diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-29 20:52:03 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2012-03-29 20:52:03 (GMT) |
commit | b49d75097e2cde7a428f48f2049fe0cb54ecf2bf (patch) | |
tree | 02c5d333c5e5fdba3ddd8d9a69b1b753dd463ad4 /win | |
parent | efdbc3f8c05ecc0ba68102a2701831532943961a (diff) | |
parent | 0778365664c71cc817ace102db58b34dca459aec (diff) | |
download | tk-b49d75097e2cde7a428f48f2049fe0cb54ecf2bf.zip tk-b49d75097e2cde7a428f48f2049fe0cb54ecf2bf.tar.gz tk-b49d75097e2cde7a428f48f2049fe0cb54ecf2bf.tar.bz2 |
[Bug 3511806] Compiler checks too early
This change allows to build the cygwin
and mingw32 ports of Tcl/Tk to build
out-of-the-box using a native or cross-
compiler.
Diffstat (limited to 'win')
-rwxr-xr-x | win/configure | 433 | ||||
-rw-r--r-- | win/configure.in | 6 | ||||
-rw-r--r-- | win/tcl.m4 | 166 |
3 files changed, 486 insertions, 119 deletions
diff --git a/win/configure b/win/configure index 7cddb40..27ca399 100755 --- a/win/configure +++ b/win/configure @@ -934,16 +934,40 @@ fi #-------------------------------------------------------------------- -# Perform additinal compiler tests. +# Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- +echo $ac_n "checking for object suffix""... $ac_c" 1>&6 +echo "configure:942: checking for object suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if { (eval echo configure:948: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_objext" 1>&6 +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext + echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:942: checking for Cygwin environment" >&5 +echo "configure:966: checking for Cygwin environment" >&5 if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 947 "configure" +#line 971 "configure" #include "confdefs.h" int main() { @@ -954,7 +978,7 @@ int main() { return __CYGWIN__; ; return 0; } EOF -if { (eval echo configure:958: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:982: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -970,49 +994,20 @@ fi echo "$ac_t""$ac_cv_cygwin" 1>&6 CYGWIN= test "$ac_cv_cygwin" = yes && CYGWIN=yes - -#-------------------------------------------------------------------- -# Determines the correct binary file extension (.o, .obj, .exe etc.) -#-------------------------------------------------------------------- - -echo $ac_n "checking for object suffix""... $ac_c" 1>&6 -echo "configure:980: checking for object suffix" >&5 -if eval "test \"`echo '$''{'ac_cv_objext'+set}'`\" = set"; then - echo $ac_n "(cached) $ac_c" 1>&6 -else - rm -f conftest* -echo 'int i = 1;' > conftest.$ac_ext -if { (eval echo configure:986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - for ac_file in conftest.*; do - case $ac_file in - *.c) ;; - *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; - esac - done -else - { echo "configure: error: installation or configuration problem; compiler does not work" 1>&2; exit 1; } -fi -rm -f conftest* -fi - -echo "$ac_t""$ac_cv_objext" 1>&6 -OBJEXT=$ac_cv_objext -ac_objext=$ac_cv_objext - echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 -echo "configure:1004: checking for mingw32 environment" >&5 +echo "configure:999: checking for mingw32 environment" >&5 if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1009 "configure" +#line 1004 "configure" #include "confdefs.h" int main() { return __MINGW32__; ; return 0; } EOF -if { (eval echo configure:1016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_mingw32=yes else @@ -1031,7 +1026,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:1035: checking for executable suffix" >&5 +echo "configure:1030: checking for executable suffix" >&5 if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1041,7 +1036,7 @@ else rm -f conftest* echo 'int main () { return 0; }' > conftest.$ac_ext ac_cv_exeext= - if { (eval echo configure:1045: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + if { (eval echo configure:1040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then for file in conftest.*; do case $file in *.c | *.o | *.obj) ;; @@ -1068,7 +1063,7 @@ ac_exeext=$EXEEXT echo $ac_n "checking for building with threads""... $ac_c" 1>&6 -echo "configure:1072: checking for building with threads" >&5 +echo "configure:1067: checking for building with threads" >&5 # Check whether --enable-threads or --disable-threads was given. if test "${enable_threads+set}" = set; then enableval="$enable_threads" @@ -1105,7 +1100,7 @@ EOF echo $ac_n "checking how to build libraries""... $ac_c" 1>&6 -echo "configure:1109: checking how to build libraries" >&5 +echo "configure:1104: checking how to build libraries" >&5 # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -1146,7 +1141,7 @@ EOF # Step 0: Enable 64 bit support? echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6 -echo "configure:1150: checking if 64bit support is requested" >&5 +echo "configure:1145: checking if 64bit support is requested" >&5 # Check whether --enable-64bit or --disable-64bit was given. if test "${enable_64bit+set}" = set; then enableval="$enable_64bit" @@ -1160,7 +1155,7 @@ fi # Cross-compiling options for Windows/CE builds echo $ac_n "checking if Windows/CE build is requested""... $ac_c" 1>&6 -echo "configure:1164: checking if Windows/CE build is requested" >&5 +echo "configure:1159: checking if Windows/CE build is requested" >&5 # Check whether --enable-wince or --disable-wince was given. if test "${enable_wince+set}" = set; then enableval="$enable_wince" @@ -1172,7 +1167,7 @@ fi echo "$ac_t""$doWince" 1>&6 echo $ac_n "checking for Windows/CE celib directory""... $ac_c" 1>&6 -echo "configure:1176: checking for Windows/CE celib directory" >&5 +echo "configure:1171: checking for Windows/CE celib directory" >&5 # Check whether --with-celib or --without-celib was given. if test "${with_celib+set}" = set; then withval="$with_celib" @@ -1189,7 +1184,7 @@ fi # Extract the first word of "cygpath", so it can be a program name with args. set dummy cygpath; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1193: checking for $ac_word" >&5 +echo "configure:1188: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CYGPATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1223,6 +1218,57 @@ fi # which requires x86|amd64|ia64. MACHINE="X86" + echo $ac_n "checking for cross-compile version of gcc""... $ac_c" 1>&6 +echo "configure:1223: checking for cross-compile version of gcc" >&5 +if eval "test \"`echo '$''{'ac_cv_cross'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1228 "configure" +#include "confdefs.h" + + #ifdef __WIN32__ + #error cross-compiler + #endif + +int main() { + +; return 0; } +EOF +if { (eval echo configure:1239: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cross=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cross=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_cross" 1>&6 + + if test "$ac_cv_cross" = "yes"; then + case "$do64bit" in + amd64|x64|yes) + CC="x86_64-w64-mingw32-gcc" + LD="x86_64-w64-mingw32-ld" + AR="x86_64-w64-mingw32-ar" + RANLIB="x86_64-w64-mingw32-ranlib" + RC="x86_64-w64-mingw32-windres" + ;; + *) + CC="i686-w64-mingw32-gcc" + LD="i686-w64-mingw32-ld" + AR="i686-w64-mingw32-ar" + RANLIB="i686-w64-mingw32-ranlib" + RC="i686-w64-mingw32-windres" + ;; + esac + fi + # Check for a bug in gcc's windres that causes the # compile to fail when a Windows native path is # passed into windres. The mingw toolchain requires @@ -1237,9 +1283,9 @@ fi echo "END" >> $conftest echo $ac_n "checking for Windows native path bug in windres""... $ac_c" 1>&6 -echo "configure:1241: checking for Windows native path bug in windres" >&5 +echo "configure:1287: checking for Windows native path bug in windres" >&5 cyg_conftest=`$CYGPATH $conftest` - if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1243: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then + if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1289: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then echo "$ac_t""no" 1>&6 else echo "$ac_t""yes" 1>&6 @@ -1249,7 +1295,7 @@ echo "configure:1241: checking for Windows native path bug in windres" >&5 cyg_conftest= fi - if test "$CYGPATH" = "echo" || test "$ac_cv_cygwin" = "yes"; then + if test "$CYGPATH" = "echo"; then DEPARG='"$<"' else DEPARG='"$(shell $(CYGPATH) $<)"' @@ -1257,8 +1303,45 @@ echo "configure:1241: checking for Windows native path bug in windres" >&5 # set various compiler flags depending on whether we are using gcc or cl + if test "${GCC}" = "yes" ; then + echo $ac_n "checking for mingw32 version of gcc""... $ac_c" 1>&6 +echo "configure:1309: checking for mingw32 version of gcc" >&5 +if eval "test \"`echo '$''{'ac_cv_win32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1314 "configure" +#include "confdefs.h" + + #ifdef __WIN32__ + #error win32 + #endif + +int main() { + +; return 0; } +EOF +if { (eval echo configure:1325: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_win32=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_win32=yes +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_win32" 1>&6 + if test "$ac_cv_win32" != "yes"; then + { echo "configure: error: ${CC} cannot produce win32 executables." 1>&2; exit 1; } + fi + fi + echo $ac_n "checking compiler flags""... $ac_c" 1>&6 -echo "configure:1262: checking compiler flags" >&5 +echo "configure:1345: checking compiler flags" >&5 if test "${GCC}" = "yes" ; then SHLIB_LD="" SHLIB_LD_LIBS="" @@ -1278,25 +1361,6 @@ echo "configure:1262: checking compiler flags" >&5 extra_cflags="-pipe" extra_ldflags="-pipe" - if test "$ac_cv_cygwin" = "yes"; then - case "$do64bit" in - amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" - LD="x86_64-w64-mingw32-ld" - AR="x86_64-w64-mingw32-ar" - RANLIB="x86_64-w64-mingw32-ranlib" - RC="x86_64-w64-mingw32-windres" - ;; - *) - CC="i686-w64-mingw32-gcc" - LD="i686-w64-mingw32-ld" - AR="i686-w64-mingw32-ar" - RANLIB="i686-w64-mingw32-ranlib" - RC="i686-w64-mingw32-windres" - ;; - esac - fi - if test "${SHARED_BUILD}" = "0" ; then # static echo "$ac_t""using static flags" 1>&6 @@ -1376,18 +1440,18 @@ echo "configure:1262: checking compiler flags" >&5 ;; *) cat > conftest.$ac_ext <<EOF -#line 1380 "configure" +#line 1444 "configure" #include "confdefs.h" - #ifdef _WIN64 + #ifdef _WIN64 #error 64-bit - #endif + #endif int main() { ; return 0; } EOF -if { (eval echo configure:1391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* tcl_win_64bit=no else @@ -1625,6 +1689,193 @@ EOF fi fi + if test "${GCC}" = "yes" ; then + echo $ac_n "checking for SEH support in compiler""... $ac_c" 1>&6 +echo "configure:1695: checking for SEH support in compiler" >&5 +if eval "test \"`echo '$''{'tcl_cv_seh'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + tcl_cv_seh=no +else + cat > conftest.$ac_ext <<EOF +#line 1703 "configure" +#include "confdefs.h" + + #define WIN32_LEAN_AND_MEAN + #include <windows.h> + #undef WIN32_LEAN_AND_MEAN + + int main(int argc, char** argv) { + int a, b = 0; + __try { + a = 666 / b; + } + __except (EXCEPTION_EXECUTE_HANDLER) { + return 0; + } + return 1; + } + +EOF +if { (eval echo configure:1722: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + tcl_cv_seh=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + tcl_cv_seh=no +fi +rm -fr conftest* +fi + + +fi + +echo "$ac_t""$tcl_cv_seh" 1>&6 + if test "$tcl_cv_seh" = "no" ; then + cat >> confdefs.h <<\EOF +#define HAVE_NO_SEH 1 +EOF + + fi + + # + # Check to see if the excpt.h include file provided contains the + # definition for EXCEPTION_DISPOSITION; if not, which is the case + # with Cygwin's version as of 2002-04-10, define it to be int, + # sufficient for getting the current code to work. + # + echo $ac_n "checking for EXCEPTION_DISPOSITION support in include files""... $ac_c" 1>&6 +echo "configure:1752: checking for EXCEPTION_DISPOSITION support in include files" >&5 +if eval "test \"`echo '$''{'tcl_cv_eh_disposition'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1757 "configure" +#include "confdefs.h" + +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# undef WIN32_LEAN_AND_MEAN + +int main() { + + EXCEPTION_DISPOSITION x; + +; return 0; } +EOF +if { (eval echo configure:1770: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + tcl_cv_eh_disposition=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + tcl_cv_eh_disposition=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$tcl_cv_eh_disposition" 1>&6 + if test "$tcl_cv_eh_disposition" = "no" ; then + cat >> confdefs.h <<\EOF +#define EXCEPTION_DISPOSITION int +EOF + + fi + + # Check to see if winnt.h defines CHAR, SHORT, and LONG + # even if VOID has already been #defined. The win32api + # used by mingw and cygwin is known to do this. + + echo $ac_n "checking for winnt.h that ignores VOID define""... $ac_c" 1>&6 +echo "configure:1796: checking for winnt.h that ignores VOID define" >&5 +if eval "test \"`echo '$''{'tcl_cv_winnt_ignore_void'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1801 "configure" +#include "confdefs.h" + + #define VOID void + #define WIN32_LEAN_AND_MEAN + #include <windows.h> + #undef WIN32_LEAN_AND_MEAN + +int main() { + + CHAR c; + SHORT s; + LONG l; + +; return 0; } +EOF +if { (eval echo configure:1817: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + tcl_cv_winnt_ignore_void=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + tcl_cv_winnt_ignore_void=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$tcl_cv_winnt_ignore_void" 1>&6 + if test "$tcl_cv_winnt_ignore_void" = "yes" ; then + cat >> confdefs.h <<\EOF +#define HAVE_WINNT_IGNORE_VOID 1 +EOF + + fi + + # See if the compiler supports casting to a union type. + # This is used to stop gcc from printing a compiler + # warning when initializing a union member. + + echo $ac_n "checking for cast to union support""... $ac_c" 1>&6 +echo "configure:1843: checking for cast to union support" >&5 +if eval "test \"`echo '$''{'tcl_cv_cast_to_union'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1848 "configure" +#include "confdefs.h" + +int main() { + + union foo { int i; double d; }; + union foo f = (union foo) (int) 0; + +; return 0; } +EOF +if { (eval echo configure:1858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + tcl_cv_cast_to_union=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + tcl_cv_cast_to_union=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$tcl_cv_cast_to_union" 1>&6 + if test "$tcl_cv_cast_to_union" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_CAST_TO_UNION 1 +EOF + + fi + fi + # DL_LIBS is empty, but then we match the Unix version @@ -1637,7 +1888,7 @@ EOF #-------------------------------------------------------------------- echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1641: checking how to run the C preprocessor" >&5 +echo "configure:1892: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1652,13 +1903,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 1656 "configure" +#line 1907 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1662: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1913: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1669,13 +1920,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1673 "configure" +#line 1924 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1679: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1686,13 +1937,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1690 "configure" +#line 1941 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1696: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1947: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1718,17 +1969,17 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "errno.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for errno.h""... $ac_c" 1>&6 -echo "configure:1722: checking for errno.h" >&5 +echo "configure:1973: checking for errno.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1727 "configure" +#line 1978 "configure" #include "confdefs.h" #include <errno.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1983: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1758,20 +2009,20 @@ fi if test "${MACHINE}" = "X86" ; then echo $ac_n "checking availability of _strtoi64""... $ac_c" 1>&6 -echo "configure:1762: checking availability of _strtoi64" >&5 +echo "configure:2013: checking availability of _strtoi64" >&5 if eval "test \"`echo '$''{'tcl_have_strtoi64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1768 "configure" +#line 2019 "configure" #include "confdefs.h" #include <stdlib.h> int main() { _strtoi64(0,0,0) ; return 0; } EOF -if { (eval echo configure:1775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* tcl_have_strtoi64=yes else @@ -1800,7 +2051,7 @@ fi echo $ac_n "checking for build with symbols""... $ac_c" 1>&6 -echo "configure:1804: checking for build with symbols" >&5 +echo "configure:2055: checking for build with symbols" >&5 # Check whether --enable-symbols or --disable-symbols was given. if test "${enable_symbols+set}" = set; then enableval="$enable_symbols" @@ -1861,7 +2112,7 @@ TK_DBGX=${DBGX} echo $ac_n "checking whether to embed manifest""... $ac_c" 1>&6 -echo "configure:1865: checking whether to embed manifest" >&5 +echo "configure:2116: checking whether to embed manifest" >&5 # Check whether --enable-embedded-manifest or --disable-embedded-manifest was given. if test "${enable_embedded_manifest+set}" = set; then enableval="$enable_embedded_manifest" @@ -1878,7 +2129,7 @@ fi -a "$GCC" != "yes" ; then # Add the magic to embed the manifest into the dll/exe cat > conftest.$ac_ext <<EOF -#line 1882 "configure" +#line 2133 "configure" #include "confdefs.h" #if defined(_MSC_VER) && _MSC_VER >= 1400 @@ -1915,7 +2166,7 @@ rm -f conftest* echo $ac_n "checking the location of tclConfig.sh""... $ac_c" 1>&6 -echo "configure:1919: checking the location of tclConfig.sh" >&5 +echo "configure:2170: checking the location of tclConfig.sh" >&5 if test -d ../../tcl8.4$TK_PATCH_LEVEL/win; then TCL_BIN_DIR_DEFAULT=../../tcl8.4$TK_PATCH_LEVEL/win @@ -1943,7 +2194,7 @@ fi echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6 -echo "configure:1947: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo "configure:2198: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then echo "$ac_t""loading" 1>&6 @@ -1996,14 +2247,14 @@ echo "configure:1947: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 echo $ac_n "checking for tclsh in Tcl build directory""... $ac_c" 1>&6 -echo "configure:2000: checking for tclsh in Tcl build directory" >&5 +echo "configure:2251: checking for tclsh in Tcl build directory" >&5 BUILD_TCLSH=${TCL_BIN_DIR}/tclsh${TCL_MAJOR_VERSION}${TCL_MINOR_VERSION}${TCL_DBGX}${EXEEXT} echo "$ac_t""$BUILD_TCLSH" 1>&6 echo $ac_n "checking for tclsh""... $ac_c" 1>&6 -echo "configure:2007: checking for tclsh" >&5 +echo "configure:2258: checking for tclsh" >&5 if eval "test \"`echo '$''{'ac_cv_path_tclsh'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 diff --git a/win/configure.in b/win/configure.in index ffad2c0..ff9e2cc 100644 --- a/win/configure.in +++ b/win/configure.in @@ -70,12 +70,6 @@ fi AC_PROG_MAKE_SET #-------------------------------------------------------------------- -# Perform additinal compiler tests. -#-------------------------------------------------------------------- - -AC_CYGWIN - -#-------------------------------------------------------------------- # Determines the correct binary file extension (.o, .obj, .exe etc.) #-------------------------------------------------------------------- @@ -408,6 +408,36 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # which requires x86|amd64|ia64. MACHINE="X86" + AC_CACHE_CHECK(for cross-compile version of gcc, + ac_cv_cross, + AC_TRY_COMPILE([ + #ifdef __WIN32__ + #error cross-compiler + #endif + ], [], + ac_cv_cross=yes, + ac_cv_cross=no) + ) + + if test "$ac_cv_cross" = "yes"; then + case "$do64bit" in + amd64|x64|yes) + CC="x86_64-w64-mingw32-gcc" + LD="x86_64-w64-mingw32-ld" + AR="x86_64-w64-mingw32-ar" + RANLIB="x86_64-w64-mingw32-ranlib" + RC="x86_64-w64-mingw32-windres" + ;; + *) + CC="i686-w64-mingw32-gcc" + LD="i686-w64-mingw32-ld" + AR="i686-w64-mingw32-ar" + RANLIB="i686-w64-mingw32-ranlib" + RC="i686-w64-mingw32-windres" + ;; + esac + fi + # Check for a bug in gcc's windres that causes the # compile to fail when a Windows native path is # passed into windres. The mingw toolchain requires @@ -433,7 +463,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ cyg_conftest= fi - if test "$CYGPATH" = "echo" || test "$ac_cv_cygwin" = "yes"; then + if test "$CYGPATH" = "echo"; then DEPARG='"$<"' else DEPARG='"$(shell $(CYGPATH) $<)"' @@ -441,6 +471,22 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ # set various compiler flags depending on whether we are using gcc or cl + if test "${GCC}" = "yes" ; then + AC_CACHE_CHECK(for mingw32 version of gcc, + ac_cv_win32, + AC_TRY_COMPILE([ + #ifdef __WIN32__ + #error win32 + #endif + ], [], + ac_cv_win32=no, + ac_cv_win32=yes) + ) + if test "$ac_cv_win32" != "yes"; then + AC_MSG_ERROR([${CC} cannot produce win32 executables.]) + fi + fi + AC_MSG_CHECKING([compiler flags]) if test "${GCC}" = "yes" ; then SHLIB_LD="" @@ -461,25 +507,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ extra_cflags="-pipe" extra_ldflags="-pipe" - if test "$ac_cv_cygwin" = "yes"; then - case "$do64bit" in - amd64|x64|yes) - CC="x86_64-w64-mingw32-gcc" - LD="x86_64-w64-mingw32-ld" - AR="x86_64-w64-mingw32-ar" - RANLIB="x86_64-w64-mingw32-ranlib" - RC="x86_64-w64-mingw32-windres" - ;; - *) - CC="i686-w64-mingw32-gcc" - LD="i686-w64-mingw32-ld" - AR="i686-w64-mingw32-ar" - RANLIB="i686-w64-mingw32-ranlib" - RC="i686-w64-mingw32-windres" - ;; - esac - fi - if test "${SHARED_BUILD}" = "0" ; then # static AC_MSG_RESULT([using static flags]) @@ -559,9 +586,9 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ ;; *) AC_TRY_COMPILE([ - #ifdef _WIN64 + #ifdef _WIN64 #error 64-bit - #endif + #endif ], [], tcl_win_64bit=no, tcl_win_64bit=yes @@ -784,6 +811,101 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ fi fi + if test "${GCC}" = "yes" ; then + AC_CACHE_CHECK(for SEH support in compiler, + tcl_cv_seh, + AC_TRY_RUN([ + #define WIN32_LEAN_AND_MEAN + #include <windows.h> + #undef WIN32_LEAN_AND_MEAN + + int main(int argc, char** argv) { + int a, b = 0; + __try { + a = 666 / b; + } + __except (EXCEPTION_EXECUTE_HANDLER) { + return 0; + } + return 1; + } + ], + tcl_cv_seh=yes, + tcl_cv_seh=no, + tcl_cv_seh=no) + ) + if test "$tcl_cv_seh" = "no" ; then + AC_DEFINE(HAVE_NO_SEH, 1, + [Defined when mingw does not support SEH]) + fi + + # + # Check to see if the excpt.h include file provided contains the + # definition for EXCEPTION_DISPOSITION; if not, which is the case + # with Cygwin's version as of 2002-04-10, define it to be int, + # sufficient for getting the current code to work. + # + AC_CACHE_CHECK(for EXCEPTION_DISPOSITION support in include files, + tcl_cv_eh_disposition, + AC_TRY_COMPILE([ +# define WIN32_LEAN_AND_MEAN +# include <windows.h> +# undef WIN32_LEAN_AND_MEAN + ],[ + EXCEPTION_DISPOSITION x; + ], + tcl_cv_eh_disposition=yes, + tcl_cv_eh_disposition=no) + ) + if test "$tcl_cv_eh_disposition" = "no" ; then + AC_DEFINE(EXCEPTION_DISPOSITION, int, + [Defined when cygwin/mingw does not support EXCEPTION DISPOSITION]) + fi + + # Check to see if winnt.h defines CHAR, SHORT, and LONG + # even if VOID has already been #defined. The win32api + # used by mingw and cygwin is known to do this. + + AC_CACHE_CHECK(for winnt.h that ignores VOID define, + tcl_cv_winnt_ignore_void, + AC_TRY_COMPILE([ + #define VOID void + #define WIN32_LEAN_AND_MEAN + #include <windows.h> + #undef WIN32_LEAN_AND_MEAN + ], [ + CHAR c; + SHORT s; + LONG l; + ], + tcl_cv_winnt_ignore_void=yes, + tcl_cv_winnt_ignore_void=no) + ) + if test "$tcl_cv_winnt_ignore_void" = "yes" ; then + AC_DEFINE(HAVE_WINNT_IGNORE_VOID, 1, + [Defined when cygwin/mingw ignores VOID define in winnt.h]) + fi + + # See if the compiler supports casting to a union type. + # This is used to stop gcc from printing a compiler + # warning when initializing a union member. + + AC_CACHE_CHECK(for cast to union support, + tcl_cv_cast_to_union, + AC_TRY_COMPILE([], + [ + union foo { int i; double d; }; + union foo f = (union foo) (int) 0; + ], + tcl_cv_cast_to_union=yes, + tcl_cv_cast_to_union=no) + ) + if test "$tcl_cv_cast_to_union" = "yes"; then + AC_DEFINE(HAVE_CAST_TO_UNION, 1, + [Defined when compiler supports casting to union type.]) + fi + fi + # DL_LIBS is empty, but then we match the Unix version AC_SUBST(DL_LIBS) AC_SUBST(CFLAGS_DEBUG) |