summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormdejong <mdejong>2003-01-13 07:01:04 (GMT)
committermdejong <mdejong>2003-01-13 07:01:04 (GMT)
commitb697c7922f1ca98c8c68a6a8c1e7f738a4a8667f (patch)
treeecc693efc09e654dadea6aa7a3df8c882e5b75ae
parent6638ab2cc75d41465a5191828f2c9acbab86af6b (diff)
downloadtcl-b697c7922f1ca98c8c68a6a8c1e7f738a4a8667f.zip
tcl-b697c7922f1ca98c8c68a6a8c1e7f738a4a8667f.tar.gz
tcl-b697c7922f1ca98c8c68a6a8c1e7f738a4a8667f.tar.bz2
* generic/tcl.h: Skip Tcl's define of CHAR,
SHORT, and LONG when HAVE_WINNT_IGNORE_VOID is defined. This avoids a bunch of compiler warnings when building with Cygwin or Mingw. * win/configure: Regen. * win/configure.in: Define HAVE_WINNT_IGNORE_VOID when we detect a winnt.h that still defines CHAR, SHORT, and LONG when VOID has already been defined. * win/tcl.m4 (SC_LOAD_TCLCONFIG): Subst the TCL_DEFS loaded from tclConfig.sh so that Tcl defines can make it into the Tk Makefile.
-rw-r--r--ChangeLog15
-rw-r--r--generic/tcl.h9
-rwxr-xr-xwin/configure97
-rw-r--r--win/configure.in27
-rw-r--r--win/tcl.m45
5 files changed, 122 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 355644b..639730e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,20 @@
2003-01-12 Mo DeJong <mdejong@users.sourceforge.net>
+ * generic/tcl.h: Skip Tcl's define of CHAR,
+ SHORT, and LONG when HAVE_WINNT_IGNORE_VOID
+ is defined. This avoids a bunch of compiler
+ warnings when building with Cygwin or Mingw.
+ * win/configure: Regen.
+ * win/configure.in: Define HAVE_WINNT_IGNORE_VOID
+ when we detect a winnt.h that still defines
+ CHAR, SHORT, and LONG when VOID has already
+ been defined.
+ * win/tcl.m4 (SC_LOAD_TCLCONFIG): Subst the
+ TCL_DEFS loaded from tclConfig.sh so that
+ Tcl defines can make it into the Tk Makefile.
+
+2003-01-12 Mo DeJong <mdejong@users.sourceforge.net>
+
* win/configure: Regen.
* win/configure.in: Check for typedefs like LPFN_ACCEPT
in winsock2.h and define HAVE_NO_LPFN_DECLS if not found.
diff --git a/generic/tcl.h b/generic/tcl.h
index d84a23f..b89bb59 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.148 2002/11/12 02:24:51 hobbs Exp $
+ * RCS: @(#) $Id: tcl.h,v 1.149 2003/01/13 07:01:06 mdejong Exp $
*/
#ifndef _TCL
@@ -287,15 +287,18 @@ extern "C" {
* The following code is copied from winnt.h.
* If we don't replicate it here, then <windows.h> can't be included
* after tcl.h, since tcl.h also defines VOID.
+ * This block is skipped under Cygwin and Mingw.
+ *
+ *
*/
-#ifdef __WIN32__
+#if defined(__WIN32__) && !defined(HAVE_WINNT_IGNORE_VOID)
#ifndef VOID
#define VOID void
typedef char CHAR;
typedef short SHORT;
typedef long LONG;
#endif
-#endif /* __WIN32__ */
+#endif /* __WIN32__ && !HAVE_WINNT_IGNORE_VOID */
/*
* Macro to use instead of "void" for arguments that must have
diff --git a/win/configure b/win/configure
index fc5a72a..68d2e1e 100755
--- a/win/configure
+++ b/win/configure
@@ -1120,18 +1120,65 @@ 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:1129: 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 1134 "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:1150: \"$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
+
#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
#--------------------------------------------------------------------
echo $ac_n "checking for object suffix""... $ac_c" 1>&6
-echo "configure:1129: checking for object suffix" >&5
+echo "configure:1176: 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:1135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1182: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
for ac_file in conftest.*; do
case $ac_file in
*.c) ;;
@@ -1149,19 +1196,19 @@ OBJEXT=$ac_cv_objext
ac_objext=$ac_cv_objext
echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6
-echo "configure:1153: checking for mingw32 environment" >&5
+echo "configure:1200: 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 1158 "configure"
+#line 1205 "configure"
#include "confdefs.h"
int main() {
return __MINGW32__;
; return 0; }
EOF
-if { (eval echo configure:1165: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1212: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_mingw32=yes
else
@@ -1180,7 +1227,7 @@ test "$ac_cv_mingw32" = yes && MINGW32=yes
echo $ac_n "checking for executable suffix""... $ac_c" 1>&6
-echo "configure:1184: checking for executable suffix" >&5
+echo "configure:1231: checking for executable suffix" >&5
if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1190,7 +1237,7 @@ else
rm -f conftest*
echo 'int main () { return 0; }' > conftest.$ac_ext
ac_cv_exeext=
- if { (eval echo configure:1194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
+ if { (eval echo configure:1241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then
for file in conftest.*; do
case $file in
*.c | *.o | *.obj) ;;
@@ -1217,7 +1264,7 @@ ac_exeext=$EXEEXT
echo $ac_n "checking for building with threads""... $ac_c" 1>&6
-echo "configure:1221: checking for building with threads" >&5
+echo "configure:1268: 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"
@@ -1254,7 +1301,7 @@ EOF
echo $ac_n "checking how to build libraries""... $ac_c" 1>&6
-echo "configure:1258: checking how to build libraries" >&5
+echo "configure:1305: 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"
@@ -1295,7 +1342,7 @@ EOF
# Step 0: Enable 64 bit support?
echo $ac_n "checking if 64bit support is requested""... $ac_c" 1>&6
-echo "configure:1299: checking if 64bit support is requested" >&5
+echo "configure:1346: 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"
@@ -1312,7 +1359,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:1316: checking for $ac_word" >&5
+echo "configure:1363: 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
@@ -1354,9 +1401,9 @@ fi
echo "END" >> $conftest
echo $ac_n "checking for Windows native path bug in windres""... $ac_c" 1>&6
-echo "configure:1358: checking for Windows native path bug in windres" >&5
+echo "configure:1405: 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:1360: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then
+ if { ac_try='$RC -o conftest.res.o $cyg_conftest'; { (eval echo configure:1407: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } ; then
echo "$ac_t""no" 1>&6
else
echo "$ac_t""yes" 1>&6
@@ -1375,7 +1422,7 @@ echo "configure:1358: 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:1379: checking compiler flags" >&5
+echo "configure:1426: 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
@@ -1588,7 +1635,7 @@ echo "configure:1379: checking compiler flags" >&5
echo $ac_n "checking for build with symbols""... $ac_c" 1>&6
-echo "configure:1592: checking for build with symbols" >&5
+echo "configure:1639: 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"
@@ -1648,7 +1695,7 @@ TCL_DBGX=${DBGX}
#--------------------------------------------------------------------
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1652: checking how to run the C preprocessor" >&5
+echo "configure:1699: checking how to run the C preprocessor" >&5
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
@@ -1663,13 +1710,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 1667 "configure"
+#line 1714 "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:1673: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1720: \"$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
:
@@ -1680,13 +1727,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1684 "configure"
+#line 1731 "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:1690: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1737: \"$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
:
@@ -1697,13 +1744,13 @@ else
rm -rf conftest*
CPP="${CC-cc} -nologo -E"
cat > conftest.$ac_ext <<EOF
-#line 1701 "configure"
+#line 1748 "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:1707: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1754: \"$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
:
@@ -1729,17 +1776,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:1733: checking for errno.h" >&5
+echo "configure:1780: 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 1738 "configure"
+#line 1785 "configure"
#include "confdefs.h"
#include <errno.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1790: \"$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 9dfaebe..b641255 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.61 2003/01/13 01:27:51 mdejong Exp $
+# RCS: @(#) $Id: configure.in,v 1.62 2003/01/13 07:01:06 mdejong Exp $
AC_INIT(../generic/tcl.h)
AC_PREREQ(2.13)
@@ -169,6 +169,31 @@ if test "$tcl_cv_lpfn_decls" = "no" ; then
[Defined when cygwin/mingw does not support LPFN_ACCEPT and friends.])
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
+
#--------------------------------------------------------------------
# Determines the correct binary file extension (.o, .obj, .exe etc.)
#--------------------------------------------------------------------
diff --git a/win/tcl.m4 b/win/tcl.m4
index be3ec6b..66b3b7b 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -83,8 +83,7 @@ AC_DEFUN(SC_PATH_TKCONFIG, [
#------------------------------------------------------------------------
# SC_LOAD_TCLCONFIG --
#
-# Load the tclConfig.sh file
-# Currently a no-op for Windows
+# Load the tclConfig.sh file.
#
# Arguments:
#
@@ -148,6 +147,8 @@ AC_DEFUN(SC_LOAD_TCLCONFIG, [
AC_SUBST(TCL_STUB_LIB_FILE)
AC_SUBST(TCL_STUB_LIB_FLAG)
AC_SUBST(TCL_STUB_LIB_SPEC)
+
+ AC_SUBST(TCL_DEFS)
])
#------------------------------------------------------------------------