diff options
author | hobbs <hobbs> | 2002-09-27 00:48:06 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2002-09-27 00:48:06 (GMT) |
commit | eb33d6b2e1af56f6f898c2c4343cea19e0e251c7 (patch) | |
tree | ac500753c542a0bf349fde96c932ce0bbe716471 /win | |
parent | 0dad9658b522536e5883baac0e78eba1fa910103 (diff) | |
download | tk-eb33d6b2e1af56f6f898c2c4343cea19e0e251c7.zip tk-eb33d6b2e1af56f6f898c2c4343cea19e0e251c7.tar.gz tk-eb33d6b2e1af56f6f898c2c4343cea19e0e251c7.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: Regenerate.
* win/tkWinPort.h (tchar.h): Do not include on Cygwin.
(_T): Define for Cygwin.
* win/winMain.c (main): Conditionally define.
Diffstat (limited to 'win')
-rwxr-xr-x | win/configure | 65 | ||||
-rw-r--r-- | win/tcl.m4 | 41 | ||||
-rw-r--r-- | win/tkWinPort.h | 8 | ||||
-rw-r--r-- | win/winMain.c | 5 |
4 files changed, 88 insertions, 31 deletions
diff --git a/win/configure b/win/configure index 6ecdf3b..deff7e3 100755 --- a/win/configure +++ b/win/configure @@ -1198,12 +1198,30 @@ echo "configure:1182: 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 @@ -1256,14 +1274,19 @@ echo "configure:1182: 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 @@ -1365,7 +1388,7 @@ echo "configure:1182: checking compiler flags" >&5 #-------------------------------------------------------------------- echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1369: checking how to run the C preprocessor" >&5 +echo "configure:1392: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1380,13 +1403,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 1384 "configure" +#line 1407 "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:1390: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1413: \"$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 : @@ -1397,13 +1420,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 1401 "configure" +#line 1424 "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:1407: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1430: \"$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 : @@ -1414,13 +1437,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext <<EOF -#line 1418 "configure" +#line 1441 "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:1424: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1447: \"$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 : @@ -1446,17 +1469,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:1450: checking for errno.h" >&5 +echo "configure:1473: 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 1455 "configure" +#line 1478 "configure" #include "confdefs.h" #include <errno.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1483: \"$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* @@ -1488,7 +1511,7 @@ fi echo $ac_n "checking for build with symbols""... $ac_c" 1>&6 -echo "configure:1492: checking for build with symbols" >&5 +echo "configure:1515: 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" @@ -1519,12 +1542,14 @@ TK_DBGX=${DBGX} echo $ac_n "checking the location of tclConfig.sh""... $ac_c" 1>&6 -echo "configure:1523: checking the location of tclConfig.sh" >&5 +echo "configure:1546: checking the location of tclConfig.sh" >&5 if test -d ../../tcl8.4$TK_PATCH_LEVEL/win; then TCL_BIN_DIR_DEFAULT=../../tcl8.4$TK_PATCH_LEVEL/win - else + elif test -d ../../tcl8.4/win; then TCL_BIN_DIR_DEFAULT=../../tcl8.4/win + else + TCL_BIN_DIR_DEFAULT=../../tcl/win fi # Check whether --with-tcl or --without-tcl was given. @@ -1545,7 +1570,7 @@ fi echo $ac_n "checking for existence of $TCL_BIN_DIR/tclConfig.sh""... $ac_c" 1>&6 -echo "configure:1549: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 +echo "configure:1574: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 if test -f "$TCL_BIN_DIR/tclConfig.sh" ; then echo "$ac_t""loading" 1>&6 @@ -1596,7 +1621,7 @@ echo "configure:1549: checking for existence of $TCL_BIN_DIR/tclConfig.sh" >&5 echo $ac_n "checking for tclsh""... $ac_c" 1>&6 -echo "configure:1600: checking for tclsh" >&5 +echo "configure:1625: checking for tclsh" >&5 if eval "test \"`echo '$''{'ac_cv_path_tclsh'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -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], @@ -388,12 +392,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 @@ -446,14 +468,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 diff --git a/win/tkWinPort.h b/win/tkWinPort.h index 9b327a5..192ed84 100644 --- a/win/tkWinPort.h +++ b/win/tkWinPort.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: tkWinPort.h,v 1.7 1999/11/19 22:00:19 hobbs Exp $ + * RCS: @(#) $Id: tkWinPort.h,v 1.8 2002/09/27 00:48:06 hobbs Exp $ */ #ifndef _WINPORT @@ -42,7 +42,11 @@ #endif #include <time.h> -#include <tchar.h> +#ifdef __CYGWIN__ +# define _T(x) L##x +#else +# include <tchar.h> +#endif #ifdef _MSC_VER # define hypot _hypot diff --git a/win/winMain.c b/win/winMain.c index a5478a9..1c4e465 100644 --- a/win/winMain.c +++ b/win/winMain.c @@ -9,7 +9,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: winMain.c,v 1.12 2002/08/26 14:32:18 dgp Exp $ + * RCS: @(#) $Id: winMain.c,v 1.13 2002/09/27 00:48:06 hobbs Exp $ */ #include <tk.h> @@ -354,8 +354,8 @@ setargv(argcPtr, argvPtr) *argcPtr = argc; *argvPtr = argv; } - +#if !defined(__GNUC__) || defined(TK_TEST) /* *---------------------------------------------------------------------- * @@ -404,4 +404,5 @@ int main(int argc, char **argv) Tk_Main(argc, argv, Tcl_AppInit); return 0; } +#endif /* !__GNUC__ || TK_TEST */ |