diff options
Diffstat (limited to 'tk/unix/tcl.m4')
-rw-r--r-- | tk/unix/tcl.m4 | 1280 |
1 files changed, 911 insertions, 369 deletions
diff --git a/tk/unix/tcl.m4 b/tk/unix/tcl.m4 index 6ebd6a4b805..31f43a95fb0 100644 --- a/tk/unix/tcl.m4 +++ b/tk/unix/tcl.m4 @@ -31,7 +31,7 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ AC_MSG_CHECKING([for Tcl configuration]) AC_CACHE_VAL(ac_cv_c_tclconfig,[ - # First check to see if --with-tclconfig was specified. + # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` @@ -53,17 +53,16 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break fi - if test -f "$i/win/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd $i/win; pwd)` - break - fi done fi # check in a few common install locations if test x"${ac_cv_c_tclconfig}" = x ; then - for i in `ls -d ${prefix}/lib 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` ; do + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do if test -f "$i/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i; pwd)` break @@ -79,18 +78,14 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [ if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` break - fi - if test -f "$i/win/tclConfig.sh" ; then - ac_cv_c_tclconfig=`(cd $i/win; pwd)` - break - fi + fi done fi ]) if test x"${ac_cv_c_tclconfig}" = x ; then TCL_BIN_DIR="# no Tcl configs found" - AC_MSG_ERROR(Can't find Tcl configuration definitions) + AC_MSG_WARN(Can't find Tcl configuration definitions) exit 0 else no_tcl= @@ -154,16 +149,15 @@ AC_DEFUN(SC_PATH_TKCONFIG, [ ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi - if test -f "$i/win/tkConfig.sh" ; then - ac_cv_c_tkconfig=`(cd $i/win; pwd)` - break - fi done fi # check in a few common install locations if test x"${ac_cv_c_tkconfig}" = x ; then - for i in `ls -d ${prefix}/lib 2>/dev/null` \ - `ls -d /usr/local/lib 2>/dev/null` ; do + for i in `ls -d ${libdir} 2>/dev/null` \ + `ls -d /usr/local/lib 2>/dev/null` \ + `ls -d /usr/contrib/lib 2>/dev/null` \ + `ls -d /usr/lib 2>/dev/null` \ + ; do if test -f "$i/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i; pwd)` break @@ -179,16 +173,12 @@ AC_DEFUN(SC_PATH_TKCONFIG, [ ac_cv_c_tkconfig=`(cd $i/unix; pwd)` break fi - if test -f "$i/win/tkConfig.sh" ; then - ac_cv_c_tkconfig=`(cd $i/win; pwd)` - break - fi done fi ]) if test x"${ac_cv_c_tkconfig}" = x ; then TK_BIN_DIR="# no Tk configs found" - AC_MSG_ERROR(Can't find Tk configuration definitions) + AC_MSG_WARN(Can't find Tk configuration definitions) exit 0 else no_tk= @@ -229,16 +219,43 @@ AC_DEFUN(SC_LOAD_TCLCONFIG, [ fi # - # The eval is required to do the TCL_DBGX substitution in the - # TCL_LIB_FILE variable + # If the TCL_BIN_DIR is the build directory (not the install directory), + # then set the common variable name to the value of the build variables. + # For example, the variable TCL_LIB_SPEC will be set to the value + # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC + # instead of TCL_BUILD_LIB_SPEC since it will work with both an + # installed and uninstalled version of Tcl. # - eval TCL_LIB_FILE=${TCL_LIB_FILE} - eval TCL_LIB_FLAG=${TCL_LIB_FLAG} + if test -f $TCL_BIN_DIR/Makefile ; then + TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC} + TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC} + TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH} + fi + # + # eval is required to do the TCL_DBGX substitution + # + + eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\"" + eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\"" + eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\"" + + eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\"" + eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\"" + eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\"" + + AC_SUBST(TCL_VERSION) AC_SUBST(TCL_BIN_DIR) AC_SUBST(TCL_SRC_DIR) + AC_SUBST(TCL_LIB_FILE) + AC_SUBST(TCL_LIB_FLAG) + AC_SUBST(TCL_LIB_SPEC) + + AC_SUBST(TCL_STUB_LIB_FILE) + AC_SUBST(TCL_STUB_LIB_FLAG) + AC_SUBST(TCL_STUB_LIB_SPEC) ]) #------------------------------------------------------------------------ @@ -258,15 +275,16 @@ AC_DEFUN(SC_LOAD_TCLCONFIG, [ #------------------------------------------------------------------------ AC_DEFUN(SC_LOAD_TKCONFIG, [ - AC_MSG_CHECKING([for existence of $TCLCONFIG]) + AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh]) if test -f "$TK_BIN_DIR/tkConfig.sh" ; then - AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh]) + AC_MSG_RESULT([loading]) . $TK_BIN_DIR/tkConfig.sh else AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh]) fi + AC_SUBST(TK_VERSION) AC_SUBST(TK_BIN_DIR) AC_SUBST(TK_SRC_DIR) AC_SUBST(TK_LIB_FILE) @@ -297,13 +315,13 @@ AC_DEFUN(SC_ENABLE_SHARED, [ AC_MSG_CHECKING([how to build libraries]) AC_ARG_ENABLE(shared, [ --enable-shared build and link with shared libraries [--enable-shared]], - [tcl_ok=$enableval], [tcl_ok=no]) + [tcl_ok=$enableval], [tcl_ok=yes]) if test "${enable_shared+set}" = set; then enableval="$enable_shared" tcl_ok=$enableval else - tcl_ok=no + tcl_ok=yes fi if test "$tcl_ok" = "yes" ; then @@ -317,6 +335,49 @@ AC_DEFUN(SC_ENABLE_SHARED, [ ]) #------------------------------------------------------------------------ +# SC_ENABLE_FRAMEWORK -- +# +# Allows the building of shared libraries into frameworks +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-framework=yes|no +# +# Sets the following vars: +# FRAMEWORK_BUILD Value of 1 or 0 +#------------------------------------------------------------------------ + +AC_DEFUN(SC_ENABLE_FRAMEWORK, [ + AC_MSG_CHECKING([how to package libraries]) + AC_ARG_ENABLE(framework, + [ --enable-framework package shared libraries in frameworks [--disable-framework]], + [tcl_ok=$enableval], [tcl_ok=no]) + + if test "${enable_framework+set}" = set; then + enableval="$enable_framework" + tcl_ok=$enableval + else + tcl_ok=no + fi + + if test "$tcl_ok" = "yes" ; then + AC_MSG_RESULT([framework]) + FRAMEWORK_BUILD=1 + if test "${SHARED_BUILD}" = "0" ; then + AC_MSG_WARN("Frameworks can only be built if --enable-shared is yes") + FRAMEWORK_BUILD=0 + fi + else + AC_MSG_RESULT([standard shared library]) + FRAMEWORK_BUILD=0 + fi +]) + +#------------------------------------------------------------------------ # SC_ENABLE_THREADS -- # # Specify if thread support should be enabled @@ -335,6 +396,7 @@ AC_DEFUN(SC_ENABLE_SHARED, [ # Defines the following vars: # TCL_THREADS # _REENTRANT +# _THREAD_SAFE # #------------------------------------------------------------------------ @@ -347,6 +409,9 @@ AC_DEFUN(SC_ENABLE_THREADS, [ AC_MSG_RESULT(yes) TCL_THREADS=1 AC_DEFINE(TCL_THREADS) + # USE_THREAD_ALLOC tells us to try the special thread-based + # allocator that significantly reduces lock contention + AC_DEFINE(USE_THREAD_ALLOC) AC_DEFINE(_REENTRANT) AC_DEFINE(_THREAD_SAFE) AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) @@ -370,8 +435,14 @@ AC_DEFUN(SC_ENABLE_THREADS, [ else AC_CHECK_LIB(c,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) if test "$tcl_ok" = "no"; then - TCL_THREADS=0 - AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...") + AC_CHECK_LIB(c_r,pthread_mutex_init,tcl_ok=yes,tcl_ok=no) + if test "$tcl_ok" = "yes"; then + # The space is needed + THREADS_LIBS=" -pthread" + else + TCL_THREADS=0 + AC_MSG_WARN("Don t know how to find pthread lib on your system - you must disable thread support or edit the LIBS in the Makefile...") + fi fi fi fi @@ -380,10 +451,12 @@ AC_DEFUN(SC_ENABLE_THREADS, [ # 'pthread_attr_setstacksize' ? AC_CHECK_FUNCS(pthread_attr_setstacksize) + AC_CHECK_FUNCS(readdir_r) else TCL_THREADS=0 - AC_MSG_RESULT(no (default)) + AC_MSG_RESULT([no (default)]) fi + AC_SUBST(TCL_THREADS) ]) #------------------------------------------------------------------------ @@ -417,6 +490,7 @@ AC_DEFUN(SC_ENABLE_THREADS, [ AC_DEFUN(SC_ENABLE_SYMBOLS, [ AC_MSG_CHECKING([for build with symbols]) AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no]) +# FIXME: Currently, LDFLAGS_DEFAULT is not used, it should work like CFLAGS_DEFAULT. if test "$tcl_ok" = "yes"; then CFLAGS_DEFAULT='$(CFLAGS_DEBUG)' LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)' @@ -428,9 +502,134 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ DBGX="" AC_MSG_RESULT([no]) fi + AC_SUBST(CFLAGS_DEFAULT) + AC_SUBST(LDFLAGS_DEFAULT) +]) + +#------------------------------------------------------------------------ +# SC_ENABLE_LANGINFO -- +# +# Allows use of modern nl_langinfo check for better l10n. +# This is only relevant for Unix. +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-langinfo=yes|no (default is yes) +# +# Defines the following vars: +# HAVE_LANGINFO Triggers use of nl_langinfo if defined. +# +#------------------------------------------------------------------------ + +AC_DEFUN(SC_ENABLE_LANGINFO, [ + AC_ARG_ENABLE(langinfo, + [ --enable-langinfo use nl_langinfo if possible to determine + encoding at startup, otherwise use old heuristic], + [langinfo_ok=$enableval], [langinfo_ok=yes]) + + HAVE_LANGINFO=0 + if test "$langinfo_ok" = "yes"; then + if test "$langinfo_ok" = "yes"; then + AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no]) + fi + fi + AC_MSG_CHECKING([whether to use nl_langinfo]) + if test "$langinfo_ok" = "yes"; then + AC_TRY_COMPILE([#include <langinfo.h>], + [nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no]) + if test "$langinfo_ok" = "no"; then + langinfo_ok="no (could not compile with nl_langinfo)"; + fi + if test "$langinfo_ok" = "yes"; then + AC_DEFINE(HAVE_LANGINFO) + fi + fi + AC_MSG_RESULT([$langinfo_ok]) ]) #-------------------------------------------------------------------- +# SC_CONFIG_MANPAGES +# +# Decide whether to use symlinks for linking the manpages and +# whether to compress the manpages after installation. +# +# Arguments: +# none +# +# Results: +# +# Adds the following arguments to configure: +# --enable-man-symlinks +# --enable-man-compression=PROG +# +# Defines the following variable: +# +# MKLINKS_FLAGS - The apropriate flags for mkLinks +# according to the user's selection. +# +#-------------------------------------------------------------------- +AC_DEFUN(SC_CONFIG_MANPAGES, [ + + AC_MSG_CHECKING([whether to use symlinks for manpages]) + AC_ARG_ENABLE(man-symlinks, + [ --enable-man-symlinks use symlinks for the manpages], + test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --symlinks", + enableval="no") + AC_MSG_RESULT([$enableval]) + + AC_MSG_CHECKING([compression for manpages]) + AC_ARG_ENABLE(man-compression, + [ --enable-man-compression=PROG + compress the manpages with PROG], + test "$enableval" = "yes" && echo && AC_MSG_ERROR([missing argument to --enable-man-compression]) + test "$enableval" != "no" && MKLINKS_FLAGS="$MKLINKS_FLAGS --compress $enableval", + enableval="no") + AC_MSG_RESULT([$enableval]) + + AC_SUBST(MKLINKS_FLAGS) +]) + +#------------------------------------------------------------------------ +# SC_ENABLE_MEMDEBUG -- +# +# Specify if the memory debugging code should be used +# +# Arguments: +# none +# +# Requires the following vars to be set in the Makefile: +# None. +# +# Results: +# +# Adds the following arguments to configure: +# --enable-memdebug +# +# Defines the following @vars@: +# MEM_DEBUG_FLAGS Sets to -DTCL_MEM_DEBUG if true +# Sets to "" if false +# +#------------------------------------------------------------------------ + +AC_DEFUN(SC_ENABLE_MEMDEBUG, [ + AC_MSG_CHECKING([for build with memory debugging]) + AC_ARG_ENABLE(memdebug, [ --enable-memdebug build with memory debugging [--disable-memdebug]], [tcl_ok=$enableval], [tcl_ok=no]) + if test "$tcl_ok" = "yes"; then + MEM_DEBUG_FLAGS=-DTCL_MEM_DEBUG + AC_MSG_RESULT([yes]) + else + MEM_DEBUG_FLAGS="" + AC_MSG_RESULT([no]) + fi + AC_SUBST(MEM_DEBUG_FLAGS) +]) + + +#-------------------------------------------------------------------- # SC_CONFIG_CFLAGS # # Try to determine the proper flags to pass to the compiler @@ -441,7 +640,7 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # # Results: # -# Defines the following vars: +# Defines and substitutes the following vars: # # DL_OBJS - Name of the object file that implements dynamic # loading for Tcl on this system. @@ -453,10 +652,20 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib", # that tell the run-time dynamic linker where to look # for shared libraries such as libtcl.so. Depends on +# the variable LIB_RUNTIME_DIR in the Makefile. Could +# be the same as CC_SEARCH_FLAGS if ${CC} is used to link. +# CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib", +# that tell the run-time dynamic linker where to look +# for shared libraries such as libtcl.so. Depends on # the variable LIB_RUNTIME_DIR in the Makefile. -# MAKE_LIB - Command to execute to build the Tcl library; -# differs depending on whether or not Tcl is being -# compiled as a shared library. +# MAKE_LIB - Command to execute to build the a library; +# differs when building shared or static. +# MAKE_STUB_LIB - +# Command to execute to build a stub library. +# INSTALL_LIB - Command to execute to install a library; +# differs when building shared or static. +# INSTALL_STUB_LIB - +# Command to execute to install a stub library. # STLIB_LD - Base command to use for combining object files # into a static library. # SHLIB_CFLAGS - Flags to pass to cc when compiling the components @@ -464,6 +673,9 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # code, among other things). # SHLIB_LD - Base command to use for combining object files # into a shared library. +# SHLIB_LD_FLAGS -Flags to pass when building a shared library. This +# differes from the SHLIB_CFLAGS as it is not used +# when building object files or executables. # SHLIB_LD_LIBS - Dependent libraries for the linker to scan when # creating shared libraries. This symbol typically # goes at the end of the "ld" commands that build @@ -478,15 +690,20 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # SHLIB_SUFFIX - Suffix to use for the names of dynamically loadable # extensions. An empty string means we don't know how # to use shared libraries on this platform. -# TCL_LIB_FILE - Name of the file that contains the Tcl library, such -# as libtcl7.8.so or libtcl7.8.a. -# TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl" -# in the shared library name, using the $VERSION variable +# TCL_SHLIB_LD_EXTRAS - Additional element which are added to SHLIB_LD_LIBS +# TK_SHLIB_LD_EXTRAS for the build of Tcl and Tk, but not recorded in the +# tclConfig.sh, since they are only used for the build +# of Tcl and Tk. +# Examples: MacOS X records the library version and +# compatibility version in the shared library. But +# of course the Tcl version of this is only used for Tcl. +# LIB_SUFFIX - Specifies everything that comes after the "libfoo" +# in a static or shared library name, using the $VERSION variable # to put the version in the right place. This is used # by platforms that need non-standard library names. # Examples: ${VERSION}.so.1.1 on NetBSD, since it needs # to have a version after the .so, and ${VERSION}.a -# on AIX, since the Tcl shared library needs to have +# on AIX, since a shared library needs to have # a .a extension whereas shared objects for loadable # extensions have a .so extension. Defaults to # ${VERSION}${SHLIB_SUFFIX}. @@ -504,13 +721,8 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [ # Flags used when running the compiler in debug mode # CFLAGS_OPTIMIZE - # Flags used when running the compiler in optimize mode -# # EXTRA_CFLAGS # -# Subst's the following vars: -# DL_LIBS -# CFLAGS_DEBUG -# CFLAGS_OPTIMIZE #-------------------------------------------------------------------- AC_DEFUN(SC_CONFIG_CFLAGS, [ @@ -567,15 +779,6 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ fi fi - AC_MSG_CHECKING([if gcc is being used]) - if test "$CC" = "gcc" -o `$CC -v 2>&1 | grep -c gcc` != "0" ; then - using_gcc="yes" - else - using_gcc="no" - fi - - AC_MSG_RESULT([$using_gcc ($CC)]) - # Step 2: check for existence of -ldl library. This is needed because # Linux can use either -ldl or -ldld for dynamic loading. @@ -584,7 +787,6 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ # Step 3: set configuration options based on system name and version. do64bit_ok=no - fullSrcDir=`cd $srcdir; pwd` EXTRA_CFLAGS="" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" @@ -593,7 +795,7 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [ TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g CFLAGS_OPTIMIZE=-O - if test "$using_gcc" = "yes" ; then + if test "$GCC" = "yes" ; then CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int" else CFLAGS_WARNING="" @@ -605,45 +807,107 @@ dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixe dnl AC_CHECK_TOOL(AR, ar, :) AC_CHECK_PROG(AR, ar, ar) STLIB_LD='${AR} cr' + LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH" + PLAT_OBJS="" case $system in - AIX-4.[[2-9]]) - if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then + AIX-5.*) + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then # AIX requires the _r compiler when gcc isn't being used if test "${CC}" != "cc_r" ; then CC=${CC}_r fi AC_MSG_RESULT(Using $CC for compiling with threads) fi + LIBS="$LIBS -lc" + # AIX-5 uses ELF style dynamic libraries SHLIB_CFLAGS="" - SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + + # Note: need the LIBS below, otherwise Tk won't find Tcl's + # symbols when dynamically loaded into tclsh. + SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" - DL_LIBS="-ldl" + # AIX-5 has dl* in libc.so + DL_LIBS="" LDFLAGS="" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' - TCL_NEEDS_EXP_FILE=1 - TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' + + if test "$GCC" = "yes" ; then + CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + else + CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + fi + LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + LD_LIBRARY_PATH_VAR="LIBPATH" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN("64bit mode not supported with GCC on $system") + else + do64bit_ok=yes + EXTRA_CFLAGS="-q64" + LDFLAGS="-q64" + fi + fi ;; AIX-*) - if test "${TCL_THREADS}" = "1" -a "$using_gcc" = "no" ; then + if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then # AIX requires the _r compiler when gcc isn't being used if test "${CC}" != "cc_r" ; then CC=${CC}_r fi AC_MSG_RESULT(Using $CC for compiling with threads) fi + LIBS="$LIBS -lc" SHLIB_CFLAGS="" - SHLIB_LD="$fullSrcDir/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" - LIBOBJS="$LIBOBJS tclLoadAix.o" - DL_LIBS="-lld" + DL_LIBS="-ldl" LDFLAGS="" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + LD_LIBRARY_PATH_VAR="LIBPATH" TCL_NEEDS_EXP_FILE=1 TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.exp' + + # AIX v<=4.1 has some different flags than 4.2+ + if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then + LIBOBJS="$LIBOBJS tclLoadAix.o" + DL_LIBS="-lld" + fi + + # On AIX <=v4 systems, libbsd.a has to be linked in to support + # non-blocking file IO. This library has to be linked in after + # the MATH_LIBS or it breaks the pow() function. The way to + # insure proper sequencing, is to add it to the tail of MATH_LIBS. + # This library also supplies gettimeofday. + # + # AIX does not have a timezone field in struct tm. When the AIX + # bsd library is used, the timezone global and the gettimeofday + # methods are to be avoided for timezone deduction instead, we + # deduce the timezone by comparing the localtime result on a + # known GMT value. + + AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no) + if test $libbsd = yes; then + MATH_LIBS="$MATH_LIBS -lbsd" + AC_DEFINE(USE_DELTA_FOR_TZ) + fi + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN("64bit mode not supported with GCC on $system") + else + do64bit_ok=yes + EXTRA_CFLAGS="-q64" + LDFLAGS="-q64" + fi + fi ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" @@ -653,6 +917,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; BSD/OS-4.*) @@ -663,6 +928,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="-export-dynamic" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; dgux*) @@ -673,9 +939,54 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; - HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*|HP-UX-*.11.*) + HP-UX-*.11.*) + # Use updated header definitions where possible + AC_DEFINE(_XOPEN_SOURCE_EXTENDED) + + SHLIB_SUFFIX=".sl" + AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) + if test "$tcl_ok" = yes; then + SHLIB_CFLAGS="+z" + SHLIB_LD="ld -b" + SHLIB_LD_LIBS='${LIBS}' + DL_OBJS="tclLoadShl.o" + DL_LIBS="-ldld" + LDFLAGS="-Wl,-E" + CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + fi + + # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc + #EXTRA_CFLAGS="+DAportable" + + # Check to enable 64-bit flags for compiler/linker + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + hpux_arch='`gcc -dumpmachine`' + case $hpux_arch in + hppa64*) + # 64-bit gcc in use. Fix flags for GNU ld. + do64bit_ok=yes + SHLIB_LD="gcc -shared" + SHLIB_LD_LIBS="" + LD_SEARCH_FLAGS='' + ;; + *) + AC_MSG_WARN("64bit mode not supported with GCC on $system") + ;; + esac + else + do64bit_ok=yes + EXTRA_CFLAGS="+DA2.0W" + LDFLAGS="+DA2.0W $LDFLAGS" + fi + fi + ;; + HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*) SHLIB_SUFFIX=".sl" AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no) if test "$tcl_ok" = yes; then @@ -685,7 +996,9 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" LDFLAGS="-Wl,-E" - LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' + LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' + LD_LIBRARY_PATH_VAR="SHLIB_PATH" fi ;; IRIX-4.*) @@ -696,18 +1009,32 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadAout.o" DL_LIBS="" LDFLAGS="-Wl,-D,08000000" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' ;; - IRIX-5.*|IRIX-6.*|IRIX64-6.5*) + IRIX-5.*) + SHLIB_CFLAGS="" + SHLIB_LD="ld -shared -rdata_shared" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="" + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + EXTRA_CFLAGS="" + LDFLAGS="" + ;; + IRIX-6.*|IRIX64-6.5*) SHLIB_CFLAGS="" SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - if test "$using_gcc" = "yes" ; then + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then EXTRA_CFLAGS="-mabi=n32" LDFLAGS="-mabi=n32" else @@ -725,13 +1052,28 @@ dnl AC_CHECK_TOOL(AR, ar, :) ;; IRIX64-6.*) SHLIB_CFLAGS="" - SHLIB_LD="ld -32 -shared -rdata_shared" + SHLIB_LD="ld -n32 -shared -rdata_shared" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + + # Check to enable 64-bit flags for compiler/linker + + if test "$do64bit" = "yes" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN([64bit mode not supported by gcc]) + else + do64bit_ok=yes + SHLIB_LD="ld -64 -shared -rdata_shared" + EXTRA_CFLAGS="-64" + LDFLAGS="-64" + fi + fi + ;; Linux*) SHLIB_CFLAGS="-fPIC" @@ -749,13 +1091,52 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="-rdynamic" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else AC_CHECK_HEADER(dld.h, [ SHLIB_LD="ld -shared" DL_OBJS="tclLoadDld.o" DL_LIBS="-ldld" LDFLAGS="" + CC_SEARCH_FLAGS="" + LD_SEARCH_FLAGS=""]) + fi + if test "`uname -m`" = "alpha" ; then + EXTRA_CFLAGS="-mieee" + fi + + # The combo of gcc + glibc has a bug related + # to inlining of functions like strtod(). The + # -fno-builtin flag should address this problem + # but it does not work. The -fno-inline flag + # is kind of overkill but it works. + # Disable inlining only when one of the + # files in compat/*.c is being linked in. + if test x"${LIBOBJS}" != x ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline" + fi + + ;; + GNU*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + + if test "$have_dl" = yes; then + SHLIB_LD="${CC} -shared" + DL_OBJS="" + DL_LIBS="-ldl" + LDFLAGS="-rdynamic" + CC_SEARCH_FLAGS="" + LD_SEARCH_FLAGS="" + else + AC_CHECK_HEADER(dld.h, [ + SHLIB_LD="ld -shared" + DL_OBJS="" + DL_LIBS="-ldld" + LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS=""]) fi if test "`uname -m`" = "alpha" ; then @@ -770,6 +1151,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; MP-RAS-*) @@ -780,6 +1162,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="-Wl,-Bexport" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; NetBSD-*|FreeBSD-[[1-2]].*|OpenBSD-*) @@ -793,7 +1176,8 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' AC_MSG_CHECKING(for ELF) AC_EGREP_CPP(yes, [ #ifdef __ELF__ @@ -813,7 +1197,8 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadAout.o" DL_LIBS="" LDFLAGS="" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' ]) @@ -826,12 +1211,47 @@ dnl AC_CHECK_TOOL(AR, ar, :) # FreeBSD 3.* and greater have ELF. SHLIB_CFLAGS="-fPIC" SHLIB_LD="ld -Bshareable -x" - SHLIB_LD_LIBS="" + SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="-export-dynamic" + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "${TCL_THREADS}" = "1" ; then + # The -pthread needs to go in the CFLAGS, not LIBS + LIBS=`echo $LIBS | sed s/-pthread//` + EXTRA_CFLAGS="-pthread" + LDFLAGS="$LDFLAGS -pthread" + fi + case $system in + FreeBSD-3.*) + # FreeBSD-3 doesn't handle version numbers with dots. + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so' + TCL_LIB_VERSIONS_OK=nodots + ;; + esac + ;; + Rhapsody-*|Darwin-*) + SHLIB_CFLAGS="-fno-common" + SHLIB_LD="cc -dynamiclib \${LDFLAGS}" + TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" + TK_SHLIB_LD_EXTRAS="-compatibility_version ${TK_VERSION} -current_version \${VERSION} -install_name \${DYLIB_INSTALL_DIR}/\${TK_LIB_FILE} -prebind -seg1addr 0xb000000" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".dylib" + DL_OBJS="tclLoadDyld.o" + PLAT_OBJS="tclMacOSXBundle.o" + DL_LIBS="" + LDFLAGS="-prebind" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" + CFLAGS_OPTIMIZE="-Os" + LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" + # for compatibility with autoconf vers 2.13 : + HACK="" + EXTRA_CFLAGS="-DMA${HACK}C_OSX_TCL -DHAVE_CFBUNDLE -DTCL_DEFAULT_ENCODING=\\\"utf-8\\\"" + LIBS="$LIBS -framework CoreFoundation" ;; NEXTSTEP-*) SHLIB_CFLAGS="" @@ -841,6 +1261,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadNext.o" DL_LIBS="" LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OS/390-*) @@ -857,45 +1278,71 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadOSF.o" DL_LIBS="" LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-1.*) # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2 SHLIB_CFLAGS="-fPIC" - SHLIB_LD="ld -shared" + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD="ld -shared" + else + SHLIB_LD="ld -non_shared" + fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-V*) # Digital OSF/1 SHLIB_CFLAGS="" - SHLIB_LD='ld -shared -expect_unresolved "*"' + if test "$SHARED_BUILD" = "1" ; then + SHLIB_LD='ld -shared -expect_unresolved "*"' + else + SHLIB_LD='ld -non_shared -expect_unresolved "*"' + fi SHLIB_LD_LIBS="" SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" LDFLAGS="" - LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - if test "$using_gcc" = "no" ; then + CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' + if test "$GCC" != "yes" ; then EXTRA_CFLAGS="-DHAVE_TZSET -std1" fi # see pthread_intro(3) for pthread support on osf1, k.furukawa if test "${TCL_THREADS}" = "1" ; then + EXTRA_CFLAGS="${EXTRA_CFLAGS} -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" EXTRA_CFLAGS="${EXTRA_CFLAGS} -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" - if test "$using_gcc" = "no" ; then + LIBS=`echo $LIBS | sed s/-lpthreads//` + if test "$GCC" = "yes" ; then + LIBS="$LIBS -lpthread -lmach -lexc" + else EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread" LDFLAGS="-pthread" - else - LIBS=`echo $LIBS | sed s/-lpthreads//` - LIBS="$LIBS -lpthread -lmach -lexc" fi fi ;; + QNX-6*) + # QNX RTP + # This may work for all QNX, but it was only reported for v6. + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="ld -Bshareable -x" + SHLIB_LD_LIBS="" + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + # dlopen is in -lc on QNX + DL_LIBS="" + LDFLAGS="" + CC_SEARCH_FLAGS="" + LD_SEARCH_FLAGS="" + ;; RISCos-*) SHLIB_CFLAGS="-G 0" SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0" @@ -904,13 +1351,14 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadAout.o" DL_LIBS="" LDFLAGS="-Wl,-D,08000000" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} ;; SCO_SV-3.2*) # Note, dlopen is available only on SCO 3.2.5 and greater. However, # this test works, since "uname -s" was non-standard in 3.2.4 and # below. - if test "$using_gcc" = "yes" ; then + if test "$GCC" = "yes" ; then SHLIB_CFLAGS="-fPIC -melf" LDFLAGS="-melf -Wl,-Bexport" else @@ -922,7 +1370,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="-belf -Wl,-Bexport" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SINIX*5.4*) @@ -933,6 +1381,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-4*) @@ -943,7 +1392,8 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} # SunOS can't handle version numbers with dots in them in library # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it @@ -955,8 +1405,14 @@ dnl AC_CHECK_TOOL(AR, ar, :) TCL_LIB_VERSIONS_OK=nodots ;; SunOS-5.[[0-6]]*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + AC_DEFINE(_REENTRANT) + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) + SHLIB_CFLAGS="-KPIC" - SHLIB_LD="/usr/ccs/bin/ld -G -z text" # Note: need the LIBS below, otherwise Tk won't find Tcl's # symbols when dynamically loaded into tclsh. @@ -966,18 +1422,34 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" LDFLAGS="" - LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + fi ;; SunOS-5*) + + # Note: If _REENTRANT isn't defined, then Solaris + # won't define thread-safe library routines. + + AC_DEFINE(_REENTRANT) + AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) + SHLIB_CFLAGS="-KPIC" - SHLIB_LD="/usr/ccs/bin/ld -G -z text" LDFLAGS="" - do64bit_ok=no + # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then arch=`isainfo` if test "$arch" = "sparcv9 sparc" ; then - if test "$using_gcc" = "no" ; then + if test "$GCC" = "yes" ; then + AC_MSG_WARN("64bit mode not supported with GCC on $system") + else do64bit_ok=yes if test "$do64bitVIS" = "yes" ; then EXTRA_CFLAGS="-xarch=v9a" @@ -986,8 +1458,6 @@ dnl AC_CHECK_TOOL(AR, ar, :) EXTRA_CFLAGS="-xarch=v9" LDFLAGS="-xarch=v9" fi - else - AC_MSG_WARN("64bit mode not supported with GCC on $system") fi else AC_MSG_WARN("64bit mode only supported sparcv9 system") @@ -1001,9 +1471,13 @@ dnl AC_CHECK_TOOL(AR, ar, :) SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - if test "$using_gcc" = "yes" ; then - LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + if test "$GCC" = "yes" ; then + SHLIB_LD="$CC -shared" + CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} else + SHLIB_LD="/usr/ccs/bin/ld -G -z text" + CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' fi ;; @@ -1015,8 +1489,9 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadAout.o" DL_LIBS="" LDFLAGS="-Wl,-D,08000000" - LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' - if test "$using_gcc" = "no" ; then + CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' + LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS} + if test "$GCC" != "yes" ; then EXTRA_CFLAGS="-DHAVE_TZSET -std1" fi ;; @@ -1040,6 +1515,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) else LDFLAGS="" fi + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" ;; esac @@ -1144,6 +1620,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) DL_OBJS="tclLoadNone.o" DL_LIBS="" LDFLAGS="" + CC_SEARCH_FLAGS="" LD_SEARCH_FLAGS="" BUILD_DLTEST="" fi @@ -1153,7 +1630,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) # standard manufacturer compiler. if test "$DL_OBJS" != "tclLoadNone.o" ; then - if test "$using_gcc" = "yes" ; then + if test "$GCC" = "yes" ; then case $system in AIX-*) ;; @@ -1163,6 +1640,8 @@ dnl AC_CHECK_TOOL(AR, ar, :) ;; NetBSD-*|FreeBSD-*|OpenBSD-*) ;; + Rhapsody-*|Darwin-*) + ;; RISCos-*) ;; SCO_SV-3.2*) @@ -1183,15 +1662,79 @@ dnl AC_CHECK_TOOL(AR, ar, :) UNSHARED_LIB_SUFFIX='${VERSION}\$\{DBGX\}.a' fi -# CYGNUS LOCAL - TCL_LIB_SUFFIX=.a - AC_SUBST(TCL_LIB_SUFFIX) -# END CYGNUS LOCAL + AC_REQUIRE([AC_PROG_RANLIB]) + + if test "${SHARED_BUILD}" = "1" && test "${SHLIB_SUFFIX}" != "" ; then + LIB_SUFFIX=${SHARED_LIB_SUFFIX} + MAKE_LIB='${SHLIB_LD} -o [$]@ ${SHLIB_LD_FLAGS} ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}' + INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' + else + LIB_SUFFIX=${UNSHARED_LIB_SUFFIX} + + if test "$RANLIB" = "" ; then + MAKE_LIB='$(STLIB_LD) [$]@ ${OBJS}' + INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE)' + else + MAKE_LIB='${STLIB_LD} [$]@ ${OBJS} ; ${RANLIB} [$]@' + INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) $(LIB_INSTALL_DIR)/$(LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(LIB_FILE))' + fi + +dnl Not at all clear what this was doing in Tcl's configure.in +dnl or why it was needed was needed. In any event, this sort of +dnl things needs to be done in the big loop above. +dnl REMOVE THIS BLOCK LATER! (mdejong) +dnl case $system in +dnl BSD/OS*) +dnl ;; +dnl AIX-[[1-4]].*) +dnl ;; +dnl *) +dnl SHLIB_LD_LIBS="" +dnl ;; +dnl esac + fi + + + # Stub lib does not depend on shared/static configuration + if test "$RANLIB" = "" ; then + MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS}' + INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE)' + else + MAKE_STUB_LIB='${STLIB_LD} [$]@ ${STUB_LIB_OBJS} ; ${RANLIB} [$]@' + INSTALL_STUB_LIB='$(INSTALL_LIBRARY) $(STUB_LIB_FILE) $(LIB_INSTALL_DIR)/$(STUB_LIB_FILE) ; (cd $(LIB_INSTALL_DIR) ; $(RANLIB) $(STUB_LIB_FILE))' + fi + AC_SUBST(DL_LIBS) + + AC_SUBST(DL_OBJS) + AC_SUBST(PLAT_OBJS) + AC_SUBST(CFLAGS) AC_SUBST(CFLAGS_DEBUG) AC_SUBST(CFLAGS_OPTIMIZE) AC_SUBST(CFLAGS_WARNING) + AC_SUBST(EXTRA_CFLAGS) + + AC_SUBST(LDFLAGS) + AC_SUBST(LDFLAGS_DEBUG) + AC_SUBST(LDFLAGS_OPTIMIZE) + AC_SUBST(CC_SEARCH_FLAGS) + AC_SUBST(LD_SEARCH_FLAGS) + + AC_SUBST(STLIB_LD) + AC_SUBST(SHLIB_LD) + AC_SUBST(TCL_SHLIB_LD_EXTRAS) + AC_SUBST(TK_SHLIB_LD_EXTRAS) + AC_SUBST(SHLIB_LD_FLAGS) + AC_SUBST(SHLIB_LD_LIBS) + AC_SUBST(SHLIB_CFLAGS) + AC_SUBST(SHLIB_SUFFIX) + + AC_SUBST(MAKE_LIB) + AC_SUBST(MAKE_STUB_LIB) + AC_SUBST(INSTALL_LIB) + AC_SUBST(INSTALL_STUB_LIB) + AC_SUBST(RANLIB) ]) #-------------------------------------------------------------------- @@ -1199,7 +1742,9 @@ dnl AC_CHECK_TOOL(AR, ar, :) # # Determine which interface to use to talk to the serial port. # Note that #include lines must begin in leftmost column for -# some compilers to recognize them as preprocessor directives. +# some compilers to recognize them as preprocessor directives, +# and some build environments have stdin not pointing at a +# pseudo-terminal (usually /dev/null instead.) # # Arguments: # none @@ -1207,6 +1752,7 @@ dnl AC_CHECK_TOOL(AR, ar, :) # Results: # # Defines only one of the following vars: +# HAVE_SYS_MODEM_H # USE_TERMIOS # USE_TERMIO # USE_SGTTY @@ -1214,13 +1760,13 @@ dnl AC_CHECK_TOOL(AR, ar, :) #-------------------------------------------------------------------- AC_DEFUN(SC_SERIAL_PORT, [ + AC_CHECK_HEADERS(sys/modem.h) AC_MSG_CHECKING([termios vs. termio vs. sgtty]) - + AC_CACHE_VAL(tcl_cv_api_serial, [ AC_TRY_RUN([ #include <termios.h> -main() -{ +int main() { struct termios t; if (tcgetattr(0, &t) == 0) { cfsetospeed(&t, 0); @@ -1228,32 +1774,25 @@ main() return 0; } return 1; -}], tk_ok=termios, tk_ok=no, tk_ok=no) - - if test $tk_ok = termios; then - AC_DEFINE(USE_TERMIOS) - else +}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include <termio.h> -main() -{ +int main() { struct termio t; if (ioctl(0, TCGETA, &t) == 0) { t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; return 0; } return 1; - }], tk_ok=termio, tk_ok=no, tk_ok=no) - - if test $tk_ok = termio; then - AC_DEFINE(USE_TERMIO) - else +}], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) + fi + if test $tcl_cv_api_serial = no ; then AC_TRY_RUN([ #include <sgtty.h> -main() -{ +int main() { struct sgttyb t; if (ioctl(0, TIOCGETP, &t) == 0) { t.sg_ospeed = 0; @@ -1261,13 +1800,61 @@ main() return 0; } return 1; -}], tk_ok=sgtty, tk_ok=none, tk_ok=none) - if test $tk_ok = sgtty; then - AC_DEFINE(USE_SGTTY) +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi + if test $tcl_cv_api_serial = no ; then + AC_TRY_RUN([ +#include <termios.h> +#include <errno.h> + +int main() { + struct termios t; + if (tcgetattr(0, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + cfsetospeed(&t, 0); + t.c_cflag |= PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; +}], tcl_cv_api_serial=termios, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi + if test $tcl_cv_api_serial = no; then + AC_TRY_RUN([ +#include <termio.h> +#include <errno.h> + +int main() { + struct termio t; + if (ioctl(0, TCGETA, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + t.c_cflag |= CBAUD | PARENB | PARODD | CSIZE | CSTOPB; + return 0; + } + return 1; + }], tcl_cv_api_serial=termio, tcl_cv_api_serial=no, tcl_cv_api_serial=no) fi - AC_MSG_RESULT($tk_ok) + if test $tcl_cv_api_serial = no; then + AC_TRY_RUN([ +#include <sgtty.h> +#include <errno.h> + +int main() { + struct sgttyb t; + if (ioctl(0, TIOCGETP, &t) == 0 + || errno == ENOTTY || errno == ENXIO || errno == EINVAL) { + t.sg_ospeed = 0; + t.sg_flags |= ODDP | EVENP | RAW; + return 0; + } + return 1; +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none) + fi]) + case $tcl_cv_api_serial in + termios) AC_DEFINE(USE_TERMIOS);; + termio) AC_DEFINE(USE_TERMIO);; + sgtty) AC_DEFINE(USE_SGTTY);; + esac + AC_MSG_RESULT($tcl_cv_api_serial) ]) #-------------------------------------------------------------------- @@ -1302,7 +1889,6 @@ main() #-------------------------------------------------------------------- AC_DEFUN(SC_MISSING_POSIX_HEADERS, [ - AC_MSG_CHECKING(dirent.h) AC_TRY_LINK([#include <sys/types.h> #include <dirent.h>], [ @@ -1330,10 +1916,10 @@ closedir(d); fi AC_MSG_RESULT($tcl_ok) - AC_CHECK_HEADER(errno.h, , AC_DEFINE(NO_ERRNO_H)) - AC_CHECK_HEADER(float.h, , AC_DEFINE(NO_FLOAT_H)) - AC_CHECK_HEADER(values.h, , AC_DEFINE(NO_VALUES_H)) - AC_CHECK_HEADER(limits.h, , AC_DEFINE(NO_LIMITS_H)) + AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)]) + AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)]) + AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)]) + AC_CHECK_HEADER(limits.h, , [AC_DEFINE(NO_LIMITS_H)]) AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0) AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0) AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0) @@ -1352,8 +1938,8 @@ closedir(d); AC_DEFINE(NO_STRING_H) fi - AC_CHECK_HEADER(sys/wait.h, , AC_DEFINE(NO_SYS_WAIT_H)) - AC_CHECK_HEADER(dlfcn.h, , AC_DEFINE(NO_DLFCN_H)) + AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)]) + AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)]) # OS/390 lacks sys/param.h (and doesn't need it, by chance). @@ -1396,28 +1982,27 @@ AC_DEFUN(SC_PATH_X, [ fi if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then AC_MSG_CHECKING(for X11 header files) - XINCLUDES="# no special path needed" - AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope") - if test "$XINCLUDES" = nope; then + found_xincludes="no" + AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no") + if test "$found_xincludes" = "no"; then dirs="/usr/unsupported/include /usr/local/include /usr/X386/include /usr/X11R6/include /usr/X11R5/include /usr/include/X11R5 /usr/include/X11R4 /usr/openwin/include /usr/X11/include /usr/sww/include" for i in $dirs ; do if test -r $i/X11/Intrinsic.h; then AC_MSG_RESULT($i) XINCLUDES=" -I$i" + found_xincludes="yes" break fi done fi else if test "$x_includes" != ""; then - XINCLUDES=-I$x_includes - else - XINCLUDES="# no special path needed" + XINCLUDES="-I$x_includes" + found_xincludes="yes" fi fi - if test "$XINCLUDES" = nope; then + if test found_xincludes = "no"; then AC_MSG_RESULT(couldn't find any!) - XINCLUDES="# no include files found" fi if test "$no_x" = yes; then @@ -1515,68 +2100,6 @@ AC_DEFUN(SC_BLOCKING_STYLE, [ ]) #-------------------------------------------------------------------- -# SC_HAVE_VFORK -# -# Check to see whether the system provides a vfork kernel call. -# If not, then use fork instead. Also, check for a problem with -# vforks and signals that can cause core dumps if a vforked child -# resets a signal handler. If the problem exists, then use fork -# instead of vfork. -# -# Arguments: -# none -# -# Results: -# -# Defines some of the following vars: -# vfork (=fork) -# -#-------------------------------------------------------------------- - -AC_DEFUN(SC_HAVE_VFORK, [ - AC_TYPE_SIGNAL() - AC_CHECK_FUNC(vfork, tcl_ok=1, tcl_ok=0) - if test "$tcl_ok" = 1; then - AC_MSG_CHECKING([vfork/signal bug]); - AC_TRY_RUN([ -#include <stdio.h> -#include <signal.h> -#include <sys/wait.h> -int gotSignal = 0; -sigProc(sig) - int sig; -{ - gotSignal = 1; -} -main() -{ - int pid, sts; - (void) signal(SIGCHLD, sigProc); - pid = vfork(); - if (pid < 0) { - exit(1); - } else if (pid == 0) { - (void) signal(SIGCHLD, SIG_DFL); - _exit(0); - } else { - (void) wait(&sts); - } - exit((gotSignal) ? 0 : 1); -}], tcl_ok=1, tcl_ok=0, tcl_ok=0) - - if test "$tcl_ok" = 1; then - AC_MSG_RESULT(ok) - else - AC_MSG_RESULT([buggy, using fork instead]) - fi - fi - rm -f core - if test "$tcl_ok" = 0; then - AC_DEFINE(vfork, fork) - fi -]) - -#-------------------------------------------------------------------- # SC_TIME_HANLDER # # Checks how the system deals with time.h, what time structures @@ -1600,73 +2123,54 @@ AC_DEFUN(SC_TIME_HANDLER, [ AC_HEADER_TIME AC_STRUCT_TIMEZONE + AC_CHECK_FUNCS(gmtime_r localtime_r) + AC_MSG_CHECKING([tm_tzadj in struct tm]) - AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;], - [AC_DEFINE(HAVE_TM_TZADJ) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) + AC_CACHE_VAL(tcl_cv_member_tm_tzadj, + AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;], + tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no)) + AC_MSG_RESULT($tcl_cv_member_tm_tzadj) + if test $tcl_cv_member_tm_tzadj = yes ; then + AC_DEFINE(HAVE_TM_TZADJ) + fi AC_MSG_CHECKING([tm_gmtoff in struct tm]) - AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;], - [AC_DEFINE(HAVE_TM_GMTOFF) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) + AC_CACHE_VAL(tcl_cv_member_tm_gmtoff, + AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;], + tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no)) + AC_MSG_RESULT($tcl_cv_member_tm_gmtoff) + if test $tcl_cv_member_tm_gmtoff = yes ; then + AC_DEFINE(HAVE_TM_GMTOFF) + fi # # Its important to include time.h in this check, as some systems # (like convex) have timezone functions, etc. # - have_timezone=no AC_MSG_CHECKING([long timezone variable]) - AC_TRY_COMPILE([#include <time.h>], + AC_CACHE_VAL(tcl_cv_var_timezone, + AC_TRY_COMPILE([#include <time.h>], [extern long timezone; timezone += 1; exit (0);], - [have_timezone=yes + tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no)) + AC_MSG_RESULT($tcl_cv_timezone_long) + if test $tcl_cv_timezone_long = yes ; then + AC_DEFINE(HAVE_TIMEZONE_VAR) + else + # + # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. + # + AC_MSG_CHECKING([time_t timezone variable]) + AC_CACHE_VAL(tcl_cv_timezone_time, + AC_TRY_COMPILE([#include <time.h>], + [extern time_t timezone; + timezone += 1; + exit (0);], + tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no)) + AC_MSG_RESULT($tcl_cv_timezone_time) + if test $tcl_cv_timezone_time = yes ; then AC_DEFINE(HAVE_TIMEZONE_VAR) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) - - # - # On some systems (eg IRIX 6.2), timezone is a time_t and not a long. - # - if test "$have_timezone" = no; then - AC_MSG_CHECKING([time_t timezone variable]) - AC_TRY_COMPILE([#include <time.h>], - [extern time_t timezone; - timezone += 1; - exit (0);], - [AC_DEFINE(HAVE_TIMEZONE_VAR) - AC_MSG_RESULT(yes)], - AC_MSG_RESULT(no)) - fi - - # - # On some systems (eg Solaris 2.5.1), timezone is not declared in - # time.h unless you jump through hoops. Instead of that, we just - # declare it ourselves when necessary. - # - if test "$have_timezone" = yes; then - AC_MSG_CHECKING(for timezone declaration) - changequote(<<,>>) - tzrx='^[ ]*extern.*timezone' - changequote([,]) - AC_EGREP_HEADER($tzrx, time.h, [ - AC_DEFINE(HAVE_TIMEZONE_DECL) - AC_MSG_RESULT(found)], AC_MSG_RESULT(missing)) - fi - - # - # AIX does not have a timezone field in struct tm. When the AIX bsd - # library is used, the timezone global and the gettimeofday methods are - # to be avoided for timezone deduction instead, we deduce the timezone - # by comparing the localtime result on a known GMT value. - # - - if test "`uname -s`" = "AIX" ; then - AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes) - if test $libbsd = yes; then - AC_DEFINE(USE_DELTA_FOR_TZ) fi fi ]) @@ -1695,24 +2199,28 @@ AC_DEFUN(SC_BUGGY_STRTOD, [ AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0) if test "$tcl_strtod" = 1; then AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs]) - AC_TRY_RUN([ - extern double strtod(); - int main() - { - char *string = "NaN", *spaceString = " "; - char *term; - double value; - value = strtod(string, &term); - if ((term != string) && (term[-1] == 0)) { - exit(1); - } - value = strtod(spaceString, &term); - if (term == (spaceString+1)) { - exit(1); - } - exit(0); - }], tcl_ok=1, tcl_ok=0, tcl_ok=0) - if test "$tcl_ok" = 1; then + AC_CACHE_VAL(tcl_cv_strtod_buggy,[ + AC_TRY_RUN([ + extern double strtod(); + int main() { + char *infString="Inf", *nanString="NaN", *spaceString=" "; + char *term; + double value; + value = strtod(infString, &term); + if ((term != infString) && (term[-1] == 0)) { + exit(1); + } + value = strtod(nanString, &term); + if ((term != nanString) && (term[-1] == 0)) { + exit(1); + } + value = strtod(spaceString, &term); + if (term == (spaceString+1)) { + exit(1); + } + exit(0); + }], tcl_cv_strtod_buggy=1, tcl_cv_strtod_buggy=0, tcl_cv_strtod_buggy=0)]) + if test "$tcl_cv_strtod_buggy" = 1; then AC_MSG_RESULT(ok) else AC_MSG_RESULT(buggy) @@ -1761,29 +2269,12 @@ AC_DEFUN(SC_TCL_LINK_LIBS, [ AC_CHECK_LIB(ieee, main, [MATH_LIBS="-lieee $MATH_LIBS"]) #-------------------------------------------------------------------- - # On AIX systems, libbsd.a has to be linked in to support - # non-blocking file IO. This library has to be linked in after - # the MATH_LIBS or it breaks the pow() function. The way to - # insure proper sequencing, is to add it to the tail of MATH_LIBS. - # This library also supplies gettimeofday. - #-------------------------------------------------------------------- - - libbsd=no - if test "`uname -s`" = "AIX" ; then - AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes) - if test $libbsd = yes; then - MATH_LIBS="$MATH_LIBS -lbsd" - fi - fi - - - #-------------------------------------------------------------------- # Interactive UNIX requires -linet instead of -lsocket, plus it # needs net/errno.h to define the socket-related error codes. #-------------------------------------------------------------------- AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"]) - AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H)) + AC_CHECK_HEADER(net/errno.h, [AC_DEFINE(HAVE_NET_ERRNO_H)]) #-------------------------------------------------------------------- # Check for the existence of the -lsocket and -lnsl libraries. @@ -1803,38 +2294,19 @@ AC_DEFUN(SC_TCL_LINK_LIBS, [ # if -lsocket doesn't work by itself. #-------------------------------------------------------------------- - # CYGNUS LOCAL: Store any socket library(ies) in the cache, and don't - # mess up the cache values of the functions we check for. - AC_CACHE_CHECK([for socket libraries], tcl_cv_lib_sockets, - [tcl_cv_lib_sockets= - tcl_checkBoth=0 - unset ac_cv_func_connect - AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) - if test "$tcl_checkSocket" = 1; then - unset ac_cv_func_connect - AC_CHECK_LIB(socket, main, tcl_cv_lib_sockets="-lsocket", - tcl_checkBoth=1) - fi - if test "$tcl_checkBoth" = 1; then - tcl_oldLibs=$LIBS - LIBS="$LIBS -lsocket -lnsl" - unset ac_cv_func_accept - AC_CHECK_FUNC(accept, - [tcl_checkNsl=0 - tcl_cv_lib_sockets="-lsocket -lnsl"]) - unset ac_cv_func_accept - LIBS=$tcl_oldLibs - fi - unset ac_cv_func_gethostbyname - tcl_oldLibs=$LIBS - LIBS="$LIBS $tcl_cv_lib_sockets" - AC_CHECK_FUNC(gethostbyname, , - [AC_CHECK_LIB(nsl, main, - [tcl_cv_lib_sockets="$tcl_cv_lib_sockets -lnsl"])]) - unset ac_cv_func_gethostbyname - LIBS=$tcl_oldLIBS - ]) - test -z "$tcl_cv_lib_sockets" || LIBS="$LIBS $tcl_cv_lib_sockets" + tcl_checkBoth=0 + AC_CHECK_FUNC(connect, tcl_checkSocket=0, tcl_checkSocket=1) + if test "$tcl_checkSocket" = 1; then + AC_CHECK_FUNC(setsockopt, , [AC_CHECK_LIB(socket, setsockopt, + LIBS="$LIBS -lsocket", tcl_checkBoth=1)]) + fi + if test "$tcl_checkBoth" = 1; then + tk_oldLibs=$LIBS + LIBS="$LIBS -lsocket -lnsl" + AC_CHECK_FUNC(accept, tcl_checkNsl=0, [LIBS=$tk_oldLibs]) + fi + AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, + [LIBS="$LIBS -lnsl"])]) # Don't perform the eval of the libraries here because DL_LIBS # won't be set until we call SC_CONFIG_CFLAGS @@ -1844,39 +2316,109 @@ AC_DEFUN(SC_TCL_LINK_LIBS, [ AC_SUBST(MATH_LIBS) ]) -dnl CYGNUS LOCAL: This gets the right posix flag for gcc - -AC_DEFUN(CY_AC_TCL_LYNX_POSIX, -[AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AC_PROG_CPP]) -AC_MSG_CHECKING([to see if this is LynxOS]) -AC_CACHE_VAL(ac_cv_os_lynx, -[AC_EGREP_CPP(yes, -[/* - * The old Lynx "cc" only defines "Lynx", but the newer one uses "__Lynx__" - */ -#if defined(__Lynx__) || defined(Lynx) -yes -#endif -], ac_cv_os_lynx=yes, ac_cv_os_lynx=no)]) -# -if test "$ac_cv_os_lynx" = "yes" ; then - AC_MSG_RESULT(yes) - AC_DEFINE(LYNX) - AC_MSG_CHECKING([whether -mposix or -X is available]) - AC_CACHE_VAL(ac_cv_c_posix_flag, - [AC_TRY_COMPILE(,[ - /* - * This flag varies depending on how old the compiler is. - * -X is for the old "cc" and "gcc" (based on 1.42). - * -mposix is for the new gcc (at least 2.5.8). - */ - #if defined(__GNUC__) && __GNUC__ >= 2 - choke me - #endif - ], ac_cv_c_posix_flag=" -mposix", ac_cv_c_posix_flag=" -X")]) - CC="$CC $ac_cv_c_posix_flag" - AC_MSG_RESULT($ac_cv_c_posix_flag) - else - AC_MSG_RESULT(no) -fi -]) +#-------------------------------------------------------------------- +# SC_TCL_EARLY_FLAGS +# +# Check for what flags are needed to be passed so the correct OS +# features are available. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# _ISOC99_SOURCE +# _LARGEFILE64_SOURCE +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_TCL_EARLY_FLAG,[ + AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]), + AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no, + AC_TRY_COMPILE([[#define ]$1[ 1 +]$2], $3, + [tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes, + [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no))) + if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then + AC_DEFINE($1) + tcl_flags="$tcl_flags $1" + fi]) + +AC_DEFUN(SC_TCL_EARLY_FLAGS,[ + AC_MSG_CHECKING([for required early compiler flags]) + tcl_flags="" + SC_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>], + [char *p = (char *)strtoll; char *q = (char *)strtoull;]) + SC_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>], + [struct stat64 buf; int i = stat64("/", &buf);]) + if test "x${tcl_flags}" = "x" ; then + AC_MSG_RESULT(none) + else + AC_MSG_RESULT(${tcl_flags}) + fi]) + +#-------------------------------------------------------------------- +# SC_TCL_64BIT_FLAGS +# +# Check for what is defined in the way of 64-bit features. +# +# Arguments: +# None +# +# Results: +# +# Might define the following vars: +# TCL_WIDE_INT_IS_LONG +# TCL_WIDE_INT_TYPE +# HAVE_STRUCT_DIRENT64 +# HAVE_STRUCT_STAT64 +# HAVE_TYPE_OFF64_T +# +#-------------------------------------------------------------------- + +AC_DEFUN(SC_TCL_64BIT_FLAGS, [ + AC_MSG_CHECKING([for 64-bit integer type]) + AC_CACHE_VAL(tcl_cv_type_64bit,[ + AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], + tcl_cv_type_64bit=__int64,tcl_cv_type_64bit=none + AC_TRY_RUN([#include <unistd.h> + int main() {exit(!(sizeof(long long) > sizeof(long)));} + ], tcl_cv_type_64bit="long long"))]) + if test "${tcl_cv_type_64bit}" = none ; then + AC_MSG_RESULT(using long) + else + AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit}) + AC_MSG_RESULT(${tcl_cv_type_64bit}) + + # Now check for auxiliary declarations + AC_MSG_CHECKING([for struct dirent64]) + AC_CACHE_VAL(tcl_cv_struct_dirent64,[ + AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/dirent.h>],[struct dirent64 p;], + tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)]) + if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then + AC_DEFINE(HAVE_STRUCT_DIRENT64) + fi + AC_MSG_RESULT(${tcl_cv_struct_dirent64}) + + AC_MSG_CHECKING([for struct stat64]) + AC_CACHE_VAL(tcl_cv_struct_stat64,[ + AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p; +], + tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)]) + if test "x${tcl_cv_struct_stat64}" = "xyes" ; then + AC_DEFINE(HAVE_STRUCT_STAT64) + fi + AC_MSG_RESULT(${tcl_cv_struct_stat64}) + + AC_MSG_CHECKING([for off64_t]) + AC_CACHE_VAL(tcl_cv_type_off64_t,[ + AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset; +], + tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)]) + if test "x${tcl_cv_type_off64_t}" = "xyes" ; then + AC_DEFINE(HAVE_TYPE_OFF64_T) + fi + AC_MSG_RESULT(${tcl_cv_type_off64_t}) + fi]) |