Adapt to Windows SDK 10.0.15063

On a machine with MSVC 2013 and 2015 (but no 2017) installed, I installed
"Windows Software Development Kit - Windows 10.0.15063.137" as available through
<https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk> (in the
hopes that it will provide a better fix for
acbb7e3243afec515bf98b2b34454afc5320bf66 "Work around clang-cl issue with MSVC's
safeint.h for now").  That apparently removed various files from the
C:\Program Files (x86)\Windows Kits\10\bin\ hierarchy, while it added files to a
new C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\ hierarchy (and
<https://developer.microsoft.com/en-US/windows/downloads/windows-10-sdk>
mentions that in an "SDK Layout Changes: Side by Side install of tools and
metadata" section).  So return a new winsdkbinsubdir var from find_winsdk() to
cover installations that use this new layout scheme.

In b076e8f673d1714ee8b6f991eb2ca299b6fa8949 "Fix include and library paths for
at least me", tml had hardcoded some 10.0.15063 -> 10.0.14393 mappings that are
unhelpful at least in my scenario.  I tried to keep those hacks in in a way that
would still work for tml's scenario.

The check for msiinfo.exe etc. had been broken since
ecfabb66f421ef07f52a655117f047aa75d54a01 "add support for Windows 8 SDK", but
apparently in a way so that nobody noticed.  The first

  # needed for msi packaging
  pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"

is indeed needed, as (at least some of) those tools are only available in the
arm and x86 sub-dirs, not in the arm64 and x64 ones.  (I'm not sure whether the
two later pathmunges adding $WINDOWS_SDK_BINDIR_NO_ARCH/{x64,x86} are still
relevant, though.)

Change-Id: Ia403e4bde7b1abf7e2c9d9f084a05af2d1311617
Reviewed-on: https://gerrit.libreoffice.org/36455
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
diff --git a/configure.ac b/configure.ac
index 335dc03..16b3517 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3325,7 +3325,11 @@ find_ucrt()
            PathFormat "$(win_get_env_from_vsvars32bat UniversalCRTSdkDir)"
            UCRTSDKDIR=$formatted_path
            UCRTVERSION=$(win_get_env_from_vsvars32bat UCRTVersion)
            if test "$UCRTVERSION" = 10.0.15063.0; then
            dnl Hack needed at least by tml:
            if test "$UCRTVERSION" = 10.0.15063.0 \
                -a ! -f "${UCRTSDKDIR}Include/10.0.15063.0/um/sqlext.h" \
                -a -f "${UCRTSDKDIR}Include/10.0.14393.0/um/sqlext.h"
            then
                UCRTVERSION=10.0.14393.0
            fi
        else
@@ -5157,9 +5161,9 @@ find_dotnetsdk46()
find_winsdk_version()
{
    # Args: $1 : SDK version as in "6.0A", "7.0" etc
    # Return values: $winsdktest, $winsdklibsubdir
    # Return values: $winsdktest, $winsdkbinsubdir, $winsdklibsubdir

    unset winsdktest winsdklibsubdir
    unset winsdktest winsdkbinsubdir winsdklibsubdir

    case "$1" in
    7.*)
@@ -5191,11 +5195,20 @@ find_winsdk_version()
        if test -n "$regvalue"; then
            winsdktest=$regvalue
            reg_get_value_32 "HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Microsoft SDKs/Windows/v${1}/ProductVersion"
            if test -n "$regvalue"; then
                winsdkbinsubdir="$regvalue".0
            fi
            winsdklibsubdir=$regvalue
            if test "$regvalue" = "10.0.14393"; then
                winsdklibsubdir="10.0.14393.0"
            elif test "$regvalue" = "10.0.15063"; then
                winsdklibsubdir="10.0.14393.0"
                winsdklibsubdir="10.0.15063.0"
                dnl Hack needed at least by tml:
                if test ! -f "${winsdktest}/Include/10.0.15063.0/um/sqlext.h" \
                    -a -f "${winsdktest}/Include/10.0.14393.0/um/sqlext.h"
                then
                    winsdklibsubdir="10.0.14393.0"
                fi
            fi
            return
        fi
@@ -5304,14 +5317,23 @@ find_msvc_x64_dlls()
}

if test "$build_os" = "cygwin"; then
    dnl Check midl.exe
    dnl Check midl.exe; this being the first check for a tool in the SDK bin
    dnl dir, it also determines that dir's path w/o an arch segment if any,
    dnl WINDOWS_SDK_BINDIR_NO_ARCH:
    AC_MSG_CHECKING([for midl.exe])

    find_winsdk
    if test -f "$winsdktest/Bin/midl.exe"; then
        MIDL_PATH="$winsdktest/Bin"
    if test -n "$winsdkbinsubdir" \
        -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/midl.exe"
    then
        WINDOWS_SDK_BINDIR_NO_ARCH=$winsdktest/Bin/$winsdkbinsubdir
        MIDL_PATH=$WINDOWS_SDK_BINDIR_NO_ARCH/$WINDOWS_SDK_ARCH
    elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/midl.exe"; then
        MIDL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
        WINDOWS_SDK_BINDIR_NO_ARCH=$winsdktest/Bin
        MIDL_PATH=$WINDOWS_SDK_BINDIR_NO_ARCH/$WINDOWS_SDK_ARCH
    elif test -f "$winsdktest/Bin/midl.exe"; then
        WINDOWS_SDK_BINDIR_NO_ARCH=$winsdktest/Bin
        MIDL_PATH=$WINDOWS_SDK_BINDIR_NO_ARCH
    fi
    if test ! -f "$MIDL_PATH/midl.exe"; then
        AC_MSG_ERROR([midl.exe not found in $winsdktest/Bin/$WINDOWS_SDK_ARCH, Windows SDK installation broken?])
@@ -5339,10 +5361,14 @@ if test "$build_os" = "cygwin"; then
    dnl Check al.exe
    AC_MSG_CHECKING([for al.exe])
    find_winsdk
    if test -f "$winsdktest/Bin/al.exe"; then
        AL_PATH="$winsdktest/Bin"
    if test -n "$winsdkbinsubdir" \
        -a -f "$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH/al.exe"
    then
        AL_PATH="$winsdktest/Bin/$winsdkbinsubdir/$WINDOWS_SDK_ARCH"
    elif test -f "$winsdktest/Bin/$WINDOWS_SDK_ARCH/al.exe"; then
        AL_PATH="$winsdktest/Bin/$WINDOWS_SDK_ARCH"
    elif test -f "$winsdktest/Bin/al.exe"; then
        AL_PATH="$winsdktest/Bin"
    fi

    if test -z "$AL_PATH"; then
@@ -9589,14 +9615,14 @@ if test "$_os" = "WINNT"; then
the  Windows SDK are installed.])
        fi

        if test ! -f "$WINDOWS_SDK_HOME/bin/msiinfo.exe" \
             -o ! -f "$WINDOWS_SDK_HOME/bin/msidb.exe" \
             -o ! -f "$WINDOWS_SDK_HOME/bin/uuidgen.exe" \
             -o ! -f "$WINDOWS_SDK_HOME/bin/msitran.exe"; then :
        elif test ! -f "$WINDOWS_SDK_HOME/bin/x86/msiinfo.exe" \
             -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msidb.exe" \
             -o ! -f "$WINDOWS_SDK_HOME/bin/x86/uuidgen.exe" \
             -o ! -f "$WINDOWS_SDK_HOME/bin/x86/msitran.exe"; then :
        if test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msiinfo.exe" \
             -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msidb.exe" \
             -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/uuidgen.exe" \
             -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/msitran.exe"; then :
        elif test -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msiinfo.exe" \
             -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msidb.exe" \
             -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/uuidgen.exe" \
             -a -f "$WINDOWS_SDK_BINDIR_NO_ARCH/x86/msitran.exe"; then :
        else
            AC_MSG_ERROR([Some (all?) Windows Installer tools in the Windows SDK are missing, please install.])
        fi
@@ -12602,7 +12628,7 @@ else
        fi
        if test "$BITNESS_OVERRIDE" = 64; then
            # needed for msi packaging
            pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
            pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
        fi
        # .NET 4.6 and higher don't have bin directory
        if test -f "$DOTNET_FRAMEWORK_HOME/bin"; then
@@ -12619,10 +12645,10 @@ else
        fi
        if test "$BITNESS_OVERRIDE" = 64; then
            pathmunge "$COMPATH/bin/amd64" "before"
            pathmunge "$WINDOWS_SDK_HOME/bin/x64" "before"
            pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x64" "before"
        else
            pathmunge "$COMPATH/bin" "before"
            pathmunge "$WINDOWS_SDK_HOME/bin/x86" "before"
            pathmunge "$WINDOWS_SDK_BINDIR_NO_ARCH/x86" "before"
        fi
        if test "$ENABLE_JAVA" != ""; then
            if test -d "$JAVA_HOME/jre/bin/client"; then