summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-03-31 08:52:25 (GMT)
committerhobbs <hobbs>2000-03-31 08:52:25 (GMT)
commitbfc465013806bbc8b695f2bbe20707a6b25ad961 (patch)
tree98cafa8492f8f5cdc15405f98b3da66ac0f35396 /win
parent3c56f64822ed7b64de23a900456152fe8ee1fb60 (diff)
downloadtcl-bfc465013806bbc8b695f2bbe20707a6b25ad961.zip
tcl-bfc465013806bbc8b695f2bbe20707a6b25ad961.tar.gz
tcl-bfc465013806bbc8b695f2bbe20707a6b25ad961.tar.bz2
* generic/tclInt.decls:
* generic/tclIntPlatDecls.h: * generic/tclStubInit.c: * win/tclWin32Dll.c: removed TclWinSynchSpawn (vestige of Win32s support). * win/tclWinReg.c: made use of TclWinGetPlatformId instead of getting info again * win/tclWinPort.h: * win/Makefile.in: * win/configure.in: * win/tcl.m4: Added support for gcc/mingw on Windows [Bug: 4234]
Diffstat (limited to 'win')
-rw-r--r--win/Makefile.in40
-rw-r--r--win/configure.in10
-rw-r--r--win/tcl.m4114
-rw-r--r--win/tclWin32Dll.c93
-rw-r--r--win/tclWinInit.c4
-rw-r--r--win/tclWinPort.h9
-rw-r--r--win/tclWinReg.c9
7 files changed, 153 insertions, 126 deletions
diff --git a/win/Makefile.in b/win/Makefile.in
index dc7017c..9151710 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -5,7 +5,7 @@
# "autoconf" program (constructs like "@foo@" will get replaced in the
# actual Makefile.
#
-# RCS: @(#) $Id: Makefile.in,v 1.28 2000/03/07 02:21:58 wart Exp $
+# RCS: @(#) $Id: Makefile.in,v 1.29 2000/03/31 08:52:25 hobbs Exp $
VERSION = @TCL_VERSION@
@@ -105,11 +105,16 @@ GENERIC_DIR = @srcdir@/../generic
WIN_DIR = @srcdir@
COMPAT_DIR = @srcdir@/../compat
+# This is a switch passed to a Cygwin script that generates file
+# names based on the platform.
PATHTYPE = @PATHTYPE@
-GENERIC_DIR_NATIVE = $(shell cygpath $(PATHTYPE) '$(GENERIC_DIR)')
-WIN_DIR_NATIVE = $(shell cygpath $(PATHTYPE) '$(WIN_DIR)')
-ROOT_DIR_NATIVE = $(shell cygpath $(PATHTYPE) '$(ROOT_DIR)')
+# This program converts between Windows native and Cygwin POSIX pathnames.
+CYGPATH = @CYGPATH@
+
+GENERIC_DIR_NATIVE = $(shell $(CYGPATH) $(PATHTYPE) '$(GENERIC_DIR)')
+WIN_DIR_NATIVE = $(shell $(CYGPATH) $(PATHTYPE) '$(WIN_DIR)')
+ROOT_DIR_NATIVE = $(shell $(CYGPATH) $(PATHTYPE) '$(ROOT_DIR)')
LIBRARY_DIR = $(shell echo '$(ROOT_DIR_NATIVE)/library' | sed 's/\\/\//g' )
@@ -140,13 +145,14 @@ MAN2TCL = man2tcl$(EXEEXT)
# Macro that expands to the first dependency argument with the appropriate
# path type already resolved.
-DEPARG = "$(shell cygpath $(PATHTYPE) $<)"
+DEPARG = "$(shell $(CYGPATH) $(PATHTYPE) $<)"
# Setting the VPATH variable to a list of paths will cause the
# makefile to look into these paths when resolving .c to .obj
-# dependencies.
+# dependencies. Note the ':' to avoid autoconf's habit of deleting
+# all VPATH lines without an explicit ':' in it.
-VPATH = $(GENERIC_DIR);$(WIN_DIR);$(COMPAT_DIR)
+VPATH = $(GENERIC_DIR)@VPSEP@$(WIN_DIR)@VPSEP@$(COMPAT_DIR) # :
AR = @AR@
CC = @CC@
@@ -310,10 +316,10 @@ $(TCLSH): $(TCL_LIB_FILE) $(TCLSH_OBJS)
$(TCLTEST): $(TCL_LIB_FILE) $(TCLTEST_OBJS) $(CAT32)
$(CC) $(CFLAGS) $(TCLTEST_OBJS) $(TCL_LIB_FILE) $(LIBS) $(CC_EXENAME)
-cat32.obj: cat.c
+cat32.${OBJEXT}: cat.c
$(CC) -c $(CC_SWITCHES) $(DEPARG) $(CC_OBJNAME)
-$(CAT32): cat32.obj
+$(CAT32): cat32.${OBJEXT}
$(CC) $(CFLAGS) cat32.obj $(CC_EXENAME) -link $(LDFLAGS_CONSOLE)
# The following targets are configured by autoconf to generate either
@@ -353,30 +359,30 @@ ${PIPE_DLL_FILE}: ${PIPE_OBJS}
# Special case object targets
-tclWinInit.obj: tclWinInit.c
+tclWinInit.${OBJEXT}: tclWinInit.c
$(CC) -c $(CC_SWITCHES) -DBUILD_tcl $(EXTFLAGS) $(DEPARG) $(CC_OBJNAME)
-testMain.obj: tclAppInit.c
+testMain.${OBJEXT}: tclAppInit.c
$(CC) -c $(CC_SWITCHES) -DTCL_TEST $(DEPARG) $(CC_OBJNAME)
-tclTest.obj: tclTest.c
+tclTest.${OBJEXT}: tclTest.c
$(CC) -c $(CC_SWITCHES) $(DEPARG) $(CC_OBJNAME)
-tclTestObj.obj: tclTestObj.c
+tclTestObj.${OBJEXT}: tclTestObj.c
$(CC) -c $(CC_SWITCHES) $(DEPARG) $(CC_OBJNAME)
-tclWinTest.obj: tclWinTest.c
+tclWinTest.${OBJEXT}: tclWinTest.c
$(CC) -c $(CC_SWITCHES) $(DEPARG) $(CC_OBJNAME)
-tclAppInit.obj : tclAppInit.c
+tclAppInit.${OBJEXT} : tclAppInit.c
$(CC) -c $(CC_SWITCHES) $(DEPARG) $(CC_OBJNAME)
# The following objects should be built using the stub interfaces
-tclWinReg.obj : tclWinReg.c
+tclWinReg.${OBJEXT} : tclWinReg.c
$(CC) -c $(CC_SWITCHES) -DUSE_TCL_STUBS $(DEPARG) $(CC_OBJNAME)
-tclWinDde.obj : tclWinDde.c
+tclWinDde.${OBJEXT} : tclWinDde.c
$(CC) -c $(CC_SWITCHES) -DUSE_TCL_STUBS $(DEPARG) $(CC_OBJNAME)
# The following objects are part of the stub library and should not
diff --git a/win/configure.in b/win/configure.in
index a62aa30..50fd4d8 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -2,7 +2,7 @@
# generate the file "configure", which is run during Tcl installation
# to configure the system for the local environment.
#
-# RCS: @(#) $Id: configure.in,v 1.18 2000/02/08 10:07:05 hobbs Exp $
+# RCS: @(#) $Id: configure.in,v 1.19 2000/03/31 08:52:29 hobbs Exp $
AC_INIT(../generic/tcl.h)
@@ -88,10 +88,11 @@ TCL_UNSHARED_LIB_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
TCL_EXPORT_FILE_SUFFIX="\${NODOT_VERSION}${LIBSUFFIX}"
eval "TCL_SRC_DIR=`cd $srcdir; pwd`"
-eval "TCL_STUB_LIB_FILE=tclstub$VER${LIBSUFFIX}"
+eval "TCL_STUB_LIB_FILE=${LIBPREFIX}tclstub$VER${LIBSUFFIX}"
eval "TCL_DLL_FILE=tcl$VER${DLLSUFFIX}"
-eval "TCL_LIB_FILE=tcl$VER${LIBSUFFIX}"
+eval "TCL_LIB_FILE=${LIBPREFIX}tcl$VER${LIBSUFFIX}"
eval "DLLSUFFIX=${DLLSUFFIX}"
+eval "LIBPREFIX=${LIBPREFIX}"
eval "LIBSUFFIX=${LIBSUFFIX}"
eval "EXESUFFIX=${EXESUFFIX}"
@@ -114,6 +115,8 @@ AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
AC_SUBST(PATHTYPE)
+AC_SUBST(CYGPATH)
+AC_SUBST(VPSEP)
AC_SUBST(CFLAGS_DEBUG)
AC_SUBST(CFLAGS_OPTIMIZE)
AC_SUBST(CFLAGS_WARNING)
@@ -133,6 +136,7 @@ AC_SUBST(LDFLAGS_WINDOW)
AC_SUBST(AR)
AC_SUBST(RC)
AC_SUBST(DLLSUFFIX)
+AC_SUBST(LIBPREFIX)
AC_SUBST(LIBSUFFIX)
AC_SUBST(EXESUFFIX)
AC_SUBST(LIBRARIES)
diff --git a/win/tcl.m4 b/win/tcl.m4
index 315cf64..c021cbd 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -174,7 +174,10 @@ AC_DEFUN(SC_ENABLE_GCC, [
CC=gcc
AC_PROG_CC
else
- CC=cl
+ # Allow user to override
+ if test -z "$CC"; then
+ CC=cl
+ fi
fi
])
@@ -320,9 +323,13 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [
# CFLAGS_WARNING
# LDFLAGS_DEBUG
# LDFLAGS_OPTIMIZE
-# PATHTYPE
+# LDFLAGS_CONSOLE
+# LDFLAGS_WINDOW
# CC_OBJNAME
# CC_EXENAME
+# PATHTYPE
+# VPSEP
+# CYGPATH
#
# Defines the following vars for non-gcc compilers
# SHLIB_LD
@@ -334,6 +341,7 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [
# MAKE_DLL
#
# LIBSUFFIX
+# LIBPREFIX
# LIBRARIES
# EXESUFFIX
# DLLSUFFIX
@@ -342,30 +350,123 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [
AC_DEFUN(SC_CONFIG_CFLAGS, [
AC_MSG_CHECKING([compiler flags])
+
+ # Set some defaults (may get changed below)
EXTRA_CFLAGS=""
+ PATHTYPE='-w'
+ CYGPATH='cygpath'
+ VPSEP=';'
+
# set various compiler flags depending on whether we are using gcc or cl
if test "${GCC}" = "yes" ; then
+ SHLIB_LD=""
+ SHLIB_LD_LIBS=""
+ LIBS=""
+ LIBS_GUI="-lgdi32 -lcomdlg32"
+ AR="${AR-ar}"
+ STLIB_LD="${AR-ar}"
+ RC="${WINDRES-windres}"
+ MAKE_LIB="\${AR} crv \[$]@"
+ MAKE_EXE="\${CC} -o \[$]@"
+ LIBPREFIX="lib"
+
+ if "$CC" -v 2>&1 | egrep '\/gcc-lib\/i[[3-6]]86[[^\/]]*-cygwin' >/dev/null; then
+ mno_cygwin="yes"
+ extra_cflags="-mno-cygwin"
+ extra_ldflags="-mno-cygwin"
+ else
+ mno_cygwin="no"
+ extra_cflags=""
+ extra_ldflags=""
+ fi
+
+ if test "$cross_compiling" = "yes" -o "$mno_cygwin" = "yes"; then
+ PATHTYPE=''
+ CYGPATH='echo '
+ VPSEP=':'
+ fi
+
+ if test "${SHARED_BUILD}" = "0" ; then
+ # static
+ AC_MSG_RESULT([using static flags])
+ runtime=
+ MAKE_DLL="echo "
+ LIBSUFFIX="s\${DBGX}.a"
+ LIBRARIES="\${STATIC_LIBRARIES}"
+ EXESUFFIX="s\${DBGX}.exe"
+ DLLSUFFIX=""
+ else
+ # dynamic
+ AC_MSG_RESULT([using shared flags])
+
+ # check to see if ld supports --shared. Libtool does a much
+ # more extensive test, but not really needed in this case.
+ if test -z "$LD"; then
+ ld_prog="`(${CC} -print-prog-name=ld) 2>/dev/null`"
+ if test -z "$ld_prog"; then
+ ld_prog=ld
+ else
+ # get rid of the potential '\r' from ld_prog.
+ ld_prog="`(echo $ld_prog | tr -d '\015' | sed 's,\\\\,\\/,g')`"
+ fi
+ LD="$ld_prog"
+ fi
+
+ AC_MSG_CHECKING([whether $ld_prog supports -shared option])
+
+ # now the ad-hoc check to see if GNU ld supports --shared.
+ if "$LD" --shared 2>&1 | egrep ': -shared not supported' >/dev/null; then
+ ld_supports_shared="no"
+ SHLIB_LD="${DLLWRAP-dllwrap}"
+ else
+ ld_supports_shared="yes"
+ SHLIB_LD="${CC} -shared"
+ fi
+ AC_MSG_RESULT([$ld_supports_shared])
+
+ runtime=
+ # Add SHLIB_LD_LIBS to the Make rule, not here.
+ MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags}"
+ if test "${ld_supports_shared}" = "yes"; then
+ MAKE_DLL="${MAKE_DLL} -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)"
+ else
+ MAKE_DLL="${MAKE_DLL} --output-lib \$(patsubst %.dll,lib%.a,\[$]@)"
+ fi
+ LIBSUFFIX="\${DBGX}.a"
+ DLLSUFFIX="\${DBGX}.dll"
+ EXESUFFIX="\${DBGX}.exe"
+ LIBRARIES="\${SHARED_LIBRARIES}"
+ fi
+
+ EXTRA_CFLAGS="${extra_cflags}"
+
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE=-O
CFLAGS_WARNING="-Wall -Wconversion"
LDFLAGS_DEBUG=-g
LDFLAGS_OPTIMIZE=-O
- PATHTYPE=-u
-
+
# Specify the CC output file names based on the target name
CC_OBJNAME="-o \[$]@"
CC_EXENAME="-o \[$]@"
+
+ # Specify linker flags depending on the type of app being
+ # built -- Console vs. Window.
+ LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
+ LDFLAGS_WINDOW="-mwindows ${extra_ldflags}"
else
SHLIB_LD="link -dll -nologo"
SHLIB_LD_LIBS="user32.lib advapi32.lib"
LIBS="user32.lib advapi32.lib"
+ LIBS_GUI="gdi32.lib comdlg32.lib"
AR="lib -nologo"
STLIB_LD="lib -nologo"
RC="rc"
MAKE_LIB="\${AR} -out:\[$]@"
MAKE_EXE="\${CC} -Fe\[$]@"
-
+ LIBPREFIX=""
+
if test "${SHARED_BUILD}" = "0" ; then
# static
AC_MSG_RESULT([using static flags])
@@ -393,11 +494,10 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
CFLAGS_WARNING="-W3"
LDFLAGS_DEBUG="-debug:full -debugtype:cv"
LDFLAGS_OPTIMIZE="-release"
- PATHTYPE=-w
# Specify the CC output file names based on the target name
CC_OBJNAME="-Fo\[$]@"
- CC_EXENAME="-Fe\"\$(shell cygpath \$(PATHTYPE) '\[$]@')\""
+ CC_EXENAME="-Fe\"\$(shell \$(CYGPATH) \$(PATHTYPE) '\[$]@')\""
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
diff --git a/win/tclWin32Dll.c b/win/tclWin32Dll.c
index eb43771..ed4051a 100644
--- a/win/tclWin32Dll.c
+++ b/win/tclWin32Dll.c
@@ -1,15 +1,15 @@
/*
* tclWin32Dll.c --
*
- * This file contains the DLL entry point which sets up the 32-to-16-bit
- * thunking code for SynchSpawn if the library is running under Win32s.
+ * This file contains the DLL entry point.
*
* Copyright (c) 1995-1996 Sun Microsystems, Inc.
+ * Copyright (c) 1998-2000 Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWin32Dll.c,v 1.8 1999/12/09 14:44:10 hobbs Exp $
+ * RCS: @(#) $Id: tclWin32Dll.c,v 1.9 2000/03/31 08:52:30 hobbs Exp $
*/
#include "tclWinInt.h"
@@ -35,7 +35,7 @@ typedef VOID (WINAPI UTUNREGISTER)(HANDLE hModule);
*/
static HINSTANCE hInstance; /* HINSTANCE of this DLL. */
-static int platformId; /* Running under NT, 95, or Win32s? */
+static int platformId; /* Running under NT, or 95/98? */
/*
* The following function tables are used to dispatch to either the
@@ -203,86 +203,6 @@ DllMain(hInst, reason, reserved)
/*
*----------------------------------------------------------------------
*
- * TclWinSynchSpawn --
- *
- * 32-bit entry point to the 16-bit SynchSpawn code.
- *
- * Results:
- * 1 on success, 0 on failure.
- *
- * Side effects:
- * Spawns a command and waits for it to complete.
- *
- *----------------------------------------------------------------------
- */
-int
-TclWinSynchSpawn(void *args, int type, void **trans, Tcl_Pid *pidPtr)
-{
- HINSTANCE hKernel;
- UTREGISTER *utRegisterProc;
- UTUNREGISTER *utUnRegisterProc;
- UT32PROC *ut32Proc;
- char buffer[] = "TCL16xx.DLL";
- int result;
-
- hKernel = LoadLibraryA("kernel32.dll");
- if (hKernel == NULL) {
- return 0;
- }
-
- /*
- * Load the Universal Thunking routines from kernel32.dll.
- */
-
- utRegisterProc = (UTREGISTER *) GetProcAddress(hKernel, "UTRegister");
- utUnRegisterProc = (UTUNREGISTER *) GetProcAddress(hKernel, "UTUnRegister");
- if ((utRegisterProc == NULL) || (utUnRegisterProc == NULL)) {
- result = 0;
- goto done;
- }
-
- /*
- * Construct the complete name of tcl16xx.dll.
- */
-
- buffer[5] = '0' + TCL_MAJOR_VERSION;
- buffer[6] = '0' + TCL_MINOR_VERSION;
-
- /*
- * Register the Tcl thunk.
- */
-
- if ((*utRegisterProc)(hInstance, buffer, NULL, "UTProc", &ut32Proc,
- NULL, NULL) == FALSE) {
- result = 0;
- goto done;
- }
- if (ut32Proc != NULL) {
- /*
- * Invoke the thunk.
- */
-
- *pidPtr = 0;
- (*ut32Proc)(args, type, trans);
- result = 1;
- } else {
- /*
- * The 16-bit thunking DLL wasn't found. Return error code that
- * indicates this problem.
- */
-
- result = 0;
- }
- (*utUnRegisterProc)(hInstance);
-
- done:
- FreeLibrary(hKernel);
- return result;
-}
-
-/*
- *----------------------------------------------------------------------
- *
* TclWinGetTclInstance --
*
* Retrieves the global library instance handle.
@@ -313,8 +233,7 @@ TclWinGetTclInstance()
* None.
*
* Side effects:
- * Initializes the 16-bit thunking library, and the tclPlatformId
- * variable.
+ * Initializes the tclPlatformId variable.
*
*----------------------------------------------------------------------
*/
@@ -326,7 +245,7 @@ TclWinInit(hInst)
OSVERSIONINFO os;
hInstance = hInst;
- os.dwOSVersionInfoSize = sizeof(os);
+ os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&os);
platformId = os.dwPlatformId;
diff --git a/win/tclWinInit.c b/win/tclWinInit.c
index c56958a..dbf44ea 100644
--- a/win/tclWinInit.c
+++ b/win/tclWinInit.c
@@ -7,7 +7,7 @@
* Copyright (c) 1998-1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclWinInit.c,v 1.21 1999/12/09 14:44:11 hobbs Exp $
+ * RCS: @(#) $Id: tclWinInit.c,v 1.22 2000/03/31 08:52:31 hobbs Exp $
*/
#include "tclWinInt.h"
@@ -549,7 +549,7 @@ TclpSetVariables(interp)
OSVERSIONINFOA osInfo;
Tcl_DString ds;
- osInfo.dwOSVersionInfoSize = sizeof(osInfo);
+ osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
GetVersionExA(&osInfo);
oemId = (OemId *) &sysInfo;
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index 2d171b1..a40681c 100644
--- a/win/tclWinPort.h
+++ b/win/tclWinPort.h
@@ -10,7 +10,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinPort.h,v 1.11 1999/10/29 03:05:13 hobbs Exp $
+ * RCS: @(#) $Id: tclWinPort.h,v 1.12 2000/03/31 08:52:31 hobbs Exp $
*/
#ifndef _TCLWINPORT
@@ -335,12 +335,15 @@ typedef float *TCHAR;
* EDEADLK as the same value, which confuses Tcl_ErrnoId().
*/
-#ifdef _MSC_VER
+#if defined(_MSC_VER) || defined(__MINGW32__)
# define environ _environ
# define hypot _hypot
# define exception _exception
# undef EDEADLOCK
-#endif /* _MSC_VER */
+# if defined(__MINGW32__) && !defined(__MSVCRT__)
+# define timezone _timezone
+# endif
+#endif /* _MSC_VER || __MINGW32__ */
/*
*---------------------------------------------------------------------------
diff --git a/win/tclWinReg.c b/win/tclWinReg.c
index 7d296a1..e5808c2 100644
--- a/win/tclWinReg.c
+++ b/win/tclWinReg.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclWinReg.c,v 1.10 1999/10/05 22:47:05 hobbs Exp $
+ * RCS: @(#) $Id: tclWinReg.c,v 1.11 2000/03/31 08:52:32 hobbs Exp $
*/
#include <tclPort.h>
@@ -213,8 +213,6 @@ int
Registry_Init(
Tcl_Interp *interp)
{
- OSVERSIONINFO os;
-
if (!Tcl_InitStubs(interp, "8.0", 0)) {
return TCL_ERROR;
}
@@ -224,10 +222,7 @@ Registry_Init(
* appropriate registry function table.
*/
- os.dwOSVersionInfoSize = sizeof(os);
- GetVersionEx(&os);
-
- if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+ if (TclWinGetPlatformId() == VER_PLATFORM_WIN32_NT) {
regWinProcs = &unicodeProcs;
} else {
regWinProcs = &asciiProcs;