handle putenv arg constness in configure
This commit is contained in:
parent
6ed2673331
commit
94b6fa9dd5
@ -24,3 +24,5 @@
|
|||||||
/* iconv parameter 2 is const char** */
|
/* iconv parameter 2 is const char** */
|
||||||
#undef RCL_ICONV_INBUF_CONST
|
#undef RCL_ICONV_INBUF_CONST
|
||||||
|
|
||||||
|
/* putenv parameter is const */
|
||||||
|
#undef PUTENV_ARG_CONST
|
||||||
|
|||||||
60
src/configure
vendored
60
src/configure
vendored
@ -2341,6 +2341,66 @@ _ACEOF
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
echo "$as_me:$LINENO: checking for type of string parameter to putenv" >&5
|
||||||
|
echo $ECHO_N "checking for type of string parameter to putenv... $ECHO_C" >&6
|
||||||
|
cat >conftest.$ac_ext <<_ACEOF
|
||||||
|
/* confdefs.h. */
|
||||||
|
_ACEOF
|
||||||
|
cat confdefs.h >>conftest.$ac_ext
|
||||||
|
cat >>conftest.$ac_ext <<_ACEOF
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
|
||||||
|
putenv((const char *)0);
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
rm -f conftest.$ac_objext
|
||||||
|
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||||
|
(eval $ac_compile) 2>conftest.er1
|
||||||
|
ac_status=$?
|
||||||
|
grep -v '^ *+' conftest.er1 >conftest.err
|
||||||
|
rm -f conftest.er1
|
||||||
|
cat conftest.err >&5
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); } &&
|
||||||
|
{ ac_try='test -z "$ac_cxx_werror_flag"
|
||||||
|
|| test ! -s conftest.err'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; } &&
|
||||||
|
{ ac_try='test -s conftest.$ac_objext'
|
||||||
|
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||||
|
(eval $ac_try) 2>&5
|
||||||
|
ac_status=$?
|
||||||
|
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||||
|
(exit $ac_status); }; }; then
|
||||||
|
rcl_putenv_string_const="1"
|
||||||
|
else
|
||||||
|
echo "$as_me: failed program was:" >&5
|
||||||
|
sed 's/^/| /' conftest.$ac_ext >&5
|
||||||
|
|
||||||
|
rcl_putenv_string_const="0"
|
||||||
|
fi
|
||||||
|
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||||
|
if test X$rcl_putenv_string_const = X1 ; then
|
||||||
|
|
||||||
|
cat >>confdefs.h <<\_ACEOF
|
||||||
|
#define PUTENV_ARG_CONST 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
#### Look for Xapian
|
#### Look for Xapian
|
||||||
# Extract the first word of "xapian-config", so it can be a program name with args.
|
# Extract the first word of "xapian-config", so it can be a program name with args.
|
||||||
set dummy xapian-config; ac_word=$2
|
set dummy xapian-config; ac_word=$2
|
||||||
|
|||||||
@ -155,6 +155,17 @@ if test X$rcl_iconv_inbuf_const = X1 ; then
|
|||||||
AC_DEFINE(RCL_ICONV_INBUF_CONST, 1, [iconv parameter 2 is const char**])
|
AC_DEFINE(RCL_ICONV_INBUF_CONST, 1, [iconv parameter 2 is const char**])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
AC_MSG_CHECKING(for type of string parameter to putenv)
|
||||||
|
AC_TRY_COMPILE([
|
||||||
|
#include <stdlib.h>
|
||||||
|
],[
|
||||||
|
putenv((const char *)0);
|
||||||
|
], rcl_putenv_string_const="1", rcl_putenv_string_const="0")
|
||||||
|
if test X$rcl_putenv_string_const = X1 ; then
|
||||||
|
AC_DEFINE(PUTENV_ARG_CONST, 1, [putenv parameter is const])
|
||||||
|
fi
|
||||||
|
|
||||||
#### Look for Xapian
|
#### Look for Xapian
|
||||||
AC_PATH_PROG(XAPIAN_CONFIG, xapian-config, no)
|
AC_PATH_PROG(XAPIAN_CONFIG, xapian-config, no)
|
||||||
if test "$XAPIAN_CONFIG" = "no" ; then
|
if test "$XAPIAN_CONFIG" = "no" ; then
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
include $(depth)/mk/commondefs
|
include $(depth)/mk/commondefs
|
||||||
include $(depth)/mk/localdefs
|
include $(depth)/mk/localdefs
|
||||||
|
|
||||||
ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
|
ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS)
|
||||||
-DPUTENV_ARG_NOT_CONST
|
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
|
|||||||
@ -2,7 +2,6 @@ include $(depth)/mk/commondefs
|
|||||||
include $(depth)/mk/localdefs
|
include $(depth)/mk/localdefs
|
||||||
|
|
||||||
ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
|
ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
|
||||||
-DPUTENV_ARG_NOT_CONST \
|
|
||||||
-DHAVE_VASPRINTF=1 \
|
-DHAVE_VASPRINTF=1 \
|
||||||
-DHAVE_MKDTEMP=1 \
|
-DHAVE_MKDTEMP=1 \
|
||||||
-DSTATFS_INCLUDE="<sys/mount.h>"
|
-DSTATFS_INCLUDE="<sys/mount.h>"
|
||||||
|
|||||||
@ -4,7 +4,6 @@ include $(depth)/mk/localdefs
|
|||||||
|
|
||||||
ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
|
ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
|
||||||
-D_GNU_SOURCE \
|
-D_GNU_SOURCE \
|
||||||
-DPUTENV_ARG_NOT_CONST \
|
|
||||||
-DHAVE_VASPRINTF=1 \
|
-DHAVE_VASPRINTF=1 \
|
||||||
-DHAVE_MKDTEMP=1
|
-DHAVE_MKDTEMP=1
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
include $(depth)/mk/commondefs
|
include $(depth)/mk/commondefs
|
||||||
include $(depth)/mk/localdefs
|
include $(depth)/mk/localdefs
|
||||||
|
|
||||||
ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS) \
|
ALL_CXXFLAGS = $(CXXFLAGS) $(COMMONCXXFLAGS) $(LOCALCXXFLAGS)
|
||||||
-DPUTENV_ARG_NOT_CONST
|
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
CXX = g++
|
CXX = g++
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.24 2007-05-23 08:28:35 dockes Exp $ (C) 2004 J.F.Dockes";
|
static char rcsid[] = "@(#$Id: execmd.cpp,v 1.25 2007-07-14 16:53:00 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -18,6 +18,9 @@ static char rcsid[] = "@(#$Id: execmd.cpp,v 1.24 2007-05-23 08:28:35 dockes Exp
|
|||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
#ifndef TEST_EXECMD
|
#ifndef TEST_EXECMD
|
||||||
|
#include "autoconfig.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -27,7 +30,7 @@ static char rcsid[] = "@(#$Id: execmd.cpp,v 1.24 2007-05-23 08:28:35 dockes Exp
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#ifdef PUTENV_ARG_NOT_CONST
|
#if !defined(PUTENV_ARG_CONST)
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -360,10 +363,10 @@ int ExecCmd::doexec(const string &cmd, const list<string>& args,
|
|||||||
|
|
||||||
for (vector<string>::const_iterator it = m_env.begin();
|
for (vector<string>::const_iterator it = m_env.begin();
|
||||||
it != m_env.end(); it++) {
|
it != m_env.end(); it++) {
|
||||||
#ifdef PUTENV_ARG_NOT_CONST
|
#ifdef PUTENV_ARG_CONST
|
||||||
::putenv(strdup(it->c_str()));
|
|
||||||
#else
|
|
||||||
::putenv(it->c_str());
|
::putenv(it->c_str());
|
||||||
|
#else
|
||||||
|
::putenv(strdup(it->c_str()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
execvp(cmd.c_str(), (char *const*)argv);
|
execvp(cmd.c_str(), (char *const*)argv);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user