This is the mail archive of the
insight@sources.redhat.com
mailing list for the Insight project.
Re: [PATCH] libgui/tcl/tix fixes for recent Cygwin
- To: Christopher Faylor <cgf at redhat dot com>, insight at sources dot redhat dot com
- Subject: Re: [PATCH] libgui/tcl/tix fixes for recent Cygwin
- From: Syd Polk <spolk at redhat dot com>
- Date: Tue, 10 Apr 2001 11:38:06 -0700
Approved. These look good, and will enable the eventual upgrade to a newer
version of tcl to go smoother.
At 10:15 PM 4/6/01 -0400, Christopher Faylor wrote:
>The changes below are meant to accomodate recent Cygwin compiler
>changes. Cygwin now does not default to defining WIN32 defines unless
>used with the -mwin32 option. This patch adds that where appropriate.
>It also removes obsolete Cygwin usages and renames CYGWIN32 to CYGWIN.
>
>Basically, this patch attempts to bring these modules into the "modern
>age" of Cygwin.
>
>Ok to check in?
>
>cgf
>
>
>libgui/ChangeLog:
>2001-04-06 Christopher Faylor <cgf@redhat.com>
>
> * configure.in: Add test for -mwin32 requirement switch when
> building
> on cygwin.
> * configure: Regenerate.
>
>tcl/ChangeLog:
>2001-04-06 Christopher Faylor <cgf@redhat.com>
>
> Throughout change __CYGWIN32__ to __CYGWIN__.
> * cygwin/configure.in: When targeting cygwin, detect if C compiler
> supports -mno-win32 flag and use it if so.
> * cygwin/Makefile.in (EXTRA_CFLAGS): New variable. Holds results of
> -mno-win32 test.
> (COMPILE): Add EXTRA_CFLAGS variable to options.
> * generic/tclEnv.c: Throughout, only compile special Cygwin code if
> building under Cygwin and want native windows understanding.
> * win/tclWin32Dll.c (DllMain): #ifdef out CYGWIN impure_ptr stuff.
> * win/tclWinPipe.c (Tcl_WaitPid): Eliminate old Cygwin consideration
> about exit values.
>
>tix/ChangeLog:
>2001-04-06 Christopher Faylor <cgf@redhat.com>
>
> * configure.in: Add test for -mwin32 requirement switch when building
> on cygwin.
> * configure: Regenerate.
> * win/Makefile.in (EXTRA_CFLAGS): Add a place to potentially put
> -mwin32 flag.
>
>Index: libgui/configure.in
>===================================================================
>RCS file: /cvs/uberbaum/libgui/configure.in,v
>retrieving revision 1.2
>diff -u -p -r1.2 configure.in
>--- configure.in 2000/06/27 21:53:32 1.2
>+++ configure.in 2001/04/07 00:22:26
>@@ -46,7 +46,6 @@ if test "$GCC" = "yes"; then
> else
> LIBGUI_CFLAGS=
> fi
>-AC_SUBST(LIBGUI_CFLAGS)
>
> AC_CACHE_CHECK([for cygwin32], ide_cv_os_cygwin32,
> [AC_EGREP_CPP(lose, [
>@@ -102,10 +101,21 @@ CYG_AC_LOAD_ITCLCONFIG
> dnl what is the path to itclsh?
> AC_CANONICAL_HOST
> case ${host} in
>-*cygwin*) ITCL_DIR=itcl/itcl/win ;;
>+*cygwin*)
>+ ITCL_DIR=itcl/itcl/win
>+ touch ac$$.c
>+ if ${CC} -c -mwin32 ac$$.c >/dev/null 2>&1; then
>+ case "$LIBGUI_CFLAGS" in
>+ *-mwin32*) ;;
>+ *) LIBGUI_CFLAGS="-mwin32 $LIBGUI_CFLAGS" ;;
>+ esac
>+ fi
>+ rm -f ac$$.o ac$$.c
>+ ;;
> *) ITCL_DIR=itcl/itcl/unix ;;
> esac
>
>+AC_SUBST(LIBGUI_CFLAGS)
> AC_SUBST(TCL_DEFS)
> AC_SUBST(TK_DEFS)
> AC_SUBST(TCLHDIR)
>Index: tcl/ChangeLog
>===================================================================
>RCS file: /cvs/uberbaum/tcl/ChangeLog,v
>retrieving revision 1.11
>diff -u -p -r1.11 ChangeLog
>--- ChangeLog 2000/12/14 00:45:22 1.11
>+++ ChangeLog 2001/04/07 00:22:40
>@@ -1,3 +1,13 @@
>+Wed Apr 4 22:06:13 2001 Christopher Faylor <cgf@cygnus.com>
>+
>+ * cygwin/configure.in: When targeting cygwin, detect if C compiler
>+ supports -mno-win32 flag and use it if so.
>+ * cygwin/Makefile.in (EXTRA_CFLAGS): New variable. Holds results of
>+ -mno-win32 test.
>+ (COMPILE): Add EXTRA_CFLAGS variable to options.
>+ * generic/tclEnv.c: Only compile special Cygwin code if building under
>+ Cygwin and want native windows understanding.
>+
> Sat Jun 10 22:43:00 2000 Christopher Faylor <cgf@cygnus.com>
>
> * win/tclWinFile.c (TclMatchFiles): Revert Mon Jun 5 18:48:32 2000
>Index: tcl/cygwin/Makefile.in
>===================================================================
>RCS file: /cvs/uberbaum/tcl/cygwin/Makefile.in,v
>retrieving revision 1.1.1.2
>diff -u -p -r1.1.1.2 Makefile.in
>--- Makefile.in 1999/11/17 02:20:44 1.1.1.2
>+++ Makefile.in 2001/04/07 00:22:40
>@@ -112,7 +112,8 @@ tclTestObj.o tclTimer.o tclUtil.o tclVar
> tclUnixChan.o tclUnixEvent.o tclUnixFCmd.o tclUnixFile.o tclUnixNotfy.o \
> tclUnixPipe.o tclUnixSock.o tclUnixTest.o tclUnixTime.o tclUnixInit.o
> CFLAGS = @CFLAGS@
>-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)
>$(AM_CFLAGS) $(CFLAGS)
>+EXTRA_CFLAGS = @EXTRA_CFLAGS@
>+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS)
>$(AM_CFLAGS) $(CFLAGS) $(EXTRA_CFLAGS)
> CCLD = $(CC)
> LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
> DIST_COMMON = Makefile.am Makefile.in aclocal.m4 configure configure.in
>Index: tcl/cygwin/configure.in
>===================================================================
>RCS file: /cvs/uberbaum/tcl/cygwin/configure.in,v
>retrieving revision 1.1.1.3
>diff -u -p -r1.1.1.3 configure.in
>--- configure.in 2000/01/18 00:05:13 1.1.1.3
>+++ configure.in 2001/04/07 00:22:40
>@@ -47,8 +47,23 @@ fi
> ])
>
> LIB_AC_PROG_CC
>+
>+case "${target}" in
>+*-*-cygwin*)
>+ touch ac$$.c
>+ if ${CC} -c -mno-win32 ac$$.c >/dev/null 2>&1; then
>+ case "$EXTRA_CFLAGS" in
>+ *-mno-win32*) ;;
>+ *) EXTRA_CFLAGS="-mno-win32 $EXTRA_CFLAGS" ;;
>+ esac
>+ fi
>+ rm -f ac$$.o ac$$.c
>+ ;;
>+esac
>+
> AC_CHECK_TOOL(AR, ar, ar)
> AC_SUBST(AR)
>+AC_SUBST(EXTRA_CFLAGS)
> AC_PROG_RANLIB
> AC_PROG_INSTALL
>
>Index: tcl/generic/tclAlloc.c
>===================================================================
>RCS file: /cvs/uberbaum/tcl/generic/tclAlloc.c,v
>retrieving revision 1.1.1.1
>diff -u -p -r1.1.1.1 tclAlloc.c
>--- tclAlloc.c 1999/11/09 01:28:43 1.1.1.1
>+++ tclAlloc.c 2001/04/07 00:22:40
>@@ -26,7 +26,7 @@
> # define RCHECK
> #endif
>
>-#ifndef __CYGWIN32__
>+#ifndef __CYGWIN__
> typedef unsigned long caddr_t;
> #endif
>
>Index: tcl/generic/tclEnv.c
>===================================================================
>RCS file: /cvs/uberbaum/tcl/generic/tclEnv.c,v
>retrieving revision 1.1.1.2
>diff -u -p -r1.1.1.2 tclEnv.c
>--- tclEnv.c 2000/02/01 03:15:26 1.1.1.2
>+++ tclEnv.c 2001/04/07 00:22:40
>@@ -19,9 +19,9 @@
> #include "tclPort.h"
>
> /* CYGNUS LOCAL */
>-#ifdef __CYGWIN32__
>+#if defined(__CYGWIN__) && defined(__WIN32__)
>
>-/* On cygwin32, the environment is imported from the cygwin32 DLL. */
>+/* Under cygwin, the environment is imported from the cygwin DLL. */
>
> extern char ***_imp____cygwin_environ;
>
>@@ -83,7 +83,7 @@ void TclSetEnv _ANSI_ARGS_((CONST char
> void TclUnsetEnv _ANSI_ARGS_((CONST char *name));
>
> /* CYGNUS LOCAL */
>-#ifdef __CYGWIN32__
>+#if defined (__CYGWIN__) && defined(__WIN32__)
> static void TclCygwin32Putenv _ANSI_ARGS_((CONST char *string));
> #endif
>
>@@ -745,12 +745,12 @@ TclFinalizeEnvironment()
> }
>
> /* CYGNUS LOCAL */
>-#ifdef __CYGWIN32__
>+#if defined(__CYGWIN__) && defined(__WIN32__)
>
> #include "windows.h"
>
>-/* When using cygwin32, when an environment variable changes, we need
>- to synch with both the cygwin32 environment (in case the
>+/* 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). */
>@@ -777,7 +777,7 @@ TclCygwin32Putenv(str)
> if (*value == '\0')
> value = NULL;
>
>- /* Set the cygwin32 environment variable. */
>+ /* Set the cygwin environment variable. */
> #undef putenv
> if (value == NULL)
> unsetenv (name);
>@@ -816,14 +816,14 @@ TclCygwin32Putenv(str)
> {
> int size;
>
>- size = cygwin32_posix_to_win32_path_list_buf_size (value);
>+ size = cygwin_posix_to_win32_path_list_buf_size (value);
> buf = (char *) alloca (size + 1);
>- cygwin32_posix_to_win32_path_list (value, buf);
>+ cygwin_posix_to_win32_path_list (value, buf);
> }
>
> SetEnvironmentVariable (name, buf);
> }
> }
>
>-#endif /* __CYGWIN32__ */
>+#endif /* __CYGWIN__ */
> /* END CYGNUS LOCAL */
>Index: tcl/win/tclWin32Dll.c
>===================================================================
>RCS file: /cvs/uberbaum/tcl/win/tclWin32Dll.c,v
>retrieving revision 1.1.1.2
>diff -u -p -r1.1.1.2 tclWin32Dll.c
>--- tclWin32Dll.c 2000/02/01 03:15:29 1.1.1.2
>+++ tclWin32Dll.c 2001/04/07 00:22:40
>@@ -58,8 +58,8 @@ BOOL APIENTRY DllMain _ANSI_ARGS_((HINS
> #ifndef STATIC_BUILD
>
> /* CYGNUS LOCAL */
>-#ifdef __CYGWIN32__
>-/* cygwin32 requires an impure pointer variable, which must be
>+#ifdef __CYGWIN__0
>+/* CYGWIN requires an impure pointer variable, which must be
> explicitly initialized when the DLL starts up. */
> struct _reent *_impure_ptr;
> extern struct _reent *_imp__reent_data;
>@@ -119,8 +119,8 @@ DllMain(hInst, reason, reserved)
> OSVERSIONINFO os;
>
> /* CYGNUS LOCAL */
>-#ifdef __CYGWIN32__
>- /* cygwin32 requires the impure data pointer to be initialized
>+#ifdef __CYGWIN__0
>+ /* Cygwin requires the impure data pointer to be initialized
> when the DLL starts up. */
> _impure_ptr = _imp__reent_data;
> #endif
>Index: tcl/win/tclWinFile.c
>===================================================================
>RCS file: /cvs/uberbaum/tcl/win/tclWinFile.c,v
>retrieving revision 1.3
>diff -u -p -r1.3 tclWinFile.c
>--- tclWinFile.c 2000/06/11 02:45:14 1.3
>+++ tclWinFile.c 2001/04/07 00:22:41
>@@ -16,7 +16,7 @@
>
> #include "tclWinInt.h"
> #include <sys/stat.h>
>-#ifndef __CYGWIN32__
>+#ifndef __WIN32__
> #include <shlobj.h>
> #endif
>
>@@ -363,9 +363,9 @@ TclChdir(interp, dirName)
> ckfree(currentDir);
> currentDir = NULL;
> }
>- /* CYGNUS LOCAL: On cygwin32, we must use chdir. Otherwise, the
>- cygwin32 notion of the current directory will get messed up. */
>-#ifdef __CYGWIN32__
>+ /* CYGNUS LOCAL: On cygwin, we must use chdir. Otherwise, the
>+ cygwin notion of the current directory will get messed up. */
>+#ifdef __CYGWIN__
> if (chdir(dirName) < 0) {
> #else
> if (!SetCurrentDirectory(dirName)) {
>@@ -567,7 +567,7 @@ TclpStat(path, buf)
>
> result = stat(path, buf);
>
>-#if ! defined (_MSC_VER) && ! defined (__CYGWIN32__)
>+#if ! defined (_MSC_VER) && ! defined (__CYGWIN__)
>
> /*
> * Borland's stat doesn't take into account localtime.
>Index: tcl/win/tclWinPipe.c
>===================================================================
>RCS file: /cvs/uberbaum/tcl/win/tclWinPipe.c,v
>retrieving revision 1.1.1.1
>diff -u -p -r1.1.1.1 tclWinPipe.c
>--- tclWinPipe.c 1999/11/09 01:28:44 1.1.1.1
>+++ tclWinPipe.c 2001/04/07 00:22:41
>@@ -15,7 +15,7 @@
> #include "tclWinInt.h"
>
> /* CYGNUS LOCAL */
>-#ifndef __CYGWIN32__
>+#ifndef __CYGWIN__
> #include <dos.h>
> #endif
> /* END CYGNUS LOCAL */
>@@ -2639,8 +2639,8 @@ Tcl_WaitPid(pid, statPtr, options)
> }
> } else if (ret != WAIT_FAILED) {
> GetExitCodeProcess(infoPtr->hProcess, (DWORD*)statPtr);
>-#ifdef __CYGWIN32__
>- /* A cygwin32 program that exits because of a signal will set
>+#ifdef __OLD_CYGWIN__
>+ /* A cygwin program that exits because of a signal will set
> the exit status to 0x10000 | (sig << 8). Fix that back
> into a standard Unix wait status. */
> if ((*statPtr & 0x10000) != 0
>Index: tcl/win/tclWinPort.h
>===================================================================
>RCS file: /cvs/uberbaum/tcl/win/tclWinPort.h,v
>retrieving revision 1.1.1.1
>diff -u -p -r1.1.1.1 tclWinPort.h
>--- tclWinPort.h 1999/11/09 01:28:44 1.1.1.1
>+++ tclWinPort.h 2001/04/07 00:22:41
>@@ -66,10 +66,10 @@
> * use by tclAlloc.c.
> */
>
>-/* On cygwin32, we just use the supplied malloc and free, rather than
>+/* On cygwin, we just use the supplied malloc and free, rather than
> using tclAlloc.c. The cygwin32 malloc is derived from the same
> sources as tclAlloc.c, anyhow. */
>-#ifdef __CYGWIN32__
>+#ifdef __CYGWIN__
> #define TclpAlloc(size) malloc(size)
> #define TclpFree(ptr) free(ptr)
> #define TclpRealloc(ptr, size) realloc(ptr, size)
>Index: tix/win/Makefile.in
>===================================================================
>RCS file: /cvs/uberbaum/tix/win/Makefile.in,v
>retrieving revision 1.2
>diff -u -p -r1.2 Makefile.in
>--- Makefile.in 2000/06/08 03:26:03 1.2
>+++ Makefile.in 2001/04/07 00:22:41
>@@ -14,6 +14,8 @@ host_alias=@host_alias@
>
> CC = @CC@
> CFLAGS = @CFLAGS@
>+EXTRA_CFLAGS = @EXTRA_CFLAGS@
>+TIX_CFLAGS = $(CFLAGS) $(EXTRA_CFLAGS)
> NM = @NM@
> AS = @AS@
> LD = @LD@
>@@ -387,10 +389,10 @@ endif
> #
>
> $(TMPDIR)/testMain.$(OBJEXT): $(ROOT)/win/tixWinMain.c
>- $(CC) -c $(TK_INCLUDES) -DSTATIC_BUILD -DTK_TEST $(CFLAGS) -o $@ $?
>+ $(CC) -c $(TK_INCLUDES) -DSTATIC_BUILD -DTK_TEST $(TIX_CFLAGS) -o
>$@ $?
>
> $(TMPDIR)/tixWinMain.$(OBJEXT): $(ROOT)/win/tixWinMain.c
>- $(CC) -c $(TK_INCLUDES) -DSTATIC_BUILD $(CFLAGS) -o $@ $?
>+ $(CC) -c $(TK_INCLUDES) -DSTATIC_BUILD $(TIX_CFLAGS) -o $@ $?
>
> ifeq ($(OBJEXT),o)
>
>@@ -408,10 +410,10 @@ endif
> #
>
> .c.$(OBJEXT):
>- $(CC) -c $(CFLAGS) -DDLL_BUILD -DBUILD_tix $(TK_INCLUDES) -c -o $@ $<
>+ $(CC) -c $(TIX_CFLAGS) -DDLL_BUILD -DBUILD_tix $(TK_INCLUDES) -c
>-o $@ $<
>
> $(TMPDIR)/%.$(OBJEXT): %.c
>- $(CC) -c $(CFLAGS) -DDLL_BUILD -DBUILD_tix $(TK_INCLUDES) -c -o $@ $<
>+ $(CC) -c $(TIX_CFLAGS) -DDLL_BUILD -DBUILD_tix $(TK_INCLUDES) -c
>-o $@ $<
>
> clean:
> rm -f $(TMPDIR)/*.$(OBJEXT) $(TMPDIR)/*.exp $(TMPDIR)/*.def
>Index: tix/win/configure.in
>===================================================================
>RCS file: /cvs/uberbaum/tix/win/configure.in,v
>retrieving revision 1.1.1.1
>diff -u -p -r1.1.1.1 configure.in
>--- configure.in 2000/02/07 00:19:29 1.1.1.1
>+++ configure.in 2001/04/07 00:22:42
>@@ -56,6 +56,19 @@ else
> TIX_BUILD_LOCATION="`pwd`\\tcl${TCL_VERSION}"
> fi
>
>+case "${host}" in
>+*-*-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
>+ fi
>+ rm -f ac$$.o ac$$.c
>+ ;;
>+esac
>+AC_SUBST(EXTRA_CFLAGS)
>
> AC_SUBST(TIX_BUILD_LIB_SPEC)
> AC_SUBST(TIX_LIB_FILE)
Syd Polk spolk@redhat.com
Engineering Manager +1 408 543 9430
Red Hat, Inc.