summaryrefslogtreecommitdiffstats
path: root/win/tcl.m4
diff options
context:
space:
mode:
Diffstat (limited to 'win/tcl.m4')
-rw-r--r--win/tcl.m4200
1 files changed, 178 insertions, 22 deletions
diff --git a/win/tcl.m4 b/win/tcl.m4
index ffc6588..7fe2ae3 100644
--- a/win/tcl.m4
+++ b/win/tcl.m4
@@ -137,7 +137,6 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
eval "TCL_STUB_LIB_SPEC=\"${TCL_STUB_LIB_SPEC}\""
AC_SUBST(TCL_VERSION)
- AC_SUBST(TCL_PATCH_LEVEL)
AC_SUBST(TCL_BIN_DIR)
AC_SUBST(TCL_SRC_DIR)
@@ -371,6 +370,7 @@ AC_DEFUN([SC_ENABLE_SYMBOLS], [
# MAKE_DLL
#
# LIBSUFFIX
+# LIBFLAGSUFFIX
# LIBPREFIX
# LIBRARIES
# EXESUFFIX
@@ -383,9 +383,20 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# 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 = amd64|ia64)], [do64bit=$enableval], [do64bit=no])
+ AC_ARG_ENABLE(64bit,[ --enable-64bit enable 64bit support (where applicable)], [do64bit=$enableval], [do64bit=no])
AC_MSG_RESULT($do64bit)
+ # Cross-compiling options for Windows/CE builds
+
+ AC_MSG_CHECKING([if Windows/CE build is requested])
+ AC_ARG_ENABLE(wince,[ --enable-wince enable Win/CE support (where applicable)], [doWince=$enableval], [doWince=no])
+ AC_MSG_RESULT($doWince)
+
+ AC_MSG_CHECKING([for Windows/CE celib directory])
+ AC_ARG_WITH(celib,[ --with-celib=DIR use Windows/CE support library from DIR],
+ CELIB_DIR=$withval, CELIB_DIR=NO_CELIB)
+ AC_MSG_RESULT([$CELIB_DIR])
+
# Set some defaults (may get changed below)
EXTRA_CFLAGS=""
@@ -432,9 +443,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
AC_MSG_CHECKING([compiler flags])
if test "${GCC}" = "yes" ; then
- if test "$do64bit" != "no" ; then
- AC_MSG_WARN("64bit mode not supported with GCC on Windows")
- fi
SHLIB_LD=""
SHLIB_LD_LIBS=""
LIBS=""
@@ -450,13 +458,8 @@ 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
+ extra_cflags="-pipe"
+ extra_ldflags="-pipe"
if test "$ac_cv_cygwin" = "yes"; then
touch ac$$.c
@@ -471,9 +474,6 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
esac
fi
rm -f ac$$.o ac$$.c
- else
- extra_cflags=''
- extra_ldflags=''
fi
if test "${SHARED_BUILD}" = "0" ; then
@@ -543,6 +543,17 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
#LDFLAGS_WINDOW="-mwindows -e _WinMain@16 ${extra_ldflags}"
LDFLAGS_CONSOLE="-mconsole ${extra_ldflags}"
LDFLAGS_WINDOW="-mwindows ${extra_ldflags}"
+
+ case "$do64bit" in
+ amd64|x64|yes)
+ MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
+ AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
+ ;;
+ ia64)
+ MACHINE="IA64"
+ AC_MSG_RESULT([ Using 64-bit $MACHINE mode])
+ ;;
+ esac
else
if test "${SHARED_BUILD}" = "0" ; then
# static
@@ -581,7 +592,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
PATH64=""
case "$do64bit" in
amd64|x64|yes)
- MACHINE="AMD64" ; # default to AMD64 64-bit build
+ MACHINE="AMD64" ; # assume AMD64 as default 64-bit build
PATH64="${MSSDK}/Bin/Win64/x86/AMD64"
;;
ia64)
@@ -598,9 +609,11 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
fi
fi
+ LIBS="user32.lib advapi32.lib"
if test "$do64bit" != "no" ; then
# The space-based-path will work for the Makefile, but will
- # not work if AC_TRY_COMPILE is called.
+ # not work if AC_TRY_COMPILE is called. TEA has the
+ # TEA_PATH_NOSPACE to avoid this issue.
CC="\"${PATH64}/cl.exe\" -I\"${MSSDK}/Include\" \
-I\"${MSSDK}/Include/crt\" -I\"${MSSDK}/Include/crt/sys\""
RC="\"${MSSDK}/bin/rc.exe\""
@@ -611,7 +624,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
LINKBIN="\"${PATH64}/link.exe\""
# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
- LIBS="user32.lib advapi32.lib bufferoverflowU.lib"
+ LIBS="$LIBS bufferoverflowU.lib"
else
RC="rc"
# -Od - no optimization
@@ -621,10 +634,101 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
CFLAGS_OPTIMIZE="-nologo -O2 ${runtime}"
lflags="-nologo"
LINKBIN="link"
- LIBS="user32.lib advapi32.lib"
fi
- LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib"
+ if test "$doWince" != "no" ; then
+ # Set defaults for common evc4/PPC2003 setup
+ # Currently Tcl requires 300+, possibly 420+ for sockets
+ CEVERSION=420; # could be 211 300 301 400 420 ...
+ TARGETCPU=ARMV4; # could be ARMV4 ARM MIPS SH3 X86 ...
+ ARCH=ARM; # could be ARM MIPS X86EM ...
+ PLATFORM="Pocket PC 2003"; # or "Pocket PC 2002"
+ if test "$doWince" != "yes"; then
+ # If !yes then the user specified something
+ # Reset ARCH to allow user to skip specifying it
+ ARCH=
+ eval `echo $doWince | awk -F "," '{ \
+ if (length([$]1)) { printf "CEVERSION=\"%s\"\n", [$]1; \
+ if ([$]1 < 400) { printf "PLATFORM=\"Pocket PC 2002\"\n" } }; \
+ if (length([$]2)) { printf "TARGETCPU=\"%s\"\n", toupper([$]2) }; \
+ if (length([$]3)) { printf "ARCH=\"%s\"\n", toupper([$]3) }; \
+ if (length([$]4)) { printf "PLATFORM=\"%s\"\n", [$]4 }; \
+ }'`
+ if test "x${ARCH}" = "x" ; then
+ ARCH=$TARGETCPU;
+ fi
+ fi
+ OSVERSION=WCE$CEVERSION;
+ if test "x${WCEROOT}" = "x" ; then
+ WCEROOT="C:/Program Files/Microsoft eMbedded C++ 4.0"
+ if test ! -d "${WCEROOT}" ; then
+ WCEROOT="C:/Program Files/Microsoft eMbedded Tools"
+ fi
+ fi
+ if test "x${SDKROOT}" = "x" ; then
+ SDKROOT="C:/Program Files/Windows CE Tools"
+ if test ! -d "${SDKROOT}" ; then
+ SDKROOT="C:/Windows CE Tools"
+ fi
+ fi
+ # The space-based-path will work for the Makefile, but will
+ # not work if AC_TRY_COMPILE is called.
+ WCEROOT=`echo "$WCEROOT" | sed -e 's!\\\!/!g'`
+ SDKROOT=`echo "$SDKROOT" | sed -e 's!\\\!/!g'`
+ CELIB_DIR=`echo "$CELIB_DIR" | sed -e 's!\\\!/!g'`
+ if test ! -d "${CELIB_DIR}/inc"; then
+ AC_MSG_ERROR([Invalid celib directory "${CELIB_DIR}"])
+ fi
+ if test ! -d "${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"\
+ -o ! -d "${WCEROOT}/EVC/${OSVERSION}/bin"; then
+ AC_MSG_ERROR([could not find PocketPC SDK or target compiler to enable WinCE mode [$CEVERSION,$TARGETCPU,$ARCH,$PLATFORM]])
+ else
+ CEINCLUDE="${SDKROOT}/${OSVERSION}/${PLATFORM}/include"
+ if test -d "${CEINCLUDE}/${TARGETCPU}" ; then
+ CEINCLUDE="${CEINCLUDE}/${TARGETCPU}"
+ fi
+ CELIBPATH="${SDKROOT}/${OSVERSION}/${PLATFORM}/Lib/${TARGETCPU}"
+ fi
+ fi
+
+ if test "$doWince" != "no" ; then
+ CEBINROOT="${WCEROOT}/EVC/${OSVERSION}/bin"
+ if test "${TARGETCPU}" = "X86"; then
+ CC="${CEBINROOT}/cl.exe"
+ else
+ CC="${CEBINROOT}/cl${ARCH}.exe"
+ fi
+ CC="\"${CC}\" -I\"${CELIB_DIR}/inc\" -I\"${CEINCLUDE}\""
+ RC="\"${WCEROOT}/Common/EVC/bin/rc.exe\""
+ arch=`echo ${ARCH} | awk '{print tolower([$]0)}'`
+ defs="${ARCH} _${ARCH}_ ${arch} PALM_SIZE _MT _DLL _WINDOWS"
+ for i in $defs ; do
+ AC_DEFINE_UNQUOTED($i)
+ done
+# if test "${ARCH}" = "X86EM"; then
+# AC_DEFINE_UNQUOTED(_WIN32_WCE_EMULATION)
+# fi
+ AC_DEFINE_UNQUOTED(_WIN32_WCE, $CEVERSION)
+ AC_DEFINE_UNQUOTED(UNDER_CE, $CEVERSION)
+ CFLAGS_DEBUG="-nologo -Zi -Od"
+ CFLAGS_OPTIMIZE="-nologo -O2"
+ lversion=`echo ${CEVERSION} | sed -e 's/\(.\)\(..\)/\1\.\2/'`
+ lflags="-nodefaultlib -MACHINE:${ARCH} -LIBPATH:\"${CELIBPATH}\" -subsystem:windowsce,${lversion} -nologo"
+ LINKBIN="\"${CEBINROOT}/link.exe\""
+ AC_SUBST(CELIB_DIR)
+ if test "${CEVERSION}" -lt 400 ; then
+ LIBS="coredll.lib corelibc.lib winsock.lib"
+ else
+ LIBS="coredll.lib corelibc.lib ws2.lib"
+ fi
+ # celib currently stuck at wce300 status
+ #LIBS="$LIBS \${CELIB_DIR}/wince-${ARCH}-pocket-${OSVERSION}-release/celib.lib"
+ LIBS="$LIBS \"\${CELIB_DIR}/wince-${ARCH}-pocket-wce300-release/celib.lib\""
+ LIBS_GUI="commctrl.lib commdlg.lib"
+ else
+ LIBS_GUI="gdi32.lib comdlg32.lib imm32.lib comctl32.lib shell32.lib"
+ fi
+
SHLIB_LD="${LINKBIN} -dll -incremental:no ${lflags}"
# link -lib only works when -lib is the first arg
STLIB_LD="${LINKBIN} -lib ${lflags}"
@@ -652,8 +756,13 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
# Specify linker flags depending on the type of app being
# built -- Console vs. Window.
- LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
- LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
+ if test "$doWince" != "no" -a "${TARGETCPU}" != "X86"; then
+ LDFLAGS_CONSOLE="-link ${lflags}"
+ LDFLAGS_WINDOW=${LDFLAGS_CONSOLE}
+ else
+ LDFLAGS_CONSOLE="-link -subsystem:console ${lflags}"
+ LDFLAGS_WINDOW="-link -subsystem:windows ${lflags}"
+ fi
fi
# DL_LIBS is empty, but then we match the Unix version
@@ -773,3 +882,50 @@ AC_DEFUN([SC_BUILD_TCLSH], [
AC_SUBST(BUILD_TCLSH)
])
+#--------------------------------------------------------------------
+# SC_EMBED_MANIFEST
+#
+# Figure out if we can embed the manifest where necessary
+#
+# Arguments:
+# An optional manifest to merge into DLL/EXE.
+#
+# Results:
+# Will define the following vars:
+# VC_MANIFEST_EMBED_DLL
+# VC_MANIFEST_EMBED_EXE
+#
+#--------------------------------------------------------------------
+
+AC_DEFUN([SC_EMBED_MANIFEST], [
+ AC_MSG_CHECKING(whether to embed manifest)
+ AC_ARG_ENABLE(embedded-manifest,
+ [ --enable-embedded-manifest embed manifest if possible (default: yes)],
+ [embed_ok=$enableval], [embed_ok=yes])
+
+ VC_MANIFEST_EMBED_DLL=
+ VC_MANIFEST_EMBED_EXE=
+ result=no
+ if test "$embed_ok" = "yes" -a "${SHARED_BUILD}" = "1" \
+ -a "$GCC" != "yes" ; then
+ # Add the magic to embed the manifest into the dll/exe
+ AC_EGREP_CPP([manifest needed], [
+#if defined(_MSC_VER) && _MSC_VER >= 1400
+print("manifest needed")
+#endif
+ ], [
+ # Could do a CHECK_PROG for mt, but should always be with MSVC8+
+ # Could add 'if test -f' check, but manifest should be created
+ # in this compiler case
+ VC_MANIFEST_EMBED_DLL="mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;2"
+ VC_MANIFEST_EMBED_EXE="mt.exe -nologo -manifest \[$]@.manifest $1 -outputresource:\[$]@\;1"
+ result=yes
+ if test "x$1" != x ; then
+ result="yes ($1)"
+ fi
+ ])
+ fi
+ AC_MSG_RESULT([$result])
+ AC_SUBST(VC_MANIFEST_EMBED_DLL)
+ AC_SUBST(VC_MANIFEST_EMBED_EXE)
+])