summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2015-08-19 15:23:25 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2015-08-19 15:23:25 (GMT)
commit74cd974b89d05dd8159d85d730e6aadaa34b3e27 (patch)
tree0f23285bc58a4da5f205563b29da11021ddf33a1
parent2ef36c8edb60b8da26aeb9947f6d2cdd1d4bf6c1 (diff)
downloadtcl-74cd974b89d05dd8159d85d730e6aadaa34b3e27.zip
tcl-74cd974b89d05dd8159d85d730e6aadaa34b3e27.tar.gz
tcl-74cd974b89d05dd8159d85d730e6aadaa34b3e27.tar.bz2
Fix [00189c4afcb9e2586301d711f71383e48817a72d|00189c4afc]: Allow semi-static UCRT build on Windows with VC 14.0
-rw-r--r--generic/tclMain.c3
-rw-r--r--win/makefile.vc22
-rw-r--r--win/rules.vc7
3 files changed, 30 insertions, 2 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c
index 5e5109b..b2206f8 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -28,7 +28,10 @@
* source directory to make their own modified versions).
*/
+#if defined _MSC_VER && _MSC_VER < 1900
+/* isatty is always defined on MSVC 14.0, but not necessarily as CRTIMPORT. */
extern CRTIMPORT int isatty(int fd);
+#endif
static Tcl_Obj *tclStartupScriptPath = NULL;
static Tcl_Obj *tclStartupScriptEncoding = NULL;
diff --git a/win/makefile.vc b/win/makefile.vc
index 1f957ea..24a92ba 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -70,7 +70,7 @@ the build instructions.
# Sets where to install Tcl from the built binaries.
# C:\Progra~1\Tcl is assumed when not specified.
#
-# OPTS=loimpact,msvcrt,static,staticpkg,symbols,threads,profile,unchecked,none
+# OPTS=loimpact,msvcrt,static,staticpkg,symbols,threads,profile,unchecked,ucrt,none
# Sets special options for the core. The default is for none.
# Any combination of the above may be used (comma separated).
# 'none' will over-ride everything to nothing.
@@ -94,6 +94,11 @@ the build instructions.
# unchecked = Allows a symbols build to not use the debug
# enabled runtime (msvcrt.dll not msvcrtd.dll
# or libcmt.lib not libcmtd.lib).
+# ucrt= Uses ucrt.lib and libvcruntime.lib, which
+# ensures Tcl will run on machines with only the subset
+# of the C runtime that is part of the operating system.
+# If omitted, builds with VC 14.0 or later will require
+# the full C runtime redistributable.
#
# STATS=compdbg,memdbg,none
# Sets optional memory and bytecode compiler debugging code added
@@ -438,7 +443,13 @@ cdebug = -Zi -WX $(DEBUGFLAGS)
cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\
-!if $(MSVCRT)
+!if $(UCRT)
+!if $(DEBUG) && !$(UNCHECKED)
+crt = -MDd
+!else
+crt = -MT
+!endif
+!elseif $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
@@ -480,6 +491,10 @@ lflags = -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
lflags = $(lflags) -profile
!endif
+!if $(UCRT) && !($(DEBUG) && !$(UNCHECKED))
+lflags = $(lflags) -nodefaultlib:libucrt.lib
+!endif
+
!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
### Align sections for PE size savings.
lflags = $(lflags) -opt:nowin98
@@ -504,6 +519,9 @@ baselibs = kernel32.lib user32.lib ws2_32.lib
baselibs = $(baselibs) bufferoverflowU.lib
!endif
!endif
+!if $(UCRT) && !($(DEBUG) && !$(UNCHECKED))
+baselibs = $(baselibs) ucrt.lib
+!endif
#---------------------------------------------------------------------
# TclTest flags
diff --git a/win/rules.vc b/win/rules.vc
index 78a167a..9247c59 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -223,6 +223,7 @@ LOIMPACT = 0
TCL_USE_STATIC_PACKAGES = 0
USE_THREAD_ALLOC = 0
UNCHECKED = 0
+UCRT = 0
!else
!if [nmakehlp -f $(OPTS) "static"]
!message *** Doing static
@@ -302,6 +303,12 @@ UNCHECKED = 1
UNCHECKED = 0
!endif
!endif
+!if [nmakehlp -f $(OPTS) "ucrt"] && $(VCVERSION) >= 1900
+!message *** Doing UCRT
+UCRT = 1
+!else
+UCRT = 0
+!endif
#----------------------------------------------------------
# Figure-out how to name our intermediate and output directories.