Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/unix/configure.in @ 25

Last change on this file since 25 was 25, checked in by landauf, 16 years ago

added tcl to libs

File size: 33.5 KB
Line 
1#! /bin/bash -norc
2dnl     This file is an input file used by the GNU "autoconf" program to
3dnl     generate the file "configure", which is run during Tcl installation
4dnl     to configure the system for the local environment.
5#
6# RCS: @(#) $Id: configure.in,v 1.180 2008/03/28 17:31:47 dgp Exp $
7
8AC_INIT([tcl],[8.5])
9AC_PREREQ(2.59)
10
11dnl This is only used when included from macosx/configure.ac
12m4_ifdef([SC_USE_CONFIG_HEADERS], [
13    AC_CONFIG_HEADERS([tclConfig.h:../unix/tclConfig.h.in])
14    AC_CONFIG_COMMANDS_PRE([DEFS="-DHAVE_TCL_CONFIG_H  -imacros tclConfig.h"])
15    AH_TOP([
16    #ifndef _TCLCONFIG
17    #define _TCLCONFIG])
18    AH_BOTTOM([
19    /* Undef unused package specific autoheader defines so that we can
20     * include both tclConfig.h and tkConfig.h at the same time: */
21    /* override */ #undef PACKAGE_NAME
22    /* override */ #undef PACKAGE_STRING
23    /* override */ #undef PACKAGE_TARNAME
24    #endif /* _TCLCONFIG */])
25])
26
27TCL_VERSION=8.5
28TCL_MAJOR_VERSION=8
29TCL_MINOR_VERSION=5
30TCL_PATCH_LEVEL=".2"
31VERSION=${TCL_VERSION}
32
33#------------------------------------------------------------------------
34# Handle the --prefix=... option
35#------------------------------------------------------------------------
36
37if test "${prefix}" = "NONE"; then
38    prefix=/usr/local
39fi
40if test "${exec_prefix}" = "NONE"; then
41    exec_prefix=$prefix
42fi
43# Make sure srcdir is fully qualified!
44srcdir="`cd "$srcdir" ; pwd`"
45TCL_SRC_DIR="`cd "$srcdir"/..; pwd`"
46
47#------------------------------------------------------------------------
48# Compress and/or soft link the manpages?
49#------------------------------------------------------------------------
50
51SC_CONFIG_MANPAGES
52
53#------------------------------------------------------------------------
54# Standard compiler checks
55#------------------------------------------------------------------------
56
57# If the user did not set CFLAGS, set it now to keep
58# the AC_PROG_CC macro from adding "-g -O2".
59if test "${CFLAGS+set}" != "set" ; then
60    CFLAGS=""
61fi
62
63AC_PROG_CC
64AC_C_INLINE
65
66#--------------------------------------------------------------------
67# Supply substitutes for missing POSIX header files.  Special notes:
68#       - stdlib.h doesn't define strtol, strtoul, or
69#         strtod insome versions of SunOS
70#       - some versions of string.h don't declare procedures such
71#         as strstr
72# Do this early, otherwise an autoconf bug throws errors on configure
73#--------------------------------------------------------------------
74
75SC_MISSING_POSIX_HEADERS
76
77#------------------------------------------------------------------------
78# If we're using GCC, see if the compiler understands -pipe.  If so, use it.
79# It makes compiling go faster.  (This is only a performance feature.)
80#------------------------------------------------------------------------
81
82if test -z "$no_pipe" && test -n "$GCC"; then
83    AC_CACHE_CHECK([if the compiler understands -pipe],
84        tcl_cv_cc_pipe, [
85        hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe"
86        AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no)
87        CFLAGS=$hold_cflags])
88    if test $tcl_cv_cc_pipe = yes; then
89        CFLAGS="$CFLAGS -pipe"
90    fi
91fi
92
93#------------------------------------------------------------------------
94# Threads support
95#------------------------------------------------------------------------
96
97SC_ENABLE_THREADS
98
99#------------------------------------------------------------------------
100# Embedded configuration information, encoding to use for the values, TIP #59
101#------------------------------------------------------------------------
102
103SC_TCL_CFG_ENCODING
104
105#--------------------------------------------------------------------
106# Look for libraries that we will need when compiling the Tcl shell
107#--------------------------------------------------------------------
108
109SC_TCL_LINK_LIBS
110
111# Add the threads support libraries
112LIBS="$LIBS$THREADS_LIBS"
113
114SC_ENABLE_SHARED
115
116#--------------------------------------------------------------------
117# The statements below define a collection of compile flags.  This
118# macro depends on the value of SHARED_BUILD, and should be called
119# after SC_ENABLE_SHARED checks the configure switches.
120#--------------------------------------------------------------------
121
122SC_CONFIG_CFLAGS
123
124SC_ENABLE_SYMBOLS(bccdebug)
125
126AC_DEFINE(TCL_TOMMATH, 1, [Build libtommath?])
127AC_DEFINE(MP_PREC, 4, [Default libtommath precision.])
128
129#--------------------------------------------------------------------
130#       Detect what compiler flags to set for 64-bit support.
131#--------------------------------------------------------------------
132
133SC_TCL_EARLY_FLAGS
134
135SC_TCL_64BIT_FLAGS
136
137#--------------------------------------------------------------------
138#       Check endianness because we can optimize comparisons of
139#       Tcl_UniChar strings to memcmp on big-endian systems.
140#--------------------------------------------------------------------
141
142AC_C_BIGENDIAN
143
144#--------------------------------------------------------------------
145#       Supply substitutes for missing POSIX library procedures, or
146#       set flags so Tcl uses alternate procedures.
147#--------------------------------------------------------------------
148
149# Check if Posix compliant getcwd exists, if not we'll use getwd.
150AC_CHECK_FUNCS(getcwd, , [AC_DEFINE(USEGETWD, 1, [Is getcwd Posix-compliant?])])
151# Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really
152# define USEGETWD even if the posix getcwd exists. Add a test ?
153
154AC_REPLACE_FUNCS(opendir strtol waitpid)
155AC_CHECK_FUNC(strerror, , [AC_DEFINE(NO_STRERROR, 1, [Do we have strerror()])])
156AC_CHECK_FUNC(getwd, , [AC_DEFINE(NO_GETWD, 1, [Do we have getwd()])])
157AC_CHECK_FUNC(wait3, , [AC_DEFINE(NO_WAIT3, 1, [Do we have wait3()])])
158AC_CHECK_FUNC(uname, , [AC_DEFINE(NO_UNAME, 1, [Do we have uname()])])
159
160if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \
161        test "`uname -r | awk -F. '{print [$]1}'`" -lt 7; then
162    # prior to Darwin 7, realpath is not threadsafe, so don't
163    # use it when threads are enabled, c.f. bug # 711232
164    ac_cv_func_realpath=no
165fi
166AC_CHECK_FUNC(realpath, , [AC_DEFINE(NO_REALPATH, 1, [Do we have realpath()])])
167
168SC_TCL_GETADDRINFO
169
170#--------------------------------------------------------------------
171#       Look for thread-safe variants of some library functions.
172#--------------------------------------------------------------------
173
174if test "${TCL_THREADS}" = 1; then
175    SC_TCL_GETPWUID_R
176    SC_TCL_GETPWNAM_R
177    SC_TCL_GETGRGID_R
178    SC_TCL_GETGRNAM_R
179    if test "`uname -s`" = "Darwin" && \
180            test "`uname -r | awk -F. '{print [$]1}'`" -gt 5; then
181        # Starting with Darwin 6 (Mac OSX 10.2), gethostbyX
182        # are actually MT-safe as they always return pointers
183        # from TSD instead of static storage.
184        AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME, 1,
185                [Do we have MT-safe gethostbyname() ?])
186        AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR, 1,
187                [Do we have MT-safe gethostbyaddr() ?])
188
189    elif test "`uname -s`" = "HP-UX" && \
190              test "`uname -r|sed -e 's|B\.||' -e 's|\..*$||'`" -gt 10; then
191        # Starting with HPUX 11.00 (we believe), gethostbyX
192        # are actually MT-safe as they always return pointers
193        # from TSD instead of static storage.
194        AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME, 1,
195                [Do we have MT-safe gethostbyname() ?])
196        AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR, 1,
197                [Do we have MT-safe gethostbyaddr() ?])
198
199    else
200        SC_TCL_GETHOSTBYNAME_R
201        SC_TCL_GETHOSTBYADDR_R
202    fi
203fi
204
205#---------------------------------------------------------------------------
206#       Determine which interface to use to talk to the serial port.
207#       Note that #include lines must begin in leftmost column for
208#       some compilers to recognize them as preprocessor directives.
209#---------------------------------------------------------------------------
210
211SC_SERIAL_PORT
212
213#--------------------------------------------------------------------
214#       Include sys/select.h if it exists and if it supplies things
215#       that appear to be useful and aren't already in sys/types.h.
216#       This appears to be true only on the RS/6000 under AIX.  Some
217#       systems like OSF/1 have a sys/select.h that's of no use, and
218#       other systems like SCO UNIX have a sys/select.h that's
219#       pernicious.  If "fd_set" isn't defined anywhere then set a
220#       special flag.
221#--------------------------------------------------------------------
222
223AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [
224    AC_TRY_COMPILE([#include <sys/types.h>],[fd_set readMask, writeMask;],
225        tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)])
226tcl_ok=$tcl_cv_type_fd_set
227if test $tcl_ok = no; then
228    AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [
229        AC_EGREP_HEADER(fd_mask, sys/select.h,
230             tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)])
231    if test $tcl_cv_grep_fd_mask = present; then
232        AC_DEFINE(HAVE_SYS_SELECT_H, 1, [Should we include <sys/select.h>?])
233        tcl_ok=yes
234    fi
235fi
236if test $tcl_ok = no; then
237    AC_DEFINE(NO_FD_SET, 1, [Do we have fd_set?])
238fi
239
240#------------------------------------------------------------------------------
241#       Find out all about time handling differences.
242#------------------------------------------------------------------------------
243
244SC_TIME_HANDLER
245
246#--------------------------------------------------------------------
247#       Some systems (e.g., IRIX 4.0.5) lack the st_blksize field
248#       in struct stat.  But we might be able to use fstatfs instead.
249#--------------------------------------------------------------------
250
251AC_STRUCT_ST_BLKSIZE
252AC_CHECK_FUNC(fstatfs, , [AC_DEFINE(NO_FSTATFS, 1, [Do we have fstatfs()?])])
253
254#--------------------------------------------------------------------
255#       Some system have no memcmp or it does not work with 8 bit
256#       data, this checks it and add memcmp.o to LIBOBJS if needed
257#--------------------------------------------------------------------
258
259AC_FUNC_MEMCMP
260
261#--------------------------------------------------------------------
262#       Some system like SunOS 4 and other BSD like systems
263#       have no memmove (we assume they have bcopy instead).
264#       {The replacement define is in compat/string.h}
265#--------------------------------------------------------------------
266
267AC_CHECK_FUNC(memmove, , [
268    AC_DEFINE(NO_MEMMOVE, 1, [Do we have memmove()?])
269    AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?]) ])
270
271#--------------------------------------------------------------------
272#       On some systems strstr is broken: it returns a pointer even
273#       even if the original string is empty.
274#--------------------------------------------------------------------
275
276SC_TCL_CHECK_BROKEN_FUNC(strstr, [
277    extern int strstr();
278    exit(strstr("\0test", "test") ? 1 : 0);
279])
280
281#--------------------------------------------------------------------
282#       Check for strtoul function.  This is tricky because under some
283#       versions of AIX strtoul returns an incorrect terminator
284#       pointer for the string "0".
285#--------------------------------------------------------------------
286
287SC_TCL_CHECK_BROKEN_FUNC(strtoul, [
288    extern int strtoul();
289    char *term, *string = "0";
290    exit(strtoul(string,&term,0) != 0 || term != string+1);
291])
292
293#--------------------------------------------------------------------
294#       Check for the strtod function.  This is tricky because in some
295#       versions of Linux strtod mis-parses strings starting with "+".
296#--------------------------------------------------------------------
297
298SC_TCL_CHECK_BROKEN_FUNC(strtod, [
299    extern double strtod();
300    char *term, *string = " +69";
301    exit(strtod(string,&term) != 69 || term != string+4);
302])
303
304#--------------------------------------------------------------------
305#       Under Solaris 2.4, strtod returns the wrong value for the
306#       terminating character under some conditions.  Check for this
307#       and if the problem exists use a substitute procedure
308#       "fixstrtod" that corrects the error.
309#--------------------------------------------------------------------
310
311SC_BUGGY_STRTOD
312
313#--------------------------------------------------------------------
314#       Check for various typedefs and provide substitutes if
315#       they don't exist.
316#--------------------------------------------------------------------
317
318AC_TYPE_MODE_T
319AC_TYPE_PID_T
320AC_TYPE_SIZE_T
321AC_TYPE_UID_T
322
323AC_CACHE_CHECK([for socklen_t], tcl_cv_type_socklen_t, [
324    AC_TRY_COMPILE([
325        #include <sys/types.h>
326        #include <sys/socket.h>
327    ],[
328        socklen_t foo;
329    ],[tcl_cv_type_socklen_t=yes],[tcl_cv_type_socklen_t=no])])
330if test $tcl_cv_type_socklen_t = no; then
331    AC_DEFINE(socklen_t, int, [Define as int if socklen_t is not available])
332fi
333
334AC_CHECK_TYPE([intptr_t], [
335    AC_DEFINE([HAVE_INTPTR_T], 1, [Do we have the intptr_t type?])], [
336    AC_CACHE_CHECK([for pointer-size signed integer type], tcl_cv_intptr_t, [
337    for tcl_cv_intptr_t in "int" "long" "long long" none; do
338        if test "$tcl_cv_intptr_t" != none; then
339            AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
340                    [[sizeof (void *) <= sizeof ($tcl_cv_intptr_t)]])],
341                [tcl_ok=yes], [tcl_ok=no])
342            test "$tcl_ok" = yes && break; fi
343    done])
344    if test "$tcl_cv_intptr_t" != none; then
345        AC_DEFINE_UNQUOTED([intptr_t], [$tcl_cv_intptr_t], [Signed integer
346           type wide enough to hold a pointer.])
347    fi
348])
349AC_CHECK_TYPE([uintptr_t], [
350    AC_DEFINE([HAVE_UINTPTR_T], 1, [Do we have the uintptr_t type?])], [
351    AC_CACHE_CHECK([for pointer-size unsigned integer type], tcl_cv_uintptr_t, [
352    for tcl_cv_uintptr_t in "unsigned int" "unsigned long" "unsigned long long" \
353            none; do
354        if test "$tcl_cv_uintptr_t" != none; then
355            AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT],
356                    [[sizeof (void *) <= sizeof ($tcl_cv_uintptr_t)]])],
357                [tcl_ok=yes], [tcl_ok=no])
358            test "$tcl_ok" = yes && break; fi
359    done])
360    if test "$tcl_cv_uintptr_t" != none; then
361        AC_DEFINE_UNQUOTED([uintptr_t], [$tcl_cv_uintptr_t], [Unsigned integer
362           type wide enough to hold a pointer.])
363    fi
364])
365
366#--------------------------------------------------------------------
367#       If a system doesn't have an opendir function (man, that's old!)
368#       then we have to supply a different version of dirent.h which
369#       is compatible with the substitute version of opendir that's
370#       provided.  This version only works with V7-style directories.
371#--------------------------------------------------------------------
372
373AC_CHECK_FUNC(opendir, , [AC_DEFINE(USE_DIRENT2_H, 1, [May we include <dirent2.h>?])])
374
375#--------------------------------------------------------------------
376#       The check below checks whether <sys/wait.h> defines the type
377#       "union wait" correctly.  It's needed because of weirdness in
378#       HP-UX where "union wait" is defined in both the BSD and SYS-V
379#       environments.  Checking the usability of WIFEXITED seems to do
380#       the trick.
381#--------------------------------------------------------------------
382
383AC_CACHE_CHECK([union wait], tcl_cv_union_wait, [
384    AC_TRY_LINK([#include <sys/types.h>
385#include <sys/wait.h>], [
386union wait x;
387WIFEXITED(x);           /* Generates compiler error if WIFEXITED
388                         * uses an int. */
389    ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no)])
390if test $tcl_cv_union_wait = no; then
391    AC_DEFINE(NO_UNION_WAIT, 1, [Do we have a usable 'union wait'?])
392fi
393
394#--------------------------------------------------------------------
395#       Check whether there is an strncasecmp function on this system.
396#       This is a bit tricky because under SCO it's in -lsocket and
397#       under Sequent Dynix it's in -linet.
398#--------------------------------------------------------------------
399
400AC_CHECK_FUNC(strncasecmp, tcl_ok=1, tcl_ok=0)
401if test "$tcl_ok" = 0; then
402    AC_CHECK_LIB(socket, strncasecmp, tcl_ok=1, tcl_ok=0)
403fi
404if test "$tcl_ok" = 0; then
405    AC_CHECK_LIB(inet, strncasecmp, tcl_ok=1, tcl_ok=0)
406fi
407if test "$tcl_ok" = 0; then
408    AC_LIBOBJ([strncasecmp])
409    USE_COMPAT=1
410fi
411
412#--------------------------------------------------------------------
413#       The code below deals with several issues related to gettimeofday:
414#       1. Some systems don't provide a gettimeofday function at all
415#          (set NO_GETTOD if this is the case).
416#       2. SGI systems don't use the BSD form of the gettimeofday function,
417#          but they have a BSDgettimeofday function that can be used instead.
418#       3. See if gettimeofday is declared in the <sys/time.h> header file.
419#          if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can
420#          declare it.
421#--------------------------------------------------------------------
422
423AC_CHECK_FUNC(BSDgettimeofday,
424    [AC_DEFINE(HAVE_BSDGETTIMEOFDAY, 1, [Do we have BSDgettimeofday()?])], [
425    AC_CHECK_FUNC(gettimeofday, , [AC_DEFINE(NO_GETTOD, 1, [Do we have gettimeofday()?])])
426])
427AC_CACHE_CHECK([for gettimeofday declaration], tcl_cv_grep_gettimeofday, [
428    AC_EGREP_HEADER(gettimeofday, sys/time.h,
429        tcl_cv_grep_gettimeofday=present, tcl_cv_grep_gettimeofday=missing)])
430if test $tcl_cv_grep_gettimeofday = missing ; then
431    AC_DEFINE(GETTOD_NOT_DECLARED, 1, [Is gettimeofday() actually declared in <sys/time.h>?])
432fi
433
434#--------------------------------------------------------------------
435#       The following code checks to see whether it is possible to get
436#       signed chars on this platform.  This is needed in order to
437#       properly generate sign-extended ints from character values.
438#--------------------------------------------------------------------
439
440AC_C_CHAR_UNSIGNED
441AC_CACHE_CHECK([signed char declarations], tcl_cv_char_signed, [
442    AC_TRY_COMPILE(, [
443        signed char *p;
444        p = 0;
445        ], tcl_cv_char_signed=yes, tcl_cv_char_signed=no)])
446if test $tcl_cv_char_signed = yes; then
447    AC_DEFINE(HAVE_SIGNED_CHAR, 1, [Are characters signed?])
448fi
449
450#--------------------------------------------------------------------
451#  Does putenv() copy or not?  We need to know to avoid memory leaks.
452#--------------------------------------------------------------------
453
454AC_CACHE_CHECK([for a putenv() that copies the buffer], tcl_cv_putenv_copy, [
455    AC_TRY_RUN([
456        #include <stdlib.h>
457        #define OURVAR "havecopy=yes"
458        int main (int argc, char *argv[])
459        {
460            char *foo, *bar;
461            foo = (char *)strdup(OURVAR);
462            putenv(foo);
463            strcpy((char *)(strchr(foo, '=') + 1), "no");
464            bar = getenv("havecopy");
465            if (!strcmp(bar, "no")) {
466                /* doesnt copy */
467                return 0;
468            } else {
469                /* does copy */
470                return 1;
471            }
472        }
473    ],
474    tcl_cv_putenv_copy=no,
475    tcl_cv_putenv_copy=yes,
476    tcl_cv_putenv_copy=no)])
477if test $tcl_cv_putenv_copy = yes; then
478    AC_DEFINE(HAVE_PUTENV_THAT_COPIES, 1,
479        [Does putenv() copy strings or incorporate them by reference?])
480fi
481
482#--------------------------------------------------------------------
483# Check for support of nl_langinfo function
484#--------------------------------------------------------------------
485
486SC_ENABLE_LANGINFO
487
488#--------------------------------------------------------------------
489# Check for support of chflags function
490#--------------------------------------------------------------------
491
492AC_CHECK_FUNCS(chflags)
493
494#--------------------------------------------------------------------
495# Darwin specific API checks and defines
496#--------------------------------------------------------------------
497
498if test "`uname -s`" = "Darwin" ; then
499    AC_CHECK_FUNCS(getattrlist)
500    AC_CHECK_HEADERS(copyfile.h)
501    AC_CHECK_FUNCS(copyfile)
502    if test $tcl_corefoundation = yes; then
503        AC_CHECK_HEADERS(libkern/OSAtomic.h)
504        AC_CHECK_FUNCS(OSSpinLockLock)
505        AC_CHECK_FUNCS(pthread_atfork)
506    fi
507    AC_DEFINE(USE_VFORK, 1, [Should we use vfork() instead of fork()?])
508    AC_DEFINE(TCL_DEFAULT_ENCODING, "utf-8",
509        [Are we to override what our default encoding is?])
510    AC_DEFINE(TCL_LOAD_FROM_MEMORY, 1,
511        [Can this platform load code from memory?])
512    AC_DEFINE(TCL_WIDE_CLICKS, 1,
513        [Does this platform have wide high-resolution clicks?])
514    AC_CHECK_HEADERS(AvailabilityMacros.h)
515    if test "$ac_cv_header_AvailabilityMacros_h" = yes; then
516        AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [
517            hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror"
518            AC_TRY_LINK([
519                    #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
520                    #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
521                    #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020
522                    #endif
523                    #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020
524                    #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020
525                    #endif
526                    int rand(void) __attribute__((weak_import));
527                ], [rand();],
528                tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no)
529            CFLAGS=$hold_cflags])
530        if test $tcl_cv_cc_weak_import = yes; then
531            AC_DEFINE(HAVE_WEAK_IMPORT, 1, [Is weak import available?])
532        fi
533    fi
534    # Build .bundle dltest binaries in addition to .dylib
535    DLTEST_LD='${CC} -bundle -Wl,-w ${CFLAGS} ${LDFLAGS}'
536    DLTEST_SUFFIX=".bundle"
537else
538    DLTEST_LD='${SHLIB_LD}'
539    DLTEST_SUFFIX=""
540fi
541
542#--------------------------------------------------------------------
543# Check for support of fts functions (readdir replacement)
544#--------------------------------------------------------------------
545
546AC_CACHE_CHECK([for fts], tcl_cv_api_fts, [
547    AC_TRY_LINK([
548            #include <sys/param.h>
549            #include <sys/stat.h>
550            #include <fts.h>
551        ], [
552            char*const p[2] = {"/", NULL};
553            FTS *f = fts_open(p, FTS_PHYSICAL|FTS_NOCHDIR|FTS_NOSTAT, NULL);
554            FTSENT *e = fts_read(f); fts_close(f);
555        ], tcl_cv_api_fts=yes, tcl_cv_api_fts=no)])
556if test $tcl_cv_api_fts = yes; then
557    AC_DEFINE(HAVE_FTS, 1, [Do we have fts functions?])
558fi
559
560#--------------------------------------------------------------------
561#       The statements below check for systems where POSIX-style
562#       non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented.
563#       On these systems (mostly older ones), use the old BSD-style
564#       FIONBIO approach instead.
565#--------------------------------------------------------------------
566
567SC_BLOCKING_STYLE
568
569#------------------------------------------------------------------------
570
571AC_MSG_CHECKING([whether to use dll unloading])
572AC_ARG_ENABLE(dll-unloading,
573    AC_HELP_STRING([--enable-dll-unloading],
574        [enable the 'unload' command (default: on)]),
575    [tcl_ok=$enableval], [tcl_ok=yes])
576if test $tcl_ok = yes; then
577    AC_DEFINE(TCL_UNLOAD_DLLS, 1, [Do we allow unloading of shared libraries?])
578fi
579AC_MSG_RESULT([$tcl_ok])
580
581#------------------------------------------------------------------------
582#       Check whether the timezone data is supplied by the OS or has
583#       to be installed by Tcl. The default is autodetection, but can
584#       be overriden on the configure command line either way.
585#------------------------------------------------------------------------
586
587AC_MSG_CHECKING([for timezone data])
588AC_ARG_WITH(tzdata,
589    AC_HELP_STRING([--with-tzdata],
590        [install timezone data (default: autodetect)]),
591    [tcl_ok=$withval], [tcl_ok=auto])
592#
593# Any directories that get added here must also be added to the
594# search path in ::tcl::clock::Initialize (library/clock.tcl).
595#
596case $tcl_ok in
597    no)
598        AC_MSG_RESULT([supplied by OS vendor])
599    ;;
600    yes)
601        # nothing to do here
602    ;;
603    auto*)
604        AC_CACHE_VAL([tcl_cv_dir_zoneinfo], [
605        for dir in /usr/share/zoneinfo \
606                /usr/share/lib/zoneinfo \
607                /usr/lib/zoneinfo
608        do
609                if test -f $dir/UTC -o -f $dir/GMT
610                then
611                        tcl_cv_dir_zoneinfo="$dir"
612                        break
613                fi
614        done])
615        if test -n "$tcl_cv_dir_zoneinfo"; then
616            tcl_ok=no
617            AC_MSG_RESULT([$dir])
618        else
619            tcl_ok=yes
620        fi
621    ;;
622    *)
623        AC_MSG_ERROR([invalid argument: $tcl_ok])       
624    ;;
625esac
626if test $tcl_ok = yes
627then
628    AC_MSG_RESULT([supplied by Tcl])
629    INSTALL_TZDATA=install-tzdata
630fi
631
632#--------------------------------------------------------------------
633#       DTrace support
634#--------------------------------------------------------------------
635
636AC_ARG_ENABLE(dtrace,
637    AC_HELP_STRING([--enable-dtrace],
638        [build with DTrace support (default: off)]),
639    [tcl_ok=$enableval], [tcl_ok=no])
640if test $tcl_ok = yes; then
641    AC_CHECK_HEADER(sys/sdt.h, [tcl_ok=yes], [tcl_ok=no])
642fi
643if test $tcl_ok = yes; then
644    AC_PATH_PROG(DTRACE, dtrace,, [$PATH:/usr/sbin])
645    test -z "$ac_cv_path_DTRACE" && tcl_ok=no
646fi
647AC_MSG_CHECKING([whether to enable DTrace support])
648if test $tcl_ok = yes; then
649    AC_DEFINE(USE_DTRACE, 1, [Are we building with DTrace support?])
650    DTRACE_SRC="\${DTRACE_SRC}"
651    DTRACE_HDR="\${DTRACE_HDR}"
652    if test "`uname -s`" != "Darwin" ; then
653        DTRACE_OBJ="\${DTRACE_OBJ}"
654    fi
655fi
656AC_MSG_RESULT([$tcl_ok])
657
658#--------------------------------------------------------------------
659#  Does the C stack grow upwards or downwards? Or cross-compiling?
660#--------------------------------------------------------------------
661
662AC_CACHE_CHECK([if the C stack grows upwards in memory], tcl_cv_stack_grows_up, [
663    AC_TRY_RUN([
664        int StackGrowsUp(int *parent) {
665            int here;
666            return (&here < parent);
667        }
668        int main (int argc, char *argv[]) {
669            int foo;
670            return StackGrowsUp(&foo);
671        }
672    ], tcl_cv_stack_grows_up=yes, tcl_cv_stack_grows_up=no,
673    tcl_cv_stack_grows_up=unknown)])
674if test $tcl_cv_stack_grows_up = unknown; then
675    AC_DEFINE(TCL_CROSS_COMPILE, 1, [Are we cross-compiling?])
676elif test $tcl_cv_stack_grows_up = yes; then
677    AC_DEFINE(TCL_STACK_GROWS_UP, 1, [The C stack grows upwards in memory.])
678fi
679
680#--------------------------------------------------------------------
681#       The statements below define a collection of symbols related to
682#       building libtcl as a shared library instead of a static library.
683#--------------------------------------------------------------------
684
685TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
686TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
687eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
688
689# tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
690# since on some platforms TCL_LIB_FILE contains shell escapes.
691# (See also: TCL_TRIM_DOTS).
692
693eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
694
695TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
696PRIVATE_INCLUDE_DIR='$(includedir)'
697HTML_DIR='$(DISTDIR)/html'
698
699# Note:  in the following variable, it's important to use the absolute
700# path name of the Tcl directory rather than "..":  this is because
701# AIX remembers this path and will attempt to use it at run-time to look
702# up the Tcl library.
703
704if test "`uname -s`" = "Darwin" ; then
705    SC_ENABLE_FRAMEWORK
706    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)}']`"
707    TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -install_name "${DYLIB_INSTALL_DIR}"/${TCL_LIB_FILE}'
708    echo "$LDFLAGS " | grep -q -- '-prebind ' && TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -seg1addr 0xa000000'
709    TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -sectcreate __TEXT __info_plist Tcl-Info.plist'
710    EXTRA_TCLSH_LIBS='-sectcreate __TEXT __info_plist Tclsh-Info.plist'
711    EXTRA_APP_CC_SWITCHES='-mdynamic-no-pic'
712    AC_CONFIG_FILES([Tcl-Info.plist:../macosx/Tcl-Info.plist.in Tclsh-Info.plist:../macosx/Tclsh-Info.plist.in])
713    TCL_YEAR="`date +%Y`"
714fi
715
716if test "$FRAMEWORK_BUILD" = "1" ; then
717    AC_DEFINE(TCL_FRAMEWORK, 1, [Is Tcl built as a framework?])
718    # Construct a fake local framework structure to make linking with
719    # '-framework Tcl' and running of tcltest work
720    AC_CONFIG_COMMANDS([Tcl.framework], [n=Tcl &&
721        f=$n.framework && v=Versions/$VERSION &&
722        rm -rf $f && mkdir -p $f/$v/Resources &&
723        ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v &&
724        ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist &&
725        unset n f v
726    ], VERSION=${TCL_VERSION})
727    LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH"
728    if test "${libdir}" = '${exec_prefix}/lib'; then
729        # override libdir default
730        libdir="/Library/Frameworks"
731    fi
732    TCL_LIB_FILE="Tcl"
733    TCL_LIB_FLAG="-framework Tcl"
734    TCL_BUILD_LIB_SPEC="-F`pwd | sed -e 's/ /\\\\ /g'` -framework Tcl"
735    TCL_LIB_SPEC="-F${libdir} -framework Tcl"
736    libdir="${libdir}/Tcl.framework/Versions/\${VERSION}"
737    TCL_LIBRARY="${libdir}/Resources/Scripts"
738    includedir="${libdir}/Headers"
739    PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders"
740    HTML_DIR="${libdir}/Resources/Documentation/Reference/Tcl"
741    EXTRA_INSTALL="install-private-headers html-tcl"
742    EXTRA_BUILD_HTML='@ln -fs contents.htm "$(HTML_INSTALL_DIR)"/TclTOC.html'
743    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"'
744    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"'
745    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)/../.."'
746    # Don't use AC_DEFINE for the following as the framework version define
747    # needs to go into the Makefile even when using autoheader, so that we 
748    # can pick up a potential make override of VERSION. Also, don't put this
749    # into CFLAGS as it should not go into tclConfig.sh
750    EXTRA_CC_SWITCHES='-DTCL_FRAMEWORK_VERSION=\"$(VERSION)\"'
751else
752    # libdir must be a fully qualified path and not ${exec_prefix}/lib
753    eval libdir="$libdir"
754    if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then
755        if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
756            TCL_LIB_FLAG="-ltcl${TCL_VERSION}"
757        else
758            TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`"
759        fi
760        TCL_BUILD_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TCL_LIB_FLAG}"
761        TCL_LIB_SPEC="-L${libdir} ${TCL_LIB_FLAG}"
762    else
763        TCL_BUILD_EXP_FILE="lib.exp"
764        eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
765   
766        if test "$GCC" = "yes" ; then
767            TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd | sed -e 's/ /\\\\ /g'`/${TCL_BUILD_EXP_FILE} -L`pwd | sed -e 's/ /\\\\ /g'`"
768            TCL_LIB_SPEC="-Wl,-bI:${libdir}/${TCL_EXP_FILE} -L${libdir}"
769        else
770            TCL_BUILD_LIB_SPEC="-bI:`pwd | sed -e 's/ /\\\\ /g'`/${TCL_BUILD_EXP_FILE}"
771            TCL_LIB_SPEC="-bI:${libdir}/${TCL_EXP_FILE}"
772        fi
773    fi
774fi
775VERSION='${VERSION}'
776eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
777eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
778eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
779VERSION=${TCL_VERSION}
780
781#--------------------------------------------------------------------
782#       The statements below define the symbol TCL_PACKAGE_PATH, which
783#       gives a list of directories that may contain packages.  The list
784#       consists of one directory for machine-dependent binaries and
785#       another for platform-independent scripts.
786#--------------------------------------------------------------------
787
788if test "$FRAMEWORK_BUILD" = "1" ; then
789    test -z "$TCL_PACKAGE_PATH" && \
790        TCL_PACKAGE_PATH="~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks"
791    test -z "$TCL_MODULE_PATH"  && \
792        TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl"
793elif test "$prefix/lib" != "$libdir"; then
794    TCL_PACKAGE_PATH="${libdir} ${prefix}/lib ${TCL_PACKAGE_PATH}"
795else
796    TCL_PACKAGE_PATH="${prefix}/lib ${TCL_PACKAGE_PATH}"
797fi
798
799#--------------------------------------------------------------------
800#       The statements below define various symbols relating to Tcl
801#       stub support.
802#--------------------------------------------------------------------
803
804# Replace ${VERSION} with contents of ${TCL_VERSION}
805# double-eval to account for TCL_TRIM_DOTS.
806#
807eval "TCL_STUB_LIB_FILE=libtclstub${TCL_UNSHARED_LIB_SUFFIX}"
808eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
809eval "TCL_STUB_LIB_DIR=${libdir}"
810
811if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then
812    TCL_STUB_LIB_FLAG="-ltclstub${TCL_VERSION}"
813else
814    TCL_STUB_LIB_FLAG="-ltclstub`echo ${TCL_VERSION} | tr -d .`"
815fi
816
817TCL_BUILD_STUB_LIB_SPEC="-L`pwd | sed -e 's/ /\\\\ /g'` ${TCL_STUB_LIB_FLAG}"
818TCL_STUB_LIB_SPEC="-L${TCL_STUB_LIB_DIR} ${TCL_STUB_LIB_FLAG}"
819TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}"
820TCL_STUB_LIB_PATH="${TCL_STUB_LIB_DIR}/${TCL_STUB_LIB_FILE}"
821
822# Install time header dir can be set via --includedir
823eval "TCL_INCLUDE_SPEC=\"-I${includedir}\""
824
825#------------------------------------------------------------------------
826# tclConfig.sh refers to this by a different name
827#------------------------------------------------------------------------
828
829TCL_SHARED_BUILD=${SHARED_BUILD}
830
831AC_SUBST(TCL_VERSION)
832AC_SUBST(TCL_MAJOR_VERSION)
833AC_SUBST(TCL_MINOR_VERSION)
834AC_SUBST(TCL_PATCH_LEVEL)
835AC_SUBST(TCL_YEAR)
836
837AC_SUBST(TCL_LIB_FILE)
838AC_SUBST(TCL_LIB_FLAG)
839AC_SUBST(TCL_LIB_SPEC)
840AC_SUBST(TCL_STUB_LIB_FILE)
841AC_SUBST(TCL_STUB_LIB_FLAG)
842AC_SUBST(TCL_STUB_LIB_SPEC)
843AC_SUBST(TCL_STUB_LIB_PATH)
844AC_SUBST(TCL_INCLUDE_SPEC)
845AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
846AC_SUBST(TCL_BUILD_STUB_LIB_PATH)
847
848AC_SUBST(TCL_SRC_DIR)
849AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
850AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
851AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
852
853AC_SUBST(TCL_SHARED_BUILD)
854AC_SUBST(LD_LIBRARY_PATH_VAR)
855
856AC_SUBST(TCL_BUILD_LIB_SPEC)
857AC_SUBST(TCL_NEEDS_EXP_FILE)
858AC_SUBST(TCL_BUILD_EXP_FILE)
859AC_SUBST(TCL_EXP_FILE)
860
861AC_SUBST(TCL_LIB_VERSIONS_OK)
862AC_SUBST(TCL_SHARED_LIB_SUFFIX)
863AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
864
865AC_SUBST(TCL_HAS_LONGLONG)
866
867AC_SUBST(INSTALL_TZDATA)
868
869AC_SUBST(DTRACE_SRC)
870AC_SUBST(DTRACE_HDR)
871AC_SUBST(DTRACE_OBJ)
872
873AC_SUBST(BUILD_DLTEST)
874AC_SUBST(TCL_PACKAGE_PATH)
875AC_SUBST(TCL_MODULE_PATH)
876
877AC_SUBST(TCL_LIBRARY)
878AC_SUBST(PRIVATE_INCLUDE_DIR)
879AC_SUBST(HTML_DIR)
880
881AC_SUBST(EXTRA_CC_SWITCHES)
882AC_SUBST(EXTRA_APP_CC_SWITCHES)
883AC_SUBST(EXTRA_INSTALL)
884AC_SUBST(EXTRA_INSTALL_BINARIES)
885AC_SUBST(EXTRA_BUILD_HTML)
886AC_SUBST(EXTRA_TCLSH_LIBS)
887
888AC_SUBST(DLTEST_LD)
889AC_SUBST(DLTEST_SUFFIX)
890
891dnl     Disable the automake-friendly normalization of LIBOBJS
892dnl     performed by autoconf 2.53 and later.  It's not correct for us.
893define([_AC_LIBOBJS_NORMALIZE],[])
894AC_CONFIG_FILES([
895    Makefile:../unix/Makefile.in
896    dltest/Makefile:../unix/dltest/Makefile.in
897    tclConfig.sh:../unix/tclConfig.sh.in
898])
899AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.