diff --git a/doc/install.html b/doc/install.html
index 8085573b..700d6edf 100644
--- a/doc/install.html
+++ b/doc/install.html
@@ -116,14 +116,14 @@ operating systems, CPUs and compilers:
ARMv5+ ARM9E+ |
@@ -168,7 +168,7 @@ only).
src/Makefile has settings for compiling LuaJIT
under POSIX, MinGW or Cygwin.
src/msvcbuild.bat has settings for compiling LuaJIT with
-MSVC or WinSDK.
+MSVC (Visual Studio).
Please read the instructions given in these files, before changing
@@ -253,17 +253,7 @@ Either install one of the open source SDKs
(» MinGW or
» Cygwin), which come with a modified
GCC plus the required development headers.
-
-
-Or install Microsoft's Visual C++ (MSVC). The freely downloadable
-» Express Edition
-works just fine, but only contains an x86 compiler.
-
-
-The freely downloadable
-» Windows SDK
-only comes with command line tools, but this is all you need to build LuaJIT.
-It contains x86 and x64 compilers.
+Or install Microsoft's Visual Studio (MSVC).
Next, download the source package and unpack it using an archive manager
@@ -271,7 +261,7 @@ Next, download the source package and unpack it using an archive manager
Building with MSVC
-Open a "Visual Studio .NET Command Prompt", cd to the
+Open a "Visual Studio Command Prompt" (either x86 or x64), cd to the
directory where you've unpacked the sources and run these commands:
@@ -279,30 +269,7 @@ cd src
msvcbuild
-Then follow the installation instructions below.
-
-Building with the Windows SDK
-
-Open a "Windows SDK Command Shell" and select the x86 compiler:
-
-
-setenv /release /x86
-
-
-Or select the x64 compiler:
-
-
-setenv /release /x64
-
-
-Then cd to the directory where you've unpacked the sources
-and run these commands:
-
-
-cd src
-msvcbuild
-
-
+Check the msvcbuild.bat file for more options.
Then follow the installation instructions below.
Building with MinGW or Cygwin
diff --git a/src/lj_def.h b/src/lj_def.h
index e67bb24c..b1208f6b 100644
--- a/src/lj_def.h
+++ b/src/lj_def.h
@@ -8,8 +8,8 @@
#include "lua.h"
-#if defined(_MSC_VER)
-/* MSVC is stuck in the last century and doesn't have C99's stdint.h. */
+#if defined(_MSC_VER) && (_MSC_VER < 1700)
+/* Old MSVC is stuck in the last century and doesn't have C99's stdint.h. */
typedef __int8 int8_t;
typedef __int16 int16_t;
typedef __int32 int32_t;
diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat
index 71bde759..4abc461a 100644
--- a/src/msvcbuild.bat
+++ b/src/msvcbuild.bat
@@ -1,19 +1,19 @@
@rem Script to build LuaJIT with MSVC.
-@rem Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
+@rem Copyright (C) 2005-2019 Mike Pall. See Copyright Notice in luajit.h
@rem
-@rem Either open a "Visual Studio .NET Command Prompt"
-@rem (Note that the Express Edition does not contain an x64 compiler)
-@rem -or-
-@rem Open a "Windows SDK Command Shell" and set the compiler environment:
-@rem setenv /release /x86
-@rem -or-
-@rem setenv /release /x64
+@rem Open a "Visual Studio Command Prompt" (either x86 or x64).
+@rem Then cd to this directory and run this script. Use the following
+@rem options (in order), if needed. The default is a dynamic release build.
@rem
-@rem Then cd to this directory and run this script.
+@rem debug emit debug symbols
+@rem amalg amalgamated build
+@rem static static linkage
@if not defined INCLUDE goto :FAIL
@setlocal
+@rem Add more debug flags here, e.g. DEBUGCFLAGS=/DLUA_USE_APICHECK
+@set DEBUGCFLAGS=
@set LJCOMPILE=cl /nologo /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_STDIO_INLINE=__declspec(dllexport)__inline
@set LJLINK=link /nologo
@set LJMT=mt /nologo
@@ -23,6 +23,7 @@
@set DASC=vm_x86.dasc
@set LJDLLNAME=lua51.dll
@set LJLIBNAME=lua51.lib
+@set BUILDTYPE=release
@set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c
%LJCOMPILE% host\minilua.c
@@ -72,9 +73,11 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
@if "%1" neq "debug" goto :NODEBUG
@shift
-@set LJCOMPILE=%LJCOMPILE% /Zi
-@set LJLINK=%LJLINK% /debug /opt:ref /opt:icf /incremental:no
+@set BUILDTYPE=debug
+@set LJCOMPILE=%LJCOMPILE% /Zi %DEBUGCFLAGS%
+@set LJLINK=%LJLINK% /opt:ref /opt:icf /incremental:no
:NODEBUG
+@set LJLINK=%LJLINK% /%BUILDTYPE%
@if "%1"=="amalg" goto :AMALGDLL
@if "%1"=="static" goto :STATIC
%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
@@ -118,5 +121,5 @@ if exist luajit.exe.manifest^
@echo *******************************************************
@goto :END
:FAIL
-@echo You must open a "Visual Studio .NET Command Prompt" to run this script
+@echo You must open a "Visual Studio Command Prompt" to run this script
:END