sl@0: #! /bin/bash -norc sl@0: dnl This file is an input file used by the GNU "autoconf" program to sl@0: dnl generate the file "configure", which is run during Tcl installation sl@0: dnl to configure the system for the local environment. sl@0: # sl@0: # RCS: @(#) $Id: configure.in,v 1.106.2.35 2007/04/29 02:20:38 das Exp $ sl@0: sl@0: AC_INIT(../generic/tcl.h) sl@0: AC_PREREQ(2.13) sl@0: sl@0: TCL_VERSION=8.4 sl@0: TCL_MAJOR_VERSION=8 sl@0: TCL_MINOR_VERSION=4 sl@0: TCL_PATCH_LEVEL=".15" sl@0: VERSION=${TCL_VERSION} sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # Handle the --prefix=... option sl@0: #------------------------------------------------------------------------ sl@0: sl@0: if test "${prefix}" = "NONE"; then sl@0: prefix=/usr/local sl@0: fi sl@0: if test "${exec_prefix}" = "NONE"; then sl@0: exec_prefix=$prefix sl@0: fi sl@0: # Make sure srcdir is fully qualified! sl@0: srcdir=`cd $srcdir ; pwd` sl@0: TCL_SRC_DIR=`cd $srcdir/..; pwd` sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # Compress and/or soft link the manpages? sl@0: #------------------------------------------------------------------------ sl@0: sl@0: SC_CONFIG_MANPAGES([tcl]) sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # Standard compiler checks sl@0: #------------------------------------------------------------------------ sl@0: sl@0: # If the user did not set CFLAGS, set it now to keep sl@0: # the AC_PROG_CC macro from adding "-g -O2". sl@0: if test "${CFLAGS+set}" != "set" ; then sl@0: CFLAGS="" sl@0: fi sl@0: sl@0: AC_PROG_CC sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Supply substitutes for missing POSIX header files. Special notes: sl@0: # - stdlib.h doesn't define strtol, strtoul, or sl@0: # strtod insome versions of SunOS sl@0: # - some versions of string.h don't declare procedures such sl@0: # as strstr sl@0: # Do this early, otherwise an autoconf bug throws errors on configure sl@0: #-------------------------------------------------------------------- sl@0: sl@0: SC_MISSING_POSIX_HEADERS sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # If we're using GCC, see if the compiler understands -pipe. If so, use it. sl@0: # It makes compiling go faster. (This is only a performance feature.) sl@0: #------------------------------------------------------------------------ sl@0: sl@0: if test -z "$no_pipe" && test -n "$GCC"; then sl@0: AC_CACHE_CHECK([if the compiler understands -pipe], sl@0: tcl_cv_cc_pipe, [ sl@0: hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -pipe" sl@0: AC_TRY_COMPILE(,, tcl_cv_cc_pipe=yes, tcl_cv_cc_pipe=no) sl@0: CFLAGS=$hold_cflags]) sl@0: if test $tcl_cv_cc_pipe = yes; then sl@0: CFLAGS="$CFLAGS -pipe" sl@0: fi sl@0: fi sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # Threads support sl@0: #------------------------------------------------------------------------ sl@0: sl@0: SC_ENABLE_THREADS sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Look for libraries that we will need when compiling the Tcl shell sl@0: #-------------------------------------------------------------------- sl@0: sl@0: SC_TCL_LINK_LIBS sl@0: sl@0: # Add the threads support libraries sl@0: LIBS="$LIBS$THREADS_LIBS" sl@0: sl@0: SC_ENABLE_SHARED sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # The statements below define a collection of compile flags. This sl@0: # macro depends on the value of SHARED_BUILD, and should be called sl@0: # after SC_ENABLE_SHARED checks the configure switches. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: SC_CONFIG_CFLAGS sl@0: sl@0: SC_ENABLE_SYMBOLS sl@0: sl@0: TCL_DBGX=${DBGX} sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Detect what compiler flags to set for 64-bit support. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: SC_TCL_EARLY_FLAGS sl@0: sl@0: SC_TCL_64BIT_FLAGS sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Check endianness because we can optimize comparisons of sl@0: # Tcl_UniChar strings to memcmp on big-endian systems. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_C_BIGENDIAN sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Supply substitutes for missing POSIX library procedures, or sl@0: # set flags so Tcl uses alternate procedures. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: # Check if Posix compliant getcwd exists, if not we'll use getwd. sl@0: AC_CHECK_FUNCS(getcwd, , [AC_DEFINE(USEGETWD)]) sl@0: # Nb: if getcwd uses popen and pwd(1) (like SunOS 4) we should really sl@0: # define USEGETWD even if the posix getcwd exists. Add a test ? sl@0: sl@0: AC_REPLACE_FUNCS(opendir strstr strtol strtoll strtoull tmpnam waitpid) sl@0: AC_CHECK_FUNC(strerror, , [AC_DEFINE(NO_STRERROR)]) sl@0: AC_CHECK_FUNC(getwd, , [AC_DEFINE(NO_GETWD)]) sl@0: AC_CHECK_FUNC(wait3, , [AC_DEFINE(NO_WAIT3)]) sl@0: AC_CHECK_FUNC(uname, , [AC_DEFINE(NO_UNAME)]) sl@0: sl@0: if test "`uname -s`" = "Darwin" && test "${TCL_THREADS}" = 1 && \ sl@0: test "`uname -r | awk -F. '{print [$]1}'`" -lt 7; then sl@0: # prior to Darwin 7, realpath is not threadsafe, so don't sl@0: # use it when threads are enabled, c.f. bug # 711232 sl@0: ac_cv_func_realpath=no sl@0: fi sl@0: AC_CHECK_FUNC(realpath, , [AC_DEFINE(NO_REALPATH)]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Look for thread-safe variants of some library functions. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: if test "${TCL_THREADS}" = 1; then sl@0: SC_TCL_GETPWUID_R sl@0: SC_TCL_GETPWNAM_R sl@0: SC_TCL_GETGRGID_R sl@0: SC_TCL_GETGRNAM_R sl@0: if test "`uname -s`" = "Darwin" && \ sl@0: test "`uname -r | awk -F. '{print [$]1}'`" -gt 5; then sl@0: # Starting with Darwin 6 (Mac OSX 10.2), gethostbyX sl@0: # are actually MT-safe as they always return pointers sl@0: # from the TSD instead of the static storage. sl@0: AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME) sl@0: AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR) sl@0: elif test "`uname -s`" = "HP-UX" && \ sl@0: test "`uname -r|sed -e 's|B\.||' -e 's|\..*$||'`" -gt 10; then sl@0: # Starting with HPUX 11.00 (we believe), gethostbyX sl@0: # are actually MT-safe as they always return pointers sl@0: # from TSD instead of static storage. sl@0: AC_DEFINE(HAVE_MTSAFE_GETHOSTBYNAME) sl@0: AC_DEFINE(HAVE_MTSAFE_GETHOSTBYADDR) sl@0: else sl@0: SC_TCL_GETHOSTBYNAME_R sl@0: SC_TCL_GETHOSTBYADDR_R sl@0: fi sl@0: fi sl@0: sl@0: #--------------------------------------------------------------------------- sl@0: # Determine which interface to use to talk to the serial port. sl@0: # Note that #include lines must begin in leftmost column for sl@0: # some compilers to recognize them as preprocessor directives. sl@0: #--------------------------------------------------------------------------- sl@0: sl@0: SC_SERIAL_PORT sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Include sys/select.h if it exists and if it supplies things sl@0: # that appear to be useful and aren't already in sys/types.h. sl@0: # This appears to be true only on the RS/6000 under AIX. Some sl@0: # systems like OSF/1 have a sys/select.h that's of no use, and sl@0: # other systems like SCO UNIX have a sys/select.h that's sl@0: # pernicious. If "fd_set" isn't defined anywhere then set a sl@0: # special flag. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CACHE_CHECK([for fd_set in sys/types], tcl_cv_type_fd_set, [ sl@0: AC_TRY_COMPILE([#include ],[fd_set readMask, writeMask;], sl@0: tcl_cv_type_fd_set=yes, tcl_cv_type_fd_set=no)]) sl@0: tcl_ok=$tcl_cv_type_fd_set sl@0: if test $tcl_ok = no; then sl@0: AC_CACHE_CHECK([for fd_mask in sys/select], tcl_cv_grep_fd_mask, [ sl@0: AC_EGREP_HEADER(fd_mask, sys/select.h, sl@0: tcl_cv_grep_fd_mask=present, tcl_cv_grep_fd_mask=missing)]) sl@0: if test $tcl_cv_grep_fd_mask = present; then sl@0: AC_DEFINE(HAVE_SYS_SELECT_H) sl@0: tcl_ok=yes sl@0: fi sl@0: fi sl@0: if test $tcl_ok = no; then sl@0: AC_DEFINE(NO_FD_SET) sl@0: fi sl@0: sl@0: #------------------------------------------------------------------------------ sl@0: # Find out all about time handling differences. sl@0: #------------------------------------------------------------------------------ sl@0: sl@0: SC_TIME_HANDLER sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Some systems (e.g., IRIX 4.0.5) lack the st_blksize field sl@0: # in struct stat. But we might be able to use fstatfs instead. sl@0: #-------------------------------------------------------------------- sl@0: AC_STRUCT_ST_BLKSIZE sl@0: AC_CHECK_FUNC(fstatfs, , [AC_DEFINE(NO_FSTATFS)]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Some system have no memcmp or it does not work with 8 bit sl@0: # data, this checks it and add memcmp.o to LIBOBJS if needed sl@0: #-------------------------------------------------------------------- sl@0: AC_FUNC_MEMCMP sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Some system like SunOS 4 and other BSD like systems sl@0: # have no memmove (we assume they have bcopy instead). sl@0: # {The replacement define is in compat/string.h} sl@0: #-------------------------------------------------------------------- sl@0: AC_CHECK_FUNC(memmove, , [AC_DEFINE(NO_MEMMOVE) AC_DEFINE(NO_STRING_H)]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # On some systems strstr is broken: it returns a pointer even sl@0: # even if the original string is empty. sl@0: #-------------------------------------------------------------------- sl@0: dnl only run if AC_REPLACE_FUNCS(strstr) hasn't already added strstr.o sl@0: if test "x${ac_cv_func_strstr}" = "xyes"; then sl@0: AC_CACHE_CHECK([proper strstr implementation], tcl_cv_strstr_unbroken, [ sl@0: AC_TRY_RUN([ sl@0: extern int strstr(); sl@0: int main() sl@0: { sl@0: exit(strstr("\0test", "test") ? 1 : 0); sl@0: }], tcl_cv_strstr_unbroken=ok, tcl_cv_strstr_unbroken=broken, sl@0: tcl_cv_strstr_unbroken=broken)]) sl@0: if test $tcl_cv_strstr_unbroken = broken; then sl@0: LIBOBJS="$LIBOBJS strstr.o" sl@0: fi sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Check for strtoul function. This is tricky because under some sl@0: # versions of AIX strtoul returns an incorrect terminator sl@0: # pointer for the string "0". sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CHECK_FUNC(strtoul, tcl_ok=1, tcl_ok=0) sl@0: if test $tcl_ok = 1; then sl@0: AC_CACHE_CHECK([proper strtoul implementation], tcl_cv_strtoul_unbroken, [ sl@0: AC_TRY_RUN([ sl@0: extern int strtoul(); sl@0: int main() sl@0: { sl@0: char *string = "0"; sl@0: char *term; sl@0: int value; sl@0: value = strtoul(string, &term, 0); sl@0: if ((value != 0) || (term != (string+1))) { sl@0: exit(1); sl@0: } sl@0: exit(0); sl@0: }], tcl_cv_strtoul_unbroken=ok , tcl_cv_strtoul_unbroken=broken, sl@0: tcl_cv_strtoul_unbroken=broken)]) sl@0: if test $tcl_cv_strtoul_unbroken = broken; then sl@0: tcl_ok=0 sl@0: fi sl@0: fi sl@0: if test $tcl_ok = 0; then sl@0: LIBOBJS="$LIBOBJS strtoul.o" sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Check for the strtod function. This is tricky because in some sl@0: # versions of Linux strtod mis-parses strings starting with "+". sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CHECK_FUNC(strtod, tcl_ok=1, tcl_ok=0) sl@0: if test $tcl_ok = 1; then sl@0: AC_CACHE_CHECK([proper strtod implementation], tcl_cv_strtod_unbroken, [ sl@0: AC_TRY_RUN([ sl@0: extern double strtod(); sl@0: int main() sl@0: { sl@0: char *string = " +69"; sl@0: char *term; sl@0: double value; sl@0: value = strtod(string, &term); sl@0: if ((value != 69) || (term != (string+4))) { sl@0: exit(1); sl@0: } sl@0: exit(0); sl@0: }], tcl_cv_strtod_unbroken=ok , tcl_cv_strtod_unbroken=broken, sl@0: tcl_cv_strtod_unbroken=broken)]) sl@0: if test $tcl_cv_strtod_unbroken = broken; then sl@0: tcl_ok=0 sl@0: fi sl@0: fi sl@0: if test $tcl_ok = 0; then sl@0: LIBOBJS="$LIBOBJS strtod.o" sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Under Solaris 2.4, strtod returns the wrong value for the sl@0: # terminating character under some conditions. Check for this sl@0: # and if the problem exists use a substitute procedure sl@0: # "fixstrtod" that corrects the error. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: SC_BUGGY_STRTOD sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Check for various typedefs and provide substitutes if sl@0: # they don't exist. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_TYPE_MODE_T sl@0: AC_TYPE_PID_T sl@0: AC_TYPE_SIZE_T sl@0: AC_TYPE_UID_T sl@0: sl@0: AC_CACHE_CHECK([for socklen_t], ac_cv_type_socklen_t, [ sl@0: AC_EGREP_CPP(changequote(<<,>>)dnl sl@0: <<(^|[^a-zA-Z_0-9])socklen_t[^a-zA-Z_0-9]>>dnl sl@0: changequote([,]),[ sl@0: #include sl@0: #include sl@0: #if STDC_HEADERS sl@0: #include sl@0: #include sl@0: #endif sl@0: ], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)]) sl@0: if test $ac_cv_type_socklen_t = no; then sl@0: AC_DEFINE(socklen_t, unsigned) sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # If a system doesn't have an opendir function (man, that's old!) sl@0: # then we have to supply a different version of dirent.h which sl@0: # is compatible with the substitute version of opendir that's sl@0: # provided. This version only works with V7-style directories. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CHECK_FUNC(opendir, , [AC_DEFINE(USE_DIRENT2_H)]) sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # The check below checks whether defines the type sl@0: # "union wait" correctly. It's needed because of weirdness in sl@0: # HP-UX where "union wait" is defined in both the BSD and SYS-V sl@0: # environments. Checking the usability of WIFEXITED seems to do sl@0: # the trick. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CACHE_CHECK([union wait], tcl_cv_union_wait, [ sl@0: AC_TRY_LINK([#include sl@0: #include ], [ sl@0: union wait x; sl@0: WIFEXITED(x); /* Generates compiler error if WIFEXITED sl@0: * uses an int. */ sl@0: ], tcl_cv_union_wait=yes, tcl_cv_union_wait=no)]) sl@0: if test $tcl_cv_union_wait = no; then sl@0: AC_DEFINE(NO_UNION_WAIT) sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Check whether there is an strncasecmp function on this system. sl@0: # This is a bit tricky because under SCO it's in -lsocket and sl@0: # under Sequent Dynix it's in -linet. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CHECK_FUNC(strncasecmp, tcl_ok=1, tcl_ok=0) sl@0: if test "$tcl_ok" = 0; then sl@0: AC_CHECK_LIB(socket, strncasecmp, tcl_ok=1, tcl_ok=0) sl@0: fi sl@0: if test "$tcl_ok" = 0; then sl@0: AC_CHECK_LIB(inet, strncasecmp, tcl_ok=1, tcl_ok=0) sl@0: fi sl@0: if test "$tcl_ok" = 0; then sl@0: LIBOBJS="$LIBOBJS strncasecmp.o" sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # The code below deals with several issues related to gettimeofday: sl@0: # 1. Some systems don't provide a gettimeofday function at all sl@0: # (set NO_GETTOD if this is the case). sl@0: # 2. SGI systems don't use the BSD form of the gettimeofday function, sl@0: # but they have a BSDgettimeofday function that can be used instead. sl@0: # 3. See if gettimeofday is declared in the header file. sl@0: # if not, set the GETTOD_NOT_DECLARED flag so that tclPort.h can sl@0: # declare it. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CHECK_FUNC(BSDgettimeofday, sl@0: [AC_DEFINE(HAVE_BSDGETTIMEOFDAY)], [ sl@0: AC_CHECK_FUNC(gettimeofday, , [AC_DEFINE(NO_GETTOD)]) sl@0: ]) sl@0: AC_CACHE_CHECK([for gettimeofday declaration], tcl_cv_grep_gettimeofday, [ sl@0: AC_EGREP_HEADER(gettimeofday, sys/time.h, sl@0: tcl_cv_grep_gettimeofday=present, tcl_cv_grep_gettimeofday=missing)]) sl@0: if test $tcl_cv_grep_gettimeofday = missing ; then sl@0: AC_DEFINE(GETTOD_NOT_DECLARED) sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # The following code checks to see whether it is possible to get sl@0: # signed chars on this platform. This is needed in order to sl@0: # properly generate sign-extended ints from character values. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_C_CHAR_UNSIGNED sl@0: AC_CACHE_CHECK([signed char declarations], tcl_cv_char_signed, [ sl@0: AC_TRY_COMPILE(, [ sl@0: signed char *p; sl@0: p = 0; sl@0: ], tcl_cv_char_signed=yes, tcl_cv_char_signed=no)]) sl@0: if test $tcl_cv_char_signed = yes; then sl@0: AC_DEFINE(HAVE_SIGNED_CHAR) sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Does putenv() copy or not? We need to know to avoid memory leaks. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CACHE_CHECK([for a putenv() that copies the buffer], tcl_cv_putenv_copy, [ sl@0: AC_TRY_RUN([ sl@0: #include sl@0: #define OURVAR "havecopy=yes" sl@0: int main (int argc, char *argv[]) sl@0: { sl@0: char *foo, *bar; sl@0: foo = (char *)strdup(OURVAR); sl@0: putenv(foo); sl@0: strcpy((char *)(strchr(foo, '=') + 1), "no"); sl@0: bar = getenv("havecopy"); sl@0: if (!strcmp(bar, "no")) { sl@0: /* doesnt copy */ sl@0: return 0; sl@0: } else { sl@0: /* does copy */ sl@0: return 1; sl@0: } sl@0: } sl@0: ], sl@0: tcl_cv_putenv_copy=no, sl@0: tcl_cv_putenv_copy=yes, sl@0: tcl_cv_putenv_copy=no)]) sl@0: if test $tcl_cv_putenv_copy = yes; then sl@0: AC_DEFINE(HAVE_PUTENV_THAT_COPIES) sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Check for support of nl_langinfo function sl@0: #-------------------------------------------------------------------- sl@0: sl@0: SC_ENABLE_LANGINFO sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Darwin specific API checks and defines sl@0: #-------------------------------------------------------------------- sl@0: sl@0: if test "`uname -s`" = "Darwin" ; then sl@0: AC_CHECK_HEADERS(copyfile.h) sl@0: AC_CHECK_FUNCS(copyfile) sl@0: if test $tcl_corefoundation = yes; then sl@0: AC_CHECK_HEADERS(libkern/OSAtomic.h) sl@0: AC_CHECK_FUNCS(OSSpinLockLock) sl@0: AC_CHECK_FUNCS(pthread_atfork) sl@0: fi sl@0: AC_DEFINE(USE_VFORK) sl@0: AC_DEFINE(TCL_DEFAULT_ENCODING, "utf-8") sl@0: AC_DEFINE(TCL_LOAD_FROM_MEMORY) sl@0: AC_CHECK_HEADERS(AvailabilityMacros.h) sl@0: if test "$ac_cv_header_AvailabilityMacros_h" = yes; then sl@0: AC_CACHE_CHECK([if weak import is available], tcl_cv_cc_weak_import, [ sl@0: hold_cflags=$CFLAGS; CFLAGS="$CFLAGS -Werror" sl@0: AC_TRY_LINK([ sl@0: #ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ sl@0: #if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 sl@0: #error __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1020 sl@0: #endif sl@0: #elif MAC_OS_X_VERSION_MIN_REQUIRED < 1020 sl@0: #error MAC_OS_X_VERSION_MIN_REQUIRED < 1020 sl@0: #endif sl@0: int rand(void) __attribute__((weak_import)); sl@0: ], [rand();], sl@0: tcl_cv_cc_weak_import=yes, tcl_cv_cc_weak_import=no) sl@0: CFLAGS=$hold_cflags]) sl@0: if test $tcl_cv_cc_weak_import = yes; then sl@0: AC_DEFINE(HAVE_WEAK_IMPORT) sl@0: fi sl@0: fi sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # Check for support of fts functions (readdir replacement) sl@0: #-------------------------------------------------------------------- sl@0: sl@0: AC_CACHE_CHECK([for fts], tcl_cv_api_fts, [ sl@0: AC_TRY_LINK([ sl@0: #include sl@0: #include sl@0: #include sl@0: ], [ sl@0: char*const p[2] = {"/", NULL}; sl@0: FTS *f = fts_open(p, FTS_PHYSICAL|FTS_NOCHDIR|FTS_NOSTAT, NULL); sl@0: FTSENT *e = fts_read(f); fts_close(f); sl@0: ], tcl_cv_api_fts=yes, tcl_cv_api_fts=no)]) sl@0: if test $tcl_cv_api_fts = yes; then sl@0: AC_DEFINE(HAVE_FTS) sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # The statements below check for systems where POSIX-style sl@0: # non-blocking I/O (O_NONBLOCK) doesn't work or is unimplemented. sl@0: # On these systems (mostly older ones), use the old BSD-style sl@0: # FIONBIO approach instead. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: SC_BLOCKING_STYLE sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # The statements below define a collection of symbols related to sl@0: # building libtcl as a shared library instead of a static library. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} sl@0: TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX} sl@0: eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}" sl@0: sl@0: # tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed sl@0: # so that the backslashes quoting the DBX braces are dropped. sl@0: sl@0: # Trick to replace DBGX with TCL_DBGX sl@0: DBGX='${TCL_DBGX}' sl@0: eval "TCL_LIB_FILE=${TCL_LIB_FILE}" sl@0: sl@0: TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)' sl@0: PRIVATE_INCLUDE_DIR='$(includedir)' sl@0: HTML_DIR='$(DISTDIR)/html' sl@0: sl@0: # Note: in the following variable, it's important to use the absolute sl@0: # path name of the Tcl directory rather than "..": this is because sl@0: # AIX remembers this path and will attempt to use it at run-time to look sl@0: # up the Tcl library. sl@0: sl@0: if test "`uname -s`" = "Darwin" ; then sl@0: SC_ENABLE_FRAMEWORK sl@0: 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: TCL_SHLIB_LD_EXTRAS="${TCL_SHLIB_LD_EXTRAS}"' -install_name ${DYLIB_INSTALL_DIR}/${TCL_LIB_FILE} -seg1addr 0xa000000' sl@0: fi sl@0: sl@0: if test "$FRAMEWORK_BUILD" = "1" ; then sl@0: AC_DEFINE(TCL_FRAMEWORK) sl@0: tcl_config_files="${tcl_config_files} [Tcl-Info.plist:../macosx/Tcl-Info.plist.in]" sl@0: # Construct a fake local framework structure to make linking with sl@0: # '-framework Tcl' and running of tcltest work sl@0: AC_OUTPUT_COMMANDS([test "$FRAMEWORK_BUILD" = "1" && n=Tcl && sl@0: f=$n.framework && v=Versions/$VERSION && sl@0: echo "creating $f" && rm -rf $f && mkdir -p $f/$v/Resources && sl@0: ln -s $v/$n $v/Resources $f && ln -s ../../../$n $f/$v && sl@0: ln -s ../../../../$n-Info.plist $f/$v/Resources/Info.plist && sl@0: unset n f v sl@0: ], [VERSION=${TCL_VERSION} FRAMEWORK_BUILD=${FRAMEWORK_BUILD}]) sl@0: LD_LIBRARY_PATH_VAR="DYLD_FRAMEWORK_PATH" sl@0: if test "${libdir}" = '${exec_prefix}/lib'; then sl@0: # override libdir default sl@0: libdir="/Library/Frameworks" sl@0: fi sl@0: TCL_LIB_FILE="Tcl" sl@0: TCL_LIB_FLAG="-framework Tcl" sl@0: TCL_BUILD_LIB_SPEC="-F`pwd` -framework Tcl" sl@0: TCL_LIB_SPEC="-F${libdir} -framework Tcl" sl@0: libdir="${libdir}/Tcl.framework/Versions/\${VERSION}" sl@0: TCL_LIBRARY="${libdir}/Resources/Scripts" sl@0: includedir="${libdir}/Headers" sl@0: PRIVATE_INCLUDE_DIR="${libdir}/PrivateHeaders" sl@0: HTML_DIR="${libdir}/Resources/Documentation/Reference/Tcl" sl@0: EXTRA_INSTALL="install-private-headers html-tcl" sl@0: EXTRA_BUILD_HTML='@ln -fs contents.htm $(HTML_INSTALL_DIR)/TclTOC.html' sl@0: 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: 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: 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: TCL_YEAR="`date +%Y`" sl@0: # Don't use AC_DEFINE for the following as the framework version define sl@0: # needs to go into the Makefile even when using autoheader, so that we sl@0: # can pick up a potential make override of VERSION. Also, don't put this sl@0: # into CFLAGS as it should not go into tclConfig.sh sl@0: EXTRA_CC_SWITCHES='-DTCL_FRAMEWORK_VERSION=\"$(VERSION)\"' sl@0: else sl@0: # libdir must be a fully qualified path and not ${exec_prefix}/lib sl@0: eval libdir="$libdir" sl@0: if test "$SHARED_BUILD" = "0" || test "$TCL_NEEDS_EXP_FILE" = "0"; then sl@0: if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then sl@0: TCL_LIB_FLAG="-ltcl${TCL_VERSION}\${TCL_DBGX}" sl@0: else sl@0: TCL_LIB_FLAG="-ltcl`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}" sl@0: fi sl@0: TCL_BUILD_LIB_SPEC="-L`pwd` ${TCL_LIB_FLAG}" sl@0: TCL_LIB_SPEC="-L${libdir} ${TCL_LIB_FLAG}" sl@0: else sl@0: TCL_BUILD_EXP_FILE="lib.exp" sl@0: eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}" sl@0: sl@0: # Replace DBGX with TCL_DBGX sl@0: eval "TCL_EXP_FILE=\"${TCL_EXP_FILE}\"" sl@0: sl@0: if test "$GCC" = "yes" ; then sl@0: TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd`/${TCL_BUILD_EXP_FILE} -L`pwd`" sl@0: TCL_LIB_SPEC="-Wl,-bI:${libdir}/${TCL_EXP_FILE} -L`pwd`" sl@0: else sl@0: TCL_BUILD_LIB_SPEC="-bI:`pwd`/${TCL_BUILD_EXP_FILE}" sl@0: TCL_LIB_SPEC="-bI:${libdir}/${TCL_EXP_FILE}" sl@0: fi sl@0: fi sl@0: fi sl@0: VERSION='${VERSION}' sl@0: eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}" sl@0: eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}" sl@0: eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}" sl@0: VERSION=${TCL_VERSION} sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # The statements below define the symbol TCL_PACKAGE_PATH, which sl@0: # gives a list of directories that may contain packages. The list sl@0: # consists of one directory for machine-dependent binaries and sl@0: # another for platform-independent scripts. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: if test "$FRAMEWORK_BUILD" = "1" ; then sl@0: 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: elif test "$prefix" != "$exec_prefix"; then sl@0: TCL_PACKAGE_PATH="${libdir} ${prefix}/lib" sl@0: else sl@0: TCL_PACKAGE_PATH="${prefix}/lib" sl@0: fi sl@0: sl@0: #-------------------------------------------------------------------- sl@0: # The statements below define various symbols relating to Tcl sl@0: # stub support. sl@0: #-------------------------------------------------------------------- sl@0: sl@0: # Replace ${VERSION} with contents of ${TCL_VERSION} sl@0: eval "TCL_STUB_LIB_FILE=libtclstub${TCL_UNSHARED_LIB_SUFFIX}" sl@0: # Replace DBGX with TCL_DBGX sl@0: eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" sl@0: eval "TCL_STUB_LIB_DIR=${libdir}" sl@0: sl@0: if test "${TCL_LIB_VERSIONS_OK}" = "ok"; then sl@0: TCL_STUB_LIB_FLAG="-ltclstub${TCL_VERSION}\${TCL_DBGX}" sl@0: else sl@0: TCL_STUB_LIB_FLAG="-ltclstub`echo ${TCL_VERSION} | tr -d .`\${TCL_DBGX}" sl@0: fi sl@0: sl@0: TCL_BUILD_STUB_LIB_SPEC="-L`pwd` ${TCL_STUB_LIB_FLAG}" sl@0: TCL_STUB_LIB_SPEC="-L${TCL_STUB_LIB_DIR} ${TCL_STUB_LIB_FLAG}" sl@0: TCL_BUILD_STUB_LIB_PATH="`pwd`/${TCL_STUB_LIB_FILE}" sl@0: TCL_STUB_LIB_PATH="${TCL_STUB_LIB_DIR}/${TCL_STUB_LIB_FILE}" sl@0: sl@0: # Install time header dir can be set via --includedir sl@0: eval "TCL_INCLUDE_SPEC=\"-I${includedir}\"" sl@0: sl@0: #------------------------------------------------------------------------ sl@0: # tclConfig.sh refers to this by a different name sl@0: #------------------------------------------------------------------------ sl@0: sl@0: TCL_SHARED_BUILD=${SHARED_BUILD} sl@0: sl@0: AC_SUBST(TCL_VERSION) sl@0: AC_SUBST(TCL_MAJOR_VERSION) sl@0: AC_SUBST(TCL_MINOR_VERSION) sl@0: AC_SUBST(TCL_PATCH_LEVEL) sl@0: AC_SUBST(TCL_YEAR) sl@0: sl@0: AC_SUBST(TCL_LIB_FILE) sl@0: AC_SUBST(TCL_LIB_FLAG) sl@0: AC_SUBST(TCL_LIB_SPEC) sl@0: AC_SUBST(TCL_STUB_LIB_FILE) sl@0: AC_SUBST(TCL_STUB_LIB_FLAG) sl@0: AC_SUBST(TCL_STUB_LIB_SPEC) sl@0: AC_SUBST(TCL_STUB_LIB_PATH) sl@0: AC_SUBST(TCL_INCLUDE_SPEC) sl@0: AC_SUBST(TCL_BUILD_STUB_LIB_SPEC) sl@0: AC_SUBST(TCL_BUILD_STUB_LIB_PATH) sl@0: sl@0: AC_SUBST(TCL_SRC_DIR) sl@0: AC_SUBST(TCL_DBGX) sl@0: AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX) sl@0: AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX) sl@0: AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX) sl@0: sl@0: AC_SUBST(TCL_SHARED_BUILD) sl@0: AC_SUBST(LD_LIBRARY_PATH_VAR) sl@0: sl@0: AC_SUBST(TCL_BUILD_LIB_SPEC) sl@0: AC_SUBST(TCL_NEEDS_EXP_FILE) sl@0: AC_SUBST(TCL_BUILD_EXP_FILE) sl@0: AC_SUBST(TCL_EXP_FILE) sl@0: sl@0: AC_SUBST(TCL_LIB_VERSIONS_OK) sl@0: AC_SUBST(TCL_SHARED_LIB_SUFFIX) sl@0: AC_SUBST(TCL_UNSHARED_LIB_SUFFIX) sl@0: sl@0: AC_SUBST(TCL_HAS_LONGLONG) sl@0: sl@0: AC_SUBST(BUILD_DLTEST) sl@0: AC_SUBST(TCL_PACKAGE_PATH) sl@0: sl@0: AC_SUBST(TCL_LIBRARY) sl@0: AC_SUBST(PRIVATE_INCLUDE_DIR) sl@0: AC_SUBST(HTML_DIR) sl@0: sl@0: AC_SUBST(EXTRA_CC_SWITCHES) sl@0: AC_SUBST(EXTRA_INSTALL) sl@0: AC_SUBST(EXTRA_INSTALL_BINARIES) sl@0: AC_SUBST(EXTRA_BUILD_HTML) sl@0: sl@0: SC_OUTPUT_COMMANDS_PRE sl@0: sl@0: tcl_config_files="${tcl_config_files} [Makefile dltest/Makefile tclConfig.sh]" sl@0: AC_OUTPUT([${tcl_config_files}])