summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2011-04-21 08:08:36 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2011-04-21 08:08:36 (GMT)
commit81582f76e6fa7e328f9ae6c92cf756e569565818 (patch)
treeb0b93eb5ba78408fab27e7c5e6c0982407cc140a /win
parentaed831f6a1a96de6e8f56e5600f4e9584fefd224 (diff)
downloadtcl-81582f76e6fa7e328f9ae6c92cf756e569565818.zip
tcl-81582f76e6fa7e328f9ae6c92cf756e569565818.tar.gz
tcl-81582f76e6fa7e328f9ae6c92cf756e569565818.tar.bz2
fix for [Bug 3288345]: Wrong Tcl_StatBufused on MinGW.
Make sure that all _WIN32 compilers use exactly the same layout for Tcl_StatBuf - the one used by MSVC6 - in all situations.
Diffstat (limited to 'win')
-rwxr-xr-xwin/configure95
-rw-r--r--win/configure.in19
-rw-r--r--win/tclWinPort.h19
3 files changed, 106 insertions, 27 deletions
diff --git a/win/configure b/win/configure
index f7da2f0..ac2284a 100755
--- a/win/configure
+++ b/win/configure
@@ -1263,19 +1263,60 @@ EOF
fi
+# Check to see if struct _stat32i64 exists in mingw's sys/stat.h
+
+echo $ac_n "checking struct _stat32i64""... $ac_c" 1>&6
+echo "configure:1270: checking struct _stat32i64" >&5
+if eval "test \"`echo '$''{'tcl_struct_stat32i64'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 1275 "configure"
+#include "confdefs.h"
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+int main() {
+
+ struct _stat32i64 foo;
+
+; return 0; }
+EOF
+if { (eval echo configure:1287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ tcl_struct_stat32i64=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ tcl_struct_stat32i64=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$tcl_struct_stat32i64" 1>&6
+if test "$tcl_struct_stat32i64" = "yes" ; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_STRUCT_STAT32I64 1
+EOF
+
+fi
+
#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
#--------------------------------------------------------------------
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1273: checking for object suffix" >&5
+echo "configure:1314: 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:1279: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1293,19 +1334,19 @@ OBJEXT=$ac_cv_objext
ac_objext=$ac_cv_objext
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1297: checking for mingw32 environment" >&5
+echo "configure:1338: 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 1302 "configure"
+#line 1343 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:1309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1350: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -1324,7 +1365,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1328: checking for executable suffix" >&5
+echo "configure:1369: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1334,7 +1375,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -1361,7 +1402,7 @@ ac_exeext=$EXEEXT
echo $ac_n "checking for building with threads""... $ac_c" 1>&6
-echo "configure:1365: checking for building with threads" >&5
+echo "configure:1406: 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"
@@ -1398,7 +1439,7 @@ EOF
echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
-echo "configure:1402: checking how to build libraries" >&5
+echo "configure:1443: 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"
@@ -1439,7 +1480,7 @@ EOF
# Step 0: Enable 64 bit support?
echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
-echo "configure:1443: checking if 64bit support is requested" >&5
+echo "configure:1484: 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"
@@ -1453,7 +1494,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:1457: checking if Windows/CE build is requested" >&5
+echo "configure:1498: 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"
@@ -1465,7 +1506,7 @@ fi
echo "$ac_t""$doWince" 1>&6
echo $ac_n "checking for Windows/CE celib directory""... $ac_c" 1>&6
-echo "configure:1469: checking for Windows/CE celib directory" >&5
+echo "configure:1510: 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"
@@ -1482,7 +1523,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:1486: checking for $ac_word" >&5
+echo "configure:1527: 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
@@ -1530,9 +1571,9 @@ fi
echo "END" >> $conftest
echo $ac_n "checking for Windows native path bug in windres""... $ac_c" 1>&6
-echo "configure:1534: checking for Windows native path bug in windres" >&5
+echo "configure:1575: 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:1536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then
+ if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1577: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then
echo "$ac_t""no" 1>&6
else
echo "$ac_t""yes" 1>&6
@@ -1551,7 +1592,7 @@ echo "configure:1534: checking for Windows native path bug in windres" >&5
# set various compiler flags depending on whether we are using gcc or cl
echo $ac_n "checking compiler flags""... $ac_c" 1>&6
-echo "configure:1555: checking compiler flags" >&5
+echo "configure:1596: checking compiler flags" >&5
if test "${GCC}" = "yes" ; then
SHLIB_LD=""
SHLIB_LD_LIBS=""
@@ -1899,7 +1940,7 @@ EOF
echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:1903: checking for build with symbols" >&5
+echo "configure:1944: 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"
@@ -1959,7 +2000,7 @@ TCL_DBGX=${DBGX}
#--------------------------------------------------------------------
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1963: checking how to run the C preprocessor" >&5
+echo "configure:2004: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1974,13 +2015,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 1978 "configure"
+#line 2019 "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:1984: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2025: \"$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
:
@@ -1991,13 +2032,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1995 "configure"
+#line 2036 "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:2001: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2042: \"$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
:
@@ -2008,13 +2049,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 2012 "configure"
+#line 2053 "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:2018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2059: \"$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
:
@@ -2040,17 +2081,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:2044: checking for errno.h" >&5
+echo "configure:2085: 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 2049 "configure"
+#line 2090 "configure"
#include "confdefs.h"
#include <errno.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2054: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2095: \"$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*
diff --git a/win/configure.in b/win/configure.in
index 1b6a843..3e6561e 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -240,6 +240,25 @@ if test "$tcl_cv_cast_to_union" = "yes"; then
[Defined when compiler supports casting to union type.])
fi
+# Check to see if struct _stat32i64 exists in mingw's sys/stat.h
+
+AC_CACHE_CHECK(struct _stat32i64,
+ tcl_struct_stat32i64,
+AC_TRY_COMPILE([
+#include <sys/types.h>
+#include <sys/stat.h>
+],
+[
+ struct _stat32i64 foo;
+],
+ tcl_struct_stat32i64=yes,
+ tcl_struct_stat32i64=no)
+)
+if test "$tcl_struct_stat32i64" = "yes" ; then
+ AC_DEFINE(HAVE_STRUCT_STAT32I64, 1,
+ [Defined when sys/stat.h has struct_stat32i64])
+fi
+
#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index 6e8dcfb..5115dab 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -95,6 +95,25 @@
#endif
/*
+ * Not all mingw32 versions have this struct.
+ */
+#if !defined(__BORLANDC__) && !defined(_MSC_VER) && !defined(_WIN64) && !defined(HAVE_STRUCT_STAT32I64)
+ struct _stat32i64 {
+ _dev_t st_dev;
+ _ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ _dev_t st_rdev;
+ __int64 st_size;
+ long st_atime;
+ long st_mtime;
+ long st_ctime;
+ };
+#endif
+
+/*
* The following defines redefine the Windows Socket errors as
* BSD errors so Tcl_PosixError can do the right thing.
*/