Bump Windows build baseline to Visual Studio 2019 16.4

(where 16.4 is currently the latest version of Visual Studio 2019 available at
<https://visualstudio.microsoft.com/downloads/>), see
<https://lists.freedesktop.org/archives/libreoffice/2020-February/084575.html>
"ESC meeting minutes: 2020-02-27": "Update baseline to VS2019 on master before
7.0 [...] check what’s the current patch level, require that? [...] no
objections"

The code from 4ea0059bca6dd84f10abcf52f6d6b81c1afec397 "VS detection: Fallback
to old registry check if vswhere failed" has been removed in accordance with its
comment "The below hack does not work for VS 2019 anyway, so should be removed
when upgrading baseline.

(Changing the comment "go to Start menu, open 'Visual Studio 2017', [...]"
regarding the installation of GNU Make from source is somewhat arbitrary, but
lets stick to the tradition of bumping that version number along with any build
baseline bump.)

Change-Id: Ic4fe8a3d347aa1748377f2d3205e302bff189b79
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89699
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Jenkins
diff --git a/README.md b/README.md
index 87de8f4..4ed3b80 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ run and compile LibreOffice, also used by the TDF builds:

* Windows:
    * Runtime: Windows 7
    * Build: Cygwin + Visual Studio 2017 version 15.7
    * Build: Cygwin + Visual Studio 2019 version 16.4
* macOS:
    * Runtime: 10.10
    * Build: 10.14.4 + Xcode 11.3
diff --git a/configure.ac b/configure.ac
index 3cf459a..d896b12 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2101,9 +2101,9 @@ libo_FUZZ_ARG_WITH(doxygen,
,with_doxygen=yes)

AC_ARG_WITH(visual-studio,
    AS_HELP_STRING([--with-visual-studio=<2017/2019>],
    AS_HELP_STRING([--with-visual-studio=<2019>],
        [Specify which Visual Studio version to use in case several are
         installed. Currently only 2017 (default) and 2019 are supported.]),
         installed. Currently only 2019 (default) is supported.]),
,)

AC_ARG_WITH(windows-sdk,
@@ -3295,8 +3295,6 @@ map_vs_year_to_version()
    unset vsversion

    case $1 in
    2017)
        vsversion=15;;
    2019)
        vsversion=16;;
    *)
@@ -3315,8 +3313,8 @@ vs_versions_to_check()
        map_vs_year_to_version "$1"
        vsversions=$vsversion
    else
        # We accept only 2017
        vsversions="15"
        # We accept only 2019
        vsversions="16"
    fi
}

@@ -3368,7 +3366,7 @@ find_ucrt()

find_msvc()
{
    # Find Visual C++ 2017/2019
    # Find Visual C++ 2019
    # Args: $1 (optional) : The VS version year
    # Return values: $vctest, $vcyear, $vcnum, $vcnumwithdot, $vcbuildnumber

@@ -3393,33 +3391,9 @@ find_msvc()
        fi
    done

    # This fallback is needed on *some* (but not all) VS 2017 installations, where vswhere turns up
    # with the empty list for unclear reason. The below hack does not work for VS 2019 anyway, so
    # should be removed when upgrading baseline.
    if ! test -n "$vctest"; then
        for ver in $vsversions; do
            reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/$ver.0/Setup/VC/ProductDir
            if test -n "$regvalue"; then
                vctest=$regvalue
                break
            fi
            reg_get_value_32 HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/VisualStudio/SxS/VS7/$ver.0
            if test -n "$regvalue"; then
                AC_MSG_RESULT([found: $regvalue])
                PathFormat "$regvalue"
                vctest=$formatted_path
                break
            fi
        done
    fi

    if test -n "$vctest"; then
        vcnumwithdot="$ver.0"
        case "$vcnumwithdot" in
        15.0)
            vcyear=2017
            vcnum=150
            ;;
        16.0)
            vcyear=2019
            vcnum=160
@@ -3440,7 +3414,7 @@ if test "$_os" = "WINNT"; then
        if test -n "$with_visual_studio"; then
            AC_MSG_ERROR([no Visual Studio $with_visual_studio installation found])
        else
            AC_MSG_ERROR([no Visual Studio 2017 installation found])
            AC_MSG_ERROR([no Visual Studio 2019 installation found])
        fi
    fi

@@ -3606,7 +3580,7 @@ if test "$_os" = "WINNT"; then
        # are always "better", we list them in reverse chronological order.

        case "$vcnum" in
        150|160)
        160)
            WINDOWS_SDK_ACCEPTABLE_VERSIONS="10.0 8.1A 8.1 8.0"
            ;;
        esac
@@ -3631,11 +3605,11 @@ if test "$_os" = "WINNT"; then
        AC_MSG_ERROR([Visual C++ not found after all, huh])
    fi

    AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2017 version 15.7])
    AC_MSG_CHECKING([$CC_BASE is at least Visual Studio 2019 version 16.4])
    AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
        // See <https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros> for mapping
        // between Visual Studio versions and _MSC_VER:
        #if _MSC_VER < 1914
        #if _MSC_VER < 1924
        #error
        #endif
    ]])],[AC_MSG_RESULT([yes])],[AC_MSG_ERROR([no])])
@@ -5662,7 +5636,7 @@ find_msms()
    AC_MSG_CHECKING([for MSVC merge modules directory])
    my_msm_files=Microsoft_VC${VCVER}_CRT_x86.msm
    case "$VCVER" in
        150|160)
        160)
        my_msm_files="Microsoft_VC141_CRT_x86.msm Microsoft_VC142_CRT_x86.msm ${my_msm_files}"
        ;;
    esac
@@ -5702,7 +5676,7 @@ find_msms()

    dnl Starting from MSVC 15.0, merge modules are located in different directory
    case "$VCVER" in
    150|160)
    160)
        for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
            echo "$as_me:$LINENO: looking in $VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules])" >&5
            my_msm_dir="$VC_PRODUCT_DIR/redist/MSVC/$l/MergeModules/"
@@ -5734,7 +5708,7 @@ find_msvc_x64_dlls()
    AC_MSG_CHECKING([for MSVC x64 DLL path])
    msvcdllpath="$VC_PRODUCT_DIR/redist/x64/Microsoft.VC${VCVER}.CRT"
    case "$VCVER" in
    150|160)
    160)
        for l in `ls -1 $VC_PRODUCT_DIR/redist/MSVC/`; do
            echo "$as_me:$LINENO: testing $VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT" >&5
            if test -d "$VC_PRODUCT_DIR/redist/MSVC/$l/x64/Microsoft.VC141.CRT"; then
@@ -13280,7 +13254,7 @@ place yourself in a working directory of you choice.

 git clone git://git.savannah.gnu.org/make.git

 [go to Start menu, open "Visual Studio 2017", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
 [go to Start menu, open "Visual Studio 2019", click "x86 Native Tools Command Prompt" or "x64 Native Tools Command Prompt"]
 set PATH=%PATH%;C:\Cygwin\bin
 [or Cygwin64, if that is what you have]
 cd path-to-make-repo-you-cloned-above
diff --git a/external/coinmp/ExternalProject_coinmp.mk b/external/coinmp/ExternalProject_coinmp.mk
index 7c10b05..e1484e6 100644
--- a/external/coinmp/ExternalProject_coinmp.mk
+++ b/external/coinmp/ExternalProject_coinmp.mk
@@ -20,7 +20,6 @@ $(call gb_ExternalProject_get_state_target,coinmp,build) :
		MSBuild.exe CoinMP.sln /t:Build \
			/p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
			/p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
			$(if $(filter 150,$(VCVER)),/p:PlatformToolset=v141 /p:VisualStudioVersion=15.0 /ToolsVersion:15.0) \
			$(if $(filter 160,$(VCVER)),/p:PlatformToolset=v142 /p:VisualStudioVersion=16.0 /ToolsVersion:Current) \
			$(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
	,CoinMP/MSVisualStudio/v9)
diff --git a/external/cppunit/ExternalProject_cppunit.mk b/external/cppunit/ExternalProject_cppunit.mk
index b9ff8b5..c0d1380 100644
--- a/external/cppunit/ExternalProject_cppunit.mk
+++ b/external/cppunit/ExternalProject_cppunit.mk
@@ -19,7 +19,6 @@ $(call gb_ExternalProject_get_state_target,cppunit,build) :
	$(call gb_ExternalProject_run,build,\
	    PROFILEFLAGS="$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
		/p:Platform=$(if $(filter INTEL,$(CPUNAME)),Win32,x64) \
			$(if $(filter 150,$(VCVER)),/p:PlatformToolset=v141 /p:VisualStudioVersion=15.0 /ToolsVersion:15.0) \
			$(if $(filter 160,$(VCVER)),/p:PlatformToolset=v142 /p:VisualStudioVersion=16.0 /ToolsVersion:Current) \
			$(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION))" \
		&& msbuild.exe cppunit_dll.vcxproj /p:Configuration=$${PROFILEFLAGS}  \
diff --git a/external/lcms2/ExternalProject_lcms2.mk b/external/lcms2/ExternalProject_lcms2.mk
index ceafec5..5210242 100644
--- a/external/lcms2/ExternalProject_lcms2.mk
+++ b/external/lcms2/ExternalProject_lcms2.mk
@@ -19,7 +19,6 @@ $(call gb_ExternalProject_get_state_target,lcms2,build):
	$(call gb_Trace_StartRange,lcms2,EXTERNAL)
	$(call gb_ExternalProject_run,build,\
		MSBuild.exe lcms2_DLL.vcxproj \
			$(if $(filter 150,$(VCVER)),/p:PlatformToolset=v141 /p:VisualStudioVersion=15.0 /ToolsVersion:15.0) \
			$(if $(filter 160,$(VCVER)),/p:PlatformToolset=v142 /p:VisualStudioVersion=16.0 /ToolsVersion:Current) \
			$(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
			/p:Configuration=$(if $(MSVC_USE_DEBUG_RUNTIME),Debug,Release) \
diff --git a/external/python3/ExternalProject_python3.mk b/external/python3/ExternalProject_python3.mk
index 65023da..8163159 100644
--- a/external/python3/ExternalProject_python3.mk
+++ b/external/python3/ExternalProject_python3.mk
@@ -42,7 +42,6 @@ $(call gb_ExternalProject_get_state_target,python3,build) :
			/p:opensslOutDir=$(call gb_UnpackedTarball_get_dir,openssl)/out32dll \
			/p:zlibDir=$(call gb_UnpackedTarball_get_dir,zlib) \
			/maxcpucount \
			$(if $(filter 150,$(VCVER)),/p:PlatformToolset=v141 /p:VisualStudioVersion=15.0 /ToolsVersion:15.0) \
			$(if $(filter 160,$(VCVER)),/p:PlatformToolset=v142 /p:VisualStudioVersion=16.0 /ToolsVersion:Current) \
			$(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
	,PCBuild)