Index: xotcl/tcl.m4 =================================================================== diff -u -rf7894d9be99a8da3a04218abcdb9bd46b6d625c8 -r435b41481fb51bf000ebe736d8574fefbeec1710 --- xotcl/tcl.m4 (.../tcl.m4) (revision f7894d9be99a8da3a04218abcdb9bd46b6d625c8) +++ xotcl/tcl.m4 (.../tcl.m4) (revision 435b41481fb51bf000ebe736d8574fefbeec1710) @@ -4,12 +4,12 @@ # a Tcl extension. # # Copyright (c) 1999-2000 Ajuba Solutions. -# Copyright (c) 2002-2003 ActiveState Corporation. +# Copyright (c) 2002-2005 ActiveState Corporation. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: tcl.m4,v 1.1 2004/05/23 22:50:39 neumann Exp $ +# RCS: @(#) $Id: tcl.m4,v 1.2 2005/09/09 21:07:23 neumann Exp $ AC_PREREQ(2.50) @@ -50,6 +50,13 @@ # First check to see if --with-tcl was specified. if test x"${with_tclconfig}" != x ; then + case ${with_tclconfig} in + */tclConfig.sh ) + if test -f ${with_tclconfig}; then + AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself]) + with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'` + fi ;; + esac if test -f "${with_tclconfig}/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)` else @@ -61,10 +68,16 @@ if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ../tcl \ + `ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tcl \ + `ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tcl \ + `ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` @@ -92,6 +105,8 @@ if test x"${ac_cv_c_tclconfig}" = x ; then for i in \ ${srcdir}/../tcl \ + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tclConfig.sh" ; then ac_cv_c_tclconfig=`(cd $i/unix; pwd)` @@ -147,6 +162,13 @@ # First check to see if --with-tkconfig was specified. if test x"${with_tkconfig}" != x ; then + case ${with_tkconfig} in + */tkConfig.sh ) + if test -f ${with_tkconfig}; then + AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself]) + with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'` + fi ;; + esac if test -f "${with_tkconfig}/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)` else @@ -158,10 +180,16 @@ if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ../tk \ + `ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \ ../../tk \ + `ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \ ../../../tk \ + `ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` @@ -187,6 +215,8 @@ if test x"${ac_cv_c_tkconfig}" = x ; then for i in \ ${srcdir}/../tk \ + `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \ `ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do if test -f "$i/unix/tkConfig.sh" ; then ac_cv_c_tkconfig=`(cd $i/unix; pwd)` @@ -276,7 +306,6 @@ AC_SUBST(TCL_STUB_LIB_FLAG) AC_SUBST(TCL_STUB_LIB_SPEC) - #AC_SUBST(TCL_DBGX) AC_SUBST(TCL_LIBS) AC_SUBST(TCL_DEFS) AC_SUBST(TCL_EXTRA_CFLAGS) @@ -405,6 +434,9 @@ # # Specify if thread support should be enabled. If "yes" is # specified as an arg (optional), threads are enabled by default. +# TCL_THREADS is checked so that if you are compiling an extension +# against a threaded core, your extension must be compiled threaded +# as well. # # Arguments: # none @@ -427,7 +459,7 @@ AC_ARG_ENABLE(threads, [ --enable-threads build with threads], [tcl_ok=$enableval], [tcl_ok=$1]) - if test "$tcl_ok" = "yes"; then + if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then TCL_THREADS=1 if test "${TEA_PLATFORM}" != "windows" ; then @@ -489,6 +521,7 @@ AC_MSG_CHECKING([for building with threads]) if test "${TCL_THREADS}" = "1"; then AC_DEFINE(TCL_THREADS) + #LIBS="$LIBS $THREADS_LIBS" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no (default)]) @@ -539,33 +572,26 @@ # Sets to CFLAGS_OPTIMIZE if false # LDFLAGS_DEFAULT Sets to LDFLAGS_DEBUG if true # Sets to LDFLAGS_OPTIMIZE if false -# DBGX Debug library extension +# DBGX Formerly used as debug library extension; +# always blank now. # #------------------------------------------------------------------------ AC_DEFUN(TEA_ENABLE_SYMBOLS, [ dnl Make sure we are initialized AC_REQUIRE([TEA_CONFIG_CFLAGS]) - if test "${TEA_PLATFORM}" = "windows" ; then - tcl_dbgx=d - else - tcl_dbgx=g - fi + DBGX="" 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]) if test "$tcl_ok" = "no"; then CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}" LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}" - DBGX="" - TCL_DBGX="" AC_MSG_RESULT([no]) else CFLAGS_DEFAULT="${CFLAGS_DEBUG}" LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}" - DBGX=${tcl_dbgx} - TCL_DBGX=${tcl_dbgx} if test "$tcl_ok" = "yes"; then AC_MSG_RESULT([yes (standard debugging)]) fi @@ -707,8 +733,7 @@ # Flags used when running the compiler in debug mode # CFLAGS_OPTIMIZE - # Flags used when running the compiler in optimize mode -# EXTRA_CFLAGS - -# Extra CFLAGS to pass to the compiler +# CFLAGS - We add CFLAGS to pass to the compiler # # Subst's the following vars: # DL_LIBS @@ -719,7 +744,6 @@ # STLIB_LD # SHLIB_LD # SHLIB_CFLAGS -# SHLIB_LD_FLAGS # LDFLAGS_DEBUG # LDFLAGS_OPTIMIZE #-------------------------------------------------------------------- @@ -788,19 +812,23 @@ AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no) # Step 3: set configuration options based on system name and version. + # This is similar to Tcl's unix/tcl.m4 except that we've added a + # "windows" case and CC_SEARCH_FLAGS becomes LD_SEARCH_FLAGS for us + # (and we have no CC_SEARCH_FLAGS). do64bit_ok=no - EXTRA_CFLAGS="" + LDFLAGS_ORIG="$LDFLAGS" TCL_EXPORT_FILE_SUFFIX="" UNSHARED_LIB_SUFFIX="" TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`' ECHO_VERSION='`echo ${PACKAGE_VERSION}`' TCL_LIB_VERSIONS_OK=ok CFLAGS_DEBUG=-g - CFLAGS_OPTIMIZE=-O if test "$GCC" = "yes" ; then - CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int" + CFLAGS_OPTIMIZE=-O2 + CFLAGS_WARNING="-Wall -Wno-implicit-int" else + CFLAGS_OPTIMIZE=-O CFLAGS_WARNING="" fi TCL_NEEDS_EXP_FILE=0 @@ -819,11 +847,10 @@ if test "x${MSSDK}x" = "xx" ; then MSSDK="C:/Progra~1/Microsoft SDK" fi - # In order to work in the tortured autoconf environment, - # we need to ensure that this path has no spaces - MSSDK=`cygpath -w -s "$MSSDK" | sed -e 's!\\\!/!g'` + # Ensure that this path has no spaces to work in autoconf + TEA_PATH_NOSPACE(MSSDK, ${MSSDK}) if test ! -d "${MSSDK}/bin/win64" ; then - AC_MSG_WARN("could not find 64-bit SDK to enable 64bit mode") + AC_MSG_WARN([could not find 64-bit SDK to enable 64bit mode]) do64bit="no" else do64bit_ok="yes" @@ -838,42 +865,55 @@ AC_MSG_ERROR([Windows/CE and GCC builds incompatible]) fi TEA_PATH_CELIB - # set defaults - # Currently Tcl requires 300+ - CEVERSION=300; # could be 211 300 301 ... - TARGETCPU=ARM; # could be ARM MIPS SH3 X86 ... - PLATFORM="Pocket PC 2002" - if test "$doWince" = "yes"; then - doWince="300,ARM,ARM,Pocket PC 2002" - fi - eval `echo $doWince | awk -F "," '{ \ - if (length([$]1)) { printf "CEVERSION=%s\n", [$]1 }; \ - if (length([$]2)) { printf "TARGETCPU=%s\n", toupper([$]2) }; \ - if (length([$]3)) { printf "ARCH=%s\n", toupper([$]3) }; \ - if (length([$]4)) { printf "PLATFORM=%s\n", [$]4 }; \ + # Set defaults for common evc4/PPC2003 setup + # Currently Tcl requires 300+, possibly 420+ for sockets + CEVERSION=420; # could be 211 300 301 400 420 ... + TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ... + ARCH=ARM; # could be ARM MIPS X86EM ... + PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002" + if test "$doWince" != "yes"; then + # If !yes then the user specified something + # Reset ARCH to allow user to skip specifying it + ARCH= + eval `echo $doWince | awk -F, '{ \ + if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \ + if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \ + if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \ + if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \ + if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \ }'` + if test "x${ARCH}" = "x" ; then + ARCH=$TARGETCPU; + fi + fi OSVERSION=WCE$CEVERSION; - if test "x${ARCH}" = "x" ; then - ARCH=$TARGETCPU; # could be ARM MIPS SH3 X86 X86EM ... + if test "x${WCEROOT}" = "x" ; then + WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0" + if test ! -d "${WCEROOT}" ; then + WCEROOT="C:/Program Files/Microsoft eMbedded Tools" + fi fi - if test "x${WCEROOT}" = "x" ; then - WCEROOT="C:/Program Files/Microsoft eMbedded Tools" - fi if test "x${SDKROOT}" = "x" ; then - SDKROOT="C:/Windows CE Tools" + SDKROOT="C:/Program Files/Windows CE Tools" + if test ! -d "${SDKROOT}" ; then + SDKROOT="C:/Windows CE Tools" + fi fi - # In order to work in the tortured autoconf environment, - # we need to ensure that this path has no spaces - WCEROOT=`cygpath -w -s "$WCEROOT" | sed -e 's!\\\!/!g'` - SDKROOT=`cygpath -w -s "$SDKROOT" | sed -e 's!\\\!/!g'` - CELIB_DIR=`cygpath -w -s "$CELIB_DIR" | sed -e 's!\\\!/!g'` + # Ensure that this path has no spaces to work in autoconf + TEA_PATH_NOSPACE(WCEROOT, ${WCEROOT}) + TEA_PATH_NOSPACE(SDKROOT, ${SDKROOT}) if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]]) doWince="no" else - CEINCLUDE=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/include" | sed -e 's!\\\!/!g'` - CELIBPATH=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" | sed -e 's!\\\!/!g'` + # We could PATH_NOSPACE these, but that's not important, + # as long as we quote them when used. + CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include" + if test -d "${CEINCLUDE}/${TARGETCPU}" ; then + CEINCLUDE="${CEINCLUDE}/${TARGETCPU}" + fi + CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" fi fi @@ -886,58 +926,65 @@ if test "$do64bit" = "yes" ; then # All this magic is necessary for the Win64 SDK RC1 - hobbs - export CC="${MSSDK}/Bin/Win64/cl.exe \ - -I${MSSDK}/Include/prerelease \ - -I${MSSDK}/Include/Win64/crt \ - -I${MSSDK}/Include" - export RC="${MSSDK}/bin/rc.exe" - export lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ - -LIBPATH:${MSSDK}/Lib/Prerelease/IA64" - export STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}" - export LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}" + CC="${MSSDK}/Bin/Win64/cl.exe" + CFLAGS="${CFLAGS} -I${MSSDK}/Include/prerelease \ + -I${MSSDK}/Include/Win64/crt \ + -I${MSSDK}/Include" + RC="${MSSDK}/bin/rc.exe" + lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \ + -LIBPATH:${MSSDK}/Lib/Prerelease/IA64 -nologo" + LINKBIN="${MSSDK}/bin/win64/link.exe" CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d" - CFLAGS_OPTIMIZE="-nologo -O2 -Gs -W2 ${runtime}" + CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" elif test "$doWince" != "no" ; then + CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin" if test "${TARGETCPU}" = "X86"; then - CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + CC="${CEBINROOT}/cl.exe" else - CC="${WCEROOT}/EVC/${OSVERSION}/bin/cl${TARGETCPU}.exe -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" + CC="${CEBINROOT}/cl${ARCH}.exe" fi + CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\"" RC="${WCEROOT}/Common/EVC/bin/rc.exe" - cpulower=`echo ${TARGETCPU} | awk '{print tolower([$]0)}'` - defs="${TARGETCPU} _${TARGETCPU}_ ${cpulower} _${cpulower}_ POCKET_SIZE PALM_SIZE _MT _DLL _WINDOWS" + arch=`echo ${ARCH} | awk '{print tolower([$]0)}'` + defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS" + if test "${SHARED_BUILD}" = "1" ; then + # Static CE builds require static celib as well + defs="${defs} _DLL" + fi for i in $defs ; do AC_DEFINE_UNQUOTED($i) done AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION) AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION) CFLAGS_DEBUG="-nologo -Zi -Od" CFLAGS_OPTIMIZE="-nologo -Ox" - lflags="-MACHINE:${TARGETCPU} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,3.00" - STLIB_LD="${WCEROOT}/EVC/${OSVERSION}/bin/lib.exe -nologo ${lflags}" - LINKBIN="${WCEROOT}/EVC/${OSVERSION}/bin/link.exe ${lflags}" + lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'` + lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo" + LINKBIN="${CEBINROOT}/link.exe" + AC_SUBST(CELIB_DIR) else RC="rc" - STLIB_LD="lib -nologo" - LINKBIN="link -link50compat" + lflags="-nologo" + LINKBIN="link" CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d" - CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD -W2 ${runtime}" + CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}" fi fi if test "$GCC" = "yes"; then # mingw gcc mode RC="windres" CFLAGS_DEBUG="-g" - CFLAGS_OPTIMIZE="-O2" + CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" SHLIB_LD="$CC -shared" - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}" LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}" else - SHLIB_LD="${LINKBIN} -dll -nologo" - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.lib' - EXTRA_CFLAGS="-YX" + SHLIB_LD="${LINKBIN} -dll ${lflags}" + # link -lib only works when -lib is the first arg + STLIB_LD="${LINKBIN} -lib ${lflags}" + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib' PATHTYPE=-w # For information on what debugtype is most useful, see: # http://msdn.microsoft.com/library/en-us/dnvc60/html/gendepdebug.asp @@ -955,7 +1002,7 @@ SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dll" - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.dll' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.dll' TCL_LIB_VERSIONS_OK=nodots # Bogus to avoid getting this turned off @@ -975,7 +1022,6 @@ SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadDl.o" - LDFLAGS="" LD_LIBRARY_PATH_VAR="LIBPATH" # AIX v<=4.1 has some different flags than 4.2+ @@ -991,8 +1037,8 @@ AC_MSG_WARN("64bit mode not supported with GCC on $system") else do64bit_ok=yes - EXTRA_CFLAGS="-q64" - LDFLAGS="-q64" + CFLAGS="$CFLAGS -q64" + LDFLAGS="$LDFLAGS -q64" RANLIB="${RANLIB} -X64" AR="${AR} -X64" SHLIB_LD_FLAGS="-b64" @@ -1010,11 +1056,16 @@ LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}' fi else - SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix /bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry ${SHLIB_LD_FLAGS}" + if test "$GCC" = "yes" ; then + SHLIB_LD="gcc -shared" + else + SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry" + fi + SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}" DL_LIBS="-ldl" LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' TCL_NEEDS_EXP_FILE=1 - TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.exp' + TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp' fi # On AIX <=v4 systems, libbsd.a has to be linked in to support @@ -1035,14 +1086,21 @@ AC_DEFINE(USE_DELTA_FOR_TZ) fi ;; + BeOS*) + SHLIB_CFLAGS="-fPIC" + SHLIB_LD="${CC} -nostart" + SHLIB_LD_LIBS='${LIBS}' + SHLIB_SUFFIX=".so" + DL_OBJS="tclLoadDl.o" + DL_LIBS="-ldl" + ;; BSD/OS-2.1*|BSD/OS-3*) SHLIB_CFLAGS="" SHLIB_LD="shlicc -r" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" LD_SEARCH_FLAGS="" ;; BSD/OS-4.*) @@ -1052,7 +1110,7 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="-export-dynamic" + LDFLAGS="$LDFLAGS -export-dynamic" LD_SEARCH_FLAGS="" ;; dgux*) @@ -1062,7 +1120,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" LD_SEARCH_FLAGS="" ;; HP-UX-*.11.*) @@ -1077,13 +1134,18 @@ SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" - LDFLAGS="-Wl,-E" + LDFLAGS="$LDFLAGS -Wl,-E" + LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.' + LD_LIBRARY_PATH_VAR="SHLIB_PATH" + fi + if test "$GCC" = "yes" ; then + SHLIB_LD="gcc -shared" + SHLIB_LD_LIBS='${LIBS}' LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' fi - LD_LIBRARY_PATH_VAR="SHLIB_PATH" # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc - #EXTRA_CFLAGS="+DAportable" + #CFLAGS="$CFLAGS +DAportable" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then @@ -1094,22 +1156,16 @@ # 64-bit gcc in use. Fix flags for GNU ld. do64bit_ok=yes SHLIB_LD="${CC} -shared" - SHLIB_LD_LIBS="" - LD_SEARCH_FLAGS='' + SHLIB_LD_LIBS='${LIBS}' ;; *) AC_MSG_WARN("64bit mode not supported with GCC on $system") ;; esac else do64bit_ok=yes - if test "`uname -m`" = "ia64" ; then - EXTRA_CFLAGS="+DD64" - LDFLAGS="+DD64 $LDFLAGS" - else - EXTRA_CFLAGS="+DA2.0W" - LDFLAGS="+DA2.0W $LDFLAGS" - fi + CFLAGS="$CFLAGS +DD64" + LDFLAGS="$LDFLAGS +DD64" fi fi ;; @@ -1122,7 +1178,7 @@ SHLIB_LD_LIBS="" DL_OBJS="tclLoadShl.o" DL_LIBS="-ldld" - LDFLAGS="-Wl,-E" + LDFLAGS="$LDFLAGS -Wl,-E" LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.' fi LD_LIBRARY_PATH_VAR="SHLIB_PATH" @@ -1134,9 +1190,9 @@ SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadAout.o" DL_LIBS="" - LDFLAGS="-Wl,-D,08000000" + LDFLAGS="$LDFLAGS -Wl,-D,08000000" LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' - SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' ;; IRIX-5.*) SHLIB_CFLAGS="" @@ -1146,8 +1202,6 @@ DL_OBJS="tclLoadDl.o" DL_LIBS="" LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' - EXTRA_CFLAGS="" - LDFLAGS="" ;; IRIX-6.*|IRIX64-6.5*) SHLIB_CFLAGS="" @@ -1158,19 +1212,19 @@ DL_LIBS="" LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' if test "$GCC" = "yes" ; then - EXTRA_CFLAGS="-mabi=n32" - LDFLAGS="-mabi=n32" + CFLAGS="$CFLAGS -mabi=n32" + LDFLAGS="$LDFLAGS -mabi=n32" else case $system in IRIX-6.3) # Use to build 6.2 compatible binaries on 6.3. - EXTRA_CFLAGS="-n32 -D_OLD_TERMIOS" + CFLAGS="$CFLAGS -n32 -D_OLD_TERMIOS" ;; *) - EXTRA_CFLAGS="-n32" + CFLAGS="$CFLAGS -n32" ;; esac - LDFLAGS="-n32" + LDFLAGS="$LDFLAGS -n32" fi ;; IRIX64-6.*) @@ -1180,7 +1234,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' # Check to enable 64-bit flags for compiler/linker @@ -1191,8 +1244,8 @@ else do64bit_ok=yes SHLIB_LD="ld -64 -shared -rdata_shared" - EXTRA_CFLAGS="-64" - LDFLAGS="-64" + CFLAGS="$CFLAGS -64" + LDFLAGS="$LDFLAGS -64" fi fi ;; @@ -1201,6 +1254,7 @@ SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".so" + CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer" # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings # when you inline the string and math operations. Turn this off to # get rid of the warnings. @@ -1211,18 +1265,17 @@ SHLIB_LD="${CC} -shared" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="-rdynamic" + LDFLAGS="$LDFLAGS -Wl,--export-dynamic" LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' else AC_CHECK_HEADER(dld.h, [ SHLIB_LD="ld -shared" DL_OBJS="tclLoadDld.o" DL_LIBS="-ldld" - LDFLAGS="" LD_SEARCH_FLAGS=""]) fi if test "`uname -m`" = "alpha" ; then - EXTRA_CFLAGS="-mieee" + CFLAGS="$CFLAGS -mieee" fi # The combo of gcc + glibc has a bug related @@ -1233,7 +1286,7 @@ # Disable inlining only when one of the # files in compat/*.c is being linked in. if test x"${USE_COMPAT}" != x ; then - EXTRA_CFLAGS="${EXTRA_CFLAGS} -fno-inline" + CFLAGS="$CFLAGS -fno-inline" fi ;; @@ -1246,18 +1299,17 @@ SHLIB_LD="${CC} -shared" DL_OBJS="" DL_LIBS="-ldl" - LDFLAGS="-rdynamic" + LDFLAGS="$LDFLAGS -Wl,--export-dynamic" LD_SEARCH_FLAGS="" else AC_CHECK_HEADER(dld.h, [ SHLIB_LD="ld -shared" DL_OBJS="" DL_LIBS="-ldld" - LDFLAGS="" LD_SEARCH_FLAGS=""]) fi if test "`uname -m`" = "alpha" ; then - EXTRA_CFLAGS="-mieee" + CFLAGS="$CFLAGS -mieee" fi ;; MP-RAS-02*) @@ -1267,7 +1319,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" LD_SEARCH_FLAGS="" ;; MP-RAS-*) @@ -1277,7 +1328,7 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="-Wl,-Bexport" + LDFLAGS="$LDFLAGS -Wl,-Bexport" LD_SEARCH_FLAGS="" ;; NetBSD-*|FreeBSD-[[1-2]].*) @@ -1290,7 +1341,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}' AC_MSG_CHECKING([for ELF]) AC_EGREP_CPP(yes, [ @@ -1299,9 +1349,9 @@ #endif ], AC_MSG_RESULT([yes]) - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so', + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so', AC_MSG_RESULT([no]) - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' ) ], [ SHLIB_CFLAGS="" @@ -1310,14 +1360,13 @@ SHLIB_SUFFIX=".a" DL_OBJS="tclLoadAout.o" DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' ]) # FreeBSD doesn't handle version numbers with dots. - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; OpenBSD-*) @@ -1326,7 +1375,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS="" AC_MSG_CHECKING(for ELF) AC_EGREP_CPP(yes, [ @@ -1335,13 +1383,13 @@ #endif ], [AC_MSG_RESULT(yes) - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'], + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'], [AC_MSG_RESULT(no) - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0'] + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'] ) # OpenBSD doesn't do version numbers with dots. - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; FreeBSD-*) @@ -1352,36 +1400,34 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="-export-dynamic" + LDFLAGS="$LDFLAGS -export-dynamic" LD_SEARCH_FLAGS='-Wl,-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" + CFLAGS="$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' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so' TCL_LIB_VERSIONS_OK=nodots ;; esac ;; - Rhapsody-*|Darwin-*) + Darwin-*) SHLIB_CFLAGS="-fno-common" SHLIB_LD="cc -dynamiclib \${LDFLAGS}" - TCL_SHLIB_LD_EXTRAS="-compatibility_version ${TCL_MAJOR_VERSION} -current_version \${PACKAGE_VERSION} -install_name \${LIB_RUNTIME_DIR}/\${TCL_LIB_FILE} -prebind -seg1addr 0xa000000" SHLIB_LD_LIBS='${LIBS}' SHLIB_SUFFIX=".dylib" DL_OBJS="tclLoadDyld.o" DL_LIBS="" - LDFLAGS="-prebind" + LDFLAGS="$LDFLAGS -prebind -Wl,-search_paths_first" LD_SEARCH_FLAGS="" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" - CFLAGS_OPTIMIZE="-O3" - EXTRA_CFLAGS="-arch ppc -pipe" + CFLAGS_OPTIMIZE="-Os" ;; NEXTSTEP-*) SHLIB_CFLAGS="" @@ -1390,7 +1436,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadNext.o" DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS="" ;; OS/390-*) @@ -1406,7 +1451,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadOSF.o" DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-1.*) @@ -1421,7 +1465,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS="" ;; OSF1-V*) @@ -1436,21 +1479,22 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' - if test "$GCC" != "yes" ; then - EXTRA_CFLAGS="-DHAVE_TZSET -std1" + if test "$GCC" = "yes" ; then + CFLAGS="$CFLAGS -mieee" + else + CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee" 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" + CFLAGS="$CFLAGS -DHAVE_PTHREAD_ATTR_SETSTACKSIZE" + CFLAGS="$CFLAGS -DTCL_THREAD_STACK_MIN=PTHREAD_STACK_MIN*64" LIBS=`echo $LIBS | sed s/-lpthreads//` if test "$GCC" = "yes" ; then LIBS="$LIBS -lpthread -lmach -lexc" else - EXTRA_CFLAGS="${EXTRA_CFLAGS} -pthread" - LDFLAGS="-pthread" + CFLAGS="$CFLAGS -pthread" + LDFLAGS="$LDFLAGS -pthread" fi fi @@ -1465,7 +1509,6 @@ DL_OBJS="tclLoadDl.o" # dlopen is in -lc on QNX DL_LIBS="" - LDFLAGS="" LD_SEARCH_FLAGS="" ;; RISCos-*) @@ -1475,7 +1518,7 @@ SHLIB_SUFFIX=".a" DL_OBJS="tclLoadAout.o" DL_LIBS="" - LDFLAGS="-Wl,-D,08000000" + LDFLAGS="$LDFLAGS -Wl,-D,08000000" LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' ;; SCO_SV-3.2*) @@ -1484,10 +1527,10 @@ # below. if test "$GCC" = "yes" ; then SHLIB_CFLAGS="-fPIC -melf" - LDFLAGS="-melf -Wl,-Bexport" + LDFLAGS="$LDFLAGS -melf -Wl,-Bexport" else SHLIB_CFLAGS="-Kpic -belf" - LDFLAGS="-belf -Wl,-Bexport" + LDFLAGS="$LDFLAGS -belf -Wl,-Bexport" fi SHLIB_LD="ld -G" SHLIB_LD_LIBS="" @@ -1503,7 +1546,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" LD_SEARCH_FLAGS="" ;; SunOS-4*) @@ -1513,16 +1555,15 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' # SunOS can't handle version numbers with dots in them in library # specs, like -ltcl7.5, so use -ltcl75 instead. Also, it # requires an extra version number at the end of .so file names. # So, the library has to have a name like libtcl75.so.1.0 - SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.so.1.0' - UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}\$\{DBGX\}.a' + SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0' + UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a' TCL_LIB_VERSIONS_OK=nodots ;; SunOS-5.[[0-6]]*) @@ -1542,7 +1583,6 @@ SHLIB_SUFFIX=".so" DL_OBJS="tclLoadDl.o" DL_LIBS="-ldl" - LDFLAGS="" if test "$GCC" = "yes" ; then SHLIB_LD="$CC -shared" LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' @@ -1560,22 +1600,28 @@ AC_DEFINE(_POSIX_PTHREAD_SEMANTICS) SHLIB_CFLAGS="-KPIC" - LDFLAGS="" # Check to enable 64-bit flags for compiler/linker if test "$do64bit" = "yes" ; then arch=`isainfo` if test "$arch" = "sparcv9 sparc" ; then if test "$GCC" = "yes" ; then - AC_MSG_WARN("64bit mode not supported with GCC on $system") + if test "`gcc -dumpversion` | awk -F. '{print $1}'" -lt "3" ; then + AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system]) + else + do64bit_ok=yes + CFLAGS="$CFLAGS -m64 -mcpu=v9" + LDFLAGS="$LDFLAGS -m64 -mcpu=v9" + SHLIB_CFLAGS="-fPIC" + fi else do64bit_ok=yes if test "$do64bitVIS" = "yes" ; then - EXTRA_CFLAGS="-xarch=v9a" - LDFLAGS="-xarch=v9a" + CFLAGS="$CFLAGS -xarch=v9a" + LDFLAGS="$LDFLAGS -xarch=v9a" else - EXTRA_CFLAGS="-xarch=v9" - LDFLAGS="-xarch=v9" + CFLAGS="$CFLAGS -xarch=v9" + LDFLAGS="$LDFLAGS -xarch=v9" fi fi else @@ -1593,6 +1639,17 @@ if test "$GCC" = "yes" ; then SHLIB_LD="$CC -shared" LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}' + if test "$do64bit" = "yes" ; then + # We need to specify -static-libgcc or we need to + # add the path to the sparv9 libgcc. + # JH: static-libgcc is necessary for core Tcl, but may + # not be necessary for extensions. + SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc" + # for finding sparcv9 libgcc, get the regular libgcc + # path, remove so name and append 'sparcv9' + #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..." + #LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS},-R,$v9gcclibdir" + fi else SHLIB_LD="/usr/ccs/bin/ld -G -z text" LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}' @@ -1605,10 +1662,10 @@ SHLIB_LD_LIBS='${LIBS}' DL_OBJS="tclLoadAout.o" DL_LIBS="" - LDFLAGS="-Wl,-D,08000000" + LDFLAGS="$LDFLAGS -Wl,-D,08000000" LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}' if test "$GCC" != "yes" ; then - EXTRA_CFLAGS="-DHAVE_TZSET -std1" + CFLAGS="$CFLAGS -DHAVE_TZSET -std1" fi ;; UNIX_SV* | UnixWare-5*) @@ -1621,16 +1678,11 @@ # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers # that don't grok the -Bexport option. Test that it does. hold_ldflags=$LDFLAGS - AC_MSG_CHECKING([for ld accepts -Bexport flag]) - LDFLAGS="${LDFLAGS} -Wl,-Bexport" - AC_TRY_LINK(, [int i;], found=yes, found=no) - LDFLAGS=$hold_ldflags + AC_MSG_CHECKING(for ld accepts -Bexport flag) + LDFLAGS="$LDFLAGS -Wl,-Bexport" + AC_TRY_LINK(, [int i;], [found=yes], + [LDFLAGS=$hold_ldflags found=no]) AC_MSG_RESULT([$found]) - if test $found = yes; then - LDFLAGS="-Wl,-Bexport" - else - LDFLAGS="" - fi LD_SEARCH_FLAGS="" ;; esac @@ -1734,7 +1786,7 @@ SHLIB_SUFFIX="" DL_OBJS="tclLoadNone.o" DL_LIBS="" - LDFLAGS="" + LDFLAGS="$LDFLAGS_ORIG" LD_SEARCH_FLAGS="" BUILD_DLTEST="" fi @@ -1754,7 +1806,7 @@ ;; NetBSD-*|FreeBSD-*) ;; - Rhapsody-*|Darwin-*) + Darwin-*) ;; RISCos-*) ;; @@ -1772,26 +1824,29 @@ fi if test "$SHARED_LIB_SUFFIX" = "" ; then - SHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}${SHLIB_SUFFIX}' + SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}' fi if test "$UNSHARED_LIB_SUFFIX" = "" ; then - UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}\$\{DBGX\}.a' + UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a' fi AC_SUBST(DL_LIBS) AC_SUBST(CFLAGS_DEBUG) AC_SUBST(CFLAGS_OPTIMIZE) AC_SUBST(CFLAGS_WARNING) - AC_SUBST(EXTRA_CFLAGS) AC_SUBST(STLIB_LD) AC_SUBST(SHLIB_LD) AC_SUBST(SHLIB_CFLAGS) - AC_SUBST(SHLIB_LD_FLAGS) AC_SUBST(SHLIB_LD_LIBS) AC_SUBST(LDFLAGS_DEBUG) AC_SUBST(LDFLAGS_OPTIMIZE) AC_SUBST(LD_LIBRARY_PATH_VAR) + + # These must be called after we do the basic CFLAGS checks and + # verify any possible 64-bit or similar switches are necessary + TEA_TCL_EARLY_FLAGS + TEA_TCL_64BIT_FLAGS ]) #-------------------------------------------------------------------- @@ -1933,16 +1988,17 @@ # NO_DIRENT_H # NO_ERRNO_H # NO_VALUES_H -# NO_LIMITS_H +# HAVE_LIMITS_H or NO_LIMITS_H # NO_STDLIB_H # NO_STRING_H # NO_SYS_WAIT_H # NO_DLFCN_H -# HAVE_UNISTD_H # HAVE_SYS_PARAM_H # # HAVE_STRING_H ? # +# tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and +# CHECK on limits.h #-------------------------------------------------------------------- AC_DEFUN(TEA_MISSING_POSIX_HEADERS, [ @@ -1976,7 +2032,8 @@ 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(limits.h, + [AC_DEFINE(HAVE_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) @@ -1999,11 +2056,8 @@ AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)]) # OS/390 lacks sys/param.h (and doesn't need it, by chance). - # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and - # CHECK on limits.h + AC_HAVE_HEADERS(sys/param.h) - AC_HAVE_HEADERS(limits.h unistd.h sys/param.h) - ]) #-------------------------------------------------------------------- @@ -2028,12 +2082,24 @@ # XINCLUDES # XLIBSW # LIBS (appends to) +# TEA_WINDOWINGSYSTEM # #-------------------------------------------------------------------- AC_DEFUN(TEA_PATH_X, [ if test "${TEA_PLATFORM}" = "unix" ; then - TEA_PATH_UNIX_X + case ${TK_DEFS} in + *MAC_OSX_TK*) + AC_DEFINE(MAC_OSX_TK) + TEA_WINDOWINGSYSTEM="aqua" + ;; + *) + TEA_PATH_UNIX_X + TEA_WINDOWINGSYSTEM="x11" + ;; + esac + elif test "${TEA_PLATFORM}" = "windows" ; then + TEA_WINDOWINGSYSTEM="windows" fi ]) @@ -2454,14 +2520,21 @@ AC_DEFUN(TEA_TCL_64BIT_FLAGS, [ AC_MSG_CHECKING([for 64-bit integer type]) AC_CACHE_VAL(tcl_cv_type_64bit,[ + tcl_cv_type_64bit=none + # See if the compiler knows natively about __int64 AC_TRY_COMPILE(,[__int64 value = (__int64) 0;], - tcl_cv_type_64bit=__int64,tcl_cv_type_64bit=none - AC_TRY_RUN([#include - int main() {exit(!(sizeof(long long) > sizeof(long)));} - ], tcl_cv_type_64bit="long long"))]) + tcl_type_64bit=__int64, tcl_type_64bit="long long") + # See if we should use long anyway Note that we substitute in the + # type that is our current guess for a 64-bit type inside this check + # program, so it should be modified only carefully... + AC_TRY_COMPILE(,[switch (0) { + case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; + }],tcl_cv_type_64bit=${tcl_type_64bit})]) if test "${tcl_cv_type_64bit}" = none ; then + AC_DEFINE(TCL_WIDE_INT_IS_LONG) AC_MSG_RESULT([using long]) - elif test "${tcl_cv_type_64bit}" = "__int64" ; then + elif test "${tcl_cv_type_64bit}" = "__int64" \ + -a "${TEA_PLATFORM}" = "windows" ; then # We actually want to use the default tcl.h checks in this # case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER* AC_MSG_RESULT([using Tcl header defaults]) @@ -2536,7 +2609,9 @@ #------------------------------------------------------------------------ AC_DEFUN(TEA_INIT, [ - TEA_VERSION="3.0" + # TEA extensions pass this us the version of TEA they think they + # are compatible with. + TEA_VERSION="3.2" AC_MSG_CHECKING([for correct TEA configuration]) if test x"${PACKAGE_NAME}" = x ; then @@ -2547,9 +2622,9 @@ AC_MSG_ERROR([ TEA version not specified.]) elif test "$1" != "${TEA_VERSION}" ; then - AC_MSG_RESULT([warning: TEA version "$1" != ${TEA_VERSION}]) + AC_MSG_RESULT([warning: requested TEA version "$1", have "${TEA_VERSION}"]) else - AC_MSG_RESULT([ok]) + AC_MSG_RESULT([ok (TEA ${TEA_VERSION})]) fi case "`uname -s`" in *win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*) @@ -2564,8 +2639,14 @@ ;; esac - # Check if exec_prefix is set. If not use fall back to prefix - if test x$exec_prefix = xNONE ; then exec_prefix=$prefix ; fi + # Check if exec_prefix is set. If not use fall back to prefix. + # Note when adjusted, so that TEA_PREFIX can correct for this. + # This is needed for recursive configures, since autoconf propagates + # $prefix, but not $exec_prefix (doh!). + if test x$exec_prefix = xNONE ; then + exec_prefix_default=yes + exec_prefix=$prefix + fi AC_SUBST(EXEEXT) AC_SUBST(CYGPATH) @@ -2755,7 +2836,9 @@ # TEA_ADD_LIBS -- # # Specify one or more libraries. Users should check for -# the right platform before adding to their list. +# the right platform before adding to their list. For Windows, +# libraries provided in "foo.lib" format will be converted to +# "-lfoo" when using GCC (mingw). # # Arguments: # one or more file names @@ -2768,6 +2851,10 @@ AC_DEFUN(TEA_ADD_LIBS, [ vars="$@" for i in $vars; do + if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then + # Convert foo.lib to -lfoo for GCC. No-op if not *.lib + i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'` + fi PKG_LIBS="$PKG_LIBS $i" done AC_SUBST(PKG_LIBS) @@ -2807,21 +2894,23 @@ # configured. #------------------------------------------------------------------------ AC_DEFUN(TEA_PREFIX, [ - # Should be AC_MSG_NOTICE, but that requires autoconf 2.50 if test "${prefix}" = "NONE"; then prefix_default=yes if test x"${TCL_PREFIX}" != x; then - AC_MSG_WARN([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}]) + AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}]) prefix=${TCL_PREFIX} else + AC_MSG_NOTICE([--prefix defaulting to /usr/local]) prefix=/usr/local fi fi - if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" ; then + if test "${exec_prefix}" = "NONE" -a x"${prefix_default}" = x"yes" \ + -o x"${exec_prefix_default}" = x"yes" ; then if test x"${TCL_EXEC_PREFIX}" != x; then - AC_MSG_WARN([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}]) + AC_MSG_NOTICE([--exec-prefix defaulting to TCL_EXEC_PREFIX ${TCL_EXEC_PREFIX}]) exec_prefix=${TCL_EXEC_PREFIX} else + AC_MSG_NOTICE([--exec-prefix defaulting to ${prefix}]) exec_prefix=$prefix fi fi @@ -2909,8 +2998,6 @@ # Common compiler flag setup #-------------------------------------------------------------------- - TEA_TCL_EARLY_FLAGS - TEA_TCL_64BIT_FLAGS AC_C_BIGENDIAN if test "${TEA_PLATFORM}" = "unix" ; then TEA_TCL_LINK_LIBS @@ -2948,11 +3035,11 @@ AC_DEFUN(TEA_MAKE_LIB, [ if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)" - MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)" + MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)" MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)" else MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)" - MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_FLAGS} \${SHLIB_LD_LIBS}" + MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}" MAKE_STUB_LIB="\${STLIB_LD} \[$]@ \$(PKG_STUB_OBJECTS)" fi @@ -2964,11 +3051,10 @@ #-------------------------------------------------------------------- # Shared libraries and static libraries have different names. - # Use the double eval to make sure the ${DBGX} in the suffix is - # substituted. + # Use the double eval to make sure any variables in the suffix is + # substituted. (@@@ Might not be necessary anymore) #-------------------------------------------------------------------- - RANLIB_STUB="${RANLIB}" if test "${TEA_PLATFORM}" = "windows" ; then if test "${SHARED_BUILD}" = "1" ; then # We force the unresolved linking of symbols that are really in @@ -2978,13 +3064,16 @@ SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\"" fi eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}" - RANLIB=: else eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}" fi # Some packages build there own stubs libraries eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}" + # These aren't needed on Windows (either MSVC or gcc) + RANLIB=: + RANLIB_STUB=: else + RANLIB_STUB="${RANLIB}" if test "${SHARED_BUILD}" = "1" ; then SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}" if test x"${TK_BIN_DIR}" != x ; then @@ -3376,15 +3465,17 @@ #------------------------------------------------------------------------ AC_DEFUN(TEA_PROG_TCLSH, [ - AC_MSG_CHECKING([for tclsh]) + # Allow the user to provide this setting in the env + if test "x${TCLSH_PROG}" = "x" ; then + AC_MSG_CHECKING([for tclsh]) - AC_CACHE_VAL(ac_cv_path_tclsh, [ - if test "x${CELIB_DIR}" != "x" ; then - # If CELIB_DIR is defined, assume Windows/CE target is requested - # which means target tclsh cannot be run (cross-compile) - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - else - search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` + AC_CACHE_VAL(ac_cv_path_tclsh, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + if test "${TEA_PLATFORM}" != "windows" -o \ + \( "$do64bit_ok" = "no" -a "$doWince" = "no" \) ; then + # Do not allow target tclsh in known cross-compile builds, + # as we need one we can run on this system + search_path="${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin ${exec_prefix}/bin ${prefix}/bin ${search_path}" fi for dir in $search_path ; do for j in `ls -r $dir/tclsh[[8-9]]*${EXEEXT} 2> /dev/null` \ @@ -3397,13 +3488,14 @@ fi done done - ]) + ]) - if test -f "$ac_cv_path_tclsh" ; then - TCLSH_PROG=$ac_cv_path_tclsh - AC_MSG_RESULT([$TCLSH_PROG]) - else - AC_MSG_ERROR([No tclsh found in PATH: $search_path]) + if test -f "$ac_cv_path_tclsh" ; then + TCLSH_PROG=$ac_cv_path_tclsh + AC_MSG_RESULT([$TCLSH_PROG]) + else + AC_MSG_ERROR([No tclsh found in PATH: $search_path]) + fi fi AC_SUBST(TCLSH_PROG) ]) @@ -3425,15 +3517,17 @@ #------------------------------------------------------------------------ AC_DEFUN(TEA_PROG_WISH, [ - AC_MSG_CHECKING([for wish]) + # Allow the user to provide this setting in the env + if test "x${WISH_PROG}" = "x" ; then + AC_MSG_CHECKING([for wish]) - AC_CACHE_VAL(ac_cv_path_wish, [ - if test "x${CELIB_DIR}" != "x" ; then - # If CELIB_DIR is defined, assume Windows/CE target is requested - # which means target wish cannot be run (cross-compile) - search_path=`echo ${PATH} | sed -e 's/:/ /g'` - else - search_path=`echo ${TK_BIN_DIR}:${TK_BIN_DIR}/../bin:${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'` + AC_CACHE_VAL(ac_cv_path_wish, [ + search_path=`echo ${PATH} | sed -e 's/:/ /g'` + if test "${TEA_PLATFORM}" != "windows" -o \ + \( "$do64bit_ok" = "no" -a "$doWince" = "no" \) ; then + # Do not allow target wish in known cross-compile builds, + # as we need one we can run on this system + search_path="${TK_BIN_DIR} ${TK_BIN_DIR}/../bin ${TCL_BIN_DIR} ${TCL_BIN_DIR}/../bin ${exec_prefix}/bin ${prefix}/bin ${search_path}" fi for dir in $search_path ; do for j in `ls -r $dir/wish[[8-9]]*${EXEEXT} 2> /dev/null` \ @@ -3446,13 +3540,14 @@ fi done done - ]) + ]) - if test -f "$ac_cv_path_wish" ; then + if test -f "$ac_cv_path_wish" ; then WISH_PROG=$ac_cv_path_wish - AC_MSG_RESULT([$WISH_PROG]) - else - AC_MSG_ERROR([No wish found in PATH: $search_path]) + AC_MSG_RESULT([$WISH_PROG]) + else + AC_MSG_ERROR([No wish found in PATH: $search_path]) + fi fi AC_SUBST(WISH_PROG) ]) @@ -3493,6 +3588,13 @@ # First check to see if --with-$1 was specified. if test x"${with_$1config}" != x ; then + case ${with_$1config} in + */$1Config.sh ) + if test -f ${with_$1config}; then + AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself]) + with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'` + fi;; + esac if test -f "${with_$1config}/$1Config.sh" ; then ac_cv_c_$1config=`(cd ${with_$1config}; pwd)` else @@ -3504,13 +3606,25 @@ if test x"${ac_cv_c_$1config}" = x ; then for i in \ ../$1 \ - `ls -dr ../$1[[8-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ + `ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ + `ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ ../../$1 \ - `ls -dr ../../$1[[8-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ + `ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ + `ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ ../../../$1 \ - `ls -dr ../../../$1[[8-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ + `ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ + `ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ ${srcdir}/../$1 \ - `ls -dr ${srcdir}/../$1[[8-9]].[[0-9]]* 2>/dev/null` \ + `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \ + `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \ + `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \ + `ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \ ; do if test -f "$i/$1Config.sh" ; then ac_cv_c_$1config=`(cd $i; pwd)` @@ -3597,6 +3711,7 @@ fi AC_SUBST($1_VERSION) + AC_SUBST($1_BIN_DIR) AC_SUBST($1_SRC_DIR) AC_SUBST($1_LIB_FILE) @@ -3664,12 +3779,49 @@ fi ]) if test x"${ac_cv_c_celibconfig}" = x ; then - CELIB_DIR="# no Celib configs found" AC_MSG_ERROR([Cannot find celib support library directory]) else no_celib= CELIB_DIR=${ac_cv_c_celibconfig} AC_MSG_RESULT([found $CELIB_DIR]) + TEA_PATH_NOSPACE(CELIB_DIR, ${ac_cv_c_celibconfig}) fi fi ]) + +#------------------------------------------------------------------------ +# TEA_PATH_NOSPACE +# Ensure that the given path has no spaces. This is necessary for +# CC (and consitutuent vars that build it up) to work in the +# tortured autoconf environment. Currently only for Windows use. +# +# Arguments +# VAR - name of the variable to set +# PATH - path to ensure no spaces in +# +# Results +# Sets $VAR to short path of $PATH if it can be found. +#------------------------------------------------------------------------ + +AC_DEFUN([TEA_PATH_NOSPACE], [ + if test "${TEA_PLATFORM}" = "windows" ; then + # we need TCLSH_PROG defined to get Windows short pathnames + AC_REQUIRE([TEA_PROG_TCLSH]) + + AC_MSG_CHECKING([short pathname for $1 ($2)]) + + shortpath= + case "$2" in + *\ *) + # Only do this if we need to. + shortpath=`echo "puts [[file attributes {$2} -shortname]] ; exit" | ${TCLSH_PROG} 2>/dev/null` + ;; + esac + if test "x${shortpath}" = "x" ; then + AC_MSG_RESULT([not changed]) + else + $1=$shortpath + AC_MSG_RESULT([${$1}]) + fi + fi +])