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