summaryrefslogtreecommitdiffstats
path: root/win/tcl.m4
diff options
context:
space:
mode:
Diffstat (limited to 'win/tcl.m4')
-rw-r--r--win/tcl.m4204
1 files changed, 109 insertions, 95 deletions
diff --git a/win/tcl.m4 b/win/tcl.m4
index 47b7bd9..d1d526f 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -135,10 +135,10 @@ AC_DEFUN(SC_LOAD_TCLCONFIG, [
#------------------------------------------------------------------------
AC_DEFUN(SC_LOAD_TKCONFIG, [
- AC_MSG_CHECKING([for existence of $TCLCONFIG])
+ AC_MSG_CHECKING([for existence of $TK_BIN_DIR/tkConfig.sh])
if test -f "$TK_BIN_DIR/tkConfig.sh" ; then
- AC_MSG_CHECKING([loading $TK_BIN_DIR/tkConfig.sh])
+ AC_MSG_RESULT([loading])
. $TK_BIN_DIR/tkConfig.sh
else
AC_MSG_RESULT([could not find $TK_BIN_DIR/tkConfig.sh])
@@ -278,6 +278,7 @@ AC_DEFUN(SC_ENABLE_THREADS, [
TCL_THREADS=0
AC_MSG_RESULT([no (default)])
fi
+ AC_SUBST(TCL_THREADS)
])
#------------------------------------------------------------------------
@@ -288,7 +289,7 @@ AC_DEFUN(SC_ENABLE_THREADS, [
# Arguments:
# none
#
-# Requires the following vars to be set:
+# Requires the following vars to be set in the Makefile:
# CFLAGS_DEBUG
# CFLAGS_OPTIMIZE
#
@@ -298,33 +299,26 @@ AC_DEFUN(SC_ENABLE_THREADS, [
# --enable-symbols
#
# Defines the following vars:
-# CFLAGS_DEFAULT Sets to CFLAGS_DEBUG if true
-# Sets to CFLAGS_OPTIMIZE if false
-# LDFLAGS_DEFAULT Sets to LDFLAGS_DEBUG if true
-# Sets to LDFLAGS_OPTIMIZE if false
+# CFLAGS_DEFAULT Sets to $(CFLAGS_DEBUG) if true
+# Sets to $(CFLAGS_OPTIMIZE) if false
+# LDFLAGS_DEFAULT Sets to $(LDFLAGS_DEBUG) if true
+# Sets to $(LDFLAGS_OPTIMIZE) if false
# DBGX Debug library extension
#
#------------------------------------------------------------------------
AC_DEFUN(SC_ENABLE_SYMBOLS, [
-
- # Step 0: Enable 64 bit support?
-
- AC_MSG_CHECKING([if 64bit support is requested])
- AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no])
- AC_MSG_RESULT($do64bit)
-
AC_MSG_CHECKING([for build with symbols])
AC_ARG_ENABLE(symbols, [ --enable-symbols build with debugging symbols [--disable-symbols]], [tcl_ok=$enableval], [tcl_ok=no])
if test "$tcl_ok" = "yes"; then
- CFLAGS_DEFAULT="${CFLAGS_DEBUG}"
- LDFLAGS_DEFAULT="${LDFLAGS_DEBUG}"
+ CFLAGS_DEFAULT='$(CFLAGS_DEBUG)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_DEBUG)'
DBGX=d
AC_MSG_RESULT([yes])
else
- CFLAGS_DEFAULT="${CFLAGS_OPTIMIZE}"
- LDFLAGS_DEFAULT="${LDFLAGS_OPTIMIZE}"
+ CFLAGS_DEFAULT='$(CFLAGS_OPTIMIZE)'
+ LDFLAGS_DEFAULT='$(LDFLAGS_OPTIMIZE)'
DBGX=""
AC_MSG_RESULT([no])
fi
@@ -357,9 +351,8 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [
# LDFLAGS_WINDOW
# CC_OBJNAME
# CC_EXENAME
-# PATHTYPE
-# VPSEP
# CYGPATH
+# STLIB_LD
# SHLIB_LD
# SHLIB_LD_LIBS
# LIBS
@@ -380,16 +373,27 @@ AC_DEFUN(SC_ENABLE_SYMBOLS, [
#--------------------------------------------------------------------
AC_DEFUN(SC_CONFIG_CFLAGS, [
- AC_MSG_CHECKING([compiler flags])
+
+ # Step 0: Enable 64 bit support?
+
+ AC_MSG_CHECKING([if 64bit support is requested])
+ AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no])
+ AC_MSG_RESULT($do64bit)
# Set some defaults (may get changed below)
EXTRA_CFLAGS=""
- PATHTYPE='-w'
- CYGPATH='cygpath'
- VPSEP=';'
+
+ AC_CHECK_PROG(CYGPATH, cygpath, cygpath -w, echo)
+
+ if test "$CYGPATH" = "echo" || test "$ac_cv_cygwin" = "yes"; then
+ DEPARG='"$<"'
+ else
+ DEPARG='"$(shell $(CYGPATH) $<)"'
+ fi
# set various compiler flags depending on whether we are using gcc or cl
+ AC_MSG_CHECKING([compiler flags])
if test "${GCC}" = "yes" ; then
if test "$do64bit" = "yes" ; then
AC_MSG_WARN("64bit mode not supported with GCC on Windows")
@@ -397,33 +401,26 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
SHLIB_LD=""
SHLIB_LD_LIBS=""
LIBS=""
- LIBS_GUI="-lgdi32 -lcomdlg32"
- STLIB_LD="${AR}"
+ LIBS_GUI="-lgdi32 -lcomdlg32 -limm32"
+ STLIB_LD='${AR} cr'
RC_OUT=-o
RC_TYPE=
RC_INCLUDE=--include
+ RC_DEFINE=--define
RES=res.o
- MAKE_LIB="\${AR} crv \[$]@"
+ MAKE_LIB="\${STLIB_LD} \[$]@"
POST_MAKE_LIB="\${RANLIB} \[$]@"
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"
+ if test "$ac_cv_cygwin" = "yes"; then
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])
@@ -436,39 +433,21 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
# 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"
+ # ad-hoc check to see if CC supports -shared.
+ if "${CC}" -shared 2>&1 | egrep ': -shared not supported' >/dev/null; then
+ AC_MSG_ERROR([${CC} does not support the -shared option.
+ You will need to upgrade to a newer version of the toolchain.])
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=
+ # Link with gcc since ld does not link to default libs like
+ # -luser32 and -lmsvcrt by default. Make sure CFLAGS is
+ # included so -mno-cygwin passed the correct libs to the linker.
+ SHLIB_LD='${CC} -shared ${CFLAGS}'
# 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
+ MAKE_DLL="\${SHLIB_LD} \$(LDFLAGS) -o \[$]@ ${extra_ldflags} \
+ -Wl,--out-implib,\$(patsubst %.dll,lib%.a,\[$]@)"
+
LIBSUFFIX="\${DBGX}.a"
EXESUFFIX="\${DBGX}.exe"
LIBRARIES="\${SHARED_LIBRARIES}"
@@ -482,8 +461,8 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE=-O
CFLAGS_WARNING="-Wall -Wconversion"
- LDFLAGS_DEBUG=-g
- LDFLAGS_OPTIMIZE=-O
+ LDFLAGS_DEBUG=
+ LDFLAGS_OPTIMIZE=
# Specify the CC output file names based on the target name
CC_OBJNAME="-o \[$]@"
@@ -491,25 +470,16 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
+ #
+ # 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.
LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
- LDFLAGS_WINDOW="-mwindows ${extra_ldflags}"
+ LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}"
else
- SHLIB_LD="link -dll -nologo -incremental:no -link50compat"
- 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"
- RC_OUT=-fo
- RC_TYPE=-r
- RC_INCLUDE=-i
- RES=res
- MAKE_LIB="\${AR} -out:\[$]@"
- POST_MAKE_LIB=
- MAKE_EXE="\${CC} -Fe\[$]@"
- LIBPREFIX=""
-
if test "${SHARED_BUILD}" = "0" ; then
# static
AC_MSG_RESULT([using static flags])
@@ -532,26 +502,70 @@ AC_DEFUN(SC_CONFIG_CFLAGS, [
# users of tclConfig.sh that may build shared or static.
DLLSUFFIX="\${DBGX}.dll"
+ # This is a 2-stage check to make sure we have the 64-bit SDK
+ # We have to know where the SDK is installed.
+ if test "$do64bit" = "yes" ; then
+ if test "x${MSSDK}x" = "xx" ; then
+ MSSDK="C:/Progra~1/Microsoft SDK"
+ fi
+ # In order to work in the tortured autoconf environment,
+ # we need to ensure that this path has no spaces
+ MSSDK=$(cygpath -w -s "$MSSDK" | sed -e 's!\\!/!g')
+ if test ! -d "${MSSDK}/bin/win64" ; then
+ AC_MSG_WARN("could not find 64-bit SDK to enable 64bit mode")
+ do64bit="no"
+ fi
+ fi
+
+ if test "$do64bit" = "yes" ; then
+ # All this magic is necessary for the Win64 SDK RC1 - hobbs
+ CC="${MSSDK}/Bin/Win64/cl.exe \
+ -I${MSSDK}/Include/prerelease \
+ -I${MSSDK}/Include/Win64/crt \
+ -I${MSSDK}/Include/Win64/crt/sys \
+ -I${MSSDK}/Include"
+ RC="${MSSDK}/bin/rc.exe"
+ CFLAGS_DEBUG="-nologo -Zi -Od ${runtime}d"
+ CFLAGS_OPTIMIZE="-nologo -O2 -Gs ${runtime}"
+ lflags="-MACHINE:IA64 -LIBPATH:${MSSDK}/Lib/IA64 \
+ -LIBPATH:${MSSDK}/Lib/Prerelease/IA64"
+ STLIB_LD="${MSSDK}/bin/win64/lib.exe -nologo ${lflags}"
+ LINKBIN="${MSSDK}/bin/win64/link.exe ${lflags}"
+ else
+ RC="rc"
+ CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
+ CFLAGS_OPTIMIZE="-nologo -Oti -Gs -GD ${runtime}"
+ STLIB_LD="lib -nologo"
+ LINKBIN="link -link50compat"
+ fi
+
+ SHLIB_LD="${LINKBIN} -dll -nologo -incremental:no"
+ SHLIB_LD_LIBS="user32.lib advapi32.lib"
+ LIBS="user32.lib advapi32.lib"
+ LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib"
+ RC_OUT=-fo
+ RC_TYPE=-r
+ RC_INCLUDE=-i
+ RC_DEFINE=-d
+ RES=res
+ MAKE_LIB="\${STLIB_LD} -out:\[$]@"
+ POST_MAKE_LIB=
+ MAKE_EXE="\${CC} -Fe\[$]@"
+ LIBPREFIX=""
+
EXTRA_CFLAGS="-YX"
- CFLAGS_DEBUG="-nologo -Z7 -Od -WX ${runtime}d"
-# CFLAGS_OPTIMIZE="-nologo -O2 -Gs -GD ${runtime}"
- CFLAGS_OPTIMIZE="-nologo -Oti -Gs -GD ${runtime}"
CFLAGS_WARNING="-W3"
LDFLAGS_DEBUG="-debug:full -debugtype:cv"
LDFLAGS_OPTIMIZE="-release"
-
+
# 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) '\[$]@')\""
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
- LDFLAGS_CONSOLE="-link -subsystem:console"
- LDFLAGS_WINDOW="-link -subsystem:windows"
-
- if test "$do64bit" = "yes" ; then
- EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_TCLALLOC=0"
- fi
+ LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
+ LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
fi
])