summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhobbs <hobbs>2002-09-27 00:50:10 (GMT)
committerhobbs <hobbs>2002-09-27 00:50:10 (GMT)
commitb96b459a4907a164acb205a2b024c2c8419ea496 (patch)
tree7ecd449f330b92357eb4737a43574667df864290
parent4985043c6ed39477bf0abc04fe017cccfd090f62 (diff)
downloadtcl-b96b459a4907a164acb205a2b024c2c8419ea496.zip
tcl-b96b459a4907a164acb205a2b024c2c8419ea496.tar.gz
tcl-b96b459a4907a164acb205a2b024c2c8419ea496.tar.bz2
2002-09-18 Mumit Khan <khan@nanotech.wisc.edu>
Added basic Cygwin support. * win/tcl.m4 (SC_PATH_TCLCONFIG): Support one-tree build. (SC_PATH_TKCONFIG): Likewise. (SC_PROG_TCLSH): Likewise. (SC_CONFIG_CFLAGS): Assume real Cygwin port and remove -mno-cygwin flags. Add -mwin32 to extra_cflags and extra_ldflags. Remove ``-e _WinMain@16'' from LDFLAGS_WINDOW. * win/configure.in: Allow Cygwin build. (SEH test): Define to be 1 instead of empty value. (EXCEPTION_DISPOSITION): Add test. * win/configure: Regenerate. * generic/tcl.h: Don't explicitly define __WIN32__ for Cygwin, let the user decide whether to use Windows or POSIX personality. (TCL_WIDE_INT_TYPE, TCL_LL_MODIFIER, struct Tcl_StatBuf): Define for Cygwin. * generic/tclEnv.c (Tcl_CygwinPutenv): putenv replacement for Cygwin. * generic/tclFileName.c (Tcl_TranslateFileName): Convert POSIX to native format. (TclDoGlob): Likewise. * generic/tclPlatDecls.h (TCHAR): Define for Cygwin. * win/tclWinPort.h (putenv, TclpSysAlloc, TclpSysFree, TclpSysRealloc): Define for Cygwin.
-rw-r--r--ChangeLog31
-rw-r--r--generic/tcl.h11
-rw-r--r--generic/tclEnv.c86
-rw-r--r--generic/tclFileName.c40
-rw-r--r--generic/tclPlatDecls.h6
-rwxr-xr-xwin/configure137
-rw-r--r--win/configure.in36
-rw-r--r--win/tcl.m448
-rw-r--r--win/tclWinPort.h17
9 files changed, 352 insertions, 60 deletions
diff --git a/ChangeLog b/ChangeLog
index 08cde2b..1742f45 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,42 @@
2002-09-26 Jeff Hobbs <jeffh@ActiveState.com>
+ * unix/ldAix (nmopts): add -X32_64 to make it work for 32 or 64bit
+ mode compilation.
+
* library/encoding/koi8-u.enc: removed extraneous spaces that
confused encoding reader. [Bug #615115]
* unix/Makefile.in: generate source dists with -src designator and
do not generate .Z anymore (just .gz and .zip).
+2002-09-18 Mumit Khan <khan@nanotech.wisc.edu>
+
+ Added basic Cygwin support.
+
+ * win/tcl.m4 (SC_PATH_TCLCONFIG): Support one-tree build.
+ (SC_PATH_TKCONFIG): Likewise.
+ (SC_PROG_TCLSH): Likewise.
+ (SC_CONFIG_CFLAGS): Assume real Cygwin port and remove -mno-cygwin
+ flags. Add -mwin32 to extra_cflags and extra_ldflags.
+ Remove ``-e _WinMain@16'' from LDFLAGS_WINDOW.
+ * win/configure.in: Allow Cygwin build.
+ (SEH test): Define to be 1 instead of empty value.
+ (EXCEPTION_DISPOSITION): Add test.
+ * win/configure: Regenerate.
+
+ * generic/tcl.h: Don't explicitly define __WIN32__ for Cygwin, let
+ the user decide whether to use Windows or POSIX personality.
+ (TCL_WIDE_INT_TYPE, TCL_LL_MODIFIER, struct Tcl_StatBuf): Define
+ for Cygwin.
+ * generic/tclEnv.c (Tcl_CygwinPutenv): putenv replacement for
+ Cygwin.
+ * generic/tclFileName.c (Tcl_TranslateFileName): Convert POSIX
+ to native format.
+ (TclDoGlob): Likewise.
+ * generic/tclPlatDecls.h (TCHAR): Define for Cygwin.
+ * win/tclWinPort.h (putenv, TclpSysAlloc, TclpSysFree,
+ TclpSysRealloc): Define for Cygwin.
+
2002-09-26 Daniel Steffen <das@users.sourceforge.net>
* macosx/Makefile: preserve environment value of INSTALL_ROOT.
diff --git a/generic/tcl.h b/generic/tcl.h
index f16d84a..dcd14a0 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -13,7 +13,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tcl.h,v 1.143 2002/09/12 17:33:20 das Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.144 2002/09/27 00:50:10 hobbs Exp $
*/
#ifndef _TCL
@@ -68,7 +68,7 @@ extern "C" {
*/
#ifndef __WIN32__
-# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__)
+# if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || defined(__BORLANDC__)
# define __WIN32__
# ifndef WIN32
# define WIN32
@@ -351,7 +351,12 @@ typedef long LONG;
*/
#if !defined(TCL_WIDE_INT_TYPE)&&!defined(TCL_WIDE_INT_IS_LONG)
-# ifdef __WIN32__
+# ifdef __CYGWIN__
+# define TCL_WIDE_INT_TYPE long long
+# define TCL_LL_MODIFIER "L"
+typedef struct stat Tcl_StatBuf;
+# define TCL_LL_MODIFIER_SIZE 1
+# elif defined(__WIN32__)
# define TCL_WIDE_INT_TYPE __int64
# ifdef __BORLANDC__
typedef struct stati64 Tcl_StatBuf;
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 75f5eab..3702ff4 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -12,7 +12,7 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclEnv.c,v 1.17 2002/08/28 22:48:10 davygrvy Exp $
+ * RCS: @(#) $Id: tclEnv.c,v 1.18 2002/09/27 00:50:10 hobbs Exp $
*/
#include "tclInt.h"
@@ -54,6 +54,9 @@ void TclSetEnv _ANSI_ARGS_((CONST char *name,
CONST char *value));
void TclUnsetEnv _ANSI_ARGS_((CONST char *name));
+#if defined (__CYGWIN__) && defined(__WIN32__)
+static void TclCygwinPutenv _ANSI_ARGS_((CONST char *string));
+#endif
/*
*----------------------------------------------------------------------
@@ -699,3 +702,84 @@ TclFinalizeEnvironment()
#endif
}
}
+
+#if defined(__CYGWIN__) && defined(__WIN32__)
+
+#include <windows.h>
+
+/*
+ * When using cygwin, when an environment variable changes, we need to synch
+ * with both the cygwin environment (in case the application C code calls
+ * fork) and the Windows environment (in case the application TCL code calls
+ * exec, which calls the Windows CreateProcess function).
+ */
+
+static void
+TclCygwinPutenv(str)
+ const char *str;
+{
+ char *name, *value;
+
+ /* Get the name and value, so that we can change the environment
+ variable for Windows. */
+ name = (char *) alloca (strlen (str) + 1);
+ strcpy (name, str);
+ for (value = name; *value != '=' && *value != '\0'; ++value)
+ ;
+ if (*value == '\0') {
+ /* Can't happen. */
+ return;
+ }
+ *value = '\0';
+ ++value;
+ if (*value == '\0') {
+ value = NULL;
+ }
+
+ /* Set the cygwin environment variable. */
+#undef putenv
+ if (value == NULL) {
+ unsetenv (name);
+ } else {
+ putenv(str);
+ }
+
+ /*
+ * Before changing the environment variable in Windows, if this is PATH,
+ * we need to convert the value back to a Windows style path.
+ *
+ * FIXME: The calling program may know it is running under windows, and
+ * may have set the path to a Windows path, or, worse, appended or
+ * prepended a Windows path to PATH.
+ */
+ if (strcmp (name, "PATH") != 0) {
+ /* If this is Path, eliminate any PATH variable, to prevent any
+ confusion. */
+ if (strcmp (name, "Path") == 0) {
+ SetEnvironmentVariable ("PATH", (char *) NULL);
+ unsetenv ("PATH");
+ }
+
+ SetEnvironmentVariable (name, value);
+ } else {
+ char *buf;
+
+ /* Eliminate any Path variable, to prevent any confusion. */
+ SetEnvironmentVariable ("Path", (char *) NULL);
+ unsetenv ("Path");
+
+ if (value == NULL) {
+ buf = NULL;
+ } else {
+ int size;
+
+ size = cygwin_posix_to_win32_path_list_buf_size (value);
+ buf = (char *) alloca (size + 1);
+ cygwin_posix_to_win32_path_list (value, buf);
+ }
+
+ SetEnvironmentVariable (name, buf);
+ }
+}
+
+#endif /* __CYGWIN__ && __WIN32__ */
diff --git a/generic/tclFileName.c b/generic/tclFileName.c
index f5e7970..e3ec128 100644
--- a/generic/tclFileName.c
+++ b/generic/tclFileName.c
@@ -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: tclFileName.c,v 1.37 2002/06/05 11:59:33 das Exp $
+ * RCS: @(#) $Id: tclFileName.c,v 1.38 2002/09/27 00:50:10 hobbs Exp $
*/
#include "tclInt.h"
@@ -1356,12 +1356,31 @@ Tcl_TranslateFileName(interp, name, bufferPtr)
*/
if (tclPlatform == TCL_PLATFORM_WINDOWS) {
+#if defined(__CYGWIN__) && defined(__WIN32__)
+
+ extern int cygwin_conv_to_win32_path
+ _ANSI_ARGS_((CONST char *, char *));
+ char winbuf[MAX_PATH];
+
+ /*
+ * In the Cygwin world, call conv_to_win32_path in order to use the
+ * mount table to translate the file name into something Windows will
+ * understand. Take care when converting empty strings!
+ */
+ if (Tcl_DStringLength(bufferPtr)) {
+ cygwin_conv_to_win32_path(Tcl_DStringValue(bufferPtr), winbuf);
+ Tcl_DStringFree(bufferPtr);
+ Tcl_DStringAppend(bufferPtr, winbuf, -1);
+ }
+#else /* __CYGWIN__ && __WIN32__ */
+
register char *p;
for (p = Tcl_DStringValue(bufferPtr); *p != '\0'; p++) {
if (*p == '/') {
*p = '\\';
}
}
+#endif /* __CYGWIN__ && __WIN32__ */
}
return Tcl_DStringValue(bufferPtr);
}
@@ -2317,6 +2336,25 @@ TclDoGlob(interp, separators, headPtr, tail, types)
* element. Add an extra slash if this is a UNC path.
*/
+#if defined(__CYGWIN__) && defined(__WIN32__)
+ {
+
+ extern int cygwin_conv_to_win32_path
+ _ANSI_ARGS_((CONST char *, char *));
+ char winbuf[MAX_PATH];
+
+ /*
+ * In the Cygwin world, call conv_to_win32_path in order to use
+ * the mount table to translate the file name into something
+ * Windows will understand.
+ */
+ cygwin_conv_to_win32_path(Tcl_DStringValue(headPtr), winbuf);
+ Tcl_DStringFree(headPtr);
+ Tcl_DStringAppend(headPtr, winbuf, -1);
+
+ }
+#endif /* __CYGWIN__ && __WIN32__ */
+
if (*name == ':') {
Tcl_DStringAppend(headPtr, ":", 1);
if (count > 1) {
diff --git a/generic/tclPlatDecls.h b/generic/tclPlatDecls.h
index e0fed76..3404542 100644
--- a/generic/tclPlatDecls.h
+++ b/generic/tclPlatDecls.h
@@ -6,7 +6,7 @@
* Copyright (c) 1998-1999 by Scriptics Corporation.
* All rights reserved.
*
- * RCS: @(#) $Id: tclPlatDecls.h,v 1.17 2002/08/31 06:09:45 das Exp $
+ * RCS: @(#) $Id: tclPlatDecls.h,v 1.18 2002/09/27 00:50:10 hobbs Exp $
*/
#ifndef _TCLPLATDECLS
@@ -15,7 +15,9 @@
/*
* Pull in the typedef of TCHAR for windows.
*/
-#if defined(__WIN32__) && !defined(_TCHAR_DEFINED)
+#if defined(__CYGWIN__)
+ typedef char TCHAR;
+#elif defined(__WIN32__) && !defined(_TCHAR_DEFINED)
# include <tchar.h>
# ifndef _TCHAR_DEFINED
/* Borland seems to forget to set this. */
diff --git a/win/configure b/win/configure
index e1d7735..99c5018 100755
--- a/win/configure
+++ b/win/configure
@@ -964,10 +964,10 @@ echo "$ac_t""$ac_cv_cygwin" 1>&6
CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes
-if test "$ac_cv_cygwin" = "yes" ; then
- { echo "configure: error: Compiling with the Cygwin version of gcc is not supported.
- Use the Mingw version of gcc from www.mingw.org instead." 1>&2; exit 1; }
-fi
+#if test "$ac_cv_cygwin" = "yes" ; then
+# AC_MSG_ERROR([Compiling with the Cygwin version of gcc is not supported.
+# Use the Mingw version of gcc from www.mingw.org instead.])
+#fi
echo $ac_n "checking for SEH support in compiler""... $ac_c" 1>&6
@@ -1016,7 +1016,53 @@ fi
echo "$ac_t""$tcl_cv_seh" 1>&6
if test "$tcl_cv_seh" = "no" ; then
cat >> confdefs.h <<\EOF
-#define HAVE_NO_SEH
+#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:1032: 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 1037 "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:1050: \"$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
@@ -1026,13 +1072,13 @@ fi
#--------------------------------------------------------------------
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1030: checking for object suffix" >&5
+echo "configure:1076: 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:1036: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1050,19 +1096,19 @@ OBJEXT=$ac_cv_objext
ac_objext=$ac_cv_objext
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1054: checking for mingw32 environment" >&5
+echo "configure:1100: 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 1059 "configure"
+#line 1105 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:1066: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1112: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -1081,7 +1127,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1085: checking for executable suffix" >&5
+echo "configure:1131: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1091,7 +1137,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1095: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -1118,7 +1164,7 @@ ac_exeext=$EXEEXT
echo $ac_n "checking for building with threads""... $ac_c" 1>&6
-echo "configure:1122: checking for building with threads" >&5
+echo "configure:1168: 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"
@@ -1149,7 +1195,7 @@ EOF
echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
-echo "configure:1153: checking how to build libraries" >&5
+echo "configure:1199: 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"
@@ -1190,7 +1236,7 @@ EOF
# Step 0: Enable 64 bit support?
echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
-echo "configure:1194: checking if 64bit support is requested" >&5
+echo "configure:1240: 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"
@@ -1207,7 +1253,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:1211: checking for $ac_word" >&5
+echo "configure:1257: 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
@@ -1244,7 +1290,7 @@ fi
# 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:1248: checking compiler flags" >&5
+echo "configure:1294: checking compiler flags" >&5
if test "${GCC}" = "yes" ; then
if test "$do64bit" = "yes" ; then
echo "configure: warning: "64bit mode not supported with GCC on Windows"" 1>&2
@@ -1264,12 +1310,30 @@ echo "configure:1248: checking compiler flags" >&5
MAKE_EXE="\${CC} -o \$@"
LIBPREFIX="lib"
+ #if test "$ac_cv_cygwin" = "yes"; then
+ # extra_cflags="-mno-cygwin"
+ # extra_ldflags="-mno-cygwin"
+ #else
+ # extra_cflags=""
+ # extra_ldflags=""
+ #fi
+
if test "$ac_cv_cygwin" = "yes"; then
- extra_cflags="-mno-cygwin"
- extra_ldflags="-mno-cygwin"
+ touch ac$$.c
+ if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then
+ case "$extra_cflags" in
+ *-mwin32*) ;;
+ *) extra_cflags="-mwin32 $extra_cflags" ;;
+ esac
+ case "$extra_ldflags" in
+ *-mwin32*) ;;
+ *) extra_ldflags="-mwin32 $extra_ldflags" ;;
+ esac
+ fi
+ rm -f ac$$.o ac$$.c
else
- extra_cflags=""
- extra_ldflags=""
+ extra_cflags=''
+ extra_ldflags=''
fi
if test "${SHARED_BUILD}" = "0" ; then
@@ -1322,14 +1386,19 @@ echo "configure:1248: checking compiler flags" >&5
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
#
+ # ORIGINAL COMMENT:
# We need to pass -e _WinMain@16 so that ld will use
# WinMain() instead of main() as the entry point. We can't
# use autoconf to check for this case since it would need
# to run an executable and that does not work when
# cross compiling. Remove this -e workaround once we
# require a gcc that does not have this bug.
+ #
+ # MK NOTE: Tk should use a different mechanism. This causes
+ # interesting problems, such as wish dying at startup.
+ #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}"
LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
- LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}"
+ LDFLAGS_WINDOW="-mwindows ${extra_ldflags}"
else
if test "${SHARED_BUILD}" = "0" ; then
# static
@@ -1434,7 +1503,7 @@ echo "configure:1248: checking compiler flags" >&5
echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:1438: checking for build with symbols" >&5
+echo "configure:1507: 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"
@@ -1458,7 +1527,7 @@ fi
echo $ac_n "checking for build with memory debugging""... $ac_c" 1>&6
-echo "configure:1462: checking for build with memory debugging" >&5
+echo "configure:1531: checking for build with memory debugging" >&5
# Check whether --enable-memdebug or --disable-memdebug was given.
if test "${enable_memdebug+set}" = set; then
enableval="$enable_memdebug"
@@ -1484,7 +1553,7 @@ TCL_DBGX=${DBGX}
#--------------------------------------------------------------------
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1488: checking how to run the C preprocessor" >&5
+echo "configure:1557: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1499,13 +1568,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 1503 "configure"
+#line 1572 "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:1509: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1578: \"$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
:
@@ -1516,13 +1585,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1520 "configure"
+#line 1589 "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:1526: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1595: \"$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
:
@@ -1533,13 +1602,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1537 "configure"
+#line 1606 "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:1543: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1612: \"$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
:
@@ -1565,17 +1634,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:1569: checking for errno.h" >&5
+echo "configure:1638: 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 1574 "configure"
+#line 1643 "configure"
#include "confdefs.h"
#include <errno.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1579: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1648: \"$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 0d6afab..a3becef 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -3,7 +3,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.54 2002/09/02 20:11:06 hobbs Exp $
+# RCS: @(#) $Id: configure.in,v 1.55 2002/09/27 00:50:10 hobbs Exp $
AC_INIT(../generic/tcl.h)
AC_PREREQ(2.13)
@@ -79,10 +79,10 @@ AC_PROG_MAKE_SET
AC_CYGWIN
-if test "$ac_cv_cygwin" = "yes" ; then
- AC_MSG_ERROR([Compiling with the Cygwin version of gcc is not supported.
- Use the Mingw version of gcc from www.mingw.org instead.])
-fi
+#if test "$ac_cv_cygwin" = "yes" ; then
+# AC_MSG_ERROR([Compiling with the Cygwin version of gcc is not supported.
+# Use the Mingw version of gcc from www.mingw.org instead.])
+#fi
AC_CACHE_CHECK(for SEH support in compiler,
@@ -108,10 +108,34 @@ int main(int argc, char** argv) {
tcl_cv_seh=no)
)
if test "$tcl_cv_seh" = "no" ; then
- AC_DEFINE(HAVE_NO_SEH,,
+ 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
+
#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
#--------------------------------------------------------------------
diff --git a/win/tcl.m4 b/win/tcl.m4
index 71ce0a9..0f79dae 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -22,8 +22,10 @@ AC_DEFUN(SC_PATH_TCLCONFIG, [
if test -d ../../tcl8.4$1/win; then
TCL_BIN_DIR_DEFAULT=../../tcl8.4$1/win
- else
+ elif test -d ../../tcl8.4/win; then
TCL_BIN_DIR_DEFAULT=../../tcl8.4/win
+ else
+ TCL_BIN_DIR_DEFAULT=../../tcl/win
fi
AC_ARG_WITH(tcl, [ --with-tcl=DIR use Tcl 8.4 binaries from DIR],
@@ -60,8 +62,10 @@ AC_DEFUN(SC_PATH_TKCONFIG, [
if test -d ../../tk8.4$1/win; then
TK_BIN_DIR_DEFAULT=../../tk8.4$1/win
- else
+ elif test -d ../../tk8.4/win; then
TK_BIN_DIR_DEFAULT=../../tk8.4/win
+ else
+ TK_BIN_DIR_DEFAULT=../../tk/win
fi
AC_ARG_WITH(tk, [ --with-tk=DIR use Tk 8.4 binaries from DIR],
@@ -424,12 +428,30 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
MAKE_EXE="\${CC} -o \[$]@"
LIBPREFIX="lib"
+ #if test "$ac_cv_cygwin" = "yes"; then
+ # extra_cflags="-mno-cygwin"
+ # extra_ldflags="-mno-cygwin"
+ #else
+ # extra_cflags=""
+ # extra_ldflags=""
+ #fi
+
if test "$ac_cv_cygwin" = "yes"; then
- extra_cflags="-mno-cygwin"
- extra_ldflags="-mno-cygwin"
+ touch ac$$.c
+ if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then
+ case "$extra_cflags" in
+ *-mwin32*) ;;
+ *) extra_cflags="-mwin32 $extra_cflags" ;;
+ esac
+ case "$extra_ldflags" in
+ *-mwin32*) ;;
+ *) extra_ldflags="-mwin32 $extra_ldflags" ;;
+ esac
+ fi
+ rm -f ac$$.o ac$$.c
else
- extra_cflags=""
- extra_ldflags=""
+ extra_cflags=''
+ extra_ldflags=''
fi
if test "${SHARED_BUILD}" = "0" ; then
@@ -482,14 +504,19 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
#
+ # ORIGINAL COMMENT:
# We need to pass -e _WinMain@16 so that ld will use
# WinMain() instead of main() as the entry point. We can't
# use autoconf to check for this case since it would need
# to run an executable and that does not work when
# cross compiling. Remove this -e workaround once we
# require a gcc that does not have this bug.
+ #
+ # MK NOTE: Tk should use a different mechanism. This causes
+ # interesting problems, such as wish dying at startup.
+ #LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}"
LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
- LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}"
+ LDFLAGS_WINDOW="-mwindows ${extra_ldflags}"
else
if test "${SHARED_BUILD}" = "0" ; then
# static
@@ -663,7 +690,12 @@ AC_DEFUN(SC_PROG_TCLSH, [
])
if test -f "$ac_cv_path_tclsh" ; then
- TCLSH_PROG=$ac_cv_path_tclsh
+ TCLSH_PROG="$ac_cv_path_tclsh"
+ AC_MSG_RESULT($TCLSH_PROG)
+ elif test -f "$TCL_BIN_DIR/tclConfig.sh" ; then
+ # One-tree build.
+ ac_cv_path_tclsh="$TCL_BIN_DIR/tclsh"
+ TCLSH_PROG="$ac_cv_path_tclsh"
AC_MSG_RESULT($TCLSH_PROG)
else
AC_MSG_ERROR(No tclsh found in PATH: $search_path)
diff --git a/win/tclWinPort.h b/win/tclWinPort.h
index a616f22..011a061 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.33 2002/08/28 22:48:48 davygrvy Exp $
+ * RCS: @(#) $Id: tclWinPort.h,v 1.34 2002/09/27 00:50:10 hobbs Exp $
*/
#ifndef _TCLWINPORT
@@ -380,9 +380,10 @@
#endif /* __BORLANDC__ */
#ifdef __CYGWIN__
-/* On cygwin32, the environment is imported from the cygwin32 DLL. */
+/* On Cygwin, the environment is imported from the Cygwin DLL. */
DLLIMPORT extern char **__cygwin_environ;
# define environ __cygwin_environ
+# define putenv TclCygwinPutenv
# define timezone _timezone
#endif /* __CYGWIN__ */
@@ -433,12 +434,18 @@
* use by tclAlloc.c.
*/
-#define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \
+#ifdef __CYGWIN__
+# define TclpSysAlloc(size, isBin) malloc((size))
+# define TclpSysFree(ptr) free((ptr))
+# define TclpSysRealloc(ptr, size) realloc((ptr), (size))
+#else
+# define TclpSysAlloc(size, isBin) ((void*)HeapAlloc(GetProcessHeap(), \
(DWORD)0, (DWORD)size))
-#define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \
+# define TclpSysFree(ptr) (HeapFree(GetProcessHeap(), \
(DWORD)0, (HGLOBAL)ptr))
-#define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \
+# define TclpSysRealloc(ptr, size) ((void*)HeapReAlloc(GetProcessHeap(), \
(DWORD)0, (LPVOID)ptr, (DWORD)size))
+#endif
/*
* The following defines map from standard socket names to our internal