update to TEA 3.2
authorJeff Hobbs <hobbs@users.sourceforge.net>
Wed, 2 Feb 2005 05:00:07 +0000 (05:00 +0000)
committerJeff Hobbs <hobbs@users.sourceforge.net>
Wed, 2 Feb 2005 05:00:07 +0000 (05:00 +0000)
ChangeLog
configure
configure.in
tclconfig/tcl.m4

index 8430aa47e35bea187770984bd90cc5eb8d100b9a..f7407e3a31ae3bc2773539a75c5109bdfdb328e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-02-01  Jeff Hobbs  <jeffh@ActiveState.com>
+
+       * configure, configure.in, tclconfig/tcl.m4: update to TEA 3.2
+
 2005-01-25  Jeff Hobbs  <jeffh@ActiveState.com>
 
        * configure, configure.in (BUILD_vfs): correct from sample default
index f499af5007619d6ee3d821cfd4747f0de95c89c6..ca70e3af54e686e639d5c5f4cdd439b5f1c8847d 100755 (executable)
--- a/configure
+++ b/configure
@@ -307,7 +307,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-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 TCL_TOP_DIR_NATIVE TCL_GENERIC_DIR_NATIVE TCL_UNIX_DIR_NATIVE TCL_WIN_DIR_NATIVE TCL_BMAP_DIR_NATIVE TCL_TOOL_DIR_NATIVE TCL_PLATFORM_DIR_NATIVE TCL_INCLUDES CLEANFILES TCL_THREADS SHARED_BUILD AR CELIB_DIR LIBOBJS DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING STLIB_LD SHLIB_LD SHLIB_CFLAGS SHLIB_LD_FLAGS SHLIB_LD_LIBS LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB TCLSH_PROG LTLIBOBJS'
+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 TCL_TOP_DIR_NATIVE TCL_GENERIC_DIR_NATIVE TCL_UNIX_DIR_NATIVE TCL_WIN_DIR_NATIVE TCL_BMAP_DIR_NATIVE TCL_TOOL_DIR_NATIVE TCL_PLATFORM_DIR_NATIVE TCL_INCLUDES CLEANFILES 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_FLAGS SHLIB_LD_LIBS LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LD_LIBRARY_PATH_VAR TCL_DBGX CFLAGS_DEFAULT LDFLAGS_DEFAULT MAKE_LIB MAKE_SHARED_LIB MAKE_STATIC_LIB MAKE_STUB_LIB RANLIB_STUB LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1287,7 +1287,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 #--------------------------------------------------------------------
 
 
-    TEA_VERSION="3.1"
+    # TEA extensions pass this us the version of TEA they think they
+    # are compatible with.
+    TEA_VERSION="3.2"
 
     echo "$as_me:$LINENO: checking for correct TEA configuration" >&5
 echo $ECHO_N "checking for correct TEA configuration... $ECHO_C" >&6
@@ -1298,15 +1300,15 @@ echo "$as_me: error:
 The PACKAGE_NAME variable must be defined by your TEA configure.in" >&2;}
    { (exit 1); exit 1; }; }
     fi
-    if test x"3.1" = x ; then
+    if test x"3.2" = x ; then
        { { echo "$as_me:$LINENO: error:
 TEA version not specified." >&5
 echo "$as_me: error:
 TEA version not specified." >&2;}
    { (exit 1); exit 1; }; }
-    elif test "3.1" != "${TEA_VERSION}" ; then
-       echo "$as_me:$LINENO: result: warning: requested TEA version \"3.1\", have \"${TEA_VERSION}\"" >&5
-echo "${ECHO_T}warning: requested TEA version \"3.1\", have \"${TEA_VERSION}\"" >&6
+    elif test "3.2" != "${TEA_VERSION}" ; then
+       echo "$as_me:$LINENO: result: warning: requested TEA version \"3.2\", have \"${TEA_VERSION}\"" >&5
+echo "${ECHO_T}warning: requested TEA version \"3.2\", have \"${TEA_VERSION}\"" >&6
     else
        echo "$as_me:$LINENO: result: ok (TEA ${TEA_VERSION})" >&5
 echo "${ECHO_T}ok (TEA ${TEA_VERSION})" >&6
@@ -5705,6 +5707,10 @@ echo "$as_me: error: could not find header file '${srcdir}/$i'" >&2;}
 
     vars=""
     for i in $vars; do
+       if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
+           # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
+           i=`echo "$i" | sed -e 's/\(.*\)\.lib$/-l\1/i'`
+       fi
        PKG_LIBS="$PKG_LIBS $i"
     done
 
@@ -6432,6 +6438,51 @@ _ACEOF
 
 
 
+    # Allow the user to provide this setting in the env
+    if test "x${TCLSH_PROG}" = "x" ; then
+       echo "$as_me:$LINENO: checking for tclsh" >&5
+echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
+
+       if test "${ac_cv_path_tclsh+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+       if test "${TEA_PLATFORM}" = "windows" -a "$do64bit_ok" = "yes" \
+               -o "$doWince" != "no" ; then
+           # A Windows cross-compile build - restrict target tclsh
+           # as we need one we can run on this system
+           search_path=`echo ${PATH} | sed -e 's/:/ /g'`
+       else
+           search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'`
+       fi
+       for dir in $search_path ; do
+           for j in `ls -r $dir/tclsh[8-9]*${EXEEXT} 2> /dev/null` \
+                   `ls -r $dir/tclsh*${EXEEXT} 2> /dev/null` ; do
+               if test x"$ac_cv_path_tclsh" = x ; then
+                   if test -f "$j" ; then
+                       ac_cv_path_tclsh=$j
+                       break
+                   fi
+               fi
+           done
+       done
+
+fi
+
+
+       if test -f "$ac_cv_path_tclsh" ; then
+           TCLSH_PROG=$ac_cv_path_tclsh
+           echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
+echo "${ECHO_T}$TCLSH_PROG" >&6
+       else
+           { { echo "$as_me:$LINENO: error: No tclsh found in PATH: $search_path" >&5
+echo "$as_me: error: No tclsh found in PATH: $search_path" >&2;}
+   { (exit 1); exit 1; }; }
+       fi
+    fi
+
+
+
 
 
     # Step 0: Enable 64 bit support?
@@ -6647,12 +6698,35 @@ fi
                if test "x${MSSDK}x" = "xx" ; then
                    MSSDK="C:/Progra~1/Microsoft SDK"
                fi
-               # In order to work in the tortured autoconf environment,
-               # we need to ensure that this path has no spaces
-               MSSDK=`cygpath -w -s "$MSSDK" | sed -e 's!\\\!/!g'`
+               # Ensure that this path has no spaces to work in autoconf
+
+    if test "${TEA_PLATFORM}" = "windows" ; then
+       # we need TCLSH_PROG defined to get Windows short pathnames
+
+
+       echo "$as_me:$LINENO: checking short pathname for MSSDK (${MSSDK})" >&5
+echo $ECHO_N "checking short pathname for MSSDK (${MSSDK})... $ECHO_C" >&6
+
+       shortpath=
+       case "${MSSDK}" in
+           *\ *)
+               # Only do this if we need to.
+               shortpath=`echo "puts [file attributes {${MSSDK}} -shortname] ; exit" | ${TCLSH_PROG} 2>/dev/null`
+               ;;
+       esac
+       if test "x${shortpath}" = "x" ; then
+           echo "$as_me:$LINENO: result: not changed" >&5
+echo "${ECHO_T}not changed" >&6
+       else
+           MSSDK=$shortpath
+           echo "$as_me:$LINENO: result: ${MSSDK}" >&5
+echo "${ECHO_T}${MSSDK}" >&6
+       fi
+    fi
+
                if test ! -d "${MSSDK}/bin/win64" ; then
-                   { echo "$as_me:$LINENO: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&5
-echo "$as_me: WARNING: \"could not find 64-bit SDK to enable 64bit mode\"" >&2;}
+                   { echo "$as_me:$LINENO: WARNING: could not find 64-bit SDK to enable 64bit mode" >&5
+echo "$as_me: WARNING: could not find 64-bit SDK to enable 64bit mode" >&2;}
                    do64bit="no"
                else
                    do64bit_ok="yes"
@@ -6722,7 +6796,6 @@ echo "$as_me: error: ${with_celibconfig} directory doesn't contain inc directory
 fi
 
        if test x"${ac_cv_c_celibconfig}" = x ; then
-           CELIB_DIR="# no Celib configs found"
            { { echo "$as_me:$LINENO: error: Cannot find celib support library directory" >&5
 echo "$as_me: error: Cannot find celib support library directory" >&2;}
    { (exit 1); exit 1; }; }
@@ -6731,28 +6804,56 @@ echo "$as_me: error: Cannot find celib support library directory" >&2;}
            CELIB_DIR=${ac_cv_c_celibconfig}
            echo "$as_me:$LINENO: result: found $CELIB_DIR" >&5
 echo "${ECHO_T}found $CELIB_DIR" >&6
+
+    if test "${TEA_PLATFORM}" = "windows" ; then
+       # we need TCLSH_PROG defined to get Windows short pathnames
+
+
+       echo "$as_me:$LINENO: checking short pathname for CELIB_DIR (${ac_cv_c_celibconfig})" >&5
+echo $ECHO_N "checking short pathname for CELIB_DIR (${ac_cv_c_celibconfig})... $ECHO_C" >&6
+
+       shortpath=
+       case "${ac_cv_c_celibconfig}" in
+           *\ *)
+               # Only do this if we need to.
+               shortpath=`echo "puts [file attributes {${ac_cv_c_celibconfig}} -shortname] ; exit" | ${TCLSH_PROG} 2>/dev/null`
+               ;;
+       esac
+       if test "x${shortpath}" = "x" ; then
+           echo "$as_me:$LINENO: result: not changed" >&5
+echo "${ECHO_T}not changed" >&6
+       else
+           CELIB_DIR=$shortpath
+           echo "$as_me:$LINENO: result: ${CELIB_DIR}" >&5
+echo "${ECHO_T}${CELIB_DIR}" >&6
        fi
     fi
 
-               # set defaults
-               # Currently Tcl requires 300+
-               CEVERSION=300;    # could be 211 300 301 ...
-               TARGETCPU=ARM;    # could be ARM MIPS SH3 X86 ...
-               PLATFORM="Pocket PC 2002"
-               if test "$doWince" = "yes"; then
-                   doWince="300,ARM,ARM,Pocket PC 2002"
-               fi
-               eval `echo $doWince | awk -F "," '{ \
-                   if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \
-                     if ($1 >= 400) { printf "PLATFORM=\"Pocket PC 2003\"\n" } }; \
-                   if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \
-                   if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \
-                   if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \
+       fi
+    fi
+
+               # Set defaults for common evc4/PPC2003 setup
+               # Currently Tcl requires 300+, possibly 420+ for sockets
+               CEVERSION=420;          # could be 211 300 301 400 420 ...
+               TARGETCPU=ARMV4;        # could be ARMV4 ARM MIPS SH3 X86 ...
+               ARCH=ARM;               # could be ARM MIPS X86EM ...
+               PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
+               if test "$doWince" != "yes"; then
+                   # If !yes then the user specified something
+                   # Reset ARCH to allow user to skip specifying it
+                   ARCH=
+                   eval `echo $doWince | awk -F, '{ \
+           if (length($1)) { printf "CEVERSION=\"%s\"\n", $1; \
+           if ($1 < 400)   { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
+           if (length($2)) { printf "TARGETCPU=\"%s\"\n", toupper($2) }; \
+           if (length($3)) { printf "ARCH=\"%s\"\n", toupper($3) }; \
+           if (length($4)) { printf "PLATFORM=\"%s\"\n", $4 }; \
                    }'`
-               OSVERSION=WCE$CEVERSION;
-               if test "x${ARCH}" = "x" ; then
-                   ARCH=$TARGETCPU;  # could be ARM MIPS SH3 X86 X86EM ...
+                   if test "x${ARCH}" = "x" ; then
+                       ARCH=$TARGETCPU;
+                   fi
                fi
+               OSVERSION=WCE$CEVERSION;
                if test "x${WCEROOT}" = "x" ; then
                        WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
                    if test ! -d "${WCEROOT}" ; then
@@ -6765,11 +6866,57 @@ echo "${ECHO_T}found $CELIB_DIR" >&6
                        SDKROOT="C:/Windows CE Tools"
                    fi
                fi
-               # In order to work in the tortured autoconf environment,
-               # we need to ensure that this path has no spaces
-               WCEROOT=`cygpath -w -s "$WCEROOT" | sed -e 's!\\\!/!g'`
-               SDKROOT=`cygpath -w -s "$SDKROOT" | sed -e 's!\\\!/!g'`
-               CELIB_DIR=`cygpath -w -s "$CELIB_DIR" | sed -e 's!\\\!/!g'`
+               # Ensure that this path has no spaces to work in autoconf
+
+    if test "${TEA_PLATFORM}" = "windows" ; then
+       # we need TCLSH_PROG defined to get Windows short pathnames
+
+
+       echo "$as_me:$LINENO: checking short pathname for WCEROOT (${WCEROOT})" >&5
+echo $ECHO_N "checking short pathname for WCEROOT (${WCEROOT})... $ECHO_C" >&6
+
+       shortpath=
+       case "${WCEROOT}" in
+           *\ *)
+               # Only do this if we need to.
+               shortpath=`echo "puts [file attributes {${WCEROOT}} -shortname] ; exit" | ${TCLSH_PROG} 2>/dev/null`
+               ;;
+       esac
+       if test "x${shortpath}" = "x" ; then
+           echo "$as_me:$LINENO: result: not changed" >&5
+echo "${ECHO_T}not changed" >&6
+       else
+           WCEROOT=$shortpath
+           echo "$as_me:$LINENO: result: ${WCEROOT}" >&5
+echo "${ECHO_T}${WCEROOT}" >&6
+       fi
+    fi
+
+
+    if test "${TEA_PLATFORM}" = "windows" ; then
+       # we need TCLSH_PROG defined to get Windows short pathnames
+
+
+       echo "$as_me:$LINENO: checking short pathname for SDKROOT (${SDKROOT})" >&5
+echo $ECHO_N "checking short pathname for SDKROOT (${SDKROOT})... $ECHO_C" >&6
+
+       shortpath=
+       case "${SDKROOT}" in
+           *\ *)
+               # Only do this if we need to.
+               shortpath=`echo "puts [file attributes {${SDKROOT}} -shortname] ; exit" | ${TCLSH_PROG} 2>/dev/null`
+               ;;
+       esac
+       if test "x${shortpath}" = "x" ; then
+           echo "$as_me:$LINENO: result: not changed" >&5
+echo "${ECHO_T}not changed" >&6
+       else
+           SDKROOT=$shortpath
+           echo "$as_me:$LINENO: result: ${SDKROOT}" >&5
+echo "${ECHO_T}${SDKROOT}" >&6
+       fi
+    fi
+
                if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
                    -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
                    { { echo "$as_me:$LINENO: error: could not find PocketPC SDK or target compiler to enable WinCE mode $CEVERSION,$TARGETCPU,$ARCH,$PLATFORM" >&5
@@ -6777,11 +6924,13 @@ echo "$as_me: error: could not find PocketPC SDK or target compiler to enable Wi
    { (exit 1); exit 1; }; }
                    doWince="no"
                else
-                   CEINCLUDE=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/include" | sed -e 's!\\\!/!g'`
+                   # We could PATH_NOSPACE these, but that's not important,
+                   # as long as we quote them when used.
+                   CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
                    if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
                        CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
                    fi
-                   CELIBPATH=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" | sed -e 's!\\\!/!g'`
+                   CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
                fi
            fi
 
@@ -6794,15 +6943,14 @@ echo "$as_me: error: could not find PocketPC SDK or target compiler to enable Wi
 
                 if test "$do64bit" = "yes" ; then
                    # All this magic is necessary for the Win64 SDK RC1 - hobbs
-                   export CC="${MSSDK}/Bin/Win64/cl.exe \
-                       -I${MSSDK}/Include/prerelease \
-                        -I${MSSDK}/Include/Win64/crt \
-                       -I${MSSDK}/Include"
-                   export RC="${MSSDK}/bin/rc.exe"
-                   export lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \
-                       -LIBPATH:${MSSDK}/Lib/Prerelease/IA64"
-                   export STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}"
-                   export LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}"
+                   CC="${MSSDK}/Bin/Win64/cl.exe"
+                   CFLAGS="${CFLAGS} -I${MSSDK}/Include/prerelease \
+                       -I${MSSDK}/Include/Win64/crt \
+                       -I${MSSDK}/Include"
+                   RC="${MSSDK}/bin/rc.exe"
+                   lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \
+                       -LIBPATH:${MSSDK}/Lib/Prerelease/IA64 -nologo"
+                   LINKBIN="${MSSDK}/bin/win64/link.exe"
                    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
                    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
                elif test "$doWince" != "no" ; then
@@ -6812,7 +6960,7 @@ echo "$as_me: error: could not find PocketPC SDK or target compiler to enable Wi
                    else
                        CC="${CEBINROOT}/cl${ARCH}.exe"
                    fi
-                   CC="${CC} -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
+                   CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
                    RC="${WCEROOT}/Common/EVC/bin/rc.exe"
                    arch=`echo ${ARCH} | awk '{print tolower($0)}'`
                    defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
@@ -6833,13 +6981,12 @@ _ACEOF
                    CFLAGS_DEBUG="-nologo -Zi -Od"
                    CFLAGS_OPTIMIZE="-nologo -Ox"
                    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
-                   lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion}"
-                   STLIB_LD="${CEBINROOT}/lib.exe -nologo ${lflags}"
-                   LINKBIN="${CEBINROOT}/link.exe ${lflags}"
+                   lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
+                   LINKBIN="${CEBINROOT}/link.exe"
 
                else
                    RC="rc"
-                   STLIB_LD="link -lib -nologo"
+                   lflags="-nologo"
                    LINKBIN="link"
                    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
                    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
@@ -6856,7 +7003,9 @@ _ACEOF
                LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
                LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
            else
-               SHLIB_LD="${LINKBIN} -dll -nologo"
+               SHLIB_LD="${LINKBIN} -dll ${lflags}"
+               # link -lib only works when -lib is the first arg
+               STLIB_LD="${LINKBIN} -lib ${lflags}"
                UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
                PATHTYPE=-w
                # For information on what debugtype is most useful, see:
@@ -7908,14 +8057,14 @@ rm -f conftest*
                ;;
            esac
            ;;
-       Rhapsody-*|Darwin-*)
+       Darwin-*)
            SHLIB_CFLAGS="-fno-common"
            SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
            SHLIB_LD_LIBS='${LIBS}'
            SHLIB_SUFFIX=".dylib"
            DL_OBJS="tclLoadDyld.o"
            DL_LIBS=""
-           LDFLAGS="$LDFLAGS -prebind"
+           LDFLAGS="$LDFLAGS -prebind -Wl,-search_paths_first"
            LD_SEARCH_FLAGS=""
            LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
            CFLAGS_OPTIMIZE="-Os"
@@ -8112,8 +8261,16 @@ _ACEOF
                arch=`isainfo`
                if test "$arch" = "sparcv9 sparc" ; then
                        if test "$GCC" = "yes" ; then
-                           { echo "$as_me:$LINENO: WARNING: \"64bit mode not supported with GCC on $system\"" >&5
-echo "$as_me: WARNING: \"64bit mode not supported with GCC on $system\"" >&2;}
+                           if test "`gcc -dumpversion` | awk -F. '{print }'" -lt "3" ; then
+                               { echo "$as_me:$LINENO: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&5
+echo "$as_me: WARNING: 64bit mode not supported with GCC < 3.2 on $system" >&2;}
+                           else
+                               do64bit_ok=yes
+                               CFLAGS="$CFLAGS -m64 -mcpu=v9"
+                               LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+                               SHLIB_CFLAGS="-fPIC"
+                               SHLIB_LD_FLAGS=""
+                           fi
                        else
                            do64bit_ok=yes
                            if test "$do64bitVIS" = "yes" ; then
@@ -8140,6 +8297,17 @@ echo "$as_me: WARNING: \"64bit mode only supported sparcv9 system\"" >&2;}
            if test "$GCC" = "yes" ; then
                SHLIB_LD="$CC -shared"
                LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+               if test "$do64bit" = "yes" ; then
+                   # We need to specify -static-libgcc or we need to
+                   # add the path to the sparv9 libgcc.
+                   # JH: static-libgcc is necessary for core Tcl, but may
+                   # not be necessary for extensions.
+                   SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
+                   # for finding sparcv9 libgcc, get the regular libgcc
+                   # path, remove so name and append 'sparcv9'
+                   #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
+                   #LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS},-R,$v9gcclibdir"
+               fi
            else
                SHLIB_LD="/usr/ccs/bin/ld -G -z text"
                LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
@@ -8458,7 +8626,7 @@ fi;
                    ;;
                NetBSD-*|FreeBSD-*)
                    ;;
-               Rhapsody-*|Darwin-*)
+               Darwin-*)
                    ;;
                RISCos-*)
                    ;;
@@ -9081,16 +9249,19 @@ _ACEOF
 
 
 
-    echo "$as_me:$LINENO: checking for tclsh" >&5
+    # Allow the user to provide this setting in the env
+    if test "x${TCLSH_PROG}" = "x" ; then
+       echo "$as_me:$LINENO: checking for tclsh" >&5
 echo $ECHO_N "checking for tclsh... $ECHO_C" >&6
 
-    if test "${ac_cv_path_tclsh+set}" = set; then
+       if test "${ac_cv_path_tclsh+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
 
-       if test "x${CELIB_DIR}" != "x" ; then
-           # If CELIB_DIR is defined, assume Windows/CE target is requested
-           # which means target tclsh cannot be run (cross-compile)
+       if test "${TEA_PLATFORM}" = "windows" -a "$do64bit_ok" = "yes" \
+               -o "$doWince" != "no" ; then
+           # A Windows cross-compile build - restrict target tclsh
+           # as we need one we can run on this system
            search_path=`echo ${PATH} | sed -e 's/:/ /g'`
        else
            search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'`
@@ -9110,14 +9281,15 @@ else
 fi
 
 
-    if test -f "$ac_cv_path_tclsh" ; then
-       TCLSH_PROG=$ac_cv_path_tclsh
-       echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
+       if test -f "$ac_cv_path_tclsh" ; then
+           TCLSH_PROG=$ac_cv_path_tclsh
+           echo "$as_me:$LINENO: result: $TCLSH_PROG" >&5
 echo "${ECHO_T}$TCLSH_PROG" >&6
-    else
-       { { echo "$as_me:$LINENO: error: No tclsh found in PATH:  $search_path" >&5
-echo "$as_me: error: No tclsh found in PATH:  $search_path" >&2;}
+       else
+           { { echo "$as_me:$LINENO: error: No tclsh found in PATH: $search_path" >&5
+echo "$as_me: error: No tclsh found in PATH: $search_path" >&2;}
    { (exit 1); exit 1; }; }
+       fi
     fi
 
 
@@ -9812,6 +9984,7 @@ s,@CLEANFILES@,$CLEANFILES,;t t
 s,@TCL_THREADS@,$TCL_THREADS,;t t
 s,@SHARED_BUILD@,$SHARED_BUILD,;t t
 s,@AR@,$AR,;t t
+s,@TCLSH_PROG@,$TCLSH_PROG,;t t
 s,@CELIB_DIR@,$CELIB_DIR,;t t
 s,@LIBOBJS@,$LIBOBJS,;t t
 s,@DL_LIBS@,$DL_LIBS,;t t
@@ -9834,7 +10007,6 @@ s,@MAKE_SHARED_LIB@,$MAKE_SHARED_LIB,;t t
 s,@MAKE_STATIC_LIB@,$MAKE_STATIC_LIB,;t t
 s,@MAKE_STUB_LIB@,$MAKE_STUB_LIB,;t t
 s,@RANLIB_STUB@,$RANLIB_STUB,;t t
-s,@TCLSH_PROG@,$TCLSH_PROG,;t t
 s,@LTLIBOBJS@,$LTLIBOBJS,;t t
 CEOF
 
index a40f1878315c484ac0ba09306ba87915947c1d71..ea6923624b03fb37d6f82fafdc21ee66179a3c91 100644 (file)
@@ -21,7 +21,7 @@ AC_INIT([vfs], [1.3])
 # as well as PKG_LIB_FILE and PKG_STUB_LIB_FILE.
 #--------------------------------------------------------------------
 
-TEA_INIT([3.1])
+TEA_INIT([3.2])
 
 AC_CONFIG_AUX_DIR(tclconfig)
 
index 4b7cf2bb0de8a2fdf04afd4ed5069dd184bc6856..7f2bbefb409974f6a99f38dafa38135adaabeadc 100644 (file)
@@ -818,11 +818,10 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                if test "x${MSSDK}x" = "xx" ; then
                    MSSDK="C:/Progra~1/Microsoft SDK"
                fi
-               # In order to work in the tortured autoconf environment,
-               # we need to ensure that this path has no spaces
-               MSSDK=`cygpath -w -s "$MSSDK" | sed -e 's!\\\!/!g'`
+               # Ensure that this path has no spaces to work in autoconf
+               TEA_PATH_NOSPACE(MSSDK, ${MSSDK})
                if test ! -d "${MSSDK}/bin/win64" ; then
-                   AC_MSG_WARN("could not find 64-bit SDK to enable 64bit mode")
+                   AC_MSG_WARN([could not find 64-bit SDK to enable 64bit mode])
                    do64bit="no"
                else
                    do64bit_ok="yes"
@@ -837,25 +836,28 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                    AC_MSG_ERROR([Windows/CE and GCC builds incompatible])
                fi
                TEA_PATH_CELIB
-               # set defaults
-               # Currently Tcl requires 300+
-               CEVERSION=300;    # could be 211 300 301 ...
-               TARGETCPU=ARM;    # could be ARM MIPS SH3 X86 ...
-               PLATFORM="Pocket PC 2002"
-               if test "$doWince" = "yes"; then
-                   doWince="300,ARM,ARM,Pocket PC 2002"
-               fi
-               eval `echo $doWince | awk -F "," '{ \
-                   if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
-                     if ([$]1 >= 400) { printf "PLATFORM=\"Pocket PC 2003\"\n" } }; \
-                   if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
-                   if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
-                   if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
+               # Set defaults for common evc4/PPC2003 setup
+               # Currently Tcl requires 300+, possibly 420+ for sockets
+               CEVERSION=420;          # could be 211 300 301 400 420 ...
+               TARGETCPU=ARMV4;        # could be ARMV4 ARM MIPS SH3 X86 ...
+               ARCH=ARM;               # could be ARM MIPS X86EM ...
+               PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
+               if test "$doWince" != "yes"; then
+                   # If !yes then the user specified something
+                   # Reset ARCH to allow user to skip specifying it
+                   ARCH=
+                   eval `echo $doWince | awk -F, '{ \
+           if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
+           if ([$]1 < 400)   { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
+           if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
+           if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
+           if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
                    }'`
-               OSVERSION=WCE$CEVERSION;
-               if test "x${ARCH}" = "x" ; then
-                   ARCH=$TARGETCPU;  # could be ARM MIPS SH3 X86 X86EM ...
+                   if test "x${ARCH}" = "x" ; then
+                       ARCH=$TARGETCPU;
+                   fi
                fi
+               OSVERSION=WCE$CEVERSION;
                if test "x${WCEROOT}" = "x" ; then
                        WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
                    if test ! -d "${WCEROOT}" ; then
@@ -868,21 +870,21 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                        SDKROOT="C:/Windows CE Tools"
                    fi
                fi
-               # In order to work in the tortured autoconf environment,
-               # we need to ensure that this path has no spaces
-               WCEROOT=`cygpath -w -s "$WCEROOT" | sed -e 's!\\\!/!g'`
-               SDKROOT=`cygpath -w -s "$SDKROOT" | sed -e 's!\\\!/!g'`
-               CELIB_DIR=`cygpath -w -s "$CELIB_DIR" | sed -e 's!\\\!/!g'`
+               # Ensure that this path has no spaces to work in autoconf
+               TEA_PATH_NOSPACE(WCEROOT, ${WCEROOT})
+               TEA_PATH_NOSPACE(SDKROOT, ${SDKROOT})
                if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" \
                    -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
                    AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
                    doWince="no"
                else
-                   CEINCLUDE=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/include" | sed -e 's!\\\!/!g'`
+                   # We could PATH_NOSPACE these, but that's not important,
+                   # as long as we quote them when used.
+                   CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
                    if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
                        CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
                    fi
-                   CELIBPATH=`cygpath -w -s "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}" | sed -e 's!\\\!/!g'`
+                   CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
                fi
            fi
 
@@ -895,15 +897,14 @@ dnl AC_CHECK_TOOL(AR, ar, :)
 
                 if test "$do64bit" = "yes" ; then
                    # All this magic is necessary for the Win64 SDK RC1 - hobbs
-                   export CC="${MSSDK}/Bin/Win64/cl.exe \
-                       -I${MSSDK}/Include/prerelease \
-                        -I${MSSDK}/Include/Win64/crt \
-                       -I${MSSDK}/Include"
-                   export RC="${MSSDK}/bin/rc.exe"
-                   export lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \
-                       -LIBPATH:${MSSDK}/Lib/Prerelease/IA64"
-                   export STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}"
-                   export LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}"
+                   CC="${MSSDK}/Bin/Win64/cl.exe"
+                   CFLAGS="${CFLAGS} -I${MSSDK}/Include/prerelease \
+                       -I${MSSDK}/Include/Win64/crt \
+                       -I${MSSDK}/Include"
+                   RC="${MSSDK}/bin/rc.exe"
+                   lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \
+                       -LIBPATH:${MSSDK}/Lib/Prerelease/IA64 -nologo"
+                   LINKBIN="${MSSDK}/bin/win64/link.exe"
                    CFLAGS_DEBUG="-nologo -Zi -Od -W3 ${runtime}d"
                    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
                elif test "$doWince" != "no" ; then
@@ -913,7 +914,7 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                    else
                        CC="${CEBINROOT}/cl${ARCH}.exe"
                    fi
-                   CC="${CC} -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
+                   CFLAGS="$CFLAGS -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
                    RC="${WCEROOT}/Common/EVC/bin/rc.exe"
                    arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
                    defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
@@ -925,13 +926,12 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                    CFLAGS_DEBUG="-nologo -Zi -Od"
                    CFLAGS_OPTIMIZE="-nologo -Ox"
                    lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
-                   lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion}"
-                   STLIB_LD="${CEBINROOT}/lib.exe -nologo ${lflags}"
-                   LINKBIN="${CEBINROOT}/link.exe ${lflags}"
+                   lflags="-MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
+                   LINKBIN="${CEBINROOT}/link.exe"
                    AC_SUBST(CELIB_DIR)
                else
                    RC="rc"
-                   STLIB_LD="link -lib -nologo"
+                   lflags="-nologo"
                    LINKBIN="link"
                    CFLAGS_DEBUG="-nologo -Z7 -Od -W3 -WX ${runtime}d"
                    CFLAGS_OPTIMIZE="-nologo -O2 -W2 ${runtime}"
@@ -948,7 +948,9 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                LDFLAGS_CONSOLE="-wl,--subsystem,console ${lflags}"
                LDFLAGS_WINDOW="-wl,--subsystem,windows ${lflags}"
            else
-               SHLIB_LD="${LINKBIN} -dll -nologo"
+               SHLIB_LD="${LINKBIN} -dll ${lflags}"
+               # link -lib only works when -lib is the first arg
+               STLIB_LD="${LINKBIN} -lib ${lflags}"
                UNSHARED_LIB_SUFFIX='${TCL_TRIM_DOTS}.lib'
                PATHTYPE=-w
                # For information on what debugtype is most useful, see:
@@ -1378,14 +1380,14 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                ;;
            esac
            ;;
-       Rhapsody-*|Darwin-*)
+       Darwin-*)
            SHLIB_CFLAGS="-fno-common"
            SHLIB_LD="cc -dynamiclib \${LDFLAGS}"
            SHLIB_LD_LIBS='${LIBS}'
            SHLIB_SUFFIX=".dylib"
            DL_OBJS="tclLoadDyld.o"
            DL_LIBS=""
-           LDFLAGS="$LDFLAGS -prebind"
+           LDFLAGS="$LDFLAGS -prebind -Wl,-search_paths_first"
            LD_SEARCH_FLAGS=""
            LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH"
            CFLAGS_OPTIMIZE="-Os"
@@ -1567,7 +1569,15 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                arch=`isainfo`
                if test "$arch" = "sparcv9 sparc" ; then
                        if test "$GCC" = "yes" ; then
-                           AC_MSG_WARN("64bit mode not supported with GCC on $system")
+                           if test "`gcc -dumpversion` | awk -F. '{print $1}'" -lt "3" ; then
+                               AC_MSG_WARN([64bit mode not supported with GCC < 3.2 on $system])
+                           else
+                               do64bit_ok=yes
+                               CFLAGS="$CFLAGS -m64 -mcpu=v9"
+                               LDFLAGS="$LDFLAGS -m64 -mcpu=v9"
+                               SHLIB_CFLAGS="-fPIC"
+                               SHLIB_LD_FLAGS=""
+                           fi
                        else
                            do64bit_ok=yes
                            if test "$do64bitVIS" = "yes" ; then
@@ -1593,6 +1603,17 @@ dnl AC_CHECK_TOOL(AR, ar, :)
            if test "$GCC" = "yes" ; then
                SHLIB_LD="$CC -shared"
                LD_SEARCH_FLAGS='-Wl,-R,${LIB_RUNTIME_DIR}'
+               if test "$do64bit" = "yes" ; then
+                   # We need to specify -static-libgcc or we need to
+                   # add the path to the sparv9 libgcc.
+                   # JH: static-libgcc is necessary for core Tcl, but may
+                   # not be necessary for extensions.
+                   SHLIB_LD="$SHLIB_LD -m64 -mcpu=v9 -static-libgcc"
+                   # for finding sparcv9 libgcc, get the regular libgcc
+                   # path, remove so name and append 'sparcv9'
+                   #v9gcclibdir="`gcc -print-file-name=libgcc_s.so` | ..."
+                   #LD_SEARCH_FLAGS="${LD_SEARCH_FLAGS},-R,$v9gcclibdir"
+               fi
            else
                SHLIB_LD="/usr/ccs/bin/ld -G -z text"
                LD_SEARCH_FLAGS='-R ${LIB_RUNTIME_DIR}'
@@ -1749,7 +1770,7 @@ dnl AC_CHECK_TOOL(AR, ar, :)
                    ;;
                NetBSD-*|FreeBSD-*)
                    ;;
-               Rhapsody-*|Darwin-*)
+               Darwin-*)
                    ;;
                RISCos-*)
                    ;;
@@ -2552,7 +2573,9 @@ AC_DEFUN(TEA_TCL_64BIT_FLAGS, [
 #------------------------------------------------------------------------
 
 AC_DEFUN(TEA_INIT, [
-    TEA_VERSION="3.1"
+    # TEA extensions pass this us the version of TEA they think they
+    # are compatible with.
+    TEA_VERSION="3.2"
 
     AC_MSG_CHECKING([for correct TEA configuration])
     if test x"${PACKAGE_NAME}" = x ; then
@@ -2777,7 +2800,9 @@ AC_DEFUN(TEA_ADD_INCLUDES, [
 # TEA_ADD_LIBS --
 #
 #      Specify one or more libraries.  Users should check for
-#      the right platform before adding to their list.
+#      the right platform before adding to their list.  For Windows,
+#      libraries provided in "foo.lib" format will be converted to
+#      "-lfoo" when using GCC (mingw).
 #
 # Arguments:
 #      one or more file names
@@ -2790,6 +2815,10 @@ AC_DEFUN(TEA_ADD_INCLUDES, [
 AC_DEFUN(TEA_ADD_LIBS, [
     vars="$@"
     for i in $vars; do
+       if test "${TEA_PLATFORM}" = "windows" -a "$GCC" = "yes" ; then
+           # Convert foo.lib to -lfoo for GCC.  No-op if not *.lib
+           i=`echo "$i" | sed -e 's/\(.*\)\.lib[$]/-l\1/i'`
+       fi
        PKG_LIBS="$PKG_LIBS $i"
     done
     AC_SUBST(PKG_LIBS)
@@ -3398,12 +3427,15 @@ AC_DEFUN(TEA_PUBLIC_TK_HEADERS, [
 #------------------------------------------------------------------------
 
 AC_DEFUN(TEA_PROG_TCLSH, [
-    AC_MSG_CHECKING([for tclsh])
-
-    AC_CACHE_VAL(ac_cv_path_tclsh, [
-       if test "x${CELIB_DIR}" != "x" ; then
-           # If CELIB_DIR is defined, assume Windows/CE target is requested
-           # which means target tclsh cannot be run (cross-compile)
+    # Allow the user to provide this setting in the env
+    if test "x${TCLSH_PROG}" = "x" ; then
+       AC_MSG_CHECKING([for tclsh])
+
+       AC_CACHE_VAL(ac_cv_path_tclsh, [
+       if test "${TEA_PLATFORM}" = "windows" -a "$do64bit_ok" = "yes" \
+               -o "$doWince" != "no" ; then
+           # A Windows cross-compile build - restrict target tclsh
+           # as we need one we can run on this system
            search_path=`echo ${PATH} | sed -e 's/:/ /g'`
        else
            search_path=`echo ${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'`
@@ -3419,13 +3451,14 @@ AC_DEFUN(TEA_PROG_TCLSH, [
                fi
            done
        done
-    ])
+       ])
 
-    if test -f "$ac_cv_path_tclsh" ; then
-       TCLSH_PROG=$ac_cv_path_tclsh
-       AC_MSG_RESULT([$TCLSH_PROG])
-    else
-       AC_MSG_ERROR([No tclsh found in PATH:  $search_path])
+       if test -f "$ac_cv_path_tclsh" ; then
+           TCLSH_PROG=$ac_cv_path_tclsh
+           AC_MSG_RESULT([$TCLSH_PROG])
+       else
+           AC_MSG_ERROR([No tclsh found in PATH: $search_path])
+       fi
     fi
     AC_SUBST(TCLSH_PROG)
 ])
@@ -3447,12 +3480,15 @@ AC_DEFUN(TEA_PROG_TCLSH, [
 #------------------------------------------------------------------------
 
 AC_DEFUN(TEA_PROG_WISH, [
-    AC_MSG_CHECKING([for wish])
-
-    AC_CACHE_VAL(ac_cv_path_wish, [
-       if test "x${CELIB_DIR}" != "x" ; then
-           # If CELIB_DIR is defined, assume Windows/CE target is requested
-           # which means target wish cannot be run (cross-compile)
+    # Allow the user to provide this setting in the env
+    if test "x${WISH_PROG}" = "x" ; then
+       AC_MSG_CHECKING([for wish])
+
+       AC_CACHE_VAL(ac_cv_path_wish, [
+       if test "${TEA_PLATFORM}" = "windows" -a "$do64bit_ok" = "yes" \
+               -o "$doWince" != "no" ; then
+           # A Windows cross-compile build - restrict target tclsh
+           # as we need one we can run on this system
            search_path=`echo ${PATH} | sed -e 's/:/ /g'`
        else
            search_path=`echo ${TK_BIN_DIR}:${TK_BIN_DIR}/../bin:${TCL_BIN_DIR}:${TCL_BIN_DIR}/../bin:${exec_prefix}/bin:${prefix}/bin:${PATH} | sed -e 's/:/ /g'`
@@ -3468,13 +3504,14 @@ AC_DEFUN(TEA_PROG_WISH, [
                fi
            done
        done
-    ])
+       ])
 
-    if test -f "$ac_cv_path_wish" ; then
+       if test -f "$ac_cv_path_wish" ; then
        WISH_PROG=$ac_cv_path_wish
-       AC_MSG_RESULT([$WISH_PROG])
-    else
-       AC_MSG_ERROR([No wish found in PATH:  $search_path])
+           AC_MSG_RESULT([$WISH_PROG])
+       else
+           AC_MSG_ERROR([No wish found in PATH: $search_path])
+       fi
     fi
     AC_SUBST(WISH_PROG)
 ])
@@ -3686,12 +3723,49 @@ AC_DEFUN(TEA_PATH_CELIB, [
            fi
        ])
        if test x"${ac_cv_c_celibconfig}" = x ; then
-           CELIB_DIR="# no Celib configs found"
            AC_MSG_ERROR([Cannot find celib support library directory])
        else
            no_celib=
            CELIB_DIR=${ac_cv_c_celibconfig}
            AC_MSG_RESULT([found $CELIB_DIR])
+           TEA_PATH_NOSPACE(CELIB_DIR, ${ac_cv_c_celibconfig})
+       fi
+    fi
+])
+
+#------------------------------------------------------------------------
+# TEA_PATH_NOSPACE
+#      Ensure that the given path has no spaces.  This is necessary for
+#      CC (and consitutuent vars that build it up) to work in the
+#      tortured autoconf environment.  Currently only for Windows use.
+#
+# Arguments
+#      VAR  - name of the variable to set
+#      PATH - path to ensure no spaces in
+#
+# Results
+#      Sets $VAR to short path of $PATH if it can be found.
+#------------------------------------------------------------------------
+
+AC_DEFUN([TEA_PATH_NOSPACE], [
+    if test "${TEA_PLATFORM}" = "windows" ; then
+       # we need TCLSH_PROG defined to get Windows short pathnames
+       AC_REQUIRE([TEA_PROG_TCLSH])
+
+       AC_MSG_CHECKING([short pathname for $1 ($2)])
+
+       shortpath=
+       case "$2" in
+           *\ *)
+               # Only do this if we need to.
+               shortpath=`echo "puts [[file attributes {$2} -shortname]] ; exit" | ${TCLSH_PROG} 2>/dev/null`
+               ;;
+       esac
+       if test "x${shortpath}" = "x" ; then
+           AC_MSG_RESULT([not changed])
+       else
+           $1=$shortpath
+           AC_MSG_RESULT([${$1}])
        fi
     fi
 ])