os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/unix/configure.in
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 #! /bin/bash -norc
     2 dnl	This file is an input file used by the GNU "autoconf" program to
     3 dnl	generate the file "configure", which is run during Tcl installation
     4 dnl	to configure the system for the local environment.
     5 #
     6 # RCS: @(#) $Id: configure.in,v 1.106.2.35 2007/04/29 02:20:38 das Exp $
     7 
     8 AC_INIT(../generic/tcl.h)
     9 AC_PREREQ(2.13)
    10 
    11 TCL_VERSION=8.4
    12 TCL_MAJOR_VERSION=8
    13 TCL_MINOR_VERSION=4
    14 TCL_PATCH_LEVEL=".15"
    15 VERSION=${TCL_VERSION}
    16 
    17 #------------------------------------------------------------------------
    18 # Handle the --prefix=... option
    19 #------------------------------------------------------------------------
    20 
    21 if test "${prefix}" = "NONE"; then
    22     prefix=/usr/local
    23 fi
    24 if test "${exec_prefix}" = "NONE"; then
    25     exec_prefix=$prefix
    26 fi
    27 # Make sure srcdir is fully qualified!
    28 srcdir=`cd $srcdir ; pwd`
    29 TCL_SRC_DIR=`cd $srcdir/..; pwd`
    30 
    31 #------------------------------------------------------------------------
    32 # Compress and/or soft link the manpages?
    33 #------------------------------------------------------------------------
    34 
    35 SC_CONFIG_MANPAGES([tcl])
    36 
    37 #------------------------------------------------------------------------
    38 # Standard compiler checks
    39 #------------------------------------------------------------------------
    40 
    41 # If the user did not set CFLAGS, set it now to keep
    42 # the AC_PROG_CC macro from adding "-g -O2".
    43 if test "${CFLAGS+set}" != "set" ; then
    44     CFLAGS=""
    45 fi
    46 
    47 AC_PROG_CC
    48 
    49 #--------------------------------------------------------------------
    50 # Supply substitutes for missing POSIX header files.  Special notes:
    51 #	- stdlib.h doesn't define strtol, strtoul, or
    52 #	  strtod insome versions of SunOS
    53 #	- some versions of string.h don't declare procedures such
    54 #	  as strstr
    55 # Do this early, otherwise an autoconf bug throws errors on configure
    56 #--------------------------------------------------------------------
    57 
    58 SC_MISSING_POSIX_HEADERS
    59 
    60 #------------------------------------------------------------------------
    61 # If we're using GCC, see if the compiler understands -pipe.  If so, use it.
    62 # It makes compiling go faster.  (This is only a performance feature.)
    63 #------------------------------------------------------------------------
    64 
    65 if test -z "$no_pipe" && test -n "$GCC"; then
    66     AC_CACHE_CHECK([if the compiler understands -pipe],
    67 	tcl_cv_cc_pipe, [
    68 	hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
    69 	AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
    70 	CFLAGS=$hold_cflags])
    71     if test $tcl_cv_cc_pipe = yes; then
    72 	CFLAGS="$CFLAGS -pipe"
    73     fi
    74 fi
    75 
    76 #------------------------------------------------------------------------
    77 # Threads support
    78 #------------------------------------------------------------------------
    79 
    80 SC_ENABLE_THREADS
    81 
    82 #--------------------------------------------------------------------
    83 # Look for libraries that we will need when compiling the Tcl shell
    84 #--------------------------------------------------------------------
    85 
    86 SC_TCL_LINK_LIBS
    87 
    88 # Add the threads support libraries
    89 LIBS="$LIBS$THREADS_LIBS"
    90 
    91 SC_ENABLE_SHARED
    92 
    93 #--------------------------------------------------------------------
    94 # The statements below define a collection of compile flags.  This
    95 # macro depends on the value of SHARED_BUILD, and should be called
    96 # after SC_ENABLE_SHARED checks the configure switches.
    97 #--------------------------------------------------------------------
    98 
    99 SC_CONFIG_CFLAGS
   100 
   101 SC_ENABLE_SYMBOLS
   102 
   103 TCL_DBGX=${DBGX}
   104 
   105 #--------------------------------------------------------------------
   106 #	Detect what compiler flags to set for 64-bit support.
   107 #--------------------------------------------------------------------
   108 
   109 SC_TCL_EARLY_FLAGS
   110 
   111 SC_TCL_64BIT_FLAGS
   112 
   113 #--------------------------------------------------------------------
   114 #	Check endianness because we can optimize comparisons of
   115 #	Tcl_UniChar strings to memcmp on big-endian systems.
   116 #--------------------------------------------------------------------
   117 
   118 AC_C_BIGENDIAN
   119 
   120 #--------------------------------------------------------------------
   121 #	Supply substitutes for missing POSIX library procedures, or
   122 #	set flags so Tcl uses alternate procedures.
   123 #--------------------------------------------------------------------
   124 
   125 # Check if Posix compliant getcwd exists, if not we'll use getwd.
   126 AC_CHECK_FUNCS(getcwd, , [AC_DEFINE(USEGETWD)])
   127 # Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really
   128 # define USEGETWD even if the posix getcwd exists. Add a test ?
   129 
   130 AC_REPLACE_FUNCS(opendir strstr strtol strtoll strtoull tmpnam waitpid)
   131 AC_CHECK_FUNC(strerror, , [AC_DEFINE(NO_STRERROR)])
   132 AC_CHECK_FUNC(getwd, , [AC_DEFINE(NO_GETWD)])
   133 AC_CHECK_FUNC(wait3, , [AC_DEFINE(NO_WAIT3)])
   134 AC_CHECK_FUNC(uname, , [AC_DEFINE(NO_UNAME)])
   135 
   136 if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \
   137 	test "`uname -r | awk -F. '{print [$]1}'`" -lt 7; then
   138     # prior to Darwin 7, realpath is not threadsafe, so don't
   139     # use it when threads are enabled, c.f. bug # 711232
   140     ac_cv_func_realpath=no
   141 fi
   142 AC_CHECK_FUNC(realpath, , [AC_DEFINE(NO_REALPATH)])
   143 
   144 #--------------------------------------------------------------------
   145 #	Look for thread-safe variants of some library functions.
   146 #--------------------------------------------------------------------
   147 
   148 if test "${TCL_THREADS}" = 1; then
   149     SC_TCL_GETPWUID_R
   150     SC_TCL_GETPWNAM_R
   151     SC_TCL_GETGRGID_R
   152     SC_TCL_GETGRNAM_R
   153     if test "`uname -s`" = "Darwin" && \
   154 	    test "`uname -r | awk -F. '{print [$]1}'`" -gt 5; then
   155 	# Starting with Darwin 6 (Mac OSX 10.2), gethostbyX 
   156 	# are actually MT-safe as they always return pointers
   157 	# from the TSD instead of the static storage.
   158 	AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME)
   159 	AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR)
   160     elif test "`uname -s`" = "HP-UX" && \
   161 	      test "`uname -r|sed -e 's|B\.||' -e 's|\..*$||'`" -gt 10; then
   162         # Starting with HPUX 11.00 (we believe), gethostbyX
   163         # are actually MT-safe as they always return pointers
   164 	# from TSD instead of static storage.
   165 	AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME)
   166 	AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR)
   167     else
   168 	SC_TCL_GETHOSTBYNAME_R
   169 	SC_TCL_GETHOSTBYADDR_R
   170     fi
   171 fi
   172 
   173 #---------------------------------------------------------------------------
   174 #	Determine which interface to use to talk to the serial port.
   175 #	Note that #include lines must begin in leftmost column for
   176 #	some compilers to recognize them as preprocessor directives.
   177 #---------------------------------------------------------------------------
   178 
   179 SC_SERIAL_PORT
   180 
   181 #--------------------------------------------------------------------
   182 #	Include sys/select.h if it exists and if it supplies things
   183 #	that appear to be useful and aren't already in sys/types.h.
   184 #	This appears to be true only on the RS/6000 under AIX.  Some
   185 #	systems like OSF/1 have a sys/select.h that's of no use, and
   186 #	other systems like SCO UNIX have a sys/select.h that's
   187 #	pernicious.  If "fd_set" isn't defined anywhere then set a
   188 #	special flag.
   189 #--------------------------------------------------------------------
   190 
   191 AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [
   192     AC_TRY_COMPILE([#include <sys/types.h>],[fd_set readMask, writeMask;],
   193 	tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)])
   194 tcl_ok=$tcl_cv_type_fd_set
   195 if test $tcl_ok = no; then
   196     AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [
   197 	AC_EGREP_HEADER(fd_mask, sys/select.h,
   198 	     tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)])
   199     if test $tcl_cv_grep_fd_mask = present; then
   200 	AC_DEFINE(HAVE_SYS_SELECT_H)
   201 	tcl_ok=yes
   202     fi
   203 fi
   204 if test $tcl_ok = no; then
   205     AC_DEFINE(NO_FD_SET)
   206 fi
   207 
   208 #------------------------------------------------------------------------------
   209 #       Find out all about time handling differences.
   210 #------------------------------------------------------------------------------
   211 
   212 SC_TIME_HANDLER
   213 
   214 #--------------------------------------------------------------------
   215 #	Some systems (e.g., IRIX 4.0.5) lack the st_blksize field
   216 #	in struct stat.  But we might be able to use fstatfs instead.
   217 #--------------------------------------------------------------------
   218 AC_STRUCT_ST_BLKSIZE
   219 AC_CHECK_FUNC(fstatfs, , [AC_DEFINE(NO_FSTATFS)])
   220 
   221 #--------------------------------------------------------------------
   222 #       Some system have no memcmp or it does not work with 8 bit
   223 #       data, this checks it and add memcmp.o to LIBOBJS if needed
   224 #--------------------------------------------------------------------
   225 AC_FUNC_MEMCMP
   226 
   227 #--------------------------------------------------------------------
   228 #       Some system like SunOS 4 and other BSD like systems
   229 #       have no memmove (we assume they have bcopy instead).
   230 #       {The replacement define is in compat/string.h}
   231 #--------------------------------------------------------------------
   232 AC_CHECK_FUNC(memmove, , [AC_DEFINE(NO_MEMMOVE) AC_DEFINE(NO_STRING_H)])
   233 
   234 #--------------------------------------------------------------------
   235 #	On some systems strstr is broken: it returns a pointer even
   236 #	even if the original string is empty.
   237 #--------------------------------------------------------------------
   238 dnl only run if AC_REPLACE_FUNCS(strstr) hasn't already added strstr.o
   239 if test "x${ac_cv_func_strstr}" = "xyes"; then
   240     AC_CACHE_CHECK([proper strstr implementation], tcl_cv_strstr_unbroken, [
   241 	AC_TRY_RUN([
   242 	extern int strstr();
   243 	int main()
   244 	{
   245 	    exit(strstr("\0test", "test") ? 1 : 0);
   246 	}], tcl_cv_strstr_unbroken=ok, tcl_cv_strstr_unbroken=broken,
   247 	    tcl_cv_strstr_unbroken=broken)])
   248     if test $tcl_cv_strstr_unbroken = broken; then
   249         LIBOBJS="$LIBOBJS strstr.o"
   250     fi
   251 fi
   252 
   253 #--------------------------------------------------------------------
   254 #	Check for strtoul function.  This is tricky because under some
   255 #	versions of AIX strtoul returns an incorrect terminator
   256 #	pointer for the string "0".
   257 #--------------------------------------------------------------------
   258 
   259 AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0)
   260 if test $tcl_ok = 1; then
   261     AC_CACHE_CHECK([proper strtoul implementation], tcl_cv_strtoul_unbroken, [
   262 	AC_TRY_RUN([
   263 	extern int strtoul();
   264 	int main()
   265 	{
   266 	    char *string = "0";
   267 	    char *term;
   268 	    int value;
   269 	    value = strtoul(string, &term, 0);
   270 	    if ((value != 0) || (term != (string+1))) {
   271 		exit(1);
   272 	    }
   273 	    exit(0);
   274 	}], tcl_cv_strtoul_unbroken=ok , tcl_cv_strtoul_unbroken=broken,
   275 	    tcl_cv_strtoul_unbroken=broken)])
   276     if test $tcl_cv_strtoul_unbroken = broken; then
   277 	tcl_ok=0
   278     fi
   279 fi
   280 if test $tcl_ok = 0; then
   281     LIBOBJS="$LIBOBJS strtoul.o"
   282 fi
   283 
   284 #--------------------------------------------------------------------
   285 #	Check for the strtod function.  This is tricky because in some
   286 #	versions of Linux strtod mis-parses strings starting with "+".
   287 #--------------------------------------------------------------------
   288 
   289 AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0)
   290 if test $tcl_ok = 1; then
   291     AC_CACHE_CHECK([proper strtod implementation], tcl_cv_strtod_unbroken, [
   292 	AC_TRY_RUN([
   293 	extern double strtod();
   294 	int main()
   295 	{
   296 	    char *string = " +69";
   297 	    char *term;
   298 	    double value;
   299 	    value = strtod(string, &term);
   300 	    if ((value != 69) || (term != (string+4))) {
   301 		exit(1);
   302 	    }
   303 	    exit(0);
   304 	}], tcl_cv_strtod_unbroken=ok , tcl_cv_strtod_unbroken=broken,
   305 	    tcl_cv_strtod_unbroken=broken)])
   306     if test $tcl_cv_strtod_unbroken = broken; then
   307 	tcl_ok=0
   308     fi
   309 fi
   310 if test $tcl_ok = 0; then
   311     LIBOBJS="$LIBOBJS strtod.o"
   312 fi
   313 
   314 #--------------------------------------------------------------------
   315 #	Under Solaris 2.4, strtod returns the wrong value for the
   316 #	terminating character under some conditions.  Check for this
   317 #	and if the problem exists use a substitute procedure
   318 #	"fixstrtod" that corrects the error.
   319 #--------------------------------------------------------------------
   320 
   321 SC_BUGGY_STRTOD
   322 
   323 #--------------------------------------------------------------------
   324 #	Check for various typedefs and provide substitutes if
   325 #	they don't exist.
   326 #--------------------------------------------------------------------
   327 
   328 AC_TYPE_MODE_T
   329 AC_TYPE_PID_T
   330 AC_TYPE_SIZE_T
   331 AC_TYPE_UID_T
   332 
   333 AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, [
   334     AC_EGREP_CPP(changequote(<<,>>)dnl
   335 <<(^|[^a-zA-Z_0-9])socklen_t[^a-zA-Z_0-9]>>dnl
   336 changequote([,]),[
   337     #include <sys/types.h>
   338     #include <sys/socket.h>
   339     #if STDC_HEADERS
   340     #include <stdlib.h>
   341     #include <stddef.h>
   342     #endif
   343     ], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)])
   344 if test $ac_cv_type_socklen_t = no; then
   345     AC_DEFINE(socklen_t, unsigned)
   346 fi
   347 
   348 #--------------------------------------------------------------------
   349 #	If a system doesn't have an opendir function (man, that's old!)
   350 #	then we have to supply a different version of dirent.h which
   351 #	is compatible with the substitute version of opendir that's
   352 #	provided.  This version only works with V7-style directories.
   353 #--------------------------------------------------------------------
   354 
   355 AC_CHECK_FUNC(opendir, , [AC_DEFINE(USE_DIRENT2_H)])
   356 
   357 #--------------------------------------------------------------------
   358 #	The check below checks whether <sys/wait.h> defines the type
   359 #	"union wait" correctly.  It's needed because of weirdness in
   360 #	HP-UX where "union wait" is defined in both the BSD and SYS-V
   361 #	environments.  Checking the usability of WIFEXITED seems to do
   362 #	the trick.
   363 #--------------------------------------------------------------------
   364 
   365 AC_CACHE_CHECK([union wait], tcl_cv_union_wait, [
   366     AC_TRY_LINK([#include <sys/types.h> 
   367 #include <sys/wait.h>], [
   368 union wait x;
   369 WIFEXITED(x);		/* Generates compiler error if WIFEXITED
   370 			 * uses an int. */
   371     ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no)])
   372 if test $tcl_cv_union_wait = no; then
   373     AC_DEFINE(NO_UNION_WAIT)
   374 fi
   375 
   376 #--------------------------------------------------------------------
   377 #	Check whether there is an strncasecmp function on this system.
   378 #	This is a bit tricky because under SCO it's in -lsocket and
   379 #	under Sequent Dynix it's in -linet.
   380 #--------------------------------------------------------------------
   381 
   382 AC_CHECK_FUNC(strncasecmp, tcl_ok=1, tcl_ok=0)
   383 if test "$tcl_ok" = 0; then
   384     AC_CHECK_LIB(socket, strncasecmp, tcl_ok=1, tcl_ok=0)
   385 fi
   386 if test "$tcl_ok" = 0; then
   387     AC_CHECK_LIB(inet, strncasecmp, tcl_ok=1, tcl_ok=0)
   388 fi
   389 if test "$tcl_ok" = 0; then
   390     LIBOBJS="$LIBOBJS strncasecmp.o"
   391 fi
   392 
   393 #--------------------------------------------------------------------
   394 #	The code below deals with several issues related to gettimeofday:
   395 #	1. Some systems don't provide a gettimeofday function at all
   396 #	   (set NO_GETTOD if this is the case).
   397 #	2. SGI systems don't use the BSD form of the gettimeofday function,
   398 #	   but they have a BSDgettimeofday function that can be used instead.
   399 #	3. See if gettimeofday is declared in the <sys/time.h> header file.
   400 #	   if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can
   401 #	   declare it.
   402 #--------------------------------------------------------------------
   403 
   404 AC_CHECK_FUNC(BSDgettimeofday,
   405     [AC_DEFINE(HAVE_BSDGETTIMEOFDAY)], [
   406     AC_CHECK_FUNC(gettimeofday, , [AC_DEFINE(NO_GETTOD)])
   407 ])
   408 AC_CACHE_CHECK([for gettimeofday declaration], tcl_cv_grep_gettimeofday, [
   409     AC_EGREP_HEADER(gettimeofday, sys/time.h,
   410 	tcl_cv_grep_gettimeofday=present, tcl_cv_grep_gettimeofday=missing)])
   411 if test $tcl_cv_grep_gettimeofday = missing ; then
   412     AC_DEFINE(GETTOD_NOT_DECLARED)
   413 fi
   414 
   415 #--------------------------------------------------------------------
   416 #	The following code checks to see whether it is possible to get
   417 #	signed chars on this platform.  This is needed in order to
   418 #	properly generate sign-extended ints from character values.
   419 #--------------------------------------------------------------------
   420 
   421 AC_C_CHAR_UNSIGNED
   422 AC_CACHE_CHECK([signed char declarations], tcl_cv_char_signed, [
   423     AC_TRY_COMPILE(, [
   424 	signed char *p;
   425 	p = 0;
   426 	], tcl_cv_char_signed=yes, tcl_cv_char_signed=no)])
   427 if test $tcl_cv_char_signed = yes; then
   428     AC_DEFINE(HAVE_SIGNED_CHAR)
   429 fi
   430 
   431 #--------------------------------------------------------------------
   432 #  Does putenv() copy or not?  We need to know to avoid memory leaks.
   433 #--------------------------------------------------------------------
   434 
   435 AC_CACHE_CHECK([for a putenv() that copies the buffer], tcl_cv_putenv_copy, [
   436     AC_TRY_RUN([
   437 	#include <stdlib.h>
   438 	#define OURVAR "havecopy=yes"
   439 	int main (int argc, char *argv[])
   440 	{
   441 	    char *foo, *bar;
   442 	    foo = (char *)strdup(OURVAR);
   443 	    putenv(foo);
   444 	    strcpy((char *)(strchr(foo, '=') + 1), "no");
   445 	    bar = getenv("havecopy");
   446 	    if (!strcmp(bar, "no")) {
   447 		/* doesnt copy */
   448 		return 0;
   449 	    } else {
   450 		/* does copy */
   451 		return 1;
   452 	    }
   453 	}
   454     ],
   455     tcl_cv_putenv_copy=no,
   456     tcl_cv_putenv_copy=yes,
   457     tcl_cv_putenv_copy=no)])
   458 if test $tcl_cv_putenv_copy = yes; then
   459     AC_DEFINE(HAVE_PUTENV_THAT_COPIES)
   460 fi
   461 
   462 #--------------------------------------------------------------------
   463 # Check for support of nl_langinfo function
   464 #--------------------------------------------------------------------
   465 
   466 SC_ENABLE_LANGINFO
   467 
   468 #--------------------------------------------------------------------
   469 # Darwin specific API checks and defines
   470 #--------------------------------------------------------------------
   471 
   472 if test "`uname -s`" = "Darwin" ; then
   473     AC_CHECK_HEADERS(copyfile.h)
   474     AC_CHECK_FUNCS(copyfile)
   475     if test $tcl_corefoundation = yes; then
   476 	AC_CHECK_HEADERS(libkern/OSAtomic.h)
   477 	AC_CHECK_FUNCS(OSSpinLockLock)
   478 	AC_CHECK_FUNCS(pthread_atfork)
   479     fi
   480     AC_DEFINE(USE_VFORK)
   481     AC_DEFINE(TCL_DEFAULT_ENCODING, "utf-8")
   482     AC_DEFINE(TCL_LOAD_FROM_MEMORY)
   483     AC_CHECK_HEADERS(AvailabilityMacros.h)
   484     if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
   485 	AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [
   486 	    hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
   487 	    AC_TRY_LINK([
   488 		    #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
   489 		    #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
   490 		    #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
   491 		    #endif
   492 		    #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
   493 		    #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
   494 		    #endif
   495 		    int rand(void) __attribute__((weak_import));
   496 		], [rand();],
   497 		tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no)
   498 	    CFLAGS=$hold_cflags])
   499 	if test $tcl_cv_cc_weak_import = yes; then
   500 	    AC_DEFINE(HAVE_WEAK_IMPORT)
   501 	fi
   502     fi
   503 fi
   504 
   505 #--------------------------------------------------------------------
   506 # Check for support of fts functions (readdir replacement)
   507 #--------------------------------------------------------------------
   508 
   509 AC_CACHE_CHECK([for fts], tcl_cv_api_fts, [
   510     AC_TRY_LINK([
   511 	    #include <sys/param.h>
   512 	    #include <sys/stat.h>
   513 	    #include <fts.h>
   514 	], [
   515 	    char*const p[2] = {"/", NULL};
   516 	    FTS *f = fts_open(p, FTS_PHYSICAL|FTS_NOCHDIR|FTS_NOSTAT, NULL);
   517 	    FTSENT *e = fts_read(f); fts_close(f);
   518 	], tcl_cv_api_fts=yes, tcl_cv_api_fts=no)])
   519 if test $tcl_cv_api_fts = yes; then
   520     AC_DEFINE(HAVE_FTS)
   521 fi
   522 
   523 #--------------------------------------------------------------------
   524 #	The statements below check for systems where POSIX-style
   525 #	non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. 
   526 #	On these systems (mostly older ones), use the old BSD-style
   527 #	FIONBIO approach instead.
   528 #--------------------------------------------------------------------
   529 
   530 SC_BLOCKING_STYLE
   531 
   532 #--------------------------------------------------------------------
   533 #	The statements below define a collection of symbols related to
   534 #	building libtcl as a shared library instead of a static library.
   535 #--------------------------------------------------------------------
   536 
   537 TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
   538 TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
   539 eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
   540 
   541 # tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
   542 # so that the backslashes quoting the DBX braces are dropped.
   543 
   544 # Trick to replace DBGX with TCL_DBGX
   545 DBGX='${TCL_DBGX}'
   546 eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
   547 
   548 TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
   549 PRIVATE_INCLUDE_DIR='$(includedir)'
   550 HTML_DIR='$(DISTDIR)/html'
   551 
   552 # Note:  in the following variable, it's important to use the absolute
   553 # path name of the Tcl directory rather than "..":  this is because
   554 # AIX remembers this path and will attempt to use it at run-time to look
   555 # up the Tcl library.
   556 
   557 if test "`uname -s`" = "Darwin" ; then
   558     SC_ENABLE_FRAMEWORK
   559     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)}']`"
   560     TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000'
   561 fi
   562 
   563 if test "$FRAMEWORK_BUILD" = "1" ; then
   564     AC_DEFINE(TCL_FRAMEWORK)
   565     tcl_config_files="${tcl_config_files} [Tcl-Info.plist:../macosx/Tcl-Info.plist.in]"
   566     # Construct a fake local framework structure to make linking with
   567     # '-framework Tcl' and running of tcltest work
   568     AC_OUTPUT_COMMANDS([test "$FRAMEWORK_BUILD" = "1" && n=Tcl &&
   569 	f=$n.framework && v=Versions/$VERSION &&
   570 	echo "creating $f" && rm -rf $f && mkdir -p $f/$v/Resources &&
   571 	ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
   572 	ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
   573 	unset n f v
   574     ], [VERSION=${TCL_VERSION} FRAMEWORK_BUILD=${FRAMEWORK_BUILD}])
   575     LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
   576     if test "${libdir}" = '${exec_prefix}/lib'; then
   577         # override libdir default
   578         libdir="/Library/Frameworks"
   579     fi
   580     TCL_LIB_FILE="Tcl"
   581     TCL_LIB_FLAG="-framework Tcl"
   582     TCL_BUILD_LIB_SPEC="-F`pwd` -framework Tcl"
   583     TCL_LIB_SPEC="-F${libdir} -framework Tcl"
   584     libdir="${libdir}/Tcl.framework/Versions/\${VERSION}"
   585     TCL_LIBRARY="${libdir}/Resources/Scripts"
   586     includedir="${libdir}/Headers"
   587     PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
   588     HTML_DIR="${libdir}/Resources/Documentation/Reference/Tcl"
   589     EXTRA_INSTALL="install-private-headers html-tcl"
   590     EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TclTOC.html' 
   591     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"'
   592     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"'
   593     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)/../.."'
   594     TCL_YEAR="`date +%Y`"
   595     # Don't use AC_DEFINE for the following as the framework version define 
   596     # needs to go into the Makefile even when using autoheader, so that we  
   597     # can pick up a potential make override of VERSION. Also, don't put this
   598     # into CFLAGS as it should not go into tclConfig.sh
   599     EXTRA_CC_SWITCHES='-DTCL_FRAMEWORK_VERSION=\"$(VERSION)\"'
   600 else
   601     # libdir must be a fully qualified path and not ${exec_prefix}/lib
   602     eval libdir="$libdir"
   603     if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
   604         if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
   605             TCL_LIB_FLAG="-ltcl${TCL_VERSION}\${TCL_DBGX}"
   606         else
   607             TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
   608         fi
   609         TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}"
   610         TCL_LIB_SPEC="-L${libdir} ${TCL_LIB_FLAG}"
   611     else
   612         TCL_BUILD_EXP_FILE="lib.exp"
   613         eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
   614     
   615         # Replace DBGX with TCL_DBGX
   616         eval "TCL_EXP_FILE=\"${TCL_EXP_FILE}\""
   617         
   618         if test "$GCC" = "yes" ; then
   619             TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`"
   620             TCL_LIB_SPEC="-Wl,-bI:${libdir}/${TCL_EXP_FILE} -L`pwd`"
   621         else
   622             TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}"
   623             TCL_LIB_SPEC="-bI:${libdir}/${TCL_EXP_FILE}"
   624         fi
   625     fi
   626 fi
   627 VERSION='${VERSION}'
   628 eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
   629 eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
   630 eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
   631 VERSION=${TCL_VERSION}
   632 
   633 #--------------------------------------------------------------------
   634 #	The statements below define the symbol TCL_PACKAGE_PATH, which
   635 #	gives a list of directories that may contain packages.  The list
   636 #	consists of one directory for machine-dependent binaries and
   637 #	another for platform-independent scripts.
   638 #--------------------------------------------------------------------
   639 
   640 if test "$FRAMEWORK_BUILD" = "1" ; then
   641     TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks"
   642 elif test "$prefix" != "$exec_prefix"; then
   643     TCL_PACKAGE_PATH="${libdir} ${prefix}/lib"
   644 else
   645     TCL_PACKAGE_PATH="${prefix}/lib"
   646 fi
   647 
   648 #--------------------------------------------------------------------
   649 #       The statements below define various symbols relating to Tcl
   650 #       stub support.
   651 #--------------------------------------------------------------------
   652 
   653 # Replace ${VERSION} with contents of ${TCL_VERSION}
   654 eval "TCL_STUB_LIB_FILE=libtclstub${TCL_UNSHARED_LIB_SUFFIX}"
   655 # Replace DBGX with TCL_DBGX
   656 eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
   657 eval "TCL_STUB_LIB_DIR=${libdir}"
   658 
   659 if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
   660     TCL_STUB_LIB_FLAG="-ltclstub${TCL_VERSION}\${TCL_DBGX}"
   661 else
   662     TCL_STUB_LIB_FLAG="-ltclstub`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}"
   663 fi
   664 
   665 TCL_BUILD_STUB_LIB_SPEC="-L`pwd` ${TCL_STUB_LIB_FLAG}"
   666 TCL_STUB_LIB_SPEC="-L${TCL_STUB_LIB_DIR} ${TCL_STUB_LIB_FLAG}"
   667 TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}"
   668 TCL_STUB_LIB_PATH="${TCL_STUB_LIB_DIR}/${TCL_STUB_LIB_FILE}"
   669 
   670 # Install time header dir can be set via --includedir
   671 eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
   672 
   673 #------------------------------------------------------------------------
   674 # tclConfig.sh refers to this by a different name
   675 #------------------------------------------------------------------------
   676 
   677 TCL_SHARED_BUILD=${SHARED_BUILD}
   678 
   679 AC_SUBST(TCL_VERSION)
   680 AC_SUBST(TCL_MAJOR_VERSION)
   681 AC_SUBST(TCL_MINOR_VERSION)
   682 AC_SUBST(TCL_PATCH_LEVEL)
   683 AC_SUBST(TCL_YEAR)
   684 
   685 AC_SUBST(TCL_LIB_FILE)
   686 AC_SUBST(TCL_LIB_FLAG)
   687 AC_SUBST(TCL_LIB_SPEC)
   688 AC_SUBST(TCL_STUB_LIB_FILE)
   689 AC_SUBST(TCL_STUB_LIB_FLAG)
   690 AC_SUBST(TCL_STUB_LIB_SPEC)
   691 AC_SUBST(TCL_STUB_LIB_PATH)
   692 AC_SUBST(TCL_INCLUDE_SPEC)
   693 AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
   694 AC_SUBST(TCL_BUILD_STUB_LIB_PATH)
   695 
   696 AC_SUBST(TCL_SRC_DIR)
   697 AC_SUBST(TCL_DBGX)
   698 AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
   699 AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
   700 AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
   701 
   702 AC_SUBST(TCL_SHARED_BUILD)
   703 AC_SUBST(LD_LIBRARY_PATH_VAR)
   704 
   705 AC_SUBST(TCL_BUILD_LIB_SPEC)
   706 AC_SUBST(TCL_NEEDS_EXP_FILE)
   707 AC_SUBST(TCL_BUILD_EXP_FILE)
   708 AC_SUBST(TCL_EXP_FILE)
   709 
   710 AC_SUBST(TCL_LIB_VERSIONS_OK)
   711 AC_SUBST(TCL_SHARED_LIB_SUFFIX)
   712 AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
   713 
   714 AC_SUBST(TCL_HAS_LONGLONG)
   715 
   716 AC_SUBST(BUILD_DLTEST)
   717 AC_SUBST(TCL_PACKAGE_PATH)
   718 
   719 AC_SUBST(TCL_LIBRARY)
   720 AC_SUBST(PRIVATE_INCLUDE_DIR)
   721 AC_SUBST(HTML_DIR)
   722 
   723 AC_SUBST(EXTRA_CC_SWITCHES)
   724 AC_SUBST(EXTRA_INSTALL)
   725 AC_SUBST(EXTRA_INSTALL_BINARIES)
   726 AC_SUBST(EXTRA_BUILD_HTML)
   727 
   728 SC_OUTPUT_COMMANDS_PRE
   729 
   730 tcl_config_files="${tcl_config_files} [Makefile dltest/Makefile tclConfig.sh]"
   731 AC_OUTPUT([${tcl_config_files}])