summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/.cvsignore27
-rw-r--r--win/README3
-rwxr-xr-xwin/configure71
-rw-r--r--win/configure.in19
-rw-r--r--win/makefile.vc19
-rw-r--r--win/rules.vc87
-rw-r--r--win/tcl.m42
-rw-r--r--win/tclWinFile.c5
-rw-r--r--win/tclWinPort.h25
9 files changed, 177 insertions, 81 deletions
diff --git a/win/.cvsignore b/win/.cvsignore
deleted file mode 100644
index 04c3b08..0000000
--- a/win/.cvsignore
+++ /dev/null
@@ -1,27 +0,0 @@
-Debug
-Release
-*.opt
-*.ncb
-*.plg
-*.00?
-*.o
-*.obj
-*.i
-*.asm
-*.dll
-*.exe
-Makefile
-tcl.hpj
-tclConfig.sh
-.#*
-tcl.sln
-tcl.suo
-autom4te.cache
-config.status
-*.a
-*.lib
-*.exp
-*.res
-*.pch
-*.x
-*.vc
diff --git a/win/README b/win/README
index ccd1e7d..1929362 100644
--- a/win/README
+++ b/win/README
@@ -11,9 +11,6 @@ The information in this file is maintained on the web at:
http://www.tcl.tk/doc/howto/compile.html#win
-The above URL includes a lengthy discussion of compiler macros necessary
-when compiling Tcl extensions that will be dynamically loaded.
-
2. Compiling Tcl
----------------
diff --git a/win/configure b/win/configure
index 099c1cb..c397e45 100755
--- a/win/configure
+++ b/win/configure
@@ -3550,6 +3550,75 @@ _ACEOF
fi
+# Check to see if struct _stat32i64 exists in mingw's sys/stat.h
+
+echo "$as_me:$LINENO: checking struct _stat32i64" >&5
+echo $ECHO_N "checking struct _stat32i64... $ECHO_C" >&6
+if test "${tcl_struct_stat32i64+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+int
+main ()
+{
+
+ struct _stat32i64 foo;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ tcl_struct_stat32i64=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+tcl_struct_stat32i64=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: $tcl_struct_stat32i64" >&5
+echo "${ECHO_T}$tcl_struct_stat32i64" >&6
+if test "$tcl_struct_stat32i64" = "yes" ; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRUCT_STAT32I64 1
+_ACEOF
+
+fi
+
# See if declarations like FINDEX_INFO_LEVELS are
# missing from winbase.h. This is known to be
@@ -4408,7 +4477,7 @@ _ACEOF
EXTRA_CFLAGS=""
CFLAGS_WARNING="-W3"
- LDFLAGS_DEBUG="-debug:full"
+ LDFLAGS_DEBUG="-debug"
LDFLAGS_OPTIMIZE="-release"
# Specify the CC output file names based on the target name
diff --git a/win/configure.in b/win/configure.in
index bbd4cd5..c589018 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -241,6 +241,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
+
# See if declarations like FINDEX_INFO_LEVELS are
# missing from winbase.h. This is known to be
diff --git a/win/makefile.vc b/win/makefile.vc
index e38abe5..7dc96b7 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -208,6 +208,15 @@ TCLDDELIB = $(OUT_DIR)\$(TCLDDELIBNAME)
TCLTEST = $(OUT_DIR)\$(PROJECT)test.exe
CAT32 = $(OUT_DIR)\cat32.exe
+# Can we run what we build? IX86 runs on all architectures.
+!ifndef TCLSH_NATIVE
+!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
+TCLSH_NATIVE = $(TCLSH)
+!else
+!error You must explicitly set TCLSH_NATIVE for cross-compilation
+!endif
+!endif
+
### Make sure we use backslash only.
LIB_INSTALL_DIR = $(_INSTALLDIR)\lib
BIN_INSTALL_DIR = $(_INSTALLDIR)\bin
@@ -452,11 +461,11 @@ STUB_CFLAGS = $(cflags) $(cdebug:-GL=) $(OPTDEFINES)
#---------------------------------------------------------------------
!if $(DEBUG)
-ldebug = -debug:full -debugtype:cv
+ldebug = -debug -debugtype:cv
!else
ldebug = -release -opt:ref -opt:icf,3
!if $(SYMBOLS)
-ldebug = $(ldebug) -debug:full -debugtype:cv
+ldebug = $(ldebug) -debug -debugtype:cv
!endif
!endif
@@ -715,7 +724,7 @@ $(OUT_DIR)\tclConfig.sh: $(WINDIR)\tclConfig.sh.in
@DEFS@ $(TCL_CFLAGS)
@CFLAGS_DEBUG@ -nologo -c -W3 -YX -Fp$(TMP_DIR)\ -MDd
@CFLAGS_OPTIMIZE@ -nologo -c -W3 -YX -Fp$(TMP_DIR)\ -MD
-@LDFLAGS_DEBUG@ -nologo -machine:$(MACHINE) -debug:full -debugtype:cv
+@LDFLAGS_DEBUG@ -nologo -machine:$(MACHINE) -debug -debugtype:cv
@LDFLAGS_OPTIMIZE@ -nologo -machine:$(MACHINE) -release -opt:ref -opt:icf,3
@TCL_DBGX@ $(SUFX)
@TCL_LIB_FILE@ $(PROJECT)$(VERSION)$(SUFX).lib
@@ -1015,13 +1024,13 @@ install-libraries: tclConfig install-msgs install-tzdata
install-tzdata:
@echo Installing time zone data
@set TCL_LIBRARY=$(ROOT)/library
- @$(TCLSH) "$(ROOT)/tools/installData.tcl" \
+ @$(TCLSH_NATIVE) "$(ROOT)/tools/installData.tcl" \
"$(ROOT)/library/tzdata" "$(SCRIPT_INSTALL_DIR)/tzdata"
install-msgs:
@echo Installing message catalogs
@set TCL_LIBRARY=$(ROOT)/library
- @$(TCLSH) "$(ROOT)/tools/installData.tcl" \
+ @$(TCLSH_NATIVE) "$(ROOT)/tools/installData.tcl" \
"$(ROOT)/library/msgs" "$(SCRIPT_INSTALL_DIR)/msgs"
#---------------------------------------------------------------------
diff --git a/win/rules.vc b/win/rules.vc
index 865b10d..e18dca9 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -27,18 +27,6 @@ _INSTALLDIR = C:\Program Files\Tcl
_INSTALLDIR = $(INSTALLDIR:/=\)
!endif
-!ifndef MACHINE
-!if "$(CPU)" == "" || "$(CPU)" == "i386"
-MACHINE = IX86
-!else
-MACHINE = $(CPU)
-!endif
-!endif
-
-!ifndef CFG_ENCODING
-CFG_ENCODING = \"cp1252\"
-!endif
-
#----------------------------------------------------------
# Set the proper copy method to avoid overwrite questions
# to the user when copying files and selecting the right
@@ -64,6 +52,50 @@ ERRNULL = >NUL # Win9x shell cannot redirect stderr
!endif
MKDIR = mkdir
+#------------------------------------------------------------------------------
+# Determine the host and target architectures and compiler version.
+#------------------------------------------------------------------------------
+
+_HASH=^#
+_VC_MANIFEST_EMBED_EXE=
+_VC_MANIFEST_EMBED_DLL=
+VCVER=0
+!if ![echo VCVERSION=_MSC_VER > vercl.x] \
+ && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
+ && ![echo ARCH=IX86 >> vercl.x] \
+ && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
+ && ![echo ARCH=AMD64 >> vercl.x] \
+ && ![echo $(_HASH)endif >> vercl.x] \
+ && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
+!include vercl.i
+!if ![echo VCVER= ^\> vercl.vc] \
+ && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
+!include vercl.vc
+!endif
+!endif
+!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
+!endif
+
+!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
+NATIVE_ARCH=IX86
+!else
+NATIVE_ARCH=AMD64
+!endif
+
+# Since MSVC8 we must deal with manifest resources.
+!if $(VCVERSION) >= 1400
+_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
+_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
+!endif
+
+!ifndef MACHINE
+MACHINE=$(ARCH)
+!endif
+
+!ifndef CFG_ENCODING
+CFG_ENCODING = \"cp1252\"
+!endif
+
!message ===============================================================================
#----------------------------------------------------------
@@ -176,36 +208,6 @@ LINKERFLAGS =-ltcg
!endif
#----------------------------------------------------------
-# MSVC8 (ships with Visual Studio 2005) generates a manifest
-# file that we should link into the binaries. This is how.
-#----------------------------------------------------------
-
-_VC_MANIFEST_EMBED_EXE=
-_VC_MANIFEST_EMBED_DLL=
-VCVER=0
-!if ![echo VCVERSION=_MSC_VER > vercl.x] \
- && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
-!include vercl.i
-!if $(VCVERSION) >= 1600
-VCVER=10
-!elseif $(VCVERSION) >= 1500
-VCVER=9
-!elseif $(VCVERSION) >= 1400
-VCVER=8
-!elseif $(VCVERSION) >= 1300
-VCVER=7
-!elseif $(VCVERSION) >= 1200
-VCVER=6
-!endif
-!endif
-
-# Since MSVC8 we must deal with manifest resources.
-!if $(VCVERSION) >= 1400
-_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
-_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
-!endif
-
-#----------------------------------------------------------
# Decode the options requested.
#----------------------------------------------------------
@@ -667,6 +669,7 @@ TK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
!message *** Suffix for binaries will be '$(SUFX)'
!message *** Optional defines are '$(OPTDEFINES)'
!message *** Compiler version $(VCVER). Target machine is $(MACHINE)
+!message *** Host architecture is $(NATIVE_ARCH)
!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'
!message *** Link options '$(LINKERFLAGS)'
diff --git a/win/tcl.m4 b/win/tcl.m4
index feb3d0c..be22fac 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -755,7 +755,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
EXTRA_CFLAGS=""
CFLAGS_WARNING="-W3"
- LDFLAGS_DEBUG="-debug:full"
+ LDFLAGS_DEBUG="-debug"
LDFLAGS_OPTIMIZE="-release"
# Specify the CC output file names based on the target name
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index aa43495..0291a41 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -12,8 +12,9 @@
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*/
-/* #define _WIN32_WINNT 0x0500 */
-
+#ifndef _WIN64
+# define _USE_32BIT_TIME_T
+#endif
#include "tclWinInt.h"
#include "tclFileSystem.h"
#include <winioctl.h>
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index 55b95c1..8fdf391 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -105,6 +105,31 @@
#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;
+#ifdef __CYGWIN__
+ struct {long tv_sec;} st_atim;
+ struct {long tv_sec;} st_mtim;
+ struct {long tv_sec;} st_ctim;
+#else
+ long st_atime;
+ long st_mtime;
+ long st_ctime;
+#endif
+ };
+#endif
+
+/*
* The following defines redefine the Windows Socket errors as
* BSD errors so Tcl_PosixError can do the right thing.
*/