summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclEnv.c7
-rwxr-xr-xunix/configure230
-rw-r--r--unix/configure.in36
-rw-r--r--win/tclWinPort.h10
4 files changed, 194 insertions, 89 deletions
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 6e3b106..75f5eab 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEnv.c,v 1.16 2002/08/05 03:24:40 dgp Exp $
+ * RCS: @(#) $Id: tclEnv.c,v 1.17 2002/08/28 22:48:10 davygrvy Exp $
*/
#include "tclInt.h"
@@ -275,6 +275,11 @@ TclSetEnv(name, value)
if ((index != -1) && (environ[index] == p)) {
ReplaceString(oldValue, p);
+#ifdef HAVE_PUTENV_THAT_COPIES
+ } else {
+ /* This putenv() copies instead of taking ownership */
+ ckfree(p);
+#endif
}
Tcl_MutexUnlock(&envMutex);
diff --git a/unix/configure b/unix/configure
index aa3c3ea..d7a92ec 100755
--- a/unix/configure
+++ b/unix/configure
@@ -4720,6 +4720,64 @@ EOF
fi
#--------------------------------------------------------------------
+# Does putenv() copy or not? We need to know to avoid memory leaks.
+#--------------------------------------------------------------------
+
+echo $ac_n "checking for a putenv() that copies the buffer""... $ac_c" 1>&6
+echo "configure:4728: checking for a putenv() that copies the buffer" >&5
+if eval "test \"`echo '$''{'tcl_cv_putenv_copy'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ tcl_cv_putenv_copy=no
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4736 "configure"
+#include "confdefs.h"
+
+ #include <stdlib.h>
+ #define OURVAR "havecopy=yes"
+ int main (int argc, char *argv)
+ {
+ char *foo, *bar;
+ foo = (char *)strdup(OURVAR);
+ putenv(foo);
+ strcpy((char *)(strchr(foo, '=') + 1), "no");
+ bar = getenv("havecopy");
+ if (!strcmp(bar, "no")) {
+ /* doesn't copy */
+ return 0;
+ } else {
+ /* does copy */
+ return 1;
+ }
+ }
+
+EOF
+if { (eval echo configure:4758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+ tcl_cv_putenv_copy=no
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ tcl_cv_putenv_copy=yes
+fi
+rm -fr conftest*
+fi
+
+
+fi
+
+echo "$ac_t""$tcl_cv_putenv_copy" 1>&6
+if test $tcl_cv_putenv_copy = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_PUTENV_THAT_COPIES 1
+EOF
+
+fi
+
+#--------------------------------------------------------------------
# Check for support of nl_langinfo function
#--------------------------------------------------------------------
@@ -4738,17 +4796,17 @@ fi
if test "$langinfo_ok" = "yes"; then
ac_safe=`echo "langinfo.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for langinfo.h""... $ac_c" 1>&6
-echo "configure:4742: checking for langinfo.h" >&5
+echo "configure:4800: checking for langinfo.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4747 "configure"
+#line 4805 "configure"
#include "confdefs.h"
#include <langinfo.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4810: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4773,17 +4831,17 @@ fi
fi
fi
echo $ac_n "checking whether to use nl_langinfo""... $ac_c" 1>&6
-echo "configure:4777: checking whether to use nl_langinfo" >&5
+echo "configure:4835: checking whether to use nl_langinfo" >&5
if test "$langinfo_ok" = "yes"; then
cat > conftest.$ac_ext <<EOF
-#line 4780 "configure"
+#line 4838 "configure"
#include "confdefs.h"
#include <langinfo.h>
int main() {
nl_langinfo(CODESET);
; return 0; }
EOF
-if { (eval echo configure:4787: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
langinfo_ok=yes
else
@@ -4819,12 +4877,12 @@ EOF
#--------------------------------------------------------------------
echo $ac_n "checking for sin""... $ac_c" 1>&6
-echo "configure:4823: checking for sin" >&5
+echo "configure:4881: checking for sin" >&5
if eval "test \"`echo '$''{'ac_cv_func_sin'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4828 "configure"
+#line 4886 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char sin(); below. */
@@ -4847,7 +4905,7 @@ sin();
; return 0; }
EOF
-if { (eval echo configure:4851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_sin=yes"
else
@@ -4868,7 +4926,7 @@ MATH_LIBS="-lm"
fi
echo $ac_n "checking for main in -lieee""... $ac_c" 1>&6
-echo "configure:4872: checking for main in -lieee" >&5
+echo "configure:4930: checking for main in -lieee" >&5
ac_lib_var=`echo ieee'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4876,14 +4934,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lieee $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4880 "configure"
+#line 4938 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4910,7 +4968,7 @@ fi
#--------------------------------------------------------------------
echo $ac_n "checking for main in -linet""... $ac_c" 1>&6
-echo "configure:4914: checking for main in -linet" >&5
+echo "configure:4972: checking for main in -linet" >&5
ac_lib_var=`echo inet'_'main | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -4918,14 +4976,14 @@ else
ac_save_LIBS="$LIBS"
LIBS="-linet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4922 "configure"
+#line 4980 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:4929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -4947,17 +5005,17 @@ fi
ac_safe=`echo "net/errno.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for net/errno.h""... $ac_c" 1>&6
-echo "configure:4951: checking for net/errno.h" >&5
+echo "configure:5009: checking for net/errno.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4956 "configure"
+#line 5014 "configure"
#include "confdefs.h"
#include <net/errno.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4961: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5019: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5002,12 +5060,12 @@ fi
tcl_checkBoth=0
echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:5006: checking for connect" >&5
+echo "configure:5064: checking for connect" >&5
if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5011 "configure"
+#line 5069 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char connect(); below. */
@@ -5030,7 +5088,7 @@ connect();
; return 0; }
EOF
-if { (eval echo configure:5034: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_connect=yes"
else
@@ -5052,12 +5110,12 @@ fi
if test "$tcl_checkSocket" = 1; then
echo $ac_n "checking for setsockopt""... $ac_c" 1>&6
-echo "configure:5056: checking for setsockopt" >&5
+echo "configure:5114: checking for setsockopt" >&5
if eval "test \"`echo '$''{'ac_cv_func_setsockopt'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5061 "configure"
+#line 5119 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char setsockopt(); below. */
@@ -5080,7 +5138,7 @@ setsockopt();
; return 0; }
EOF
-if { (eval echo configure:5084: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_setsockopt=yes"
else
@@ -5098,7 +5156,7 @@ if eval "test \"`echo '$ac_cv_func_'setsockopt`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for setsockopt in -lsocket""... $ac_c" 1>&6
-echo "configure:5102: checking for setsockopt in -lsocket" >&5
+echo "configure:5160: checking for setsockopt in -lsocket" >&5
ac_lib_var=`echo socket'_'setsockopt | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5106,7 +5164,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5110 "configure"
+#line 5168 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5117,7 +5175,7 @@ int main() {
setsockopt()
; return 0; }
EOF
-if { (eval echo configure:5121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5145,12 +5203,12 @@ fi
tk_oldLibs=$LIBS
LIBS="$LIBS -lsocket -lnsl"
echo $ac_n "checking for accept""... $ac_c" 1>&6
-echo "configure:5149: checking for accept" >&5
+echo "configure:5207: checking for accept" >&5
if eval "test \"`echo '$''{'ac_cv_func_accept'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5154 "configure"
+#line 5212 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char accept(); below. */
@@ -5173,7 +5231,7 @@ accept();
; return 0; }
EOF
-if { (eval echo configure:5177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_accept=yes"
else
@@ -5195,12 +5253,12 @@ fi
fi
echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:5199: checking for gethostbyname" >&5
+echo "configure:5257: checking for gethostbyname" >&5
if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5204 "configure"
+#line 5262 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gethostbyname(); below. */
@@ -5223,7 +5281,7 @@ gethostbyname();
; return 0; }
EOF
-if { (eval echo configure:5227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_gethostbyname=yes"
else
@@ -5241,7 +5299,7 @@ if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:5245: checking for gethostbyname in -lnsl" >&5
+echo "configure:5303: checking for gethostbyname in -lnsl" >&5
ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5249,7 +5307,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5253 "configure"
+#line 5311 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5260,7 +5318,7 @@ int main() {
gethostbyname()
; return 0; }
EOF
-if { (eval echo configure:5264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5297,7 +5355,7 @@ LIBS="$LIBS$THREADS_LIBS"
echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
-echo "configure:5301: checking how to build libraries" >&5
+echo "configure:5359: checking how to build libraries" >&5
# Check whether --enable-shared or --disable-shared was given.
if test "${enable_shared+set}" = set; then
enableval="$enable_shared"
@@ -5336,7 +5394,7 @@ EOF
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5340: checking for $ac_word" >&5
+echo "configure:5398: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5368,7 +5426,7 @@ fi
# Step 0.a: Enable 64 bit support?
echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
-echo "configure:5372: checking if 64bit support is requested" >&5
+echo "configure:5430: checking if 64bit support is requested" >&5
# Check whether --enable-64bit or --disable-64bit was given.
if test "${enable_64bit+set}" = set; then
enableval="$enable_64bit"
@@ -5388,7 +5446,7 @@ fi
# Step 0.b: Enable Solaris 64 bit VIS support?
echo $ac_n "checking if 64bit Sparc VIS support is requested""... $ac_c" 1>&6
-echo "configure:5392: checking if 64bit Sparc VIS support is requested" >&5
+echo "configure:5450: checking if 64bit Sparc VIS support is requested" >&5
# Check whether --enable-64bit-vis or --disable-64bit-vis was given.
if test "${enable_64bit_vis+set}" = set; then
enableval="$enable_64bit_vis"
@@ -5412,7 +5470,7 @@ fi
# there are a few systems, like Next, where this doesn't work.
echo $ac_n "checking system version (for dynamic loading)""... $ac_c" 1>&6
-echo "configure:5416: checking system version (for dynamic loading)" >&5
+echo "configure:5474: checking system version (for dynamic loading)" >&5
if test -f /usr/lib/NextStep/software_version; then
system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
else
@@ -5438,7 +5496,7 @@ echo "configure:5416: checking system version (for dynamic loading)" >&5
# Linux can use either -ldl or -ldld for dynamic loading.
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5442: checking for dlopen in -ldl" >&5
+echo "configure:5500: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5446,7 +5504,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5450 "configure"
+#line 5508 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5457,7 +5515,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:5461: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5519: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5501,7 +5559,7 @@ fi
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5505: checking for $ac_word" >&5
+echo "configure:5563: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5610,7 +5668,7 @@ fi
# known GMT value.
echo $ac_n "checking for gettimeofday in -lbsd""... $ac_c" 1>&6
-echo "configure:5614: checking for gettimeofday in -lbsd" >&5
+echo "configure:5672: checking for gettimeofday in -lbsd" >&5
ac_lib_var=`echo bsd'_'gettimeofday | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5618,7 +5676,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lbsd $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5622 "configure"
+#line 5680 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5629,7 +5687,7 @@ int main() {
gettimeofday()
; return 0; }
EOF
-if { (eval echo configure:5633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5711,7 +5769,7 @@ EOF
SHLIB_SUFFIX=".sl"
echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:5715: checking for shl_load in -ldld" >&5
+echo "configure:5773: checking for shl_load in -ldld" >&5
ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5719,7 +5777,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5723 "configure"
+#line 5781 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5730,7 +5788,7 @@ int main() {
shl_load()
; return 0; }
EOF
-if { (eval echo configure:5734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5776,7 +5834,7 @@ fi
HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
SHLIB_SUFFIX=".sl"
echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:5780: checking for shl_load in -ldld" >&5
+echo "configure:5838: checking for shl_load in -ldld" >&5
ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5784,7 +5842,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldld $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5788 "configure"
+#line 5846 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5795,7 +5853,7 @@ int main() {
shl_load()
; return 0; }
EOF
-if { (eval echo configure:5799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5922,17 +5980,17 @@ fi
else
ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:5926: checking for dld.h" >&5
+echo "configure:5984: checking for dld.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5931 "configure"
+#line 5989 "configure"
#include "confdefs.h"
#include <dld.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5991,17 +6049,17 @@ fi
else
ac_safe=`echo "dld.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dld.h""... $ac_c" 1>&6
-echo "configure:5995: checking for dld.h" >&5
+echo "configure:6053: checking for dld.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6000 "configure"
+#line 6058 "configure"
#include "confdefs.h"
#include <dld.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -6059,17 +6117,17 @@ fi
# Not available on all versions: check for include file.
ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:6063: checking for dlfcn.h" >&5
+echo "configure:6121: checking for dlfcn.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6068 "configure"
+#line 6126 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -6097,9 +6155,9 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
echo $ac_n "checking for ELF""... $ac_c" 1>&6
-echo "configure:6101: checking for ELF" >&5
+echo "configure:6159: checking for ELF" >&5
cat > conftest.$ac_ext <<EOF
-#line 6103 "configure"
+#line 6161 "configure"
#include "confdefs.h"
#ifdef __ELF__
@@ -6449,17 +6507,17 @@ EOF
# that don't grok the -Bexport option. Test that it does.
hold_ldflags=$LDFLAGS
echo $ac_n "checking for ld accepts -Bexport flag""... $ac_c" 1>&6
-echo "configure:6453: checking for ld accepts -Bexport flag" >&5
+echo "configure:6511: checking for ld accepts -Bexport flag" >&5
LDFLAGS="${LDFLAGS} -Wl,-Bexport"
cat > conftest.$ac_ext <<EOF
-#line 6456 "configure"
+#line 6514 "configure"
#include "confdefs.h"
int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:6463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:6521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
found=yes
else
@@ -6506,9 +6564,9 @@ rm -f conftest*
if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
echo $ac_n "checking sys/exec.h""... $ac_c" 1>&6
-echo "configure:6510: checking sys/exec.h" >&5
+echo "configure:6568: checking sys/exec.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6512 "configure"
+#line 6570 "configure"
#include "confdefs.h"
#include <sys/exec.h>
int main() {
@@ -6526,7 +6584,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:6530: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6588: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
tcl_ok=usable
else
@@ -6544,9 +6602,9 @@ EOF
else
echo $ac_n "checking a.out.h""... $ac_c" 1>&6
-echo "configure:6548: checking a.out.h" >&5
+echo "configure:6606: checking a.out.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6550 "configure"
+#line 6608 "configure"
#include "confdefs.h"
#include <a.out.h>
int main() {
@@ -6564,7 +6622,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:6568: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6626: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
tcl_ok=usable
else
@@ -6582,9 +6640,9 @@ EOF
else
echo $ac_n "checking sys/exec_aout.h""... $ac_c" 1>&6
-echo "configure:6586: checking sys/exec_aout.h" >&5
+echo "configure:6644: checking sys/exec_aout.h" >&5
cat > conftest.$ac_ext <<EOF
-#line 6588 "configure"
+#line 6646 "configure"
#include "confdefs.h"
#include <sys/exec_aout.h>
int main() {
@@ -6602,7 +6660,7 @@ int main() {
; return 0; }
EOF
-if { (eval echo configure:6606: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6664: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
tcl_ok=usable
else
@@ -6752,7 +6810,7 @@ fi
echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:6756: checking for build with symbols" >&5
+echo "configure:6814: checking for build with symbols" >&5
# Check whether --enable-symbols or --disable-symbols was given.
if test "${enable_symbols+set}" = set; then
enableval="$enable_symbols"
@@ -6778,7 +6836,7 @@ fi
echo $ac_n "checking for build with memory debugging""... $ac_c" 1>&6
-echo "configure:6782: checking for build with memory debugging" >&5
+echo "configure:6840: checking for build with memory debugging" >&5
# Check whether --enable-memdebug or --disable-memdebug was given.
if test "${enable_memdebug+set}" = set; then
enableval="$enable_memdebug"
@@ -6811,17 +6869,17 @@ TCL_DBGX=${DBGX}
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6815: checking for $ac_hdr" >&5
+echo "configure:6873: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6820 "configure"
+#line 6878 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6883: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -6851,17 +6909,17 @@ done
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6855: checking for $ac_hdr" >&5
+echo "configure:6913: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 6860 "configure"
+#line 6918 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6865: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6923: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -6888,7 +6946,7 @@ fi
done
echo $ac_n "checking FIONBIO vs. O_NONBLOCK for nonblocking I/O""... $ac_c" 1>&6
-echo "configure:6892: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5
+echo "configure:6950: checking FIONBIO vs. O_NONBLOCK for nonblocking I/O" >&5
if test -f /usr/lib/NextStep/software_version; then
system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
else
diff --git a/unix/configure.in b/unix/configure.in
index e141949..b1d6918 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl installation
dnl to configure the system for the local environment.
#
-# RCS: @(#) $Id: configure.in,v 1.99 2002/08/28 08:47:47 dkf Exp $
+# RCS: @(#) $Id: configure.in,v 1.100 2002/08/28 22:48:39 davygrvy Exp $
AC_INIT(../generic/tcl.h)
AC_PREREQ(2.13)
@@ -373,6 +373,40 @@ if test $tcl_cv_char_signed = yes; then
fi
#--------------------------------------------------------------------
+# Does putenv() copy or not? We need to know to avoid memory leaks.
+#--------------------------------------------------------------------
+
+AC_MSG_CHECKING([for a putenv() that copies the buffer])
+AC_CACHE_VAL(tcl_cv_putenv_copy,
+ AC_TRY_RUN([
+ #include <stdlib.h>
+ #define OURVAR "havecopy=yes"
+ int main (int argc, char *argv[])
+ {
+ char *foo, *bar;
+ foo = (char *)strdup(OURVAR);
+ putenv(foo);
+ strcpy((char *)(strchr(foo, '=') + 1), "no");
+ bar = getenv("havecopy");
+ if (!strcmp(bar, "no")) {
+ /* doesn't copy */
+ return 0;
+ } else {
+ /* does copy */
+ return 1;
+ }
+ }
+ ],
+ tcl_cv_putenv_copy=no,
+ tcl_cv_putenv_copy=yes,
+ tcl_cv_putenv_copy=no)
+)
+AC_MSG_RESULT($tcl_cv_putenv_copy)
+if test $tcl_cv_putenv_copy = yes; then
+ AC_DEFINE(HAVE_PUTENV_THAT_COPIES)
+fi
+
+#--------------------------------------------------------------------
# Check for support of nl_langinfo function
#--------------------------------------------------------------------
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index 845c217..a616f22 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinPort.h,v 1.32 2002/08/01 13:05:31 rmax Exp $
+ * RCS: @(#) $Id: tclWinPort.h,v 1.33 2002/08/28 22:48:48 davygrvy Exp $
*/
#ifndef _TCLWINPORT
@@ -421,6 +421,14 @@
#define USE_PUTENV 1
/*
+ * Msvcrt's putenv() copies the string rather than takes ownership of it.
+ */
+
+#if defined(_MSC_VER) || defined(__MINGW32__)
+# define HAVE_PUTENV_THAT_COPIES 1
+#endif
+
+/*
* The following defines wrap the system memory allocation routines for
* use by tclAlloc.c.
*/