Check-in [0fa0ca923c]
Bounty program for improvements to Tcl and certain Tcl packages.
Overview
Comment:Updated to TEA 3.5 in response to bug 1460491
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0fa0ca923c34cb10d08367bf2080ca1c3c4dabbd
User & Date: patthoyts on 2006-06-22 14:03:23
Other Links: manifest | tags
Context
2007-02-28
23:33
* win/makefile.vc: Rebase the DLL sensibly. Additional libs for static link of openssl. * tls.tcl: bug #1579837 - TIP 278 bug (possibly) - fixed. check-in: 6613ecd570 user: patthoyts tags: trunk
2006-06-22
14:03
Updated to TEA 3.5 in response to bug 1460491 check-in: 0fa0ca923c user: patthoyts tags: trunk
2005-02-09
01:19
note autoconf-2.59 use check-in: d3d9ecf47d user: hobbs2 tags: trunk
Changes

Modified ChangeLog from [c3d82e9467] to [d289d7ff0b].

            1  +2006-03-30  Pat Thoyts  <[email protected]>
            2  +
            3  +	* tclconfig/*:  Updated to TEA 3.5 in response to bug 1460491
            4  +	* configure*:   Regenerated configure.
            5  +
     1      6   2005-02-08  Jeff Hobbs  <[email protected]>
     2      7   
     3      8   	* Makefile.in, tclconfig/tcl.m4: update to TEA 3.2
     4      9   	* configure, configure.in:       using autoconf-2.59
     5     10   
     6     11   2004-12-23  Pat Thoyts  <[email protected]rs.sourceforge.net>
     7     12   

Modified aclocal.m4 from [49b1cec83e] to [59a1ccd527].

   123    123   	fi
   124    124       fi
   125    125   
   126    126       AC_SUBST(SSL_DIR)
   127    127       AC_SUBST(SSL_LIB_DIR)
   128    128       AC_SUBST(SSL_INCLUDE_DIR)
   129    129   
   130         -    if test "$GCC" = "yes"; then
          130  +    if test "$PLATFORM" = "WIN32" -a "$GCC" != "yes"; then
          131  +        SSL_INCLUDE_DIR_NATIVE=\"`echo ${SSL_INCLUDE_DIR}|sed 's%/%\\\\%g'`\"
          132  +        SSL_LIB_DIR_NATIVE=\"`echo ${SSL_LIB_DIR}|sed 's%/%\\\\%g'`\"
          133  +    else
   131    134           SSL_INCLUDE_DIR_NATIVE=\"`${CYGPATH} ${SSL_INCLUDE_DIR}`\"
   132    135           SSL_LIB_DIR_NATIVE=\"`${CYGPATH} ${SSL_LIB_DIR}`\"
   133         -    else
   134         -        SSL_INCLUDE_DIR_NATIVE=\"`echo ${SSL_INCLUDE_DIR}|sed 's%/%\\\\%g'`\"
   135         -        SSL_LIB_DIR_NATIVE=\"`echo ${SSL_LIB_DIR}|sed 's%/%\\\\%g'`\"
   136    136       fi
   137    137       AC_SUBST(SSL_INCLUDE_DIR_NATIVE)
   138    138       AC_SUBST(SSL_LIB_DIR_NATIVE)
   139    139   
   140    140       #--------------------------------------------------------------------
   141    141       # If OpenSSL was built with gcc then there may be some symbols that need
   142    142       # resolving before we can load it into tclsh (__udivd3i on solaris.

Modified configure from [d6243e043a] to [b4b18d9520].

   304    304   #  include <stdint.h>
   305    305   # endif
   306    306   #endif
   307    307   #if HAVE_UNISTD_H
   308    308   # include <unistd.h>
   309    309   #endif"
   310    310   
   311         -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB EGREP MATH_LIBS PKG_SOURCES PKG_OBJECTS CLEANFILES TCL_INCLUDES TCL_THREADS SHARED_BUILD AR TCLSH_PROG CELIB_DIR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING STLIB_LD SHLIB_LD SHLIB_CFLAGS SHLIB_LD_LIBS LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT SSL_DIR SSL_LIB_DIR SSL_INCLUDE_DIR SSL_INCLUDE_DIR_NATIVE SSL_LIB_DIR_NATIVE MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB LTLIBOBJS'
          311  +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CYGPATH EXEEXT PKG_LIB_FILE PKG_STUB_LIB_FILE PKG_STUB_SOURCES PKG_STUB_OBJECTS PKG_TCL_SOURCES PKG_HEADERS PKG_INCLUDES PKG_LIBS PKG_CFLAGS TCL_VERSION TCL_BIN_DIR TCL_SRC_DIR TCL_LIB_FILE TCL_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_LIBS TCL_DEFS TCL_EXTRA_CFLAGS TCL_LD_FLAGS TCL_SHLIB_LD_LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE RANLIB ac_ct_RANLIB EGREP MATH_LIBS PKG_SOURCES PKG_OBJECTS CLEANFILES TCL_INCLUDES TCL_THREADS SHARED_BUILD AR CELIB_DIR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT SSL_DIR SSL_LIB_DIR SSL_INCLUDE_DIR SSL_INCLUDE_DIR_NATIVE SSL_LIB_DIR_NATIVE MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB TCLSH_PROG LTLIBOBJS'
   312    312   ac_subst_files=''
   313    313   
   314    314   # Initialize some variables set by options.
   315    315   ac_init_help=
   316    316   ac_init_version=false
   317    317   # The variables have the same names as the options, with
   318    318   # dashes changed to underlines.
................................................................................
   838    838      esac
   839    839     cat <<\_ACEOF
   840    840   
   841    841   Optional Features:
   842    842     --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   843    843     --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   844    844     --enable-threads        build with threads
   845         -  --enable-shared         build and link with shared libraries --enable-shared
   846         -  --enable-64bit          enable 64bit support (where applicable)
   847         -  --enable-64bit-vis      enable 64bit Sparc VIS support
          845  +  --enable-shared         build and link with shared libraries (default: on)
          846  +  --enable-64bit          enable 64bit support (default: off)
          847  +  --enable-64bit-vis      enable 64bit Sparc VIS support (default: off)
   848    848     --enable-wince          enable Win/CE support (where applicable)
   849    849     --disable-load          disallow dynamic loading and "load" command
   850         -  --enable-symbols        build with debugging symbols --disable-symbols
          850  +                          (default: enabled)
          851  +  --enable-symbols        build with debugging symbols (default: off)
   851    852     --enable-bsafe          Use RSA BSAFE SSL-C libs.  Default is to use OpenSSL libs
   852    853     --enable-patents        Use patented code.  Default is enabled
   853    854   
   854    855   Optional Packages:
   855    856     --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   856    857     --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
   857         -  --with-tcl              directory containing tcl configuration (tclConfig.sh)
          858  +  --with-tcl              directory containing tcl configuration
          859  +                          (tclConfig.sh)
   858    860     --with-tclinclude       directory containing the public Tcl header files
   859    861     --with-celib=DIR        use Windows/CE support library from DIR
   860    862     --with-ssl-dir=DIR      SSL root directory
   861    863     --with-gcclib	       link with libgcc to resolve symbols in a gcc-built openssl library
   862    864   
   863    865   Some influential environment variables:
   864    866     CC          C compiler command
................................................................................
  1317   1319   
  1318   1320   
  1319   1321   
  1320   1322   
  1321   1323   
  1322   1324       # TEA extensions pass this us the version of TEA they think they
  1323   1325       # are compatible with.
  1324         -    TEA_VERSION="3.2"
         1326  +    TEA_VERSION="3.5"
  1325   1327   
  1326   1328       echo "$as_me:$LINENO: checking for correct TEA configuration" >&5
  1327   1329   echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6
  1328   1330       if test x"${PACKAGE_NAME}" = x ; then
  1329   1331   	{ { echo "$as_me:$LINENO: error:
  1330   1332   The PACKAGE_NAME variable must be defined by your TEA configure.in" >&5
  1331   1333   echo "$as_me: error:
  1332   1334   The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;}
  1333   1335      { (exit 1); exit 1; }; }
  1334   1336       fi
  1335         -    if test x"3.2" = x ; then
         1337  +    if test x"3.5" = x ; then
  1336   1338   	{ { echo "$as_me:$LINENO: error:
  1337   1339   TEA version not specified." >&5
  1338   1340   echo "$as_me: error:
  1339   1341   TEA version not specified." >&2;}
  1340   1342      { (exit 1); exit 1; }; }
  1341         -    elif test "3.2" != "${TEA_VERSION}" ; then
  1342         -	echo "$as_me:$LINENO: result: warning: requested TEA version \"3.2\", have \"${TEA_VERSION}\"" >&5
  1343         -echo "${ECHO_T}warning: requested TEA version \"3.2\", have \"${TEA_VERSION}\"" >&6
         1343  +    elif test "3.5" != "${TEA_VERSION}" ; then
         1344  +	echo "$as_me:$LINENO: result: warning: requested TEA version \"3.5\", have \"${TEA_VERSION}\"" >&5
         1345  +echo "${ECHO_T}warning: requested TEA version \"3.5\", have \"${TEA_VERSION}\"" >&6
  1344   1346       else
  1345   1347   	echo "$as_me:$LINENO: result: ok (TEA ${TEA_VERSION})" >&5
  1346   1348   echo "${ECHO_T}ok (TEA ${TEA_VERSION})" >&6
  1347   1349       fi
  1348   1350       case "`uname -s`" in
  1349   1351   	*win32*|*WIN32*|*CYGWIN_NT*|*CYGWIN_9*|*CYGWIN_ME*|*MINGW32_*)
  1350   1352   	    # Extract the first word of "cygpath", so it can be a program name with args.
................................................................................
  1473   1475   	if test "${ac_cv_c_tclconfig+set}" = set; then
  1474   1476     echo $ECHO_N "(cached) $ECHO_C" >&6
  1475   1477   else
  1476   1478   
  1477   1479   
  1478   1480   	    # First check to see if --with-tcl was specified.
  1479   1481   	    if test x"${with_tclconfig}" != x ; then
         1482  +		case ${with_tclconfig} in
         1483  +		    */tclConfig.sh )
         1484  +			if test -f ${with_tclconfig}; then
         1485  +			    { echo "$as_me:$LINENO: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&5
         1486  +echo "$as_me: WARNING: --with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself" >&2;}
         1487  +			    with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'`
         1488  +			fi ;;
         1489  +		esac
  1480   1490   		if test -f "${with_tclconfig}/tclConfig.sh" ; then
  1481   1491   		    ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
  1482   1492   		else
  1483   1493   		    { { echo "$as_me:$LINENO: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&5
  1484   1494   echo "$as_me: error: ${with_tclconfig} directory doesn't contain tclConfig.sh" >&2;}
  1485   1495      { (exit 1); exit 1; }; }
  1486   1496   		fi
  1487   1497   	    fi
  1488   1498   
  1489   1499   	    # then check for a private Tcl installation
  1490   1500   	    if test x"${ac_cv_c_tclconfig}" = x ; then
  1491   1501   		for i in \
  1492   1502   			../tcl \
         1503  +			`ls -dr ../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
         1504  +			`ls -dr ../tcl[8-9].[0-9] 2>/dev/null` \
  1493   1505   			`ls -dr ../tcl[8-9].[0-9]* 2>/dev/null` \
  1494   1506   			../../tcl \
         1507  +			`ls -dr ../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
         1508  +			`ls -dr ../../tcl[8-9].[0-9] 2>/dev/null` \
  1495   1509   			`ls -dr ../../tcl[8-9].[0-9]* 2>/dev/null` \
  1496   1510   			../../../tcl \
         1511  +			`ls -dr ../../../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
         1512  +			`ls -dr ../../../tcl[8-9].[0-9] 2>/dev/null` \
  1497   1513   			`ls -dr ../../../tcl[8-9].[0-9]* 2>/dev/null` ; do
  1498   1514   		    if test -f "$i/unix/tclConfig.sh" ; then
  1499   1515   			ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
  1500   1516   			break
  1501   1517   		    fi
  1502   1518   		done
  1503   1519   	    fi
         1520  +
         1521  +	    # on Darwin, check in Framework installation locations
         1522  +	    if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
         1523  +		for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
         1524  +			`ls -d /Library/Frameworks 2>/dev/null` \
         1525  +			`ls -d /Network/Library/Frameworks 2>/dev/null` \
         1526  +			`ls -d /System/Library/Frameworks 2>/dev/null` \
         1527  +			; do
         1528  +		    if test -f "$i/Tcl.framework/tclConfig.sh" ; then
         1529  +			ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
         1530  +			break
         1531  +		    fi
         1532  +		done
         1533  +	    fi
         1534  +
         1535  +	    # on Windows, check in common installation locations
         1536  +	    if test "${TEA_PLATFORM}" = "windows" \
         1537  +		-a x"${ac_cv_c_tclconfig}" = x ; then
         1538  +		for i in `ls -d C:/Tcl/lib 2>/dev/null` \
         1539  +			`ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
         1540  +			; do
         1541  +		    if test -f "$i/tclConfig.sh" ; then
         1542  +			ac_cv_c_tclconfig=`(cd $i; pwd)`
         1543  +			break
         1544  +		    fi
         1545  +		done
         1546  +	    fi
  1504   1547   
  1505   1548   	    # check in a few common install locations
  1506   1549   	    if test x"${ac_cv_c_tclconfig}" = x ; then
  1507         -		for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \
         1550  +		for i in `ls -d ${libdir} 2>/dev/null` \
         1551  +			`ls -d ${exec_prefix}/lib 2>/dev/null` \
  1508   1552   			`ls -d ${prefix}/lib 2>/dev/null` \
  1509   1553   			`ls -d /usr/local/lib 2>/dev/null` \
  1510   1554   			`ls -d /usr/contrib/lib 2>/dev/null` \
  1511   1555   			`ls -d /usr/lib 2>/dev/null` \
  1512   1556   			; do
  1513   1557   		    if test -f "$i/tclConfig.sh" ; then
  1514   1558   			ac_cv_c_tclconfig=`(cd $i; pwd)`
................................................................................
  1517   1561   		done
  1518   1562   	    fi
  1519   1563   
  1520   1564   	    # check in a few other private locations
  1521   1565   	    if test x"${ac_cv_c_tclconfig}" = x ; then
  1522   1566   		for i in \
  1523   1567   			${srcdir}/../tcl \
         1568  +			`ls -dr ${srcdir}/../tcl[8-9].[0-9].[0-9]* 2>/dev/null` \
         1569  +			`ls -dr ${srcdir}/../tcl[8-9].[0-9] 2>/dev/null` \
  1524   1570   			`ls -dr ${srcdir}/../tcl[8-9].[0-9]* 2>/dev/null` ; do
  1525   1571   		    if test -f "$i/unix/tclConfig.sh" ; then
  1526   1572   		    ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
  1527   1573   		    break
  1528   1574   		fi
  1529   1575   		done
  1530   1576   	    fi
  1531   1577   
  1532   1578   fi
  1533   1579   
  1534   1580   
  1535   1581   	if test x"${ac_cv_c_tclconfig}" = x ; then
  1536   1582   	    TCL_BIN_DIR="# no Tcl configs found"
  1537         -	    { echo "$as_me:$LINENO: WARNING: \"Cannot find Tcl configuration definitions\"" >&5
  1538         -echo "$as_me: WARNING: \"Cannot find Tcl configuration definitions\"" >&2;}
         1583  +	    { echo "$as_me:$LINENO: WARNING: Can't find Tcl configuration definitions" >&5
         1584  +echo "$as_me: WARNING: Can't find Tcl configuration definitions" >&2;}
  1539   1585   	    exit 0
  1540   1586   	else
  1541   1587   	    no_tcl=
  1542   1588   	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
  1543         -	    echo "$as_me:$LINENO: result: found $TCL_BIN_DIR/tclConfig.sh" >&5
  1544         -echo "${ECHO_T}found $TCL_BIN_DIR/tclConfig.sh" >&6
         1589  +	    echo "$as_me:$LINENO: result: found ${TCL_BIN_DIR}/tclConfig.sh" >&5
         1590  +echo "${ECHO_T}found ${TCL_BIN_DIR}/tclConfig.sh" >&6
  1545   1591   	fi
  1546   1592       fi
  1547   1593   
  1548   1594   
  1549         -    echo "$as_me:$LINENO: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5
  1550         -echo $ECHO_N "checking for existence of $TCL_BIN_DIR/tclConfig.sh... $ECHO_C" >&6
         1595  +    echo "$as_me:$LINENO: checking for existence of ${TCL_BIN_DIR}/tclConfig.sh" >&5
         1596  +echo $ECHO_N "checking for existence of ${TCL_BIN_DIR}/tclConfig.sh... $ECHO_C" >&6
  1551   1597   
  1552         -    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
         1598  +    if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
  1553   1599           echo "$as_me:$LINENO: result: loading" >&5
  1554   1600   echo "${ECHO_T}loading" >&6
  1555         -	. $TCL_BIN_DIR/tclConfig.sh
         1601  +	. ${TCL_BIN_DIR}/tclConfig.sh
  1556   1602       else
  1557         -        echo "$as_me:$LINENO: result: file not found" >&5
  1558         -echo "${ECHO_T}file not found" >&6
         1603  +        echo "$as_me:$LINENO: result: could not find ${TCL_BIN_DIR}/tclConfig.sh" >&5
         1604  +echo "${ECHO_T}could not find ${TCL_BIN_DIR}/tclConfig.sh" >&6
  1559   1605       fi
  1560   1606   
  1561         -    #
         1607  +    # eval is required to do the TCL_DBGX substitution
         1608  +    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
         1609  +    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
         1610  +
  1562   1611       # If the TCL_BIN_DIR is the build directory (not the install directory),
  1563   1612       # then set the common variable name to the value of the build variables.
  1564   1613       # For example, the variable TCL_LIB_SPEC will be set to the value
  1565   1614       # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
  1566   1615       # instead of TCL_BUILD_LIB_SPEC since it will work with both an
  1567   1616       # installed and uninstalled version of Tcl.
  1568         -    #
  1569         -
  1570         -    if test -f $TCL_BIN_DIR/Makefile ; then
         1617  +    if test -f ${TCL_BIN_DIR}/Makefile ; then
  1571   1618           TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
  1572   1619           TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
  1573   1620           TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
         1621  +    elif test "`uname -s`" = "Darwin"; then
         1622  +	# If Tcl was built as a framework, attempt to use the libraries
         1623  +	# from the framework at the given location so that linking works
         1624  +	# against Tcl.framework installed in an arbitary location.
         1625  +	case ${TCL_DEFS} in
         1626  +	    *TCL_FRAMEWORK*)
         1627  +		if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
         1628  +		    for i in "`cd ${TCL_BIN_DIR}; pwd`" \
         1629  +			     "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
         1630  +			if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
         1631  +			    TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
         1632  +			    break
         1633  +			fi
         1634  +		    done
         1635  +		fi
         1636  +		if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
         1637  +		    TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
         1638  +		    TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
         1639  +		fi
         1640  +		;;
         1641  +	esac
  1574   1642       fi
  1575   1643   
  1576         -    #
  1577   1644       # eval is required to do the TCL_DBGX substitution
  1578         -    #
  1579         -
  1580         -    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
  1581   1645       eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
  1582   1646       eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
  1583         -
  1584         -    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
  1585   1647       eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
  1586   1648       eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
  1587   1649   
  1588   1650   
  1589   1651   
  1590   1652   
  1591   1653   
................................................................................
  1598   1660   
  1599   1661   
  1600   1662   
  1601   1663   
  1602   1664   
  1603   1665   
  1604   1666   
  1605         -    #AC_SUBST(TCL_BUILD_LIB_SPEC)
  1606         -    #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
  1607   1667   
  1608   1668   
  1609   1669   #-----------------------------------------------------------------------
  1610   1670   # Handle the --prefix=... option by defaulting to what Tcl gave.
  1611   1671   # Must be called after TEA_LOAD_TCLCONFIG and before TEA_SETUP_COMPILER.
  1612   1672   #-----------------------------------------------------------------------
  1613   1673   
................................................................................
  3948   4008     ac_cv_header_net_errno_h=$ac_header_preproc
  3949   4009   fi
  3950   4010   echo "$as_me:$LINENO: result: $ac_cv_header_net_errno_h" >&5
  3951   4011   echo "${ECHO_T}$ac_cv_header_net_errno_h" >&6
  3952   4012   
  3953   4013   fi
  3954   4014   if test $ac_cv_header_net_errno_h = yes; then
  3955         -  cat >>confdefs.h <<\_ACEOF
         4015  +
         4016  +
         4017  +cat >>confdefs.h <<\_ACEOF
  3956   4018   #define HAVE_NET_ERRNO_H 1
  3957   4019   _ACEOF
  3958   4020   
  3959   4021   fi
  3960   4022   
  3961   4023   
  3962   4024   
................................................................................
  4512   4574       TCL_LIBS='${DL_LIBS} ${LIBS} ${MATH_LIBS}'
  4513   4575   
  4514   4576   
  4515   4577   
  4516   4578   
  4517   4579       echo "$as_me:$LINENO: checking dirent.h" >&5
  4518   4580   echo $ECHO_N "checking dirent.h... $ECHO_C" >&6
  4519         -    cat >conftest.$ac_ext <<_ACEOF
         4581  +if test "${tcl_cv_dirent_h+set}" = set; then
         4582  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         4583  +else
         4584  +  cat >conftest.$ac_ext <<_ACEOF
  4520   4585   /* confdefs.h.  */
  4521   4586   _ACEOF
  4522   4587   cat confdefs.h >>conftest.$ac_ext
  4523   4588   cat >>conftest.$ac_ext <<_ACEOF
  4524   4589   /* end confdefs.h.  */
  4525   4590   #include <sys/types.h>
  4526   4591   #include <dirent.h>
................................................................................
  4568   4633     (exit $ac_status); }; } &&
  4569   4634   	 { ac_try='test -s conftest$ac_exeext'
  4570   4635     { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  4571   4636     (eval $ac_try) 2>&5
  4572   4637     ac_status=$?
  4573   4638     echo "$as_me:$LINENO: \$? = $ac_status" >&5
  4574   4639     (exit $ac_status); }; }; then
  4575         -  tcl_ok=yes
         4640  +  tcl_cv_dirent_h=yes
  4576   4641   else
  4577   4642     echo "$as_me: failed program was:" >&5
  4578   4643   sed 's/^/| /' conftest.$ac_ext >&5
  4579   4644   
  4580         -tcl_ok=no
         4645  +tcl_cv_dirent_h=no
  4581   4646   fi
  4582   4647   rm -f conftest.err conftest.$ac_objext \
  4583   4648         conftest$ac_exeext conftest.$ac_ext
         4649  +fi
         4650  +echo "$as_me:$LINENO: result: $tcl_cv_dirent_h" >&5
         4651  +echo "${ECHO_T}$tcl_cv_dirent_h" >&6
  4584   4652   
  4585         -    if test $tcl_ok = no; then
  4586         -	cat >>confdefs.h <<\_ACEOF
         4653  +    if test $tcl_cv_dirent_h = no; then
         4654  +
         4655  +cat >>confdefs.h <<\_ACEOF
  4587   4656   #define NO_DIRENT_H 1
  4588   4657   _ACEOF
  4589   4658   
  4590   4659       fi
  4591   4660   
  4592         -    echo "$as_me:$LINENO: result: $tcl_ok" >&5
  4593         -echo "${ECHO_T}$tcl_ok" >&6
  4594   4661       if test "${ac_cv_header_errno_h+set}" = set; then
  4595   4662     echo "$as_me:$LINENO: checking for errno.h" >&5
  4596   4663   echo $ECHO_N "checking for errno.h... $ECHO_C" >&6
  4597   4664   if test "${ac_cv_header_errno_h+set}" = set; then
  4598   4665     echo $ECHO_N "(cached) $ECHO_C" >&6
  4599   4666   fi
  4600   4667   echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
................................................................................
  4727   4794   echo "$as_me:$LINENO: result: $ac_cv_header_errno_h" >&5
  4728   4795   echo "${ECHO_T}$ac_cv_header_errno_h" >&6
  4729   4796   
  4730   4797   fi
  4731   4798   if test $ac_cv_header_errno_h = yes; then
  4732   4799     :
  4733   4800   else
  4734         -  cat >>confdefs.h <<\_ACEOF
         4801  +
         4802  +cat >>confdefs.h <<\_ACEOF
  4735   4803   #define NO_ERRNO_H 1
  4736   4804   _ACEOF
  4737   4805   
  4738   4806   fi
  4739   4807   
  4740   4808   
  4741   4809       if test "${ac_cv_header_float_h+set}" = set; then
................................................................................
  4874   4942   echo "$as_me:$LINENO: result: $ac_cv_header_float_h" >&5
  4875   4943   echo "${ECHO_T}$ac_cv_header_float_h" >&6
  4876   4944   
  4877   4945   fi
  4878   4946   if test $ac_cv_header_float_h = yes; then
  4879   4947     :
  4880   4948   else
  4881         -  cat >>confdefs.h <<\_ACEOF
         4949  +
         4950  +cat >>confdefs.h <<\_ACEOF
  4882   4951   #define NO_FLOAT_H 1
  4883   4952   _ACEOF
  4884   4953   
  4885   4954   fi
  4886   4955   
  4887   4956   
  4888   4957       if test "${ac_cv_header_values_h+set}" = set; then
................................................................................
  5021   5090   echo "$as_me:$LINENO: result: $ac_cv_header_values_h" >&5
  5022   5091   echo "${ECHO_T}$ac_cv_header_values_h" >&6
  5023   5092   
  5024   5093   fi
  5025   5094   if test $ac_cv_header_values_h = yes; then
  5026   5095     :
  5027   5096   else
  5028         -  cat >>confdefs.h <<\_ACEOF
         5097  +
         5098  +cat >>confdefs.h <<\_ACEOF
  5029   5099   #define NO_VALUES_H 1
  5030   5100   _ACEOF
  5031   5101   
  5032   5102   fi
  5033   5103   
  5034   5104   
  5035   5105       if test "${ac_cv_header_limits_h+set}" = set; then
................................................................................
  5166   5236     ac_cv_header_limits_h=$ac_header_preproc
  5167   5237   fi
  5168   5238   echo "$as_me:$LINENO: result: $ac_cv_header_limits_h" >&5
  5169   5239   echo "${ECHO_T}$ac_cv_header_limits_h" >&6
  5170   5240   
  5171   5241   fi
  5172   5242   if test $ac_cv_header_limits_h = yes; then
  5173         -  cat >>confdefs.h <<\_ACEOF
         5243  +
         5244  +cat >>confdefs.h <<\_ACEOF
  5174   5245   #define HAVE_LIMITS_H 1
  5175   5246   _ACEOF
  5176   5247   
  5177   5248   else
  5178         -  cat >>confdefs.h <<\_ACEOF
         5249  +
         5250  +cat >>confdefs.h <<\_ACEOF
  5179   5251   #define NO_LIMITS_H 1
  5180   5252   _ACEOF
  5181   5253   
  5182   5254   fi
  5183   5255   
  5184   5256   
  5185   5257       if test "${ac_cv_header_stdlib_h+set}" = set; then
................................................................................
  5374   5446     :
  5375   5447   else
  5376   5448     tcl_ok=0
  5377   5449   fi
  5378   5450   rm -f conftest*
  5379   5451   
  5380   5452       if test $tcl_ok = 0; then
  5381         -	cat >>confdefs.h <<\_ACEOF
         5453  +
         5454  +cat >>confdefs.h <<\_ACEOF
  5382   5455   #define NO_STDLIB_H 1
  5383   5456   _ACEOF
  5384   5457   
  5385   5458       fi
  5386   5459       if test "${ac_cv_header_string_h+set}" = set; then
  5387   5460     echo "$as_me:$LINENO: checking for string.h" >&5
  5388   5461   echo $ECHO_N "checking for string.h... $ECHO_C" >&6
................................................................................
  5562   5635   rm -f conftest*
  5563   5636   
  5564   5637   
  5565   5638       # See also memmove check below for a place where NO_STRING_H can be
  5566   5639       # set and why.
  5567   5640   
  5568   5641       if test $tcl_ok = 0; then
  5569         -	cat >>confdefs.h <<\_ACEOF
         5642  +
         5643  +cat >>confdefs.h <<\_ACEOF
  5570   5644   #define NO_STRING_H 1
  5571   5645   _ACEOF
  5572   5646   
  5573   5647       fi
  5574   5648   
  5575   5649       if test "${ac_cv_header_sys_wait_h+set}" = set; then
  5576   5650     echo "$as_me:$LINENO: checking for sys/wait.h" >&5
................................................................................
  5708   5782   echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
  5709   5783   echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
  5710   5784   
  5711   5785   fi
  5712   5786   if test $ac_cv_header_sys_wait_h = yes; then
  5713   5787     :
  5714   5788   else
  5715         -  cat >>confdefs.h <<\_ACEOF
         5789  +
         5790  +cat >>confdefs.h <<\_ACEOF
  5716   5791   #define NO_SYS_WAIT_H 1
  5717   5792   _ACEOF
  5718   5793   
  5719   5794   fi
  5720   5795   
  5721   5796   
  5722   5797       if test "${ac_cv_header_dlfcn_h+set}" = set; then
................................................................................
  5855   5930   echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5
  5856   5931   echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6
  5857   5932   
  5858   5933   fi
  5859   5934   if test $ac_cv_header_dlfcn_h = yes; then
  5860   5935     :
  5861   5936   else
  5862         -  cat >>confdefs.h <<\_ACEOF
         5937  +
         5938  +cat >>confdefs.h <<\_ACEOF
  5863   5939   #define NO_DLFCN_H 1
  5864   5940   _ACEOF
  5865   5941   
  5866   5942   fi
  5867   5943   
  5868   5944   
  5869   5945   
................................................................................
  6013   6089     cat >>confdefs.h <<_ACEOF
  6014   6090   #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
  6015   6091   _ACEOF
  6016   6092   
  6017   6093   fi
  6018   6094   
  6019   6095   done
  6020         -
  6021   6096   
  6022   6097   
  6023   6098   	# Let the user call this, because if it triggers, they will
  6024   6099   	# need a compat/strtod.c that is correct.  Users can also
  6025   6100   	# use Tcl_GetDouble(FromObj) instead.
  6026   6101   	#TEA_BUGGY_STRTOD
  6027   6102       fi
................................................................................
  6206   6281   		ac_cv_c_tclh=${with_tclinclude}
  6207   6282   	    else
  6208   6283   		{ { echo "$as_me:$LINENO: error: ${with_tclinclude} directory does not contain tcl.h" >&5
  6209   6284   echo "$as_me: error: ${with_tclinclude} directory does not contain tcl.h" >&2;}
  6210   6285      { (exit 1); exit 1; }; }
  6211   6286   	    fi
  6212   6287   	else
         6288  +	    if test "`uname -s`" = "Darwin"; then
         6289  +		# If Tcl was built as a framework, attempt to use
         6290  +		# the framework's Headers directory
         6291  +		case ${TCL_DEFS} in
         6292  +		    *TCL_FRAMEWORK*)
         6293  +			list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
         6294  +			;;
         6295  +		esac
         6296  +	    fi
         6297  +
         6298  +	    # Look in the source dir only if Tcl is not installed,
         6299  +	    # and in that situation, look there before installed locations.
         6300  +	    if test -f "${TCL_BIN_DIR}/Makefile" ; then
         6301  +		list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
         6302  +	    fi
         6303  +
  6213   6304   	    # Check order: pkg --prefix location, Tcl's --prefix location,
  6214         -	    # directory of tclConfig.sh, and Tcl source directory.
  6215         -	    # Looking in the source dir is not ideal, but OK.
         6305  +	    # relative to directory of tclConfig.sh.
  6216   6306   
  6217   6307   	    eval "temp_includedir=${includedir}"
  6218         -	    list="`ls -d ${temp_includedir}      2>/dev/null` \
         6308  +	    list="$list \
         6309  +		`ls -d ${temp_includedir}        2>/dev/null` \
  6219   6310   		`ls -d ${TCL_PREFIX}/include     2>/dev/null` \
  6220         -		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \
  6221         -		`ls -d ${TCL_SRC_DIR}/generic    2>/dev/null`"
         6311  +		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
  6222   6312   	    if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
  6223   6313   		list="$list /usr/local/include /usr/include"
         6314  +		if test x"${TCL_INCLUDE_SPEC}" != x ; then
         6315  +		    d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
         6316  +		    list="$list `ls -d ${d} 2>/dev/null`"
         6317  +		fi
  6224   6318   	    fi
  6225   6319   	    for i in $list ; do
  6226   6320   		if test -f "$i/tcl.h" ; then
  6227   6321   		    ac_cv_c_tclh=$i
  6228   6322   		    break
  6229   6323   		fi
  6230   6324   	    done
................................................................................
  6259   6353   
  6260   6354   
  6261   6355       # Check whether --enable-threads or --disable-threads was given.
  6262   6356   if test "${enable_threads+set}" = set; then
  6263   6357     enableval="$enable_threads"
  6264   6358     tcl_ok=$enableval
  6265   6359   else
  6266         -  tcl_ok=
         6360  +  tcl_ok=yes
  6267   6361   fi;
         6362  +
         6363  +    if test "${enable_threads+set}" = set; then
         6364  +	enableval="$enable_threads"
         6365  +	tcl_ok=$enableval
         6366  +    else
         6367  +	tcl_ok=yes
         6368  +    fi
  6268   6369   
  6269   6370       if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
  6270   6371   	TCL_THREADS=1
  6271   6372   
  6272   6373   	if test "${TEA_PLATFORM}" != "windows" ; then
  6273         -	    # We are always OK on Windows, so check what this platform wants.
  6274         -	    cat >>confdefs.h <<\_ACEOF
         6374  +	    # We are always OK on Windows, so check what this platform wants:
         6375  +
         6376  +	    # USE_THREAD_ALLOC tells us to try the special thread-based
         6377  +	    # allocator that significantly reduces lock contention
         6378  +
         6379  +cat >>confdefs.h <<\_ACEOF
  6275   6380   #define USE_THREAD_ALLOC 1
  6276   6381   _ACEOF
  6277   6382   
  6278         -	    cat >>confdefs.h <<\_ACEOF
         6383  +
         6384  +cat >>confdefs.h <<\_ACEOF
  6279   6385   #define _REENTRANT 1
  6280   6386   _ACEOF
  6281   6387   
  6282         -	    cat >>confdefs.h <<\_ACEOF
         6388  +	    if test "`uname -s`" = "SunOS" ; then
         6389  +
         6390  +cat >>confdefs.h <<\_ACEOF
         6391  +#define _POSIX_PTHREAD_SEMANTICS 1
         6392  +_ACEOF
         6393  +
         6394  +	    fi
         6395  +
         6396  +cat >>confdefs.h <<\_ACEOF
  6283   6397   #define _THREAD_SAFE 1
  6284   6398   _ACEOF
  6285   6399   
  6286   6400   	    echo "$as_me:$LINENO: checking for pthread_mutex_init in -lpthread" >&5
  6287   6401   echo $ECHO_N "checking for pthread_mutex_init in -lpthread... $ECHO_C" >&6
  6288   6402   if test "${ac_cv_lib_pthread_pthread_mutex_init+set}" = set; then
  6289   6403     echo $ECHO_N "(cached) $ECHO_C" >&6
................................................................................
  6350   6464   if test $ac_cv_lib_pthread_pthread_mutex_init = yes; then
  6351   6465     tcl_ok=yes
  6352   6466   else
  6353   6467     tcl_ok=no
  6354   6468   fi
  6355   6469   
  6356   6470   	    if test "$tcl_ok" = "no"; then
  6357         -		# Check a little harder for __pthread_mutex_init in the
  6358         -		# same library, as some systems hide it there until
  6359         -		# pthread.h is defined.	 We could alternatively do an
  6360         -		# AC_TRY_COMPILE with pthread.h, but that will work with
  6361         -		# libpthread really doesn't exist, like AIX 4.2.
  6362         -		# [Bug: 4359]
         6471  +		# Check a little harder for __pthread_mutex_init in the same
         6472  +		# library, as some systems hide it there until pthread.h is
         6473  +		# defined.  We could alternatively do an AC_TRY_COMPILE with
         6474  +		# pthread.h, but that will work with libpthread really doesn't
         6475  +		# exist, like AIX 4.2.  [Bug: 4359]
  6363   6476   		echo "$as_me:$LINENO: checking for __pthread_mutex_init in -lpthread" >&5
  6364   6477   echo $ECHO_N "checking for __pthread_mutex_init in -lpthread... $ECHO_C" >&6
  6365   6478   if test "${ac_cv_lib_pthread___pthread_mutex_init+set}" = set; then
  6366   6479     echo $ECHO_N "(cached) $ECHO_C" >&6
  6367   6480   else
  6368   6481     ac_check_lib_save_LIBS=$LIBS
  6369   6482   LIBS="-lpthread  $LIBS"
................................................................................
  6652   6765   fi
  6653   6766   
  6654   6767   			if test "$tcl_ok" = "yes"; then
  6655   6768   			    # The space is needed
  6656   6769   			    THREADS_LIBS=" -pthread"
  6657   6770   			else
  6658   6771   			    TCL_THREADS=0
  6659         -			    { echo "$as_me:$LINENO: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&5
  6660         -echo "$as_me: WARNING: \"Don t know how to find pthread lib on your system - thread support disabled\"" >&2;}
         6772  +			    { echo "$as_me:$LINENO: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&5
         6773  +echo "$as_me: WARNING: Do not know how to find pthread lib on your system - thread support disabled" >&2;}
  6661   6774   			fi
  6662   6775   		    fi
  6663   6776   		fi
  6664   6777   	    fi
  6665         -
  6666         -	    # Does the pthread-implementation provide
  6667         -	    # 'pthread_attr_setstacksize' ?
  6668         -
  6669         -	    ac_saved_libs=$LIBS
  6670         -	    LIBS="$LIBS $THREADS_LIBS"
  6671         -
  6672         -for ac_func in pthread_attr_setstacksize
  6673         -do
  6674         -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  6675         -echo "$as_me:$LINENO: checking for $ac_func" >&5
  6676         -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  6677         -if eval "test \"\${$as_ac_var+set}\" = set"; then
  6678         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  6679         -else
  6680         -  cat >conftest.$ac_ext <<_ACEOF
  6681         -/* confdefs.h.  */
  6682         -_ACEOF
  6683         -cat confdefs.h >>conftest.$ac_ext
  6684         -cat >>conftest.$ac_ext <<_ACEOF
  6685         -/* end confdefs.h.  */
  6686         -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
  6687         -   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
  6688         -#define $ac_func innocuous_$ac_func
  6689         -
  6690         -/* System header to define __stub macros and hopefully few prototypes,
  6691         -    which can conflict with char $ac_func (); below.
  6692         -    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  6693         -    <limits.h> exists even on freestanding compilers.  */
  6694         -
  6695         -#ifdef __STDC__
  6696         -# include <limits.h>
  6697         -#else
  6698         -# include <assert.h>
  6699         -#endif
  6700         -
  6701         -#undef $ac_func
  6702         -
  6703         -/* Override any gcc2 internal prototype to avoid an error.  */
  6704         -#ifdef __cplusplus
  6705         -extern "C"
  6706         -{
  6707         -#endif
  6708         -/* We use char because int might match the return type of a gcc2
  6709         -   builtin and then its argument prototype would still apply.  */
  6710         -char $ac_func ();
  6711         -/* The GNU C library defines this for functions which it implements
  6712         -    to always fail with ENOSYS.  Some functions are actually named
  6713         -    something starting with __ and the normal name is an alias.  */
  6714         -#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  6715         -choke me
  6716         -#else
  6717         -char (*f) () = $ac_func;
  6718         -#endif
  6719         -#ifdef __cplusplus
  6720         -}
  6721         -#endif
  6722         -
  6723         -int
  6724         -main ()
  6725         -{
  6726         -return f != $ac_func;
  6727         -  ;
  6728         -  return 0;
  6729         -}
  6730         -_ACEOF
  6731         -rm -f conftest.$ac_objext conftest$ac_exeext
  6732         -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  6733         -  (eval $ac_link) 2>conftest.er1
  6734         -  ac_status=$?
  6735         -  grep -v '^ *+' conftest.er1 >conftest.err
  6736         -  rm -f conftest.er1
  6737         -  cat conftest.err >&5
  6738         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  6739         -  (exit $ac_status); } &&
  6740         -	 { ac_try='test -z "$ac_c_werror_flag"
  6741         -			 || test ! -s conftest.err'
  6742         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  6743         -  (eval $ac_try) 2>&5
  6744         -  ac_status=$?
  6745         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  6746         -  (exit $ac_status); }; } &&
  6747         -	 { ac_try='test -s conftest$ac_exeext'
  6748         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  6749         -  (eval $ac_try) 2>&5
  6750         -  ac_status=$?
  6751         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  6752         -  (exit $ac_status); }; }; then
  6753         -  eval "$as_ac_var=yes"
  6754         -else
  6755         -  echo "$as_me: failed program was:" >&5
  6756         -sed 's/^/| /' conftest.$ac_ext >&5
  6757         -
  6758         -eval "$as_ac_var=no"
  6759         -fi
  6760         -rm -f conftest.err conftest.$ac_objext \
  6761         -      conftest$ac_exeext conftest.$ac_ext
  6762         -fi
  6763         -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  6764         -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  6765         -if test `eval echo '${'$as_ac_var'}'` = yes; then
  6766         -  cat >>confdefs.h <<_ACEOF
  6767         -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  6768         -_ACEOF
  6769         -
  6770         -fi
  6771         -done
  6772         -
  6773         -	    LIBS=$ac_saved_libs
  6774         -
  6775         -for ac_func in readdir_r
  6776         -do
  6777         -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
  6778         -echo "$as_me:$LINENO: checking for $ac_func" >&5
  6779         -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
  6780         -if eval "test \"\${$as_ac_var+set}\" = set"; then
  6781         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  6782         -else
  6783         -  cat >conftest.$ac_ext <<_ACEOF
  6784         -/* confdefs.h.  */
  6785         -_ACEOF
  6786         -cat confdefs.h >>conftest.$ac_ext
  6787         -cat >>conftest.$ac_ext <<_ACEOF
  6788         -/* end confdefs.h.  */
  6789         -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
  6790         -   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
  6791         -#define $ac_func innocuous_$ac_func
  6792         -
  6793         -/* System header to define __stub macros and hopefully few prototypes,
  6794         -    which can conflict with char $ac_func (); below.
  6795         -    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
  6796         -    <limits.h> exists even on freestanding compilers.  */
  6797         -
  6798         -#ifdef __STDC__
  6799         -# include <limits.h>
  6800         -#else
  6801         -# include <assert.h>
  6802         -#endif
  6803         -
  6804         -#undef $ac_func
  6805         -
  6806         -/* Override any gcc2 internal prototype to avoid an error.  */
  6807         -#ifdef __cplusplus
  6808         -extern "C"
  6809         -{
  6810         -#endif
  6811         -/* We use char because int might match the return type of a gcc2
  6812         -   builtin and then its argument prototype would still apply.  */
  6813         -char $ac_func ();
  6814         -/* The GNU C library defines this for functions which it implements
  6815         -    to always fail with ENOSYS.  Some functions are actually named
  6816         -    something starting with __ and the normal name is an alias.  */
  6817         -#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
  6818         -choke me
  6819         -#else
  6820         -char (*f) () = $ac_func;
  6821         -#endif
  6822         -#ifdef __cplusplus
  6823         -}
  6824         -#endif
  6825         -
  6826         -int
  6827         -main ()
  6828         -{
  6829         -return f != $ac_func;
  6830         -  ;
  6831         -  return 0;
  6832         -}
  6833         -_ACEOF
  6834         -rm -f conftest.$ac_objext conftest$ac_exeext
  6835         -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
  6836         -  (eval $ac_link) 2>conftest.er1
  6837         -  ac_status=$?
  6838         -  grep -v '^ *+' conftest.er1 >conftest.err
  6839         -  rm -f conftest.er1
  6840         -  cat conftest.err >&5
  6841         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  6842         -  (exit $ac_status); } &&
  6843         -	 { ac_try='test -z "$ac_c_werror_flag"
  6844         -			 || test ! -s conftest.err'
  6845         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  6846         -  (eval $ac_try) 2>&5
  6847         -  ac_status=$?
  6848         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  6849         -  (exit $ac_status); }; } &&
  6850         -	 { ac_try='test -s conftest$ac_exeext'
  6851         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  6852         -  (eval $ac_try) 2>&5
  6853         -  ac_status=$?
  6854         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  6855         -  (exit $ac_status); }; }; then
  6856         -  eval "$as_ac_var=yes"
  6857         -else
  6858         -  echo "$as_me: failed program was:" >&5
  6859         -sed 's/^/| /' conftest.$ac_ext >&5
  6860         -
  6861         -eval "$as_ac_var=no"
  6862         -fi
  6863         -rm -f conftest.err conftest.$ac_objext \
  6864         -      conftest$ac_exeext conftest.$ac_ext
  6865         -fi
  6866         -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
  6867         -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
  6868         -if test `eval echo '${'$as_ac_var'}'` = yes; then
  6869         -  cat >>confdefs.h <<_ACEOF
  6870         -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
  6871         -_ACEOF
  6872         -
  6873         -fi
  6874         -done
  6875         -
  6876   6778   	fi
  6877   6779       else
  6878   6780   	TCL_THREADS=0
  6879   6781       fi
  6880   6782       # Do checking message here to not mess up interleaved configure output
  6881   6783       echo "$as_me:$LINENO: checking for building with threads" >&5
  6882   6784   echo $ECHO_N "checking for building with threads... $ECHO_C" >&6
  6883         -    if test "${TCL_THREADS}" = "1"; then
  6884         -	cat >>confdefs.h <<\_ACEOF
         6785  +    if test "${TCL_THREADS}" = 1; then
         6786  +
         6787  +cat >>confdefs.h <<\_ACEOF
  6885   6788   #define TCL_THREADS 1
  6886   6789   _ACEOF
  6887   6790   
  6888         -	#LIBS="$LIBS $THREADS_LIBS"
  6889         -	echo "$as_me:$LINENO: result: yes" >&5
  6890         -echo "${ECHO_T}yes" >&6
         6791  +	echo "$as_me:$LINENO: result: yes (default)" >&5
         6792  +echo "${ECHO_T}yes (default)" >&6
  6891   6793       else
  6892         -	echo "$as_me:$LINENO: result: no (default)" >&5
  6893         -echo "${ECHO_T}no (default)" >&6
         6794  +	echo "$as_me:$LINENO: result: no" >&5
         6795  +echo "${ECHO_T}no" >&6
  6894   6796       fi
  6895   6797       # TCL_THREADS sanity checking.  See if our request for building with
  6896   6798       # threads is the same as the way Tcl was built.  If not, warn the user.
  6897   6799       case ${TCL_DEFS} in
  6898   6800   	*THREADS=1*)
  6899   6801   	    if test "${TCL_THREADS}" = "0"; then
  6900   6802   		{ echo "$as_me:$LINENO: WARNING:
  6901         -    Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl
  6902         -    that IS thread-enabled." >&5
         6803  +    Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
         6804  +    that IS thread-enabled.  It is recommended to use --enable-threads." >&5
  6903   6805   echo "$as_me: WARNING:
  6904         -    Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl
  6905         -    that IS thread-enabled." >&2;}
         6806  +    Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
         6807  +    that IS thread-enabled.  It is recommended to use --enable-threads." >&2;}
  6906   6808   	    fi
  6907   6809   	    ;;
  6908   6810   	*)
  6909   6811   	    if test "${TCL_THREADS}" = "1"; then
  6910   6812   		{ echo "$as_me:$LINENO: WARNING:
  6911         -    --enable-threads requested, but attempting building against a Tcl
  6912         -    that is NOT thread-enabled." >&5
         6813  +    --enable-threads requested, but building against a Tcl that is NOT
         6814  +    thread-enabled.  This is an OK configuration that will also run in
         6815  +    a thread-enabled core." >&5
  6913   6816   echo "$as_me: WARNING:
  6914         -    --enable-threads requested, but attempting building against a Tcl
  6915         -    that is NOT thread-enabled." >&2;}
         6817  +    --enable-threads requested, but building against a Tcl that is NOT
         6818  +    thread-enabled.  This is an OK configuration that will also run in
         6819  +    a thread-enabled core." >&2;}
  6916   6820   	    fi
  6917   6821   	    ;;
  6918   6822       esac
  6919   6823   
  6920   6824   
  6921   6825   
  6922   6826   #--------------------------------------------------------------------
................................................................................
  6946   6850   	echo "$as_me:$LINENO: result: shared" >&5
  6947   6851   echo "${ECHO_T}shared" >&6
  6948   6852   	SHARED_BUILD=1
  6949   6853       else
  6950   6854   	echo "$as_me:$LINENO: result: static" >&5
  6951   6855   echo "${ECHO_T}static" >&6
  6952   6856   	SHARED_BUILD=0
  6953         -	cat >>confdefs.h <<\_ACEOF
         6857  +
         6858  +cat >>confdefs.h <<\_ACEOF
  6954   6859   #define STATIC_BUILD 1
  6955   6860   _ACEOF
  6956   6861   
  6957   6862       fi
  6958   6863   
  6959   6864   
  6960   6865   
................................................................................
  6961   6866   #--------------------------------------------------------------------
  6962   6867   # This macro figures out what flags to use with the compiler/linker
  6963   6868   # when building shared/static debug/optimized objects.  This information
  6964   6869   # can be taken from the tclConfig.sh file, but this figures it all out.
  6965   6870   #--------------------------------------------------------------------
  6966   6871   
  6967   6872   
  6968         -    # Allow the user to provide this setting in the env
  6969         -    if test "x${TCLSH_PROG}" = "x" ; then
  6970         -	echo "$as_me:$LINENO: checking for tclsh" >&5
  6971         -echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
  6972         -
  6973         -	if test "${ac_cv_path_tclsh+set}" = set; then
  6974         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  6975         -else
  6976         -
  6977         -	if test "${TEA_PLATFORM}" = "windows" -a "$do64bit_ok" = "yes" \
  6978         -		-o "$doWince" != "no" ; then
  6979         -	    # A Windows cross-compile build - restrict target tclsh
  6980         -	    # as we need one we can run on this system
  6981         -	    search_path=`echo ${PATH} | sed -e 's/:/ /g'`
  6982         -	else
  6983         -	    search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'`
  6984         -	fi
  6985         -	for dir in $search_path ; do
  6986         -	    for j in `ls -r $dir/tclsh[8-9]*${EXEEXT} 2> /dev/null` \
  6987         -		    `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do
  6988         -		if test x"$ac_cv_path_tclsh" = x ; then
  6989         -		    if test -f "$j" ; then
  6990         -			ac_cv_path_tclsh=$j
  6991         -			break
  6992         -		    fi
  6993         -		fi
  6994         -	    done
  6995         -	done
  6996         -
  6997         -fi
  6998   6873   
  6999   6874   
  7000         -	if test -f "$ac_cv_path_tclsh" ; then
  7001         -	    TCLSH_PROG=$ac_cv_path_tclsh
  7002         -	    echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
  7003         -echo "${ECHO_T}$TCLSH_PROG" >&6
  7004         -	else
  7005         -	    { { echo "$as_me:$LINENO: error: No tclsh found in PATH: $search_path" >&5
  7006         -echo "$as_me: error: No tclsh found in PATH: $search_path" >&2;}
  7007         -   { (exit 1); exit 1; }; }
  7008         -	fi
  7009         -    fi
         6875  +    # Step 0.a: Enable 64 bit support?
  7010   6876   
  7011         -
  7012         -
  7013         -
  7014         -
  7015         -    # Step 0: Enable 64 bit support?
  7016         -
  7017         -    echo "$as_me:$LINENO: checking if 64bit support is enabled" >&5
  7018         -echo $ECHO_N "checking if 64bit support is enabled... $ECHO_C" >&6
         6877  +    echo "$as_me:$LINENO: checking if 64bit support is requested" >&5
         6878  +echo $ECHO_N "checking if 64bit support is requested... $ECHO_C" >&6
  7019   6879       # Check whether --enable-64bit or --disable-64bit was given.
  7020   6880   if test "${enable_64bit+set}" = set; then
  7021   6881     enableval="$enable_64bit"
  7022   6882     do64bit=$enableval
  7023   6883   else
  7024   6884     do64bit=no
  7025   6885   fi;
................................................................................
  7058   6918     doWince=no
  7059   6919   fi;
  7060   6920   	echo "$as_me:$LINENO: result: $doWince" >&5
  7061   6921   echo "${ECHO_T}$doWince" >&6
  7062   6922       fi
  7063   6923   
  7064   6924       # Step 1: set the variable "system" to hold the name and version number
  7065         -    # for the system.  This can usually be done via the "uname" command, but
  7066         -    # there are a few systems, like Next, where this doesn't work.
         6925  +    # for the system.
  7067   6926   
  7068         -    echo "$as_me:$LINENO: checking system version (for dynamic loading)" >&5
  7069         -echo $ECHO_N "checking system version (for dynamic loading)... $ECHO_C" >&6
  7070         -    if test -f /usr/lib/NextStep/software_version; then
  7071         -	system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  7072         -    else
  7073         -	system=`uname -s`-`uname -r`
  7074         -	if test "$?" -ne 0 ; then
  7075         -	    echo "$as_me:$LINENO: result: unknown (can't find uname command)" >&5
  7076         -echo "${ECHO_T}unknown (can't find uname command)" >&6
  7077         -	    system=unknown
         6927  +
         6928  +    echo "$as_me:$LINENO: checking system version" >&5
         6929  +echo $ECHO_N "checking system version... $ECHO_C" >&6
         6930  +if test "${tcl_cv_sys_version+set}" = set; then
         6931  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         6932  +else
         6933  +
         6934  +	if test "${TEA_PLATFORM}" = "windows" ; then
         6935  +	    tcl_cv_sys_version=windows
         6936  +	elif test -f /usr/lib/NextStep/software_version; then
         6937  +	    tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  7078   6938   	else
  7079         -	    # Special check for weird MP-RAS system (uname returns weird
  7080         -	    # results, and the version is kept in special file).
         6939  +	    tcl_cv_sys_version=`uname -s`-`uname -r`
         6940  +	    if test "$?" -ne 0 ; then
         6941  +		{ echo "$as_me:$LINENO: WARNING: can't find uname command" >&5
         6942  +echo "$as_me: WARNING: can't find uname command" >&2;}
         6943  +		tcl_cv_sys_version=unknown
         6944  +	    else
         6945  +		# Special check for weird MP-RAS system (uname returns weird
         6946  +		# results, and the version is kept in special file).
  7081   6947   
  7082         -	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  7083         -		system=MP-RAS-`awk '{print }' /etc/.relid'`
         6948  +		if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
         6949  +		    tcl_cv_sys_version=MP-RAS-`awk '{print $3}' /etc/.relid`
         6950  +		fi
         6951  +		if test "`uname -s`" = "AIX" ; then
         6952  +		    tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
         6953  +		fi
  7084   6954   	    fi
  7085         -	    if test "`uname -s`" = "AIX" ; then
  7086         -		system=AIX-`uname -v`.`uname -r`
  7087         -	    fi
  7088         -	    if test "${TEA_PLATFORM}" = "windows" ; then
  7089         -		system=windows
  7090         -	    fi
  7091         -	    echo "$as_me:$LINENO: result: $system" >&5
  7092         -echo "${ECHO_T}$system" >&6
  7093   6955   	fi
  7094         -    fi
         6956  +
         6957  +fi
         6958  +echo "$as_me:$LINENO: result: $tcl_cv_sys_version" >&5
         6959  +echo "${ECHO_T}$tcl_cv_sys_version" >&6
         6960  +    system=$tcl_cv_sys_version
         6961  +
  7095   6962   
  7096   6963       # Step 2: check for existence of -ldl library.  This is needed because
  7097   6964       # Linux can use either -ldl or -ldld for dynamic loading.
  7098   6965   
  7099   6966       echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
  7100   6967   echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
  7101   6968   if test "${ac_cv_lib_dl_dlopen+set}" = set; then
................................................................................
  7162   7029   echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
  7163   7030   if test $ac_cv_lib_dl_dlopen = yes; then
  7164   7031     have_dl=yes
  7165   7032   else
  7166   7033     have_dl=no
  7167   7034   fi
  7168   7035   
         7036  +
         7037  +    # Require ranlib early so we can override it in special cases below.
         7038  +
         7039  +
  7169   7040   
  7170   7041       # Step 3: set configuration options based on system name and version.
  7171   7042       # This is similar to Tcl's unix/tcl.m4 except that we've added a
  7172         -    # "windows" case and CC_SEARCH_FLAGS becomes LD_SEARCH_FLAGS for us
  7173         -    # (and we have no CC_SEARCH_FLAGS).
         7043  +    # "windows" case.
  7174   7044   
  7175   7045       do64bit_ok=no
  7176   7046       LDFLAGS_ORIG="$LDFLAGS"
         7047  +    # When ld needs options to work in 64-bit mode, put them in
         7048  +    # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
         7049  +    # is disabled by the user. [Bug 1016796]
         7050  +    LDFLAGS_ARCH=""
  7177   7051       TCL_EXPORT_FILE_SUFFIX=""
  7178   7052       UNSHARED_LIB_SUFFIX=""
  7179   7053       TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
  7180   7054       ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
  7181   7055       TCL_LIB_VERSIONS_OK=ok
  7182   7056       CFLAGS_DEBUG=-g
         7057  +    CFLAGS_OPTIMIZE=-O
  7183   7058       if test "$GCC" = "yes" ; then
  7184   7059   	CFLAGS_OPTIMIZE=-O2
  7185   7060   	CFLAGS_WARNING="-Wall -Wno-implicit-int"
  7186   7061       else
  7187         -	CFLAGS_OPTIMIZE=-O
  7188   7062   	CFLAGS_WARNING=""
  7189   7063       fi
  7190   7064       TCL_NEEDS_EXP_FILE=0
  7191   7065       TCL_BUILD_EXP_FILE=""
  7192   7066       TCL_EXP_FILE=""
  7193   7067       # Extract the first word of "ar", so it can be a program name with args.
  7194   7068   set dummy ar; ac_word=$2
................................................................................
  7227   7101   
  7228   7102       STLIB_LD='${AR} cr'
  7229   7103       LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
  7230   7104       case $system in
  7231   7105   	windows)
  7232   7106   	    # This is a 2-stage check to make sure we have the 64-bit SDK
  7233   7107   	    # We have to know where the SDK is installed.
  7234         -	    if test "$do64bit" = "yes" ; then
         7108  +	    # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
         7109  +	    # MACHINE is IX86 for LINK, but this is used by the manifest,
         7110  +	    # which requires x86|amd64|ia64.
         7111  +	    MACHINE="X86"
         7112  +	    if test "$do64bit" != "no" ; then
  7235   7113   		if test "x${MSSDK}x" = "xx" ; then
  7236         -		    MSSDK="C:/Progra~1/Microsoft SDK"
  7237         -		fi
  7238         -		# Ensure that this path has no spaces to work in autoconf
  7239         -
  7240         -    if test "${TEA_PLATFORM}" = "windows" ; then
  7241         -	# we need TCLSH_PROG defined to get Windows short pathnames
  7242         -
  7243         -
  7244         -	echo "$as_me:$LINENO: checking short pathname for MSSDK (${MSSDK})" >&5
  7245         -echo $ECHO_N "checking short pathname for MSSDK (${MSSDK})... $ECHO_C" >&6
  7246         -
  7247         -	shortpath=
  7248         -	case "${MSSDK}" in
  7249         -	    *\ *)
  7250         -		# Only do this if we need to.
  7251         -		shortpath=`echo "puts [file attributes {${MSSDK}} -shortname] ; exit" | ${TCLSH_PROG} 2>/dev/null`
  7252         -		;;
  7253         -	esac
  7254         -	if test "x${shortpath}" = "x" ; then
  7255         -	    echo "$as_me:$LINENO: result: not changed" >&5
  7256         -echo "${ECHO_T}not changed" >&6
  7257         -	else
  7258         -	    MSSDK=$shortpath
  7259         -	    echo "$as_me:$LINENO: result: ${MSSDK}" >&5
  7260         -echo "${ECHO_T}${MSSDK}" >&6
  7261         -	fi
  7262         -    fi
  7263         -
  7264         -		if test ! -d "${MSSDK}/bin/win64" ; then
  7265         -		    { echo "$as_me:$LINENO: WARNING: could not find 64-bit SDK to enable 64bit mode" >&5
  7266         -echo "$as_me: WARNING: could not find 64-bit SDK to enable 64bit mode" >&2;}
         7114  +		    MSSDK="C:/Progra~1/Microsoft Platform SDK"
         7115  +		fi
         7116  +		MSSDK=`echo "$MSSDK" | sed -e  's!\\\!/!g'`
         7117  +		PATH64=""
         7118  +		case "$do64bit" in
         7119  +		    amd64|x64|yes)
         7120  +			MACHINE="AMD64" ; # default to AMD64 64-bit build
         7121  +			PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
         7122  +			;;
         7123  +		    ia64)
         7124  +			MACHINE="IA64"
         7125  +			PATH64="${MSSDK}/Bin/Win64"
         7126  +			;;
         7127  +		esac
         7128  +		if test ! -d "${PATH64}" ; then
         7129  +		    { echo "$as_me:$LINENO: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&5
         7130  +echo "$as_me: WARNING: Could not find 64-bit $MACHINE SDK to enable 64bit mode" >&2;}
         7131  +		    { echo "$as_me:$LINENO: WARNING: Ensure latest Platform SDK is installed" >&5
         7132  +echo "$as_me: WARNING: Ensure latest Platform SDK is installed" >&2;}
  7267   7133   		    do64bit="no"
  7268   7134   		else
         7135  +		    echo "$as_me:$LINENO: result:    Using 64-bit $MACHINE mode" >&5
         7136  +echo "${ECHO_T}   Using 64-bit $MACHINE mode" >&6
  7269   7137   		    do64bit_ok="yes"
  7270   7138   		fi
  7271   7139   	    fi
  7272   7140   
  7273   7141   	    if test "$doWince" != "no" ; then
  7274         -		if test "$do64bit" = "yes" ; then
         7142  +		if test "$do64bit" != "no" ; then
  7275   7143   		    { { echo "$as_me:$LINENO: error: Windows/CE and 64-bit builds incompatible" >&5
  7276   7144   echo "$as_me: error: Windows/CE and 64-bit builds incompatible" >&2;}
  7277   7145      { (exit 1); exit 1; }; }
  7278   7146   		fi
  7279   7147   		if test "$GCC" = "yes" ; then
  7280   7148   		    { { echo "$as_me:$LINENO: error: Windows/CE and GCC builds incompatible" >&5
  7281   7149   echo "$as_me: error: Windows/CE and GCC builds incompatible" >&2;}
................................................................................
  7335   7203   	if test x"${ac_cv_c_celibconfig}" = x ; then
  7336   7204   	    { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5
  7337   7205   echo "$as_me: error: Cannot find celib support library directory" >&2;}
  7338   7206      { (exit 1); exit 1; }; }
  7339   7207   	else
  7340   7208   	    no_celib=
  7341   7209   	    CELIB_DIR=${ac_cv_c_celibconfig}
         7210  +	    CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
  7342   7211   	    echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5
  7343   7212   echo "${ECHO_T}found $CELIB_DIR" >&6
  7344         -
  7345         -    if test "${TEA_PLATFORM}" = "windows" ; then
  7346         -	# we need TCLSH_PROG defined to get Windows short pathnames
  7347         -
  7348         -
  7349         -	echo "$as_me:$LINENO: checking short pathname for CELIB_DIR (${ac_cv_c_celibconfig})" >&5
  7350         -echo $ECHO_N "checking short pathname for CELIB_DIR (${ac_cv_c_celibconfig})... $ECHO_C" >&6
  7351         -
  7352         -	shortpath=
  7353         -	case "${ac_cv_c_celibconfig}" in
  7354         -	    *\ *)
  7355         -		# Only do this if we need to.
  7356         -		shortpath=`echo "puts [file attributes {${ac_cv_c_celibconfig}} -shortname] ; exit" | ${TCLSH_PROG} 2>/dev/null`
  7357         -		;;
  7358         -	esac
  7359         -	if test "x${shortpath}" = "x" ; then
  7360         -	    echo "$as_me:$LINENO: result: not changed" >&5
  7361         -echo "${ECHO_T}not changed" >&6
  7362         -	else
  7363         -	    CELIB_DIR=$shortpath
  7364         -	    echo "$as_me:$LINENO: result: ${CELIB_DIR}" >&5
  7365         -echo "${ECHO_T}${CELIB_DIR}" >&6
  7366         -	fi
  7367         -    fi
  7368         -
  7369   7213   	fi
  7370   7214       fi
  7371   7215   
  7372   7216   		# Set defaults for common evc4/PPC2003 setup
  7373   7217   		# Currently Tcl requires 300+, possibly 420+ for sockets
  7374   7218   		CEVERSION=420; 		# could be 211 300 301 400 420 ...
  7375   7219   		TARGETCPU=ARMV4;	# could be ARMV4 ARM MIPS SH3 X86 ...
................................................................................
  7399   7243   		fi
  7400   7244   		if test "x${SDKROOT}" = "x" ; then
  7401   7245   		    SDKROOT="C:/Program Files/Windows CE Tools"
  7402   7246   		    if test ! -d "${SDKROOT}" ; then
  7403   7247   			SDKROOT="C:/Windows CE Tools"
  7404   7248   		    fi
  7405   7249   		fi
  7406         -		# Ensure that this path has no spaces to work in autoconf
  7407         -
  7408         -    if test "${TEA_PLATFORM}" = "windows" ; then
  7409         -	# we need TCLSH_PROG defined to get Windows short pathnames
  7410         -
  7411         -
  7412         -	echo "$as_me:$LINENO: checking short pathname for WCEROOT (${WCEROOT})" >&5
  7413         -echo $ECHO_N "checking short pathname for WCEROOT (${WCEROOT})... $ECHO_C" >&6
  7414         -
  7415         -	shortpath=
  7416         -	case "${WCEROOT}" in
  7417         -	    *\ *)
  7418         -		# Only do this if we need to.
  7419         -		shortpath=`echo "puts [file attributes {${WCEROOT}} -shortname] ; exit" | ${TCLSH_PROG} 2>/dev/null`
  7420         -		;;
  7421         -	esac
  7422         -	if test "x${shortpath}" = "x" ; then
  7423         -	    echo "$as_me:$LINENO: result: not changed" >&5
  7424         -echo "${ECHO_T}not changed" >&6
  7425         -	else
  7426         -	    WCEROOT=$shortpath
  7427         -	    echo "$as_me:$LINENO: result: ${WCEROOT}" >&5
  7428         -echo "${ECHO_T}${WCEROOT}" >&6
  7429         -	fi
  7430         -    fi
  7431         -
  7432         -
  7433         -    if test "${TEA_PLATFORM}" = "windows" ; then
  7434         -	# we need TCLSH_PROG defined to get Windows short pathnames
  7435         -
  7436         -
  7437         -	echo "$as_me:$LINENO: checking short pathname for SDKROOT (${SDKROOT})" >&5
  7438         -echo $ECHO_N "checking short pathname for SDKROOT (${SDKROOT})... $ECHO_C" >&6
  7439         -
  7440         -	shortpath=
  7441         -	case "${SDKROOT}" in
  7442         -	    *\ *)
  7443         -		# Only do this if we need to.
  7444         -		shortpath=`echo "puts [file attributes {${SDKROOT}} -shortname] ; exit" | ${TCLSH_PROG} 2>/dev/null`
  7445         -		;;
  7446         -	esac
  7447         -	if test "x${shortpath}" = "x" ; then
  7448         -	    echo "$as_me:$LINENO: result: not changed" >&5
  7449         -echo "${ECHO_T}not changed" >&6
  7450         -	else
  7451         -	    SDKROOT=$shortpath
  7452         -	    echo "$as_me:$LINENO: result: ${SDKROOT}" >&5
  7453         -echo "${ECHO_T}${SDKROOT}" >&6
  7454         -	fi
  7455         -    fi
  7456         -
         7250  +		WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
         7251  +		SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
  7457   7252   		if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
  7458   7253   		    -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
  7459   7254   		    { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5
  7460   7255   echo "$as_me: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&2;}
  7461   7256      { (exit 1); exit 1; }; }
  7462   7257   		    doWince="no"
  7463   7258   		else
................................................................................
  7474   7269   	    if test "$GCC" != "yes" ; then
  7475   7270   	        if test "${SHARED_BUILD}" = "0" ; then
  7476   7271   		    runtime=-MT
  7477   7272   	        else
  7478   7273   		    runtime=-MD
  7479   7274   	        fi
  7480   7275   
  7481         -                if test "$do64bit" = "yes" ; then
         7276  +                if test "$do64bit" != "no" ; then
  7482   7277   		    # All this magic is necessary for the Win64 SDK RC1 - hobbs
  7483         -		    CC="${MSSDK}/Bin/Win64/cl.exe"
  7484         -		    CFLAGS="${CFLAGS} -I${MSSDK}/Include/prerelease \
  7485         -			-I${MSSDK}/Include/Win64/crt \
  7486         -			-I${MSSDK}/Include"
  7487         -		    RC="${MSSDK}/bin/rc.exe"
  7488         -		    lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \
  7489         -			-LIBPATH:${MSSDK}/Lib/Prerelease/IA64 -nologo"
  7490         -		    LINKBIN="${MSSDK}/bin/win64/link.exe"
         7278  +		    CC="\"${PATH64}/cl.exe\""
         7279  +		    CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
         7280  +		    RC="\"${MSSDK}/bin/rc.exe\""
         7281  +		    lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
         7282  +		    LINKBIN="\"${PATH64}/link.exe\""
  7491   7283   		    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
  7492   7284   		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
         7285  +		    # Avoid 'unresolved external symbol __security_cookie'
         7286  +		    # errors, c.f. http://support.microsoft.com/?id=894573
         7287  +
         7288  +    vars="bufferoverflowU.lib"
         7289  +    for i in $vars; do
         7290  +	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
         7291  +	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
         7292  +	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`
         7293  +	fi
         7294  +	PKG_LIBS="$PKG_LIBS $i"
         7295  +    done
         7296  +
         7297  +
  7493   7298   		elif test "$doWince" != "no" ; then
  7494   7299   		    CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
  7495   7300   		    if test "${TARGETCPU}" = "X86"; then
  7496         -			CC="${CEBINROOT}/cl.exe"
         7301  +			CC="\"${CEBINROOT}/cl.exe\""
  7497   7302   		    else
  7498         -			CC="${CEBINROOT}/cl${ARCH}.exe"
         7303  +			CC="\"${CEBINROOT}/cl${ARCH}.exe\""
  7499   7304   		    fi
  7500   7305   		    CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
  7501         -		    RC="${WCEROOT}/Common/EVC/bin/rc.exe"
         7306  +		    RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
  7502   7307   		    arch=`echo ${ARCH} | awk '{print tolower($0)}'`
  7503         -		    defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
         7308  +		    defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
         7309  +		    if test "${SHARED_BUILD}" = "1" ; then
         7310  +			# Static CE builds require static celib as well
         7311  +		    	defs="${defs} _DLL"
         7312  +		    fi
  7504   7313   		    for i in $defs ; do
  7505         -			cat >>confdefs.h <<_ACEOF
         7314  +
         7315  +cat >>confdefs.h <<_ACEOF
  7506   7316   #define $i 1
  7507   7317   _ACEOF
  7508   7318   
  7509   7319   		    done
  7510         -		    cat >>confdefs.h <<_ACEOF
         7320  +
         7321  +cat >>confdefs.h <<_ACEOF
  7511   7322   #define _WIN32_WCE $CEVERSION
  7512   7323   _ACEOF
  7513   7324   
  7514         -		    cat >>confdefs.h <<_ACEOF
         7325  +
         7326  +cat >>confdefs.h <<_ACEOF
  7515   7327   #define UNDER_CE $CEVERSION
  7516   7328   _ACEOF
  7517   7329   
  7518   7330   		    CFLAGS_DEBUG="-nologo -Zi -Od"
  7519   7331   		    CFLAGS_OPTIMIZE="-nologo -Ox"
  7520   7332   		    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
  7521   7333   		    lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
  7522         -		    LINKBIN="${CEBINROOT}/link.exe"
         7334  +		    LINKBIN="\"${CEBINROOT}/link.exe\""
  7523   7335   
  7524   7336   		else
  7525   7337   		    RC="rc"
  7526   7338   		    lflags="-nologo"
  7527   7339       		    LINKBIN="link"
  7528   7340   		    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
  7529   7341   		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
................................................................................
  7566   7378   	    TCL_LIB_VERSIONS_OK=nodots
  7567   7379   	    # Bogus to avoid getting this turned off
  7568   7380   	    DL_OBJS="tclLoadNone.obj"
  7569   7381       	    ;;
  7570   7382   	AIX-*)
  7571   7383   	    if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
  7572   7384   		# AIX requires the _r compiler when gcc isn't being used
  7573         -		if test "${CC}" != "cc_r" ; then
  7574         -		    CC=${CC}_r
  7575         -		fi
         7385  +		case "${CC}" in
         7386  +		    *_r)
         7387  +			# ok ...
         7388  +			;;
         7389  +		    *)
         7390  +			CC=${CC}_r
         7391  +			;;
         7392  +		esac
  7576   7393   		echo "$as_me:$LINENO: result: Using $CC for compiling with threads" >&5
  7577   7394   echo "${ECHO_T}Using $CC for compiling with threads" >&6
  7578   7395   	    fi
  7579   7396   	    LIBS="$LIBS -lc"
  7580   7397   	    SHLIB_CFLAGS=""
         7398  +	    SHLIB_LD_LIBS='${LIBS}'
  7581   7399   	    SHLIB_SUFFIX=".so"
  7582         -	    SHLIB_LD_LIBS='${LIBS}'
  7583   7400   
  7584   7401   	    DL_OBJS="tclLoadDl.o"
  7585   7402   	    LD_LIBRARY_PATH_VAR="LIBPATH"
  7586   7403   
  7587         -	    # AIX v<=4.1 has some different flags than 4.2+
  7588         -	    if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
  7589         -		#LIBOBJS="$LIBOBJS tclLoadAix.o"
  7590         -		case $LIBOBJS in
  7591         -    "tclLoadAix.$ac_objext"   | \
  7592         -  *" tclLoadAix.$ac_objext"   | \
  7593         -    "tclLoadAix.$ac_objext "* | \
  7594         -  *" tclLoadAix.$ac_objext "* ) ;;
  7595         -  *) LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" ;;
  7596         -esac
  7597         -
  7598         -		DL_LIBS="-lld"
  7599         -	    fi
  7600         -
  7601   7404   	    # Check to enable 64-bit flags for compiler/linker on AIX 4+
  7602   7405   	    if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
  7603   7406   		if test "$GCC" = "yes" ; then
  7604         -		    { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5
  7605         -echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;}
         7407  +		    { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
         7408  +echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
  7606   7409   		else
  7607   7410   		    do64bit_ok=yes
  7608   7411   		    CFLAGS="$CFLAGS -q64"
  7609         -		    LDFLAGS="$LDFLAGS -q64"
         7412  +		    LDFLAGS_ARCH="-q64"
  7610   7413   		    RANLIB="${RANLIB} -X64"
  7611   7414   		    AR="${AR} -X64"
  7612   7415   		    SHLIB_LD_FLAGS="-b64"
  7613   7416   		fi
  7614   7417   	    fi
  7615   7418   
  7616   7419   	    if test "`uname -m`" = "ia64" ; then
  7617   7420   		# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
  7618   7421   		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  7619   7422   		# AIX-5 has dl* in libc.so
  7620   7423   		DL_LIBS=""
  7621   7424   		if test "$GCC" = "yes" ; then
  7622         -		    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
         7425  +		    CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  7623   7426   		else
  7624         -		    LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
         7427  +		    CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
  7625   7428   		fi
         7429  +		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  7626   7430   	    else
  7627   7431   		if test "$GCC" = "yes" ; then
  7628   7432   		    SHLIB_LD="gcc -shared"
  7629   7433   		else
  7630   7434   		    SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
  7631   7435   		fi
  7632   7436   		SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
  7633   7437   		DL_LIBS="-ldl"
  7634         -		LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
         7438  +		CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
         7439  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  7635   7440   		TCL_NEEDS_EXP_FILE=1
  7636   7441   		TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp'
  7637   7442   	    fi
         7443  +
         7444  +	    # AIX v<=4.1 has some different flags than 4.2+
         7445  +	    if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
         7446  +		case $LIBOBJS in
         7447  +    "tclLoadAix.$ac_objext"   | \
         7448  +  *" tclLoadAix.$ac_objext"   | \
         7449  +    "tclLoadAix.$ac_objext "* | \
         7450  +  *" tclLoadAix.$ac_objext "* ) ;;
         7451  +  *) LIBOBJS="$LIBOBJS tclLoadAix.$ac_objext" ;;
         7452  +esac
         7453  +
         7454  +		DL_LIBS="-lld"
         7455  +	    fi
  7638   7456   
  7639   7457   	    # On AIX <=v4 systems, libbsd.a has to be linked in to support
  7640   7458   	    # non-blocking file IO.  This library has to be linked in after
  7641   7459   	    # the MATH_LIBS or it breaks the pow() function.  The way to
  7642   7460   	    # insure proper sequencing, is to add it to the tail of MATH_LIBS.
  7643   7461   	    # This library also supplies gettimeofday.
  7644   7462   	    #
................................................................................
  7716   7534     libbsd=yes
  7717   7535   else
  7718   7536     libbsd=no
  7719   7537   fi
  7720   7538   
  7721   7539   	    if test $libbsd = yes; then
  7722   7540   	    	MATH_LIBS="$MATH_LIBS -lbsd"
  7723         -	    	cat >>confdefs.h <<\_ACEOF
         7541  +
         7542  +cat >>confdefs.h <<\_ACEOF
  7724   7543   #define USE_DELTA_FOR_TZ 1
  7725   7544   _ACEOF
  7726   7545   
  7727   7546   	    fi
  7728   7547   	    ;;
  7729   7548   	BeOS*)
  7730   7549   	    SHLIB_CFLAGS="-fPIC"
  7731   7550   	    SHLIB_LD="${CC} -nostart"
  7732   7551   	    SHLIB_LD_LIBS='${LIBS}'
  7733   7552   	    SHLIB_SUFFIX=".so"
  7734   7553   	    DL_OBJS="tclLoadDl.o"
  7735   7554   	    DL_LIBS="-ldl"
         7555  +
         7556  +	    #-----------------------------------------------------------
         7557  +	    # Check for inet_ntoa in -lbind, for BeOS (which also needs
         7558  +	    # -lsocket, even if the network functions are in -lnet which
         7559  +	    # is always linked to, for compatibility.
         7560  +	    #-----------------------------------------------------------
         7561  +	    echo "$as_me:$LINENO: checking for inet_ntoa in -lbind" >&5
         7562  +echo $ECHO_N "checking for inet_ntoa in -lbind... $ECHO_C" >&6
         7563  +if test "${ac_cv_lib_bind_inet_ntoa+set}" = set; then
         7564  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         7565  +else
         7566  +  ac_check_lib_save_LIBS=$LIBS
         7567  +LIBS="-lbind  $LIBS"
         7568  +cat >conftest.$ac_ext <<_ACEOF
         7569  +/* confdefs.h.  */
         7570  +_ACEOF
         7571  +cat confdefs.h >>conftest.$ac_ext
         7572  +cat >>conftest.$ac_ext <<_ACEOF
         7573  +/* end confdefs.h.  */
         7574  +
         7575  +/* Override any gcc2 internal prototype to avoid an error.  */
         7576  +#ifdef __cplusplus
         7577  +extern "C"
         7578  +#endif
         7579  +/* We use char because int might match the return type of a gcc2
         7580  +   builtin and then its argument prototype would still apply.  */
         7581  +char inet_ntoa ();
         7582  +int
         7583  +main ()
         7584  +{
         7585  +inet_ntoa ();
         7586  +  ;
         7587  +  return 0;
         7588  +}
         7589  +_ACEOF
         7590  +rm -f conftest.$ac_objext conftest$ac_exeext
         7591  +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
         7592  +  (eval $ac_link) 2>conftest.er1
         7593  +  ac_status=$?
         7594  +  grep -v '^ *+' conftest.er1 >conftest.err
         7595  +  rm -f conftest.er1
         7596  +  cat conftest.err >&5
         7597  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         7598  +  (exit $ac_status); } &&
         7599  +	 { ac_try='test -z "$ac_c_werror_flag"
         7600  +			 || test ! -s conftest.err'
         7601  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         7602  +  (eval $ac_try) 2>&5
         7603  +  ac_status=$?
         7604  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         7605  +  (exit $ac_status); }; } &&
         7606  +	 { ac_try='test -s conftest$ac_exeext'
         7607  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         7608  +  (eval $ac_try) 2>&5
         7609  +  ac_status=$?
         7610  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         7611  +  (exit $ac_status); }; }; then
         7612  +  ac_cv_lib_bind_inet_ntoa=yes
         7613  +else
         7614  +  echo "$as_me: failed program was:" >&5
         7615  +sed 's/^/| /' conftest.$ac_ext >&5
         7616  +
         7617  +ac_cv_lib_bind_inet_ntoa=no
         7618  +fi
         7619  +rm -f conftest.err conftest.$ac_objext \
         7620  +      conftest$ac_exeext conftest.$ac_ext
         7621  +LIBS=$ac_check_lib_save_LIBS
         7622  +fi
         7623  +echo "$as_me:$LINENO: result: $ac_cv_lib_bind_inet_ntoa" >&5
         7624  +echo "${ECHO_T}$ac_cv_lib_bind_inet_ntoa" >&6
         7625  +if test $ac_cv_lib_bind_inet_ntoa = yes; then
         7626  +  LIBS="$LIBS -lbind -lsocket"
         7627  +fi
         7628  +
  7736   7629   	    ;;
  7737   7630   	BSD/OS-2.1*|BSD/OS-3*)
  7738   7631   	    SHLIB_CFLAGS=""
  7739   7632   	    SHLIB_LD="shlicc -r"
  7740   7633   	    SHLIB_LD_LIBS='${LIBS}'
  7741   7634   	    SHLIB_SUFFIX=".so"
  7742   7635   	    DL_OBJS="tclLoadDl.o"
  7743   7636   	    DL_LIBS="-ldl"
         7637  +	    CC_SEARCH_FLAGS=""
  7744   7638   	    LD_SEARCH_FLAGS=""
  7745   7639   	    ;;
  7746   7640   	BSD/OS-4.*)
  7747   7641   	    SHLIB_CFLAGS="-export-dynamic -fPIC"
  7748   7642   	    SHLIB_LD="cc -shared"
  7749   7643   	    SHLIB_LD_LIBS='${LIBS}'
  7750   7644   	    SHLIB_SUFFIX=".so"
  7751   7645   	    DL_OBJS="tclLoadDl.o"
  7752   7646   	    DL_LIBS="-ldl"
  7753   7647   	    LDFLAGS="$LDFLAGS -export-dynamic"
         7648  +	    CC_SEARCH_FLAGS=""
  7754   7649   	    LD_SEARCH_FLAGS=""
  7755   7650   	    ;;
  7756   7651   	dgux*)
  7757   7652   	    SHLIB_CFLAGS="-K PIC"
  7758   7653   	    SHLIB_LD="cc -G"
  7759   7654   	    SHLIB_LD_LIBS=""
  7760   7655   	    SHLIB_SUFFIX=".so"
  7761   7656   	    DL_OBJS="tclLoadDl.o"
  7762   7657   	    DL_LIBS="-ldl"
         7658  +	    CC_SEARCH_FLAGS=""
  7763   7659   	    LD_SEARCH_FLAGS=""
  7764   7660   	    ;;
  7765   7661   	HP-UX-*.11.*)
  7766   7662   	    # Use updated header definitions where possible
  7767         -	    cat >>confdefs.h <<\_ACEOF
         7663  +
         7664  +cat >>confdefs.h <<\_ACEOF
  7768   7665   #define _XOPEN_SOURCE_EXTENDED 1
  7769   7666   _ACEOF
  7770   7667   
         7668  +	    # Needed by Tcl, but not most extensions
         7669  +	    #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
         7670  +	    #LIBS="$LIBS -lxnet"               # Use the XOPEN network library
  7771   7671   
  7772   7672   	    SHLIB_SUFFIX=".sl"
  7773   7673   	    echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
  7774   7674   echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
  7775   7675   if test "${ac_cv_lib_dld_shl_load+set}" = set; then
  7776   7676     echo $ECHO_N "(cached) $ECHO_C" >&6
  7777   7677   else
................................................................................
  7843   7743   	    if test "$tcl_ok" = yes; then
  7844   7744   		SHLIB_CFLAGS="+z"
  7845   7745   		SHLIB_LD="ld -b"
  7846   7746   		SHLIB_LD_LIBS='${LIBS}'
  7847   7747   		DL_OBJS="tclLoadShl.o"
  7848   7748   		DL_LIBS="-ldld"
  7849   7749   		LDFLAGS="$LDFLAGS -Wl,-E"
  7850         -		LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
         7750  +		CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
         7751  +		LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
  7851   7752   		LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  7852   7753   	    fi
  7853   7754   	    if test "$GCC" = "yes" ; then
  7854   7755   		SHLIB_LD="gcc -shared"
  7855   7756   		SHLIB_LD_LIBS='${LIBS}'
  7856         -		LD_SEARCH_FLAGS=''
         7757  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  7857   7758   	    fi
  7858   7759   
  7859   7760   	    # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
  7860   7761   	    #CFLAGS="$CFLAGS +DAportable"
  7861   7762   
  7862   7763   	    # Check to enable 64-bit flags for compiler/linker
  7863   7764   	    if test "$do64bit" = "yes" ; then
................................................................................
  7865   7766   		    hpux_arch=`${CC} -dumpmachine`
  7866   7767   		    case $hpux_arch in
  7867   7768   			hppa64*)
  7868   7769   			    # 64-bit gcc in use.  Fix flags for GNU ld.
  7869   7770   			    do64bit_ok=yes
  7870   7771   			    SHLIB_LD="${CC} -shared"
  7871   7772   			    SHLIB_LD_LIBS='${LIBS}'
  7872         -			    LD_SEARCH_FLAGS=''
         7773  +			    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7774  +			    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  7873   7775   			    ;;
  7874   7776   			*)
  7875         -			    { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5
  7876         -echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;}
         7777  +			    { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
         7778  +echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
  7877   7779   			    ;;
  7878   7780   		    esac
  7879   7781   		else
  7880   7782   		    do64bit_ok=yes
  7881   7783   		    CFLAGS="$CFLAGS +DD64"
  7882         -		    LDFLAGS="$LDFLAGS +DD64"
         7784  +		    LDFLAGS_ARCH="+DD64"
  7883   7785   		fi
  7884   7786   	    fi
  7885   7787   	    ;;
  7886   7788   	HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  7887   7789   	    SHLIB_SUFFIX=".sl"
  7888   7790   	    echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
  7889   7791   echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6
................................................................................
  7958   7860   	    if test "$tcl_ok" = yes; then
  7959   7861   		SHLIB_CFLAGS="+z"
  7960   7862   		SHLIB_LD="ld -b"
  7961   7863   		SHLIB_LD_LIBS=""
  7962   7864   		DL_OBJS="tclLoadShl.o"
  7963   7865   		DL_LIBS="-ldld"
  7964   7866   		LDFLAGS="$LDFLAGS -Wl,-E"
  7965         -		LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
         7867  +		CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
         7868  +		LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
         7869  +		LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  7966   7870   	    fi
  7967         -	    LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  7968         -	    ;;
  7969         -	IRIX-4.*)
  7970         -	    SHLIB_CFLAGS="-G 0"
  7971         -	    SHLIB_SUFFIX=".a"
  7972         -	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  7973         -	    SHLIB_LD_LIBS='${LIBS}'
  7974         -	    DL_OBJS="tclLoadAout.o"
  7975         -	    DL_LIBS=""
  7976         -	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  7977         -	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  7978         -	    SHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
  7979   7871   	    ;;
  7980   7872   	IRIX-5.*)
  7981   7873   	    SHLIB_CFLAGS=""
  7982   7874   	    SHLIB_LD="ld -shared -rdata_shared"
  7983   7875   	    SHLIB_LD_LIBS='${LIBS}'
  7984   7876   	    SHLIB_SUFFIX=".so"
  7985   7877   	    DL_OBJS="tclLoadDl.o"
  7986   7878   	    DL_LIBS=""
  7987         -	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7879  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7880  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  7988   7881   	    ;;
  7989         -	IRIX-6.*|IRIX64-6.5*)
         7882  +	IRIX-6.*)
  7990   7883   	    SHLIB_CFLAGS=""
  7991   7884   	    SHLIB_LD="ld -n32 -shared -rdata_shared"
  7992   7885   	    SHLIB_LD_LIBS='${LIBS}'
  7993   7886   	    SHLIB_SUFFIX=".so"
  7994   7887   	    DL_OBJS="tclLoadDl.o"
  7995   7888   	    DL_LIBS=""
  7996         -	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7889  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7890  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  7997   7891   	    if test "$GCC" = "yes" ; then
  7998   7892   		CFLAGS="$CFLAGS -mabi=n32"
  7999   7893   		LDFLAGS="$LDFLAGS -mabi=n32"
  8000   7894   	    else
  8001   7895   		case $system in
  8002   7896   		    IRIX-6.3)
  8003   7897   			# Use to build 6.2 compatible binaries on 6.3.
................................................................................
  8013   7907   	IRIX64-6.*)
  8014   7908   	    SHLIB_CFLAGS=""
  8015   7909   	    SHLIB_LD="ld -n32 -shared -rdata_shared"
  8016   7910   	    SHLIB_LD_LIBS='${LIBS}'
  8017   7911   	    SHLIB_SUFFIX=".so"
  8018   7912   	    DL_OBJS="tclLoadDl.o"
  8019   7913   	    DL_LIBS=""
  8020         -	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7914  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7915  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  8021   7916   
  8022   7917   	    # Check to enable 64-bit flags for compiler/linker
  8023   7918   
  8024   7919   	    if test "$do64bit" = "yes" ; then
  8025   7920   	        if test "$GCC" = "yes" ; then
  8026   7921   	            { echo "$as_me:$LINENO: WARNING: 64bit mode not supported by gcc" >&5
  8027   7922   echo "$as_me: WARNING: 64bit mode not supported by gcc" >&2;}
  8028   7923   	        else
  8029   7924   	            do64bit_ok=yes
  8030   7925   	            SHLIB_LD="ld -64 -shared -rdata_shared"
  8031   7926   	            CFLAGS="$CFLAGS -64"
  8032         -	            LDFLAGS="$LDFLAGS -64"
         7927  +	            LDFLAGS_ARCH="-64"
  8033   7928   	        fi
  8034   7929   	    fi
  8035   7930   	    ;;
  8036   7931   	Linux*)
  8037   7932   	    SHLIB_CFLAGS="-fPIC"
  8038   7933   	    SHLIB_LD_LIBS='${LIBS}'
  8039   7934   	    SHLIB_SUFFIX=".so"
  8040   7935   
  8041   7936   	    CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
  8042   7937   	    # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings
  8043   7938   	    # when you inline the string and math operations.  Turn this off to
  8044   7939   	    # get rid of the warnings.
  8045         -
  8046   7940   	    #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
  8047   7941   
  8048         -	    if test "$have_dl" = yes; then
  8049         -		SHLIB_LD="${CC} -shared"
  8050         -		DL_OBJS="tclLoadDl.o"
  8051         -		DL_LIBS="-ldl"
  8052         -		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  8053         -		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  8054         -	    else
  8055         -		if test "${ac_cv_header_dld_h+set}" = set; then
  8056         -  echo "$as_me:$LINENO: checking for dld.h" >&5
  8057         -echo $ECHO_N "checking for dld.h... $ECHO_C" >&6
  8058         -if test "${ac_cv_header_dld_h+set}" = set; then
  8059         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  8060         -fi
  8061         -echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5
  8062         -echo "${ECHO_T}$ac_cv_header_dld_h" >&6
  8063         -else
  8064         -  # Is the header compilable?
  8065         -echo "$as_me:$LINENO: checking dld.h usability" >&5
  8066         -echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6
  8067         -cat >conftest.$ac_ext <<_ACEOF
  8068         -/* confdefs.h.  */
  8069         -_ACEOF
  8070         -cat confdefs.h >>conftest.$ac_ext
  8071         -cat >>conftest.$ac_ext <<_ACEOF
  8072         -/* end confdefs.h.  */
  8073         -$ac_includes_default
  8074         -#include <dld.h>
  8075         -_ACEOF
  8076         -rm -f conftest.$ac_objext
  8077         -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  8078         -  (eval $ac_compile) 2>conftest.er1
  8079         -  ac_status=$?
  8080         -  grep -v '^ *+' conftest.er1 >conftest.err
  8081         -  rm -f conftest.er1
  8082         -  cat conftest.err >&5
  8083         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8084         -  (exit $ac_status); } &&
  8085         -	 { ac_try='test -z "$ac_c_werror_flag"
  8086         -			 || test ! -s conftest.err'
  8087         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  8088         -  (eval $ac_try) 2>&5
  8089         -  ac_status=$?
  8090         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8091         -  (exit $ac_status); }; } &&
  8092         -	 { ac_try='test -s conftest.$ac_objext'
  8093         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  8094         -  (eval $ac_try) 2>&5
  8095         -  ac_status=$?
  8096         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8097         -  (exit $ac_status); }; }; then
  8098         -  ac_header_compiler=yes
  8099         -else
  8100         -  echo "$as_me: failed program was:" >&5
  8101         -sed 's/^/| /' conftest.$ac_ext >&5
  8102         -
  8103         -ac_header_compiler=no
  8104         -fi
  8105         -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  8106         -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  8107         -echo "${ECHO_T}$ac_header_compiler" >&6
  8108         -
  8109         -# Is the header present?
  8110         -echo "$as_me:$LINENO: checking dld.h presence" >&5
  8111         -echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6
  8112         -cat >conftest.$ac_ext <<_ACEOF
  8113         -/* confdefs.h.  */
  8114         -_ACEOF
  8115         -cat confdefs.h >>conftest.$ac_ext
  8116         -cat >>conftest.$ac_ext <<_ACEOF
  8117         -/* end confdefs.h.  */
  8118         -#include <dld.h>
  8119         -_ACEOF
  8120         -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  8121         -  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  8122         -  ac_status=$?
  8123         -  grep -v '^ *+' conftest.er1 >conftest.err
  8124         -  rm -f conftest.er1
  8125         -  cat conftest.err >&5
  8126         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8127         -  (exit $ac_status); } >/dev/null; then
  8128         -  if test -s conftest.err; then
  8129         -    ac_cpp_err=$ac_c_preproc_warn_flag
  8130         -    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  8131         -  else
  8132         -    ac_cpp_err=
  8133         -  fi
  8134         -else
  8135         -  ac_cpp_err=yes
  8136         -fi
  8137         -if test -z "$ac_cpp_err"; then
  8138         -  ac_header_preproc=yes
  8139         -else
  8140         -  echo "$as_me: failed program was:" >&5
  8141         -sed 's/^/| /' conftest.$ac_ext >&5
  8142         -
  8143         -  ac_header_preproc=no
  8144         -fi
  8145         -rm -f conftest.err conftest.$ac_ext
  8146         -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  8147         -echo "${ECHO_T}$ac_header_preproc" >&6
  8148         -
  8149         -# So?  What about this header?
  8150         -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
  8151         -  yes:no: )
  8152         -    { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5
  8153         -echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
  8154         -    { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the compiler's result" >&5
  8155         -echo "$as_me: WARNING: dld.h: proceeding with the compiler's result" >&2;}
  8156         -    ac_header_preproc=yes
  8157         -    ;;
  8158         -  no:yes:* )
  8159         -    { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5
  8160         -echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;}
  8161         -    { echo "$as_me:$LINENO: WARNING: dld.h:     check for missing prerequisite headers?" >&5
  8162         -echo "$as_me: WARNING: dld.h:     check for missing prerequisite headers?" >&2;}
  8163         -    { echo "$as_me:$LINENO: WARNING: dld.h: see the Autoconf documentation" >&5
  8164         -echo "$as_me: WARNING: dld.h: see the Autoconf documentation" >&2;}
  8165         -    { echo "$as_me:$LINENO: WARNING: dld.h:     section \"Present But Cannot Be Compiled\"" >&5
  8166         -echo "$as_me: WARNING: dld.h:     section \"Present But Cannot Be Compiled\"" >&2;}
  8167         -    { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5
  8168         -echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;}
  8169         -    { echo "$as_me:$LINENO: WARNING: dld.h: in the future, the compiler will take precedence" >&5
  8170         -echo "$as_me: WARNING: dld.h: in the future, the compiler will take precedence" >&2;}
  8171         -    (
  8172         -      cat <<\_ASBOX
  8173         -## ------------------------------ ##
  8174         -## Report this to the tls lists.  ##
  8175         -## ------------------------------ ##
  8176         -_ASBOX
  8177         -    ) |
  8178         -      sed "s/^/$as_me: WARNING:     /" >&2
  8179         -    ;;
  8180         -esac
  8181         -echo "$as_me:$LINENO: checking for dld.h" >&5
  8182         -echo $ECHO_N "checking for dld.h... $ECHO_C" >&6
  8183         -if test "${ac_cv_header_dld_h+set}" = set; then
  8184         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  8185         -else
  8186         -  ac_cv_header_dld_h=$ac_header_preproc
  8187         -fi
  8188         -echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5
  8189         -echo "${ECHO_T}$ac_cv_header_dld_h" >&6
  8190         -
  8191         -fi
  8192         -if test $ac_cv_header_dld_h = yes; then
  8193         -
  8194         -		    SHLIB_LD="ld -shared"
  8195         -		    DL_OBJS="tclLoadDld.o"
  8196         -		    DL_LIBS="-ldld"
  8197         -		    LD_SEARCH_FLAGS=""
  8198         -fi
  8199         -
  8200         -
  8201         -	    fi
         7942  +	    SHLIB_LD="${CC} -shared"
         7943  +	    DL_OBJS="tclLoadDl.o"
         7944  +	    DL_LIBS="-ldl"
         7945  +	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
         7946  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7947  +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  8202   7948   	    if test "`uname -m`" = "alpha" ; then
  8203   7949   		CFLAGS="$CFLAGS -mieee"
  8204   7950   	    fi
  8205   7951   
  8206   7952   	    # The combo of gcc + glibc has a bug related
  8207   7953   	    # to inlining of functions like strtod(). The
  8208   7954   	    # -fno-builtin flag should address this problem
................................................................................
  8216   7962   
  8217   7963   	    ;;
  8218   7964   	GNU*)
  8219   7965   	    SHLIB_CFLAGS="-fPIC"
  8220   7966   	    SHLIB_LD_LIBS='${LIBS}'
  8221   7967   	    SHLIB_SUFFIX=".so"
  8222   7968   
  8223         -	    if test "$have_dl" = yes; then
  8224         -		SHLIB_LD="${CC} -shared"
  8225         -		DL_OBJS=""
  8226         -		DL_LIBS="-ldl"
  8227         -		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  8228         -		LD_SEARCH_FLAGS=""
  8229         -	    else
  8230         -		if test "${ac_cv_header_dld_h+set}" = set; then
  8231         -  echo "$as_me:$LINENO: checking for dld.h" >&5
  8232         -echo $ECHO_N "checking for dld.h... $ECHO_C" >&6
  8233         -if test "${ac_cv_header_dld_h+set}" = set; then
  8234         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  8235         -fi
  8236         -echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5
  8237         -echo "${ECHO_T}$ac_cv_header_dld_h" >&6
  8238         -else
  8239         -  # Is the header compilable?
  8240         -echo "$as_me:$LINENO: checking dld.h usability" >&5
  8241         -echo $ECHO_N "checking dld.h usability... $ECHO_C" >&6
  8242         -cat >conftest.$ac_ext <<_ACEOF
  8243         -/* confdefs.h.  */
  8244         -_ACEOF
  8245         -cat confdefs.h >>conftest.$ac_ext
  8246         -cat >>conftest.$ac_ext <<_ACEOF
  8247         -/* end confdefs.h.  */
  8248         -$ac_includes_default
  8249         -#include <dld.h>
  8250         -_ACEOF
  8251         -rm -f conftest.$ac_objext
  8252         -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  8253         -  (eval $ac_compile) 2>conftest.er1
  8254         -  ac_status=$?
  8255         -  grep -v '^ *+' conftest.er1 >conftest.err
  8256         -  rm -f conftest.er1
  8257         -  cat conftest.err >&5
  8258         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8259         -  (exit $ac_status); } &&
  8260         -	 { ac_try='test -z "$ac_c_werror_flag"
  8261         -			 || test ! -s conftest.err'
  8262         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  8263         -  (eval $ac_try) 2>&5
  8264         -  ac_status=$?
  8265         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8266         -  (exit $ac_status); }; } &&
  8267         -	 { ac_try='test -s conftest.$ac_objext'
  8268         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  8269         -  (eval $ac_try) 2>&5
  8270         -  ac_status=$?
  8271         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8272         -  (exit $ac_status); }; }; then
  8273         -  ac_header_compiler=yes
  8274         -else
  8275         -  echo "$as_me: failed program was:" >&5
  8276         -sed 's/^/| /' conftest.$ac_ext >&5
  8277         -
  8278         -ac_header_compiler=no
  8279         -fi
  8280         -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  8281         -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  8282         -echo "${ECHO_T}$ac_header_compiler" >&6
  8283         -
  8284         -# Is the header present?
  8285         -echo "$as_me:$LINENO: checking dld.h presence" >&5
  8286         -echo $ECHO_N "checking dld.h presence... $ECHO_C" >&6
  8287         -cat >conftest.$ac_ext <<_ACEOF
  8288         -/* confdefs.h.  */
  8289         -_ACEOF
  8290         -cat confdefs.h >>conftest.$ac_ext
  8291         -cat >>conftest.$ac_ext <<_ACEOF
  8292         -/* end confdefs.h.  */
  8293         -#include <dld.h>
  8294         -_ACEOF
  8295         -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  8296         -  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  8297         -  ac_status=$?
  8298         -  grep -v '^ *+' conftest.er1 >conftest.err
  8299         -  rm -f conftest.er1
  8300         -  cat conftest.err >&5
  8301         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8302         -  (exit $ac_status); } >/dev/null; then
  8303         -  if test -s conftest.err; then
  8304         -    ac_cpp_err=$ac_c_preproc_warn_flag
  8305         -    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  8306         -  else
  8307         -    ac_cpp_err=
  8308         -  fi
  8309         -else
  8310         -  ac_cpp_err=yes
  8311         -fi
  8312         -if test -z "$ac_cpp_err"; then
  8313         -  ac_header_preproc=yes
  8314         -else
  8315         -  echo "$as_me: failed program was:" >&5
  8316         -sed 's/^/| /' conftest.$ac_ext >&5
  8317         -
  8318         -  ac_header_preproc=no
  8319         -fi
  8320         -rm -f conftest.err conftest.$ac_ext
  8321         -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  8322         -echo "${ECHO_T}$ac_header_preproc" >&6
  8323         -
  8324         -# So?  What about this header?
  8325         -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
  8326         -  yes:no: )
  8327         -    { echo "$as_me:$LINENO: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&5
  8328         -echo "$as_me: WARNING: dld.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
  8329         -    { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the compiler's result" >&5
  8330         -echo "$as_me: WARNING: dld.h: proceeding with the compiler's result" >&2;}
  8331         -    ac_header_preproc=yes
  8332         -    ;;
  8333         -  no:yes:* )
  8334         -    { echo "$as_me:$LINENO: WARNING: dld.h: present but cannot be compiled" >&5
  8335         -echo "$as_me: WARNING: dld.h: present but cannot be compiled" >&2;}
  8336         -    { echo "$as_me:$LINENO: WARNING: dld.h:     check for missing prerequisite headers?" >&5
  8337         -echo "$as_me: WARNING: dld.h:     check for missing prerequisite headers?" >&2;}
  8338         -    { echo "$as_me:$LINENO: WARNING: dld.h: see the Autoconf documentation" >&5
  8339         -echo "$as_me: WARNING: dld.h: see the Autoconf documentation" >&2;}
  8340         -    { echo "$as_me:$LINENO: WARNING: dld.h:     section \"Present But Cannot Be Compiled\"" >&5
  8341         -echo "$as_me: WARNING: dld.h:     section \"Present But Cannot Be Compiled\"" >&2;}
  8342         -    { echo "$as_me:$LINENO: WARNING: dld.h: proceeding with the preprocessor's result" >&5
  8343         -echo "$as_me: WARNING: dld.h: proceeding with the preprocessor's result" >&2;}
  8344         -    { echo "$as_me:$LINENO: WARNING: dld.h: in the future, the compiler will take precedence" >&5
  8345         -echo "$as_me: WARNING: dld.h: in the future, the compiler will take precedence" >&2;}
  8346         -    (
  8347         -      cat <<\_ASBOX
  8348         -## ------------------------------ ##
  8349         -## Report this to the tls lists.  ##
  8350         -## ------------------------------ ##
  8351         -_ASBOX
  8352         -    ) |
  8353         -      sed "s/^/$as_me: WARNING:     /" >&2
  8354         -    ;;
  8355         -esac
  8356         -echo "$as_me:$LINENO: checking for dld.h" >&5
  8357         -echo $ECHO_N "checking for dld.h... $ECHO_C" >&6
  8358         -if test "${ac_cv_header_dld_h+set}" = set; then
  8359         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  8360         -else
  8361         -  ac_cv_header_dld_h=$ac_header_preproc
  8362         -fi
  8363         -echo "$as_me:$LINENO: result: $ac_cv_header_dld_h" >&5
  8364         -echo "${ECHO_T}$ac_cv_header_dld_h" >&6
  8365         -
  8366         -fi
  8367         -if test $ac_cv_header_dld_h = yes; then
  8368         -
  8369         -		    SHLIB_LD="ld -shared"
  8370         -		    DL_OBJS=""
  8371         -		    DL_LIBS="-ldld"
  8372         -		    LD_SEARCH_FLAGS=""
  8373         -fi
  8374         -
  8375         -
  8376         -	    fi
         7969  +	    SHLIB_LD="${CC} -shared"
         7970  +	    DL_OBJS=""
         7971  +	    DL_LIBS="-ldl"
         7972  +	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
         7973  +	    CC_SEARCH_FLAGS=""
         7974  +	    LD_SEARCH_FLAGS=""
  8377   7975   	    if test "`uname -m`" = "alpha" ; then
  8378   7976   		CFLAGS="$CFLAGS -mieee"
  8379   7977   	    fi
  8380   7978   	    ;;
         7979  +	Lynx*)
         7980  +	    SHLIB_CFLAGS="-fPIC"
         7981  +	    SHLIB_LD_LIBS='${LIBS}'
         7982  +	    SHLIB_SUFFIX=".so"
         7983  +	    CFLAGS_OPTIMIZE=-02
         7984  +	    SHLIB_LD="${CC} -shared "
         7985  +	    DL_OBJS="tclLoadDl.o"
         7986  +	    DL_LIBS="-mshared -ldl"
         7987  +	    LD_FLAGS="-Wl,--export-dynamic"
         7988  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7989  +	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         7990  +	    ;;
  8381   7991   	MP-RAS-02*)
  8382   7992   	    SHLIB_CFLAGS="-K PIC"
  8383   7993   	    SHLIB_LD="cc -G"
  8384   7994   	    SHLIB_LD_LIBS=""
  8385   7995   	    SHLIB_SUFFIX=".so"
  8386   7996   	    DL_OBJS="tclLoadDl.o"
  8387   7997   	    DL_LIBS="-ldl"
         7998  +	    CC_SEARCH_FLAGS=""
  8388   7999   	    LD_SEARCH_FLAGS=""
  8389   8000   	    ;;
  8390   8001   	MP-RAS-*)
  8391   8002   	    SHLIB_CFLAGS="-K PIC"
  8392   8003   	    SHLIB_LD="cc -G"
  8393   8004   	    SHLIB_LD_LIBS=""
  8394   8005   	    SHLIB_SUFFIX=".so"
  8395   8006   	    DL_OBJS="tclLoadDl.o"
  8396   8007   	    DL_LIBS="-ldl"
  8397   8008   	    LDFLAGS="$LDFLAGS -Wl,-Bexport"
         8009  +	    CC_SEARCH_FLAGS=""
  8398   8010   	    LD_SEARCH_FLAGS=""
  8399   8011   	    ;;
  8400   8012   	NetBSD-*|FreeBSD-[1-2].*)
  8401         -	    # Not available on all versions:  check for include file.
  8402         -	    if test "${ac_cv_header_dlfcn_h+set}" = set; then
  8403         -  echo "$as_me:$LINENO: checking for dlfcn.h" >&5
  8404         -echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6
  8405         -if test "${ac_cv_header_dlfcn_h+set}" = set; then
  8406         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  8407         -fi
  8408         -echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5
  8409         -echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6
  8410         -else
  8411         -  # Is the header compilable?
  8412         -echo "$as_me:$LINENO: checking dlfcn.h usability" >&5
  8413         -echo $ECHO_N "checking dlfcn.h usability... $ECHO_C" >&6
  8414         -cat >conftest.$ac_ext <<_ACEOF
  8415         -/* confdefs.h.  */
  8416         -_ACEOF
  8417         -cat confdefs.h >>conftest.$ac_ext
  8418         -cat >>conftest.$ac_ext <<_ACEOF
  8419         -/* end confdefs.h.  */
  8420         -$ac_includes_default
  8421         -#include <dlfcn.h>
  8422         -_ACEOF
  8423         -rm -f conftest.$ac_objext
  8424         -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  8425         -  (eval $ac_compile) 2>conftest.er1
  8426         -  ac_status=$?
  8427         -  grep -v '^ *+' conftest.er1 >conftest.err
  8428         -  rm -f conftest.er1
  8429         -  cat conftest.err >&5
  8430         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8431         -  (exit $ac_status); } &&
  8432         -	 { ac_try='test -z "$ac_c_werror_flag"
  8433         -			 || test ! -s conftest.err'
  8434         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  8435         -  (eval $ac_try) 2>&5
  8436         -  ac_status=$?
  8437         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8438         -  (exit $ac_status); }; } &&
  8439         -	 { ac_try='test -s conftest.$ac_objext'
  8440         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  8441         -  (eval $ac_try) 2>&5
  8442         -  ac_status=$?
  8443         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8444         -  (exit $ac_status); }; }; then
  8445         -  ac_header_compiler=yes
  8446         -else
  8447         -  echo "$as_me: failed program was:" >&5
  8448         -sed 's/^/| /' conftest.$ac_ext >&5
  8449         -
  8450         -ac_header_compiler=no
  8451         -fi
  8452         -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  8453         -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
  8454         -echo "${ECHO_T}$ac_header_compiler" >&6
  8455         -
  8456         -# Is the header present?
  8457         -echo "$as_me:$LINENO: checking dlfcn.h presence" >&5
  8458         -echo $ECHO_N "checking dlfcn.h presence... $ECHO_C" >&6
  8459         -cat >conftest.$ac_ext <<_ACEOF
  8460         -/* confdefs.h.  */
  8461         -_ACEOF
  8462         -cat confdefs.h >>conftest.$ac_ext
  8463         -cat >>conftest.$ac_ext <<_ACEOF
  8464         -/* end confdefs.h.  */
  8465         -#include <dlfcn.h>
  8466         -_ACEOF
  8467         -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
  8468         -  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
  8469         -  ac_status=$?
  8470         -  grep -v '^ *+' conftest.er1 >conftest.err
  8471         -  rm -f conftest.er1
  8472         -  cat conftest.err >&5
  8473         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8474         -  (exit $ac_status); } >/dev/null; then
  8475         -  if test -s conftest.err; then
  8476         -    ac_cpp_err=$ac_c_preproc_warn_flag
  8477         -    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
  8478         -  else
  8479         -    ac_cpp_err=
  8480         -  fi
  8481         -else
  8482         -  ac_cpp_err=yes
  8483         -fi
  8484         -if test -z "$ac_cpp_err"; then
  8485         -  ac_header_preproc=yes
  8486         -else
  8487         -  echo "$as_me: failed program was:" >&5
  8488         -sed 's/^/| /' conftest.$ac_ext >&5
  8489         -
  8490         -  ac_header_preproc=no
  8491         -fi
  8492         -rm -f conftest.err conftest.$ac_ext
  8493         -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
  8494         -echo "${ECHO_T}$ac_header_preproc" >&6
  8495         -
  8496         -# So?  What about this header?
  8497         -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
  8498         -  yes:no: )
  8499         -    { echo "$as_me:$LINENO: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&5
  8500         -echo "$as_me: WARNING: dlfcn.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
  8501         -    { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the compiler's result" >&5
  8502         -echo "$as_me: WARNING: dlfcn.h: proceeding with the compiler's result" >&2;}
  8503         -    ac_header_preproc=yes
  8504         -    ;;
  8505         -  no:yes:* )
  8506         -    { echo "$as_me:$LINENO: WARNING: dlfcn.h: present but cannot be compiled" >&5
  8507         -echo "$as_me: WARNING: dlfcn.h: present but cannot be compiled" >&2;}
  8508         -    { echo "$as_me:$LINENO: WARNING: dlfcn.h:     check for missing prerequisite headers?" >&5
  8509         -echo "$as_me: WARNING: dlfcn.h:     check for missing prerequisite headers?" >&2;}
  8510         -    { echo "$as_me:$LINENO: WARNING: dlfcn.h: see the Autoconf documentation" >&5
  8511         -echo "$as_me: WARNING: dlfcn.h: see the Autoconf documentation" >&2;}
  8512         -    { echo "$as_me:$LINENO: WARNING: dlfcn.h:     section \"Present But Cannot Be Compiled\"" >&5
  8513         -echo "$as_me: WARNING: dlfcn.h:     section \"Present But Cannot Be Compiled\"" >&2;}
  8514         -    { echo "$as_me:$LINENO: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&5
  8515         -echo "$as_me: WARNING: dlfcn.h: proceeding with the preprocessor's result" >&2;}
  8516         -    { echo "$as_me:$LINENO: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&5
  8517         -echo "$as_me: WARNING: dlfcn.h: in the future, the compiler will take precedence" >&2;}
  8518         -    (
  8519         -      cat <<\_ASBOX
  8520         -## ------------------------------ ##
  8521         -## Report this to the tls lists.  ##
  8522         -## ------------------------------ ##
  8523         -_ASBOX
  8524         -    ) |
  8525         -      sed "s/^/$as_me: WARNING:     /" >&2
  8526         -    ;;
  8527         -esac
  8528         -echo "$as_me:$LINENO: checking for dlfcn.h" >&5
  8529         -echo $ECHO_N "checking for dlfcn.h... $ECHO_C" >&6
  8530         -if test "${ac_cv_header_dlfcn_h+set}" = set; then
  8531         -  echo $ECHO_N "(cached) $ECHO_C" >&6
  8532         -else
  8533         -  ac_cv_header_dlfcn_h=$ac_header_preproc
  8534         -fi
  8535         -echo "$as_me:$LINENO: result: $ac_cv_header_dlfcn_h" >&5
  8536         -echo "${ECHO_T}$ac_cv_header_dlfcn_h" >&6
  8537         -
  8538         -fi
  8539         -if test $ac_cv_header_dlfcn_h = yes; then
  8540         -
  8541         -		# NetBSD/SPARC needs -fPIC, -fpic will not do.
  8542         -		SHLIB_CFLAGS="-fPIC"
  8543         -		SHLIB_LD="ld -Bshareable -x"
  8544         -		SHLIB_LD_LIBS=""
  8545         -		SHLIB_SUFFIX=".so"
  8546         -		DL_OBJS="tclLoadDl.o"
  8547         -		DL_LIBS=""
  8548         -		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  8549         -		echo "$as_me:$LINENO: checking for ELF" >&5
         8013  +	    # NetBSD/SPARC needs -fPIC, -fpic will not do.
         8014  +	    SHLIB_CFLAGS="-fPIC"
         8015  +	    SHLIB_LD="ld -Bshareable -x"
         8016  +	    SHLIB_LD_LIBS='${LIBS}'
         8017  +	    SHLIB_SUFFIX=".so"
         8018  +	    DL_OBJS="tclLoadDl.o"
         8019  +	    DL_LIBS=""
         8020  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         8021  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
         8022  +	    echo "$as_me:$LINENO: checking for ELF" >&5
         8023  +echo $ECHO_N "checking for ELF... $ECHO_C" >&6
         8024  +if test "${tcl_cv_ld_elf+set}" = set; then
         8025  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         8026  +else
         8027  +
         8028  +		cat >conftest.$ac_ext <<_ACEOF
         8029  +/* confdefs.h.  */
         8030  +_ACEOF
         8031  +cat confdefs.h >>conftest.$ac_ext
         8032  +cat >>conftest.$ac_ext <<_ACEOF
         8033  +/* end confdefs.h.  */
         8034  +
         8035  +#ifdef __ELF__
         8036  +	yes
         8037  +#endif
         8038  +
         8039  +_ACEOF
         8040  +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
         8041  +  $EGREP "yes" >/dev/null 2>&1; then
         8042  +  tcl_cv_ld_elf=yes
         8043  +else
         8044  +  tcl_cv_ld_elf=no
         8045  +fi
         8046  +rm -f conftest*
         8047  +
         8048  +fi
         8049  +echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
         8050  +echo "${ECHO_T}$tcl_cv_ld_elf" >&6
         8051  +	    if test $tcl_cv_ld_elf = yes; then
         8052  +		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
         8053  +	    else
         8054  +		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
         8055  +	    fi
         8056  +
         8057  +	    # Ancient FreeBSD doesn't handle version numbers with dots.
         8058  +
         8059  +	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
         8060  +	    TCL_LIB_VERSIONS_OK=nodots
         8061  +	    ;;
         8062  +	OpenBSD-*)
         8063  +	    # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
         8064  +	    case `machine` in
         8065  +	    sparc|sparc64)
         8066  +		SHLIB_CFLAGS="-fPIC";;
         8067  +	    *)
         8068  +		SHLIB_CFLAGS="-fpic";;
         8069  +	    esac
         8070  +	    SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
         8071  +	    SHLIB_LD_LIBS='${LIBS}'
         8072  +	    SHLIB_SUFFIX=".so"
         8073  +	    DL_OBJS="tclLoadDl.o"
         8074  +	    DL_LIBS=""
         8075  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         8076  +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
         8077  +	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
         8078  +	    echo "$as_me:$LINENO: checking for ELF" >&5
  8550   8079   echo $ECHO_N "checking for ELF... $ECHO_C" >&6
         8080  +if test "${tcl_cv_ld_elf+set}" = set; then
         8081  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         8082  +else
         8083  +
  8551   8084   		cat >conftest.$ac_ext <<_ACEOF
  8552   8085   /* confdefs.h.  */
  8553   8086   _ACEOF
  8554   8087   cat confdefs.h >>conftest.$ac_ext
  8555   8088   cat >>conftest.$ac_ext <<_ACEOF
  8556   8089   /* end confdefs.h.  */
  8557   8090   
................................................................................
  8558   8091   #ifdef __ELF__
  8559   8092   	yes
  8560   8093   #endif
  8561   8094   
  8562   8095   _ACEOF
  8563   8096   if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  8564   8097     $EGREP "yes" >/dev/null 2>&1; then
  8565         -  echo "$as_me:$LINENO: result: yes" >&5
  8566         -echo "${ECHO_T}yes" >&6
  8567         -		    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
         8098  +  tcl_cv_ld_elf=yes
  8568   8099   else
  8569         -  echo "$as_me:$LINENO: result: no" >&5
  8570         -echo "${ECHO_T}no" >&6
  8571         -		    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
  8572         -
         8100  +  tcl_cv_ld_elf=no
  8573   8101   fi
  8574   8102   rm -f conftest*
  8575   8103   
  8576         -
  8577         -else
  8578         -
  8579         -		SHLIB_CFLAGS=""
  8580         -		SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
  8581         -		SHLIB_LD_LIBS='${LIBS}'
  8582         -		SHLIB_SUFFIX=".a"
  8583         -		DL_OBJS="tclLoadAout.o"
  8584         -		DL_LIBS=""
  8585         -		LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  8586         -		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  8587         -
  8588         -fi
  8589         -
  8590         -
  8591         -
  8592         -	    # FreeBSD doesn't handle version numbers with dots.
  8593         -
  8594         -	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  8595         -	    TCL_LIB_VERSIONS_OK=nodots
  8596         -	    ;;
  8597         -	OpenBSD-*)
  8598         -	    SHLIB_LD="${CC} -shared"
  8599         -	    SHLIB_LD_LIBS='${LIBS}'
  8600         -	    SHLIB_SUFFIX=".so"
  8601         -	    DL_OBJS="tclLoadDl.o"
  8602         -	    DL_LIBS=""
  8603         -	    LD_SEARCH_FLAGS=""
  8604         -	    echo "$as_me:$LINENO: checking for ELF" >&5
  8605         -echo $ECHO_N "checking for ELF... $ECHO_C" >&6
  8606         -	    cat >conftest.$ac_ext <<_ACEOF
  8607         -/* confdefs.h.  */
  8608         -_ACEOF
  8609         -cat confdefs.h >>conftest.$ac_ext
  8610         -cat >>conftest.$ac_ext <<_ACEOF
  8611         -/* end confdefs.h.  */
  8612         -
  8613         -#ifdef __ELF__
  8614         -	yes
  8615         -#endif
  8616         -
  8617         -_ACEOF
  8618         -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
  8619         -  $EGREP "yes" >/dev/null 2>&1; then
  8620         -  echo "$as_me:$LINENO: result: yes" >&5
  8621         -echo "${ECHO_T}yes" >&6
  8622         -		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
  8623         -else
  8624         -  echo "$as_me:$LINENO: result: no" >&5
  8625         -echo "${ECHO_T}no" >&6
  8626         -		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
  8627         -
  8628         -fi
  8629         -rm -f conftest*
  8630         -
         8104  +fi
         8105  +echo "$as_me:$LINENO: result: $tcl_cv_ld_elf" >&5
         8106  +echo "${ECHO_T}$tcl_cv_ld_elf" >&6
         8107  +	    if test $tcl_cv_ld_elf = yes; then
         8108  +		LDFLAGS=-Wl,-export-dynamic
         8109  +	    else
         8110  +		LDFLAGS=""
         8111  +	    fi
  8631   8112   
  8632   8113   	    # OpenBSD doesn't do version numbers with dots.
  8633   8114   	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  8634   8115   	    TCL_LIB_VERSIONS_OK=nodots
  8635   8116   	    ;;
  8636   8117   	FreeBSD-*)
  8637   8118   	    # FreeBSD 3.* and greater have ELF.
................................................................................
  8638   8119   	    SHLIB_CFLAGS="-fPIC"
  8639   8120   	    SHLIB_LD="ld -Bshareable -x"
  8640   8121   	    SHLIB_LD_LIBS='${LIBS}'
  8641   8122   	    SHLIB_SUFFIX=".so"
  8642   8123   	    DL_OBJS="tclLoadDl.o"
  8643   8124   	    DL_LIBS=""
  8644   8125   	    LDFLAGS="$LDFLAGS -export-dynamic"
  8645         -	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         8126  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         8127  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  8646   8128   	    if test "${TCL_THREADS}" = "1" ; then
  8647   8129   		# The -pthread needs to go in the CFLAGS, not LIBS
  8648   8130   		LIBS=`echo $LIBS | sed s/-pthread//`
  8649   8131   		CFLAGS="$CFLAGS -pthread"
  8650   8132   	    	LDFLAGS="$LDFLAGS -pthread"
  8651   8133   	    fi
  8652   8134   	    case $system in
................................................................................
  8655   8137   	    	UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  8656   8138   	    	SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
  8657   8139   	    	TCL_LIB_VERSIONS_OK=nodots
  8658   8140   		;;
  8659   8141   	    esac
  8660   8142   	    ;;
  8661   8143   	Darwin-*)
         8144  +	    CFLAGS_OPTIMIZE="-Os"
  8662   8145   	    SHLIB_CFLAGS="-fno-common"
  8663         -	    SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
         8146  +	    if test $do64bit = yes; then
         8147  +	        do64bit_ok=yes
         8148  +	        CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
         8149  +	    fi
         8150  +	    # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS here:
         8151  +	    SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
         8152  +	    echo "$as_me:$LINENO: checking if ld accepts -single_module flag" >&5
         8153  +echo $ECHO_N "checking if ld accepts -single_module flag... $ECHO_C" >&6
         8154  +if test "${tcl_cv_ld_single_module+set}" = set; then
         8155  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         8156  +else
         8157  +
         8158  +	        hold_ldflags=$LDFLAGS
         8159  +	        LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
         8160  +	        cat >conftest.$ac_ext <<_ACEOF
         8161  +/* confdefs.h.  */
         8162  +_ACEOF
         8163  +cat confdefs.h >>conftest.$ac_ext
         8164  +cat >>conftest.$ac_ext <<_ACEOF
         8165  +/* end confdefs.h.  */
         8166  +
         8167  +int
         8168  +main ()
         8169  +{
         8170  +int i;
         8171  +  ;
         8172  +  return 0;
         8173  +}
         8174  +_ACEOF
         8175  +rm -f conftest.$ac_objext conftest$ac_exeext
         8176  +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
         8177  +  (eval $ac_link) 2>conftest.er1
         8178  +  ac_status=$?
         8179  +  grep -v '^ *+' conftest.er1 >conftest.err
         8180  +  rm -f conftest.er1
         8181  +  cat conftest.err >&5
         8182  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8183  +  (exit $ac_status); } &&
         8184  +	 { ac_try='test -z "$ac_c_werror_flag"
         8185  +			 || test ! -s conftest.err'
         8186  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         8187  +  (eval $ac_try) 2>&5
         8188  +  ac_status=$?
         8189  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8190  +  (exit $ac_status); }; } &&
         8191  +	 { ac_try='test -s conftest$ac_exeext'
         8192  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         8193  +  (eval $ac_try) 2>&5
         8194  +  ac_status=$?
         8195  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8196  +  (exit $ac_status); }; }; then
         8197  +  tcl_cv_ld_single_module=yes
         8198  +else
         8199  +  echo "$as_me: failed program was:" >&5
         8200  +sed 's/^/| /' conftest.$ac_ext >&5
         8201  +
         8202  +tcl_cv_ld_single_module=no
         8203  +fi
         8204  +rm -f conftest.err conftest.$ac_objext \
         8205  +      conftest$ac_exeext conftest.$ac_ext
         8206  +	        LDFLAGS=$hold_ldflags
         8207  +fi
         8208  +echo "$as_me:$LINENO: result: $tcl_cv_ld_single_module" >&5
         8209  +echo "${ECHO_T}$tcl_cv_ld_single_module" >&6
         8210  +	    if test $tcl_cv_ld_single_module = yes; then
         8211  +	        SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
         8212  +	    fi
  8664   8213   	    SHLIB_LD_LIBS='${LIBS}'
  8665   8214   	    SHLIB_SUFFIX=".dylib"
  8666   8215   	    DL_OBJS="tclLoadDyld.o"
  8667   8216   	    DL_LIBS=""
  8668         -	    LDFLAGS="$LDFLAGS -prebind -Wl,-search_paths_first"
         8217  +	    # Don't use -prebind when building for Mac OS X 10.4 or later only:
         8218  +	    test -z "${MACOSX_DEPLOYMENT_TARGET}" || \
         8219  +		test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F. '{print $2}'`" -lt 4 && \
         8220  +		LDFLAGS="$LDFLAGS -prebind"
         8221  +	    LDFLAGS="$LDFLAGS -headerpad_max_install_names"
         8222  +	    echo "$as_me:$LINENO: checking if ld accepts -search_paths_first flag" >&5
         8223  +echo $ECHO_N "checking if ld accepts -search_paths_first flag... $ECHO_C" >&6
         8224  +if test "${tcl_cv_ld_search_paths_first+set}" = set; then
         8225  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         8226  +else
         8227  +
         8228  +	        hold_ldflags=$LDFLAGS
         8229  +	        LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
         8230  +	        cat >conftest.$ac_ext <<_ACEOF
         8231  +/* confdefs.h.  */
         8232  +_ACEOF
         8233  +cat confdefs.h >>conftest.$ac_ext
         8234  +cat >>conftest.$ac_ext <<_ACEOF
         8235  +/* end confdefs.h.  */
         8236  +
         8237  +int
         8238  +main ()
         8239  +{
         8240  +int i;
         8241  +  ;
         8242  +  return 0;
         8243  +}
         8244  +_ACEOF
         8245  +rm -f conftest.$ac_objext conftest$ac_exeext
         8246  +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
         8247  +  (eval $ac_link) 2>conftest.er1
         8248  +  ac_status=$?
         8249  +  grep -v '^ *+' conftest.er1 >conftest.err
         8250  +  rm -f conftest.er1
         8251  +  cat conftest.err >&5
         8252  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8253  +  (exit $ac_status); } &&
         8254  +	 { ac_try='test -z "$ac_c_werror_flag"
         8255  +			 || test ! -s conftest.err'
         8256  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         8257  +  (eval $ac_try) 2>&5
         8258  +  ac_status=$?
         8259  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8260  +  (exit $ac_status); }; } &&
         8261  +	 { ac_try='test -s conftest$ac_exeext'
         8262  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         8263  +  (eval $ac_try) 2>&5
         8264  +  ac_status=$?
         8265  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8266  +  (exit $ac_status); }; }; then
         8267  +  tcl_cv_ld_search_paths_first=yes
         8268  +else
         8269  +  echo "$as_me: failed program was:" >&5
         8270  +sed 's/^/| /' conftest.$ac_ext >&5
         8271  +
         8272  +tcl_cv_ld_search_paths_first=no
         8273  +fi
         8274  +rm -f conftest.err conftest.$ac_objext \
         8275  +      conftest$ac_exeext conftest.$ac_ext
         8276  +	        LDFLAGS=$hold_ldflags
         8277  +fi
         8278  +echo "$as_me:$LINENO: result: $tcl_cv_ld_search_paths_first" >&5
         8279  +echo "${ECHO_T}$tcl_cv_ld_search_paths_first" >&6
         8280  +	    if test $tcl_cv_ld_search_paths_first = yes; then
         8281  +	        LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
         8282  +	    fi
         8283  +	    CC_SEARCH_FLAGS=""
  8669   8284   	    LD_SEARCH_FLAGS=""
  8670   8285   	    LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
  8671         -	    CFLAGS_OPTIMIZE="-Os"
         8286  +
         8287  +	    # TEA specific: for Tk extensions, remove -arch ppc64 from CFLAGS
         8288  +	    # for fat builds, as neither TkAqua nor TkX11 can be built for 64bit
         8289  +	    # at present (no 64bit GUI libraries).
         8290  +	    test $do64bit_ok = no && test -n "${TK_BIN_DIR}" && \
         8291  +	        CFLAGS="`echo "$CFLAGS" | sed -e 's/-arch ppc64/-arch ppc/g'`"
  8672   8292   	    ;;
  8673   8293   	NEXTSTEP-*)
  8674   8294   	    SHLIB_CFLAGS=""
  8675   8295   	    SHLIB_LD="cc -nostdlib -r"
  8676   8296   	    SHLIB_LD_LIBS=""
  8677   8297   	    SHLIB_SUFFIX=".so"
  8678   8298   	    DL_OBJS="tclLoadNext.o"
  8679   8299   	    DL_LIBS=""
         8300  +	    CC_SEARCH_FLAGS=""
  8680   8301   	    LD_SEARCH_FLAGS=""
  8681   8302   	    ;;
  8682   8303   	OS/390-*)
  8683         -	    CFLAGS_OPTIMIZE=""      # Optimizer is buggy
  8684         -	    cat >>confdefs.h <<\_ACEOF
         8304  +	    CFLAGS_OPTIMIZE=""		# Optimizer is buggy
         8305  +
         8306  +cat >>confdefs.h <<\_ACEOF
  8685   8307   #define _OE_SOCKETS 1
  8686   8308   _ACEOF
  8687         -  # needed in sys/socket.h
         8309  +
  8688   8310   	    ;;
  8689   8311   	OSF1-1.0|OSF1-1.1|OSF1-1.2)
  8690   8312   	    # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
  8691   8313   	    SHLIB_CFLAGS=""
  8692   8314   	    # Hack: make package name same as library name
  8693   8315   	    SHLIB_LD='ld -R -export :'
  8694   8316   	    SHLIB_LD_LIBS=""
  8695   8317   	    SHLIB_SUFFIX=".so"
  8696   8318   	    DL_OBJS="tclLoadOSF.o"
  8697   8319   	    DL_LIBS=""
         8320  +	    CC_SEARCH_FLAGS=""
  8698   8321   	    LD_SEARCH_FLAGS=""
  8699   8322   	    ;;
  8700   8323   	OSF1-1.*)
  8701   8324   	    # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
  8702   8325   	    SHLIB_CFLAGS="-fPIC"
  8703   8326   	    if test "$SHARED_BUILD" = "1" ; then
  8704   8327   	        SHLIB_LD="ld -shared"
................................................................................
  8705   8328   	    else
  8706   8329   	        SHLIB_LD="ld -non_shared"
  8707   8330   	    fi
  8708   8331   	    SHLIB_LD_LIBS=""
  8709   8332   	    SHLIB_SUFFIX=".so"
  8710   8333   	    DL_OBJS="tclLoadDl.o"
  8711   8334   	    DL_LIBS=""
         8335  +	    CC_SEARCH_FLAGS=""
  8712   8336   	    LD_SEARCH_FLAGS=""
  8713   8337   	    ;;
  8714   8338   	OSF1-V*)
  8715   8339   	    # Digital OSF/1
  8716   8340   	    SHLIB_CFLAGS=""
  8717   8341   	    if test "$SHARED_BUILD" = "1" ; then
  8718   8342   	        SHLIB_LD='ld -shared -expect_unresolved "*"'
................................................................................
  8719   8343   	    else
  8720   8344   	        SHLIB_LD='ld -non_shared -expect_unresolved "*"'
  8721   8345   	    fi
  8722   8346   	    SHLIB_LD_LIBS=""
  8723   8347   	    SHLIB_SUFFIX=".so"
  8724   8348   	    DL_OBJS="tclLoadDl.o"
  8725   8349   	    DL_LIBS=""
         8350  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  8726   8351   	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  8727   8352   	    if test "$GCC" = "yes" ; then
  8728   8353   		CFLAGS="$CFLAGS -mieee"
  8729   8354               else
  8730   8355   		CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
  8731   8356   	    fi
  8732   8357   	    # see pthread_intro(3) for pthread support on osf1, k.furukawa
................................................................................
  8749   8374   	    SHLIB_CFLAGS="-fPIC"
  8750   8375   	    SHLIB_LD="ld -Bshareable -x"
  8751   8376   	    SHLIB_LD_LIBS=""
  8752   8377   	    SHLIB_SUFFIX=".so"
  8753   8378   	    DL_OBJS="tclLoadDl.o"
  8754   8379   	    # dlopen is in -lc on QNX
  8755   8380   	    DL_LIBS=""
         8381  +	    CC_SEARCH_FLAGS=""
  8756   8382   	    LD_SEARCH_FLAGS=""
  8757   8383   	    ;;
  8758         -	RISCos-*)
  8759         -	    SHLIB_CFLAGS="-G 0"
  8760         -	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  8761         -	    SHLIB_LD_LIBS='${LIBS}'
  8762         -	    SHLIB_SUFFIX=".a"
  8763         -	    DL_OBJS="tclLoadAout.o"
  8764         -	    DL_LIBS=""
  8765         -	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  8766         -	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  8767         -	    ;;
  8768   8384   	SCO_SV-3.2*)
  8769   8385   	    # Note, dlopen is available only on SCO 3.2.5 and greater. However,
  8770   8386   	    # this test works, since "uname -s" was non-standard in 3.2.4 and
  8771   8387   	    # below.
  8772   8388   	    if test "$GCC" = "yes" ; then
  8773   8389   	    	SHLIB_CFLAGS="-fPIC -melf"
  8774   8390   	    	LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
................................................................................
  8777   8393   	    	LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
  8778   8394   	    fi
  8779   8395   	    SHLIB_LD="ld -G"
  8780   8396   	    SHLIB_LD_LIBS=""
  8781   8397   	    SHLIB_SUFFIX=".so"
  8782   8398   	    DL_OBJS="tclLoadDl.o"
  8783   8399   	    DL_LIBS=""
         8400  +	    CC_SEARCH_FLAGS=""
  8784   8401   	    LD_SEARCH_FLAGS=""
  8785   8402   	    ;;
  8786   8403   	SINIX*5.4*)
  8787   8404   	    SHLIB_CFLAGS="-K PIC"
  8788   8405   	    SHLIB_LD="cc -G"
  8789   8406   	    SHLIB_LD_LIBS=""
  8790   8407   	    SHLIB_SUFFIX=".so"
  8791   8408   	    DL_OBJS="tclLoadDl.o"
  8792   8409   	    DL_LIBS="-ldl"
         8410  +	    CC_SEARCH_FLAGS=""
  8793   8411   	    LD_SEARCH_FLAGS=""
  8794   8412   	    ;;
  8795   8413   	SunOS-4*)
  8796   8414   	    SHLIB_CFLAGS="-PIC"
  8797   8415   	    SHLIB_LD="ld"
  8798   8416   	    SHLIB_LD_LIBS=""
  8799   8417   	    SHLIB_SUFFIX=".so"
  8800   8418   	    DL_OBJS="tclLoadDl.o"
  8801   8419   	    DL_LIBS="-ldl"
  8802         -	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
         8420  +	    CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
         8421  +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  8803   8422   
  8804   8423   	    # SunOS can't handle version numbers with dots in them in library
  8805   8424   	    # specs, like -ltcl7.5, so use -ltcl75 instead.  Also, it
  8806   8425   	    # requires an extra version number at the end of .so file names.
  8807   8426   	    # So, the library has to have a name like libtcl75.so.1.0
  8808   8427   
  8809   8428   	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
  8810   8429   	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  8811   8430   	    TCL_LIB_VERSIONS_OK=nodots
  8812   8431   	    ;;
  8813         -	SunOS-5.[0-6]*)
         8432  +	SunOS-5.[0-6])
         8433  +	    # Careful to not let 5.10+ fall into this case
  8814   8434   
  8815   8435   	    # Note: If _REENTRANT isn't defined, then Solaris
  8816   8436   	    # won't define thread-safe library routines.
  8817   8437   
  8818         -	    cat >>confdefs.h <<\_ACEOF
         8438  +
         8439  +cat >>confdefs.h <<\_ACEOF
  8819   8440   #define _REENTRANT 1
  8820   8441   _ACEOF
  8821   8442   
  8822         -	    cat >>confdefs.h <<\_ACEOF
         8443  +
         8444  +cat >>confdefs.h <<\_ACEOF
  8823   8445   #define _POSIX_PTHREAD_SEMANTICS 1
  8824   8446   _ACEOF
  8825   8447   
  8826   8448   
  8827   8449   	    SHLIB_CFLAGS="-KPIC"
  8828   8450   
  8829   8451   	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
................................................................................
  8831   8453   
  8832   8454   	    SHLIB_LD_LIBS='${LIBS}'
  8833   8455   	    SHLIB_SUFFIX=".so"
  8834   8456   	    DL_OBJS="tclLoadDl.o"
  8835   8457   	    DL_LIBS="-ldl"
  8836   8458   	    if test "$GCC" = "yes" ; then
  8837   8459   		SHLIB_LD="$CC -shared"
  8838         -		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
         8460  +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
         8461  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  8839   8462   	    else
  8840   8463   		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  8841         -		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
         8464  +		CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
         8465  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  8842   8466   	    fi
  8843   8467   	    ;;
  8844   8468   	SunOS-5*)
  8845         -
  8846   8469   	    # Note: If _REENTRANT isn't defined, then Solaris
  8847   8470   	    # won't define thread-safe library routines.
  8848   8471   
  8849         -	    cat >>confdefs.h <<\_ACEOF
         8472  +
         8473  +cat >>confdefs.h <<\_ACEOF
  8850   8474   #define _REENTRANT 1
  8851   8475   _ACEOF
  8852   8476   
  8853         -	    cat >>confdefs.h <<\_ACEOF
         8477  +
         8478  +cat >>confdefs.h <<\_ACEOF
  8854   8479   #define _POSIX_PTHREAD_SEMANTICS 1
  8855   8480   _ACEOF
  8856   8481   
  8857   8482   
  8858   8483   	    SHLIB_CFLAGS="-KPIC"
  8859   8484   
  8860   8485   	    # Check to enable 64-bit flags for compiler/linker
  8861   8486   	    if test "$do64bit" = "yes" ; then
  8862   8487   		arch=`isainfo`
  8863   8488   		if test "$arch" = "sparcv9 sparc" ; then
  8864   8489   			if test "$GCC" = "yes" ; then
  8865         -			    if test "`gcc -dumpversion` | awk -F. '{print }'" -lt "3" ; then
         8490  +			    if test "`gcc -dumpversion | awk -F. '{print $1}'`" -lt "3" ; then
  8866   8491   				{ echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5
  8867   8492   echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;}
  8868   8493   			    else
  8869   8494   				do64bit_ok=yes
  8870   8495   				CFLAGS="$CFLAGS -m64 -mcpu=v9"
  8871   8496   				LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
  8872   8497   				SHLIB_CFLAGS="-fPIC"
  8873   8498   			    fi
  8874   8499   			else
  8875   8500   			    do64bit_ok=yes
  8876   8501   			    if test "$do64bitVIS" = "yes" ; then
  8877   8502   				CFLAGS="$CFLAGS -xarch=v9a"
  8878         -			    	LDFLAGS="$LDFLAGS -xarch=v9a"
         8503  +			    	LDFLAGS_ARCH="-xarch=v9a"
  8879   8504   			    else
  8880   8505   				CFLAGS="$CFLAGS -xarch=v9"
  8881         -			    	LDFLAGS="$LDFLAGS -xarch=v9"
         8506  +			    	LDFLAGS_ARCH="-xarch=v9"
  8882   8507   			    fi
         8508  +			    # Solaris 64 uses this as well
         8509  +			    #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
  8883   8510   			fi
         8511  +		elif test "$arch" = "amd64 i386" ; then
         8512  +		    if test "$GCC" = "yes" ; then
         8513  +			{ echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC on $system" >&5
         8514  +echo "$as_me: WARNING: 64bit mode not supported with GCC on $system" >&2;}
         8515  +		    else
         8516  +			do64bit_ok=yes
         8517  +			CFLAGS="$CFLAGS -xarch=amd64"
         8518  +			LDFLAGS="$LDFLAGS -xarch=amd64"
         8519  +		    fi
  8884   8520   		else
  8885         -		    { echo "$as_me:$LINENO: WARNING: \"64bit mode only supported sparcv9 system\"" >&5
  8886         -echo "$as_me: WARNING: \"64bit mode only supported sparcv9 system\"" >&2;}
         8521  +		    { echo "$as_me:$LINENO: WARNING: 64bit mode not supported for $arch" >&5
         8522  +echo "$as_me: WARNING: 64bit mode not supported for $arch" >&2;}
  8887   8523   		fi
  8888   8524   	    fi
  8889   8525   
  8890   8526   	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
  8891   8527   	    # symbols when dynamically loaded into tclsh.
  8892   8528   
  8893   8529   	    SHLIB_LD_LIBS='${LIBS}'
  8894   8530   	    SHLIB_SUFFIX=".so"
  8895   8531   	    DL_OBJS="tclLoadDl.o"
  8896   8532   	    DL_LIBS="-ldl"
  8897   8533   	    if test "$GCC" = "yes" ; then
  8898   8534   		SHLIB_LD="$CC -shared"
  8899         -		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  8900         -		if test "$do64bit" = "yes" ; then
         8535  +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
         8536  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
         8537  +		if test "$do64bit_ok" = "yes" ; then
  8901   8538   		    # We need to specify -static-libgcc or we need to
  8902   8539   		    # add the path to the sparv9 libgcc.
  8903   8540   		    # JH: static-libgcc is necessary for core Tcl, but may
  8904   8541   		    # not be necessary for extensions.
  8905   8542   		    SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
  8906   8543   		    # for finding sparcv9 libgcc, get the regular libgcc
  8907   8544   		    # path, remove so name and append 'sparcv9'
  8908   8545   		    #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
  8909         -		    #LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS},-R,$v9gcclibdir"
         8546  +		    #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
  8910   8547   		fi
  8911   8548   	    else
  8912   8549   		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
         8550  +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  8913   8551   		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  8914   8552   	    fi
  8915         -	    ;;
  8916         -	ULTRIX-4.*)
  8917         -	    SHLIB_CFLAGS="-G 0"
  8918         -	    SHLIB_SUFFIX=".a"
  8919         -	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  8920         -	    SHLIB_LD_LIBS='${LIBS}'
  8921         -	    DL_OBJS="tclLoadAout.o"
  8922         -	    DL_LIBS=""
  8923         -	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  8924         -	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  8925         -	    if test "$GCC" != "yes" ; then
  8926         -		CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
  8927         -	    fi
  8928   8553   	    ;;
  8929   8554   	UNIX_SV* | UnixWare-5*)
  8930   8555   	    SHLIB_CFLAGS="-KPIC"
  8931   8556   	    SHLIB_LD="cc -G"
  8932   8557   	    SHLIB_LD_LIBS=""
  8933   8558   	    SHLIB_SUFFIX=".so"
  8934   8559   	    DL_OBJS="tclLoadDl.o"
  8935   8560   	    DL_LIBS="-ldl"
  8936   8561   	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
  8937   8562   	    # that don't grok the -Bexport option.  Test that it does.
  8938         -	    hold_ldflags=$LDFLAGS
  8939   8563   	    echo "$as_me:$LINENO: checking for ld accepts -Bexport flag" >&5
  8940   8564   echo $ECHO_N "checking for ld accepts -Bexport flag... $ECHO_C" >&6
  8941         -	    LDFLAGS="$LDFLAGS -Wl,-Bexport"
  8942         -	    cat >conftest.$ac_ext <<_ACEOF
         8565  +if test "${tcl_cv_ld_Bexport+set}" = set; then
         8566  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         8567  +else
         8568  +
         8569  +		hold_ldflags=$LDFLAGS
         8570  +		LDFLAGS="$LDFLAGS -Wl,-Bexport"
         8571  +		cat >conftest.$ac_ext <<_ACEOF
  8943   8572   /* confdefs.h.  */
  8944   8573   _ACEOF
  8945   8574   cat confdefs.h >>conftest.$ac_ext
  8946   8575   cat >>conftest.$ac_ext <<_ACEOF
  8947   8576   /* end confdefs.h.  */
  8948   8577   
  8949   8578   int
................................................................................
  8972   8601     (exit $ac_status); }; } &&
  8973   8602   	 { ac_try='test -s conftest$ac_exeext'
  8974   8603     { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  8975   8604     (eval $ac_try) 2>&5
  8976   8605     ac_status=$?
  8977   8606     echo "$as_me:$LINENO: \$? = $ac_status" >&5
  8978   8607     (exit $ac_status); }; }; then
  8979         -  found=yes
         8608  +  tcl_cv_ld_Bexport=yes
  8980   8609   else
  8981   8610     echo "$as_me: failed program was:" >&5
  8982   8611   sed 's/^/| /' conftest.$ac_ext >&5
  8983   8612   
  8984         -LDFLAGS=$hold_ldflags found=no
         8613  +tcl_cv_ld_Bexport=no
  8985   8614   fi
  8986   8615   rm -f conftest.err conftest.$ac_objext \
  8987   8616         conftest$ac_exeext conftest.$ac_ext
  8988         -	    echo "$as_me:$LINENO: result: $found" >&5
  8989         -echo "${ECHO_T}$found" >&6
         8617  +	        LDFLAGS=$hold_ldflags
         8618  +fi
         8619  +echo "$as_me:$LINENO: result: $tcl_cv_ld_Bexport" >&5
         8620  +echo "${ECHO_T}$tcl_cv_ld_Bexport" >&6
         8621  +	    if test $tcl_cv_ld_Bexport = yes; then
         8622  +		LDFLAGS="$LDFLAGS -Wl,-Bexport"
         8623  +	    fi
         8624  +	    CC_SEARCH_FLAGS=""
  8990   8625   	    LD_SEARCH_FLAGS=""
  8991   8626   	    ;;
  8992   8627       esac
  8993   8628   
  8994   8629       if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
  8995         -    { echo "$as_me:$LINENO: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&5
  8996         -echo "$as_me: WARNING: \"64bit support being disabled -- don\'t know magic for this platform\"" >&2;}
  8997         -    fi
  8998         -
  8999         -    # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
  9000         -    # Loading for Tcl -- What Became of It?".  Proc. 2nd Tcl/Tk Workshop,
  9001         -    # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
  9002         -    # to determine which of several header files defines the a.out file
  9003         -    # format (a.out.h, sys/exec.h, or sys/exec_aout.h).  At present, we
  9004         -    # support only a file format that is more or less version-7-compatible.
  9005         -    # In particular,
  9006         -    #	- a.out files must begin with `struct exec'.
  9007         -    #	- the N_TXTOFF on the `struct exec' must compute the seek address
  9008         -    #	  of the text segment
  9009         -    #	- The `struct exec' must contain a_magic, a_text, a_data, a_bss
  9010         -    #	  and a_entry fields.
  9011         -    # The following compilation should succeed if and only if either sys/exec.h
  9012         -    # or a.out.h is usable for the purpose.
  9013         -    #
  9014         -    # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
  9015         -    # `struct exec' includes a second header that contains information that
  9016         -    # duplicates the v7 fields that are needed.
  9017         -
  9018         -    if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
  9019         -	echo "$as_me:$LINENO: checking sys/exec.h" >&5
  9020         -echo $ECHO_N "checking sys/exec.h... $ECHO_C" >&6
  9021         -	cat >conftest.$ac_ext <<_ACEOF
  9022         -/* confdefs.h.  */
  9023         -_ACEOF
  9024         -cat confdefs.h >>conftest.$ac_ext
  9025         -cat >>conftest.$ac_ext <<_ACEOF
  9026         -/* end confdefs.h.  */
  9027         -#include <sys/exec.h>
  9028         -int
  9029         -main ()
  9030         -{
  9031         -
  9032         -	    struct exec foo;
  9033         -	    unsigned long seek;
  9034         -	    int flag;
  9035         -#if defined(__mips) || defined(mips)
  9036         -	    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  9037         -#else
  9038         -	    seek = N_TXTOFF (foo);
  9039         -#endif
  9040         -	    flag = (foo.a_magic == OMAGIC);
  9041         -	    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  9042         -
  9043         -  ;
  9044         -  return 0;
  9045         -}
  9046         -_ACEOF
  9047         -rm -f conftest.$ac_objext
  9048         -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9049         -  (eval $ac_compile) 2>conftest.er1
  9050         -  ac_status=$?
  9051         -  grep -v '^ *+' conftest.er1 >conftest.err
  9052         -  rm -f conftest.er1
  9053         -  cat conftest.err >&5
  9054         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9055         -  (exit $ac_status); } &&
  9056         -	 { ac_try='test -z "$ac_c_werror_flag"
  9057         -			 || test ! -s conftest.err'
  9058         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9059         -  (eval $ac_try) 2>&5
  9060         -  ac_status=$?
  9061         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9062         -  (exit $ac_status); }; } &&
  9063         -	 { ac_try='test -s conftest.$ac_objext'
  9064         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9065         -  (eval $ac_try) 2>&5
  9066         -  ac_status=$?
  9067         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9068         -  (exit $ac_status); }; }; then
  9069         -  tcl_ok=usable
  9070         -else
  9071         -  echo "$as_me: failed program was:" >&5
  9072         -sed 's/^/| /' conftest.$ac_ext >&5
  9073         -
  9074         -tcl_ok=unusable
  9075         -fi
  9076         -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9077         -	echo "$as_me:$LINENO: result: $tcl_ok" >&5
  9078         -echo "${ECHO_T}$tcl_ok" >&6
  9079         -	if test $tcl_ok = usable; then
  9080         -	    cat >>confdefs.h <<\_ACEOF
  9081         -#define USE_SYS_EXEC_H 1
  9082         -_ACEOF
  9083         -
  9084         -	else
  9085         -	    echo "$as_me:$LINENO: checking a.out.h" >&5
  9086         -echo $ECHO_N "checking a.out.h... $ECHO_C" >&6
  9087         -	    cat >conftest.$ac_ext <<_ACEOF
  9088         -/* confdefs.h.  */
  9089         -_ACEOF
  9090         -cat confdefs.h >>conftest.$ac_ext
  9091         -cat >>conftest.$ac_ext <<_ACEOF
  9092         -/* end confdefs.h.  */
  9093         -#include <a.out.h>
  9094         -int
  9095         -main ()
  9096         -{
  9097         -
  9098         -		struct exec foo;
  9099         -		unsigned long seek;
  9100         -		int flag;
  9101         -#if defined(__mips) || defined(mips)
  9102         -		seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  9103         -#else
  9104         -		seek = N_TXTOFF (foo);
  9105         -#endif
  9106         -		flag = (foo.a_magic == OMAGIC);
  9107         -		return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  9108         -
  9109         -  ;
  9110         -  return 0;
  9111         -}
  9112         -_ACEOF
  9113         -rm -f conftest.$ac_objext
  9114         -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9115         -  (eval $ac_compile) 2>conftest.er1
  9116         -  ac_status=$?
  9117         -  grep -v '^ *+' conftest.er1 >conftest.err
  9118         -  rm -f conftest.er1
  9119         -  cat conftest.err >&5
  9120         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9121         -  (exit $ac_status); } &&
  9122         -	 { ac_try='test -z "$ac_c_werror_flag"
  9123         -			 || test ! -s conftest.err'
  9124         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9125         -  (eval $ac_try) 2>&5
  9126         -  ac_status=$?
  9127         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9128         -  (exit $ac_status); }; } &&
  9129         -	 { ac_try='test -s conftest.$ac_objext'
  9130         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9131         -  (eval $ac_try) 2>&5
  9132         -  ac_status=$?
  9133         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9134         -  (exit $ac_status); }; }; then
  9135         -  tcl_ok=usable
  9136         -else
  9137         -  echo "$as_me: failed program was:" >&5
  9138         -sed 's/^/| /' conftest.$ac_ext >&5
  9139         -
  9140         -tcl_ok=unusable
  9141         -fi
  9142         -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9143         -	    echo "$as_me:$LINENO: result: $tcl_ok" >&5
  9144         -echo "${ECHO_T}$tcl_ok" >&6
  9145         -	    if test $tcl_ok = usable; then
  9146         -		cat >>confdefs.h <<\_ACEOF
  9147         -#define USE_A_OUT_H 1
  9148         -_ACEOF
  9149         -
  9150         -	    else
  9151         -		echo "$as_me:$LINENO: checking sys/exec_aout.h" >&5
  9152         -echo $ECHO_N "checking sys/exec_aout.h... $ECHO_C" >&6
  9153         -		cat >conftest.$ac_ext <<_ACEOF
  9154         -/* confdefs.h.  */
  9155         -_ACEOF
  9156         -cat confdefs.h >>conftest.$ac_ext
  9157         -cat >>conftest.$ac_ext <<_ACEOF
  9158         -/* end confdefs.h.  */
  9159         -#include <sys/exec_aout.h>
  9160         -int
  9161         -main ()
  9162         -{
  9163         -
  9164         -		    struct exec foo;
  9165         -		    unsigned long seek;
  9166         -		    int flag;
  9167         -#if defined(__mips) || defined(mips)
  9168         -		    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  9169         -#else
  9170         -		    seek = N_TXTOFF (foo);
  9171         -#endif
  9172         -		    flag = (foo.a_midmag == OMAGIC);
  9173         -		    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  9174         -
  9175         -  ;
  9176         -  return 0;
  9177         -}
  9178         -_ACEOF
  9179         -rm -f conftest.$ac_objext
  9180         -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
  9181         -  (eval $ac_compile) 2>conftest.er1
  9182         -  ac_status=$?
  9183         -  grep -v '^ *+' conftest.er1 >conftest.err
  9184         -  rm -f conftest.er1
  9185         -  cat conftest.err >&5
  9186         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9187         -  (exit $ac_status); } &&
  9188         -	 { ac_try='test -z "$ac_c_werror_flag"
  9189         -			 || test ! -s conftest.err'
  9190         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9191         -  (eval $ac_try) 2>&5
  9192         -  ac_status=$?
  9193         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9194         -  (exit $ac_status); }; } &&
  9195         -	 { ac_try='test -s conftest.$ac_objext'
  9196         -  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
  9197         -  (eval $ac_try) 2>&5
  9198         -  ac_status=$?
  9199         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
  9200         -  (exit $ac_status); }; }; then
  9201         -  tcl_ok=usable
  9202         -else
  9203         -  echo "$as_me: failed program was:" >&5
  9204         -sed 's/^/| /' conftest.$ac_ext >&5
  9205         -
  9206         -tcl_ok=unusable
  9207         -fi
  9208         -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9209         -		echo "$as_me:$LINENO: result: $tcl_ok" >&5
  9210         -echo "${ECHO_T}$tcl_ok" >&6
  9211         -		if test $tcl_ok = usable; then
  9212         -		    cat >>confdefs.h <<\_ACEOF
  9213         -#define USE_SYS_EXEC_AOUT_H 1
  9214         -_ACEOF
  9215         -
  9216         -		else
  9217         -		    DL_OBJS=""
  9218         -		fi
  9219         -	    fi
  9220         -	fi
  9221         -    fi
  9222         -
  9223         -    # Step 5: disable dynamic loading if requested via a command-line switch.
         8630  +	{ echo "$as_me:$LINENO: WARNING: 64bit support being disabled -- don't know magic for this platform" >&5
         8631  +echo "$as_me: WARNING: 64bit support being disabled -- don't know magic for this platform" >&2;}
         8632  +    fi
         8633  +
         8634  +    # Step 4: disable dynamic loading if requested via a command-line switch.
  9224   8635   
  9225   8636       # Check whether --enable-load or --disable-load was given.
  9226   8637   if test "${enable_load+set}" = set; then
  9227   8638     enableval="$enable_load"
  9228   8639     tcl_ok=$enableval
  9229   8640   else
  9230   8641     tcl_ok=yes
................................................................................
  9240   8651   	echo "on this system."
  9241   8652   	SHLIB_CFLAGS=""
  9242   8653   	SHLIB_LD=""
  9243   8654   	SHLIB_SUFFIX=""
  9244   8655   	DL_OBJS="tclLoadNone.o"
  9245   8656   	DL_LIBS=""
  9246   8657   	LDFLAGS="$LDFLAGS_ORIG"
         8658  +	CC_SEARCH_FLAGS=""
  9247   8659   	LD_SEARCH_FLAGS=""
  9248   8660   	BUILD_DLTEST=""
  9249   8661       fi
         8662  +    LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
  9250   8663   
  9251   8664       # If we're running gcc, then change the C flags for compiling shared
  9252   8665       # libraries to the right flags for gcc, instead of those for the
  9253   8666       # standard manufacturer compiler.
  9254   8667   
  9255   8668       if test "$DL_OBJS" != "tclLoadNone.o" ; then
  9256   8669   	if test "$GCC" = "yes" ; then
................................................................................
  9261   8674   		    ;;
  9262   8675   		IRIX*)
  9263   8676   		    ;;
  9264   8677   		NetBSD-*|FreeBSD-*)
  9265   8678   		    ;;
  9266   8679   		Darwin-*)
  9267   8680   		    ;;
  9268         -		RISCos-*)
  9269         -		    ;;
  9270   8681   		SCO_SV-3.2*)
  9271   8682   		    ;;
  9272         -		ULTRIX-4.*)
  9273         -		    ;;
  9274   8683   		windows)
  9275   8684   		    ;;
  9276   8685   		*)
  9277   8686   		    SHLIB_CFLAGS="-fPIC"
  9278   8687   		    ;;
  9279   8688   	    esac
  9280   8689   	fi
................................................................................
  9282   8691   
  9283   8692       if test "$SHARED_LIB_SUFFIX" = "" ; then
  9284   8693   	SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
  9285   8694       fi
  9286   8695       if test "$UNSHARED_LIB_SUFFIX" = "" ; then
  9287   8696   	UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
  9288   8697       fi
         8698  +
  9289   8699   
  9290   8700   
  9291   8701   
  9292   8702   
  9293   8703   
  9294   8704   
  9295   8705   
................................................................................
  9399   8809   fi
  9400   8810   rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9401   8811   fi
  9402   8812   rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9403   8813   fi
  9404   8814   
  9405   8815       if test "x${tcl_cv_flag__isoc99_source}" = "xyes" ; then
  9406         -	cat >>confdefs.h <<\_ACEOF
         8816  +
         8817  +cat >>confdefs.h <<\_ACEOF
  9407   8818   #define _ISOC99_SOURCE 1
  9408   8819   _ACEOF
  9409   8820   
  9410   8821   	tcl_flags="$tcl_flags _ISOC99_SOURCE"
  9411   8822       fi
  9412   8823   
  9413   8824   
................................................................................
  9503   8914   fi
  9504   8915   rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9505   8916   fi
  9506   8917   rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9507   8918   fi
  9508   8919   
  9509   8920       if test "x${tcl_cv_flag__largefile64_source}" = "xyes" ; then
  9510         -	cat >>confdefs.h <<\_ACEOF
         8921  +
         8922  +cat >>confdefs.h <<\_ACEOF
  9511   8923   #define _LARGEFILE64_SOURCE 1
  9512   8924   _ACEOF
  9513   8925   
  9514   8926   	tcl_flags="$tcl_flags _LARGEFILE64_SOURCE"
  9515   8927       fi
  9516   8928   
         8929  +
         8930  +    if test "${tcl_cv_flag__largefile_source64+set}" = set; then
         8931  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         8932  +else
         8933  +  cat >conftest.$ac_ext <<_ACEOF
         8934  +/* confdefs.h.  */
         8935  +_ACEOF
         8936  +cat confdefs.h >>conftest.$ac_ext
         8937  +cat >>conftest.$ac_ext <<_ACEOF
         8938  +/* end confdefs.h.  */
         8939  +#include <sys/stat.h>
         8940  +int
         8941  +main ()
         8942  +{
         8943  +char *p = (char *)open64;
         8944  +  ;
         8945  +  return 0;
         8946  +}
         8947  +_ACEOF
         8948  +rm -f conftest.$ac_objext
         8949  +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
         8950  +  (eval $ac_compile) 2>conftest.er1
         8951  +  ac_status=$?
         8952  +  grep -v '^ *+' conftest.er1 >conftest.err
         8953  +  rm -f conftest.er1
         8954  +  cat conftest.err >&5
         8955  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8956  +  (exit $ac_status); } &&
         8957  +	 { ac_try='test -z "$ac_c_werror_flag"
         8958  +			 || test ! -s conftest.err'
         8959  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         8960  +  (eval $ac_try) 2>&5
         8961  +  ac_status=$?
         8962  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8963  +  (exit $ac_status); }; } &&
         8964  +	 { ac_try='test -s conftest.$ac_objext'
         8965  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         8966  +  (eval $ac_try) 2>&5
         8967  +  ac_status=$?
         8968  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8969  +  (exit $ac_status); }; }; then
         8970  +  tcl_cv_flag__largefile_source64=no
         8971  +else
         8972  +  echo "$as_me: failed program was:" >&5
         8973  +sed 's/^/| /' conftest.$ac_ext >&5
         8974  +
         8975  +cat >conftest.$ac_ext <<_ACEOF
         8976  +/* confdefs.h.  */
         8977  +_ACEOF
         8978  +cat confdefs.h >>conftest.$ac_ext
         8979  +cat >>conftest.$ac_ext <<_ACEOF
         8980  +/* end confdefs.h.  */
         8981  +#define _LARGEFILE_SOURCE64 1
         8982  +#include <sys/stat.h>
         8983  +int
         8984  +main ()
         8985  +{
         8986  +char *p = (char *)open64;
         8987  +  ;
         8988  +  return 0;
         8989  +}
         8990  +_ACEOF
         8991  +rm -f conftest.$ac_objext
         8992  +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
         8993  +  (eval $ac_compile) 2>conftest.er1
         8994  +  ac_status=$?
         8995  +  grep -v '^ *+' conftest.er1 >conftest.err
         8996  +  rm -f conftest.er1
         8997  +  cat conftest.err >&5
         8998  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         8999  +  (exit $ac_status); } &&
         9000  +	 { ac_try='test -z "$ac_c_werror_flag"
         9001  +			 || test ! -s conftest.err'
         9002  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         9003  +  (eval $ac_try) 2>&5
         9004  +  ac_status=$?
         9005  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         9006  +  (exit $ac_status); }; } &&
         9007  +	 { ac_try='test -s conftest.$ac_objext'
         9008  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         9009  +  (eval $ac_try) 2>&5
         9010  +  ac_status=$?
         9011  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         9012  +  (exit $ac_status); }; }; then
         9013  +  tcl_cv_flag__largefile_source64=yes
         9014  +else
         9015  +  echo "$as_me: failed program was:" >&5
         9016  +sed 's/^/| /' conftest.$ac_ext >&5
         9017  +
         9018  +tcl_cv_flag__largefile_source64=no
         9019  +fi
         9020  +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
         9021  +fi
         9022  +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
         9023  +fi
         9024  +
         9025  +    if test "x${tcl_cv_flag__largefile_source64}" = "xyes" ; then
         9026  +
         9027  +cat >>confdefs.h <<\_ACEOF
         9028  +#define _LARGEFILE_SOURCE64 1
         9029  +_ACEOF
         9030  +
         9031  +	tcl_flags="$tcl_flags _LARGEFILE_SOURCE64"
         9032  +    fi
         9033  +
  9517   9034       if test "x${tcl_flags}" = "x" ; then
  9518   9035   	echo "$as_me:$LINENO: result: none" >&5
  9519   9036   echo "${ECHO_T}none" >&6
  9520   9037       else
  9521   9038   	echo "$as_me:$LINENO: result: ${tcl_flags}" >&5
  9522   9039   echo "${ECHO_T}${tcl_flags}" >&6
  9523   9040       fi
................................................................................
  9624   9141   sed 's/^/| /' conftest.$ac_ext >&5
  9625   9142   
  9626   9143   fi
  9627   9144   rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9628   9145   fi
  9629   9146   
  9630   9147       if test "${tcl_cv_type_64bit}" = none ; then
  9631         -	cat >>confdefs.h <<\_ACEOF
         9148  +
         9149  +cat >>confdefs.h <<\_ACEOF
  9632   9150   #define TCL_WIDE_INT_IS_LONG 1
  9633   9151   _ACEOF
  9634   9152   
  9635   9153   	echo "$as_me:$LINENO: result: using long" >&5
  9636   9154   echo "${ECHO_T}using long" >&6
  9637         -    elif test "${tcl_cv_type_64bit}" = "__int64" ; then
         9155  +    elif test "${tcl_cv_type_64bit}" = "__int64" \
         9156  +		-a "${TEA_PLATFORM}" = "windows" ; then
  9638   9157   	# We actually want to use the default tcl.h checks in this
  9639   9158   	# case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
  9640   9159   	echo "$as_me:$LINENO: result: using Tcl header defaults" >&5
  9641   9160   echo "${ECHO_T}using Tcl header defaults" >&6
  9642   9161       else
  9643         -	cat >>confdefs.h <<_ACEOF
         9162  +
         9163  +cat >>confdefs.h <<_ACEOF
  9644   9164   #define TCL_WIDE_INT_TYPE ${tcl_cv_type_64bit}
  9645   9165   _ACEOF
  9646   9166   
  9647   9167   	echo "$as_me:$LINENO: result: ${tcl_cv_type_64bit}" >&5
  9648   9168   echo "${ECHO_T}${tcl_cv_type_64bit}" >&6
  9649   9169   
  9650   9170   	# Now check for auxiliary declarations
  9651   9171   	echo "$as_me:$LINENO: checking for struct dirent64" >&5
  9652   9172   echo $ECHO_N "checking for struct dirent64... $ECHO_C" >&6
  9653         -	if test "${tcl_cv_struct_dirent64+set}" = set; then
         9173  +if test "${tcl_cv_struct_dirent64+set}" = set; then
  9654   9174     echo $ECHO_N "(cached) $ECHO_C" >&6
  9655   9175   else
  9656   9176   
  9657   9177   	    cat >conftest.$ac_ext <<_ACEOF
  9658   9178   /* confdefs.h.  */
  9659   9179   _ACEOF
  9660   9180   cat confdefs.h >>conftest.$ac_ext
................................................................................
  9697   9217     echo "$as_me: failed program was:" >&5
  9698   9218   sed 's/^/| /' conftest.$ac_ext >&5
  9699   9219   
  9700   9220   tcl_cv_struct_dirent64=no
  9701   9221   fi
  9702   9222   rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9703   9223   fi
  9704         -
         9224  +echo "$as_me:$LINENO: result: $tcl_cv_struct_dirent64" >&5
         9225  +echo "${ECHO_T}$tcl_cv_struct_dirent64" >&6
  9705   9226   	if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
  9706         -	    cat >>confdefs.h <<\_ACEOF
         9227  +
         9228  +cat >>confdefs.h <<\_ACEOF
  9707   9229   #define HAVE_STRUCT_DIRENT64 1
  9708   9230   _ACEOF
  9709   9231   
  9710   9232   	fi
  9711         -	echo "$as_me:$LINENO: result: ${tcl_cv_struct_dirent64}" >&5
  9712         -echo "${ECHO_T}${tcl_cv_struct_dirent64}" >&6
  9713   9233   
  9714   9234   	echo "$as_me:$LINENO: checking for struct stat64" >&5
  9715   9235   echo $ECHO_N "checking for struct stat64... $ECHO_C" >&6
  9716         -	if test "${tcl_cv_struct_stat64+set}" = set; then
         9236  +if test "${tcl_cv_struct_stat64+set}" = set; then
  9717   9237     echo $ECHO_N "(cached) $ECHO_C" >&6
  9718   9238   else
  9719   9239   
  9720   9240   	    cat >conftest.$ac_ext <<_ACEOF
  9721   9241   /* confdefs.h.  */
  9722   9242   _ACEOF
  9723   9243   cat confdefs.h >>conftest.$ac_ext
................................................................................
  9760   9280     echo "$as_me: failed program was:" >&5
  9761   9281   sed 's/^/| /' conftest.$ac_ext >&5
  9762   9282   
  9763   9283   tcl_cv_struct_stat64=no
  9764   9284   fi
  9765   9285   rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9766   9286   fi
  9767         -
         9287  +echo "$as_me:$LINENO: result: $tcl_cv_struct_stat64" >&5
         9288  +echo "${ECHO_T}$tcl_cv_struct_stat64" >&6
  9768   9289   	if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
  9769         -	    cat >>confdefs.h <<\_ACEOF
         9290  +
         9291  +cat >>confdefs.h <<\_ACEOF
  9770   9292   #define HAVE_STRUCT_STAT64 1
  9771   9293   _ACEOF
  9772   9294   
  9773   9295   	fi
  9774         -	echo "$as_me:$LINENO: result: ${tcl_cv_struct_stat64}" >&5
  9775         -echo "${ECHO_T}${tcl_cv_struct_stat64}" >&6
         9296  +
         9297  +
         9298  +
         9299  +for ac_func in open64 lseek64
         9300  +do
         9301  +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
         9302  +echo "$as_me:$LINENO: checking for $ac_func" >&5
         9303  +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
         9304  +if eval "test \"\${$as_ac_var+set}\" = set"; then
         9305  +  echo $ECHO_N "(cached) $ECHO_C" >&6
         9306  +else
         9307  +  cat >conftest.$ac_ext <<_ACEOF
         9308  +/* confdefs.h.  */
         9309  +_ACEOF
         9310  +cat confdefs.h >>conftest.$ac_ext
         9311  +cat >>conftest.$ac_ext <<_ACEOF
         9312  +/* end confdefs.h.  */
         9313  +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
         9314  +   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
         9315  +#define $ac_func innocuous_$ac_func
         9316  +
         9317  +/* System header to define __stub macros and hopefully few prototypes,
         9318  +    which can conflict with char $ac_func (); below.
         9319  +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
         9320  +    <limits.h> exists even on freestanding compilers.  */
         9321  +
         9322  +#ifdef __STDC__
         9323  +# include <limits.h>
         9324  +#else
         9325  +# include <assert.h>
         9326  +#endif
         9327  +
         9328  +#undef $ac_func
         9329  +
         9330  +/* Override any gcc2 internal prototype to avoid an error.  */
         9331  +#ifdef __cplusplus
         9332  +extern "C"
         9333  +{
         9334  +#endif
         9335  +/* We use char because int might match the return type of a gcc2
         9336  +   builtin and then its argument prototype would still apply.  */
         9337  +char $ac_func ();
         9338  +/* The GNU C library defines this for functions which it implements
         9339  +    to always fail with ENOSYS.  Some functions are actually named
         9340  +    something starting with __ and the normal name is an alias.  */
         9341  +#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
         9342  +choke me
         9343  +#else
         9344  +char (*f) () = $ac_func;
         9345  +#endif
         9346  +#ifdef __cplusplus
         9347  +}
         9348  +#endif
         9349  +
         9350  +int
         9351  +main ()
         9352  +{
         9353  +return f != $ac_func;
         9354  +  ;
         9355  +  return 0;
         9356  +}
         9357  +_ACEOF
         9358  +rm -f conftest.$ac_objext conftest$ac_exeext
         9359  +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
         9360  +  (eval $ac_link) 2>conftest.er1
         9361  +  ac_status=$?
         9362  +  grep -v '^ *+' conftest.er1 >conftest.err
         9363  +  rm -f conftest.er1
         9364  +  cat conftest.err >&5
         9365  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         9366  +  (exit $ac_status); } &&
         9367  +	 { ac_try='test -z "$ac_c_werror_flag"
         9368  +			 || test ! -s conftest.err'
         9369  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         9370  +  (eval $ac_try) 2>&5
         9371  +  ac_status=$?
         9372  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         9373  +  (exit $ac_status); }; } &&
         9374  +	 { ac_try='test -s conftest$ac_exeext'
         9375  +  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
         9376  +  (eval $ac_try) 2>&5
         9377  +  ac_status=$?
         9378  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
         9379  +  (exit $ac_status); }; }; then
         9380  +  eval "$as_ac_var=yes"
         9381  +else
         9382  +  echo "$as_me: failed program was:" >&5
         9383  +sed 's/^/| /' conftest.$ac_ext >&5
         9384  +
         9385  +eval "$as_ac_var=no"
         9386  +fi
         9387  +rm -f conftest.err conftest.$ac_objext \
         9388  +      conftest$ac_exeext conftest.$ac_ext
         9389  +fi
         9390  +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
         9391  +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
         9392  +if test `eval echo '${'$as_ac_var'}'` = yes; then
         9393  +  cat >>confdefs.h <<_ACEOF
         9394  +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
         9395  +_ACEOF
         9396  +
         9397  +fi
         9398  +done
  9776   9399   
  9777   9400   	echo "$as_me:$LINENO: checking for off64_t" >&5
  9778   9401   echo $ECHO_N "checking for off64_t... $ECHO_C" >&6
  9779   9402   	if test "${tcl_cv_type_off64_t+set}" = set; then
  9780   9403     echo $ECHO_N "(cached) $ECHO_C" >&6
  9781   9404   else
  9782   9405   
................................................................................
  9824   9447   sed 's/^/| /' conftest.$ac_ext >&5
  9825   9448   
  9826   9449   tcl_cv_type_off64_t=no
  9827   9450   fi
  9828   9451   rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
  9829   9452   fi
  9830   9453   
  9831         -	if test "x${tcl_cv_type_off64_t}" = "xyes" ; then
  9832         -	    cat >>confdefs.h <<\_ACEOF
         9454  +			if test "x${tcl_cv_type_off64_t}" = "xyes" && \
         9455  +	        test "x${ac_cv_func_lseek64}" = "xyes" && \
         9456  +	        test "x${ac_cv_func_open64}" = "xyes" ; then
         9457  +
         9458  +cat >>confdefs.h <<\_ACEOF
  9833   9459   #define HAVE_TYPE_OFF64_T 1
  9834   9460   _ACEOF
  9835   9461   
         9462  +	    echo "$as_me:$LINENO: result: yes" >&5
         9463  +echo "${ECHO_T}yes" >&6
         9464  +	else
         9465  +	    echo "$as_me:$LINENO: result: no" >&5
         9466  +echo "${ECHO_T}no" >&6
  9836   9467   	fi
  9837         -	echo "$as_me:$LINENO: result: ${tcl_cv_type_off64_t}" >&5
  9838         -echo "${ECHO_T}${tcl_cv_type_off64_t}" >&6
  9839   9468       fi
  9840   9469   
  9841   9470   
  9842   9471   
  9843   9472   #--------------------------------------------------------------------
  9844   9473   # Set the default compiler switches based on the --enable-symbols option.
  9845   9474   #--------------------------------------------------------------------
  9846   9475   
  9847   9476   
  9848   9477   
  9849         -
  9850         -    DBGX=""
  9851         -
  9852   9478       echo "$as_me:$LINENO: checking for build with symbols" >&5
  9853   9479   echo $ECHO_N "checking for build with symbols... $ECHO_C" >&6
  9854   9480       # Check whether --enable-symbols or --disable-symbols was given.
  9855   9481   if test "${enable_symbols+set}" = set; then
  9856   9482     enableval="$enable_symbols"
  9857   9483     tcl_ok=$enableval
  9858   9484   else
  9859   9485     tcl_ok=no
  9860   9486   fi;
         9487  +    DBGX=""
  9861   9488       if test "$tcl_ok" = "no"; then
  9862   9489   	CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
  9863   9490   	LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
  9864   9491   	echo "$as_me:$LINENO: result: no" >&5
  9865   9492   echo "${ECHO_T}no" >&6
  9866   9493       else
  9867   9494   	CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
................................................................................
  9876   9503       fi
  9877   9504   
  9878   9505   
  9879   9506   
  9880   9507   
  9881   9508   
  9882   9509       if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
  9883         -	cat >>confdefs.h <<\_ACEOF
         9510  +
         9511  +cat >>confdefs.h <<\_ACEOF
  9884   9512   #define TCL_MEM_DEBUG 1
  9885   9513   _ACEOF
  9886   9514   
  9887   9515       fi
  9888   9516   
  9889   9517       if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
  9890   9518   	if test "$tcl_ok" = "all"; then
................................................................................
 10061   9689   	fi
 10062   9690       fi
 10063   9691   
 10064   9692   
 10065   9693   
 10066   9694   
 10067   9695   
 10068         -    if test "$GCC" = "yes"; then
         9696  +    if test "$PLATFORM" = "WIN32" -a "$GCC" != "yes"; then
         9697  +        SSL_INCLUDE_DIR_NATIVE=\"`echo ${SSL_INCLUDE_DIR}|sed 's%/%\\\\%g'`\"
         9698  +        SSL_LIB_DIR_NATIVE=\"`echo ${SSL_LIB_DIR}|sed 's%/%\\\\%g'`\"
         9699  +    else
 10069   9700           SSL_INCLUDE_DIR_NATIVE=\"`${CYGPATH} ${SSL_INCLUDE_DIR}`\"
 10070   9701           SSL_LIB_DIR_NATIVE=\"`${CYGPATH} ${SSL_LIB_DIR}`\"
 10071         -    else
 10072         -        SSL_INCLUDE_DIR_NATIVE=\"`echo ${SSL_INCLUDE_DIR}|sed 's%/%\\\\%g'`\"
 10073         -        SSL_LIB_DIR_NATIVE=\"`echo ${SSL_LIB_DIR}|sed 's%/%\\\\%g'`\"
 10074   9702       fi
 10075   9703   
 10076   9704   
 10077   9705   
 10078   9706       #--------------------------------------------------------------------
 10079   9707       # If OpenSSL was built with gcc then there may be some symbols that need
 10080   9708       # resolving before we can load it into tclsh (__udivd3i on solaris.
................................................................................
 10160   9788   
 10161   9789       #--------------------------------------------------------------------
 10162   9790       # Shared libraries and static libraries have different names.
 10163   9791       # Use the double eval to make sure any variables in the suffix is
 10164   9792       # substituted. (@@@ Might not be necessary anymore)
 10165   9793       #--------------------------------------------------------------------
 10166   9794   
 10167         -    RANLIB_STUB="${RANLIB}"
 10168   9795       if test "${TEA_PLATFORM}" = "windows" ; then
 10169   9796   	if test "${SHARED_BUILD}" = "1" ; then
 10170   9797   	    # We force the unresolved linking of symbols that are really in
 10171   9798   	    # the private libraries of Tcl and Tk.
 10172   9799   	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}`\""
 10173   9800   	    if test x"${TK_BIN_DIR}" != x ; then
 10174   9801   		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
 10175   9802   	    fi
 10176   9803   	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
 10177         -	    RANLIB=:
 10178   9804   	else
 10179   9805   	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
 10180   9806   	fi
 10181         -	# Some packages build there own stubs libraries
         9807  +	# Some packages build their own stubs libraries
 10182   9808   	eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
         9809  +	if test "$GCC" = "yes"; then
         9810  +	    PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
         9811  +	fi
         9812  +	# These aren't needed on Windows (either MSVC or gcc)
         9813  +	RANLIB=:
         9814  +	RANLIB_STUB=:
 10183   9815       else
         9816  +	RANLIB_STUB="${RANLIB}"
 10184   9817   	if test "${SHARED_BUILD}" = "1" ; then
 10185   9818   	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
 10186   9819   	    if test x"${TK_BIN_DIR}" != x ; then
 10187   9820   		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
 10188   9821   	    fi
 10189   9822   	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
 10190   9823   	    RANLIB=:
 10191   9824   	else
 10192   9825   	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
 10193   9826   	fi
 10194         -	# Some packages build there own stubs libraries
         9827  +	# Some packages build their own stubs libraries
 10195   9828   	eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
 10196   9829       fi
 10197   9830   
 10198   9831       # These are escaped so that only CFLAGS is picked up at configure time.
 10199   9832       # The other values will be substituted at make time.
 10200   9833       CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
 10201   9834       if test "${SHARED_BUILD}" = "1" ; then
................................................................................
 10216   9849   # OpenSSL uses as its default names.
 10217   9850   #--------------------------------------------------------------------
 10218   9851   
 10219   9852   if test -n "${OPENSSL}"; then
 10220   9853       if test "${TEA_PLATFORM}" = "windows" ; then
 10221   9854           if test "$GCC" = "yes"; then
 10222   9855   
 10223         -    vars="-L${SSL_LIB_DIR_NATIVE} -lssleay32.lib -llibeay32.lib"
         9856  +    vars="-L${SSL_LIB_DIR_NATIVE} -lssleay32 -llibeay32"
 10224   9857       for i in $vars; do
 10225   9858   	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
 10226   9859   	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
 10227   9860   	    i=`echo "$i" | sed -e 's/^\([^-].*\)\.lib$/-l\1/i'`
 10228   9861   	fi
 10229   9862   	PKG_LIBS="$PKG_LIBS $i"
 10230   9863       done
................................................................................
 10304   9937   # ${CYGPATH} because it's being used directly by make.
 10305   9938   # Require that we use a tclsh shell version 8.2 or later since earlier
 10306   9939   # versions have bugs in the pkg_mkIndex routine.
 10307   9940   # Add WISH as well if this is a Tk extension.
 10308   9941   #--------------------------------------------------------------------
 10309   9942   
 10310   9943   
 10311         -    # Allow the user to provide this setting in the env
 10312         -    if test "x${TCLSH_PROG}" = "x" ; then
 10313         -	echo "$as_me:$LINENO: checking for tclsh" >&5
         9944  +    echo "$as_me:$LINENO: checking for tclsh" >&5
 10314   9945   echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
 10315         -
 10316         -	if test "${ac_cv_path_tclsh+set}" = set; then
 10317         -  echo $ECHO_N "(cached) $ECHO_C" >&6
 10318         -else
 10319         -
 10320         -	if test "${TEA_PLATFORM}" = "windows" -a "$do64bit_ok" = "yes" \
 10321         -		-o "$doWince" != "no" ; then
 10322         -	    # A Windows cross-compile build - restrict target tclsh
 10323         -	    # as we need one we can run on this system
 10324         -	    search_path=`echo ${PATH} | sed -e 's/:/ /g'`
 10325         -	else
 10326         -	    search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'`
 10327         -	fi
 10328         -	for dir in $search_path ; do
 10329         -	    for j in `ls -r $dir/tclsh[8-9]*${EXEEXT} 2> /dev/null` \
 10330         -		    `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do
 10331         -		if test x"$ac_cv_path_tclsh" = x ; then
 10332         -		    if test -f "$j" ; then
 10333         -			ac_cv_path_tclsh=$j
 10334         -			break
 10335         -		    fi
 10336         -		fi
 10337         -	    done
 10338         -	done
 10339         -
 10340         -fi
 10341         -
 10342         -
 10343         -	if test -f "$ac_cv_path_tclsh" ; then
 10344         -	    TCLSH_PROG=$ac_cv_path_tclsh
 10345         -	    echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
 10346         -echo "${ECHO_T}$TCLSH_PROG" >&6
 10347         -	else
 10348         -	    { { echo "$as_me:$LINENO: error: No tclsh found in PATH: $search_path" >&5
 10349         -echo "$as_me: error: No tclsh found in PATH: $search_path" >&2;}
 10350         -   { (exit 1); exit 1; }; }
 10351         -	fi
         9946  +    if test -f "${TCL_BIN_DIR}/Makefile" ; then
         9947  +        # tclConfig.sh is in Tcl build directory
         9948  +        if test "${TEA_PLATFORM}" = "windows"; then
         9949  +            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
         9950  +        else
         9951  +            TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
         9952  +        fi
         9953  +    else
         9954  +        # tclConfig.sh is in install location
         9955  +        if test "${TEA_PLATFORM}" = "windows"; then
         9956  +            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
         9957  +        else
         9958  +            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
         9959  +        fi
         9960  +        list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
         9961  +              `ls -d ${TCL_BIN_DIR}/..     2>/dev/null` \
         9962  +              `ls -d ${TCL_PREFIX}/bin     2>/dev/null`"
         9963  +        for i in $list ; do
         9964  +            if test -f "$i/${TCLSH_PROG}" ; then
         9965  +                REAL_TCL_BIN_DIR="`cd "$i"; pwd`"
         9966  +                break
         9967  +            fi
         9968  +        done
         9969  +        TCLSH_PROG="${REAL_TCL_BIN_DIR}/${TCLSH_PROG}"
 10352   9970       fi
         9971  +    echo "$as_me:$LINENO: result: ${TCLSH_PROG}" >&5
         9972  +echo "${ECHO_T}${TCLSH_PROG}" >&6
 10353   9973   
 10354   9974   
 10355   9975   
 10356   9976   #--------------------------------------------------------------------
 10357   9977   # Finally, substitute all of the various values into the Makefile.
 10358   9978   #--------------------------------------------------------------------
 10359   9979   
................................................................................
 11036  10656   s,@[email protected],$PKG_SOURCES,;t t
 11037  10657   s,@[email protected],$PKG_OBJECTS,;t t
 11038  10658   s,@[email protected],$CLEANFILES,;t t
 11039  10659   s,@[email protected],$TCL_INCLUDES,;t t
 11040  10660   s,@[email protected],$TCL_THREADS,;t t
 11041  10661   s,@[email protected],$SHARED_BUILD,;t t
 11042  10662   s,@[email protected],$AR,;t t
 11043         -s,@[email protected],$TCLSH_PROG,;t t
 11044  10663   s,@[email protected],$CELIB_DIR,;t t
 11045  10664   s,@[email protected],$LIBOBJS,;t t
 11046  10665   s,@[email protected],$DL_LIBS,;t t
 11047  10666   s,@[email protected],$CFLAGS_DEBUG,;t t
 11048  10667   s,@[email protected],$CFLAGS_OPTIMIZE,;t t
 11049  10668   s,@[email protected],$CFLAGS_WARNING,;t t
 11050  10669   s,@[email protected],$STLIB_LD,;t t
 11051  10670   s,@[email protected],$SHLIB_LD,;t t
 11052         -s,@[email protected],$SHLIB_CFLAGS,;t t
 11053  10671   s,@[email protected],$SHLIB_LD_LIBS,;t t
 11054         -s,@[email protected],$LDFLAGS_DEBUG,;t t
 11055         -s,@[email protected],$LDFLAGS_OPTIMIZE,;t t
        10672  +s,@[email protected],$SHLIB_CFLAGS,;t t
 11056  10673   s,@[email protected],$LD_LIBRARY_PATH_VAR,;t t
 11057  10674   s,@[email protected],$TCL_DBGX,;t t
 11058  10675   s,@[email protected],$CFLAGS_DEFAULT,;t t
 11059  10676   s,@[email protected],$LDFLAGS_DEFAULT,;t t
 11060  10677   s,@[email protected],$SSL_DIR,;t t
 11061  10678   s,@[email protected],$SSL_LIB_DIR,;t t
 11062  10679   s,@[email protected],$SSL_INCLUDE_DIR,;t t
................................................................................
 11063  10680   s,@[email protected],$SSL_INCLUDE_DIR_NATIVE,;t t
 11064  10681   s,@[email protected],$SSL_LIB_DIR_NATIVE,;t t
 11065  10682   s,@[email protected],$MAKE_LIB,;t t
 11066  10683   s,@[email protected],$MAKE_SHARED_LIB,;t t
 11067  10684   s,@[email protected],$MAKE_STATIC_LIB,;t t
 11068  10685   s,@[email protected],$MAKE_STUB_LIB,;t t
 11069  10686   s,@[email protected],$RANLIB_STUB,;t t
        10687  +s,@[email protected],$TCLSH_PROG,;t t
 11070  10688   s,@[email protected],$LTLIBOBJS,;t t
 11071  10689   CEOF
 11072  10690   
 11073  10691   _ACEOF
 11074  10692   
 11075  10693     cat >>$CONFIG_STATUS <<\_ACEOF
 11076  10694     # Split the substitutions into bite-sized pieces for seds with

Modified configure.in from [7f5ca0eb05] to [d20191ea0e].

     7      7   dnl OpenSSL libraries or libraries from the commercial BSAFE SSL-C
     8      8   dnl product from RSA Security.  In the United States, it is necessary
     9      9   dnl to use the RSA BSAFE libraries for any product developed for
    10     10   dnl commercial use. Licensing information for BSAFE SSL-C may be
    11     11   dnl obtained from RSA Data Scurity Inc., San Mateo, California, USA.
    12     12   dnl Their home page on the web is "www.rsasecurity.com". 
    13     13   #
    14         -# RCS: @(#) $Id: configure.in,v 1.21 2005/02/09 00:58:26 hobbs2 Exp $
           14  +# RCS: @(#) $Id: configure.in,v 1.22 2006/06/22 14:03:23 patthoyts Exp $
    15     15   
    16     16   
    17     17   #--------------------------------------------------------------------
    18     18   # macro used to verify that the configure script can find the sources
    19     19   #--------------------------------------------------------------------
    20     20   
    21     21   AC_INIT([tls], [1.5.1])
    22     22   
    23         -TEA_INIT([3.2])
           23  +TEA_INIT([3.5])
    24     24   
    25     25   AC_CONFIG_AUX_DIR(tclconfig)
    26     26   
    27     27   #--------------------------------------------------------------------
    28     28   # Load the tclConfig.sh file
    29     29   #--------------------------------------------------------------------
    30     30   
................................................................................
   170    170   # For the OpenSSL version, I chose to use the same library names that
   171    171   # OpenSSL uses as its default names.
   172    172   #--------------------------------------------------------------------
   173    173   
   174    174   if test -n "${OPENSSL}"; then
   175    175       if test "${TEA_PLATFORM}" = "windows" ; then
   176    176           if test "$GCC" = "yes"; then
   177         -            TEA_ADD_LIBS([-L${SSL_LIB_DIR_NATIVE} -lssleay32.lib -llibeay32.lib])
          177  +            TEA_ADD_LIBS([-L${SSL_LIB_DIR_NATIVE} -lssleay32 -llibeay32])
   178    178           else
   179    179               TEA_ADD_LIBS([-libpath:${SSL_LIB_DIR_NATIVE} ssleay32.lib libeay32.lib])
   180    180           fi
   181    181       else
   182    182   	TEA_ADD_LIBS([-L${SSL_LIB_DIR} -lssl -lcrypto ${GCCPATH} ${GCCLIB}])
   183    183       fi
   184    184   else

Modified tclconfig/README.txt from [c7a8a24b27] to [180f4215d5].

    19     19   
    20     20   README.txt	This file
    21     21   
    22     22   install-sh	Program used for copying binaries and script files
    23     23   		to their install locations.
    24     24   
    25     25   tcl.m4		Collection of Tcl autoconf macros.  Included by a package's
    26         -		aclocal.m4 to define SC_* macros.
           26  +		aclocal.m4 to define TEA_* macros.

Modified tclconfig/tcl.m4 from [ec3f5608c5] to [0e5e5a2986].

     1      1   # tcl.m4 --
     2      2   #
     3      3   #	This file provides a set of autoconf macros to help TEA-enable
     4      4   #	a Tcl extension.
     5      5   #
     6      6   # Copyright (c) 1999-2000 Ajuba Solutions.
     7         -# Copyright (c) 2002-2003 ActiveState Corporation.
            7  +# Copyright (c) 2002-2005 ActiveState Corporation.
     8      8   #
     9      9   # See the file "license.terms" for information on usage and redistribution
    10     10   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    11     11   #
    12         -# RCS: @(#) $Id: tcl.m4,v 1.4 2005/02/09 00:58:27 hobbs2 Exp $
           12  +# RCS: @(#) $Id: tcl.m4,v 1.5 2006/06/22 14:03:24 patthoyts Exp $
    13     13   
    14     14   AC_PREREQ(2.50)
           15  +
           16  +dnl TEA extensions pass this us the version of TEA they think they
           17  +dnl are compatible with (must be set in TEA_INIT below)
           18  +dnl TEA_VERSION="3.5"
           19  +
           20  +# Possible values for key variables defined:
           21  +#
           22  +# TEA_WINDOWINGSYSTEM - win32 aqua x11 (mirrors 'tk windowingsystem')
           23  +# TEA_PLATFORM        - windows unix
           24  +#
    15     25   
    16     26   #------------------------------------------------------------------------
    17     27   # TEA_PATH_TCLCONFIG --
    18     28   #
    19     29   #	Locate the tclConfig.sh file and perform a sanity check on
    20     30   #	the Tcl compile flags
    21     31   #
................................................................................
    28     38   #		--with-tcl=...
    29     39   #
    30     40   #	Defines the following vars:
    31     41   #		TCL_BIN_DIR	Full path to the directory containing
    32     42   #				the tclConfig.sh file
    33     43   #------------------------------------------------------------------------
    34     44   
    35         -AC_DEFUN(TEA_PATH_TCLCONFIG, [
           45  +AC_DEFUN([TEA_PATH_TCLCONFIG], [
    36     46       dnl Make sure we are initialized
    37     47       AC_REQUIRE([TEA_INIT])
    38     48       #
    39     49       # Ok, lets find the tcl configuration
    40     50       # First, look for one uninstalled.
    41     51       # the alternative search directory is invoked by --with-tcl
    42     52       #
    43     53   
    44     54       if test x"${no_tcl}" = x ; then
    45     55   	# we reset no_tcl in case something fails here
    46     56   	no_tcl=true
    47         -	AC_ARG_WITH(tcl, [  --with-tcl              directory containing tcl configuration (tclConfig.sh)], with_tclconfig=${withval})
           57  +	AC_ARG_WITH(tcl,
           58  +	    AC_HELP_STRING([--with-tcl],
           59  +		[directory containing tcl configuration (tclConfig.sh)]),
           60  +	    with_tclconfig=${withval})
    48     61   	AC_MSG_CHECKING([for Tcl configuration])
    49     62   	AC_CACHE_VAL(ac_cv_c_tclconfig,[
    50     63   
    51     64   	    # First check to see if --with-tcl was specified.
    52     65   	    if test x"${with_tclconfig}" != x ; then
           66  +		case ${with_tclconfig} in
           67  +		    */tclConfig.sh )
           68  +			if test -f ${with_tclconfig}; then
           69  +			    AC_MSG_WARN([--with-tcl argument should refer to directory containing tclConfig.sh, not to tclConfig.sh itself])
           70  +			    with_tclconfig=`echo ${with_tclconfig} | sed 's!/tclConfig\.sh$!!'`
           71  +			fi ;;
           72  +		esac
    53     73   		if test -f "${with_tclconfig}/tclConfig.sh" ; then
    54     74   		    ac_cv_c_tclconfig=`(cd ${with_tclconfig}; pwd)`
    55     75   		else
    56     76   		    AC_MSG_ERROR([${with_tclconfig} directory doesn't contain tclConfig.sh])
    57     77   		fi
    58     78   	    fi
    59     79   
    60     80   	    # then check for a private Tcl installation
    61     81   	    if test x"${ac_cv_c_tclconfig}" = x ; then
    62     82   		for i in \
    63     83   			../tcl \
           84  +			`ls -dr ../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
           85  +			`ls -dr ../tcl[[8-9]].[[0-9]] 2>/dev/null` \
    64     86   			`ls -dr ../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
    65     87   			../../tcl \
           88  +			`ls -dr ../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
           89  +			`ls -dr ../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
    66     90   			`ls -dr ../../tcl[[8-9]].[[0-9]]* 2>/dev/null` \
    67     91   			../../../tcl \
           92  +			`ls -dr ../../../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
           93  +			`ls -dr ../../../tcl[[8-9]].[[0-9]] 2>/dev/null` \
    68     94   			`ls -dr ../../../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
    69     95   		    if test -f "$i/unix/tclConfig.sh" ; then
    70     96   			ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
    71     97   			break
    72     98   		    fi
    73     99   		done
    74    100   	    fi
          101  +
          102  +	    # on Darwin, check in Framework installation locations
          103  +	    if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tclconfig}" = x ; then
          104  +		for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
          105  +			`ls -d /Library/Frameworks 2>/dev/null` \
          106  +			`ls -d /Network/Library/Frameworks 2>/dev/null` \
          107  +			`ls -d /System/Library/Frameworks 2>/dev/null` \
          108  +			; do
          109  +		    if test -f "$i/Tcl.framework/tclConfig.sh" ; then
          110  +			ac_cv_c_tclconfig=`(cd $i/Tcl.framework; pwd)`
          111  +			break
          112  +		    fi
          113  +		done
          114  +	    fi
          115  +
          116  +	    # on Windows, check in common installation locations
          117  +	    if test "${TEA_PLATFORM}" = "windows" \
          118  +		-a x"${ac_cv_c_tclconfig}" = x ; then
          119  +		for i in `ls -d C:/Tcl/lib 2>/dev/null` \
          120  +			`ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
          121  +			; do
          122  +		    if test -f "$i/tclConfig.sh" ; then
          123  +			ac_cv_c_tclconfig=`(cd $i; pwd)`
          124  +			break
          125  +		    fi
          126  +		done
          127  +	    fi
    75    128   
    76    129   	    # check in a few common install locations
    77    130   	    if test x"${ac_cv_c_tclconfig}" = x ; then
    78         -		for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \
          131  +		for i in `ls -d ${libdir} 2>/dev/null` \
          132  +			`ls -d ${exec_prefix}/lib 2>/dev/null` \
    79    133   			`ls -d ${prefix}/lib 2>/dev/null` \
    80    134   			`ls -d /usr/local/lib 2>/dev/null` \
    81    135   			`ls -d /usr/contrib/lib 2>/dev/null` \
    82    136   			`ls -d /usr/lib 2>/dev/null` \
    83    137   			; do
    84    138   		    if test -f "$i/tclConfig.sh" ; then
    85    139   			ac_cv_c_tclconfig=`(cd $i; pwd)`
................................................................................
    88    142   		done
    89    143   	    fi
    90    144   
    91    145   	    # check in a few other private locations
    92    146   	    if test x"${ac_cv_c_tclconfig}" = x ; then
    93    147   		for i in \
    94    148   			${srcdir}/../tcl \
          149  +			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
          150  +			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]] 2>/dev/null` \
    95    151   			`ls -dr ${srcdir}/../tcl[[8-9]].[[0-9]]* 2>/dev/null` ; do
    96    152   		    if test -f "$i/unix/tclConfig.sh" ; then
    97    153   		    ac_cv_c_tclconfig=`(cd $i/unix; pwd)`
    98    154   		    break
    99    155   		fi
   100    156   		done
   101    157   	    fi
   102    158   	])
   103    159   
   104    160   	if test x"${ac_cv_c_tclconfig}" = x ; then
   105    161   	    TCL_BIN_DIR="# no Tcl configs found"
   106         -	    AC_MSG_WARN("Cannot find Tcl configuration definitions")
          162  +	    AC_MSG_WARN([Can't find Tcl configuration definitions])
   107    163   	    exit 0
   108    164   	else
   109    165   	    no_tcl=
   110    166   	    TCL_BIN_DIR=${ac_cv_c_tclconfig}
   111         -	    AC_MSG_RESULT([found $TCL_BIN_DIR/tclConfig.sh])
          167  +	    AC_MSG_RESULT([found ${TCL_BIN_DIR}/tclConfig.sh])
   112    168   	fi
   113    169       fi
   114    170   ])
   115    171   
   116    172   #------------------------------------------------------------------------
   117    173   # TEA_PATH_TKCONFIG --
   118    174   #
................................................................................
   127    183   #		--with-tk=...
   128    184   #
   129    185   #	Defines the following vars:
   130    186   #		TK_BIN_DIR	Full path to the directory containing
   131    187   #				the tkConfig.sh file
   132    188   #------------------------------------------------------------------------
   133    189   
   134         -AC_DEFUN(TEA_PATH_TKCONFIG, [
          190  +AC_DEFUN([TEA_PATH_TKCONFIG], [
   135    191       #
   136    192       # Ok, lets find the tk configuration
   137    193       # First, look for one uninstalled.
   138    194       # the alternative search directory is invoked by --with-tk
   139    195       #
   140    196   
   141    197       if test x"${no_tk}" = x ; then
   142    198   	# we reset no_tk in case something fails here
   143    199   	no_tk=true
   144         -	AC_ARG_WITH(tk, [  --with-tk               directory containing tk configuration (tkConfig.sh)], with_tkconfig=${withval})
          200  +	AC_ARG_WITH(tk,
          201  +	    AC_HELP_STRING([--with-tk],
          202  +		[directory containing tk configuration (tkConfig.sh)]),
          203  +	    with_tkconfig=${withval})
   145    204   	AC_MSG_CHECKING([for Tk configuration])
   146    205   	AC_CACHE_VAL(ac_cv_c_tkconfig,[
   147    206   
   148    207   	    # First check to see if --with-tkconfig was specified.
   149    208   	    if test x"${with_tkconfig}" != x ; then
          209  +		case ${with_tkconfig} in
          210  +		    */tkConfig.sh )
          211  +			if test -f ${with_tkconfig}; then
          212  +			    AC_MSG_WARN([--with-tk argument should refer to directory containing tkConfig.sh, not to tkConfig.sh itself])
          213  +			    with_tkconfig=`echo ${with_tkconfig} | sed 's!/tkConfig\.sh$!!'`
          214  +			fi ;;
          215  +		esac
   150    216   		if test -f "${with_tkconfig}/tkConfig.sh" ; then
   151    217   		    ac_cv_c_tkconfig=`(cd ${with_tkconfig}; pwd)`
   152    218   		else
   153    219   		    AC_MSG_ERROR([${with_tkconfig} directory doesn't contain tkConfig.sh])
   154    220   		fi
   155    221   	    fi
   156    222   
   157    223   	    # then check for a private Tk library
   158    224   	    if test x"${ac_cv_c_tkconfig}" = x ; then
   159    225   		for i in \
   160    226   			../tk \
          227  +			`ls -dr ../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
          228  +			`ls -dr ../tk[[8-9]].[[0-9]] 2>/dev/null` \
   161    229   			`ls -dr ../tk[[8-9]].[[0-9]]* 2>/dev/null` \
   162    230   			../../tk \
          231  +			`ls -dr ../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
          232  +			`ls -dr ../../tk[[8-9]].[[0-9]] 2>/dev/null` \
   163    233   			`ls -dr ../../tk[[8-9]].[[0-9]]* 2>/dev/null` \
   164    234   			../../../tk \
          235  +			`ls -dr ../../../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
          236  +			`ls -dr ../../../tk[[8-9]].[[0-9]] 2>/dev/null` \
   165    237   			`ls -dr ../../../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
   166    238   		    if test -f "$i/unix/tkConfig.sh" ; then
   167    239   			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
   168    240   			break
   169    241   		    fi
   170    242   		done
   171    243   	    fi
          244  +
          245  +	    # on Darwin, check in Framework installation locations
          246  +	    if test "`uname -s`" = "Darwin" -a x"${ac_cv_c_tkconfig}" = x ; then
          247  +		for i in `ls -d ~/Library/Frameworks 2>/dev/null` \
          248  +			`ls -d /Library/Frameworks 2>/dev/null` \
          249  +			`ls -d /Network/Library/Frameworks 2>/dev/null` \
          250  +			`ls -d /System/Library/Frameworks 2>/dev/null` \
          251  +			; do
          252  +		    if test -f "$i/Tk.framework/tkConfig.sh" ; then
          253  +			ac_cv_c_tkconfig=`(cd $i/Tk.framework; pwd)`
          254  +			break
          255  +		    fi
          256  +		done
          257  +	    fi
          258  +
   172    259   	    # check in a few common install locations
   173    260   	    if test x"${ac_cv_c_tkconfig}" = x ; then
   174         -		for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \
          261  +		for i in `ls -d ${libdir} 2>/dev/null` \
          262  +			`ls -d ${exec_prefix}/lib 2>/dev/null` \
   175    263   			`ls -d ${prefix}/lib 2>/dev/null` \
   176    264   			`ls -d /usr/local/lib 2>/dev/null` \
   177    265   			`ls -d /usr/contrib/lib 2>/dev/null` \
   178    266   			`ls -d /usr/lib 2>/dev/null` \
   179    267   			; do
   180    268   		    if test -f "$i/tkConfig.sh" ; then
   181    269   			ac_cv_c_tkconfig=`(cd $i; pwd)`
   182    270   			break
   183    271   		    fi
   184    272   		done
   185    273   	    fi
          274  +
          275  +	    # on Windows, check in common installation locations
          276  +	    if test "${TEA_PLATFORM}" = "windows" \
          277  +		-a x"${ac_cv_c_tkconfig}" = x ; then
          278  +		for i in `ls -d C:/Tcl/lib 2>/dev/null` \
          279  +			`ls -d C:/Progra~1/Tcl/lib 2>/dev/null` \
          280  +			; do
          281  +		    if test -f "$i/tkConfig.sh" ; then
          282  +			ac_cv_c_tkconfig=`(cd $i; pwd)`
          283  +			break
          284  +		    fi
          285  +		done
          286  +	    fi
          287  +
   186    288   	    # check in a few other private locations
   187    289   	    if test x"${ac_cv_c_tkconfig}" = x ; then
   188    290   		for i in \
   189    291   			${srcdir}/../tk \
          292  +			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]].[[0-9]]* 2>/dev/null` \
          293  +			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]] 2>/dev/null` \
   190    294   			`ls -dr ${srcdir}/../tk[[8-9]].[[0-9]]* 2>/dev/null` ; do
   191    295   		    if test -f "$i/unix/tkConfig.sh" ; then
   192    296   			ac_cv_c_tkconfig=`(cd $i/unix; pwd)`
   193    297   			break
   194    298   		    fi
   195    299   		done
   196    300   	    fi
   197    301   	])
          302  +
   198    303   	if test x"${ac_cv_c_tkconfig}" = x ; then
   199    304   	    TK_BIN_DIR="# no Tk configs found"
   200         -	    AC_MSG_WARN("Cannot find Tk configuration definitions")
          305  +	    AC_MSG_WARN([Can't find Tk configuration definitions])
   201    306   	    exit 0
   202    307   	else
   203    308   	    no_tk=
   204    309   	    TK_BIN_DIR=${ac_cv_c_tkconfig}
   205         -	    AC_MSG_RESULT([found $TK_BIN_DIR/tkConfig.sh])
          310  +	    AC_MSG_RESULT([found ${TK_BIN_DIR}/tkConfig.sh])
   206    311   	fi
   207    312       fi
   208         -
   209    313   ])
   210    314   
   211    315   #------------------------------------------------------------------------
   212    316   # TEA_LOAD_TCLCONFIG --
   213    317   #
   214    318   #	Load the tclConfig.sh file
   215    319   #
................................................................................
   223    327   #	Subst the following vars:
   224    328   #		TCL_BIN_DIR
   225    329   #		TCL_SRC_DIR
   226    330   #		TCL_LIB_FILE
   227    331   #
   228    332   #------------------------------------------------------------------------
   229    333   
   230         -AC_DEFUN(TEA_LOAD_TCLCONFIG, [
   231         -    AC_MSG_CHECKING([for existence of $TCL_BIN_DIR/tclConfig.sh])
          334  +AC_DEFUN([TEA_LOAD_TCLCONFIG], [
          335  +    AC_MSG_CHECKING([for existence of ${TCL_BIN_DIR}/tclConfig.sh])
   232    336   
   233         -    if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
          337  +    if test -f "${TCL_BIN_DIR}/tclConfig.sh" ; then
   234    338           AC_MSG_RESULT([loading])
   235         -	. $TCL_BIN_DIR/tclConfig.sh
          339  +	. ${TCL_BIN_DIR}/tclConfig.sh
   236    340       else
   237         -        AC_MSG_RESULT([file not found])
          341  +        AC_MSG_RESULT([could not find ${TCL_BIN_DIR}/tclConfig.sh])
   238    342       fi
   239    343   
   240         -    #
          344  +    # eval is required to do the TCL_DBGX substitution
          345  +    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
          346  +    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
          347  +
   241    348       # If the TCL_BIN_DIR is the build directory (not the install directory),
   242    349       # then set the common variable name to the value of the build variables.
   243    350       # For example, the variable TCL_LIB_SPEC will be set to the value
   244    351       # of TCL_BUILD_LIB_SPEC. An extension should make use of TCL_LIB_SPEC
   245    352       # instead of TCL_BUILD_LIB_SPEC since it will work with both an
   246    353       # installed and uninstalled version of Tcl.
   247         -    #
   248         -
   249         -    if test -f $TCL_BIN_DIR/Makefile ; then
          354  +    if test -f ${TCL_BIN_DIR}/Makefile ; then
   250    355           TCL_LIB_SPEC=${TCL_BUILD_LIB_SPEC}
   251    356           TCL_STUB_LIB_SPEC=${TCL_BUILD_STUB_LIB_SPEC}
   252    357           TCL_STUB_LIB_PATH=${TCL_BUILD_STUB_LIB_PATH}
          358  +    elif test "`uname -s`" = "Darwin"; then
          359  +	# If Tcl was built as a framework, attempt to use the libraries
          360  +	# from the framework at the given location so that linking works
          361  +	# against Tcl.framework installed in an arbitary location.
          362  +	case ${TCL_DEFS} in
          363  +	    *TCL_FRAMEWORK*)
          364  +		if test -f ${TCL_BIN_DIR}/${TCL_LIB_FILE}; then
          365  +		    for i in "`cd ${TCL_BIN_DIR}; pwd`" \
          366  +			     "`cd ${TCL_BIN_DIR}/../..; pwd`"; do
          367  +			if test "`basename "$i"`" = "${TCL_LIB_FILE}.framework"; then
          368  +			    TCL_LIB_SPEC="-F`dirname "$i"` -framework ${TCL_LIB_FILE}"
          369  +			    break
          370  +			fi
          371  +		    done
          372  +		fi
          373  +		if test -f ${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}; then
          374  +		    TCL_STUB_LIB_SPEC="-L${TCL_BIN_DIR} ${TCL_STUB_LIB_FLAG}"
          375  +		    TCL_STUB_LIB_PATH="${TCL_BIN_DIR}/${TCL_STUB_LIB_FILE}"
          376  +		fi
          377  +		;;
          378  +	esac
   253    379       fi
   254    380   
   255         -    #
   256    381       # eval is required to do the TCL_DBGX substitution
   257         -    #
   258         -
   259         -    eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
   260    382       eval "TCL_LIB_FLAG=\"${TCL_LIB_FLAG}\""
   261    383       eval "TCL_LIB_SPEC=\"${TCL_LIB_SPEC}\""
   262         -
   263         -    eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
   264    384       eval "TCL_STUB_LIB_FLAG=\"${TCL_STUB_LIB_FLAG}\""
   265    385       eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
   266    386   
   267    387       AC_SUBST(TCL_VERSION)
   268    388       AC_SUBST(TCL_BIN_DIR)
   269    389       AC_SUBST(TCL_SRC_DIR)
   270    390   
................................................................................
   277    397       AC_SUBST(TCL_STUB_LIB_SPEC)
   278    398   
   279    399       AC_SUBST(TCL_LIBS)
   280    400       AC_SUBST(TCL_DEFS)
   281    401       AC_SUBST(TCL_EXTRA_CFLAGS)
   282    402       AC_SUBST(TCL_LD_FLAGS)
   283    403       AC_SUBST(TCL_SHLIB_LD_LIBS)
   284         -    #AC_SUBST(TCL_BUILD_LIB_SPEC)
   285         -    #AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
   286    404   ])
   287    405   
   288    406   #------------------------------------------------------------------------
   289    407   # TEA_LOAD_TKCONFIG --
   290    408   #
   291    409   #	Load the tkConfig.sh file
   292    410   #
................................................................................
   297    415   #
   298    416   # Results:
   299    417   #
   300    418   #	Sets the following vars that should be in tkConfig.sh:
   301    419   #		TK_BIN_DIR
   302    420   #------------------------------------------------------------------------
   303    421   
   304         -AC_DEFUN(TEA_LOAD_TKCONFIG, [
          422  +AC_DEFUN([TEA_LOAD_TKCONFIG], [
   305    423       AC_MSG_CHECKING([for existence of ${TK_BIN_DIR}/tkConfig.sh])
   306    424   
   307    425       if test -f "${TK_BIN_DIR}/tkConfig.sh" ; then
   308    426           AC_MSG_RESULT([loading])
   309         -	. $TK_BIN_DIR/tkConfig.sh
          427  +	. ${TK_BIN_DIR}/tkConfig.sh
   310    428       else
   311    429           AC_MSG_RESULT([could not find ${TK_BIN_DIR}/tkConfig.sh])
   312    430       fi
   313    431   
   314         -    #
          432  +    # eval is required to do the TK_DBGX substitution
          433  +    eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
          434  +    eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
          435  +
   315    436       # If the TK_BIN_DIR is the build directory (not the install directory),
   316    437       # then set the common variable name to the value of the build variables.
   317    438       # For example, the variable TK_LIB_SPEC will be set to the value
   318    439       # of TK_BUILD_LIB_SPEC. An extension should make use of TK_LIB_SPEC
   319    440       # instead of TK_BUILD_LIB_SPEC since it will work with both an
   320    441       # installed and uninstalled version of Tcl.
   321         -    #
   322         -
   323         -    if test -f $TK_BIN_DIR/Makefile ; then
          442  +    if test -f ${TK_BIN_DIR}/Makefile ; then
   324    443           TK_LIB_SPEC=${TK_BUILD_LIB_SPEC}
   325    444           TK_STUB_LIB_SPEC=${TK_BUILD_STUB_LIB_SPEC}
   326    445           TK_STUB_LIB_PATH=${TK_BUILD_STUB_LIB_PATH}
          446  +    elif test "`uname -s`" = "Darwin"; then
          447  +	# If Tk was built as a framework, attempt to use the libraries
          448  +	# from the framework at the given location so that linking works
          449  +	# against Tk.framework installed in an arbitary location.
          450  +	case ${TK_DEFS} in
          451  +	    *TK_FRAMEWORK*)
          452  +		if test -f ${TK_BIN_DIR}/${TK_LIB_FILE}; then
          453  +		    for i in "`cd ${TK_BIN_DIR}; pwd`" \
          454  +			     "`cd ${TK_BIN_DIR}/../..; pwd`"; do
          455  +			if test "`basename "$i"`" = "${TK_LIB_FILE}.framework"; then
          456  +			    TK_LIB_SPEC="-F`dirname "$i"` -framework ${TK_LIB_FILE}"
          457  +			    break
          458  +			fi
          459  +		    done
          460  +		fi
          461  +		if test -f ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}; then
          462  +		    TK_STUB_LIB_SPEC="-L${TK_BIN_DIR} ${TK_STUB_LIB_FLAG}"
          463  +		    TK_STUB_LIB_PATH="${TK_BIN_DIR}/${TK_STUB_LIB_FILE}"
          464  +		fi
          465  +		;;
          466  +	esac
   327    467       fi
   328    468   
   329         -    #
   330    469       # eval is required to do the TK_DBGX substitution
   331         -    #
   332         -
   333         -    eval "TK_LIB_FILE=\"${TK_LIB_FILE}\""
   334    470       eval "TK_LIB_FLAG=\"${TK_LIB_FLAG}\""
   335    471       eval "TK_LIB_SPEC=\"${TK_LIB_SPEC}\""
   336         -
   337         -    eval "TK_STUB_LIB_FILE=\"${TK_STUB_LIB_FILE}\""
   338    472       eval "TK_STUB_LIB_FLAG=\"${TK_STUB_LIB_FLAG}\""
   339    473       eval "TK_STUB_LIB_SPEC=\"${TK_STUB_LIB_SPEC}\""
          474  +
          475  +    # Ensure windowingsystem is defined
          476  +    if test "${TEA_PLATFORM}" = "unix" ; then
          477  +	case ${TK_DEFS} in
          478  +	    *MAC_OSX_TK*)
          479  +		AC_DEFINE(MAC_OSX_TK, 1, [Are we building against Mac OS X TkAqua?])
          480  +		TEA_WINDOWINGSYSTEM="aqua"
          481  +		;;
          482  +	    *)
          483  +		TEA_WINDOWINGSYSTEM="x11"
          484  +		;;
          485  +	esac
          486  +    elif test "${TEA_PLATFORM}" = "windows" ; then
          487  +	TEA_WINDOWINGSYSTEM="win32"
          488  +    fi
   340    489   
   341    490       AC_SUBST(TK_VERSION)
   342    491       AC_SUBST(TK_BIN_DIR)
   343    492       AC_SUBST(TK_SRC_DIR)
   344    493   
   345    494       AC_SUBST(TK_LIB_FILE)
   346    495       AC_SUBST(TK_LIB_FLAG)
................................................................................
   371    520   #		STATIC_BUILD	Used for building import/export libraries
   372    521   #				on Windows.
   373    522   #
   374    523   #	Sets the following vars:
   375    524   #		SHARED_BUILD	Value of 1 or 0
   376    525   #------------------------------------------------------------------------
   377    526   
   378         -AC_DEFUN(TEA_ENABLE_SHARED, [
          527  +AC_DEFUN([TEA_ENABLE_SHARED], [
   379    528       AC_MSG_CHECKING([how to build libraries])
   380    529       AC_ARG_ENABLE(shared,
   381         -	[  --enable-shared         build and link with shared libraries [--enable-shared]],
          530  +	AC_HELP_STRING([--enable-shared],
          531  +	    [build and link with shared libraries (default: on)]),
   382    532   	[tcl_ok=$enableval], [tcl_ok=yes])
   383    533   
   384    534       if test "${enable_shared+set}" = set; then
   385    535   	enableval="$enable_shared"
   386    536   	tcl_ok=$enableval
   387    537       else
   388    538   	tcl_ok=yes
................................................................................
   390    540   
   391    541       if test "$tcl_ok" = "yes" ; then
   392    542   	AC_MSG_RESULT([shared])
   393    543   	SHARED_BUILD=1
   394    544       else
   395    545   	AC_MSG_RESULT([static])
   396    546   	SHARED_BUILD=0
   397         -	AC_DEFINE(STATIC_BUILD)
          547  +	AC_DEFINE(STATIC_BUILD, 1, [Is this a static build?])
   398    548       fi
   399    549       AC_SUBST(SHARED_BUILD)
   400    550   ])
   401    551   
   402    552   #------------------------------------------------------------------------
   403    553   # TEA_ENABLE_THREADS --
   404    554   #
   405         -#	Specify if thread support should be enabled.  If "yes" is
   406         -#	specified as an arg (optional), threads are enabled by default.
          555  +#	Specify if thread support should be enabled.  If "yes" is specified
          556  +#	as an arg (optional), threads are enabled by default, "no" means
          557  +#	threads are disabled.  "yes" is the default.
          558  +#
   407    559   #	TCL_THREADS is checked so that if you are compiling an extension
   408    560   #	against a threaded core, your extension must be compiled threaded
   409    561   #	as well.
          562  +#
          563  +#	Note that it is legal to have a thread enabled extension run in a
          564  +#	threaded or non-threaded Tcl core, but a non-threaded extension may
          565  +#	only run in a non-threaded Tcl core.
   410    566   #
   411    567   # Arguments:
   412    568   #	none
   413    569   #	
   414    570   # Results:
   415    571   #
   416    572   #	Adds the following arguments to configure:
................................................................................
   418    574   #
   419    575   #	Sets the following vars:
   420    576   #		THREADS_LIBS	Thread library(s)
   421    577   #
   422    578   #	Defines the following vars:
   423    579   #		TCL_THREADS
   424    580   #		_REENTRANT
          581  +#		_THREAD_SAFE
   425    582   #
   426    583   #------------------------------------------------------------------------
   427    584   
   428         -AC_DEFUN(TEA_ENABLE_THREADS, [
   429         -    AC_ARG_ENABLE(threads, [  --enable-threads        build with threads],
   430         -	[tcl_ok=$enableval], [tcl_ok=$1])
          585  +AC_DEFUN([TEA_ENABLE_THREADS], [
          586  +    AC_ARG_ENABLE(threads,
          587  +	AC_HELP_STRING([--enable-threads],
          588  +	    [build with threads]),
          589  +	[tcl_ok=$enableval], [tcl_ok=yes])
          590  +
          591  +    if test "${enable_threads+set}" = set; then
          592  +	enableval="$enable_threads"
          593  +	tcl_ok=$enableval
          594  +    else
          595  +	tcl_ok=yes
          596  +    fi
   431    597   
   432    598       if test "$tcl_ok" = "yes" -o "${TCL_THREADS}" = 1; then
   433    599   	TCL_THREADS=1
   434    600   
   435    601   	if test "${TEA_PLATFORM}" != "windows" ; then
   436         -	    # We are always OK on Windows, so check what this platform wants.
   437         -	    AC_DEFINE(USE_THREAD_ALLOC)
   438         -	    AC_DEFINE(_REENTRANT)
   439         -	    AC_DEFINE(_THREAD_SAFE)
          602  +	    # We are always OK on Windows, so check what this platform wants:
          603  +    
          604  +	    # USE_THREAD_ALLOC tells us to try the special thread-based
          605  +	    # allocator that significantly reduces lock contention
          606  +	    AC_DEFINE(USE_THREAD_ALLOC, 1,
          607  +		[Do we want to use the threaded memory allocator?])
          608  +	    AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
          609  +	    if test "`uname -s`" = "SunOS" ; then
          610  +		AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
          611  +			[Do we really want to follow the standard? Yes we do!])
          612  +	    fi
          613  +	    AC_DEFINE(_THREAD_SAFE, 1, [Do we want the thread-safe OS API?])
   440    614   	    AC_CHECK_LIB(pthread,pthread_mutex_init,tcl_ok=yes,tcl_ok=no)
   441    615   	    if test "$tcl_ok" = "no"; then
   442         -		# Check a little harder for __pthread_mutex_init in the
   443         -		# same library, as some systems hide it there until
   444         -		# pthread.h is defined.	 We could alternatively do an
   445         -		# AC_TRY_COMPILE with pthread.h, but that will work with
   446         -		# libpthread really doesn't exist, like AIX 4.2.
   447         -		# [Bug: 4359]
          616  +		# Check a little harder for __pthread_mutex_init in the same
          617  +		# library, as some systems hide it there until pthread.h is
          618  +		# defined.  We could alternatively do an AC_TRY_COMPILE with
          619  +		# pthread.h, but that will work with libpthread really doesn't
          620  +		# exist, like AIX 4.2.  [Bug: 4359]
   448    621   		AC_CHECK_LIB(pthread, __pthread_mutex_init,
   449    622   		    tcl_ok=yes, tcl_ok=no)
   450    623   	    fi
   451         -	    
          624  +
   452    625   	    if test "$tcl_ok" = "yes"; then
   453    626   		# The space is needed
   454    627   		THREADS_LIBS=" -lpthread"
   455    628   	    else
   456    629   		AC_CHECK_LIB(pthreads, pthread_mutex_init,
   457    630   		    tcl_ok=yes, tcl_ok=no)
   458    631   		if test "$tcl_ok" = "yes"; then
................................................................................
   465    638   			AC_CHECK_LIB(c_r, pthread_mutex_init,
   466    639   			    tcl_ok=yes, tcl_ok=no)
   467    640   			if test "$tcl_ok" = "yes"; then
   468    641   			    # The space is needed
   469    642   			    THREADS_LIBS=" -pthread"
   470    643   			else
   471    644   			    TCL_THREADS=0
   472         -			    AC_MSG_WARN("Don t know how to find pthread lib on your system - thread support disabled")
          645  +			    AC_MSG_WARN([Do not know how to find pthread lib on your system - thread support disabled])
   473    646   			fi
   474    647   		    fi
   475    648   		fi
   476    649   	    fi
   477         -
   478         -	    # Does the pthread-implementation provide
   479         -	    # 'pthread_attr_setstacksize' ?
   480         -
   481         -	    ac_saved_libs=$LIBS
   482         -	    LIBS="$LIBS $THREADS_LIBS"
   483         -	    AC_CHECK_FUNCS(pthread_attr_setstacksize)
   484         -	    LIBS=$ac_saved_libs
   485         -	    AC_CHECK_FUNCS(readdir_r)
   486    650   	fi
   487    651       else
   488    652   	TCL_THREADS=0
   489    653       fi
   490    654       # Do checking message here to not mess up interleaved configure output
   491    655       AC_MSG_CHECKING([for building with threads])
   492         -    if test "${TCL_THREADS}" = "1"; then
   493         -	AC_DEFINE(TCL_THREADS)
   494         -	#LIBS="$LIBS $THREADS_LIBS"
   495         -	AC_MSG_RESULT([yes])
          656  +    if test "${TCL_THREADS}" = 1; then
          657  +	AC_DEFINE(TCL_THREADS, 1, [Are we building with threads enabled?])
          658  +	AC_MSG_RESULT([yes (default)])
   496    659       else
   497         -	AC_MSG_RESULT([no (default)])
          660  +	AC_MSG_RESULT([no])
   498    661       fi
   499    662       # TCL_THREADS sanity checking.  See if our request for building with
   500    663       # threads is the same as the way Tcl was built.  If not, warn the user.
   501    664       case ${TCL_DEFS} in
   502    665   	*THREADS=1*)
   503    666   	    if test "${TCL_THREADS}" = "0"; then
   504    667   		AC_MSG_WARN([
   505         -    Building ${PACKAGE_NAME} without threads enabled, but building against a Tcl
   506         -    that IS thread-enabled.])
          668  +    Building ${PACKAGE_NAME} without threads enabled, but building against Tcl
          669  +    that IS thread-enabled.  It is recommended to use --enable-threads.])
   507    670   	    fi
   508    671   	    ;;
   509    672   	*)
   510    673   	    if test "${TCL_THREADS}" = "1"; then
   511    674   		AC_MSG_WARN([
   512         -    --enable-threads requested, but attempting building against a Tcl
   513         -    that is NOT thread-enabled.])
          675  +    --enable-threads requested, but building against a Tcl that is NOT
          676  +    thread-enabled.  This is an OK configuration that will also run in
          677  +    a thread-enabled core.])
   514    678   	    fi
   515    679   	    ;;
   516    680       esac
   517    681       AC_SUBST(TCL_THREADS)
   518    682   ])
   519    683   
   520    684   #------------------------------------------------------------------------
   521    685   # TEA_ENABLE_SYMBOLS --
   522    686   #
   523         -#	Specify if debugging symbols should be used
          687  +#	Specify if debugging symbols should be used.
   524    688   #	Memory (TCL_MEM_DEBUG) debugging can also be enabled.
   525    689   #
   526    690   # Arguments:
   527    691   #	none
   528    692   #	
   529         -#	Requires the following vars to be set:
   530         -#		CFLAGS_DEBUG
   531         -#		CFLAGS_OPTIMIZE
   532         -#		LDFLAGS_DEBUG
   533         -#		LDFLAGS_OPTIMIZE
          693  +#	TEA varies from core Tcl in that C|LDFLAGS_DEFAULT receives
          694  +#	the value of C|LDFLAGS_OPTIMIZE|DEBUG already substituted.
          695  +#	Requires the following vars to be set in the Makefile:
          696  +#		CFLAGS_DEFAULT
          697  +#		LDFLAGS_DEFAULT
   534    698   #	
   535    699   # Results:
   536    700   #
   537    701   #	Adds the following arguments to configure:
   538    702   #		--enable-symbols
   539    703   #
   540    704   #	Defines the following vars:
   541         -#		CFLAGS_DEFAULT	Sets to CFLAGS_DEBUG if true
   542         -#				Sets to CFLAGS_OPTIMIZE if false
   543         -#		LDFLAGS_DEFAULT	Sets to LDFLAGS_DEBUG if true
   544         -#				Sets to LDFLAGS_OPTIMIZE if false
          705  +#		CFLAGS_DEFAULT	Sets to $(CFLAGS_DEBUG) if true
          706  +#				Sets to $(CFLAGS_OPTIMIZE) if false
          707  +#		LDFLAGS_DEFAULT	Sets to $(LDFLAGS_DEBUG) if true
          708  +#				Sets to $(LDFLAGS_OPTIMIZE) if false
   545    709   #		DBGX		Formerly used as debug library extension;
   546    710   #				always blank now.
   547    711   #
   548    712   #------------------------------------------------------------------------
   549    713   
   550         -AC_DEFUN(TEA_ENABLE_SYMBOLS, [
          714  +AC_DEFUN([TEA_ENABLE_SYMBOLS], [
   551    715       dnl Make sure we are initialized
   552    716       AC_REQUIRE([TEA_CONFIG_CFLAGS])
   553         -
   554         -    DBGX=""
   555         -
   556    717       AC_MSG_CHECKING([for build with symbols])
   557         -    AC_ARG_ENABLE(symbols, [  --enable-symbols        build with debugging symbols [--disable-symbols]],    [tcl_ok=$enableval], [tcl_ok=no])
          718  +    AC_ARG_ENABLE(symbols,
          719  +	AC_HELP_STRING([--enable-symbols],
          720  +	    [build with debugging symbols (default: off)]),
          721  +	[tcl_ok=$enableval], [tcl_ok=no])
          722  +    DBGX=""
   558    723       if test "$tcl_ok" = "no"; then
   559    724   	CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
   560    725   	LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
   561    726   	AC_MSG_RESULT([no])
   562    727       else
   563    728   	CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
   564    729   	LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
................................................................................
   571    736       fi
   572    737   
   573    738       AC_SUBST(TCL_DBGX)
   574    739       AC_SUBST(CFLAGS_DEFAULT)
   575    740       AC_SUBST(LDFLAGS_DEFAULT)
   576    741   
   577    742       if test "$tcl_ok" = "mem" -o "$tcl_ok" = "all"; then
   578         -	AC_DEFINE(TCL_MEM_DEBUG)
          743  +	AC_DEFINE(TCL_MEM_DEBUG, 1, [Is memory debugging enabled?])
   579    744       fi
   580    745   
   581    746       if test "$tcl_ok" != "yes" -a "$tcl_ok" != "no"; then
   582    747   	if test "$tcl_ok" = "all"; then
   583    748   	    AC_MSG_RESULT([enabled symbols mem debugging])
   584    749   	else
   585    750   	    AC_MSG_RESULT([enabled $tcl_ok debugging])
................................................................................
   602    767   #		--enable-langinfo=yes|no (default is yes)
   603    768   #
   604    769   #	Defines the following vars:
   605    770   #		HAVE_LANGINFO	Triggers use of nl_langinfo if defined.
   606    771   #
   607    772   #------------------------------------------------------------------------
   608    773   
   609         -AC_DEFUN(TEA_ENABLE_LANGINFO, [
          774  +AC_DEFUN([TEA_ENABLE_LANGINFO], [
   610    775       AC_ARG_ENABLE(langinfo,
   611         -	[  --enable-langinfo	  use nl_langinfo if possible to determine
   612         -			  encoding at startup, otherwise use old heuristic],
          776  +	AC_HELP_STRING([--enable-langinfo],
          777  +	    [use nl_langinfo if possible to determine encoding at startup, otherwise use old heuristic (default: on)]),
   613    778   	[langinfo_ok=$enableval], [langinfo_ok=yes])
   614    779   
   615    780       HAVE_LANGINFO=0
   616    781       if test "$langinfo_ok" = "yes"; then
   617         -	if test "$langinfo_ok" = "yes"; then
   618         -	    AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
   619         -	fi
          782  +	AC_CHECK_HEADER(langinfo.h,[langinfo_ok=yes],[langinfo_ok=no])
   620    783       fi
   621    784       AC_MSG_CHECKING([whether to use nl_langinfo])
   622    785       if test "$langinfo_ok" = "yes"; then
   623         -	AC_TRY_COMPILE([#include <langinfo.h>],
   624         -		[nl_langinfo(CODESET);],[langinfo_ok=yes],[langinfo_ok=no])
   625         -	if test "$langinfo_ok" = "no"; then
   626         -	    langinfo_ok="no (could not compile with nl_langinfo)";
   627         -	fi
   628         -	if test "$langinfo_ok" = "yes"; then
   629         -	    AC_DEFINE(HAVE_LANGINFO)
   630         -	fi
   631         -    fi
   632         -    AC_MSG_RESULT([$langinfo_ok])
          786  +	AC_CACHE_VAL(tcl_cv_langinfo_h,
          787  +	    AC_TRY_COMPILE([#include <langinfo.h>], [nl_langinfo(CODESET);],
          788  +		    [tcl_cv_langinfo_h=yes],[tcl_cv_langinfo_h=no]))
          789  +	AC_MSG_RESULT([$tcl_cv_langinfo_h])
          790  +	if test $tcl_cv_langinfo_h = yes; then
          791  +	    AC_DEFINE(HAVE_LANGINFO, 1, [Do we have nl_langinfo()?])
          792  +	fi
          793  +    else 
          794  +	AC_MSG_RESULT([$langinfo_ok])
          795  +    fi
          796  +])
          797  +
          798  +#--------------------------------------------------------------------
          799  +# TEA_CONFIG_SYSTEM
          800  +#
          801  +#	Determine what the system is (some things cannot be easily checked
          802  +#	on a feature-driven basis, alas). This can usually be done via the
          803  +#	"uname" command, but there are a few systems, like Next, where
          804  +#	this doesn't work.
          805  +#
          806  +# Arguments:
          807  +#	none
          808  +#
          809  +# Results:
          810  +#	Defines the following var:
          811  +#
          812  +#	system -	System/platform/version identification code.
          813  +#
          814  +#--------------------------------------------------------------------
          815  +
          816  +AC_DEFUN([TEA_CONFIG_SYSTEM], [
          817  +    AC_CACHE_CHECK([system version], tcl_cv_sys_version, [
          818  +	if test "${TEA_PLATFORM}" = "windows" ; then
          819  +	    tcl_cv_sys_version=windows
          820  +	elif test -f /usr/lib/NextStep/software_version; then
          821  +	    tcl_cv_sys_version=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
          822  +	else
          823  +	    tcl_cv_sys_version=`uname -s`-`uname -r`
          824  +	    if test "$?" -ne 0 ; then
          825  +		AC_MSG_WARN([can't find uname command])
          826  +		tcl_cv_sys_version=unknown
          827  +	    else
          828  +		# Special check for weird MP-RAS system (uname returns weird
          829  +		# results, and the version is kept in special file).
          830  +
          831  +		if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
          832  +		    tcl_cv_sys_version=MP-RAS-`awk '{print [$]3}' /etc/.relid`
          833  +		fi
          834  +		if test "`uname -s`" = "AIX" ; then
          835  +		    tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
          836  +		fi
          837  +	    fi
          838  +	fi
          839  +    ])
          840  +    system=$tcl_cv_sys_version
   633    841   ])
   634    842   
   635    843   #--------------------------------------------------------------------
   636    844   # TEA_CONFIG_CFLAGS
   637    845   #
   638    846   #	Try to determine the proper flags to pass to the compiler
   639    847   #	for building shared libraries and other such nonsense.
   640    848   #
   641    849   # Arguments:
   642    850   #	none
   643    851   #
   644    852   # Results:
   645    853   #
   646         -#	Defines the following vars:
          854  +#	Defines and substitutes the following vars:
   647    855   #
   648    856   #       DL_OBJS -       Name of the object file that implements dynamic
   649    857   #                       loading for Tcl on this system.
   650    858   #       DL_LIBS -       Library file(s) to include in tclsh and other base
   651    859   #                       applications in order for the "load" command to work.
   652    860   #       LDFLAGS -      Flags to pass to the compiler when linking object
   653    861   #                       files into an executable application binary such
   654    862   #                       as tclsh.
   655    863   #       LD_SEARCH_FLAGS-Flags to pass to ld, such as "-R /usr/local/tcl/lib",
   656    864   #                       that tell the run-time dynamic linker where to look
          865  +#                       for shared libraries such as libtcl.so.  Depends on
          866  +#                       the variable LIB_RUNTIME_DIR in the Makefile. Could
          867  +#                       be the same as CC_SEARCH_FLAGS if ${CC} is used to link.
          868  +#       CC_SEARCH_FLAGS-Flags to pass to ${CC}, such as "-Wl,-rpath,/usr/local/tcl/lib",
          869  +#                       that tell the run-time dynamic linker where to look
   657    870   #                       for shared libraries such as libtcl.so.  Depends on
   658    871   #                       the variable LIB_RUNTIME_DIR in the Makefile.
   659    872   #       SHLIB_CFLAGS -  Flags to pass to cc when compiling the components
   660    873   #                       of a shared library (may request position-independent
   661    874   #                       code, among other things).
   662    875   #       SHLIB_LD -      Base command to use for combining object files
   663    876   #                       into a shared library.
................................................................................
   671    884   #                       SunOS 4.x, where they cause the link to fail, or in
   672    885   #                       general if Tcl and Tk aren't themselves shared
   673    886   #                       libraries), then this symbol has an empty string
   674    887   #                       as its value.
   675    888   #       SHLIB_SUFFIX -  Suffix to use for the names of dynamically loadable
   676    889   #                       extensions.  An empty string means we don't know how
   677    890   #                       to use shared libraries on this platform.
   678         -#       TCL_LIB_FILE -  Name of the file that contains the Tcl library, such
   679         -#                       as libtcl7.8.so or libtcl7.8.a.
   680         -#       TCL_LIB_SUFFIX -Specifies everything that comes after the "libtcl"
   681         -#                       in the shared library name, using the
   682         -#                       ${PACKAGE_VERSION} variable to put the version in
   683         -#                       the right place.  This is used by platforms that
   684         -#                       need non-standard library names.
   685         -#                       Examples:  ${PACKAGE_VERSION}.so.1.1 on NetBSD,
   686         -#                       since it needs to have a version after the .so, and
   687         -#                       ${PACKAGE_VERSION}.a on AIX, since the Tcl shared
   688         -#                       library needs to have a .a extension whereas shared
   689         -#                       objects for loadable extensions have a .so
   690         -#                       extension.  Defaults to
   691         -#                       ${PACKAGE_VERSION}${SHLIB_SUFFIX}.
          891  +#       LIB_SUFFIX -    Specifies everything that comes after the "libfoo"
          892  +#                       in a static or shared library name, using the $VERSION variable
          893  +#                       to put the version in the right place.  This is used
          894  +#                       by platforms that need non-standard library names.
          895  +#                       Examples:  ${VERSION}.so.1.1 on NetBSD, since it needs
          896  +#                       to have a version after the .so, and ${VERSION}.a
          897  +#                       on AIX, since a shared library needs to have
          898  +#                       a .a extension whereas shared objects for loadable
          899  +#                       extensions have a .so extension.  Defaults to
          900  +#                       ${VERSION}${SHLIB_SUFFIX}.
   692    901   #       TCL_NEEDS_EXP_FILE -
   693    902   #                       1 means that an export file is needed to link to a
   694    903   #                       shared library.
   695    904   #       TCL_EXP_FILE -  The name of the installed export / import file which
   696    905   #                       should be used to link to the Tcl shared library.
   697    906   #                       Empty if Tcl is unshared.
   698    907   #       TCL_BUILD_EXP_FILE -
................................................................................
   699    908   #                       The name of the built export / import file which
   700    909   #                       should be used to link to the Tcl shared library.
   701    910   #                       Empty if Tcl is unshared.
   702    911   #	CFLAGS_DEBUG -
   703    912   #			Flags used when running the compiler in debug mode
   704    913   #	CFLAGS_OPTIMIZE -
   705    914   #			Flags used when running the compiler in optimize mode
   706         -#	CFLAGS -	We add CFLAGS to pass to the compiler
          915  +#	CFLAGS -	Additional CFLAGS added as necessary (usually 64-bit)
   707    916   #
   708         -#	Subst's the following vars:
   709         -#		DL_LIBS
   710         -#		CFLAGS_DEBUG
   711         -#		CFLAGS_OPTIMIZE
   712         -#		CFLAGS_WARNING
   713         -#
   714         -#		STLIB_LD
   715         -#		SHLIB_LD
   716         -#		SHLIB_CFLAGS
   717         -#		LDFLAGS_DEBUG
   718         -#		LDFLAGS_OPTIMIZE
   719    917   #--------------------------------------------------------------------
   720    918   
   721         -AC_DEFUN(TEA_CONFIG_CFLAGS, [
          919  +AC_DEFUN([TEA_CONFIG_CFLAGS], [
   722    920       dnl Make sure we are initialized
   723    921       AC_REQUIRE([TEA_INIT])
   724    922   
   725         -    # Step 0: Enable 64 bit support?
          923  +    # Step 0.a: Enable 64 bit support?
   726    924   
   727         -    AC_MSG_CHECKING([if 64bit support is enabled])
   728         -    AC_ARG_ENABLE(64bit,[  --enable-64bit          enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no])
          925  +    AC_MSG_CHECKING([if 64bit support is requested])
          926  +    AC_ARG_ENABLE(64bit,
          927  +	AC_HELP_STRING([--enable-64bit],
          928  +	    [enable 64bit support (default: off)]),
          929  +	[do64bit=$enableval], [do64bit=no])
   729    930       AC_MSG_RESULT([$do64bit])
   730         - 
          931  +
   731    932       # Step 0.b: Enable Solaris 64 bit VIS support?
   732    933   
   733    934       AC_MSG_CHECKING([if 64bit Sparc VIS support is requested])
   734         -    AC_ARG_ENABLE(64bit-vis,[  --enable-64bit-vis      enable 64bit Sparc VIS support], [do64bitVIS=$enableval], [do64bitVIS=no])
          935  +    AC_ARG_ENABLE(64bit-vis,
          936  +	AC_HELP_STRING([--enable-64bit-vis],
          937  +	    [enable 64bit Sparc VIS support (default: off)]),
          938  +	[do64bitVIS=$enableval], [do64bitVIS=no])
   735    939       AC_MSG_RESULT([$do64bitVIS])
   736    940   
   737    941       if test "$do64bitVIS" = "yes"; then
   738    942   	# Force 64bit on with VIS
   739    943   	do64bit=yes
   740    944       fi
   741    945   
   742    946       # Step 0.c: Cross-compiling options for Windows/CE builds?
   743    947   
   744    948       if test "${TEA_PLATFORM}" = "windows" ; then
   745    949   	AC_MSG_CHECKING([if Windows/CE build is requested])
   746    950   	AC_ARG_ENABLE(wince,[  --enable-wince          enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no])
   747         -	AC_MSG_RESULT($doWince)
          951  +	AC_MSG_RESULT([$doWince])
   748    952       fi
   749    953   
   750    954       # Step 1: set the variable "system" to hold the name and version number
   751         -    # for the system.  This can usually be done via the "uname" command, but
   752         -    # there are a few systems, like Next, where this doesn't work.
          955  +    # for the system.
   753    956   
   754         -    AC_MSG_CHECKING([system version (for dynamic loading)])
   755         -    if test -f /usr/lib/NextStep/software_version; then
   756         -	system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
   757         -    else
   758         -	system=`uname -s`-`uname -r`
   759         -	if test "$?" -ne 0 ; then
   760         -	    AC_MSG_RESULT([unknown (can't find uname command)])
   761         -	    system=unknown
   762         -	else
   763         -	    # Special check for weird MP-RAS system (uname returns weird
   764         -	    # results, and the version is kept in special file).
   765         -	
   766         -	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
   767         -		system=MP-RAS-`awk '{print $3}' /etc/.relid'`
   768         -	    fi
   769         -	    if test "`uname -s`" = "AIX" ; then
   770         -		system=AIX-`uname -v`.`uname -r`
   771         -	    fi
   772         -	    if test "${TEA_PLATFORM}" = "windows" ; then
   773         -		system=windows
   774         -	    fi
   775         -	    AC_MSG_RESULT([$system])
   776         -	fi
   777         -    fi
          957  +    TEA_CONFIG_SYSTEM
   778    958   
   779    959       # Step 2: check for existence of -ldl library.  This is needed because
   780    960       # Linux can use either -ldl or -ldld for dynamic loading.
   781    961   
   782    962       AC_CHECK_LIB(dl, dlopen, have_dl=yes, have_dl=no)
          963  +
          964  +    # Require ranlib early so we can override it in special cases below.
          965  +
          966  +    AC_REQUIRE([AC_PROG_RANLIB])
   783    967   
   784    968       # Step 3: set configuration options based on system name and version.
   785    969       # This is similar to Tcl's unix/tcl.m4 except that we've added a
   786         -    # "windows" case and CC_SEARCH_FLAGS becomes LD_SEARCH_FLAGS for us
   787         -    # (and we have no CC_SEARCH_FLAGS).
          970  +    # "windows" case.
   788    971   
   789    972       do64bit_ok=no
   790    973       LDFLAGS_ORIG="$LDFLAGS"
          974  +    # When ld needs options to work in 64-bit mode, put them in
          975  +    # LDFLAGS_ARCH so they eventually end up in LDFLAGS even if [load]
          976  +    # is disabled by the user. [Bug 1016796]
          977  +    LDFLAGS_ARCH=""
   791    978       TCL_EXPORT_FILE_SUFFIX=""
   792    979       UNSHARED_LIB_SUFFIX=""
   793    980       TCL_TRIM_DOTS='`echo ${PACKAGE_VERSION} | tr -d .`'
   794    981       ECHO_VERSION='`echo ${PACKAGE_VERSION}`'
   795    982       TCL_LIB_VERSIONS_OK=ok
   796    983       CFLAGS_DEBUG=-g
          984  +    CFLAGS_OPTIMIZE=-O
   797    985       if test "$GCC" = "yes" ; then
   798    986   	CFLAGS_OPTIMIZE=-O2
   799    987   	CFLAGS_WARNING="-Wall -Wno-implicit-int"
   800    988       else
   801         -	CFLAGS_OPTIMIZE=-O
   802    989   	CFLAGS_WARNING=""
   803    990       fi
   804    991       TCL_NEEDS_EXP_FILE=0
   805    992       TCL_BUILD_EXP_FILE=""
   806    993       TCL_EXP_FILE=""
   807    994   dnl FIXME: Replace AC_CHECK_PROG with AC_CHECK_TOOL once cross compiling is fixed.
   808         -dnl AC_CHECK_TOOL(AR, ar, :)
          995  +dnl AC_CHECK_TOOL(AR, ar)
   809    996       AC_CHECK_PROG(AR, ar, ar)
   810    997       STLIB_LD='${AR} cr'
   811    998       LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH"
   812    999       case $system in
   813   1000   	windows)
   814   1001   	    # This is a 2-stage check to make sure we have the 64-bit SDK
   815   1002   	    # We have to know where the SDK is installed.
   816         -	    if test "$do64bit" = "yes" ; then
         1003  +	    # This magic is based on MS Platform SDK for Win2003 SP1 - hobbs
         1004  +	    # MACHINE is IX86 for LINK, but this is used by the manifest,
         1005  +	    # which requires x86|amd64|ia64.
         1006  +	    MACHINE="X86"
         1007  +	    if test "$do64bit" != "no" ; then
   817   1008   		if test "x${MSSDK}x" = "xx" ; then
   818         -		    MSSDK="C:/Progra~1/Microsoft SDK"
         1009  +		    MSSDK="C:/Progra~1/Microsoft Platform SDK"
   819   1010   		fi
   820         -		# Ensure that this path has no spaces to work in autoconf
   821         -		TEA_PATH_NOSPACE(MSSDK, ${MSSDK})
   822         -		if test ! -d "${MSSDK}/bin/win64" ; then
   823         -		    AC_MSG_WARN([could not find 64-bit SDK to enable 64bit mode])
         1011  +		MSSDK=`echo "$MSSDK" | sed -e  's!\\\!/!g'`
         1012  +		PATH64=""
         1013  +		case "$do64bit" in
         1014  +		    amd64|x64|yes)
         1015  +			MACHINE="AMD64" ; # default to AMD64 64-bit build
         1016  +			PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
         1017  +			;;
         1018  +		    ia64)
         1019  +			MACHINE="IA64"
         1020  +			PATH64="${MSSDK}/Bin/Win64"
         1021  +			;;
         1022  +		esac
         1023  +		if test ! -d "${PATH64}" ; then
         1024  +		    AC_MSG_WARN([Could not find 64-bit $MACHINE SDK to enable 64bit mode])
         1025  +		    AC_MSG_WARN([Ensure latest Platform SDK is installed])
   824   1026   		    do64bit="no"
   825   1027   		else
         1028  +		    AC_MSG_RESULT([   Using 64-bit $MACHINE mode])
   826   1029   		    do64bit_ok="yes"
   827   1030   		fi
   828   1031   	    fi
   829   1032   
   830   1033   	    if test "$doWince" != "no" ; then
   831         -		if test "$do64bit" = "yes" ; then
         1034  +		if test "$do64bit" != "no" ; then
   832   1035   		    AC_MSG_ERROR([Windows/CE and 64-bit builds incompatible])
   833   1036   		fi
   834   1037   		if test "$GCC" = "yes" ; then
   835   1038   		    AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
   836   1039   		fi
   837   1040   		TEA_PATH_CELIB
   838   1041   		# Set defaults for common evc4/PPC2003 setup
................................................................................
   865   1068   		fi
   866   1069   		if test "x${SDKROOT}" = "x" ; then
   867   1070   		    SDKROOT="C:/Program Files/Windows CE Tools"
   868   1071   		    if test ! -d "${SDKROOT}" ; then
   869   1072   			SDKROOT="C:/Windows CE Tools"
   870   1073   		    fi
   871   1074   		fi
   872         -		# Ensure that this path has no spaces to work in autoconf
   873         -		TEA_PATH_NOSPACE(WCEROOT, ${WCEROOT})
   874         -		TEA_PATH_NOSPACE(SDKROOT, ${SDKROOT})
         1075  +		WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
         1076  +		SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
   875   1077   		if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
   876   1078   		    -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
   877   1079   		    AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
   878   1080   		    doWince="no"
   879   1081   		else
   880   1082   		    # We could PATH_NOSPACE these, but that's not important,
   881   1083   		    # as long as we quote them when used.
................................................................................
   890   1092   	    if test "$GCC" != "yes" ; then
   891   1093   	        if test "${SHARED_BUILD}" = "0" ; then
   892   1094   		    runtime=-MT
   893   1095   	        else
   894   1096   		    runtime=-MD
   895   1097   	        fi
   896   1098   
   897         -                if test "$do64bit" = "yes" ; then
         1099  +                if test "$do64bit" != "no" ; then
   898   1100   		    # All this magic is necessary for the Win64 SDK RC1 - hobbs
   899         -		    CC="${MSSDK}/Bin/Win64/cl.exe"
   900         -		    CFLAGS="${CFLAGS} -I${MSSDK}/Include/prerelease \
   901         -			-I${MSSDK}/Include/Win64/crt \
   902         -			-I${MSSDK}/Include"
   903         -		    RC="${MSSDK}/bin/rc.exe"
   904         -		    lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \
   905         -			-LIBPATH:${MSSDK}/Lib/Prerelease/IA64 -nologo"
   906         -		    LINKBIN="${MSSDK}/bin/win64/link.exe"
         1101  +		    CC="\"${PATH64}/cl.exe\""
         1102  +		    CFLAGS="${CFLAGS} -I\"${MSSDK}/Include\" -I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
         1103  +		    RC="\"${MSSDK}/bin/rc.exe\""
         1104  +		    lflags="-nologo -MACHINE:${MACHINE} -LIBPATH:\"${MSSDK}/Lib/${MACHINE}\""
         1105  +		    LINKBIN="\"${PATH64}/link.exe\""
   907   1106   		    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
   908   1107   		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
         1108  +		    # Avoid 'unresolved external symbol __security_cookie'
         1109  +		    # errors, c.f. http://support.microsoft.com/?id=894573
         1110  +		    TEA_ADD_LIBS([bufferoverflowU.lib])
   909   1111   		elif test "$doWince" != "no" ; then
   910   1112   		    CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
   911   1113   		    if test "${TARGETCPU}" = "X86"; then
   912         -			CC="${CEBINROOT}/cl.exe"
         1114  +			CC="\"${CEBINROOT}/cl.exe\""
   913   1115   		    else
   914         -			CC="${CEBINROOT}/cl${ARCH}.exe"
         1116  +			CC="\"${CEBINROOT}/cl${ARCH}.exe\""
   915   1117   		    fi
   916   1118   		    CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
   917         -		    RC="${WCEROOT}/Common/EVC/bin/rc.exe"
         1119  +		    RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
   918   1120   		    arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
   919   1121   		    defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _WINDOWS"
   920   1122   		    if test "${SHARED_BUILD}" = "1" ; then
   921   1123   			# Static CE builds require static celib as well
   922   1124   		    	defs="${defs} _DLL"
   923   1125   		    fi
   924   1126   		    for i in $defs ; do
   925         -			AC_DEFINE_UNQUOTED($i)
         1127  +			AC_DEFINE_UNQUOTED($i, 1, [WinCE def ]$i)
   926   1128   		    done
   927         -		    AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION)
   928         -		    AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION)
         1129  +		    AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION, [_WIN32_WCE version])
         1130  +		    AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION, [UNDER_CE version])
   929   1131   		    CFLAGS_DEBUG="-nologo -Zi -Od"
   930   1132   		    CFLAGS_OPTIMIZE="-nologo -Ox"
   931   1133   		    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
   932   1134   		    lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
   933         -		    LINKBIN="${CEBINROOT}/link.exe"
         1135  +		    LINKBIN="\"${CEBINROOT}/link.exe\""
   934   1136   		    AC_SUBST(CELIB_DIR)
   935   1137   		else
   936   1138   		    RC="rc"
   937   1139   		    lflags="-nologo"
   938   1140       		    LINKBIN="link"
   939   1141   		    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
   940   1142   		    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
................................................................................
   977   1179   	    TCL_LIB_VERSIONS_OK=nodots
   978   1180   	    # Bogus to avoid getting this turned off
   979   1181   	    DL_OBJS="tclLoadNone.obj"
   980   1182       	    ;;
   981   1183   	AIX-*)
   982   1184   	    if test "${TCL_THREADS}" = "1" -a "$GCC" != "yes" ; then
   983   1185   		# AIX requires the _r compiler when gcc isn't being used
   984         -		if test "${CC}" != "cc_r" ; then
   985         -		    CC=${CC}_r
   986         -		fi
         1186  +		case "${CC}" in
         1187  +		    *_r)
         1188  +			# ok ...
         1189  +			;;
         1190  +		    *)
         1191  +			CC=${CC}_r
         1192  +			;;
         1193  +		esac
   987   1194   		AC_MSG_RESULT([Using $CC for compiling with threads])
   988   1195   	    fi
   989   1196   	    LIBS="$LIBS -lc"
   990   1197   	    SHLIB_CFLAGS=""
         1198  +	    SHLIB_LD_LIBS='${LIBS}'
   991   1199   	    SHLIB_SUFFIX=".so"
   992         -	    SHLIB_LD_LIBS='${LIBS}'
   993   1200   
   994   1201   	    DL_OBJS="tclLoadDl.o"
   995   1202   	    LD_LIBRARY_PATH_VAR="LIBPATH"
   996   1203   
   997         -	    # AIX v<=4.1 has some different flags than 4.2+
   998         -	    if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
   999         -		#LIBOBJS="$LIBOBJS tclLoadAix.o"
  1000         -		AC_LIBOBJ([tclLoadAix])
  1001         -		DL_LIBS="-lld"
  1002         -	    fi
  1003         -
  1004   1204   	    # Check to enable 64-bit flags for compiler/linker on AIX 4+
  1005   1205   	    if test "$do64bit" = "yes" -a "`uname -v`" -gt "3" ; then
  1006   1206   		if test "$GCC" = "yes" ; then
  1007         -		    AC_MSG_WARN("64bit mode not supported with GCC on $system")
         1207  +		    AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1008   1208   		else 
  1009   1209   		    do64bit_ok=yes
  1010   1210   		    CFLAGS="$CFLAGS -q64"
  1011         -		    LDFLAGS="$LDFLAGS -q64"
         1211  +		    LDFLAGS_ARCH="-q64"
  1012   1212   		    RANLIB="${RANLIB} -X64"
  1013   1213   		    AR="${AR} -X64"
  1014   1214   		    SHLIB_LD_FLAGS="-b64"
  1015   1215   		fi
  1016   1216   	    fi
  1017   1217   
  1018   1218   	    if test "`uname -m`" = "ia64" ; then
  1019   1219   		# AIX-5 uses ELF style dynamic libraries on IA-64, but not PPC
  1020   1220   		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1021   1221   		# AIX-5 has dl* in libc.so
  1022   1222   		DL_LIBS=""
  1023   1223   		if test "$GCC" = "yes" ; then
  1024         -		    LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
         1224  +		    CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1025   1225   		else
  1026         -		    LD_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
         1226  +		    CC_SEARCH_FLAGS='-R${LIB_RUNTIME_DIR}'
  1027   1227   		fi
         1228  +		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1028   1229   	    else
  1029   1230   		if test "$GCC" = "yes" ; then
  1030   1231   		    SHLIB_LD="gcc -shared"
  1031   1232   		else
  1032   1233   		    SHLIB_LD="/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry"
  1033   1234   		fi
  1034   1235   		SHLIB_LD="${TCL_SRC_DIR}/unix/ldAix ${SHLIB_LD} ${SHLIB_LD_FLAGS}"
  1035   1236   		DL_LIBS="-ldl"
  1036         -		LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
         1237  +		CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
         1238  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1037   1239   		TCL_NEEDS_EXP_FILE=1
  1038   1240   		TCL_EXPORT_FILE_SUFFIX='${PACKAGE_VERSION}.exp'
  1039   1241   	    fi
         1242  +
         1243  +	    # AIX v<=4.1 has some different flags than 4.2+
         1244  +	    if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
         1245  +		AC_LIBOBJ([tclLoadAix])
         1246  +		DL_LIBS="-lld"
         1247  +	    fi
  1040   1248   
  1041   1249   	    # On AIX <=v4 systems, libbsd.a has to be linked in to support
  1042   1250   	    # non-blocking file IO.  This library has to be linked in after
  1043   1251   	    # the MATH_LIBS or it breaks the pow() function.  The way to
  1044   1252   	    # insure proper sequencing, is to add it to the tail of MATH_LIBS.
  1045   1253   	    # This library also supplies gettimeofday.
  1046   1254   	    #
................................................................................
  1049   1257   	    # methods are to be avoided for timezone deduction instead, we
  1050   1258   	    # deduce the timezone by comparing the localtime result on a
  1051   1259   	    # known GMT value.
  1052   1260   
  1053   1261   	    AC_CHECK_LIB(bsd, gettimeofday, libbsd=yes, libbsd=no)
  1054   1262   	    if test $libbsd = yes; then
  1055   1263   	    	MATH_LIBS="$MATH_LIBS -lbsd"
  1056         -	    	AC_DEFINE(USE_DELTA_FOR_TZ)
         1264  +	    	AC_DEFINE(USE_DELTA_FOR_TZ, 1, [Do we need a special AIX hack for timezones?])
  1057   1265   	    fi
  1058   1266   	    ;;
  1059   1267   	BeOS*)
  1060   1268   	    SHLIB_CFLAGS="-fPIC"
  1061   1269   	    SHLIB_LD="${CC} -nostart"
  1062   1270   	    SHLIB_LD_LIBS='${LIBS}'
  1063   1271   	    SHLIB_SUFFIX=".so"
  1064   1272   	    DL_OBJS="tclLoadDl.o"
  1065   1273   	    DL_LIBS="-ldl"
         1274  +
         1275  +	    #-----------------------------------------------------------
         1276  +	    # Check for inet_ntoa in -lbind, for BeOS (which also needs
         1277  +	    # -lsocket, even if the network functions are in -lnet which
         1278  +	    # is always linked to, for compatibility.
         1279  +	    #-----------------------------------------------------------
         1280  +	    AC_CHECK_LIB(bind, inet_ntoa, [LIBS="$LIBS -lbind -lsocket"])
  1066   1281   	    ;;
  1067   1282   	BSD/OS-2.1*|BSD/OS-3*)
  1068   1283   	    SHLIB_CFLAGS=""
  1069   1284   	    SHLIB_LD="shlicc -r"
  1070   1285   	    SHLIB_LD_LIBS='${LIBS}'
  1071   1286   	    SHLIB_SUFFIX=".so"
  1072   1287   	    DL_OBJS="tclLoadDl.o"
  1073   1288   	    DL_LIBS="-ldl"
         1289  +	    CC_SEARCH_FLAGS=""
  1074   1290   	    LD_SEARCH_FLAGS=""
  1075   1291   	    ;;
  1076   1292   	BSD/OS-4.*)
  1077   1293   	    SHLIB_CFLAGS="-export-dynamic -fPIC"
  1078   1294   	    SHLIB_LD="cc -shared"
  1079   1295   	    SHLIB_LD_LIBS='${LIBS}'
  1080   1296   	    SHLIB_SUFFIX=".so"
  1081   1297   	    DL_OBJS="tclLoadDl.o"
  1082   1298   	    DL_LIBS="-ldl"
  1083   1299   	    LDFLAGS="$LDFLAGS -export-dynamic"
         1300  +	    CC_SEARCH_FLAGS=""
  1084   1301   	    LD_SEARCH_FLAGS=""
  1085   1302   	    ;;
  1086   1303   	dgux*)
  1087   1304   	    SHLIB_CFLAGS="-K PIC"
  1088   1305   	    SHLIB_LD="cc -G"
  1089   1306   	    SHLIB_LD_LIBS=""
  1090   1307   	    SHLIB_SUFFIX=".so"
  1091   1308   	    DL_OBJS="tclLoadDl.o"
  1092   1309   	    DL_LIBS="-ldl"
         1310  +	    CC_SEARCH_FLAGS=""
  1093   1311   	    LD_SEARCH_FLAGS=""
  1094   1312   	    ;;
  1095   1313   	HP-UX-*.11.*)
  1096   1314   	    # Use updated header definitions where possible
  1097         -	    AC_DEFINE(_XOPEN_SOURCE_EXTENDED)
         1315  +	    AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1, [Do we want to use the XOPEN network library?])
         1316  +	    # Needed by Tcl, but not most extensions
         1317  +	    #AC_DEFINE(_XOPEN_SOURCE, 1, [Do we want to use the XOPEN network library?])
         1318  +	    #LIBS="$LIBS -lxnet"               # Use the XOPEN network library
  1098   1319   
  1099   1320   	    SHLIB_SUFFIX=".sl"
  1100   1321   	    AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  1101   1322   	    if test "$tcl_ok" = yes; then
  1102   1323   		SHLIB_CFLAGS="+z"
  1103   1324   		SHLIB_LD="ld -b"
  1104   1325   		SHLIB_LD_LIBS='${LIBS}'
  1105   1326   		DL_OBJS="tclLoadShl.o"
  1106   1327   		DL_LIBS="-ldld"
  1107   1328   		LDFLAGS="$LDFLAGS -Wl,-E"
  1108         -		LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
         1329  +		CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
         1330  +		LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
  1109   1331   		LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1110   1332   	    fi
  1111   1333   	    if test "$GCC" = "yes" ; then
  1112   1334   		SHLIB_LD="gcc -shared"
  1113   1335   		SHLIB_LD_LIBS='${LIBS}'
  1114         -		LD_SEARCH_FLAGS=''
         1336  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1115   1337   	    fi
  1116   1338   
  1117   1339   	    # Users may want PA-RISC 1.1/2.0 portable code - needs HP cc
  1118   1340   	    #CFLAGS="$CFLAGS +DAportable"
  1119   1341   
  1120   1342   	    # Check to enable 64-bit flags for compiler/linker
  1121   1343   	    if test "$do64bit" = "yes" ; then
................................................................................
  1123   1345   		    hpux_arch=`${CC} -dumpmachine`
  1124   1346   		    case $hpux_arch in
  1125   1347   			hppa64*)
  1126   1348   			    # 64-bit gcc in use.  Fix flags for GNU ld.
  1127   1349   			    do64bit_ok=yes
  1128   1350   			    SHLIB_LD="${CC} -shared"
  1129   1351   			    SHLIB_LD_LIBS='${LIBS}'
  1130         -			    LD_SEARCH_FLAGS=''
         1352  +			    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1353  +			    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1131   1354   			    ;;
  1132   1355   			*)
  1133         -			    AC_MSG_WARN("64bit mode not supported with GCC on $system")
         1356  +			    AC_MSG_WARN([64bit mode not supported with GCC on $system])
  1134   1357   			    ;;
  1135   1358   		    esac
  1136   1359   		else
  1137   1360   		    do64bit_ok=yes
  1138   1361   		    CFLAGS="$CFLAGS +DD64"
  1139         -		    LDFLAGS="$LDFLAGS +DD64"
         1362  +		    LDFLAGS_ARCH="+DD64"
  1140   1363   		fi
  1141   1364   	    fi
  1142   1365   	    ;;
  1143   1366   	HP-UX-*.08.*|HP-UX-*.09.*|HP-UX-*.10.*)
  1144   1367   	    SHLIB_SUFFIX=".sl"
  1145   1368   	    AC_CHECK_LIB(dld, shl_load, tcl_ok=yes, tcl_ok=no)
  1146   1369   	    if test "$tcl_ok" = yes; then
  1147   1370   		SHLIB_CFLAGS="+z"
  1148   1371   		SHLIB_LD="ld -b"
  1149   1372   		SHLIB_LD_LIBS=""
  1150   1373   		DL_OBJS="tclLoadShl.o"
  1151   1374   		DL_LIBS="-ldld"
  1152   1375   		LDFLAGS="$LDFLAGS -Wl,-E"
  1153         -		LD_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
         1376  +		CC_SEARCH_FLAGS='-Wl,+s,+b,${LIB_RUNTIME_DIR}:.'
         1377  +		LD_SEARCH_FLAGS='+s +b ${LIB_RUNTIME_DIR}:.'
         1378  +		LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1154   1379   	    fi
  1155         -	    LD_LIBRARY_PATH_VAR="SHLIB_PATH"
  1156         -	    ;;
  1157         -	IRIX-4.*)
  1158         -	    SHLIB_CFLAGS="-G 0"
  1159         -	    SHLIB_SUFFIX=".a"
  1160         -	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  1161         -	    SHLIB_LD_LIBS='${LIBS}'
  1162         -	    DL_OBJS="tclLoadAout.o"
  1163         -	    DL_LIBS=""
  1164         -	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  1165         -	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1166         -	    SHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
  1167   1380   	    ;;
  1168   1381   	IRIX-5.*)
  1169   1382   	    SHLIB_CFLAGS=""
  1170   1383   	    SHLIB_LD="ld -shared -rdata_shared"
  1171   1384   	    SHLIB_LD_LIBS='${LIBS}'
  1172   1385   	    SHLIB_SUFFIX=".so"
  1173   1386   	    DL_OBJS="tclLoadDl.o"
  1174   1387   	    DL_LIBS=""
  1175         -	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1388  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1389  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1176   1390   	    ;;
  1177         -	IRIX-6.*|IRIX64-6.5*)
         1391  +	IRIX-6.*)
  1178   1392   	    SHLIB_CFLAGS=""
  1179   1393   	    SHLIB_LD="ld -n32 -shared -rdata_shared"
  1180   1394   	    SHLIB_LD_LIBS='${LIBS}'
  1181   1395   	    SHLIB_SUFFIX=".so"
  1182   1396   	    DL_OBJS="tclLoadDl.o"
  1183   1397   	    DL_LIBS=""
  1184         -	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1398  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1399  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1185   1400   	    if test "$GCC" = "yes" ; then
  1186   1401   		CFLAGS="$CFLAGS -mabi=n32"
  1187   1402   		LDFLAGS="$LDFLAGS -mabi=n32"
  1188   1403   	    else
  1189   1404   		case $system in
  1190   1405   		    IRIX-6.3)
  1191   1406   			# Use to build 6.2 compatible binaries on 6.3.
................................................................................
  1201   1416   	IRIX64-6.*)
  1202   1417   	    SHLIB_CFLAGS=""
  1203   1418   	    SHLIB_LD="ld -n32 -shared -rdata_shared"
  1204   1419   	    SHLIB_LD_LIBS='${LIBS}'
  1205   1420   	    SHLIB_SUFFIX=".so"
  1206   1421   	    DL_OBJS="tclLoadDl.o"
  1207   1422   	    DL_LIBS=""
  1208         -	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1423  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1424  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1209   1425   
  1210   1426   	    # Check to enable 64-bit flags for compiler/linker
  1211   1427   
  1212   1428   	    if test "$do64bit" = "yes" ; then
  1213   1429   	        if test "$GCC" = "yes" ; then
  1214   1430   	            AC_MSG_WARN([64bit mode not supported by gcc])
  1215   1431   	        else
  1216   1432   	            do64bit_ok=yes
  1217   1433   	            SHLIB_LD="ld -64 -shared -rdata_shared"
  1218   1434   	            CFLAGS="$CFLAGS -64"
  1219         -	            LDFLAGS="$LDFLAGS -64"
         1435  +	            LDFLAGS_ARCH="-64"
  1220   1436   	        fi
  1221   1437   	    fi
  1222   1438   	    ;;
  1223   1439   	Linux*)
  1224   1440   	    SHLIB_CFLAGS="-fPIC"
  1225   1441   	    SHLIB_LD_LIBS='${LIBS}'
  1226   1442   	    SHLIB_SUFFIX=".so"
  1227   1443   
  1228   1444   	    CFLAGS_OPTIMIZE="-O2 -fomit-frame-pointer"
  1229   1445   	    # egcs-2.91.66 on Redhat Linux 6.0 generates lots of warnings 
  1230   1446   	    # when you inline the string and math operations.  Turn this off to
  1231   1447   	    # get rid of the warnings.
  1232         -
  1233   1448   	    #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
  1234   1449   
  1235         -	    if test "$have_dl" = yes; then
  1236         -		SHLIB_LD="${CC} -shared"
  1237         -		DL_OBJS="tclLoadDl.o"
  1238         -		DL_LIBS="-ldl"
  1239         -		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  1240         -		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1241         -	    else
  1242         -		AC_CHECK_HEADER(dld.h, [
  1243         -		    SHLIB_LD="ld -shared"
  1244         -		    DL_OBJS="tclLoadDld.o"
  1245         -		    DL_LIBS="-ldld"
  1246         -		    LD_SEARCH_FLAGS=""])
  1247         -	    fi
         1450  +	    SHLIB_LD="${CC} -shared"
         1451  +	    DL_OBJS="tclLoadDl.o"
         1452  +	    DL_LIBS="-ldl"
         1453  +	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
         1454  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1455  +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1248   1456   	    if test "`uname -m`" = "alpha" ; then
  1249   1457   		CFLAGS="$CFLAGS -mieee"
  1250   1458   	    fi
  1251   1459   
  1252   1460   	    # The combo of gcc + glibc has a bug related
  1253   1461   	    # to inlining of functions like strtod(). The
  1254   1462   	    # -fno-builtin flag should address this problem
................................................................................
  1262   1470   
  1263   1471   	    ;;
  1264   1472   	GNU*)
  1265   1473   	    SHLIB_CFLAGS="-fPIC"
  1266   1474   	    SHLIB_LD_LIBS='${LIBS}'
  1267   1475   	    SHLIB_SUFFIX=".so"
  1268   1476   
  1269         -	    if test "$have_dl" = yes; then
  1270         -		SHLIB_LD="${CC} -shared"
  1271         -		DL_OBJS=""
  1272         -		DL_LIBS="-ldl"
  1273         -		LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
  1274         -		LD_SEARCH_FLAGS=""
  1275         -	    else
  1276         -		AC_CHECK_HEADER(dld.h, [
  1277         -		    SHLIB_LD="ld -shared"
  1278         -		    DL_OBJS=""
  1279         -		    DL_LIBS="-ldld"
  1280         -		    LD_SEARCH_FLAGS=""])
  1281         -	    fi
         1477  +	    SHLIB_LD="${CC} -shared"
         1478  +	    DL_OBJS=""
         1479  +	    DL_LIBS="-ldl"
         1480  +	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
         1481  +	    CC_SEARCH_FLAGS=""
         1482  +	    LD_SEARCH_FLAGS=""
  1282   1483   	    if test "`uname -m`" = "alpha" ; then
  1283   1484   		CFLAGS="$CFLAGS -mieee"
  1284   1485   	    fi
  1285   1486   	    ;;
         1487  +	Lynx*)
         1488  +	    SHLIB_CFLAGS="-fPIC"
         1489  +	    SHLIB_LD_LIBS='${LIBS}'
         1490  +	    SHLIB_SUFFIX=".so"
         1491  +	    CFLAGS_OPTIMIZE=-02
         1492  +	    SHLIB_LD="${CC} -shared "
         1493  +	    DL_OBJS="tclLoadDl.o"
         1494  +	    DL_LIBS="-mshared -ldl"
         1495  +	    LD_FLAGS="-Wl,--export-dynamic"
         1496  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1497  +	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1498  +	    ;;
  1286   1499   	MP-RAS-02*)
  1287   1500   	    SHLIB_CFLAGS="-K PIC"
  1288   1501   	    SHLIB_LD="cc -G"
  1289   1502   	    SHLIB_LD_LIBS=""
  1290   1503   	    SHLIB_SUFFIX=".so"
  1291   1504   	    DL_OBJS="tclLoadDl.o"
  1292   1505   	    DL_LIBS="-ldl"
         1506  +	    CC_SEARCH_FLAGS=""
  1293   1507   	    LD_SEARCH_FLAGS=""
  1294   1508   	    ;;
  1295   1509   	MP-RAS-*)
  1296   1510   	    SHLIB_CFLAGS="-K PIC"
  1297   1511   	    SHLIB_LD="cc -G"
  1298   1512   	    SHLIB_LD_LIBS=""
  1299   1513   	    SHLIB_SUFFIX=".so"
  1300   1514   	    DL_OBJS="tclLoadDl.o"
  1301   1515   	    DL_LIBS="-ldl"
  1302   1516   	    LDFLAGS="$LDFLAGS -Wl,-Bexport"
         1517  +	    CC_SEARCH_FLAGS=""
  1303   1518   	    LD_SEARCH_FLAGS=""
  1304   1519   	    ;;
  1305   1520   	NetBSD-*|FreeBSD-[[1-2]].*)
  1306         -	    # Not available on all versions:  check for include file.
  1307         -	    AC_CHECK_HEADER(dlfcn.h, [
  1308         -		# NetBSD/SPARC needs -fPIC, -fpic will not do.
  1309         -		SHLIB_CFLAGS="-fPIC"
  1310         -		SHLIB_LD="ld -Bshareable -x"
  1311         -		SHLIB_LD_LIBS=""
  1312         -		SHLIB_SUFFIX=".so"
  1313         -		DL_OBJS="tclLoadDl.o"
  1314         -		DL_LIBS=""
  1315         -		LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1316         -		AC_MSG_CHECKING([for ELF])
         1521  +	    # NetBSD/SPARC needs -fPIC, -fpic will not do.
         1522  +	    SHLIB_CFLAGS="-fPIC"
         1523  +	    SHLIB_LD="ld -Bshareable -x"
         1524  +	    SHLIB_LD_LIBS='${LIBS}'
         1525  +	    SHLIB_SUFFIX=".so"
         1526  +	    DL_OBJS="tclLoadDl.o"
         1527  +	    DL_LIBS=""
         1528  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1529  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
         1530  +	    AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
  1317   1531   		AC_EGREP_CPP(yes, [
  1318   1532   #ifdef __ELF__
  1319   1533   	yes
  1320   1534   #endif
  1321         -		],
  1322         -		    AC_MSG_RESULT([yes])
  1323         -		    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so',
  1324         -		    AC_MSG_RESULT([no])
  1325         -		    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
  1326         -		)
  1327         -	    ], [
  1328         -		SHLIB_CFLAGS=""
  1329         -		SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r"
  1330         -		SHLIB_LD_LIBS='${LIBS}'
  1331         -		SHLIB_SUFFIX=".a"
  1332         -		DL_OBJS="tclLoadAout.o"
  1333         -		DL_LIBS=""
  1334         -		LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1335         -		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1336         -	    ])
         1535  +		], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
         1536  +	    if test $tcl_cv_ld_elf = yes; then
         1537  +		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
         1538  +	    else
         1539  +		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
         1540  +	    fi
  1337   1541   
  1338         -	    # FreeBSD doesn't handle version numbers with dots.
         1542  +	    # Ancient FreeBSD doesn't handle version numbers with dots.
  1339   1543   
  1340   1544   	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1341   1545   	    TCL_LIB_VERSIONS_OK=nodots
  1342   1546   	    ;;
  1343   1547   	OpenBSD-*)
  1344         -	    SHLIB_LD="${CC} -shared"
         1548  +	    # OpenBSD/SPARC[64] needs -fPIC, -fpic will not do.
         1549  +	    case `machine` in
         1550  +	    sparc|sparc64)
         1551  +		SHLIB_CFLAGS="-fPIC";;
         1552  +	    *)
         1553  +		SHLIB_CFLAGS="-fpic";;
         1554  +	    esac
         1555  +	    SHLIB_LD="${CC} -shared ${SHLIB_CFLAGS}"
  1345   1556   	    SHLIB_LD_LIBS='${LIBS}'
  1346   1557   	    SHLIB_SUFFIX=".so"
  1347   1558   	    DL_OBJS="tclLoadDl.o"
  1348   1559   	    DL_LIBS=""
  1349         -	    LD_SEARCH_FLAGS=""
  1350         -	    AC_MSG_CHECKING(for ELF)
  1351         -	    AC_EGREP_CPP(yes, [
         1560  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1561  +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
         1562  +	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
         1563  +	    AC_CACHE_CHECK([for ELF], tcl_cv_ld_elf, [
         1564  +		AC_EGREP_CPP(yes, [
  1352   1565   #ifdef __ELF__
  1353   1566   	yes
  1354   1567   #endif
  1355         -	    ],
  1356         -		[AC_MSG_RESULT(yes)
  1357         -		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'],
  1358         -		[AC_MSG_RESULT(no)
  1359         -		SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0']
  1360         -	    )
         1568  +		], tcl_cv_ld_elf=yes, tcl_cv_ld_elf=no)])
         1569  +	    if test $tcl_cv_ld_elf = yes; then
         1570  +		LDFLAGS=-Wl,-export-dynamic
         1571  +	    else
         1572  +		LDFLAGS=""
         1573  +	    fi
  1361   1574   
  1362   1575   	    # OpenBSD doesn't do version numbers with dots.
  1363   1576   	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1364   1577   	    TCL_LIB_VERSIONS_OK=nodots
  1365   1578   	    ;;
  1366   1579   	FreeBSD-*)
  1367   1580   	    # FreeBSD 3.* and greater have ELF.
................................................................................
  1368   1581   	    SHLIB_CFLAGS="-fPIC"
  1369   1582   	    SHLIB_LD="ld -Bshareable -x"
  1370   1583   	    SHLIB_LD_LIBS='${LIBS}'
  1371   1584   	    SHLIB_SUFFIX=".so"
  1372   1585   	    DL_OBJS="tclLoadDl.o"
  1373   1586   	    DL_LIBS=""
  1374   1587   	    LDFLAGS="$LDFLAGS -export-dynamic"
  1375         -	    LD_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1588  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
         1589  +	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1376   1590   	    if test "${TCL_THREADS}" = "1" ; then
  1377   1591   		# The -pthread needs to go in the CFLAGS, not LIBS
  1378   1592   		LIBS=`echo $LIBS | sed s/-pthread//`
  1379   1593   		CFLAGS="$CFLAGS -pthread"
  1380   1594   	    	LDFLAGS="$LDFLAGS -pthread"
  1381   1595   	    fi
  1382   1596   	    case $system in
................................................................................
  1385   1599   	    	UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1386   1600   	    	SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so'
  1387   1601   	    	TCL_LIB_VERSIONS_OK=nodots
  1388   1602   		;;
  1389   1603   	    esac
  1390   1604   	    ;;
  1391   1605   	Darwin-*)
         1606  +	    CFLAGS_OPTIMIZE="-Os"
  1392   1607   	    SHLIB_CFLAGS="-fno-common"
  1393         -	    SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
         1608  +	    if test $do64bit = yes; then
         1609  +	        do64bit_ok=yes
         1610  +	        CFLAGS="$CFLAGS -arch ppc64 -mpowerpc64 -mcpu=G5"
         1611  +	    fi
         1612  +	    # TEA specific: use LDFLAGS_DEFAULT instead of LDFLAGS here:
         1613  +	    SHLIB_LD='${CC} -dynamiclib ${CFLAGS} ${LDFLAGS_DEFAULT}'
         1614  +	    AC_CACHE_CHECK([if ld accepts -single_module flag], tcl_cv_ld_single_module, [
         1615  +	        hold_ldflags=$LDFLAGS
         1616  +	        LDFLAGS="$LDFLAGS -dynamiclib -Wl,-single_module"
         1617  +	        AC_TRY_LINK(, [int i;], tcl_cv_ld_single_module=yes, tcl_cv_ld_single_module=no)
         1618  +	        LDFLAGS=$hold_ldflags])
         1619  +	    if test $tcl_cv_ld_single_module = yes; then
         1620  +	        SHLIB_LD="${SHLIB_LD} -Wl,-single_module"
         1621  +	    fi
  1394   1622   	    SHLIB_LD_LIBS='${LIBS}'
  1395   1623   	    SHLIB_SUFFIX=".dylib"
  1396   1624   	    DL_OBJS="tclLoadDyld.o"
  1397   1625   	    DL_LIBS=""
  1398         -	    LDFLAGS="$LDFLAGS -prebind -Wl,-search_paths_first"
         1626  +	    # Don't use -prebind when building for Mac OS X 10.4 or later only:
         1627  +	    test -z "${MACOSX_DEPLOYMENT_TARGET}" || \
         1628  +		test "`echo "${MACOSX_DEPLOYMENT_TARGET}" | awk -F. '{print [$]2}'`" -lt 4 && \
         1629  +		LDFLAGS="$LDFLAGS -prebind"
         1630  +	    LDFLAGS="$LDFLAGS -headerpad_max_install_names"
         1631  +	    AC_CACHE_CHECK([if ld accepts -search_paths_first flag], tcl_cv_ld_search_paths_first, [
         1632  +	        hold_ldflags=$LDFLAGS
         1633  +	        LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
         1634  +	        AC_TRY_LINK(, [int i;], tcl_cv_ld_search_paths_first=yes, tcl_cv_ld_search_paths_first=no)
         1635  +	        LDFLAGS=$hold_ldflags])
         1636  +	    if test $tcl_cv_ld_search_paths_first = yes; then
         1637  +	        LDFLAGS="$LDFLAGS -Wl,-search_paths_first"
         1638  +	    fi
         1639  +	    CC_SEARCH_FLAGS=""
  1399   1640   	    LD_SEARCH_FLAGS=""
  1400   1641   	    LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
  1401         -	    CFLAGS_OPTIMIZE="-Os"
         1642  +
         1643  +	    # TEA specific: for Tk extensions, remove -arch ppc64 from CFLAGS
         1644  +	    # for fat builds, as neither TkAqua nor TkX11 can be built for 64bit
         1645  +	    # at present (no 64bit GUI libraries).
         1646  +	    test $do64bit_ok = no && test -n "${TK_BIN_DIR}" && \
         1647  +	        CFLAGS="`echo "$CFLAGS" | sed -e 's/-arch ppc64/-arch ppc/g'`"
  1402   1648   	    ;;
  1403   1649   	NEXTSTEP-*)
  1404   1650   	    SHLIB_CFLAGS=""
  1405   1651   	    SHLIB_LD="cc -nostdlib -r"
  1406   1652   	    SHLIB_LD_LIBS=""
  1407   1653   	    SHLIB_SUFFIX=".so"
  1408   1654   	    DL_OBJS="tclLoadNext.o"
  1409   1655   	    DL_LIBS=""
         1656  +	    CC_SEARCH_FLAGS=""
  1410   1657   	    LD_SEARCH_FLAGS=""
  1411   1658   	    ;;
  1412   1659   	OS/390-*)
  1413         -	    CFLAGS_OPTIMIZE=""      # Optimizer is buggy
  1414         -	    AC_DEFINE(_OE_SOCKETS)  # needed in sys/socket.h
         1660  +	    CFLAGS_OPTIMIZE=""		# Optimizer is buggy
         1661  +	    AC_DEFINE(_OE_SOCKETS, 1,	# needed in sys/socket.h
         1662  +		[Should OS/390 do the right thing with sockets?])
  1415   1663   	    ;;      
  1416   1664   	OSF1-1.0|OSF1-1.1|OSF1-1.2)
  1417   1665   	    # OSF/1 1.[012] from OSF, and derivatives, including Paragon OSF/1
  1418   1666   	    SHLIB_CFLAGS=""
  1419   1667   	    # Hack: make package name same as library name
  1420   1668   	    SHLIB_LD='ld -R -export [email protected]:'
  1421   1669   	    SHLIB_LD_LIBS=""
  1422   1670   	    SHLIB_SUFFIX=".so"
  1423   1671   	    DL_OBJS="tclLoadOSF.o"
  1424   1672   	    DL_LIBS=""
         1673  +	    CC_SEARCH_FLAGS=""
  1425   1674   	    LD_SEARCH_FLAGS=""
  1426   1675   	    ;;
  1427   1676   	OSF1-1.*)
  1428   1677   	    # OSF/1 1.3 from OSF using ELF, and derivatives, including AD2
  1429   1678   	    SHLIB_CFLAGS="-fPIC"
  1430   1679   	    if test "$SHARED_BUILD" = "1" ; then
  1431   1680   	        SHLIB_LD="ld -shared"
................................................................................
  1432   1681   	    else
  1433   1682   	        SHLIB_LD="ld -non_shared"
  1434   1683   	    fi
  1435   1684   	    SHLIB_LD_LIBS=""
  1436   1685   	    SHLIB_SUFFIX=".so"
  1437   1686   	    DL_OBJS="tclLoadDl.o"
  1438   1687   	    DL_LIBS=""
         1688  +	    CC_SEARCH_FLAGS=""
  1439   1689   	    LD_SEARCH_FLAGS=""
  1440   1690   	    ;;
  1441   1691   	OSF1-V*)
  1442   1692   	    # Digital OSF/1
  1443   1693   	    SHLIB_CFLAGS=""
  1444   1694   	    if test "$SHARED_BUILD" = "1" ; then
  1445   1695   	        SHLIB_LD='ld -shared -expect_unresolved "*"'
................................................................................
  1446   1696   	    else
  1447   1697   	        SHLIB_LD='ld -non_shared -expect_unresolved "*"'
  1448   1698   	    fi
  1449   1699   	    SHLIB_LD_LIBS=""
  1450   1700   	    SHLIB_SUFFIX=".so"
  1451   1701   	    DL_OBJS="tclLoadDl.o"
  1452   1702   	    DL_LIBS=""
         1703  +	    CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'
  1453   1704   	    LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}'
  1454   1705   	    if test "$GCC" = "yes" ; then
  1455   1706   		CFLAGS="$CFLAGS -mieee"
  1456   1707               else
  1457   1708   		CFLAGS="$CFLAGS -DHAVE_TZSET -std1 -ieee"
  1458   1709   	    fi
  1459   1710   	    # see pthread_intro(3) for pthread support on osf1, k.furukawa
................................................................................
  1476   1727   	    SHLIB_CFLAGS="-fPIC"
  1477   1728   	    SHLIB_LD="ld -Bshareable -x"
  1478   1729   	    SHLIB_LD_LIBS=""
  1479   1730   	    SHLIB_SUFFIX=".so"
  1480   1731   	    DL_OBJS="tclLoadDl.o"
  1481   1732   	    # dlopen is in -lc on QNX
  1482   1733   	    DL_LIBS=""
         1734  +	    CC_SEARCH_FLAGS=""
  1483   1735   	    LD_SEARCH_FLAGS=""
  1484   1736   	    ;;
  1485         -	RISCos-*)
  1486         -	    SHLIB_CFLAGS="-G 0"
  1487         -	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  1488         -	    SHLIB_LD_LIBS='${LIBS}'
  1489         -	    SHLIB_SUFFIX=".a"
  1490         -	    DL_OBJS="tclLoadAout.o"
  1491         -	    DL_LIBS=""
  1492         -	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  1493         -	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1494         -	    ;;
  1495   1737   	SCO_SV-3.2*)
  1496   1738   	    # Note, dlopen is available only on SCO 3.2.5 and greater. However,
  1497   1739   	    # this test works, since "uname -s" was non-standard in 3.2.4 and
  1498   1740   	    # below.
  1499   1741   	    if test "$GCC" = "yes" ; then
  1500   1742   	    	SHLIB_CFLAGS="-fPIC -melf"
  1501   1743   	    	LDFLAGS="$LDFLAGS -melf -Wl,-Bexport"
................................................................................
  1504   1746   	    	LDFLAGS="$LDFLAGS -belf -Wl,-Bexport"
  1505   1747   	    fi
  1506   1748   	    SHLIB_LD="ld -G"
  1507   1749   	    SHLIB_LD_LIBS=""
  1508   1750   	    SHLIB_SUFFIX=".so"
  1509   1751   	    DL_OBJS="tclLoadDl.o"
  1510   1752   	    DL_LIBS=""
         1753  +	    CC_SEARCH_FLAGS=""
  1511   1754   	    LD_SEARCH_FLAGS=""
  1512   1755   	    ;;
  1513   1756   	SINIX*5.4*)
  1514   1757   	    SHLIB_CFLAGS="-K PIC"
  1515   1758   	    SHLIB_LD="cc -G"
  1516   1759   	    SHLIB_LD_LIBS=""
  1517   1760   	    SHLIB_SUFFIX=".so"
  1518   1761   	    DL_OBJS="tclLoadDl.o"
  1519   1762   	    DL_LIBS="-ldl"
         1763  +	    CC_SEARCH_FLAGS=""
  1520   1764   	    LD_SEARCH_FLAGS=""
  1521   1765   	    ;;
  1522   1766   	SunOS-4*)
  1523   1767   	    SHLIB_CFLAGS="-PIC"
  1524   1768   	    SHLIB_LD="ld"
  1525   1769   	    SHLIB_LD_LIBS=""
  1526   1770   	    SHLIB_SUFFIX=".so"
  1527   1771   	    DL_OBJS="tclLoadDl.o"
  1528   1772   	    DL_LIBS="-ldl"
  1529         -	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
         1773  +	    CC_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
         1774  +	    LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1530   1775   
  1531   1776   	    # SunOS can't handle version numbers with dots in them in library
  1532   1777   	    # specs, like -ltcl7.5, so use -ltcl75 instead.  Also, it
  1533   1778   	    # requires an extra version number at the end of .so file names.
  1534   1779   	    # So, the library has to have a name like libtcl75.so.1.0
  1535   1780   
  1536   1781   	    SHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.so.1.0'
  1537   1782   	    UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.a'
  1538   1783   	    TCL_LIB_VERSIONS_OK=nodots
  1539   1784   	    ;;
  1540         -	SunOS-5.[[0-6]]*)
         1785  +	SunOS-5.[[0-6]])
         1786  +	    # Careful to not let 5.10+ fall into this case
  1541   1787   
  1542   1788   	    # Note: If _REENTRANT isn't defined, then Solaris
  1543   1789   	    # won't define thread-safe library routines.
  1544   1790   
  1545         -	    AC_DEFINE(_REENTRANT)
  1546         -	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
         1791  +	    AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
         1792  +	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
         1793  +		[Do we really want to follow the standard? Yes we do!])
  1547   1794   
  1548   1795   	    SHLIB_CFLAGS="-KPIC"
  1549   1796   
  1550   1797   	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
  1551   1798   	    # symbols when dynamically loaded into tclsh.
  1552   1799   
  1553   1800   	    SHLIB_LD_LIBS='${LIBS}'
  1554   1801   	    SHLIB_SUFFIX=".so"
  1555   1802   	    DL_OBJS="tclLoadDl.o"
  1556   1803   	    DL_LIBS="-ldl"
  1557   1804   	    if test "$GCC" = "yes" ; then
  1558   1805   		SHLIB_LD="$CC -shared"
  1559         -		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
         1806  +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
         1807  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1560   1808   	    else
  1561   1809   		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
  1562         -		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
         1810  +		CC_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
         1811  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
  1563   1812   	    fi
  1564   1813   	    ;;
  1565   1814   	SunOS-5*)
  1566         -
  1567   1815   	    # Note: If _REENTRANT isn't defined, then Solaris
  1568   1816   	    # won't define thread-safe library routines.
  1569   1817   
  1570         -	    AC_DEFINE(_REENTRANT)
  1571         -	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS)
         1818  +	    AC_DEFINE(_REENTRANT, 1, [Do we want the reentrant OS API?])
         1819  +	    AC_DEFINE(_POSIX_PTHREAD_SEMANTICS, 1,
         1820  +		[Do we really want to follow the standard? Yes we do!])
  1572   1821   
  1573   1822   	    SHLIB_CFLAGS="-KPIC"
  1574         -    
         1823  +
  1575   1824   	    # Check to enable 64-bit flags for compiler/linker
  1576   1825   	    if test "$do64bit" = "yes" ; then
  1577   1826   		arch=`isainfo`
  1578   1827   		if test "$arch" = "sparcv9 sparc" ; then
  1579   1828   			if test "$GCC" = "yes" ; then
  1580         -			    if test "`gcc -dumpversion` | awk -F. '{print $1}'" -lt "3" ; then
         1829  +			    if test "`gcc -dumpversion | awk -F. '{print [$]1}'`" -lt "3" ; then
  1581   1830   				AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
  1582   1831   			    else
  1583   1832   				do64bit_ok=yes
  1584   1833   				CFLAGS="$CFLAGS -m64 -mcpu=v9"
  1585   1834   				LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
  1586   1835   				SHLIB_CFLAGS="-fPIC"
  1587   1836   			    fi
  1588   1837   			else
  1589   1838   			    do64bit_ok=yes
  1590   1839   			    if test "$do64bitVIS" = "yes" ; then
  1591   1840   				CFLAGS="$CFLAGS -xarch=v9a"
  1592         -			    	LDFLAGS="$LDFLAGS -xarch=v9a"
         1841  +			    	LDFLAGS_ARCH="-xarch=v9a"
  1593   1842   			    else
  1594   1843   				CFLAGS="$CFLAGS -xarch=v9"
  1595         -			    	LDFLAGS="$LDFLAGS -xarch=v9"
         1844  +			    	LDFLAGS_ARCH="-xarch=v9"
  1596   1845   			    fi
         1846  +			    # Solaris 64 uses this as well
         1847  +			    #LD_LIBRARY_PATH_VAR="LD_LIBRARY_PATH_64"
  1597   1848   			fi
         1849  +		elif test "$arch" = "amd64 i386" ; then
         1850  +		    if test "$GCC" = "yes" ; then
         1851  +			AC_MSG_WARN([64bit mode not supported with GCC on $system])
         1852  +		    else
         1853  +			do64bit_ok=yes
         1854  +			CFLAGS="$CFLAGS -xarch=amd64"
         1855  +			LDFLAGS="$LDFLAGS -xarch=amd64"
         1856  +		    fi
  1598   1857   		else
  1599         -		    AC_MSG_WARN("64bit mode only supported sparcv9 system")
         1858  +		    AC_MSG_WARN([64bit mode not supported for $arch])
  1600   1859   		fi
  1601   1860   	    fi
  1602   1861   	    
  1603   1862   	    # Note: need the LIBS below, otherwise Tk won't find Tcl's
  1604   1863   	    # symbols when dynamically loaded into tclsh.
  1605   1864   
  1606   1865   	    SHLIB_LD_LIBS='${LIBS}'
  1607   1866   	    SHLIB_SUFFIX=".so"
  1608   1867   	    DL_OBJS="tclLoadDl.o"
  1609   1868   	    DL_LIBS="-ldl"
  1610   1869   	    if test "$GCC" = "yes" ; then
  1611   1870   		SHLIB_LD="$CC -shared"
  1612         -		LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1613         -		if test "$do64bit" = "yes" ; then
         1871  +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
         1872  +		LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
         1873  +		if test "$do64bit_ok" = "yes" ; then
  1614   1874   		    # We need to specify -static-libgcc or we need to
  1615   1875   		    # add the path to the sparv9 libgcc.
  1616   1876   		    # JH: static-libgcc is necessary for core Tcl, but may
  1617   1877   		    # not be necessary for extensions.
  1618   1878   		    SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
  1619   1879   		    # for finding sparcv9 libgcc, get the regular libgcc
  1620   1880   		    # path, remove so name and append 'sparcv9'
  1621   1881   		    #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
  1622         -		    #LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS},-R,$v9gcclibdir"
         1882  +		    #CC_SEARCH_FLAGS="${CC_SEARCH_FLAGS},-R,$v9gcclibdir"
  1623   1883   		fi
  1624   1884   	    else
  1625   1885   		SHLIB_LD="/usr/ccs/bin/ld -G -z text"
         1886  +		CC_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
  1626   1887   		LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
  1627   1888   	    fi
  1628         -	    ;;
  1629         -	ULTRIX-4.*)
  1630         -	    SHLIB_CFLAGS="-G 0"
  1631         -	    SHLIB_SUFFIX=".a"
  1632         -	    SHLIB_LD="echo tclLdAout $CC \{$SHLIB_CFLAGS\} | `pwd`/tclsh -r -G 0"
  1633         -	    SHLIB_LD_LIBS='${LIBS}'
  1634         -	    DL_OBJS="tclLoadAout.o"
  1635         -	    DL_LIBS=""
  1636         -	    LDFLAGS="$LDFLAGS -Wl,-D,08000000"
  1637         -	    LD_SEARCH_FLAGS='-L${LIB_RUNTIME_DIR}'
  1638         -	    if test "$GCC" != "yes" ; then
  1639         -		CFLAGS="$CFLAGS -DHAVE_TZSET -std1"
  1640         -	    fi
  1641   1889   	    ;;
  1642   1890   	UNIX_SV* | UnixWare-5*)
  1643   1891   	    SHLIB_CFLAGS="-KPIC"
  1644   1892   	    SHLIB_LD="cc -G"
  1645   1893   	    SHLIB_LD_LIBS=""
  1646   1894   	    SHLIB_SUFFIX=".so"
  1647   1895   	    DL_OBJS="tclLoadDl.o"
  1648   1896   	    DL_LIBS="-ldl"
  1649   1897   	    # Some UNIX_SV* systems (unixware 1.1.2 for example) have linkers
  1650   1898   	    # that don't grok the -Bexport option.  Test that it does.
  1651         -	    hold_ldflags=$LDFLAGS
  1652         -	    AC_MSG_CHECKING(for ld accepts -Bexport flag)
  1653         -	    LDFLAGS="$LDFLAGS -Wl,-Bexport"
  1654         -	    AC_TRY_LINK(, [int i;], [found=yes],
  1655         -			[LDFLAGS=$hold_ldflags found=no])
  1656         -	    AC_MSG_RESULT([$found])
         1899  +	    AC_CACHE_CHECK([for ld accepts -Bexport flag], tcl_cv_ld_Bexport, [
         1900  +		hold_ldflags=$LDFLAGS
         1901  +		LDFLAGS="$LDFLAGS -Wl,-Bexport"
         1902  +		AC_TRY_LINK(, [int i;], tcl_cv_ld_Bexport=yes, tcl_cv_ld_Bexport=no)
         1903  +	        LDFLAGS=$hold_ldflags])
         1904  +	    if test $tcl_cv_ld_Bexport = yes; then
         1905  +		LDFLAGS="$LDFLAGS -Wl,-Bexport"
         1906  +	    fi
         1907  +	    CC_SEARCH_FLAGS=""
  1657   1908   	    LD_SEARCH_FLAGS=""
  1658   1909   	    ;;
  1659   1910       esac
  1660   1911   
  1661   1912       if test "$do64bit" = "yes" -a "$do64bit_ok" = "no" ; then
  1662         -    AC_MSG_WARN("64bit support being disabled -- don\'t know magic for this platform")
  1663         -    fi
  1664         -
  1665         -    # Step 4: If pseudo-static linking is in use (see K. B. Kenny, "Dynamic
  1666         -    # Loading for Tcl -- What Became of It?".  Proc. 2nd Tcl/Tk Workshop,
  1667         -    # New Orleans, LA, Computerized Processes Unlimited, 1994), then we need
  1668         -    # to determine which of several header files defines the a.out file
  1669         -    # format (a.out.h, sys/exec.h, or sys/exec_aout.h).  At present, we
  1670         -    # support only a file format that is more or less version-7-compatible. 
  1671         -    # In particular,
  1672         -    #	- a.out files must begin with `struct exec'.
  1673         -    #	- the N_TXTOFF on the `struct exec' must compute the seek address
  1674         -    #	  of the text segment
  1675         -    #	- The `struct exec' must contain a_magic, a_text, a_data, a_bss
  1676         -    #	  and a_entry fields.
  1677         -    # The following compilation should succeed if and only if either sys/exec.h
  1678         -    # or a.out.h is usable for the purpose.
  1679         -    #
  1680         -    # Note that the modified COFF format used on MIPS Ultrix 4.x is usable; the
  1681         -    # `struct exec' includes a second header that contains information that
  1682         -    # duplicates the v7 fields that are needed.
  1683         -
  1684         -    if test "x$DL_OBJS" = "xtclLoadAout.o" ; then
  1685         -	AC_MSG_CHECKING([sys/exec.h])
  1686         -	AC_TRY_COMPILE([#include <sys/exec.h>],[
  1687         -	    struct exec foo;
  1688         -	    unsigned long seek;
  1689         -	    int flag;
  1690         -#if defined(__mips) || defined(mips)
  1691         -	    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1692         -#else
  1693         -	    seek = N_TXTOFF (foo);
  1694         -#endif
  1695         -	    flag = (foo.a_magic == OMAGIC);
  1696         -	    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1697         -    ], tcl_ok=usable, tcl_ok=unusable)
  1698         -	AC_MSG_RESULT([$tcl_ok])
  1699         -	if test $tcl_ok = usable; then
  1700         -	    AC_DEFINE(USE_SYS_EXEC_H)
  1701         -	else
  1702         -	    AC_MSG_CHECKING([a.out.h])
  1703         -	    AC_TRY_COMPILE([#include <a.out.h>],[
  1704         -		struct exec foo;
  1705         -		unsigned long seek;
  1706         -		int flag;
  1707         -#if defined(__mips) || defined(mips)
  1708         -		seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1709         -#else
  1710         -		seek = N_TXTOFF (foo);
  1711         -#endif
  1712         -		flag = (foo.a_magic == OMAGIC);
  1713         -		return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1714         -	    ], tcl_ok=usable, tcl_ok=unusable)
  1715         -	    AC_MSG_RESULT([$tcl_ok])
  1716         -	    if test $tcl_ok = usable; then
  1717         -		AC_DEFINE(USE_A_OUT_H)
  1718         -	    else
  1719         -		AC_MSG_CHECKING([sys/exec_aout.h])
  1720         -		AC_TRY_COMPILE([#include <sys/exec_aout.h>],[
  1721         -		    struct exec foo;
  1722         -		    unsigned long seek;
  1723         -		    int flag;
  1724         -#if defined(__mips) || defined(mips)
  1725         -		    seek = N_TXTOFF (foo.ex_f, foo.ex_o);
  1726         -#else
  1727         -		    seek = N_TXTOFF (foo);
  1728         -#endif
  1729         -		    flag = (foo.a_midmag == OMAGIC);
  1730         -		    return foo.a_text + foo.a_data + foo.a_bss + foo.a_entry;
  1731         -		], tcl_ok=usable, tcl_ok=unusable)
  1732         -		AC_MSG_RESULT([$tcl_ok])
  1733         -		if test $tcl_ok = usable; then
  1734         -		    AC_DEFINE(USE_SYS_EXEC_AOUT_H)
  1735         -		else
  1736         -		    DL_OBJS=""
  1737         -		fi
  1738         -	    fi
  1739         -	fi
  1740         -    fi
  1741         -
  1742         -    # Step 5: disable dynamic loading if requested via a command-line switch.
  1743         -
  1744         -    AC_ARG_ENABLE(load, [  --disable-load          disallow dynamic loading and "load" command],
         1913  +	AC_MSG_WARN([64bit support being disabled -- don't know magic for this platform])
         1914  +    fi
         1915  +
         1916  +    # Step 4: disable dynamic loading if requested via a command-line switch.
         1917  +
         1918  +    AC_ARG_ENABLE(load,
         1919  +	AC_HELP_STRING([--disable-load],
         1920  +	    [disallow dynamic loading and "load" command (default: enabled)]),
  1745   1921   	[tcl_ok=$enableval], [tcl_ok=yes])
  1746   1922       if test "$tcl_ok" = "no"; then
  1747   1923   	DL_OBJS=""
  1748   1924       fi
  1749   1925   
  1750   1926       if test "x$DL_OBJS" != "x" ; then
  1751   1927   	BUILD_DLTEST="\$(DLTEST_TARGETS)"
................................................................................
  1754   1930   	echo "on this system."
  1755   1931   	SHLIB_CFLAGS=""
  1756   1932   	SHLIB_LD=""
  1757   1933   	SHLIB_SUFFIX=""
  1758   1934   	DL_OBJS="tclLoadNone.o"
  1759   1935   	DL_LIBS=""
  1760   1936   	LDFLAGS="$LDFLAGS_ORIG"
         1937  +	CC_SEARCH_FLAGS=""
  1761   1938   	LD_SEARCH_FLAGS=""
  1762   1939   	BUILD_DLTEST=""
  1763   1940       fi
         1941  +    LDFLAGS="$LDFLAGS $LDFLAGS_ARCH"
  1764   1942   
  1765   1943       # If we're running gcc, then change the C flags for compiling shared
  1766   1944       # libraries to the right flags for gcc, instead of those for the
  1767   1945       # standard manufacturer compiler.
  1768   1946   
  1769   1947       if test "$DL_OBJS" != "tclLoadNone.o" ; then
  1770   1948   	if test "$GCC" = "yes" ; then
................................................................................
  1775   1953   		    ;;
  1776   1954   		IRIX*)
  1777   1955   		    ;;
  1778   1956   		NetBSD-*|FreeBSD-*)
  1779   1957   		    ;;
  1780   1958   		Darwin-*)
  1781   1959   		    ;;
  1782         -		RISCos-*)
  1783         -		    ;;
  1784   1960   		SCO_SV-3.2*)
  1785   1961   		    ;;
  1786         -		ULTRIX-4.*)
  1787         -		    ;;
  1788   1962   		windows)
  1789   1963   		    ;;
  1790   1964   		*)
  1791   1965   		    SHLIB_CFLAGS="-fPIC"
  1792   1966   		    ;;
  1793   1967   	    esac
  1794   1968   	fi
................................................................................
  1798   1972   	SHARED_LIB_SUFFIX='${PACKAGE_VERSION}${SHLIB_SUFFIX}'
  1799   1973       fi
  1800   1974       if test "$UNSHARED_LIB_SUFFIX" = "" ; then
  1801   1975   	UNSHARED_LIB_SUFFIX='${PACKAGE_VERSION}.a'
  1802   1976       fi
  1803   1977   
  1804   1978       AC_SUBST(DL_LIBS)
         1979  +
  1805   1980       AC_SUBST(CFLAGS_DEBUG)
  1806   1981       AC_SUBST(CFLAGS_OPTIMIZE)
  1807   1982       AC_SUBST(CFLAGS_WARNING)
  1808   1983   
  1809   1984       AC_SUBST(STLIB_LD)
  1810   1985       AC_SUBST(SHLIB_LD)
  1811         -    AC_SUBST(SHLIB_CFLAGS)
         1986  +
  1812   1987       AC_SUBST(SHLIB_LD_LIBS)
  1813         -    AC_SUBST(LDFLAGS_DEBUG)
  1814         -    AC_SUBST(LDFLAGS_OPTIMIZE)
         1988  +    AC_SUBST(SHLIB_CFLAGS)
         1989  +
  1815   1990       AC_SUBST(LD_LIBRARY_PATH_VAR)
  1816   1991   
  1817   1992       # These must be called after we do the basic CFLAGS checks and
  1818   1993       # verify any possible 64-bit or similar switches are necessary
  1819   1994       TEA_TCL_EARLY_FLAGS
  1820   1995       TEA_TCL_64BIT_FLAGS
  1821   1996   ])
................................................................................
  1838   2013   #		HAVE_SYS_MODEM_H
  1839   2014   #		USE_TERMIOS
  1840   2015   #		USE_TERMIO
  1841   2016   #		USE_SGTTY
  1842   2017   #
  1843   2018   #--------------------------------------------------------------------
  1844   2019   
  1845         -AC_DEFUN(TEA_SERIAL_PORT, [
         2020  +AC_DEFUN([TEA_SERIAL_PORT], [
  1846   2021       AC_CHECK_HEADERS(sys/modem.h)
  1847         -    AC_MSG_CHECKING([termios vs. termio vs. sgtty])
  1848         -    AC_CACHE_VAL(tcl_cv_api_serial, [
         2022  +    AC_CACHE_CHECK([termios vs. termio vs. sgtty], tcl_cv_api_serial, [
  1849   2023       AC_TRY_RUN([
  1850   2024   #include <termios.h>
  1851   2025   
  1852   2026   int main() {
  1853   2027       struct termios t;
  1854   2028       if (tcgetattr(0, &t) == 0) {
  1855   2029   	cfsetospeed(&t, 0);
................................................................................
  1879   2053       struct sgttyb t;
  1880   2054       if (ioctl(0, TIOCGETP, &t) == 0) {
  1881   2055   	t.sg_ospeed = 0;
  1882   2056   	t.sg_flags |= ODDP | EVENP | RAW;
  1883   2057   	return 0;
  1884   2058       }
  1885   2059       return 1;
  1886         -}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
         2060  +}], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=no, tcl_cv_api_serial=no)
  1887   2061       fi
  1888   2062       if test $tcl_cv_api_serial = no ; then
  1889   2063   	AC_TRY_RUN([
  1890   2064   #include <termios.h>
  1891   2065   #include <errno.h>
  1892   2066   
  1893   2067   int main() {
................................................................................
  1929   2103   	t.sg_flags |= ODDP | EVENP | RAW;
  1930   2104   	return 0;
  1931   2105       }
  1932   2106       return 1;
  1933   2107   }], tcl_cv_api_serial=sgtty, tcl_cv_api_serial=none, tcl_cv_api_serial=none)
  1934   2108       fi])
  1935   2109       case $tcl_cv_api_serial in
  1936         -	termios) AC_DEFINE(USE_TERMIOS);;
  1937         -	termio)  AC_DEFINE(USE_TERMIO);;
  1938         -	sgtty)   AC_DEFINE(USE_SGTTY);;
         2110  +	termios) AC_DEFINE(USE_TERMIOS, 1, [Use the termios API for serial lines]);;
         2111  +	termio)  AC_DEFINE(USE_TERMIO, 1, [Use the termio API for serial lines]);;
         2112  +	sgtty)   AC_DEFINE(USE_SGTTY, 1, [Use the sgtty API for serial lines]);;
  1939   2113       esac
  1940         -    AC_MSG_RESULT([$tcl_cv_api_serial])
  1941   2114   ])
  1942   2115   
  1943   2116   #--------------------------------------------------------------------
  1944   2117   # TEA_MISSING_POSIX_HEADERS
  1945   2118   #
  1946   2119   #	Supply substitutes for missing POSIX header files.  Special
  1947   2120   #	notes:
................................................................................
  1968   2141   #
  1969   2142   #		HAVE_STRING_H ?
  1970   2143   #
  1971   2144   # tkUnixPort.h checks for HAVE_LIMITS_H, so do both HAVE and
  1972   2145   # CHECK on limits.h
  1973   2146   #--------------------------------------------------------------------
  1974   2147   
  1975         -AC_DEFUN(TEA_MISSING_POSIX_HEADERS, [
  1976         -    AC_MSG_CHECKING([dirent.h])
         2148  +AC_DEFUN([TEA_MISSING_POSIX_HEADERS], [
         2149  +    AC_CACHE_CHECK([dirent.h], tcl_cv_dirent_h,
  1977   2150       AC_TRY_LINK([#include <sys/types.h>
  1978   2151   #include <dirent.h>], [
  1979   2152   #ifndef _POSIX_SOURCE
  1980   2153   #   ifdef __Lynx__
  1981   2154   	/*
  1982   2155   	 * Generate compilation error to make the test fail:  Lynx headers
  1983   2156   	 * are only valid if really in the POSIX environment.
................................................................................
  1989   2162   DIR *d;
  1990   2163   struct dirent *entryPtr;
  1991   2164   char *p;
  1992   2165   d = opendir("foobar");
  1993   2166   entryPtr = readdir(d);
  1994   2167   p = entryPtr->d_name;
  1995   2168   closedir(d);
  1996         -], tcl_ok=yes, tcl_ok=no)
         2169  +], tcl_cv_dirent_h=yes, tcl_cv_dirent_h=no))
  1997   2170   
  1998         -    if test $tcl_ok = no; then
  1999         -	AC_DEFINE(NO_DIRENT_H)
         2171  +    if test $tcl_cv_dirent_h = no; then
         2172  +	AC_DEFINE(NO_DIRENT_H, 1, [Do we have <dirent.h>?])
  2000   2173       fi
  2001   2174   
  2002         -    AC_MSG_RESULT([$tcl_ok])
  2003         -    AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H)])
  2004         -    AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H)])
  2005         -    AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H)])
         2175  +    AC_CHECK_HEADER(errno.h, , [AC_DEFINE(NO_ERRNO_H, 1, [Do we have <errno.h>?])])
         2176  +    AC_CHECK_HEADER(float.h, , [AC_DEFINE(NO_FLOAT_H, 1, [Do we have <float.h>?])])
         2177  +    AC_CHECK_HEADER(values.h, , [AC_DEFINE(NO_VALUES_H, 1, [Do we have <values.h>?])])
  2006   2178       AC_CHECK_HEADER(limits.h,
  2007         -	[AC_DEFINE(HAVE_LIMITS_H)], [AC_DEFINE(NO_LIMITS_H)])
         2179  +	[AC_DEFINE(HAVE_LIMITS_H, 1, [Do we have <limits.h>?])],
         2180  +	[AC_DEFINE(NO_LIMITS_H, 1, [Do we have <limits.h>?])])
  2008   2181       AC_CHECK_HEADER(stdlib.h, tcl_ok=1, tcl_ok=0)
  2009   2182       AC_EGREP_HEADER(strtol, stdlib.h, , tcl_ok=0)
  2010   2183       AC_EGREP_HEADER(strtoul, stdlib.h, , tcl_ok=0)
  2011   2184       AC_EGREP_HEADER(strtod, stdlib.h, , tcl_ok=0)
  2012   2185       if test $tcl_ok = 0; then
  2013         -	AC_DEFINE(NO_STDLIB_H)
         2186  +	AC_DEFINE(NO_STDLIB_H, 1, [Do we have <stdlib.h>?])
  2014   2187       fi
  2015   2188       AC_CHECK_HEADER(string.h, tcl_ok=1, tcl_ok=0)
  2016   2189       AC_EGREP_HEADER(strstr, string.h, , tcl_ok=0)
  2017   2190       AC_EGREP_HEADER(strerror, string.h, , tcl_ok=0)
  2018   2191   
  2019   2192       # See also memmove check below for a place where NO_STRING_H can be
  2020   2193       # set and why.
  2021   2194   
  2022   2195       if test $tcl_ok = 0; then
  2023         -	AC_DEFINE(NO_STRING_H)
         2196  +	AC_DEFINE(NO_STRING_H, 1, [Do we have <string.h>?])
  2024   2197       fi
  2025   2198   
  2026         -    AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H)])
  2027         -    AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H)])
         2199  +    AC_CHECK_HEADER(sys/wait.h, , [AC_DEFINE(NO_SYS_WAIT_H, 1, [Do we have <sys/wait.h>?])])
         2200  +    AC_CHECK_HEADER(dlfcn.h, , [AC_DEFINE(NO_DLFCN_H, 1, [Do we have <dlfcn.h>?])])
  2028   2201   
  2029   2202       # OS/390 lacks sys/param.h (and doesn't need it, by chance).
  2030   2203       AC_HAVE_HEADERS(sys/param.h)
  2031         -
  2032   2204   ])
  2033   2205   
  2034   2206   #--------------------------------------------------------------------
  2035   2207   # TEA_PATH_X
  2036   2208   #
  2037   2209   #	Locate the X11 header files and the X11 library archive.  Try
  2038   2210   #	the ac_path_x macro first, but if it doesn't find the X stuff
................................................................................
  2048   2220   #	none
  2049   2221   #	
  2050   2222   # Results:
  2051   2223   #
  2052   2224   #	Sets the following vars:
  2053   2225   #		XINCLUDES
  2054   2226   #		XLIBSW
  2055         -#		LIBS (appends to)
  2056         -#		TEA_WINDOWINGSYSTEM
         2227  +#		PKG_LIBS (appends to)
  2057   2228   #
  2058   2229   #--------------------------------------------------------------------
  2059   2230   
  2060         -AC_DEFUN(TEA_PATH_X, [
  2061         -    if test "${TEA_PLATFORM}" = "unix" ; then
  2062         -	case ${TK_DEFS} in
  2063         -	    *MAC_OSX_TK*)
  2064         -		AC_DEFINE(MAC_OSX_TK)
  2065         -		TEA_WINDOWINGSYSTEM="aqua"
  2066         -		;;
  2067         -	    *)
  2068         -		TEA_PATH_UNIX_X
  2069         -		TEA_WINDOWINGSYSTEM="x11"
  2070         -		;;
  2071         -	esac
  2072         -    elif test "${TEA_PLATFORM}" = "windows" ; then
  2073         -	TEA_WINDOWINGSYSTEM="windows"
         2231  +AC_DEFUN([TEA_PATH_X], [
         2232  +    if test "${TEA_WINDOWINGSYSTEM}" = "x11" ; then
         2233  +	TEA_PATH_UNIX_X
  2074   2234       fi
  2075   2235   ])
  2076   2236   
  2077         -AC_DEFUN(TEA_PATH_UNIX_X, [
         2237  +AC_DEFUN([TEA_PATH_UNIX_X], [
  2078   2238       AC_PATH_X
  2079   2239       not_really_there=""
  2080   2240       if test "$no_x" = ""; then
  2081   2241   	if test "$x_includes" = ""; then
  2082   2242   	    AC_TRY_CPP([#include <X11/XIntrinsic.h>], , not_really_there="yes")
  2083   2243   	else
  2084   2244   	    if test ! -r $x_includes/X11/Intrinsic.h; then
  2085   2245   		not_really_there="yes"
  2086   2246   	    fi
  2087   2247   	fi
  2088   2248       fi
  2089   2249       if test "$no_x" = "yes" -o "$not_really_there" = "yes"; then
  2090   2250   	AC_MSG_CHECKING([for X11 header files])
  2091         -	XINCLUDES="# no special path needed"
  2092         -	AC_TRY_CPP([#include <X11/Intrinsic.h>], , XINCLUDES="nope")
  2093         -	if test "$XINCLUDES" = nope; then
         2251  +	found_xincludes="no"
         2252  +	AC_TRY_CPP([#include <X11/Intrinsic.h>], found_xincludes="yes", found_xincludes="no")
         2253  +	if test "$found_xincludes" = "no"; then
  2094   2254   	    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"
  2095   2255   	    for i in $dirs ; do
  2096   2256   		if test -r $i/X11/Intrinsic.h; then
  2097   2257   		    AC_MSG_RESULT([$i])
  2098   2258   		    XINCLUDES=" -I$i"
         2259  +		    found_xincludes="yes"
  2099   2260   		    break
  2100   2261   		fi
  2101   2262   	    done
  2102   2263   	fi
  2103   2264       else
  2104   2265   	if test "$x_includes" != ""; then
  2105         -	    XINCLUDES=-I$x_includes
  2106         -	else
  2107         -	    XINCLUDES="# no special path needed"
         2266  +	    XINCLUDES="-I$x_includes"
         2267  +	    found_xincludes="yes"
  2108   2268   	fi
  2109   2269       fi
  2110         -    if test "$XINCLUDES" = nope; then
  2111         -	AC_MSG_RESULT([could not find any!])
  2112         -	XINCLUDES="# no include files found"
         2270  +    if test found_xincludes = "no"; then
         2271  +	AC_MSG_RESULT([couldn't find any!])
  2113   2272       fi
  2114   2273   
  2115   2274       if test "$no_x" = yes; then
  2116   2275   	AC_MSG_CHECKING([for X11 libraries])
  2117   2276   	XLIBSW=nope
  2118   2277   	dirs="/usr/unsupported/lib /usr/local/lib /usr/X386/lib /usr/X11R6/lib /usr/X11R5/lib /usr/lib/X11R5 /usr/lib/X11R4 /usr/openwin/lib /usr/X11/lib /usr/sww/X11/lib"
  2119   2278   	for i in $dirs ; do
................................................................................
  2160   2319   #		HAVE_SYS_IOCTL_H
  2161   2320   #		HAVE_SYS_FILIO_H
  2162   2321   #		USE_FIONBIO
  2163   2322   #		O_NONBLOCK
  2164   2323   #
  2165   2324   #--------------------------------------------------------------------
  2166   2325   
  2167         -AC_DEFUN(TEA_BLOCKING_STYLE, [
         2326  +AC_DEFUN([TEA_BLOCKING_STYLE], [
  2168   2327       AC_CHECK_HEADERS(sys/ioctl.h)
  2169   2328       AC_CHECK_HEADERS(sys/filio.h)
         2329  +    TEA_CONFIG_SYSTEM
  2170   2330       AC_MSG_CHECKING([FIONBIO vs. O_NONBLOCK for nonblocking I/O])
  2171         -    if test -f /usr/lib/NextStep/software_version; then
  2172         -	system=NEXTSTEP-`awk '/3/,/3/' /usr/lib/NextStep/software_version`
  2173         -    else
  2174         -	system=`uname -s`-`uname -r`
  2175         -	if test "$?" -ne 0 ; then
  2176         -	    system=unknown
  2177         -	else
  2178         -	    # Special check for weird MP-RAS system (uname returns weird
  2179         -	    # results, and the version is kept in special file).
  2180         -	
  2181         -	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
  2182         -		system=MP-RAS-`awk '{print $3}' /etc/.relid'`
  2183         -	    fi
  2184         -	    if test "`uname -s`" = "AIX" ; then
  2185         -		system=AIX-`uname -v`.`uname -r`
  2186         -	    fi
  2187         -	fi
  2188         -    fi
  2189   2331       case $system in
  2190   2332   	# There used to be code here to use FIONBIO under AIX.  However, it
  2191   2333   	# was reported that FIONBIO doesn't work under AIX 3.2.5.  Since
  2192   2334   	# using O_NONBLOCK seems fine under AIX 4.*, I removed the FIONBIO
  2193   2335   	# code (JO, 5/31/97).
  2194   2336   
  2195   2337   	OSF*)
  2196         -	    AC_DEFINE(USE_FIONBIO)
         2338  +	    AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
  2197   2339   	    AC_MSG_RESULT([FIONBIO])
  2198   2340   	    ;;
  2199   2341   	SunOS-4*)
  2200         -	    AC_DEFINE(USE_FIONBIO)
  2201         -	    AC_MSG_RESULT([FIONBIO])
  2202         -	    ;;
  2203         -	ULTRIX-4.*)
  2204         -	    AC_DEFINE(USE_FIONBIO)
         2342  +	    AC_DEFINE(USE_FIONBIO, 1, [Should we use FIONBIO?])
  2205   2343   	    AC_MSG_RESULT([FIONBIO])
  2206   2344   	    ;;
  2207   2345   	*)
  2208   2346   	    AC_MSG_RESULT([O_NONBLOCK])
  2209   2347   	    ;;
  2210   2348       esac
  2211   2349   ])
................................................................................
  2225   2363   #		USE_DELTA_FOR_TZ
  2226   2364   #		HAVE_TM_GMTOFF
  2227   2365   #		HAVE_TM_TZADJ
  2228   2366   #		HAVE_TIMEZONE_VAR
  2229   2367   #
  2230   2368   #--------------------------------------------------------------------
  2231   2369   
  2232         -AC_DEFUN(TEA_TIME_HANDLER, [
         2370  +AC_DEFUN([TEA_TIME_HANDLER], [
  2233   2371       AC_CHECK_HEADERS(sys/time.h)
  2234   2372       AC_HEADER_TIME
  2235   2373       AC_STRUCT_TIMEZONE
  2236   2374   
  2237   2375       AC_CHECK_FUNCS(gmtime_r localtime_r)
  2238   2376   
  2239         -    AC_MSG_CHECKING([tm_tzadj in struct tm])
  2240         -    AC_CACHE_VAL(tcl_cv_member_tm_tzadj,
         2377  +    AC_CACHE_CHECK([tm_tzadj in struct tm], tcl_cv_member_tm_tzadj,
  2241   2378   	AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_tzadj;],
  2242   2379   	    tcl_cv_member_tm_tzadj=yes, tcl_cv_member_tm_tzadj=no))
  2243         -    AC_MSG_RESULT([$tcl_cv_member_tm_tzadj])
  2244   2380       if test $tcl_cv_member_tm_tzadj = yes ; then
  2245         -	AC_DEFINE(HAVE_TM_TZADJ)
         2381  +	AC_DEFINE(HAVE_TM_TZADJ, 1, [Should we use the tm_tzadj field of struct tm?])
  2246   2382       fi
  2247   2383   
  2248         -    AC_MSG_CHECKING([tm_gmtoff in struct tm])
  2249         -    AC_CACHE_VAL(tcl_cv_member_tm_gmtoff,
         2384  +    AC_CACHE_CHECK([tm_gmtoff in struct tm], tcl_cv_member_tm_gmtoff,
  2250   2385   	AC_TRY_COMPILE([#include <time.h>], [struct tm tm; tm.tm_gmtoff;],
  2251   2386   	    tcl_cv_member_tm_gmtoff=yes, tcl_cv_member_tm_gmtoff=no))
  2252         -    AC_MSG_RESULT([$tcl_cv_member_tm_gmtoff])
  2253   2387       if test $tcl_cv_member_tm_gmtoff = yes ; then
  2254         -	AC_DEFINE(HAVE_TM_GMTOFF)
         2388  +	AC_DEFINE(HAVE_TM_GMTOFF, 1, [Should we use the tm_gmtoff field of struct tm?])
  2255   2389       fi
  2256   2390   
  2257   2391       #
  2258   2392       # Its important to include time.h in this check, as some systems
  2259   2393       # (like convex) have timezone functions, etc.
  2260   2394       #
  2261         -    AC_MSG_CHECKING([long timezone variable])
  2262         -    AC_CACHE_VAL(tcl_cv_var_timezone,
         2395  +    AC_CACHE_CHECK([long timezone variable], tcl_cv_timezone_long,
  2263   2396   	AC_TRY_COMPILE([#include <time.h>],
  2264   2397   	    [extern long timezone;
  2265   2398   	    timezone += 1;
  2266   2399   	    exit (0);],
  2267   2400   	    tcl_cv_timezone_long=yes, tcl_cv_timezone_long=no))
  2268         -    AC_MSG_RESULT([$tcl_cv_timezone_long])
  2269   2401       if test $tcl_cv_timezone_long = yes ; then
  2270         -	AC_DEFINE(HAVE_TIMEZONE_VAR)
         2402  +	AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
  2271   2403       else
  2272   2404   	#
  2273   2405   	# On some systems (eg IRIX 6.2), timezone is a time_t and not a long.
  2274   2406   	#
  2275         -	AC_MSG_CHECKING([time_t timezone variable])
  2276         -	AC_CACHE_VAL(tcl_cv_timezone_time,
         2407  +	AC_CACHE_CHECK([time_t timezone variable], tcl_cv_timezone_time,
  2277   2408   	    AC_TRY_COMPILE([#include <time.h>],
  2278   2409   		[extern time_t timezone;
  2279   2410   		timezone += 1;
  2280   2411   		exit (0);],
  2281   2412   		tcl_cv_timezone_time=yes, tcl_cv_timezone_time=no))
  2282         -	AC_MSG_RESULT([$tcl_cv_timezone_time])
  2283   2413   	if test $tcl_cv_timezone_time = yes ; then
  2284         -	    AC_DEFINE(HAVE_TIMEZONE_VAR)
         2414  +	    AC_DEFINE(HAVE_TIMEZONE_VAR, 1, [Should we use the global timezone variable?])
  2285   2415   	fi
  2286   2416       fi
  2287   2417   ])
  2288   2418   
  2289   2419   #--------------------------------------------------------------------
  2290   2420   # TEA_BUGGY_STRTOD
  2291   2421   #
................................................................................
  2302   2432   # Results:
  2303   2433   #
  2304   2434   #	Might defines some of the following vars:
  2305   2435   #		strtod (=fixstrtod)
  2306   2436   #
  2307   2437   #--------------------------------------------------------------------
  2308   2438   
  2309         -AC_DEFUN(TEA_BUGGY_STRTOD, [
         2439  +AC_DEFUN([TEA_BUGGY_STRTOD], [
  2310   2440       AC_CHECK_FUNC(strtod, tcl_strtod=1, tcl_strtod=0)
  2311   2441       if test "$tcl_strtod" = 1; then
  2312         -	AC_MSG_CHECKING([for Solaris2.4/Tru64 strtod bugs])
  2313         -	AC_TRY_RUN([
  2314         -	    extern double strtod();
  2315         -	    int main()
  2316         -	    {
  2317         -		char *string = "NaN", *spaceString = " ";
  2318         -		char *term;
  2319         -		double value;
  2320         -		value = strtod(string, &term);
  2321         -		if ((term != string) && (term[-1] == 0)) {
  2322         -		    exit(1);
  2323         -		}
  2324         -		value = strtod(spaceString, &term);
  2325         -		if (term == (spaceString+1)) {
  2326         -		    exit(1);
  2327         -		}
  2328         -		exit(0);
  2329         -	    }], tcl_ok=1, tcl_ok=0, tcl_ok=0)
  2330         -	if test "$tcl_ok" = 1; then
  2331         -	    AC_MSG_RESULT([ok])
  2332         -	else
  2333         -	    AC_MSG_RESULT([buggy])
  2334         -	    #LIBOBJS="$LIBOBJS fixstrtod.o"
         2442  +	AC_CACHE_CHECK([for Solaris2.4/Tru64 strtod bugs], tcl_cv_strtod_buggy,[
         2443  +	    AC_TRY_RUN([
         2444  +		extern double strtod();
         2445  +		int main() {
         2446  +		    char *infString="Inf", *nanString="NaN", *spaceString=" ";
         2447  +		    char *term;
         2448  +		    double value;
         2449  +		    value = strtod(infString, &term);
         2450  +		    if ((term != infString) && (term[-1] == 0)) {
         2451  +			exit(1);
         2452  +		    }
         2453  +		    value = strtod(nanString, &term);
         2454  +		    if ((term != nanString) && (term[-1] == 0)) {
         2455  +			exit(1);
         2456  +		    }
         2457  +		    value = strtod(spaceString, &term);
         2458  +		    if (term == (spaceString+1)) {
         2459  +			exit(1);
         2460  +		    }
         2461  +		    exit(0);
         2462  +		}], tcl_cv_strtod_buggy=ok, tcl_cv_strtod_buggy=buggy,
         2463  +		    tcl_cv_strtod_buggy=buggy)])
         2464  +	if test "$tcl_cv_strtod_buggy" = buggy; then
  2335   2465   	    AC_LIBOBJ([fixstrtod])
  2336   2466   	    USE_COMPAT=1
  2337         -	    AC_DEFINE(strtod, fixstrtod)
         2467  +	    AC_DEFINE(strtod, fixstrtod, [Do we want to use the strtod() in compat?])
  2338   2468   	fi
  2339   2469       fi
  2340   2470   ])
  2341   2471   
  2342   2472   #--------------------------------------------------------------------
  2343   2473   # TEA_TCL_LINK_LIBS
  2344   2474   #
................................................................................
  2362   2492   #		LIBS
  2363   2493   #
  2364   2494   #	Might define the following vars:
  2365   2495   #		HAVE_NET_ERRNO_H
  2366   2496   #
  2367   2497   #--------------------------------------------------------------------
  2368   2498   
  2369         -AC_DEFUN(TEA_TCL_LINK_LIBS, [
         2499  +AC_DEFUN([TEA_TCL_LINK_LIBS], [
  2370   2500       #--------------------------------------------------------------------
  2371   2501       # On a few very rare systems, all of the libm.a stuff is
  2372   2502       # already in libc.a.  Set compiler flags accordingly.
  2373   2503       # Also, Linux requires the "ieee" library for math to work
  2374   2504       # right (and it must appear before "-lm").
  2375   2505       #--------------------------------------------------------------------
  2376   2506   
................................................................................
  2379   2509   
  2380   2510       #--------------------------------------------------------------------
  2381   2511       # Interactive UNIX requires -linet instead of -lsocket, plus it
  2382   2512       # needs net/errno.h to define the socket-related error codes.
  2383   2513       #--------------------------------------------------------------------
  2384   2514   
  2385   2515       AC_CHECK_LIB(inet, main, [LIBS="$LIBS -linet"])
  2386         -    AC_CHECK_HEADER(net/errno.h, AC_DEFINE(HAVE_NET_ERRNO_H))
         2516  +    AC_CHECK_HEADER(net/errno.h, [
         2517  +	AC_DEFINE(HAVE_NET_ERRNO_H, 1, [Do we have <net/errno.h>?])])
  2387   2518   
  2388   2519       #--------------------------------------------------------------------
  2389   2520       #	Check for the existence of the -lsocket and -lnsl libraries.
  2390   2521       #	The order here is important, so that they end up in the right
  2391   2522       #	order in the command line generated by make.  Here are some
  2392   2523       #	special considerations:
  2393   2524       #	1. Use "connect" and "accept" to check for -lsocket, and
................................................................................
  2435   2566   #	None
  2436   2567   #	
  2437   2568   # Results:
  2438   2569   #
  2439   2570   #	Might define the following vars:
  2440   2571   #		_ISOC99_SOURCE
  2441   2572   #		_LARGEFILE64_SOURCE
         2573  +#		_LARGEFILE_SOURCE64
  2442   2574   #
  2443   2575   #--------------------------------------------------------------------
  2444   2576   
  2445         -AC_DEFUN(TEA_TCL_EARLY_FLAG,[
         2577  +AC_DEFUN([TEA_TCL_EARLY_FLAG],[
  2446   2578       AC_CACHE_VAL([tcl_cv_flag_]translit($1,[A-Z],[a-z]),
  2447   2579   	AC_TRY_COMPILE([$2], $3, [tcl_cv_flag_]translit($1,[A-Z],[a-z])=no,
  2448   2580   	    AC_TRY_COMPILE([[#define ]$1[ 1
  2449   2581   ]$2], $3,
  2450   2582   		[tcl_cv_flag_]translit($1,[A-Z],[a-z])=yes,
  2451   2583   		[tcl_cv_flag_]translit($1,[A-Z],[a-z])=no)))
  2452   2584       if test ["x${tcl_cv_flag_]translit($1,[A-Z],[a-z])[}" = "xyes"] ; then
  2453         -	AC_DEFINE($1)
         2585  +	AC_DEFINE($1, 1, [Add the ]$1[ flag when building])
  2454   2586   	tcl_flags="$tcl_flags $1"
  2455   2587       fi
  2456   2588   ])
  2457   2589   
  2458         -AC_DEFUN(TEA_TCL_EARLY_FLAGS,[
         2590  +AC_DEFUN([TEA_TCL_EARLY_FLAGS],[
  2459   2591       AC_MSG_CHECKING([for required early compiler flags])
  2460   2592       tcl_flags=""
  2461   2593       TEA_TCL_EARLY_FLAG(_ISOC99_SOURCE,[#include <stdlib.h>],
  2462   2594   	[char *p = (char *)strtoll; char *q = (char *)strtoull;])
  2463   2595       TEA_TCL_EARLY_FLAG(_LARGEFILE64_SOURCE,[#include <sys/stat.h>],
  2464   2596   	[struct stat64 buf; int i = stat64("/", &buf);])
         2597  +    TEA_TCL_EARLY_FLAG(_LARGEFILE_SOURCE64,[#include <sys/stat.h>],
         2598  +	[char *p = (char *)open64;])
  2465   2599       if test "x${tcl_flags}" = "x" ; then
  2466   2600   	AC_MSG_RESULT([none])
  2467   2601       else
  2468   2602   	AC_MSG_RESULT([${tcl_flags}])
  2469   2603       fi
  2470   2604   ])
  2471   2605   
................................................................................
  2484   2618   #		TCL_WIDE_INT_TYPE
  2485   2619   #		HAVE_STRUCT_DIRENT64
  2486   2620   #		HAVE_STRUCT_STAT64
  2487   2621   #		HAVE_TYPE_OFF64_T
  2488   2622   #
  2489   2623   #--------------------------------------------------------------------
  2490   2624   
  2491         -AC_DEFUN(TEA_TCL_64BIT_FLAGS, [
         2625  +AC_DEFUN([TEA_TCL_64BIT_FLAGS], [
  2492   2626       AC_MSG_CHECKING([for 64-bit integer type])
  2493   2627       AC_CACHE_VAL(tcl_cv_type_64bit,[
  2494   2628   	tcl_cv_type_64bit=none
  2495   2629   	# See if the compiler knows natively about __int64
  2496   2630   	AC_TRY_COMPILE(,[__int64 value = (__int64) 0;],
  2497   2631   	    tcl_type_64bit=__int64, tcl_type_64bit="long long")
  2498   2632   	# See if we should use long anyway  Note that we substitute in the
  2499   2633   	# type that is our current guess for a 64-bit type inside this check
  2500   2634   	# program, so it should be modified only carefully...
  2501   2635           AC_TRY_COMPILE(,[switch (0) { 
  2502   2636               case 1: case (sizeof(]${tcl_type_64bit}[)==sizeof(long)): ; 
  2503   2637           }],tcl_cv_type_64bit=${tcl_type_64bit})])
  2504   2638       if test "${tcl_cv_type_64bit}" = none ; then
  2505         -	AC_DEFINE(TCL_WIDE_INT_IS_LONG)
         2639  +	AC_DEFINE(TCL_WIDE_INT_IS_LONG, 1, [Are wide integers to be implemented with C 'long's?])
  2506   2640   	AC_MSG_RESULT([using long])
  2507         -    elif test "${tcl_cv_type_64bit}" = "__int64" ; then
         2641  +    elif test "${tcl_cv_type_64bit}" = "__int64" \
         2642  +		-a "${TEA_PLATFORM}" = "windows" ; then
  2508   2643   	# We actually want to use the default tcl.h checks in this
  2509   2644   	# case to handle both TCL_WIDE_INT_TYPE and TCL_LL_MODIFIER*
  2510   2645   	AC_MSG_RESULT([using Tcl header defaults])
  2511   2646       else
  2512         -	AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit})
         2647  +	AC_DEFINE_UNQUOTED(TCL_WIDE_INT_TYPE,${tcl_cv_type_64bit},
         2648  +	    [What type should be used to define wide integers?])
  2513   2649   	AC_MSG_RESULT([${tcl_cv_type_64bit}])
  2514   2650   
  2515   2651   	# Now check for auxiliary declarations
  2516         -	AC_MSG_CHECKING([for struct dirent64])
  2517         -	AC_CACHE_VAL(tcl_cv_struct_dirent64,[
         2652  +	AC_CACHE_CHECK([for struct dirent64], tcl_cv_struct_dirent64,[
  2518   2653   	    AC_TRY_COMPILE([#include <sys/types.h>
  2519   2654   #include <sys/dirent.h>],[struct dirent64 p;],
  2520   2655   		tcl_cv_struct_dirent64=yes,tcl_cv_struct_dirent64=no)])
  2521   2656   	if test "x${tcl_cv_struct_dirent64}" = "xyes" ; then
  2522         -	    AC_DEFINE(HAVE_STRUCT_DIRENT64)
         2657  +	    AC_DEFINE(HAVE_STRUCT_DIRENT64, 1, [Is 'struct dirent64' in <sys/types.h>?])
  2523   2658   	fi
  2524         -	AC_MSG_RESULT([${tcl_cv_struct_dirent64}])
  2525   2659   
  2526         -	AC_MSG_CHECKING([for struct stat64])
  2527         -	AC_CACHE_VAL(tcl_cv_struct_stat64,[
         2660  +	AC_CACHE_CHECK([for struct stat64], tcl_cv_struct_stat64,[
  2528   2661   	    AC_TRY_COMPILE([#include <sys/stat.h>],[struct stat64 p;
  2529   2662   ],
  2530   2663   		tcl_cv_struct_stat64=yes,tcl_cv_struct_stat64=no)])
  2531   2664   	if test "x${tcl_cv_struct_stat64}" = "xyes" ; then
  2532         -	    AC_DEFINE(HAVE_STRUCT_STAT64)
         2665  +	    AC_DEFINE(HAVE_STRUCT_STAT64, 1, [Is 'struct stat64' in <sys/stat.h>?])
  2533   2666   	fi
  2534         -	AC_MSG_RESULT([${tcl_cv_struct_stat64}])
  2535   2667   
         2668  +	AC_CHECK_FUNCS(open64 lseek64)
  2536   2669   	AC_MSG_CHECKING([for off64_t])
  2537   2670   	AC_CACHE_VAL(tcl_cv_type_off64_t,[
  2538   2671   	    AC_TRY_COMPILE([#include <sys/types.h>],[off64_t offset;
  2539   2672   ],
  2540   2673   		tcl_cv_type_off64_t=yes,tcl_cv_type_off64_t=no)])
  2541         -	if test "x${tcl_cv_type_off64_t}" = "xyes" ; then
  2542         -	    AC_DEFINE(HAVE_TYPE_OFF64_T)
         2674  +	dnl Define HAVE_TYPE_OFF64_T only when the off64_t type and the
         2675  +	dnl functions lseek64 and open64 are defined.
         2676  +	if test "x${tcl_cv_type_off64_t}" = "xyes" && \
         2677  +	        test "x${ac_cv_func_lseek64}" = "xyes" && \
         2678  +	        test "x${ac_cv_func_open64}" = "xyes" ; then
         2679  +	    AC_DEFINE(HAVE_TYPE_OFF64_T, 1, [Is off64_t in <sys/types.h>?])
         2680  +	    AC_MSG_RESULT([yes])
         2681  +	else
         2682  +	    AC_MSG_RESULT([no])
  2543   2683   	fi
  2544         -	AC_MSG_RESULT([${tcl_cv_type_off64_t}])
  2545   2684       fi
  2546   2685   ])
  2547   2686   
  2548   2687   ##
  2549   2688   ## Here ends the standard Tcl configuration bits and starts the
  2550   2689   ## TEA specific functions
  2551   2690   ##
................................................................................
  2561   2700   #
  2562   2701   # Results:
  2563   2702   #
  2564   2703   #	Defines and substs the following vars:
  2565   2704   #		CYGPATH
  2566   2705   #		EXEEXT
  2567   2706   #	Defines only:
         2707  +#		TEA_VERSION
  2568   2708   #		TEA_INITED
  2569   2709   #		TEA_PLATFORM (windows or unix)
  2570   2710   #
  2571   2711   # "cygpath" is used on windows to generate native path names for include
  2572   2712   # files. These variables should only be used with the compiler and linker
  2573   2713   # since they generate native path names.
  2574   2714   #
  2575   2715   # EXEEXT
  2576   2716   #	Select the executable extension based on the host type.  This
  2577   2717   #	is a lightweight replacement for AC_EXEEXT that doesn't require
  2578   2718   #	a compiler.
  2579   2719   #------------------------------------------------------------------------
  2580   2720   
  2581         -AC_DEFUN(TEA_INIT, [
         2721  +AC_DEFUN([TEA_INIT], [
  2582   2722       # TEA extensions pass this us the version of TEA they think they
  2583   2723       # are compatible with.
  2584         -    TEA_VERSION="3.2"
         2724  +    TEA_VERSION="3.5"
  2585   2725   
  2586   2726       AC_MSG_CHECKING([for correct TEA configuration])
  2587   2727       if test x"${PACKAGE_NAME}" = x ; then
  2588   2728   	AC_MSG_ERROR([
  2589   2729   The PACKAGE_NAME variable must be defined by your TEA configure.in])
  2590   2730       fi
  2591   2731       if test x"$1" = x ; then
................................................................................
  2650   2790   #
  2651   2791   # Results:
  2652   2792   #
  2653   2793   #	Defines and substs the following vars:
  2654   2794   #		PKG_SOURCES
  2655   2795   #		PKG_OBJECTS
  2656   2796   #------------------------------------------------------------------------
  2657         -AC_DEFUN(TEA_ADD_SOURCES, [
         2797  +AC_DEFUN([TEA_ADD_SOURCES], [
  2658   2798       vars="[email protected]"
  2659   2799       for i in $vars; do
  2660   2800   	case $i in
  2661   2801   	    [\$]*)
  2662   2802   		# allow $-var names
  2663   2803   		PKG_SOURCES="$PKG_SOURCES $i"
  2664   2804   		PKG_OBJECTS="$PKG_OBJECTS $i"
................................................................................
  2700   2840   #
  2701   2841   # Results:
  2702   2842   #
  2703   2843   #	Defines and substs the following vars:
  2704   2844   #		PKG_STUB_SOURCES
  2705   2845   #		PKG_STUB_OBJECTS
  2706   2846   #------------------------------------------------------------------------
  2707         -AC_DEFUN(TEA_ADD_STUB_SOURCES, [
         2847  +AC_DEFUN([TEA_ADD_STUB_SOURCES], [
  2708   2848       vars="[email protected]"
  2709   2849       for i in $vars; do
  2710   2850   	# check for existence - allows for generic/win/unix VPATH
  2711   2851   	if test ! -f "${srcdir}/$i" -a ! -f "${srcdir}/generic/$i" \
  2712   2852   	    -a ! -f "${srcdir}/win/$i" -a ! -f "${srcdir}/unix/$i" \
  2713   2853   	    ; then
  2714   2854   	    AC_MSG_ERROR([could not find stub source file '$i'])
................................................................................
  2738   2878   #	one or more file names
  2739   2879   #
  2740   2880   # Results:
  2741   2881   #
  2742   2882   #	Defines and substs the following vars:
  2743   2883   #		PKG_TCL_SOURCES
  2744   2884   #------------------------------------------------------------------------
  2745         -AC_DEFUN(TEA_ADD_TCL_SOURCES, [
         2885  +AC_DEFUN([TEA_ADD_TCL_SOURCES], [
  2746   2886       vars="[email protected]"
  2747   2887       for i in $vars; do
  2748   2888   	# check for existence, be strict because it is installed
  2749   2889   	if test ! -f "${srcdir}/$i" ; then
  2750   2890   	    AC_MSG_ERROR([could not find tcl source file '${srcdir}/$i'])
  2751   2891   	fi
  2752   2892   	PKG_TCL_SOURCES="$PKG_TCL_SOURCES $i"
................................................................................
  2764   2904   #	one or more file names
  2765   2905   #
  2766   2906   # Results:
  2767   2907   #
  2768   2908   #	Defines and substs the following vars:
  2769   2909   #		PKG_HEADERS
  2770   2910   #------------------------------------------------------------------------
  2771         -AC_DEFUN(TEA_ADD_HEADERS, [
         2911  +AC_DEFUN([TEA_ADD_HEADERS], [
  2772   2912       vars="[email protected]"
  2773   2913       for i in $vars; do
  2774   2914   	# check for existence, be strict because it is installed
  2775   2915   	if test ! -f "${srcdir}/$i" ; then
  2776   2916   	    AC_MSG_ERROR([could not find header file '${srcdir}/$i'])
  2777   2917   	fi
  2778   2918   	PKG_HEADERS="$PKG_HEADERS $i"
................................................................................
  2790   2930   #	one or more file names
  2791   2931   #
  2792   2932   # Results:
  2793   2933   #
  2794   2934   #	Defines and substs the following vars:
  2795   2935   #		PKG_INCLUDES
  2796   2936   #------------------------------------------------------------------------
  2797         -AC_DEFUN(TEA_ADD_INCLUDES, [
         2937  +AC_DEFUN([TEA_ADD_INCLUDES], [
  2798   2938       vars="[email protected]"
  2799   2939       for i in $vars; do
  2800   2940   	PKG_INCLUDES="$PKG_INCLUDES $i"
  2801   2941       done
  2802   2942       AC_SUBST(PKG_INCLUDES)
  2803   2943   ])
  2804   2944   
................................................................................
  2814   2954   #	one or more file names
  2815   2955   #
  2816   2956   # Results:
  2817   2957   #
  2818   2958   #	Defines and substs the following vars:
  2819   2959   #		PKG_LIBS
  2820   2960   #------------------------------------------------------------------------
  2821         -AC_DEFUN(TEA_ADD_LIBS, [
         2961  +AC_DEFUN([TEA_ADD_LIBS], [
  2822   2962       vars="[email protected]"
  2823   2963       for i in $vars; do
  2824   2964   	if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
  2825   2965   	    # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
  2826   2966   	    i=`echo "$i" | sed -e 's/^\([[^-]].*\)\.lib[$]/-l\1/i'`
  2827   2967   	fi
  2828   2968   	PKG_LIBS="$PKG_LIBS $i"
................................................................................
  2840   2980   #	one or more file names
  2841   2981   #
  2842   2982   # Results:
  2843   2983   #
  2844   2984   #	Defines and substs the following vars:
  2845   2985   #		PKG_CFLAGS
  2846   2986   #------------------------------------------------------------------------
  2847         -AC_DEFUN(TEA_ADD_CFLAGS, [
         2987  +AC_DEFUN([TEA_ADD_CFLAGS], [
  2848   2988       PKG_CFLAGS="$PKG_CFLAGS [email protected]"
  2849   2989       AC_SUBST(PKG_CFLAGS)
  2850   2990   ])
  2851   2991   
  2852   2992   #------------------------------------------------------------------------
  2853   2993   # TEA_PREFIX --
  2854   2994   #
................................................................................
  2859   2999   #
  2860   3000   # Results:
  2861   3001   #
  2862   3002   #	If --prefix or --exec-prefix was not specified, $prefix and
  2863   3003   #	$exec_prefix will be set to the values given to Tcl when it was
  2864   3004   #	configured.
  2865   3005   #------------------------------------------------------------------------
  2866         -AC_DEFUN(TEA_PREFIX, [
         3006  +AC_DEFUN([TEA_PREFIX], [
  2867   3007       if test "${prefix}" = "NONE"; then
  2868   3008   	prefix_default=yes
  2869   3009   	if test x"${TCL_PREFIX}" != x; then
  2870   3010   	    AC_MSG_NOTICE([--prefix defaulting to TCL_PREFIX ${TCL_PREFIX}])
  2871   3011   	    prefix=${TCL_PREFIX}
  2872   3012   	else
  2873   3013   	    AC_MSG_NOTICE([--prefix defaulting to /usr/local])
................................................................................
  2895   3035   # Arguments:
  2896   3036   #	none
  2897   3037   #
  2898   3038   # Results:
  2899   3039   #
  2900   3040   #	Sets up CC var and other standard bits we need to make executables.
  2901   3041   #------------------------------------------------------------------------
  2902         -AC_DEFUN(TEA_SETUP_COMPILER_CC, [
         3042  +AC_DEFUN([TEA_SETUP_COMPILER_CC], [
  2903   3043       # Don't put any macros that use the compiler (e.g. AC_TRY_COMPILE)
  2904   3044       # in this macro, they need to go into TEA_SETUP_COMPILER instead.
  2905   3045   
  2906   3046       # If the user did not set CFLAGS, set it now to keep
  2907   3047       # the AC_PROG_CC macro from adding "-g -O2".
  2908   3048       if test "${CFLAGS+set}" != "set" ; then
  2909   3049   	CFLAGS=""
................................................................................
  2943   3083   # Arguments:
  2944   3084   #	none
  2945   3085   #
  2946   3086   # Results:
  2947   3087   #
  2948   3088   #	Sets up CC var and other standard bits we need to make executables.
  2949   3089   #------------------------------------------------------------------------
  2950         -AC_DEFUN(TEA_SETUP_COMPILER, [
         3090  +AC_DEFUN([TEA_SETUP_COMPILER], [
  2951   3091       # Any macros that use the compiler (e.g. AC_TRY_COMPILE) have to go here.
  2952   3092       AC_REQUIRE([TEA_SETUP_COMPILER_CC])
  2953   3093   
  2954   3094       #------------------------------------------------------------------------
  2955   3095       # If we're using GCC, see if the compiler understands -pipe. If so, use it.
  2956   3096       # It makes compiling go faster.  (This is only a performance feature.)
  2957   3097       #------------------------------------------------------------------------
................................................................................
  2998   3138   #                       differs depending on whether or not Tcl is being
  2999   3139   #                       compiled as a shared library.
  3000   3140   #	MAKE_SHARED_LIB	Makefile rule for building a shared library
  3001   3141   #	MAKE_STATIC_LIB	Makefile rule for building a static library
  3002   3142   #	MAKE_STUB_LIB	Makefile rule for building a stub library
  3003   3143   #------------------------------------------------------------------------
  3004   3144   
  3005         -AC_DEFUN(TEA_MAKE_LIB, [
         3145  +AC_DEFUN([TEA_MAKE_LIB], [
  3006   3146       if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes"; then
  3007   3147   	MAKE_STATIC_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_OBJECTS)"
  3008   3148   	MAKE_SHARED_LIB="\${SHLIB_LD} \${SHLIB_LD_LIBS} \${LDFLAGS_DEFAULT} -out:\[$]@ \$(PKG_OBJECTS)"
  3009   3149   	MAKE_STUB_LIB="\${STLIB_LD} -out:\[$]@ \$(PKG_STUB_OBJECTS)"
  3010   3150       else
  3011   3151   	MAKE_STATIC_LIB="\${STLIB_LD} \[$]@ \$(PKG_OBJECTS)"
  3012   3152   	MAKE_SHARED_LIB="\${SHLIB_LD} -o \[$]@ \$(PKG_OBJECTS) \${SHLIB_LD_LIBS}"
................................................................................
  3033   3173   	    if test x"${TK_BIN_DIR}" != x ; then
  3034   3174   		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${TK_BIN_DIR}/${TK_STUB_LIB_FILE}`\""
  3035   3175   	    fi
  3036   3176   	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  3037   3177   	else
  3038   3178   	    eval eval "PKG_LIB_FILE=${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  3039   3179   	fi
  3040         -	# Some packages build there own stubs libraries
         3180  +	# Some packages build their own stubs libraries
  3041   3181   	eval eval "PKG_STUB_LIB_FILE=${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
         3182  +	if test "$GCC" = "yes"; then
         3183  +	    PKG_STUB_LIB_FILE=lib${PKG_STUB_LIB_FILE}
         3184  +	fi
  3042   3185   	# These aren't needed on Windows (either MSVC or gcc)
  3043   3186   	RANLIB=:
  3044   3187   	RANLIB_STUB=:
  3045   3188       else
  3046   3189   	RANLIB_STUB="${RANLIB}"
  3047   3190   	if test "${SHARED_BUILD}" = "1" ; then
  3048   3191   	    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TCL_STUB_LIB_SPEC}"
................................................................................
  3050   3193   		SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${TK_STUB_LIB_SPEC}"
  3051   3194   	    fi
  3052   3195   	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${SHARED_LIB_SUFFIX}"
  3053   3196   	    RANLIB=:
  3054   3197   	else
  3055   3198   	    eval eval "PKG_LIB_FILE=lib${PACKAGE_NAME}${UNSHARED_LIB_SUFFIX}"
  3056   3199   	fi
  3057         -	# Some packages build there own stubs libraries
         3200  +	# Some packages build their own stubs libraries
  3058   3201   	eval eval "PKG_STUB_LIB_FILE=lib${PACKAGE_NAME}stub${UNSHARED_LIB_SUFFIX}"
  3059   3202       fi
  3060   3203   
  3061   3204       # These are escaped so that only CFLAGS is picked up at configure time.
  3062   3205       # The other values will be substituted at make time.
  3063   3206       CFLAGS="${CFLAGS} \${CFLAGS_DEFAULT} \${CFLAGS_WARNING}"
  3064   3207       if test "${SHARED_BUILD}" = "1" ; then
................................................................................
  3091   3234   # Results:
  3092   3235   #
  3093   3236   #	Defines the following vars:
  3094   3237   #		${basename}_LIB_NAME	The computed library name.
  3095   3238   #		${basename}_LIB_SPEC	The computed linker flags.
  3096   3239   #------------------------------------------------------------------------
  3097   3240   
  3098         -AC_DEFUN(TEA_LIB_SPEC, [
         3241  +AC_DEFUN([TEA_LIB_SPEC], [
  3099   3242       AC_MSG_CHECKING([for $1 library])
  3100   3243   
  3101   3244       # Look in exec-prefix for the library (defined by TEA_PREFIX).
  3102   3245   
  3103   3246       tea_lib_name_dir="${exec_prefix}/lib"
  3104   3247   
  3105   3248       # Or in a user-specified location.
................................................................................
  3164   3307   #		TCL_BMAP_DIR_NATIVE
  3165   3308   #		TCL_TOOL_DIR_NATIVE
  3166   3309   #		TCL_PLATFORM_DIR_NATIVE
  3167   3310   #		TCL_BIN_DIR_NATIVE
  3168   3311   #		TCL_INCLUDES
  3169   3312   #------------------------------------------------------------------------
  3170   3313   
  3171         -AC_DEFUN(TEA_PRIVATE_TCL_HEADERS, [
         3314  +AC_DEFUN([TEA_PRIVATE_TCL_HEADERS], [
  3172   3315       AC_MSG_CHECKING([for Tcl private include files])
  3173   3316   
         3317  +    TCL_SRC_DIR_NATIVE=`${CYGPATH} ${TCL_SRC_DIR}`
         3318  +    TCL_TOP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}\"
         3319  +    TCL_GENERIC_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/generic\"
         3320  +    TCL_UNIX_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/unix\"
         3321  +    TCL_WIN_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/win\"
         3322  +    TCL_BMAP_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/bitmaps\"
         3323  +    TCL_TOOL_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/tools\"
         3324  +    TCL_COMPAT_DIR_NATIVE=\"${TCL_SRC_DIR_NATIVE}/compat\"
         3325  +
  3174   3326       if test "${TEA_PLATFORM}" = "windows"; then
  3175         -	TCL_TOP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}`\"
  3176         -	TCL_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/generic`\"
  3177         -	TCL_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/unix`\"
  3178         -	TCL_WIN_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/win`\"
  3179         -	TCL_BMAP_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/bitmaps`\"
  3180         -	TCL_TOOL_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/tools`\"
  3181         -	TCL_COMPAT_DIR_NATIVE=\"`${CYGPATH} ${TCL_SRC_DIR}/compat`\"
  3182   3327   	TCL_PLATFORM_DIR_NATIVE=${TCL_WIN_DIR_NATIVE}
  3183         -
  3184         -	TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
  3185   3328       else
  3186         -	TCL_TOP_DIR_NATIVE='$(TCL_SRC_DIR)'
  3187         -	TCL_GENERIC_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/generic'
  3188         -	TCL_UNIX_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/unix'
  3189         -	TCL_WIN_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/win'
  3190         -	TCL_BMAP_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/bitmaps'
  3191         -	TCL_TOOL_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/tools'
  3192         -	TCL_COMPAT_DIR_NATIVE='${TCL_TOP_DIR_NATIVE}/compat'
  3193   3329   	TCL_PLATFORM_DIR_NATIVE=${TCL_UNIX_DIR_NATIVE}
  3194         -
  3195         -	# substitute these in "relaxed" so that TCL_INCLUDES still works
  3196         -	# without requiring the other vars to be defined in the Makefile
  3197         -	eval "TCL_INCLUDES=\"-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}\""
         3330  +    fi
         3331  +    # We want to ensure these are substituted so as not to require
         3332  +    # any *_NATIVE vars be defined in the Makefile
         3333  +    TCL_INCLUDES="-I${TCL_GENERIC_DIR_NATIVE} -I${TCL_PLATFORM_DIR_NATIVE}"
         3334  +    if test "`uname -s`" = "Darwin"; then
         3335  +        # If Tcl was built as a framework, attempt to use
         3336  +        # the framework's Headers and PrivateHeaders directories
         3337  +        case ${TCL_DEFS} in
         3338  +	    *TCL_FRAMEWORK*)
         3339  +	        if test -d "${TCL_BIN_DIR}/Headers" -a -d "${TCL_BIN_DIR}/PrivateHeaders"; then
         3340  +	        TCL_INCLUDES="-I\"${TCL_BIN_DIR}/Headers\" -I\"${TCL_BIN_DIR}/PrivateHeaders\" ${TCL_INCLUDES}"; else
         3341  +	        TCL_INCLUDES="${TCL_INCLUDES} ${TCL_INCLUDE_SPEC} `echo "${TCL_INCLUDE_SPEC}" | sed -e 's/Headers/PrivateHeaders/'`"; fi
         3342  +	        ;;
         3343  +	esac
  3198   3344       fi
  3199   3345   
  3200   3346       AC_SUBST(TCL_TOP_DIR_NATIVE)
  3201   3347       AC_SUBST(TCL_GENERIC_DIR_NATIVE)
  3202   3348       AC_SUBST(TCL_UNIX_DIR_NATIVE)
  3203   3349       AC_SUBST(TCL_WIN_DIR_NATIVE)
  3204   3350       AC_SUBST(TCL_BMAP_DIR_NATIVE)
................................................................................
  3225   3371   #	Adds a --with-tclinclude switch to configure.
  3226   3372   #	Result is cached.
  3227   3373   #
  3228   3374   #	Substs the following vars:
  3229   3375   #		TCL_INCLUDES
  3230   3376   #------------------------------------------------------------------------
  3231   3377   
  3232         -AC_DEFUN(TEA_PUBLIC_TCL_HEADERS, [
         3378  +AC_DEFUN([TEA_PUBLIC_TCL_HEADERS], [
  3233   3379       AC_MSG_CHECKING([for Tcl public headers])
  3234   3380   
  3235   3381       AC_ARG_WITH(tclinclude, [  --with-tclinclude       directory containing the public Tcl header files], with_tclinclude=${withval})
  3236   3382   
  3237   3383       AC_CACHE_VAL(ac_cv_c_tclh, [
  3238   3384   	# Use the value from --with-tclinclude, if it was given
  3239   3385   
................................................................................
  3240   3386   	if test x"${with_tclinclude}" != x ; then
  3241   3387   	    if test -f "${with_tclinclude}/tcl.h" ; then
  3242   3388   		ac_cv_c_tclh=${with_tclinclude}
  3243   3389   	    else
  3244   3390   		AC_MSG_ERROR([${with_tclinclude} directory does not contain tcl.h])
  3245   3391   	    fi
  3246   3392   	else
         3393  +	    if test "`uname -s`" = "Darwin"; then
         3394  +		# If Tcl was built as a framework, attempt to use
         3395  +		# the framework's Headers directory
         3396  +		case ${TCL_DEFS} in
         3397  +		    *TCL_FRAMEWORK*)
         3398  +			list="`ls -d ${TCL_BIN_DIR}/Headers 2>/dev/null`"
         3399  +			;;
         3400  +		esac
         3401  +	    fi
         3402  +
         3403  +	    # Look in the source dir only if Tcl is not installed,
         3404  +	    # and in that situation, look there before installed locations.
         3405  +	    if test -f "${TCL_BIN_DIR}/Makefile" ; then
         3406  +		list="$list `ls -d ${TCL_SRC_DIR}/generic 2>/dev/null`"
         3407  +	    fi
         3408  +
  3247   3409   	    # Check order: pkg --prefix location, Tcl's --prefix location,
  3248         -	    # directory of tclConfig.sh, and Tcl source directory.
  3249         -	    # Looking in the source dir is not ideal, but OK.
         3410  +	    # relative to directory of tclConfig.sh.
  3250   3411   
  3251   3412   	    eval "temp_includedir=${includedir}"
  3252         -	    list="`ls -d ${temp_includedir}      2>/dev/null` \
         3413  +	    list="$list \
         3414  +		`ls -d ${temp_includedir}        2>/dev/null` \
  3253   3415   		`ls -d ${TCL_PREFIX}/include     2>/dev/null` \
  3254         -		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \
  3255         -		`ls -d ${TCL_SRC_DIR}/generic    2>/dev/null`"
         3416  +		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
  3256   3417   	    if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
  3257   3418   		list="$list /usr/local/include /usr/include"
         3419  +		if test x"${TCL_INCLUDE_SPEC}" != x ; then
         3420  +		    d=`echo "${TCL_INCLUDE_SPEC}" | sed -e 's/^-I//'`
         3421  +		    list="$list `ls -d ${d} 2>/dev/null`"
         3422  +		fi
  3258   3423   	    fi
  3259   3424   	    for i in $list ; do
  3260   3425   		if test -f "$i/tcl.h" ; then
  3261   3426   		    ac_cv_c_tclh=$i
  3262   3427   		    break
  3263   3428   		fi
  3264   3429   	    done
................................................................................
  3295   3460   #
  3296   3461   # Results:
  3297   3462   #
  3298   3463   #	Substs the following vars:
  3299   3464   #		TK_INCLUDES
  3300   3465   #------------------------------------------------------------------------
  3301   3466   
  3302         -AC_DEFUN(TEA_PRIVATE_TK_HEADERS, [
         3467  +AC_DEFUN([TEA_PRIVATE_TK_HEADERS], [
  3303   3468       AC_MSG_CHECKING([for Tk private include files])
  3304   3469   
         3470  +    TK_SRC_DIR_NATIVE=`${CYGPATH} ${TK_SRC_DIR}`
         3471  +    TK_TOP_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}\"
         3472  +    TK_UNIX_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/unix\"
         3473  +    TK_WIN_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/win\"
         3474  +    TK_GENERIC_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/generic\"
         3475  +    TK_XLIB_DIR_NATIVE=\"${TK_SRC_DIR_NATIVE}/xlib\"
  3305   3476       if test "${TEA_PLATFORM}" = "windows"; then
  3306         -	TK_TOP_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}`\"
  3307         -	TK_UNIX_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/unix`\"
  3308         -	TK_WIN_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/win`\"
  3309         -	TK_GENERIC_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/generic`\"
  3310         -	TK_XLIB_DIR_NATIVE=\"`${CYGPATH} ${TK_SRC_DIR}/xlib`\"
  3311   3477   	TK_PLATFORM_DIR_NATIVE=${TK_WIN_DIR_NATIVE}
  3312         -
  3313         -	TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE} -I${TK_XLIB_DIR_NATIVE}"
  3314   3478       else
  3315         -	TK_TOP_DIR_NATIVE='${TK_SRC_DIR}'
  3316         -	TK_GENERIC_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/generic'
  3317         -	TK_UNIX_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/unix'
  3318         -	TK_WIN_DIR_NATIVE='${TK_TOP_DIR_NATIVE}/win'
  3319   3479   	TK_PLATFORM_DIR_NATIVE=${TK_UNIX_DIR_NATIVE}
  3320         -
  3321         -	# substitute these in "relaxed" so that TK_INCLUDES still works
  3322         -	# without requiring the other vars to be defined in the Makefile
  3323         -	eval "TK_INCLUDES=\"-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}\""
         3480  +    fi
         3481  +    # We want to ensure these are substituted so as not to require
         3482  +    # any *_NATIVE vars be defined in the Makefile
         3483  +    TK_INCLUDES="-I${TK_GENERIC_DIR_NATIVE} -I${TK_PLATFORM_DIR_NATIVE}"
         3484  +    if test "${TEA_WINDOWINGSYSTEM}" = "win32" \
         3485  +	-o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
         3486  +	TK_INCLUDES="${TK_INCLUDES} -I${TK_XLIB_DIR_NATIVE}"
         3487  +    fi
         3488  +    if test "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
         3489  +	TK_INCLUDES="${TK_INCLUDES} -I${TK_SRC_DIR_NATIVE}/macosx"
         3490  +    fi
         3491  +    if test "`uname -s`" = "Darwin"; then
         3492  +        # If Tk was built as a framework, attempt to use
         3493  +        # the framework's Headers and PrivateHeaders directories
         3494  +        case ${TK_DEFS} in
         3495  +	    *TK_FRAMEWORK*)
         3496  +	        if test -d "${TK_BIN_DIR}/Headers" -a -d "${TK_BIN_DIR}/PrivateHeaders"; then
         3497  +	        TK_INCLUDES="-I\"${TK_BIN_DIR}/Headers\" -I\"${TK_BIN_DIR}/PrivateHeaders\" ${TK_INCLUDES}"; fi
         3498  +	        ;;
         3499  +	esac
  3324   3500       fi
  3325   3501   
  3326   3502       AC_SUBST(TK_TOP_DIR_NATIVE)
  3327   3503       AC_SUBST(TK_UNIX_DIR_NATIVE)
  3328   3504       AC_SUBST(TK_WIN_DIR_NATIVE)
  3329   3505       AC_SUBST(TK_GENERIC_DIR_NATIVE)
  3330   3506       AC_SUBST(TK_XLIB_DIR_NATIVE)
................................................................................
  3350   3526   #	Adds a --with-tkinclude switch to configure.
  3351   3527   #	Result is cached.
  3352   3528   #
  3353   3529   #	Substs the following vars:
  3354   3530   #		TK_INCLUDES
  3355   3531   #------------------------------------------------------------------------
  3356   3532   
  3357         -AC_DEFUN(TEA_PUBLIC_TK_HEADERS, [
         3533  +AC_DEFUN([TEA_PUBLIC_TK_HEADERS], [
  3358   3534       AC_MSG_CHECKING([for Tk public headers])
  3359   3535   
  3360   3536       AC_ARG_WITH(tkinclude, [  --with-tkinclude      directory containing the public Tk header files.], with_tkinclude=${withval})
  3361   3537   
  3362   3538       AC_CACHE_VAL(ac_cv_c_tkh, [
  3363   3539   	# Use the value from --with-tkinclude, if it was given
  3364   3540   
................................................................................
  3365   3541   	if test x"${with_tkinclude}" != x ; then
  3366   3542   	    if test -f "${with_tkinclude}/tk.h" ; then
  3367   3543   		ac_cv_c_tkh=${with_tkinclude}
  3368   3544   	    else
  3369   3545   		AC_MSG_ERROR([${with_tkinclude} directory does not contain tk.h])
  3370   3546   	    fi
  3371   3547   	else
  3372         -	    # Check order: pkg --prefix location, Tcl's --prefix location,
  3373         -	    # directory of tclConfig.sh, and Tcl source directory.
  3374         -	    # Looking in the source dir is not ideal, but OK.
         3548  +	    if test "`uname -s`" = "Darwin"; then
         3549  +		# If Tk was built as a framework, attempt to use
         3550  +		# the framework's Headers directory.
         3551  +		case ${TK_DEFS} in
         3552  +		    *TK_FRAMEWORK*)
         3553  +			list="`ls -d ${TK_BIN_DIR}/Headers 2>/dev/null`"
         3554  +			;;
         3555  +		esac
         3556  +	    fi
         3557  +
         3558  +	    # Look in the source dir only if Tk is not installed,
         3559  +	    # and in that situation, look there before installed locations.
         3560  +	    if test -f "${TK_BIN_DIR}/Makefile" ; then
         3561  +		list="$list `ls -d ${TK_SRC_DIR}/generic 2>/dev/null`"
         3562  +	    fi
         3563  +
         3564  +	    # Check order: pkg --prefix location, Tk's --prefix location,
         3565  +	    # relative to directory of tkConfig.sh, Tcl's --prefix location, 
         3566  +	    # relative to directory of tclConfig.sh.
  3375   3567   
  3376   3568   	    eval "temp_includedir=${includedir}"
  3377         -	    list="`ls -d ${temp_includedir}      2>/dev/null` \
         3569  +	    list="$list \
         3570  +		`ls -d ${temp_includedir}        2>/dev/null` \
  3378   3571   		`ls -d ${TK_PREFIX}/include      2>/dev/null` \
         3572  +		`ls -d ${TK_BIN_DIR}/../include  2>/dev/null` \
  3379   3573   		`ls -d ${TCL_PREFIX}/include     2>/dev/null` \
  3380         -		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null` \
  3381         -		`ls -d ${TK_SRC_DIR}/generic     2>/dev/null`"
         3574  +		`ls -d ${TCL_BIN_DIR}/../include 2>/dev/null`"
  3382   3575   	    if test "${TEA_PLATFORM}" != "windows" -o "$GCC" = "yes"; then
  3383   3576   		list="$list /usr/local/include /usr/include"
  3384   3577   	    fi
  3385   3578   	    for i in $list ; do
  3386   3579   		if test -f "$i/tk.h" ; then
  3387   3580   		    ac_cv_c_tkh=$i
  3388   3581   		    break
................................................................................
  3403   3596   
  3404   3597       INCLUDE_DIR_NATIVE=`${CYGPATH} ${ac_cv_c_tkh}`
  3405   3598   
  3406   3599       TK_INCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
  3407   3600   
  3408   3601       AC_SUBST(TK_INCLUDES)
  3409   3602   
  3410         -    if test "${TEA_PLATFORM}" = "windows" ; then
  3411         -	# On Windows, we need the X compat headers
         3603  +    if test "${TEA_WINDOWINGSYSTEM}" = "win32" \
         3604  +	-o "${TEA_WINDOWINGSYSTEM}" = "aqua"; then
         3605  +	# On Windows and Aqua, we need the X compat headers
  3412   3606   	AC_MSG_CHECKING([for X11 header files])
  3413   3607   	if test ! -r "${INCLUDE_DIR_NATIVE}/X11/Xlib.h"; then
  3414   3608   	    INCLUDE_DIR_NATIVE="`${CYGPATH} ${TK_SRC_DIR}/xlib`"
  3415   3609   	    TK_XINCLUDES=-I\"${INCLUDE_DIR_NATIVE}\"
  3416   3610   	    AC_SUBST(TK_XINCLUDES)
  3417   3611   	fi
  3418   3612   	AC_MSG_RESULT([${INCLUDE_DIR_NATIVE}])
  3419   3613       fi
  3420   3614   ])
  3421   3615   
  3422   3616   #------------------------------------------------------------------------
  3423   3617   # TEA_PROG_TCLSH
  3424         -#	Locate a tclsh shell in the following directories:
  3425         -#		${TCL_BIN_DIR}		${TCL_BIN_DIR}/../bin
  3426         -#		${exec_prefix}/bin	${prefix}/bin
  3427         -#		${PATH}
         3618  +#	Determine the fully qualified path name of the tclsh executable
         3619  +#	in the Tcl build directory or the tclsh installed in a bin
         3620  +#	directory. This macro will correctly determine the name
         3621  +#	of the tclsh executable even if tclsh has not yet been
         3622  +#	built in the build directory. The tclsh found is always
         3623  +#	associated with a tclConfig.sh file. This tclsh should be used
         3624  +#	only for running extension test cases. It should never be
         3625  +#	or generation of files (like pkgIndex.tcl) at build time.
  3428   3626   #
  3429   3627   # Arguments
  3430   3628   #	none
  3431   3629   #
  3432   3630   # Results
  3433   3631   #	Subst's the following values:
  3434   3632   #		TCLSH_PROG
  3435   3633   #------------------------------------------------------------------------
  3436   3634   
  3437         -AC_DEFUN(TEA_PROG_TCLSH, [
  3438         -    # Allow the user to provide this setting in the env
  3439         -    if test "x${TCLSH_PROG}" = "x" ; then
  3440         -	AC_MSG_CHECKING([for tclsh])
  3441         -
  3442         -	AC_CACHE_VAL(ac_cv_path_tclsh, [
  3443         -	if test "${TEA_PLATFORM}" = "windows" -a "$do64bit_ok" = "yes" \
  3444         -		-o "$doWince" != "no" ; then
  3445         -	    # A Windows cross-compile build - restrict target tclsh
  3446         -	    # as we need one we can run on this system
  3447         -	    search_path=`echo ${PATH} | sed -e 's/:/ /g'`
  3448         -	else
  3449         -	    search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'`
  3450         -	fi
  3451         -	for dir in $search_path ; do
  3452         -	    for j in `ls -r $dir/tclsh[[8-9]]*${EXEEXT} 2> /dev/null` \
  3453         -		    `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do
  3454         -		if test x"$ac_cv_path_tclsh" = x ; then
  3455         -		    if test -f "$j" ; then
  3456         -			ac_cv_path_tclsh=$j
  3457         -			break
  3458         -		    fi
  3459         -		fi
  3460         -	    done
  3461         -	done
  3462         -	])
  3463         -
  3464         -	if test -f "$ac_cv_path_tclsh" ; then
  3465         -	    TCLSH_PROG=$ac_cv_path_tclsh
  3466         -	    AC_MSG_RESULT([$TCLSH_PROG])
  3467         -	else
  3468         -	    AC_MSG_ERROR([No tclsh found in PATH: $search_path])
  3469         -	fi
         3635  +AC_DEFUN([TEA_PROG_TCLSH], [
         3636  +    AC_MSG_CHECKING([for tclsh])
         3637  +    if test -f "${TCL_BIN_DIR}/Makefile" ; then
         3638  +        # tclConfig.sh is in Tcl build directory
         3639  +        if test "${TEA_PLATFORM}" = "windows"; then
         3640  +            TCLSH_PROG="${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
         3641  +        else
         3642  +            TCLSH_PROG="${TCL_BIN_DIR}/tclsh"
         3643  +        fi
         3644  +    else
         3645  +        # tclConfig.sh is in install location
         3646  +        if test "${TEA_PLATFORM}" = "windows"; then
         3647  +            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT}"
         3648  +        else
         3649  +            TCLSH_PROG="tclsh${TCL_MAJOR_VERSION}.${TCL_MINOR_VERSION}${TCL_DBGX}"
         3650  +        fi
         3651  +        list="`ls -d ${TCL_BIN_DIR}/../bin 2>/dev/null` \
         3652  +              `ls -d ${TCL_BIN_DIR}/..     2>/dev/null` \
         3653  +              `ls -d ${TCL_PREFIX}/bin     2>/dev/null`"
         3654  +        for i in $list ; do
         3655  +            if test -f "$i/${TCLSH_PROG}" ; then
         3656  +                REAL_TCL_BIN_DIR="`cd "$i"; pwd`"
         3657  +                break
         3658  +            fi
         3659  +        done
         3660  +        TCLSH_PROG="${REAL_TCL_BIN_DIR}/${TCLSH_PROG}"
  3470   3661       fi
         3662  +    AC_MSG_RESULT([${TCLSH_PROG}])
  3471   3663       AC_SUBST(TCLSH_PROG)
  3472   3664   ])
  3473   3665   
  3474   3666   #------------------------------------------------------------------------
  3475   3667   # TEA_PROG_WISH
  3476         -#	Locate a wish shell in the following directories:
  3477         -#		${TK_BIN_DIR}		${TK_BIN_DIR}/../bin
  3478         -#		${TCL_BIN_DIR}		${TCL_BIN_DIR}/../bin
  3479         -#		${exec_prefix}/bin	${prefix}/bin
  3480         -#		${PATH}
         3668  +#	Determine the fully qualified path name of the wish executable
         3669  +#	in the Tk build directory or the wish installed in a bin
         3670  +#	directory. This macro will correctly determine the name
         3671  +#	of the wish executable even if wish has not yet been
         3672  +#	built in the build directory. The wish found is always
         3673  +#	associated with a tkConfig.sh file. This wish should be used
         3674  +#	only for running extension test cases. It should never be
         3675  +#	or generation of files (like pkgIndex.tcl) at build time.
  3481   3676   #
  3482   3677   # Arguments
  3483   3678   #	none
  3484   3679   #
  3485   3680   # Results
  3486   3681   #	Subst's the following values:
  3487   3682   #		WISH_PROG
  3488   3683   #------------------------------------------------------------------------
  3489   3684   
  3490         -AC_DEFUN(TEA_PROG_WISH, [
  3491         -    # Allow the user to provide this setting in the env
  3492         -    if test "x${WISH_PROG}" = "x" ; then
  3493         -	AC_MSG_CHECKING([for wish])
  3494         -
  3495         -	AC_CACHE_VAL(ac_cv_path_wish, [
  3496         -	if test "${TEA_PLATFORM}" = "windows" -a "$do64bit_ok" = "yes" \
  3497         -		-o "$doWince" != "no" ; then
  3498         -	    # A Windows cross-compile build - restrict target tclsh
  3499         -	    # as we need one we can run on this system
  3500         -	    search_path=`echo ${PATH} | sed -e 's/:/ /g'`
  3501         -	else
  3502         -	    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'`
  3503         -	fi
  3504         -	for dir in $search_path ; do
  3505         -	    for j in `ls -r $dir/wish[[8-9]]*${EXEEXT} 2> /dev/null` \
  3506         -		    `ls -r $dir/wish*${EXEEXT} 2> /dev/null` ; do
  3507         -		if test x"$ac_cv_path_wish" = x ; then
  3508         -		    if test -f "$j" ; then
  3509         -			ac_cv_path_wish=$j
  3510         -			break
  3511         -		    fi
  3512         -		fi
  3513         -	    done
  3514         -	done
  3515         -	])
  3516         -
  3517         -	if test -f "$ac_cv_path_wish" ; then
  3518         -	WISH_PROG=$ac_cv_path_wish
  3519         -	    AC_MSG_RESULT([$WISH_PROG])
  3520         -	else
  3521         -	    AC_MSG_ERROR([No wish found in PATH: $search_path])
  3522         -	fi
         3685  +AC_DEFUN([TEA_PROG_WISH], [
         3686  +    AC_MSG_CHECKING([for wish])
         3687  +    if test -f "${TK_BIN_DIR}/Makefile" ; then
         3688  +        # tkConfig.sh is in Tk build directory
         3689  +        if test "${TEA_PLATFORM}" = "windows"; then
         3690  +            WISH_PROG="${TK_BIN_DIR}/wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
         3691  +        else
         3692  +            WISH_PROG="${TK_BIN_DIR}/wish"
         3693  +        fi
         3694  +    else
         3695  +        # tkConfig.sh is in install location
         3696  +        if test "${TEA_PLATFORM}" = "windows"; then
         3697  +            WISH_PROG="wish${TK_MAJOR_VERSION}${TK_MINOR_VERSION}${TK_DBGX}${EXEEXT}"
         3698  +        else
         3699  +            WISH_PROG="wish${TK_MAJOR_VERSION}.${TK_MINOR_VERSION}${TK_DBGX}"
         3700  +        fi
         3701  +        list="`ls -d ${TK_BIN_DIR}/../bin 2>/dev/null` \
         3702  +              `ls -d ${TK_BIN_DIR}/..     2>/dev/null` \
         3703  +              `ls -d ${TK_PREFIX}/bin     2>/dev/null`"
         3704  +        for i in $list ; do
         3705  +            if test -f "$i/${WISH_PROG}" ; then
         3706  +                REAL_TK_BIN_DIR="`cd "$i"; pwd`"
         3707  +                break
         3708  +            fi
         3709  +        done
         3710  +        WISH_PROG="${REAL_TK_BIN_DIR}/${WISH_PROG}"
  3523   3711       fi
         3712  +    AC_MSG_RESULT([${WISH_PROG}])
  3524   3713       AC_SUBST(WISH_PROG)
  3525   3714   ])
  3526   3715   
  3527   3716   #------------------------------------------------------------------------
  3528   3717   # TEA_PATH_CONFIG --
  3529   3718   #
  3530   3719   #	Locate the ${1}Config.sh file and perform a sanity check on
................................................................................
  3540   3729   #		--with-$1=...
  3541   3730   #
  3542   3731   #	Defines the following vars:
  3543   3732   #		$1_BIN_DIR	Full path to the directory containing
  3544   3733   #				the $1Config.sh file
  3545   3734   #------------------------------------------------------------------------
  3546   3735   
  3547         -AC_DEFUN(TEA_PATH_CONFIG, [
         3736  +AC_DEFUN([TEA_PATH_CONFIG], [
  3548   3737       #
  3549   3738       # Ok, lets find the $1 configuration
  3550   3739       # First, look for one uninstalled.
  3551   3740       # the alternative search directory is invoked by --with-$1
  3552   3741       #
  3553   3742   
  3554   3743       if test x"${no_$1}" = x ; then
................................................................................
  3556   3745   	no_$1=true
  3557   3746   	AC_ARG_WITH($1, [  --with-$1              directory containing $1 configuration ($1Config.sh)], with_$1config=${withval})
  3558   3747   	AC_MSG_CHECKING([for $1 configuration])
  3559   3748   	AC_CACHE_VAL(ac_cv_c_$1config,[
  3560   3749   
  3561   3750   	    # First check to see if --with-$1 was specified.
  3562   3751   	    if test x"${with_$1config}" != x ; then
         3752  +		case ${with_$1config} in
         3753  +		    */$1Config.sh )
         3754  +			if test -f ${with_$1config}; then
         3755  +			    AC_MSG_WARN([--with-$1 argument should refer to directory containing $1Config.sh, not to $1Config.sh itself])
         3756  +			    with_$1config=`echo ${with_$1config} | sed 's!/$1Config\.sh$!!'`
         3757  +			fi;;
         3758  +		esac
  3563   3759   		if test -f "${with_$1config}/$1Config.sh" ; then
  3564   3760   		    ac_cv_c_$1config=`(cd ${with_$1config}; pwd)`
  3565   3761   		else
  3566   3762   		    AC_MSG_ERROR([${with_$1config} directory doesn't contain $1Config.sh])
  3567   3763   		fi
  3568   3764   	    fi
  3569   3765   
  3570   3766   	    # then check for a private $1 installation
  3571   3767   	    if test x"${ac_cv_c_$1config}" = x ; then
  3572   3768   		for i in \
  3573   3769   			../$1 \
  3574         -			`ls -dr ../$1[[8-9]].[[0-9]]* 2>/dev/null` \
         3770  +			`ls -dr ../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
         3771  +			`ls -dr ../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
         3772  +			`ls -dr ../$1*[[0-9]].[[0-9]] 2>/dev/null` \
         3773  +			`ls -dr ../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
  3575   3774   			../../$1 \
  3576         -			`ls -dr ../../$1[[8-9]].[[0-9]]* 2>/dev/null` \
         3775  +			`ls -dr ../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
         3776  +			`ls -dr ../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
         3777  +			`ls -dr ../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
         3778  +			`ls -dr ../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
  3577   3779   			../../../$1 \
  3578         -			`ls -dr ../../../$1[[8-9]].[[0-9]]* 2>/dev/null` \
         3780  +			`ls -dr ../../../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
         3781  +			`ls -dr ../../../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
         3782  +			`ls -dr ../../../$1*[[0-9]].[[0-9]] 2>/dev/null` \
         3783  +			`ls -dr ../../../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
  3579   3784   			${srcdir}/../$1 \
  3580         -			`ls -dr ${srcdir}/../$1[[8-9]].[[0-9]]* 2>/dev/null` \
         3785  +			`ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]*.[[0-9]]* 2>/dev/null` \
         3786  +			`ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]][[0-9]] 2>/dev/null` \
         3787  +			`ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]] 2>/dev/null` \
         3788  +			`ls -dr ${srcdir}/../$1*[[0-9]].[[0-9]]* 2>/dev/null` \
  3581   3789   			; do
  3582   3790   		    if test -f "$i/$1Config.sh" ; then
  3583   3791   			ac_cv_c_$1config=`(cd $i; pwd)`
  3584   3792   			break
  3585   3793   		    fi
  3586   3794   		    if test -f "$i/unix/$1Config.sh" ; then
  3587   3795   			ac_cv_c_$1config=`(cd $i/unix; pwd)`
................................................................................
  3588   3796   			break
  3589   3797   		    fi
  3590   3798   		done
  3591   3799   	    fi
  3592   3800   
  3593   3801   	    # check in a few common install locations
  3594   3802   	    if test x"${ac_cv_c_$1config}" = x ; then
  3595         -		for i in `ls -d ${exec_prefix}/lib 2>/dev/null` \
         3803  +		for i in `ls -d ${libdir} 2>/dev/null` \
         3804  +			`ls -d ${exec_prefix}/lib 2>/dev/null` \
  3596   3805   			`ls -d ${prefix}/lib 2>/dev/null` \
  3597   3806   			`ls -d /usr/local/lib 2>/dev/null` \
  3598   3807   			`ls -d /usr/contrib/lib 2>/dev/null` \
  3599   3808   			`ls -d /usr/lib 2>/dev/null` \
  3600   3809   			; do
  3601   3810   		    if test -f "$i/$1Config.sh" ; then
  3602   3811   			ac_cv_c_$1config=`(cd $i; pwd)`
................................................................................
  3604   3813   		    fi
  3605   3814   		done
  3606   3815   	    fi
  3607   3816   	])
  3608   3817   
  3609   3818   	if test x"${ac_cv_c_$1config}" = x ; then
  3610   3819   	    $1_BIN_DIR="# no $1 configs found"
  3611         -	    AC_MSG_WARN("Cannot find $1 configuration definitions")
         3820  +	    AC_MSG_WARN([Cannot find $1 configuration definitions])
  3612   3821   	    exit 0
  3613   3822   	else
  3614   3823   	    no_$1=
  3615   3824   	    $1_BIN_DIR=${ac_cv_c_$1config}
  3616   3825   	    AC_MSG_RESULT([found $$1_BIN_DIR/$1Config.sh])
  3617   3826   	fi
  3618   3827       fi
................................................................................
  3633   3842   #	Subst the following vars:
  3634   3843   #		$1_SRC_DIR
  3635   3844   #		$1_LIB_FILE
  3636   3845   #		$1_LIB_SPEC
  3637   3846   #
  3638   3847   #------------------------------------------------------------------------
  3639   3848   
  3640         -AC_DEFUN(TEA_LOAD_CONFIG, [
         3849  +AC_DEFUN([TEA_LOAD_CONFIG], [
  3641   3850       AC_MSG_CHECKING([for existence of ${$1_BIN_DIR}/$1Config.sh])
  3642   3851   
  3643   3852       if test -f "${$1_BIN_DIR}/$1Config.sh" ; then
  3644   3853           AC_MSG_RESULT([loading])
  3645   3854   	. ${$1_BIN_DIR}/$1Config.sh
  3646   3855       else
  3647   3856           AC_MSG_RESULT([file not found])
................................................................................
  3660   3869   	AC_MSG_WARN([Found Makefile - using build library specs for $1])
  3661   3870           $1_LIB_SPEC=${$1_BUILD_LIB_SPEC}
  3662   3871           $1_STUB_LIB_SPEC=${$1_BUILD_STUB_LIB_SPEC}
  3663   3872           $1_STUB_LIB_PATH=${$1_BUILD_STUB_LIB_PATH}
  3664   3873       fi
  3665   3874   
  3666   3875       AC_SUBST($1_VERSION)
         3876  +    AC_SUBST($1_BIN_DIR)
  3667   3877       AC_SUBST($1_SRC_DIR)
  3668   3878   
  3669   3879       AC_SUBST($1_LIB_FILE)
  3670   3880       AC_SUBST($1_LIB_SPEC)
  3671   3881   
  3672   3882       AC_SUBST($1_STUB_LIB_FILE)
  3673   3883       AC_SUBST($1_STUB_LIB_SPEC)
................................................................................
  3688   3898   #		--with-celib=...
  3689   3899   #
  3690   3900   #	Defines the following vars:
  3691   3901   #		CELIB_DIR	Full path to the directory containing
  3692   3902   #				the include and platform lib files
  3693   3903   #------------------------------------------------------------------------
  3694   3904   
  3695         -AC_DEFUN(TEA_PATH_CELIB, [
         3905  +AC_DEFUN([TEA_PATH_CELIB], [
  3696   3906       # First, look for one uninstalled.
  3697   3907       # the alternative search directory is invoked by --with-celib
  3698   3908   
  3699   3909       if test x"${no_celib}" = x ; then
  3700   3910   	# we reset no_celib in case something fails here
  3701   3911   	no_celib=true
  3702   3912   	AC_ARG_WITH(celib,[  --with-celib=DIR        use Windows/CE support library from DIR], with_celibconfig=${withval})
................................................................................
  3731   3941   	    fi
  3732   3942   	])
  3733   3943   	if test x"${ac_cv_c_celibconfig}" = x ; then
  3734   3944   	    AC_MSG_ERROR([Cannot find celib support library directory])
  3735   3945   	else
  3736   3946   	    no_celib=
  3737   3947   	    CELIB_DIR=${ac_cv_c_celibconfig}
         3948  +	    CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
  3738   3949   	    AC_MSG_RESULT([found $CELIB_DIR])
  3739         -	    TEA_PATH_NOSPACE(CELIB_DIR, ${ac_cv_c_celibconfig})
  3740   3950   	fi
  3741   3951       fi
  3742   3952   ])
  3743   3953   
  3744         -#------------------------------------------------------------------------
  3745         -# TEA_PATH_NOSPACE
  3746         -#	Ensure that the given path has no spaces.  This is necessary for
  3747         -#	CC (and consitutuent vars that build it up) to work in the
  3748         -#	tortured autoconf environment.  Currently only for Windows use.
  3749         -#
  3750         -# Arguments
  3751         -#	VAR  - name of the variable to set
  3752         -#	PATH - path to ensure no spaces in
  3753         -#
  3754         -# Results
  3755         -#	Sets $VAR to short path of $PATH if it can be found.
  3756         -#------------------------------------------------------------------------
  3757   3954   
  3758         -AC_DEFUN([TEA_PATH_NOSPACE], [
  3759         -    if test "${TEA_PLATFORM}" = "windows" ; then
  3760         -	# we need TCLSH_PROG defined to get Windows short pathnames
  3761         -	AC_REQUIRE([TEA_PROG_TCLSH])
  3762         -
  3763         -	AC_MSG_CHECKING([short pathname for $1 ($2)])
  3764         -
  3765         -	shortpath=
  3766         -	case "$2" in
  3767         -	    *\ *)
  3768         -		# Only do this if we need to.
  3769         -		shortpath=`echo "puts [[file attributes {$2} -shortname]] ; exit" | ${TCLSH_PROG} 2>/dev/null`
  3770         -		;;
  3771         -	esac
  3772         -	if test "x${shortpath}" = "x" ; then
  3773         -	    AC_MSG_RESULT([not changed])
  3774         -	else
  3775         -	    $1=$shortpath
  3776         -	    AC_MSG_RESULT([${$1}])
  3777         -	fi
  3778         -    fi
  3779         -])
         3955  +# Local Variables:
         3956  +# mode: autoconf
         3957  +# End: