Index: tcl-core-8.6.4.x/generic/tclMain.c =================================================================== --- tcl-core-8.6.4.x/generic/tclMain.c (revision 89060) +++ tcl-core-8.6.4.x/generic/tclMain.c (working copy) @@ -77,15 +77,18 @@ /* * Declarations for various library functions and variables (don't want to * include tclPort.h here, because people might copy this file out of the Tcl - * source directory to make their own modified versions). + * 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 + +/* + * The thread-local variables for this file's functions. */ -extern CRTIMPORT int isatty(int fd); - -/* - * The thread-local variables for this file's functions. - */ - typedef struct { Tcl_Obj *path; /* The filename of the script for *_Main() * routines to [source] as a startup script, Index: tcl-core-8.6.4.x/win/makefile.vc =================================================================== --- tcl-core-8.6.4.x/win/makefile.vc (revision 89060) +++ tcl-core-8.6.4.x/win/makefile.vc (working copy) @@ -71,7 +71,7 @@ # Sets where to install Tcl from the built binaries. # C:\Progra~1\Tcl is assumed when not specified. # -# OPTS=loimpact,msvcrt,nothreads,pdbs,profile,static,staticpkg,symbols,thrdalloc,tclalloc,unchecked,none +# OPTS=loimpact,msvcrt,nothreads,pdbs,profile,static,staticpkg,symbols,thrdalloc,tclalloc,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. @@ -102,6 +102,11 @@ # 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 @@ -488,10 +493,16 @@ 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 crt = -MD !endif !else @@ -530,6 +541,10 @@ 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 @@ -554,6 +569,9 @@ baselibs = $(baselibs) bufferoverflowU.lib !endif !endif +!if $(UCRT) && !($(DEBUG) && !$(UNCHECKED)) +baselibs = $(baselibs) ucrt.lib +!endif #--------------------------------------------------------------------- # TclTest flags Index: tcl-core-8.6.4.x/win/rules.vc =================================================================== --- tcl-core-8.6.4.x/win/rules.vc (revision 89060) +++ tcl-core-8.6.4.x/win/rules.vc (working copy) @@ -223,6 +223,7 @@ TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 +UCRT = 0 !else !if [nmakehlp -f $(OPTS) "static"] !message *** Doing static @@ -302,6 +303,12 @@ 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. Index: tk-8.6.4.x/win/makefile.vc =================================================================== --- tk-8.6.4.x/win/makefile.vc (revision 89060) +++ tk-8.6.4.x/win/makefile.vc (working copy) @@ -76,7 +76,7 @@ # Sets where to install Tcl from the built binaries. # C:\Progra~1\Tcl is assumed when not specified. # -# OPTS=loimpact,msvcrt,nothreads,noxp,pdbs,profile,square,static,staticpkg,symbols,unchecked,none +# OPTS=loimpact,msvcrt,nothreads,noxp,pdbs,profile,square,static,staticpkg,symbols,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. @@ -105,6 +105,11 @@ # 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 @@ -460,10 +465,16 @@ 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 crt = -MD !endif !else @@ -500,6 +511,10 @@ 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 @@ -526,6 +541,11 @@ baselibs = $(baselibs) bufferoverflowU.lib !endif !endif + +!if $(UCRT) && !($(DEBUG) && !$(UNCHECKED)) +baselibs = $(baselibs) ucrt.lib +!endif + guilibs = $(baselibs) gdi32.lib Index: tk-8.6.4.x/win/rules.vc =================================================================== --- tk-8.6.4.x/win/rules.vc (revision 89060) +++ tk-8.6.4.x/win/rules.vc (working copy) @@ -223,6 +223,7 @@ TCL_USE_STATIC_PACKAGES = 0 USE_THREAD_ALLOC = 1 UNCHECKED = 0 +UCRT = 0 !else !if [nmakehlp -f $(OPTS) "static"] !message *** Doing static @@ -302,6 +303,12 @@ 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.