os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/configure.in
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/configure.in	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,731 @@
     1.4 +#! /bin/bash -norc
     1.5 +dnl	This file is an input file used by the GNU "autoconf" program to
     1.6 +dnl	generate the file "configure", which is run during Tcl installation
     1.7 +dnl	to configure the system for the local environment.
     1.8 +#
     1.9 +# RCS: @(#) $Id: configure.in,v 1.106.2.35 2007/04/29 02:20:38 das Exp $
    1.10 +
    1.11 +AC_INIT(../generic/tcl.h)
    1.12 +AC_PREREQ(2.13)
    1.13 +
    1.14 +TCL_VERSION=8.4
    1.15 +TCL_MAJOR_VERSION=8
    1.16 +TCL_MINOR_VERSION=4
    1.17 +TCL_PATCH_LEVEL=".15"
    1.18 +VERSION=${TCL_VERSION}
    1.19 +
    1.20 +#------------------------------------------------------------------------
    1.21 +# Handle the --prefix=... option
    1.22 +#------------------------------------------------------------------------
    1.23 +
    1.24 +if test "${prefix}" = "NONE"; then
    1.25 +    prefix=/usr/local
    1.26 +fi
    1.27 +if test "${exec_prefix}" = "NONE"; then
    1.28 +    exec_prefix=$prefix
    1.29 +fi
    1.30 +# Make sure srcdir is fully qualified!
    1.31 +srcdir=`cd $srcdir ; pwd`
    1.32 +TCL_SRC_DIR=`cd $srcdir/..; pwd`
    1.33 +
    1.34 +#------------------------------------------------------------------------
    1.35 +# Compress and/or soft link the manpages?
    1.36 +#------------------------------------------------------------------------
    1.37 +
    1.38 +SC_CONFIG_MANPAGES([tcl])
    1.39 +
    1.40 +#------------------------------------------------------------------------
    1.41 +# Standard compiler checks
    1.42 +#------------------------------------------------------------------------
    1.43 +
    1.44 +# If the user did not set CFLAGS, set it now to keep
    1.45 +# the AC_PROG_CC macro from adding "-g -O2".
    1.46 +if test "${CFLAGS+set}" != "set" ; then
    1.47 +    CFLAGS=""
    1.48 +fi
    1.49 +
    1.50 +AC_PROG_CC
    1.51 +
    1.52 +#--------------------------------------------------------------------
    1.53 +# Supply substitutes for missing POSIX header files.  Special notes:
    1.54 +#	- stdlib.h doesn't define strtol, strtoul, or
    1.55 +#	  strtod insome versions of SunOS
    1.56 +#	- some versions of string.h don't declare procedures such
    1.57 +#	  as strstr
    1.58 +# Do this early, otherwise an autoconf bug throws errors on configure
    1.59 +#--------------------------------------------------------------------
    1.60 +
    1.61 +SC_MISSING_POSIX_HEADERS
    1.62 +
    1.63 +#------------------------------------------------------------------------
    1.64 +# If we're using GCC, see if the compiler understands -pipe.  If so, use it.
    1.65 +# It makes compiling go faster.  (This is only a performance feature.)
    1.66 +#------------------------------------------------------------------------
    1.67 +
    1.68 +if test -z "$no_pipe" && test -n "$GCC"; then
    1.69 +    AC_CACHE_CHECK([if the compiler understands -pipe],
    1.70 +	tcl_cv_cc_pipe, [
    1.71 +	hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
    1.72 +	AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
    1.73 +	CFLAGS=$hold_cflags])
    1.74 +    if test $tcl_cv_cc_pipe = yes; then
    1.75 +	CFLAGS="$CFLAGS -pipe"
    1.76 +    fi
    1.77 +fi
    1.78 +
    1.79 +#------------------------------------------------------------------------
    1.80 +# Threads support
    1.81 +#------------------------------------------------------------------------
    1.82 +
    1.83 +SC_ENABLE_THREADS
    1.84 +
    1.85 +#--------------------------------------------------------------------
    1.86 +# Look for libraries that we will need when compiling the Tcl shell
    1.87 +#--------------------------------------------------------------------
    1.88 +
    1.89 +SC_TCL_LINK_LIBS
    1.90 +
    1.91 +# Add the threads support libraries
    1.92 +LIBS="$LIBS$THREADS_LIBS"
    1.93 +
    1.94 +SC_ENABLE_SHARED
    1.95 +
    1.96 +#--------------------------------------------------------------------
    1.97 +# The statements below define a collection of compile flags.  This
    1.98 +# macro depends on the value of SHARED_BUILD, and should be called
    1.99 +# after SC_ENABLE_SHARED checks the configure switches.
   1.100 +#--------------------------------------------------------------------
   1.101 +
   1.102 +SC_CONFIG_CFLAGS
   1.103 +
   1.104 +SC_ENABLE_SYMBOLS
   1.105 +
   1.106 +TCL_DBGX=${DBGX}
   1.107 +
   1.108 +#--------------------------------------------------------------------
   1.109 +#	Detect what compiler flags to set for 64-bit support.
   1.110 +#--------------------------------------------------------------------
   1.111 +
   1.112 +SC_TCL_EARLY_FLAGS
   1.113 +
   1.114 +SC_TCL_64BIT_FLAGS
   1.115 +
   1.116 +#--------------------------------------------------------------------
   1.117 +#	Check endianness because we can optimize comparisons of
   1.118 +#	Tcl_UniChar strings to memcmp on big-endian systems.
   1.119 +#--------------------------------------------------------------------
   1.120 +
   1.121 +AC_C_BIGENDIAN
   1.122 +
   1.123 +#--------------------------------------------------------------------
   1.124 +#	Supply substitutes for missing POSIX library procedures, or
   1.125 +#	set flags so Tcl uses alternate procedures.
   1.126 +#--------------------------------------------------------------------
   1.127 +
   1.128 +# Check if Posix compliant getcwd exists, if not we'll use getwd.
   1.129 +AC_CHECK_FUNCS(getcwd, , [AC_DEFINE(USEGETWD)])
   1.130 +# Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really
   1.131 +# define USEGETWD even if the posix getcwd exists. Add a test ?
   1.132 +
   1.133 +AC_REPLACE_FUNCS(opendir strstr strtol strtoll strtoull tmpnam waitpid)
   1.134 +AC_CHECK_FUNC(strerror, , [AC_DEFINE(NO_STRERROR)])
   1.135 +AC_CHECK_FUNC(getwd, , [AC_DEFINE(NO_GETWD)])
   1.136 +AC_CHECK_FUNC(wait3, , [AC_DEFINE(NO_WAIT3)])
   1.137 +AC_CHECK_FUNC(uname, , [AC_DEFINE(NO_UNAME)])
   1.138 +
   1.139 +if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \
   1.140 +	test "`uname -r | awk -F. '{print [$]1}'`" -lt 7; then
   1.141 +    # prior to Darwin 7, realpath is not threadsafe, so don't
   1.142 +    # use it when threads are enabled, c.f. bug # 711232
   1.143 +    ac_cv_func_realpath=no
   1.144 +fi
   1.145 +AC_CHECK_FUNC(realpath, , [AC_DEFINE(NO_REALPATH)])
   1.146 +
   1.147 +#--------------------------------------------------------------------
   1.148 +#	Look for thread-safe variants of some library functions.
   1.149 +#--------------------------------------------------------------------
   1.150 +
   1.151 +if test "${TCL_THREADS}" = 1; then
   1.152 +    SC_TCL_GETPWUID_R
   1.153 +    SC_TCL_GETPWNAM_R
   1.154 +    SC_TCL_GETGRGID_R
   1.155 +    SC_TCL_GETGRNAM_R
   1.156 +    if test "`uname -s`" = "Darwin" && \
   1.157 +	    test "`uname -r | awk -F. '{print [$]1}'`" -gt 5; then
   1.158 +	# Starting with Darwin 6 (Mac OSX 10.2), gethostbyX 
   1.159 +	# are actually MT-safe as they always return pointers
   1.160 +	# from the TSD instead of the static storage.
   1.161 +	AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME)
   1.162 +	AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR)
   1.163 +    elif test "`uname -s`" = "HP-UX" && \
   1.164 +	      test "`uname -r|sed -e 's|B\.||' -e 's|\..*$||'`" -gt 10; then
   1.165 +        # Starting with HPUX 11.00 (we believe), gethostbyX
   1.166 +        # are actually MT-safe as they always return pointers
   1.167 +	# from TSD instead of static storage.
   1.168 +	AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME)
   1.169 +	AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR)
   1.170 +    else
   1.171 +	SC_TCL_GETHOSTBYNAME_R
   1.172 +	SC_TCL_GETHOSTBYADDR_R
   1.173 +    fi
   1.174 +fi
   1.175 +
   1.176 +#---------------------------------------------------------------------------
   1.177 +#	Determine which interface to use to talk to the serial port.
   1.178 +#	Note that #include lines must begin in leftmost column for
   1.179 +#	some compilers to recognize them as preprocessor directives.
   1.180 +#---------------------------------------------------------------------------
   1.181 +
   1.182 +SC_SERIAL_PORT
   1.183 +
   1.184 +#--------------------------------------------------------------------
   1.185 +#	Include sys/select.h if it exists and if it supplies things
   1.186 +#	that appear to be useful and aren't already in sys/types.h.
   1.187 +#	This appears to be true only on the RS/6000 under AIX.  Some
   1.188 +#	systems like OSF/1 have a sys/select.h that's of no use, and
   1.189 +#	other systems like SCO UNIX have a sys/select.h that's
   1.190 +#	pernicious.  If "fd_set" isn't defined anywhere then set a
   1.191 +#	special flag.
   1.192 +#--------------------------------------------------------------------
   1.193 +
   1.194 +AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [
   1.195 +    AC_TRY_COMPILE([#include <sys/types.h>],[fd_set readMask, writeMask;],
   1.196 +	tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)])
   1.197 +tcl_ok=$tcl_cv_type_fd_set
   1.198 +if test $tcl_ok = no; then
   1.199 +    AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [
   1.200 +	AC_EGREP_HEADER(fd_mask, sys/select.h,
   1.201 +	     tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)])
   1.202 +    if test $tcl_cv_grep_fd_mask = present; then
   1.203 +	AC_DEFINE(HAVE_SYS_SELECT_H)
   1.204 +	tcl_ok=yes
   1.205 +    fi
   1.206 +fi
   1.207 +if test $tcl_ok = no; then
   1.208 +    AC_DEFINE(NO_FD_SET)
   1.209 +fi
   1.210 +
   1.211 +#------------------------------------------------------------------------------
   1.212 +#       Find out all about time handling differences.
   1.213 +#------------------------------------------------------------------------------
   1.214 +
   1.215 +SC_TIME_HANDLER
   1.216 +
   1.217 +#--------------------------------------------------------------------
   1.218 +#	Some systems (e.g., IRIX 4.0.5) lack the st_blksize field
   1.219 +#	in struct stat.  But we might be able to use fstatfs instead.
   1.220 +#--------------------------------------------------------------------
   1.221 +AC_STRUCT_ST_BLKSIZE
   1.222 +AC_CHECK_FUNC(fstatfs, , [AC_DEFINE(NO_FSTATFS)])
   1.223 +
   1.224 +#--------------------------------------------------------------------
   1.225 +#       Some system have no memcmp or it does not work with 8 bit
   1.226 +#       data, this checks it and add memcmp.o to LIBOBJS if needed
   1.227 +#--------------------------------------------------------------------
   1.228 +AC_FUNC_MEMCMP
   1.229 +
   1.230 +#--------------------------------------------------------------------
   1.231 +#       Some system like SunOS 4 and other BSD like systems
   1.232 +#       have no memmove (we assume they have bcopy instead).
   1.233 +#       {The replacement define is in compat/string.h}
   1.234 +#--------------------------------------------------------------------
   1.235 +AC_CHECK_FUNC(memmove, , [AC_DEFINE(NO_MEMMOVE) AC_DEFINE(NO_STRING_H)])
   1.236 +
   1.237 +#--------------------------------------------------------------------
   1.238 +#	On some systems strstr is broken: it returns a pointer even
   1.239 +#	even if the original string is empty.
   1.240 +#--------------------------------------------------------------------
   1.241 +dnl only run if AC_REPLACE_FUNCS(strstr) hasn't already added strstr.o
   1.242 +if test "x${ac_cv_func_strstr}" = "xyes"; then
   1.243 +    AC_CACHE_CHECK([proper strstr implementation], tcl_cv_strstr_unbroken, [
   1.244 +	AC_TRY_RUN([
   1.245 +	extern int strstr();
   1.246 +	int main()
   1.247 +	{
   1.248 +	    exit(strstr("\0test", "test") ? 1 : 0);
   1.249 +	}], tcl_cv_strstr_unbroken=ok, tcl_cv_strstr_unbroken=broken,
   1.250 +	    tcl_cv_strstr_unbroken=broken)])
   1.251 +    if test $tcl_cv_strstr_unbroken = broken; then
   1.252 +        LIBOBJS="$LIBOBJS strstr.o"
   1.253 +    fi
   1.254 +fi
   1.255 +
   1.256 +#--------------------------------------------------------------------
   1.257 +#	Check for strtoul function.  This is tricky because under some
   1.258 +#	versions of AIX strtoul returns an incorrect terminator
   1.259 +#	pointer for the string "0".
   1.260 +#--------------------------------------------------------------------
   1.261 +
   1.262 +AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0)
   1.263 +if test $tcl_ok = 1; then
   1.264 +    AC_CACHE_CHECK([proper strtoul implementation], tcl_cv_strtoul_unbroken, [
   1.265 +	AC_TRY_RUN([
   1.266 +	extern int strtoul();
   1.267 +	int main()
   1.268 +	{
   1.269 +	    char *string = "0";
   1.270 +	    char *term;
   1.271 +	    int value;
   1.272 +	    value = strtoul(string, &term, 0);
   1.273 +	    if ((value != 0) || (term != (string+1))) {
   1.274 +		exit(1);
   1.275 +	    }
   1.276 +	    exit(0);
   1.277 +	}], tcl_cv_strtoul_unbroken=ok , tcl_cv_strtoul_unbroken=broken,
   1.278 +	    tcl_cv_strtoul_unbroken=broken)])
   1.279 +    if test $tcl_cv_strtoul_unbroken = broken; then
   1.280 +	tcl_ok=0
   1.281 +    fi
   1.282 +fi
   1.283 +if test $tcl_ok = 0; then
   1.284 +    LIBOBJS="$LIBOBJS strtoul.o"
   1.285 +fi
   1.286 +
   1.287 +#--------------------------------------------------------------------
   1.288 +#	Check for the strtod function.  This is tricky because in some
   1.289 +#	versions of Linux strtod mis-parses strings starting with "+".
   1.290 +#--------------------------------------------------------------------
   1.291 +
   1.292 +AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0)
   1.293 +if test $tcl_ok = 1; then
   1.294 +    AC_CACHE_CHECK([proper strtod implementation], tcl_cv_strtod_unbroken, [
   1.295 +	AC_TRY_RUN([
   1.296 +	extern double strtod();
   1.297 +	int main()
   1.298 +	{
   1.299 +	    char *string = " +69";
   1.300 +	    char *term;
   1.301 +	    double value;
   1.302 +	    value = strtod(string, &term);
   1.303 +	    if ((value != 69) || (term != (string+4))) {
   1.304 +		exit(1);
   1.305 +	    }
   1.306 +	    exit(0);
   1.307 +	}], tcl_cv_strtod_unbroken=ok , tcl_cv_strtod_unbroken=broken,
   1.308 +	    tcl_cv_strtod_unbroken=broken)])
   1.309 +    if test $tcl_cv_strtod_unbroken = broken; then
   1.310 +	tcl_ok=0
   1.311 +    fi
   1.312 +fi
   1.313 +if test $tcl_ok = 0; then
   1.314 +    LIBOBJS="$LIBOBJS strtod.o"
   1.315 +fi
   1.316 +
   1.317 +#--------------------------------------------------------------------
   1.318 +#	Under Solaris 2.4, strtod returns the wrong value for the
   1.319 +#	terminating character under some conditions.  Check for this
   1.320 +#	and if the problem exists use a substitute procedure
   1.321 +#	"fixstrtod" that corrects the error.
   1.322 +#--------------------------------------------------------------------
   1.323 +
   1.324 +SC_BUGGY_STRTOD
   1.325 +
   1.326 +#--------------------------------------------------------------------
   1.327 +#	Check for various typedefs and provide substitutes if
   1.328 +#	they don't exist.
   1.329 +#--------------------------------------------------------------------
   1.330 +
   1.331 +AC_TYPE_MODE_T
   1.332 +AC_TYPE_PID_T
   1.333 +AC_TYPE_SIZE_T
   1.334 +AC_TYPE_UID_T
   1.335 +
   1.336 +AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, [
   1.337 +    AC_EGREP_CPP(changequote(<<,>>)dnl
   1.338 +<<(^|[^a-zA-Z_0-9])socklen_t[^a-zA-Z_0-9]>>dnl
   1.339 +changequote([,]),[
   1.340 +    #include <sys/types.h>
   1.341 +    #include <sys/socket.h>
   1.342 +    #if STDC_HEADERS
   1.343 +    #include <stdlib.h>
   1.344 +    #include <stddef.h>
   1.345 +    #endif
   1.346 +    ], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)])
   1.347 +if test $ac_cv_type_socklen_t = no; then
   1.348 +    AC_DEFINE(socklen_t, unsigned)
   1.349 +fi
   1.350 +
   1.351 +#--------------------------------------------------------------------
   1.352 +#	If a system doesn't have an opendir function (man, that's old!)
   1.353 +#	then we have to supply a different version of dirent.h which
   1.354 +#	is compatible with the substitute version of opendir that's
   1.355 +#	provided.  This version only works with V7-style directories.
   1.356 +#--------------------------------------------------------------------
   1.357 +
   1.358 +AC_CHECK_FUNC(opendir, , [AC_DEFINE(USE_DIRENT2_H)])
   1.359 +
   1.360 +#--------------------------------------------------------------------
   1.361 +#	The check below checks whether <sys/wait.h> defines the type
   1.362 +#	"union wait" correctly.  It's needed because of weirdness in
   1.363 +#	HP-UX where "union wait" is defined in both the BSD and SYS-V
   1.364 +#	environments.  Checking the usability of WIFEXITED seems to do
   1.365 +#	the trick.
   1.366 +#--------------------------------------------------------------------
   1.367 +
   1.368 +AC_CACHE_CHECK([union wait], tcl_cv_union_wait, [
   1.369 +    AC_TRY_LINK([#include <sys/types.h> 
   1.370 +#include <sys/wait.h>], [
   1.371 +union wait x;
   1.372 +WIFEXITED(x);		/* Generates compiler error if WIFEXITED
   1.373 +			 * uses an int. */
   1.374 +    ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no)])
   1.375 +if test $tcl_cv_union_wait = no; then
   1.376 +    AC_DEFINE(NO_UNION_WAIT)
   1.377 +fi
   1.378 +
   1.379 +#--------------------------------------------------------------------
   1.380 +#	Check whether there is an strncasecmp function on this system.
   1.381 +#	This is a bit tricky because under SCO it's in -lsocket and
   1.382 +#	under Sequent Dynix it's in -linet.
   1.383 +#--------------------------------------------------------------------
   1.384 +
   1.385 +AC_CHECK_FUNC(strncasecmp, tcl_ok=1, tcl_ok=0)
   1.386 +if test "$tcl_ok" = 0; then
   1.387 +    AC_CHECK_LIB(socket, strncasecmp, tcl_ok=1, tcl_ok=0)
   1.388 +fi
   1.389 +if test "$tcl_ok" = 0; then
   1.390 +    AC_CHECK_LIB(inet, strncasecmp, tcl_ok=1, tcl_ok=0)
   1.391 +fi
   1.392 +if test "$tcl_ok" = 0; then
   1.393 +    LIBOBJS="$LIBOBJS strncasecmp.o"
   1.394 +fi
   1.395 +
   1.396 +#--------------------------------------------------------------------
   1.397 +#	The code below deals with several issues related to gettimeofday:
   1.398 +#	1. Some systems don't provide a gettimeofday function at all
   1.399 +#	   (set NO_GETTOD if this is the case).
   1.400 +#	2. SGI systems don't use the BSD form of the gettimeofday function,
   1.401 +#	   but they have a BSDgettimeofday function that can be used instead.
   1.402 +#	3. See if gettimeofday is declared in the <sys/time.h> header file.
   1.403 +#	   if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can
   1.404 +#	   declare it.
   1.405 +#--------------------------------------------------------------------
   1.406 +
   1.407 +AC_CHECK_FUNC(BSDgettimeofday,
   1.408 +    [AC_DEFINE(HAVE_BSDGETTIMEOFDAY)], [
   1.409 +    AC_CHECK_FUNC(gettimeofday, , [AC_DEFINE(NO_GETTOD)])
   1.410 +])
   1.411 +AC_CACHE_CHECK([for gettimeofday declaration], tcl_cv_grep_gettimeofday, [
   1.412 +    AC_EGREP_HEADER(gettimeofday, sys/time.h,
   1.413 +	tcl_cv_grep_gettimeofday=present, tcl_cv_grep_gettimeofday=missing)])
   1.414 +if test $tcl_cv_grep_gettimeofday = missing ; then
   1.415 +    AC_DEFINE(GETTOD_NOT_DECLARED)
   1.416 +fi
   1.417 +
   1.418 +#--------------------------------------------------------------------
   1.419 +#	The following code checks to see whether it is possible to get
   1.420 +#	signed chars on this platform.  This is needed in order to
   1.421 +#	properly generate sign-extended ints from character values.
   1.422 +#--------------------------------------------------------------------
   1.423 +
   1.424 +AC_C_CHAR_UNSIGNED
   1.425 +AC_CACHE_CHECK([signed char declarations], tcl_cv_char_signed, [
   1.426 +    AC_TRY_COMPILE(, [
   1.427 +	signed char *p;
   1.428 +	p = 0;
   1.429 +	], tcl_cv_char_signed=yes, tcl_cv_char_signed=no)])
   1.430 +if test $tcl_cv_char_signed = yes; then
   1.431 +    AC_DEFINE(HAVE_SIGNED_CHAR)
   1.432 +fi
   1.433 +
   1.434 +#--------------------------------------------------------------------
   1.435 +#  Does putenv() copy or not?  We need to know to avoid memory leaks.
   1.436 +#--------------------------------------------------------------------
   1.437 +
   1.438 +AC_CACHE_CHECK([for a putenv() that copies the buffer], tcl_cv_putenv_copy, [
   1.439 +    AC_TRY_RUN([
   1.440 +	#include <stdlib.h>
   1.441 +	#define OURVAR "havecopy=yes"
   1.442 +	int main (int argc, char *argv[])
   1.443 +	{
   1.444 +	    char *foo, *bar;
   1.445 +	    foo = (char *)strdup(OURVAR);
   1.446 +	    putenv(foo);
   1.447 +	    strcpy((char *)(strchr(foo, '=') + 1), "no");
   1.448 +	    bar = getenv("havecopy");
   1.449 +	    if (!strcmp(bar, "no")) {
   1.450 +		/* doesnt copy */
   1.451 +		return 0;
   1.452 +	    } else {
   1.453 +		/* does copy */
   1.454 +		return 1;
   1.455 +	    }
   1.456 +	}
   1.457 +    ],
   1.458 +    tcl_cv_putenv_copy=no,
   1.459 +    tcl_cv_putenv_copy=yes,
   1.460 +    tcl_cv_putenv_copy=no)])
   1.461 +if test $tcl_cv_putenv_copy = yes; then
   1.462 +    AC_DEFINE(HAVE_PUTENV_THAT_COPIES)
   1.463 +fi
   1.464 +
   1.465 +#--------------------------------------------------------------------
   1.466 +# Check for support of nl_langinfo function
   1.467 +#--------------------------------------------------------------------
   1.468 +
   1.469 +SC_ENABLE_LANGINFO
   1.470 +
   1.471 +#--------------------------------------------------------------------
   1.472 +# Darwin specific API checks and defines
   1.473 +#--------------------------------------------------------------------
   1.474 +
   1.475 +if test "`uname -s`" = "Darwin" ; then
   1.476 +    AC_CHECK_HEADERS(copyfile.h)
   1.477 +    AC_CHECK_FUNCS(copyfile)
   1.478 +    if test $tcl_corefoundation = yes; then
   1.479 +	AC_CHECK_HEADERS(libkern/OSAtomic.h)
   1.480 +	AC_CHECK_FUNCS(OSSpinLockLock)
   1.481 +	AC_CHECK_FUNCS(pthread_atfork)
   1.482 +    fi
   1.483 +    AC_DEFINE(USE_VFORK)
   1.484 +    AC_DEFINE(TCL_DEFAULT_ENCODING, "utf-8")
   1.485 +    AC_DEFINE(TCL_LOAD_FROM_MEMORY)
   1.486 +    AC_CHECK_HEADERS(AvailabilityMacros.h)
   1.487 +    if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
   1.488 +	AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [
   1.489 +	    hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
   1.490 +	    AC_TRY_LINK([
   1.491 +		    #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
   1.492 +		    #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
   1.493 +		    #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
   1.494 +		    #endif
   1.495 +		    #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
   1.496 +		    #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
   1.497 +		    #endif
   1.498 +		    int rand(void) __attribute__((weak_import));
   1.499 +		], [rand();],
   1.500 +		tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no)
   1.501 +	    CFLAGS=$hold_cflags])
   1.502 +	if test $tcl_cv_cc_weak_import = yes; then
   1.503 +	    AC_DEFINE(HAVE_WEAK_IMPORT)
   1.504 +	fi
   1.505 +    fi
   1.506 +fi
   1.507 +
   1.508 +#--------------------------------------------------------------------
   1.509 +# Check for support of fts functions (readdir replacement)
   1.510 +#--------------------------------------------------------------------
   1.511 +
   1.512 +AC_CACHE_CHECK([for fts], tcl_cv_api_fts, [
   1.513 +    AC_TRY_LINK([
   1.514 +	    #include <sys/param.h>
   1.515 +	    #include <sys/stat.h>
   1.516 +	    #include <fts.h>
   1.517 +	], [
   1.518 +	    char*const p[2] = {"/", NULL};
   1.519 +	    FTS *f = fts_open(p, FTS_PHYSICAL|FTS_NOCHDIR|FTS_NOSTAT, NULL);
   1.520 +	    FTSENT *e = fts_read(f); fts_close(f);
   1.521 +	], tcl_cv_api_fts=yes, tcl_cv_api_fts=no)])
   1.522 +if test $tcl_cv_api_fts = yes; then
   1.523 +    AC_DEFINE(HAVE_FTS)
   1.524 +fi
   1.525 +
   1.526 +#--------------------------------------------------------------------
   1.527 +#	The statements below check for systems where POSIX-style
   1.528 +#	non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. 
   1.529 +#	On these systems (mostly older ones), use the old BSD-style
   1.530 +#	FIONBIO approach instead.
   1.531 +#--------------------------------------------------------------------
   1.532 +
   1.533 +SC_BLOCKING_STYLE
   1.534 +
   1.535 +#--------------------------------------------------------------------
   1.536 +#	The statements below define a collection of symbols related to
   1.537 +#	building libtcl as a shared library instead of a static library.
   1.538 +#--------------------------------------------------------------------
   1.539 +
   1.540 +TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
   1.541 +TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
   1.542 +eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
   1.543 +
   1.544 +# tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
   1.545 +# so that the backslashes quoting the DBX braces are dropped.
   1.546 +
   1.547 +# Trick to replace DBGX with TCL_DBGX
   1.548 +DBGX='${TCL_DBGX}'
   1.549 +eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
   1.550 +
   1.551 +TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
   1.552 +PRIVATE_INCLUDE_DIR='$(includedir)'
   1.553 +HTML_DIR='$(DISTDIR)/html'
   1.554 +
   1.555 +# Note:  in the following variable, it's important to use the absolute
   1.556 +# path name of the Tcl directory rather than "..":  this is because
   1.557 +# AIX remembers this path and will attempt to use it at run-time to look
   1.558 +# up the Tcl library.
   1.559 +
   1.560 +if test "`uname -s`" = "Darwin" ; then
   1.561 +    SC_ENABLE_FRAMEWORK
   1.562 +    TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version ${TCL_VERSION}`echo ${TCL_PATCH_LEVEL} | awk ['{match($0, "\\\.[0-9]+"); print substr($0,RSTART,RLENGTH)}']`"
   1.563 +    TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000'
   1.564 +fi
   1.565 +
   1.566 +if test "$FRAMEWORK_BUILD" = "1" ; then
   1.567 +    AC_DEFINE(TCL_FRAMEWORK)
   1.568 +    tcl_config_files="${tcl_config_files} [Tcl-Info.plist:../macosx/Tcl-Info.plist.in]"
   1.569 +    # Construct a fake local framework structure to make linking with
   1.570 +    # '-framework Tcl' and running of tcltest work
   1.571 +    AC_OUTPUT_COMMANDS([test "$FRAMEWORK_BUILD" = "1" && n=Tcl &&
   1.572 +	f=$n.framework && v=Versions/$VERSION &&
   1.573 +	echo "creating $f" && rm -rf $f && mkdir -p $f/$v/Resources &&
   1.574 +	ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
   1.575 +	ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
   1.576 +	unset n f v
   1.577 +    ], [VERSION=${TCL_VERSION} FRAMEWORK_BUILD=${FRAMEWORK_BUILD}])
   1.578 +    LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
   1.579 +    if test "${libdir}" = '${exec_prefix}/lib'; then
   1.580 +        # override libdir default
   1.581 +        libdir="/Library/Frameworks"
   1.582 +    fi
   1.583 +    TCL_LIB_FILE="Tcl"
   1.584 +    TCL_LIB_FLAG="-framework Tcl"
   1.585 +    TCL_BUILD_LIB_SPEC="-F`pwd` -framework Tcl"
   1.586 +    TCL_LIB_SPEC="-F${libdir} -framework Tcl"
   1.587 +    libdir="${libdir}/Tcl.framework/Versions/\${VERSION}"
   1.588 +    TCL_LIBRARY="${libdir}/Resources/Scripts"
   1.589 +    includedir="${libdir}/Headers"
   1.590 +    PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
   1.591 +    HTML_DIR="${libdir}/Resources/Documentation/Reference/Tcl"
   1.592 +    EXTRA_INSTALL="install-private-headers html-tcl"
   1.593 +    EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TclTOC.html' 
   1.594 +    EXTRA_INSTALL_BINARIES='@echo "Installing Info.plist to $(LIB_INSTALL_DIR)/Resources" && mkdir -p "$(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) Tcl-Info.plist "$(LIB_INSTALL_DIR)/Resources/Info.plist"'
   1.595 +    EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Installing license.terms to $(LIB_INSTALL_DIR)/Resources" && $(INSTALL_DATA) "$(TOP_DIR)/license.terms" "$(LIB_INSTALL_DIR)/Resources"'
   1.596 +    EXTRA_INSTALL_BINARIES="$EXTRA_INSTALL_BINARIES"' && echo "Finalizing Tcl.framework" && rm -f "$(LIB_INSTALL_DIR)/../Current" && ln -s "$(VERSION)" "$(LIB_INSTALL_DIR)/../Current" && for f in "$(LIB_FILE)" tclConfig.sh Resources Headers PrivateHeaders; do rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/Current/$$f" "$(LIB_INSTALL_DIR)/../.."; done && f="$(STUB_LIB_FILE)" && rm -f "$(LIB_INSTALL_DIR)/../../$$f" && ln -s "Versions/$(VERSION)/$$f" "$(LIB_INSTALL_DIR)/../.."'
   1.597 +    TCL_YEAR="`date +%Y`"
   1.598 +    # Don't use AC_DEFINE for the following as the framework version define 
   1.599 +    # needs to go into the Makefile even when using autoheader, so that we  
   1.600 +    # can pick up a potential make override of VERSION. Also, don't put this
   1.601 +    # into CFLAGS as it should not go into tclConfig.sh
   1.602 +    EXTRA_CC_SWITCHES='-DTCL_FRAMEWORK_VERSION=\"$(VERSION)\"'
   1.603 +else
   1.604 +    # libdir must be a fully qualified path and not ${exec_prefix}/lib
   1.605 +    eval libdir="$libdir"
   1.606 +    if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
   1.607 +        if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
   1.608 +            TCL_LIB_FLAG="-ltcl${TCL_VERSION}\${TCL_DBGX}"
   1.609 +        else
   1.610 +            TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
   1.611 +        fi
   1.612 +        TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
   1.613 +        TCL_LIB_SPEC="-L${libdir} ${TCL_LIB_FLAG}"
   1.614 +    else
   1.615 +        TCL_BUILD_EXP_FILE="lib.exp"
   1.616 +        eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
   1.617 +    
   1.618 +        # Replace DBGX with TCL_DBGX
   1.619 +        eval "TCL_EXP_FILE=\"${TCL_EXP_FILE}\""
   1.620 +        
   1.621 +        if test "$GCC" = "yes" ; then
   1.622 +            TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`"
   1.623 +            TCL_LIB_SPEC="-Wl,-bI:${libdir}/${TCL_EXP_FILE} -L`pwd`"
   1.624 +        else
   1.625 +            TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}"
   1.626 +            TCL_LIB_SPEC="-bI:${libdir}/${TCL_EXP_FILE}"
   1.627 +        fi
   1.628 +    fi
   1.629 +fi
   1.630 +VERSION='${VERSION}'
   1.631 +eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
   1.632 +eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
   1.633 +eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
   1.634 +VERSION=${TCL_VERSION}
   1.635 +
   1.636 +#--------------------------------------------------------------------
   1.637 +#	The statements below define the symbol TCL_PACKAGE_PATH, which
   1.638 +#	gives a list of directories that may contain packages.  The list
   1.639 +#	consists of one directory for machine-dependent binaries and
   1.640 +#	another for platform-independent scripts.
   1.641 +#--------------------------------------------------------------------
   1.642 +
   1.643 +if test "$FRAMEWORK_BUILD" = "1" ; then
   1.644 +    TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks"
   1.645 +elif test "$prefix" != "$exec_prefix"; then
   1.646 +    TCL_PACKAGE_PATH="${libdir} ${prefix}/lib"
   1.647 +else
   1.648 +    TCL_PACKAGE_PATH="${prefix}/lib"
   1.649 +fi
   1.650 +
   1.651 +#--------------------------------------------------------------------
   1.652 +#       The statements below define various symbols relating to Tcl
   1.653 +#       stub support.
   1.654 +#--------------------------------------------------------------------
   1.655 +
   1.656 +# Replace ${VERSION} with contents of ${TCL_VERSION}
   1.657 +eval "TCL_STUB_LIB_FILE=libtclstub${TCL_UNSHARED_LIB_SUFFIX}"
   1.658 +# Replace DBGX with TCL_DBGX
   1.659 +eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
   1.660 +eval "TCL_STUB_LIB_DIR=${libdir}"
   1.661 +
   1.662 +if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
   1.663 +    TCL_STUB_LIB_FLAG="-ltclstub${TCL_VERSION}\${TCL_DBGX}"
   1.664 +else
   1.665 +    TCL_STUB_LIB_FLAG="-ltclstub`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
   1.666 +fi
   1.667 +
   1.668 +TCL_BUILD_STUB_LIB_SPEC="-L`pwd` ${TCL_STUB_LIB_FLAG}"
   1.669 +TCL_STUB_LIB_SPEC="-L${TCL_STUB_LIB_DIR} ${TCL_STUB_LIB_FLAG}"
   1.670 +TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}"
   1.671 +TCL_STUB_LIB_PATH="${TCL_STUB_LIB_DIR}/${TCL_STUB_LIB_FILE}"
   1.672 +
   1.673 +# Install time header dir can be set via --includedir
   1.674 +eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
   1.675 +
   1.676 +#------------------------------------------------------------------------
   1.677 +# tclConfig.sh refers to this by a different name
   1.678 +#------------------------------------------------------------------------
   1.679 +
   1.680 +TCL_SHARED_BUILD=${SHARED_BUILD}
   1.681 +
   1.682 +AC_SUBST(TCL_VERSION)
   1.683 +AC_SUBST(TCL_MAJOR_VERSION)
   1.684 +AC_SUBST(TCL_MINOR_VERSION)
   1.685 +AC_SUBST(TCL_PATCH_LEVEL)
   1.686 +AC_SUBST(TCL_YEAR)
   1.687 +
   1.688 +AC_SUBST(TCL_LIB_FILE)
   1.689 +AC_SUBST(TCL_LIB_FLAG)
   1.690 +AC_SUBST(TCL_LIB_SPEC)
   1.691 +AC_SUBST(TCL_STUB_LIB_FILE)
   1.692 +AC_SUBST(TCL_STUB_LIB_FLAG)
   1.693 +AC_SUBST(TCL_STUB_LIB_SPEC)
   1.694 +AC_SUBST(TCL_STUB_LIB_PATH)
   1.695 +AC_SUBST(TCL_INCLUDE_SPEC)
   1.696 +AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
   1.697 +AC_SUBST(TCL_BUILD_STUB_LIB_PATH)
   1.698 +
   1.699 +AC_SUBST(TCL_SRC_DIR)
   1.700 +AC_SUBST(TCL_DBGX)
   1.701 +AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
   1.702 +AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
   1.703 +AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
   1.704 +
   1.705 +AC_SUBST(TCL_SHARED_BUILD)
   1.706 +AC_SUBST(LD_LIBRARY_PATH_VAR)
   1.707 +
   1.708 +AC_SUBST(TCL_BUILD_LIB_SPEC)
   1.709 +AC_SUBST(TCL_NEEDS_EXP_FILE)
   1.710 +AC_SUBST(TCL_BUILD_EXP_FILE)
   1.711 +AC_SUBST(TCL_EXP_FILE)
   1.712 +
   1.713 +AC_SUBST(TCL_LIB_VERSIONS_OK)
   1.714 +AC_SUBST(TCL_SHARED_LIB_SUFFIX)
   1.715 +AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
   1.716 +
   1.717 +AC_SUBST(TCL_HAS_LONGLONG)
   1.718 +
   1.719 +AC_SUBST(BUILD_DLTEST)
   1.720 +AC_SUBST(TCL_PACKAGE_PATH)
   1.721 +
   1.722 +AC_SUBST(TCL_LIBRARY)
   1.723 +AC_SUBST(PRIVATE_INCLUDE_DIR)
   1.724 +AC_SUBST(HTML_DIR)
   1.725 +
   1.726 +AC_SUBST(EXTRA_CC_SWITCHES)
   1.727 +AC_SUBST(EXTRA_INSTALL)
   1.728 +AC_SUBST(EXTRA_INSTALL_BINARIES)
   1.729 +AC_SUBST(EXTRA_BUILD_HTML)
   1.730 +
   1.731 +SC_OUTPUT_COMMANDS_PRE
   1.732 +
   1.733 +tcl_config_files="${tcl_config_files} [Makefile dltest/Makefile tclConfig.sh]"
   1.734 +AC_OUTPUT([${tcl_config_files}])