8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)

Wed, 16 May 2018 15:52:51 -0700

author
kevinw
date
Wed, 16 May 2018 15:52:51 -0700
changeset 2223
01cc48ed67f3
parent 2222
7129b977c4af
child 2224
20daa32eec6f

8042707: Source changes needed to build JDK 9 with Visual Studio 2013 (VS2013)
Reviewed-by: erikj, ihse, ddehaven, billyh

common/autoconf/flags.m4 file | annotate | diff | comparison | revisions
common/autoconf/generated-configure.sh file | annotate | diff | comparison | revisions
common/autoconf/help.m4 file | annotate | diff | comparison | revisions
common/autoconf/libraries.m4 file | annotate | diff | comparison | revisions
common/autoconf/spec.gmk.in file | annotate | diff | comparison | revisions
common/autoconf/toolchain.m4 file | annotate | diff | comparison | revisions
common/autoconf/toolchain_windows.m4 file | annotate | diff | comparison | revisions
make/common/MakeBase.gmk file | annotate | diff | comparison | revisions
     1.1 --- a/common/autoconf/flags.m4	Fri May 04 11:00:26 2018 +0100
     1.2 +++ b/common/autoconf/flags.m4	Wed May 16 15:52:51 2018 -0700
     1.3 @@ -462,15 +462,23 @@
     1.4      CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
     1.5      CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
     1.6    elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
     1.7 -    CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
     1.8 -    -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
     1.9 -    -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
    1.10 -    -DWIN32 -DIAL"
    1.11 +    CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK \
    1.12 +        -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
    1.13 +        -DWIN32_LEAN_AND_MEAN \
    1.14 +        -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
    1.15 +        -DWIN32 -DIAL"
    1.16      if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
    1.17        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
    1.18      else
    1.19        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
    1.20      fi
    1.21 +    # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
    1.22 +    # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
    1.23 +    # studio.
    1.24 +    if test "x$TOOLCHAIN_VERSION" = "x2010"; then
    1.25 +      CXXFLAGS_JDK="$CXXFLAGS_JDK \
    1.26 +          -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
    1.27 +    fi
    1.28    fi
    1.29  
    1.30    ###############################################################################
     2.1 --- a/common/autoconf/generated-configure.sh	Fri May 04 11:00:26 2018 +0100
     2.2 +++ b/common/autoconf/generated-configure.sh	Wed May 16 15:52:51 2018 -0700
     2.3 @@ -640,6 +640,7 @@
     2.4  ENABLE_INTREE_EC
     2.5  SALIB_NAME
     2.6  HOTSPOT_MAKE_ARGS
     2.7 +MSVCP_DLL
     2.8  MSVCR_DLL
     2.9  LIBCXX
    2.10  LLVM_LIBS
    2.11 @@ -1065,6 +1066,7 @@
    2.12  with_override_jdk
    2.13  with_import_hotspot
    2.14  with_toolchain_type
    2.15 +with_toolchain_version
    2.16  with_jtreg
    2.17  with_extra_cflags
    2.18  with_extra_cxxflags
    2.19 @@ -1087,6 +1089,7 @@
    2.20  with_zlib
    2.21  with_stdc__lib
    2.22  with_msvcr_dll
    2.23 +with_msvcp_dll
    2.24  with_dxsdk
    2.25  with_dxsdk_lib
    2.26  with_dxsdk_include
    2.27 @@ -1908,6 +1911,10 @@
    2.28                            source
    2.29    --with-toolchain-type   the toolchain type (or family) to use, use '--help'
    2.30                            to show possible values [platform dependent]
    2.31 +  --with-toolchain-version
    2.32 +                          the version of the toolchain to look for, use
    2.33 +                          '--help' to show possible values [platform
    2.34 +                          dependent]
    2.35    --with-jtreg            Regression Test Harness [probed]
    2.36    --with-extra-cflags     extra flags to be used when compiling jdk c-files
    2.37    --with-extra-cxxflags   extra flags to be used when compiling jdk c++-files
    2.38 @@ -1937,8 +1944,10 @@
    2.39                            force linking of the C++ runtime on Linux to either
    2.40                            static or dynamic, default is static with dynamic as
    2.41                            fallback
    2.42 -  --with-msvcr-dll        copy this msvcr100.dll into the built JDK (Windows
    2.43 -                          only) [probed]
    2.44 +  --with-msvcr-dll        path to microsoft C runtime dll (msvcr*.dll)
    2.45 +                          (Windows only) [probed]
    2.46 +  --with-msvcp-dll        path to microsoft C++ runtime dll (msvcp*.dll)
    2.47 +                          (Windows only) [probed]
    2.48    --with-dxsdk            Deprecated. Option is kept for backwards
    2.49                            compatibility and is ignored
    2.50    --with-dxsdk-lib        Deprecated. Option is kept for backwards
    2.51 @@ -4192,7 +4201,7 @@
    2.52  
    2.53  
    2.54  #
    2.55 -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
    2.56 +# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
    2.57  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    2.58  #
    2.59  # This code is free software; you can redistribute it and/or modify it
    2.60 @@ -4216,12 +4225,59 @@
    2.61  # questions.
    2.62  #
    2.63  
    2.64 -
    2.65 -
    2.66 -
    2.67 -
    2.68 -
    2.69 -
    2.70 +################################################################################
    2.71 +
    2.72 +VALID_VS_VERSIONS="2010 2012 2013"
    2.73 +
    2.74 +VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
    2.75 +VS_VERSION_INTERNAL_2010=100
    2.76 +VS_MSVCR_2010=msvcr100.dll
    2.77 +# We don't use msvcp on Visual Studio 2010
    2.78 +#VS_MSVCP_2010=msvcp100.dll
    2.79 +VS_ENVVAR_2010="VS100COMNTOOLS"
    2.80 +VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
    2.81 +VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
    2.82 +VS_VS_PLATFORM_NAME_2010="v100"
    2.83 +VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
    2.84 +
    2.85 +VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
    2.86 +VS_VERSION_INTERNAL_2012=110
    2.87 +VS_MSVCR_2012=msvcr110.dll
    2.88 +VS_MSVCP_2012=msvcp110.dll
    2.89 +VS_ENVVAR_2012="VS110COMNTOOLS"
    2.90 +VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
    2.91 +VS_SDK_INSTALLDIR_2012=
    2.92 +VS_VS_PLATFORM_NAME_2012="v110"
    2.93 +VS_SDK_PLATFORM_NAME_2012=
    2.94 +
    2.95 +VS_DESCRIPTION_2013="Microsoft Visual Studio 2013"
    2.96 +VS_VERSION_INTERNAL_2013=120
    2.97 +VS_MSVCR_2013=msvcr120.dll
    2.98 +VS_MSVCP_2013=msvcp120.dll
    2.99 +VS_ENVVAR_2013="VS120COMNTOOLS"
   2.100 +VS_VS_INSTALLDIR_2013="Microsoft Visual Studio 12.0"
   2.101 +VS_SDK_INSTALLDIR_2013=
   2.102 +VS_VS_PLATFORM_NAME_2013="v120"
   2.103 +VS_SDK_PLATFORM_NAME_2013=
   2.104 +
   2.105 +################################################################################
   2.106 +
   2.107 +
   2.108 +
   2.109 +################################################################################
   2.110 +
   2.111 +
   2.112 +
   2.113 +################################################################################
   2.114 +# Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
   2.115 +# build environment and assigns it to VS_ENV_CMD
   2.116 +
   2.117 +
   2.118 +################################################################################
   2.119 +
   2.120 +
   2.121 +
   2.122 +################################################################################
   2.123  # Check if the VS env variables were setup prior to running configure.
   2.124  # If not, then find vcvarsall.bat and run it automatically, and integrate
   2.125  # the set env variables into the spec file.
   2.126 @@ -4236,13 +4292,16 @@
   2.127  
   2.128  
   2.129  
   2.130 +
   2.131 +
   2.132 +
   2.133  # This line needs to be here, verbatim, after all includes and the dummy hook
   2.134  # definitions. It is replaced with custom functionality when building
   2.135  # custom sources.
   2.136  #CUSTOM_AUTOCONF_INCLUDE
   2.137  
   2.138  # Do not change or remove the following line, it is needed for consistency checks:
   2.139 -DATE_WHEN_GENERATED=1525371284
   2.140 +DATE_WHEN_GENERATED=1526507291
   2.141  
   2.142  ###############################################################################
   2.143  #
   2.144 @@ -25217,41 +25276,177 @@
   2.145  
   2.146    # First-hand choice is to locate and run the vsvars bat file.
   2.147  
   2.148 -  if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.149 -    VCVARSFILE="vc/bin/vcvars32.bat"
   2.150 -  else
   2.151 -    VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.152 +
   2.153 +# Check whether --with-toolchain-version was given.
   2.154 +if test "${with_toolchain_version+set}" = set; then :
   2.155 +  withval=$with_toolchain_version;
   2.156 +fi
   2.157 +
   2.158 +
   2.159 +  if test "x$with_toolchain_version" = xlist; then
   2.160 +    # List all toolchains
   2.161 +    { $as_echo "$as_me:${as_lineno-$LINENO}: The following toolchain versions are valid on this platform:" >&5
   2.162 +$as_echo "$as_me: The following toolchain versions are valid on this platform:" >&6;}
   2.163 +    for version in $VALID_VS_VERSIONS; do
   2.164 +      eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
   2.165 +      $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
   2.166 +    done
   2.167 +
   2.168 +    exit 0
   2.169 +  elif test "x$with_toolchain_version" != x; then
   2.170 +    # User override; check that it is valid
   2.171 +    if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
   2.172 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Visual Studio version $with_toolchain_version is not valid." >&5
   2.173 +$as_echo "$as_me: Visual Studio version $with_toolchain_version is not valid." >&6;}
   2.174 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Valid Visual Studio versions: $VALID_VS_VERSIONS." >&5
   2.175 +$as_echo "$as_me: Valid Visual Studio versions: $VALID_VS_VERSIONS." >&6;}
   2.176 +      as_fn_error $? "Cannot continue." "$LINENO" 5
   2.177 +    fi
   2.178 +    VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
   2.179 +  else
   2.180 +    # No flag given, use default
   2.181 +    VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
   2.182 +  fi
   2.183 +
   2.184 +  for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
   2.185 +
   2.186 +  VS_VERSION="$VS_VERSION"
   2.187 +  eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
   2.188 +  eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
   2.189 +  eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
   2.190 +  eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
   2.191 +
   2.192 +  # When using --with-tools-dir, assume it points to the correct and default
   2.193 +  # version of Visual Studio or that --with-toolchain-version was also set.
   2.194 +  if test "x$with_tools_dir" != x; then
   2.195 +
   2.196 +  if test "x$VS_ENV_CMD" = x; then
   2.197 +    VS_VERSION="${VS_VERSION}"
   2.198 +    VS_BASE="$with_tools_dir/../.."
   2.199 +    METHOD="--with-tools-dir"
   2.200 +
   2.201 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.202 +      VCVARSFILE="vc/bin/vcvars32.bat"
   2.203 +    else
   2.204 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.205 +    fi
   2.206 +
   2.207 +
   2.208 +  windows_path="$VS_BASE"
   2.209 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.210 +    unix_path=`$CYGPATH -u "$windows_path"`
   2.211 +    VS_BASE="$unix_path"
   2.212 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.213 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.214 +    VS_BASE="$unix_path"
   2.215 +  fi
   2.216 +
   2.217 +    if test -d "$VS_BASE"; then
   2.218 +      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.219 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.220 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.221 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.222 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.223 +        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.224 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.225 +      else
   2.226 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.227 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.228 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.229 +$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.230 +      fi
   2.231 +    fi
   2.232 +  fi
   2.233 +
   2.234 +
   2.235 +  if test "x$VS_ENV_CMD" = x; then
   2.236 +    VS_VERSION="${VS_VERSION}"
   2.237 +    VS_BASE="$with_tools_dir/../../.."
   2.238 +    METHOD="--with-tools-dir"
   2.239 +
   2.240 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.241 +      VCVARSFILE="vc/bin/vcvars32.bat"
   2.242 +    else
   2.243 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.244 +    fi
   2.245 +
   2.246 +
   2.247 +  windows_path="$VS_BASE"
   2.248 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.249 +    unix_path=`$CYGPATH -u "$windows_path"`
   2.250 +    VS_BASE="$unix_path"
   2.251 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.252 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.253 +    VS_BASE="$unix_path"
   2.254 +  fi
   2.255 +
   2.256 +    if test -d "$VS_BASE"; then
   2.257 +      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.258 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.259 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.260 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.261 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.262 +        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.263 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.264 +      else
   2.265 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.266 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.267 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.268 +$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.269 +      fi
   2.270 +    fi
   2.271 +  fi
   2.272 +
   2.273 +    if test "x$VS_ENV_CMD" = x; then
   2.274 +      # Having specified an argument which is incorrect will produce an instant failure;
   2.275 +      # we should not go on looking
   2.276 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The path given by --with-tools-dir does not contain a valid" >&5
   2.277 +$as_echo "$as_me: The path given by --with-tools-dir does not contain a valid" >&6;}
   2.278 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Visual Studio installation. Please point to the VC/bin or VC/bin/amd64" >&5
   2.279 +$as_echo "$as_me: Visual Studio installation. Please point to the VC/bin or VC/bin/amd64" >&6;}
   2.280 +      { $as_echo "$as_me:${as_lineno-$LINENO}: directory within the Visual Studio installation" >&5
   2.281 +$as_echo "$as_me: directory within the Visual Studio installation" >&6;}
   2.282 +      as_fn_error $? "Cannot locate a valid Visual Studio installation" "$LINENO" 5
   2.283 +    fi
   2.284    fi
   2.285  
   2.286    VS_ENV_CMD=""
   2.287    VS_ENV_ARGS=""
   2.288 -  if test "x$with_toolsdir" != x; then
   2.289 +
   2.290 +  if test "x$VS_COMNTOOLS" != x; then
   2.291  
   2.292    if test "x$VS_ENV_CMD" = x; then
   2.293 -    VS100BASE="$with_toolsdir/../.."
   2.294 -    METHOD="--with-tools-dir"
   2.295 -
   2.296 -  windows_path="$VS100BASE"
   2.297 -  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.298 -    unix_path=`$CYGPATH -u "$windows_path"`
   2.299 -    VS100BASE="$unix_path"
   2.300 -  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.301 -    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.302 -    VS100BASE="$unix_path"
   2.303 -  fi
   2.304 -
   2.305 -    if test -d "$VS100BASE"; then
   2.306 -      if test -f "$VS100BASE/$VCVARSFILE"; then
   2.307 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.308 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.309 -        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
   2.310 +    VS_VERSION="${VS_VERSION}"
   2.311 +    VS_BASE="$VS_COMNTOOLS/../.."
   2.312 +    METHOD="$VS_COMNTOOLS_VAR variable"
   2.313 +
   2.314 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.315 +      VCVARSFILE="vc/bin/vcvars32.bat"
   2.316 +    else
   2.317 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.318 +    fi
   2.319 +
   2.320 +
   2.321 +  windows_path="$VS_BASE"
   2.322 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.323 +    unix_path=`$CYGPATH -u "$windows_path"`
   2.324 +    VS_BASE="$unix_path"
   2.325 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.326 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.327 +    VS_BASE="$unix_path"
   2.328 +  fi
   2.329 +
   2.330 +    if test -d "$VS_BASE"; then
   2.331 +      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.332 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.333 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.334 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.335          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.336          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.337 -        # TODO: improve detection for other versions of VS
   2.338 -        PLATFORM_TOOLSET="v100"
   2.339 -      else
   2.340 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.341 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.342 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.343 +      else
   2.344 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.345 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.346          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.347  $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.348        fi
   2.349 @@ -25259,44 +25454,40 @@
   2.350    fi
   2.351  
   2.352    fi
   2.353 -
   2.354 -  if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
   2.355 -    # Having specified an argument which is incorrect will produce an instant failure;
   2.356 -    # we should not go on looking
   2.357 -    { $as_echo "$as_me:${as_lineno-$LINENO}: The path given by --with-tools-dir does not contain a valid Visual Studio installation" >&5
   2.358 -$as_echo "$as_me: The path given by --with-tools-dir does not contain a valid Visual Studio installation" >&6;}
   2.359 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Please point to the VC/bin directory within the Visual Studio installation" >&5
   2.360 -$as_echo "$as_me: Please point to the VC/bin directory within the Visual Studio installation" >&6;}
   2.361 -    as_fn_error $? "Cannot locate a valid Visual Studio installation" "$LINENO" 5
   2.362 -  fi
   2.363 -
   2.364 -  if test "x$VS100COMNTOOLS" != x; then
   2.365 +  if test "x$PROGRAMFILES" != x; then
   2.366  
   2.367    if test "x$VS_ENV_CMD" = x; then
   2.368 -    VS100BASE="$VS100COMNTOOLS/../.."
   2.369 -    METHOD="VS100COMNTOOLS variable"
   2.370 -
   2.371 -  windows_path="$VS100BASE"
   2.372 -  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.373 -    unix_path=`$CYGPATH -u "$windows_path"`
   2.374 -    VS100BASE="$unix_path"
   2.375 -  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.376 -    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.377 -    VS100BASE="$unix_path"
   2.378 -  fi
   2.379 -
   2.380 -    if test -d "$VS100BASE"; then
   2.381 -      if test -f "$VS100BASE/$VCVARSFILE"; then
   2.382 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.383 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.384 -        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
   2.385 +    VS_VERSION="${VS_VERSION}"
   2.386 +    VS_BASE="$PROGRAMFILES/$VS_INSTALL_DIR"
   2.387 +    METHOD="well-known name"
   2.388 +
   2.389 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.390 +      VCVARSFILE="vc/bin/vcvars32.bat"
   2.391 +    else
   2.392 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.393 +    fi
   2.394 +
   2.395 +
   2.396 +  windows_path="$VS_BASE"
   2.397 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.398 +    unix_path=`$CYGPATH -u "$windows_path"`
   2.399 +    VS_BASE="$unix_path"
   2.400 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.401 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.402 +    VS_BASE="$unix_path"
   2.403 +  fi
   2.404 +
   2.405 +    if test -d "$VS_BASE"; then
   2.406 +      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.407 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.408 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.409 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.410          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.411          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.412 -        # TODO: improve detection for other versions of VS
   2.413 -        PLATFORM_TOOLSET="v100"
   2.414 -      else
   2.415 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.416 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.417 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.418 +      else
   2.419 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.420 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.421          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.422  $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.423        fi
   2.424 @@ -25304,33 +25495,42 @@
   2.425    fi
   2.426  
   2.427    fi
   2.428 -  if test "x$PROGRAMFILES" != x; then
   2.429 +  # Work around the insanely named ProgramFiles(x86) env variable
   2.430 +  PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
   2.431 +  if test "x$PROGRAMFILES_X86" != x; then
   2.432  
   2.433    if test "x$VS_ENV_CMD" = x; then
   2.434 -    VS100BASE="$PROGRAMFILES/Microsoft Visual Studio 10.0"
   2.435 +    VS_VERSION="${VS_VERSION}"
   2.436 +    VS_BASE="$PROGRAMFILES_X86/$VS_INSTALL_DIR"
   2.437      METHOD="well-known name"
   2.438  
   2.439 -  windows_path="$VS100BASE"
   2.440 -  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.441 -    unix_path=`$CYGPATH -u "$windows_path"`
   2.442 -    VS100BASE="$unix_path"
   2.443 -  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.444 -    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.445 -    VS100BASE="$unix_path"
   2.446 -  fi
   2.447 -
   2.448 -    if test -d "$VS100BASE"; then
   2.449 -      if test -f "$VS100BASE/$VCVARSFILE"; then
   2.450 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.451 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.452 -        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
   2.453 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.454 +      VCVARSFILE="vc/bin/vcvars32.bat"
   2.455 +    else
   2.456 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.457 +    fi
   2.458 +
   2.459 +
   2.460 +  windows_path="$VS_BASE"
   2.461 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.462 +    unix_path=`$CYGPATH -u "$windows_path"`
   2.463 +    VS_BASE="$unix_path"
   2.464 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.465 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.466 +    VS_BASE="$unix_path"
   2.467 +  fi
   2.468 +
   2.469 +    if test -d "$VS_BASE"; then
   2.470 +      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.471 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.472 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.473 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.474          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.475          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.476 -        # TODO: improve detection for other versions of VS
   2.477 -        PLATFORM_TOOLSET="v100"
   2.478 -      else
   2.479 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.480 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.481 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.482 +      else
   2.483 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.484 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.485          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.486  $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.487        fi
   2.488 @@ -25340,30 +25540,37 @@
   2.489    fi
   2.490  
   2.491    if test "x$VS_ENV_CMD" = x; then
   2.492 -    VS100BASE="C:/Program Files/Microsoft Visual Studio 10.0"
   2.493 +    VS_VERSION="${VS_VERSION}"
   2.494 +    VS_BASE="C:/Program Files/$VS_INSTALL_DIR"
   2.495      METHOD="well-known name"
   2.496  
   2.497 -  windows_path="$VS100BASE"
   2.498 -  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.499 -    unix_path=`$CYGPATH -u "$windows_path"`
   2.500 -    VS100BASE="$unix_path"
   2.501 -  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.502 -    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.503 -    VS100BASE="$unix_path"
   2.504 -  fi
   2.505 -
   2.506 -    if test -d "$VS100BASE"; then
   2.507 -      if test -f "$VS100BASE/$VCVARSFILE"; then
   2.508 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.509 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.510 -        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
   2.511 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.512 +      VCVARSFILE="vc/bin/vcvars32.bat"
   2.513 +    else
   2.514 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.515 +    fi
   2.516 +
   2.517 +
   2.518 +  windows_path="$VS_BASE"
   2.519 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.520 +    unix_path=`$CYGPATH -u "$windows_path"`
   2.521 +    VS_BASE="$unix_path"
   2.522 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.523 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.524 +    VS_BASE="$unix_path"
   2.525 +  fi
   2.526 +
   2.527 +    if test -d "$VS_BASE"; then
   2.528 +      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.529 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.530 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.531 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.532          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.533          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.534 -        # TODO: improve detection for other versions of VS
   2.535 -        PLATFORM_TOOLSET="v100"
   2.536 -      else
   2.537 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.538 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.539 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.540 +      else
   2.541 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.542 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.543          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.544  $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.545        fi
   2.546 @@ -25372,30 +25579,37 @@
   2.547  
   2.548  
   2.549    if test "x$VS_ENV_CMD" = x; then
   2.550 -    VS100BASE="C:/Program Files (x86)/Microsoft Visual Studio 10.0"
   2.551 +    VS_VERSION="${VS_VERSION}"
   2.552 +    VS_BASE="C:/Program Files (x86)/$VS_INSTALL_DIR"
   2.553      METHOD="well-known name"
   2.554  
   2.555 -  windows_path="$VS100BASE"
   2.556 -  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.557 -    unix_path=`$CYGPATH -u "$windows_path"`
   2.558 -    VS100BASE="$unix_path"
   2.559 -  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.560 -    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.561 -    VS100BASE="$unix_path"
   2.562 -  fi
   2.563 -
   2.564 -    if test -d "$VS100BASE"; then
   2.565 -      if test -f "$VS100BASE/$VCVARSFILE"; then
   2.566 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.567 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.568 -        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
   2.569 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.570 +      VCVARSFILE="vc/bin/vcvars32.bat"
   2.571 +    else
   2.572 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.573 +    fi
   2.574 +
   2.575 +
   2.576 +  windows_path="$VS_BASE"
   2.577 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.578 +    unix_path=`$CYGPATH -u "$windows_path"`
   2.579 +    VS_BASE="$unix_path"
   2.580 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.581 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
   2.582 +    VS_BASE="$unix_path"
   2.583 +  fi
   2.584 +
   2.585 +    if test -d "$VS_BASE"; then
   2.586 +      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.587 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.588 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.589 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.590          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.591          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.592 -        # TODO: improve detection for other versions of VS
   2.593 -        PLATFORM_TOOLSET="v100"
   2.594 -      else
   2.595 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS100BASE using $METHOD" >&5
   2.596 -$as_echo "$as_me: Found Visual Studio installation at $VS100BASE using $METHOD" >&6;}
   2.597 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.598 +      else
   2.599 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.600 +$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.601          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.602  $as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.603        fi
   2.604 @@ -25403,10 +25617,12 @@
   2.605    fi
   2.606  
   2.607  
   2.608 -  if test "x$ProgramW6432" != x; then
   2.609 +  if test "x$SDK_INSTALL_DIR" != x; then
   2.610 +    if test "x$ProgramW6432" != x; then
   2.611  
   2.612    if test "x$VS_ENV_CMD" = x; then
   2.613 -    WIN_SDK_BASE="$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin"
   2.614 +    VS_VERSION="${VS_VERSION}"
   2.615 +    WIN_SDK_BASE="$ProgramW6432/$SDK_INSTALL_DIR"
   2.616      METHOD="well-known name"
   2.617  
   2.618    windows_path="$WIN_SDK_BASE"
   2.619 @@ -25421,15 +25637,15 @@
   2.620      if test -d "$WIN_SDK_BASE"; then
   2.621        # There have been cases of partial or broken SDK installations. A missing
   2.622        # lib dir is not going to work.
   2.623 -      if test ! -d "$WIN_SDK_BASE/../lib"; then
   2.624 +      if test ! -d "$WIN_SDK_BASE/lib"; then
   2.625          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.626  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.627          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
   2.628  $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
   2.629 -      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
   2.630 +      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
   2.631          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.632  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.633 -        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
   2.634 +        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
   2.635          if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.636            VS_ENV_ARGS="/x86"
   2.637          else
   2.638 @@ -25438,7 +25654,7 @@
   2.639          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.640          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
   2.641          # TODO: improve detection for other versions of SDK
   2.642 -        PLATFORM_TOOLSET="Windows7.1SDK"
   2.643 +        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
   2.644        else
   2.645          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.646  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.647 @@ -25448,11 +25664,12 @@
   2.648      fi
   2.649    fi
   2.650  
   2.651 -  fi
   2.652 -  if test "x$PROGRAMW6432" != x; then
   2.653 +    fi
   2.654 +    if test "x$PROGRAMW6432" != x; then
   2.655  
   2.656    if test "x$VS_ENV_CMD" = x; then
   2.657 -    WIN_SDK_BASE="$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin"
   2.658 +    VS_VERSION="${VS_VERSION}"
   2.659 +    WIN_SDK_BASE="$PROGRAMW6432/$SDK_INSTALL_DIR"
   2.660      METHOD="well-known name"
   2.661  
   2.662    windows_path="$WIN_SDK_BASE"
   2.663 @@ -25467,15 +25684,15 @@
   2.664      if test -d "$WIN_SDK_BASE"; then
   2.665        # There have been cases of partial or broken SDK installations. A missing
   2.666        # lib dir is not going to work.
   2.667 -      if test ! -d "$WIN_SDK_BASE/../lib"; then
   2.668 +      if test ! -d "$WIN_SDK_BASE/lib"; then
   2.669          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.670  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.671          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
   2.672  $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
   2.673 -      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
   2.674 +      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
   2.675          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.676  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.677 -        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
   2.678 +        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
   2.679          if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.680            VS_ENV_ARGS="/x86"
   2.681          else
   2.682 @@ -25484,7 +25701,7 @@
   2.683          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.684          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
   2.685          # TODO: improve detection for other versions of SDK
   2.686 -        PLATFORM_TOOLSET="Windows7.1SDK"
   2.687 +        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
   2.688        else
   2.689          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.690  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.691 @@ -25494,11 +25711,12 @@
   2.692      fi
   2.693    fi
   2.694  
   2.695 -  fi
   2.696 -  if test "x$PROGRAMFILES" != x; then
   2.697 +    fi
   2.698 +    if test "x$PROGRAMFILES" != x; then
   2.699  
   2.700    if test "x$VS_ENV_CMD" = x; then
   2.701 -    WIN_SDK_BASE="$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin"
   2.702 +    VS_VERSION="${VS_VERSION}"
   2.703 +    WIN_SDK_BASE="$PROGRAMFILES/$SDK_INSTALL_DIR"
   2.704      METHOD="well-known name"
   2.705  
   2.706    windows_path="$WIN_SDK_BASE"
   2.707 @@ -25513,15 +25731,15 @@
   2.708      if test -d "$WIN_SDK_BASE"; then
   2.709        # There have been cases of partial or broken SDK installations. A missing
   2.710        # lib dir is not going to work.
   2.711 -      if test ! -d "$WIN_SDK_BASE/../lib"; then
   2.712 +      if test ! -d "$WIN_SDK_BASE/lib"; then
   2.713          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.714  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.715          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
   2.716  $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
   2.717 -      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
   2.718 +      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
   2.719          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.720  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.721 -        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
   2.722 +        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
   2.723          if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.724            VS_ENV_ARGS="/x86"
   2.725          else
   2.726 @@ -25530,7 +25748,7 @@
   2.727          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.728          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
   2.729          # TODO: improve detection for other versions of SDK
   2.730 -        PLATFORM_TOOLSET="Windows7.1SDK"
   2.731 +        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
   2.732        else
   2.733          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.734  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.735 @@ -25540,10 +25758,11 @@
   2.736      fi
   2.737    fi
   2.738  
   2.739 -  fi
   2.740 +    fi
   2.741  
   2.742    if test "x$VS_ENV_CMD" = x; then
   2.743 -    WIN_SDK_BASE="C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin"
   2.744 +    VS_VERSION="${VS_VERSION}"
   2.745 +    WIN_SDK_BASE="C:/Program Files/$SDK_INSTALL_DIR"
   2.746      METHOD="well-known name"
   2.747  
   2.748    windows_path="$WIN_SDK_BASE"
   2.749 @@ -25558,15 +25777,15 @@
   2.750      if test -d "$WIN_SDK_BASE"; then
   2.751        # There have been cases of partial or broken SDK installations. A missing
   2.752        # lib dir is not going to work.
   2.753 -      if test ! -d "$WIN_SDK_BASE/../lib"; then
   2.754 +      if test ! -d "$WIN_SDK_BASE/lib"; then
   2.755          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.756  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.757          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
   2.758  $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
   2.759 -      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
   2.760 +      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
   2.761          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.762  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.763 -        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
   2.764 +        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
   2.765          if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.766            VS_ENV_ARGS="/x86"
   2.767          else
   2.768 @@ -25575,7 +25794,7 @@
   2.769          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.770          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
   2.771          # TODO: improve detection for other versions of SDK
   2.772 -        PLATFORM_TOOLSET="Windows7.1SDK"
   2.773 +        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
   2.774        else
   2.775          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.776  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.777 @@ -25587,7 +25806,8 @@
   2.778  
   2.779  
   2.780    if test "x$VS_ENV_CMD" = x; then
   2.781 -    WIN_SDK_BASE="C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin"
   2.782 +    VS_VERSION="${VS_VERSION}"
   2.783 +    WIN_SDK_BASE="C:/Program Files (x86)/$SDK_INSTALL_DIR"
   2.784      METHOD="well-known name"
   2.785  
   2.786    windows_path="$WIN_SDK_BASE"
   2.787 @@ -25602,15 +25822,15 @@
   2.788      if test -d "$WIN_SDK_BASE"; then
   2.789        # There have been cases of partial or broken SDK installations. A missing
   2.790        # lib dir is not going to work.
   2.791 -      if test ! -d "$WIN_SDK_BASE/../lib"; then
   2.792 +      if test ! -d "$WIN_SDK_BASE/lib"; then
   2.793          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.794  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.795          { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: Installation is broken, lib dir is missing. Ignoring" >&5
   2.796  $as_echo "$as_me: Warning: Installation is broken, lib dir is missing. Ignoring" >&6;}
   2.797 -      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
   2.798 +      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
   2.799          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.800  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.801 -        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
   2.802 +        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
   2.803          if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.804            VS_ENV_ARGS="/x86"
   2.805          else
   2.806 @@ -25619,7 +25839,7 @@
   2.807          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.808          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
   2.809          # TODO: improve detection for other versions of SDK
   2.810 -        PLATFORM_TOOLSET="Windows7.1SDK"
   2.811 +        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
   2.812        else
   2.813          { $as_echo "$as_me:${as_lineno-$LINENO}: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&5
   2.814  $as_echo "$as_me: Found Windows SDK installation at $WIN_SDK_BASE using $METHOD" >&6;}
   2.815 @@ -25629,6 +25849,21 @@
   2.816      fi
   2.817    fi
   2.818  
   2.819 +  fi
   2.820 +
   2.821 +    if test "x$VS_ENV_CMD" != x; then
   2.822 +      TOOLCHAIN_VERSION=$VS_VERSION
   2.823 +      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
   2.824 +      eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
   2.825 +      eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
   2.826 +      eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
   2.827 +      # The rest of the variables are already evaled while probing
   2.828 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found $VS_DESCRIPTION" >&5
   2.829 +$as_echo "$as_me: Found $VS_DESCRIPTION" >&6;}
   2.830 +      break
   2.831 +    fi
   2.832 +  done
   2.833 +
   2.834  
   2.835    if test "x$VS_ENV_CMD" != x; then
   2.836      # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
   2.837 @@ -39483,8 +39718,8 @@
   2.838      CC_VERSION_OUTPUT=`$CC 2>&1 | $HEAD -n 1 | $TR -d '\r'`
   2.839      COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
   2.840      if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
   2.841 -      if test "x$COMPILER_CPU_TEST" != "x80x86"; then
   2.842 -        as_fn_error $? "Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for \"$COMPILER_CPU_TEST\"; expected \"80x86\"." "$LINENO" 5
   2.843 +      if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then
   2.844 +        as_fn_error $? "Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for \"$COMPILER_CPU_TEST\"; expected \"80x86\" or \"x86\"." "$LINENO" 5
   2.845        fi
   2.846      elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
   2.847        if test "x$COMPILER_CPU_TEST" != "xx64"; then
   2.848 @@ -41123,15 +41358,23 @@
   2.849      CFLAGS_JDK="$CFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   2.850      CXXFLAGS_JDK="$CXXFLAGS_JDK -D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
   2.851    elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
   2.852 -    CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
   2.853 -    -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB -DWIN32_LEAN_AND_MEAN \
   2.854 -    -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
   2.855 -    -DWIN32 -DIAL"
   2.856 +    CCXXFLAGS_JDK="$CCXXFLAGS $CCXXFLAGS_JDK \
   2.857 +        -Zi -MD -Zc:wchar_t- -W3 -wd4800 \
   2.858 +        -DWIN32_LEAN_AND_MEAN \
   2.859 +        -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE \
   2.860 +        -DWIN32 -DIAL"
   2.861      if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
   2.862        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_AMD64_ -Damd64"
   2.863      else
   2.864        CCXXFLAGS_JDK="$CCXXFLAGS_JDK -D_X86_ -Dx86"
   2.865      fi
   2.866 +    # If building with Visual Studio 2010, we can still use _STATIC_CPPLIB to
   2.867 +    # avoid bundling msvcpNNN.dll. Doesn't work with newer versions of visual
   2.868 +    # studio.
   2.869 +    if test "x$TOOLCHAIN_VERSION" = "x2010"; then
   2.870 +      CXXFLAGS_JDK="$CXXFLAGS_JDK \
   2.871 +          -D_STATIC_CPPLIB -D_DISABLE_DEPRECATE_STATIC_CPPLIB"
   2.872 +    fi
   2.873    fi
   2.874  
   2.875    ###############################################################################
   2.876 @@ -47772,16 +48015,17 @@
   2.877    if test "x$with_msvcr_dll" != x; then
   2.878      # If given explicitely by user, do not probe. If not present, fail directly.
   2.879  
   2.880 -  POSSIBLE_MSVCR_DLL="$with_msvcr_dll"
   2.881 +  DLL_NAME="$DLL_NAME"
   2.882 +  POSSIBLE_MSVC_DLL="$with_msvcr_dll"
   2.883    METHOD="--with-msvcr-dll"
   2.884 -  if test -e "$POSSIBLE_MSVCR_DLL"; then
   2.885 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
   2.886 -$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
   2.887 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
   2.888 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
   2.889 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
   2.890  
   2.891      # Need to check if the found msvcr is correct architecture
   2.892 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
   2.893 -$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
   2.894 -    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
   2.895 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
   2.896 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
   2.897 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
   2.898      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.899        # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
   2.900        # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
   2.901 @@ -47797,28 +48041,32 @@
   2.902          CORRECT_MSVCR_ARCH=x86-64
   2.903        fi
   2.904      fi
   2.905 -    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
   2.906 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
   2.907        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
   2.908  $as_echo "ok" >&6; }
   2.909 -      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
   2.910 -      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
   2.911 -$as_echo_n "checking for msvcr100.dll... " >&6; }
   2.912 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
   2.913 -$as_echo "$MSVCR_DLL" >&6; }
   2.914 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
   2.915 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
   2.916 +$as_echo_n "checking for $DLL_NAME... " >&6; }
   2.917 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
   2.918 +$as_echo "$MSVC_DLL" >&6; }
   2.919      else
   2.920        { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
   2.921  $as_echo "incorrect, ignoring" >&6; }
   2.922 -      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
   2.923 -$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
   2.924 -    fi
   2.925 -  fi
   2.926 -
   2.927 -    if test "x$MSVCR_DLL" = x; then
   2.928 -      as_fn_error $? "Could not find a proper msvcr100.dll as specified by --with-msvcr-dll" "$LINENO" 5
   2.929 -    fi
   2.930 -  fi
   2.931 -
   2.932 -  if test "x$MSVCR_DLL" = x; then
   2.933 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
   2.934 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
   2.935 +    fi
   2.936 +  fi
   2.937 +
   2.938 +    if test "x$MSVC_DLL" = x; then
   2.939 +      as_fn_error $? "Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll" "$LINENO" 5
   2.940 +    fi
   2.941 +  else
   2.942 +
   2.943 +  VAR_NAME="MSVCR_DLL"
   2.944 +  DLL_NAME="${MSVCR_NAME}"
   2.945 +  MSVC_DLL=
   2.946 +
   2.947 +  if test "x$MSVC_DLL" = x; then
   2.948      # Probe: Using well-known location from Visual Studio 10.0
   2.949      if test "x$VCINSTALLDIR" != x; then
   2.950        CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
   2.951 @@ -47833,21 +48081,23 @@
   2.952    fi
   2.953  
   2.954        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   2.955 -        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
   2.956 -      else
   2.957 -        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
   2.958 -      fi
   2.959 -
   2.960 -  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
   2.961 +        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.962 +      else
   2.963 +        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.964 +      fi
   2.965 +      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
   2.966 +
   2.967 +  DLL_NAME="$DLL_NAME"
   2.968 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
   2.969    METHOD="well-known location in VCINSTALLDIR"
   2.970 -  if test -e "$POSSIBLE_MSVCR_DLL"; then
   2.971 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
   2.972 -$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
   2.973 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
   2.974 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
   2.975 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
   2.976  
   2.977      # Need to check if the found msvcr is correct architecture
   2.978 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
   2.979 -$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
   2.980 -    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
   2.981 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
   2.982 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
   2.983 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
   2.984      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   2.985        # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
   2.986        # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
   2.987 @@ -47863,39 +48113,40 @@
   2.988          CORRECT_MSVCR_ARCH=x86-64
   2.989        fi
   2.990      fi
   2.991 -    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
   2.992 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
   2.993        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
   2.994  $as_echo "ok" >&6; }
   2.995 -      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
   2.996 -      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
   2.997 -$as_echo_n "checking for msvcr100.dll... " >&6; }
   2.998 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
   2.999 -$as_echo "$MSVCR_DLL" >&6; }
  2.1000 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1001 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1002 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1003 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1004 +$as_echo "$MSVC_DLL" >&6; }
  2.1005      else
  2.1006        { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1007  $as_echo "incorrect, ignoring" >&6; }
  2.1008 -      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
  2.1009 -$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
  2.1010 -    fi
  2.1011 -  fi
  2.1012 -
  2.1013 -    fi
  2.1014 -  fi
  2.1015 -
  2.1016 -  if test "x$MSVCR_DLL" = x; then
  2.1017 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1018 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1019 +    fi
  2.1020 +  fi
  2.1021 +
  2.1022 +    fi
  2.1023 +  fi
  2.1024 +
  2.1025 +  if test "x$MSVC_DLL" = x; then
  2.1026      # Probe: Check in the Boot JDK directory.
  2.1027 -    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
  2.1028 -
  2.1029 -  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
  2.1030 +    POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
  2.1031 +
  2.1032 +  DLL_NAME="$DLL_NAME"
  2.1033 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1034    METHOD="well-known location in Boot JDK"
  2.1035 -  if test -e "$POSSIBLE_MSVCR_DLL"; then
  2.1036 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
  2.1037 -$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
  2.1038 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1039 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1040 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1041  
  2.1042      # Need to check if the found msvcr is correct architecture
  2.1043 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
  2.1044 -$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
  2.1045 -    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
  2.1046 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1047 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1048 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1049      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1050        # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1051        # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1052 @@ -47911,25 +48162,25 @@
  2.1053          CORRECT_MSVCR_ARCH=x86-64
  2.1054        fi
  2.1055      fi
  2.1056 -    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1057 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1058        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1059  $as_echo "ok" >&6; }
  2.1060 -      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
  2.1061 -      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
  2.1062 -$as_echo_n "checking for msvcr100.dll... " >&6; }
  2.1063 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
  2.1064 -$as_echo "$MSVCR_DLL" >&6; }
  2.1065 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1066 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1067 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1068 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1069 +$as_echo "$MSVC_DLL" >&6; }
  2.1070      else
  2.1071        { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1072  $as_echo "incorrect, ignoring" >&6; }
  2.1073 -      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
  2.1074 -$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
  2.1075 -    fi
  2.1076 -  fi
  2.1077 -
  2.1078 -  fi
  2.1079 -
  2.1080 -  if test "x$MSVCR_DLL" = x; then
  2.1081 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1082 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1083 +    fi
  2.1084 +  fi
  2.1085 +
  2.1086 +  fi
  2.1087 +
  2.1088 +  if test "x$MSVC_DLL" = x; then
  2.1089      # Probe: Look in the Windows system32 directory
  2.1090      CYGWIN_SYSTEMROOT="$SYSTEMROOT"
  2.1091  
  2.1092 @@ -47942,18 +48193,19 @@
  2.1093      CYGWIN_SYSTEMROOT="$unix_path"
  2.1094    fi
  2.1095  
  2.1096 -    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
  2.1097 -
  2.1098 -  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
  2.1099 +    POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
  2.1100 +
  2.1101 +  DLL_NAME="$DLL_NAME"
  2.1102 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1103    METHOD="well-known location in SYSTEMROOT"
  2.1104 -  if test -e "$POSSIBLE_MSVCR_DLL"; then
  2.1105 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
  2.1106 -$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
  2.1107 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1108 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1109 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1110  
  2.1111      # Need to check if the found msvcr is correct architecture
  2.1112 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
  2.1113 -$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
  2.1114 -    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
  2.1115 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1116 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1117 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1118      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1119        # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1120        # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1121 @@ -47969,25 +48221,25 @@
  2.1122          CORRECT_MSVCR_ARCH=x86-64
  2.1123        fi
  2.1124      fi
  2.1125 -    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1126 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1127        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1128  $as_echo "ok" >&6; }
  2.1129 -      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
  2.1130 -      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
  2.1131 -$as_echo_n "checking for msvcr100.dll... " >&6; }
  2.1132 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
  2.1133 -$as_echo "$MSVCR_DLL" >&6; }
  2.1134 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1135 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1136 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1137 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1138 +$as_echo "$MSVC_DLL" >&6; }
  2.1139      else
  2.1140        { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1141  $as_echo "incorrect, ignoring" >&6; }
  2.1142 -      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
  2.1143 -$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
  2.1144 -    fi
  2.1145 -  fi
  2.1146 -
  2.1147 -  fi
  2.1148 -
  2.1149 -  if test "x$MSVCR_DLL" = x; then
  2.1150 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1151 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1152 +    fi
  2.1153 +  fi
  2.1154 +
  2.1155 +  fi
  2.1156 +
  2.1157 +  if test "x$MSVC_DLL" = x; then
  2.1158      # Probe: If Visual Studio Express is installed, there is usually one with the debugger
  2.1159      if test "x$VS100COMNTOOLS" != x; then
  2.1160        CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
  2.1161 @@ -48002,21 +48254,24 @@
  2.1162    fi
  2.1163  
  2.1164        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
  2.1165 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
  2.1166 -      else
  2.1167 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
  2.1168 -      fi
  2.1169 -
  2.1170 -  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
  2.1171 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
  2.1172 +            | $GREP -i /x64/ | $HEAD --lines 1`
  2.1173 +      else
  2.1174 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
  2.1175 +            | $GREP -i /x86/ | $HEAD --lines 1`
  2.1176 +      fi
  2.1177 +
  2.1178 +  DLL_NAME="$DLL_NAME"
  2.1179 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1180    METHOD="search of VS100COMNTOOLS"
  2.1181 -  if test -e "$POSSIBLE_MSVCR_DLL"; then
  2.1182 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
  2.1183 -$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
  2.1184 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1185 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1186 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1187  
  2.1188      # Need to check if the found msvcr is correct architecture
  2.1189 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
  2.1190 -$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
  2.1191 -    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
  2.1192 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1193 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1194 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1195      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1196        # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1197        # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1198 @@ -48032,50 +48287,54 @@
  2.1199          CORRECT_MSVCR_ARCH=x86-64
  2.1200        fi
  2.1201      fi
  2.1202 -    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1203 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1204        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1205  $as_echo "ok" >&6; }
  2.1206 -      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
  2.1207 -      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
  2.1208 -$as_echo_n "checking for msvcr100.dll... " >&6; }
  2.1209 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
  2.1210 -$as_echo "$MSVCR_DLL" >&6; }
  2.1211 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1212 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1213 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1214 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1215 +$as_echo "$MSVC_DLL" >&6; }
  2.1216      else
  2.1217        { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1218  $as_echo "incorrect, ignoring" >&6; }
  2.1219 -      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
  2.1220 -$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
  2.1221 -    fi
  2.1222 -  fi
  2.1223 -
  2.1224 -    fi
  2.1225 -  fi
  2.1226 -
  2.1227 -  if test "x$MSVCR_DLL" = x; then
  2.1228 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1229 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1230 +    fi
  2.1231 +  fi
  2.1232 +
  2.1233 +    fi
  2.1234 +  fi
  2.1235 +
  2.1236 +  if test "x$MSVC_DLL" = x; then
  2.1237      # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
  2.1238 -    # (This was the original behaviour; kept since it might turn up something)
  2.1239 +    # (This was the original behaviour; kept since it might turn something up)
  2.1240      if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
  2.1241        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
  2.1242 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
  2.1243 -      else
  2.1244 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
  2.1245 -        if test "x$POSSIBLE_MSVCR_DLL" = x; then
  2.1246 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
  2.1247 +          | $GREP x64 | $HEAD --lines 1`
  2.1248 +      else
  2.1249 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
  2.1250 +          | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
  2.1251 +        if test "x$POSSIBLE_MSVC_DLL" = x; then
  2.1252            # We're grasping at straws now...
  2.1253 -          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
  2.1254 -        fi
  2.1255 -      fi
  2.1256 -
  2.1257 -
  2.1258 -  POSSIBLE_MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
  2.1259 +          POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
  2.1260 +              | $HEAD --lines 1`
  2.1261 +        fi
  2.1262 +      fi
  2.1263 +
  2.1264 +
  2.1265 +  DLL_NAME="$DLL_NAME"
  2.1266 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1267    METHOD="search of VCINSTALLDIR"
  2.1268 -  if test -e "$POSSIBLE_MSVCR_DLL"; then
  2.1269 -    { $as_echo "$as_me:${as_lineno-$LINENO}: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&5
  2.1270 -$as_echo "$as_me: Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD" >&6;}
  2.1271 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1272 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1273 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1274  
  2.1275      # Need to check if the found msvcr is correct architecture
  2.1276 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found msvcr100.dll architecture" >&5
  2.1277 -$as_echo_n "checking found msvcr100.dll architecture... " >&6; }
  2.1278 -    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
  2.1279 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1280 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1281 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1282      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1283        # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1284        # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1285 @@ -48091,33 +48350,34 @@
  2.1286          CORRECT_MSVCR_ARCH=x86-64
  2.1287        fi
  2.1288      fi
  2.1289 -    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1290 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1291        { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1292  $as_echo "ok" >&6; }
  2.1293 -      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
  2.1294 -      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
  2.1295 -$as_echo_n "checking for msvcr100.dll... " >&6; }
  2.1296 -      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVCR_DLL" >&5
  2.1297 -$as_echo "$MSVCR_DLL" >&6; }
  2.1298 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1299 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1300 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1301 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1302 +$as_echo "$MSVC_DLL" >&6; }
  2.1303      else
  2.1304        { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1305  $as_echo "incorrect, ignoring" >&6; }
  2.1306 -      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&5
  2.1307 -$as_echo "$as_me: The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE" >&6;}
  2.1308 -    fi
  2.1309 -  fi
  2.1310 -
  2.1311 -    fi
  2.1312 -  fi
  2.1313 -
  2.1314 -  if test "x$MSVCR_DLL" = x; then
  2.1315 -    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for msvcr100.dll" >&5
  2.1316 -$as_echo_n "checking for msvcr100.dll... " >&6; }
  2.1317 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1318 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1319 +    fi
  2.1320 +  fi
  2.1321 +
  2.1322 +    fi
  2.1323 +  fi
  2.1324 +
  2.1325 +  if test "x$MSVC_DLL" = x; then
  2.1326 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1327 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1328      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  2.1329  $as_echo "no" >&6; }
  2.1330 -    as_fn_error $? "Could not find msvcr100.dll. Please specify using --with-msvcr-dll." "$LINENO" 5
  2.1331 -  fi
  2.1332 -
  2.1333 +    as_fn_error $? "Could not find $DLL_NAME. Please specify using --with-msvcr-dll." "$LINENO" 5
  2.1334 +  fi
  2.1335 +
  2.1336 +  MSVCR_DLL=$MSVC_DLL
  2.1337  
  2.1338    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  2.1339  
  2.1340 @@ -48240,6 +48500,512 @@
  2.1341      MSVCR_DLL="`cd "$path"; $THEPWDCMD -L`"
  2.1342    fi
  2.1343  
  2.1344 +  MSVCR_DLL=$MSVCR_DLL
  2.1345 +
  2.1346 +
  2.1347 +  fi
  2.1348 +
  2.1349 +
  2.1350 +# Check whether --with-msvcp-dll was given.
  2.1351 +if test "${with_msvcp_dll+set}" = set; then :
  2.1352 +  withval=$with_msvcp_dll;
  2.1353 +fi
  2.1354 +
  2.1355 +
  2.1356 +  if test "x$MSVCP_NAME" != "x"; then
  2.1357 +    if test "x$with_msvcp_dll" != x; then
  2.1358 +      # If given explicitely by user, do not probe. If not present, fail directly.
  2.1359 +
  2.1360 +  DLL_NAME="$DLL_NAME"
  2.1361 +  POSSIBLE_MSVC_DLL="$with_msvcp_dll"
  2.1362 +  METHOD="--with-msvcp-dll"
  2.1363 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1364 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1365 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1366 +
  2.1367 +    # Need to check if the found msvcr is correct architecture
  2.1368 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1369 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1370 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1371 +    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1372 +      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1373 +      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1374 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1375 +        CORRECT_MSVCR_ARCH="PE32 executable"
  2.1376 +      else
  2.1377 +        CORRECT_MSVCR_ARCH="PE32+ executable"
  2.1378 +      fi
  2.1379 +    else
  2.1380 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1381 +        CORRECT_MSVCR_ARCH=386
  2.1382 +      else
  2.1383 +        CORRECT_MSVCR_ARCH=x86-64
  2.1384 +      fi
  2.1385 +    fi
  2.1386 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1387 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1388 +$as_echo "ok" >&6; }
  2.1389 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1390 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1391 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1392 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1393 +$as_echo "$MSVC_DLL" >&6; }
  2.1394 +    else
  2.1395 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1396 +$as_echo "incorrect, ignoring" >&6; }
  2.1397 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1398 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1399 +    fi
  2.1400 +  fi
  2.1401 +
  2.1402 +      if test "x$MSVC_DLL" = x; then
  2.1403 +        as_fn_error $? "Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll" "$LINENO" 5
  2.1404 +      fi
  2.1405 +    else
  2.1406 +
  2.1407 +  VAR_NAME="MSVCP_DLL"
  2.1408 +  DLL_NAME="${MSVCP_NAME}"
  2.1409 +  MSVC_DLL=
  2.1410 +
  2.1411 +  if test "x$MSVC_DLL" = x; then
  2.1412 +    # Probe: Using well-known location from Visual Studio 10.0
  2.1413 +    if test "x$VCINSTALLDIR" != x; then
  2.1414 +      CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
  2.1415 +
  2.1416 +  windows_path="$CYGWIN_VC_INSTALL_DIR"
  2.1417 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  2.1418 +    unix_path=`$CYGPATH -u "$windows_path"`
  2.1419 +    CYGWIN_VC_INSTALL_DIR="$unix_path"
  2.1420 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1421 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
  2.1422 +    CYGWIN_VC_INSTALL_DIR="$unix_path"
  2.1423 +  fi
  2.1424 +
  2.1425 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
  2.1426 +        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
  2.1427 +      else
  2.1428 +        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
  2.1429 +      fi
  2.1430 +      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
  2.1431 +
  2.1432 +  DLL_NAME="$DLL_NAME"
  2.1433 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1434 +  METHOD="well-known location in VCINSTALLDIR"
  2.1435 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1436 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1437 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1438 +
  2.1439 +    # Need to check if the found msvcr is correct architecture
  2.1440 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1441 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1442 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1443 +    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1444 +      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1445 +      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1446 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1447 +        CORRECT_MSVCR_ARCH="PE32 executable"
  2.1448 +      else
  2.1449 +        CORRECT_MSVCR_ARCH="PE32+ executable"
  2.1450 +      fi
  2.1451 +    else
  2.1452 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1453 +        CORRECT_MSVCR_ARCH=386
  2.1454 +      else
  2.1455 +        CORRECT_MSVCR_ARCH=x86-64
  2.1456 +      fi
  2.1457 +    fi
  2.1458 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1459 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1460 +$as_echo "ok" >&6; }
  2.1461 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1462 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1463 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1464 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1465 +$as_echo "$MSVC_DLL" >&6; }
  2.1466 +    else
  2.1467 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1468 +$as_echo "incorrect, ignoring" >&6; }
  2.1469 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1470 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1471 +    fi
  2.1472 +  fi
  2.1473 +
  2.1474 +    fi
  2.1475 +  fi
  2.1476 +
  2.1477 +  if test "x$MSVC_DLL" = x; then
  2.1478 +    # Probe: Check in the Boot JDK directory.
  2.1479 +    POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
  2.1480 +
  2.1481 +  DLL_NAME="$DLL_NAME"
  2.1482 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1483 +  METHOD="well-known location in Boot JDK"
  2.1484 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1485 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1486 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1487 +
  2.1488 +    # Need to check if the found msvcr is correct architecture
  2.1489 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1490 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1491 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1492 +    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1493 +      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1494 +      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1495 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1496 +        CORRECT_MSVCR_ARCH="PE32 executable"
  2.1497 +      else
  2.1498 +        CORRECT_MSVCR_ARCH="PE32+ executable"
  2.1499 +      fi
  2.1500 +    else
  2.1501 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1502 +        CORRECT_MSVCR_ARCH=386
  2.1503 +      else
  2.1504 +        CORRECT_MSVCR_ARCH=x86-64
  2.1505 +      fi
  2.1506 +    fi
  2.1507 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1508 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1509 +$as_echo "ok" >&6; }
  2.1510 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1511 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1512 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1513 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1514 +$as_echo "$MSVC_DLL" >&6; }
  2.1515 +    else
  2.1516 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1517 +$as_echo "incorrect, ignoring" >&6; }
  2.1518 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1519 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1520 +    fi
  2.1521 +  fi
  2.1522 +
  2.1523 +  fi
  2.1524 +
  2.1525 +  if test "x$MSVC_DLL" = x; then
  2.1526 +    # Probe: Look in the Windows system32 directory
  2.1527 +    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
  2.1528 +
  2.1529 +  windows_path="$CYGWIN_SYSTEMROOT"
  2.1530 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  2.1531 +    unix_path=`$CYGPATH -u "$windows_path"`
  2.1532 +    CYGWIN_SYSTEMROOT="$unix_path"
  2.1533 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1534 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
  2.1535 +    CYGWIN_SYSTEMROOT="$unix_path"
  2.1536 +  fi
  2.1537 +
  2.1538 +    POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
  2.1539 +
  2.1540 +  DLL_NAME="$DLL_NAME"
  2.1541 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1542 +  METHOD="well-known location in SYSTEMROOT"
  2.1543 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1544 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1545 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1546 +
  2.1547 +    # Need to check if the found msvcr is correct architecture
  2.1548 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1549 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1550 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1551 +    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1552 +      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1553 +      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1554 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1555 +        CORRECT_MSVCR_ARCH="PE32 executable"
  2.1556 +      else
  2.1557 +        CORRECT_MSVCR_ARCH="PE32+ executable"
  2.1558 +      fi
  2.1559 +    else
  2.1560 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1561 +        CORRECT_MSVCR_ARCH=386
  2.1562 +      else
  2.1563 +        CORRECT_MSVCR_ARCH=x86-64
  2.1564 +      fi
  2.1565 +    fi
  2.1566 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1567 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1568 +$as_echo "ok" >&6; }
  2.1569 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1570 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1571 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1572 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1573 +$as_echo "$MSVC_DLL" >&6; }
  2.1574 +    else
  2.1575 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1576 +$as_echo "incorrect, ignoring" >&6; }
  2.1577 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1578 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1579 +    fi
  2.1580 +  fi
  2.1581 +
  2.1582 +  fi
  2.1583 +
  2.1584 +  if test "x$MSVC_DLL" = x; then
  2.1585 +    # Probe: If Visual Studio Express is installed, there is usually one with the debugger
  2.1586 +    if test "x$VS100COMNTOOLS" != x; then
  2.1587 +      CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
  2.1588 +
  2.1589 +  windows_path="$CYGWIN_VS_TOOLS_DIR"
  2.1590 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  2.1591 +    unix_path=`$CYGPATH -u "$windows_path"`
  2.1592 +    CYGWIN_VS_TOOLS_DIR="$unix_path"
  2.1593 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1594 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
  2.1595 +    CYGWIN_VS_TOOLS_DIR="$unix_path"
  2.1596 +  fi
  2.1597 +
  2.1598 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
  2.1599 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
  2.1600 +            | $GREP -i /x64/ | $HEAD --lines 1`
  2.1601 +      else
  2.1602 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
  2.1603 +            | $GREP -i /x86/ | $HEAD --lines 1`
  2.1604 +      fi
  2.1605 +
  2.1606 +  DLL_NAME="$DLL_NAME"
  2.1607 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1608 +  METHOD="search of VS100COMNTOOLS"
  2.1609 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1610 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1611 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1612 +
  2.1613 +    # Need to check if the found msvcr is correct architecture
  2.1614 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1615 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1616 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1617 +    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1618 +      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1619 +      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1620 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1621 +        CORRECT_MSVCR_ARCH="PE32 executable"
  2.1622 +      else
  2.1623 +        CORRECT_MSVCR_ARCH="PE32+ executable"
  2.1624 +      fi
  2.1625 +    else
  2.1626 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1627 +        CORRECT_MSVCR_ARCH=386
  2.1628 +      else
  2.1629 +        CORRECT_MSVCR_ARCH=x86-64
  2.1630 +      fi
  2.1631 +    fi
  2.1632 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1633 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1634 +$as_echo "ok" >&6; }
  2.1635 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1636 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1637 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1638 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1639 +$as_echo "$MSVC_DLL" >&6; }
  2.1640 +    else
  2.1641 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1642 +$as_echo "incorrect, ignoring" >&6; }
  2.1643 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1644 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1645 +    fi
  2.1646 +  fi
  2.1647 +
  2.1648 +    fi
  2.1649 +  fi
  2.1650 +
  2.1651 +  if test "x$MSVC_DLL" = x; then
  2.1652 +    # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
  2.1653 +    # (This was the original behaviour; kept since it might turn something up)
  2.1654 +    if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
  2.1655 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
  2.1656 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
  2.1657 +          | $GREP x64 | $HEAD --lines 1`
  2.1658 +      else
  2.1659 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
  2.1660 +          | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
  2.1661 +        if test "x$POSSIBLE_MSVC_DLL" = x; then
  2.1662 +          # We're grasping at straws now...
  2.1663 +          POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
  2.1664 +              | $HEAD --lines 1`
  2.1665 +        fi
  2.1666 +      fi
  2.1667 +
  2.1668 +
  2.1669 +  DLL_NAME="$DLL_NAME"
  2.1670 +  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1671 +  METHOD="search of VCINSTALLDIR"
  2.1672 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
  2.1673 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
  2.1674 +$as_echo "$as_me: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&6;}
  2.1675 +
  2.1676 +    # Need to check if the found msvcr is correct architecture
  2.1677 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking found $DLL_NAME architecture" >&5
  2.1678 +$as_echo_n "checking found $DLL_NAME architecture... " >&6; }
  2.1679 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
  2.1680 +    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1681 +      # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
  2.1682 +      # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
  2.1683 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1684 +        CORRECT_MSVCR_ARCH="PE32 executable"
  2.1685 +      else
  2.1686 +        CORRECT_MSVCR_ARCH="PE32+ executable"
  2.1687 +      fi
  2.1688 +    else
  2.1689 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
  2.1690 +        CORRECT_MSVCR_ARCH=386
  2.1691 +      else
  2.1692 +        CORRECT_MSVCR_ARCH=x86-64
  2.1693 +      fi
  2.1694 +    fi
  2.1695 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
  2.1696 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
  2.1697 +$as_echo "ok" >&6; }
  2.1698 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
  2.1699 +      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1700 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1701 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSVC_DLL" >&5
  2.1702 +$as_echo "$MSVC_DLL" >&6; }
  2.1703 +    else
  2.1704 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: incorrect, ignoring" >&5
  2.1705 +$as_echo "incorrect, ignoring" >&6; }
  2.1706 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&5
  2.1707 +$as_echo "$as_me: The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE" >&6;}
  2.1708 +    fi
  2.1709 +  fi
  2.1710 +
  2.1711 +    fi
  2.1712 +  fi
  2.1713 +
  2.1714 +  if test "x$MSVC_DLL" = x; then
  2.1715 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $DLL_NAME" >&5
  2.1716 +$as_echo_n "checking for $DLL_NAME... " >&6; }
  2.1717 +    { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
  2.1718 +$as_echo "no" >&6; }
  2.1719 +    as_fn_error $? "Could not find $DLL_NAME. Please specify using --with-msvcr-dll." "$LINENO" 5
  2.1720 +  fi
  2.1721 +
  2.1722 +  MSVCP_DLL=$MSVC_DLL
  2.1723 +
  2.1724 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  2.1725 +
  2.1726 +  # Input might be given as Windows format, start by converting to
  2.1727 +  # unix format.
  2.1728 +  path="$MSVCP_DLL"
  2.1729 +  new_path=`$CYGPATH -u "$path"`
  2.1730 +
  2.1731 +  # Cygwin tries to hide some aspects of the Windows file system, such that binaries are
  2.1732 +  # named .exe but called without that suffix. Therefore, "foo" and "foo.exe" are considered
  2.1733 +  # the same file, most of the time (as in "test -f"). But not when running cygpath -s, then
  2.1734 +  # "foo.exe" is OK but "foo" is an error.
  2.1735 +  #
  2.1736 +  # This test is therefore slightly more accurate than "test -f" to check for file precense.
  2.1737 +  # It is also a way to make sure we got the proper file name for the real test later on.
  2.1738 +  test_shortpath=`$CYGPATH -s -m "$new_path" 2> /dev/null`
  2.1739 +  if test "x$test_shortpath" = x; then
  2.1740 +    { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&5
  2.1741 +$as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&6;}
  2.1742 +    as_fn_error $? "Cannot locate the the path of MSVCP_DLL" "$LINENO" 5
  2.1743 +  fi
  2.1744 +
  2.1745 +  # Call helper function which possibly converts this using DOS-style short mode.
  2.1746 +  # If so, the updated path is stored in $new_path.
  2.1747 +
  2.1748 +  input_path="$new_path"
  2.1749 +  # Check if we need to convert this using DOS-style short mode. If the path
  2.1750 +  # contains just simple characters, use it. Otherwise (spaces, weird characters),
  2.1751 +  # take no chances and rewrite it.
  2.1752 +  # Note: m4 eats our [], so we need to use [ and ] instead.
  2.1753 +  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-._/a-zA-Z0-9]`
  2.1754 +  if test "x$has_forbidden_chars" != x; then
  2.1755 +    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
  2.1756 +    shortmode_path=`$CYGPATH -s -m -a "$input_path"`
  2.1757 +    path_after_shortmode=`$CYGPATH -u "$shortmode_path"`
  2.1758 +    if test "x$path_after_shortmode" != "x$input_to_shortpath"; then
  2.1759 +      # Going to short mode and back again did indeed matter. Since short mode is
  2.1760 +      # case insensitive, let's make it lowercase to improve readability.
  2.1761 +      shortmode_path=`$ECHO "$shortmode_path" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  2.1762 +      # Now convert it back to Unix-stile (cygpath)
  2.1763 +      input_path=`$CYGPATH -u "$shortmode_path"`
  2.1764 +      new_path="$input_path"
  2.1765 +    fi
  2.1766 +  fi
  2.1767 +
  2.1768 +  test_cygdrive_prefix=`$ECHO $input_path | $GREP ^/cygdrive/`
  2.1769 +  if test "x$test_cygdrive_prefix" = x; then
  2.1770 +    # As a simple fix, exclude /usr/bin since it's not a real path.
  2.1771 +    if test "x`$ECHO $new_path | $GREP ^/usr/bin/`" = x; then
  2.1772 +      # The path is in a Cygwin special directory (e.g. /home). We need this converted to
  2.1773 +      # a path prefixed by /cygdrive for fixpath to work.
  2.1774 +      new_path="$CYGWIN_ROOT_PATH$input_path"
  2.1775 +    fi
  2.1776 +  fi
  2.1777 +
  2.1778 +
  2.1779 +  if test "x$path" != "x$new_path"; then
  2.1780 +    MSVCP_DLL="$new_path"
  2.1781 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVCP_DLL to \"$new_path\"" >&5
  2.1782 +$as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;}
  2.1783 +  fi
  2.1784 +
  2.1785 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1786 +
  2.1787 +  path="$MSVCP_DLL"
  2.1788 +  has_colon=`$ECHO $path | $GREP ^.:`
  2.1789 +  new_path="$path"
  2.1790 +  if test "x$has_colon" = x; then
  2.1791 +    # Not in mixed or Windows style, start by that.
  2.1792 +    new_path=`cmd //c echo $path`
  2.1793 +  fi
  2.1794 +
  2.1795 +
  2.1796 +  input_path="$new_path"
  2.1797 +  # Check if we need to convert this using DOS-style short mode. If the path
  2.1798 +  # contains just simple characters, use it. Otherwise (spaces, weird characters),
  2.1799 +  # take no chances and rewrite it.
  2.1800 +  # Note: m4 eats our [], so we need to use [ and ] instead.
  2.1801 +  has_forbidden_chars=`$ECHO "$input_path" | $GREP [^-_/:a-zA-Z0-9]`
  2.1802 +  if test "x$has_forbidden_chars" != x; then
  2.1803 +    # Now convert it to mixed DOS-style, short mode (no spaces, and / instead of \)
  2.1804 +    new_path=`cmd /c "for %A in (\"$input_path\") do @echo %~sA"|$TR \\\\\\\\ / | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
  2.1805 +  fi
  2.1806 +
  2.1807 +
  2.1808 +  windows_path="$new_path"
  2.1809 +  if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
  2.1810 +    unix_path=`$CYGPATH -u "$windows_path"`
  2.1811 +    new_path="$unix_path"
  2.1812 +  elif test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
  2.1813 +    unix_path=`$ECHO "$windows_path" | $SED -e 's,^\\(.\\):,/\\1,g' -e 's,\\\\,/,g'`
  2.1814 +    new_path="$unix_path"
  2.1815 +  fi
  2.1816 +
  2.1817 +  if test "x$path" != "x$new_path"; then
  2.1818 +    MSVCP_DLL="$new_path"
  2.1819 +    { $as_echo "$as_me:${as_lineno-$LINENO}: Rewriting MSVCP_DLL to \"$new_path\"" >&5
  2.1820 +$as_echo "$as_me: Rewriting MSVCP_DLL to \"$new_path\"" >&6;}
  2.1821 +  fi
  2.1822 +
  2.1823 +  # Save the first 10 bytes of this path to the storage, so fixpath can work.
  2.1824 +  all_fixpath_prefixes=("${all_fixpath_prefixes[@]}" "${new_path:0:10}")
  2.1825 +
  2.1826 +  else
  2.1827 +    # We're on a posix platform. Hooray! :)
  2.1828 +    path="$MSVCP_DLL"
  2.1829 +    has_space=`$ECHO "$path" | $GREP " "`
  2.1830 +    if test "x$has_space" != x; then
  2.1831 +      { $as_echo "$as_me:${as_lineno-$LINENO}: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&5
  2.1832 +$as_echo "$as_me: The path of MSVCP_DLL, which resolves as \"$path\", is invalid." >&6;}
  2.1833 +      as_fn_error $? "Spaces are not allowed in this path." "$LINENO" 5
  2.1834 +    fi
  2.1835 +
  2.1836 +    # Use eval to expand a potential ~
  2.1837 +    eval path="$path"
  2.1838 +    if test ! -f "$path" && test ! -d "$path"; then
  2.1839 +      as_fn_error $? "The path of MSVCP_DLL, which resolves as \"$path\", is not found." "$LINENO" 5
  2.1840 +    fi
  2.1841 +
  2.1842 +    MSVCP_DLL="`cd "$path"; $THEPWDCMD -L`"
  2.1843 +  fi
  2.1844 +
  2.1845 +  MSVCP_DLL=$MSVCP_DLL
  2.1846 +
  2.1847 +
  2.1848 +    fi
  2.1849 +  fi
  2.1850  
  2.1851  
  2.1852  
  2.1853 @@ -48271,7 +49037,6 @@
  2.1854    fi
  2.1855  
  2.1856  
  2.1857 -
  2.1858  ###############################################################################
  2.1859  #
  2.1860  # We need to do some final tweaking, when everything else is done.
  2.1861 @@ -50419,7 +51184,10 @@
  2.1862      printf "* Environment:    $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n"
  2.1863    fi
  2.1864    printf "* Boot JDK:       $BOOT_JDK_VERSION (at $BOOT_JDK)\n"
  2.1865 -  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n"
  2.1866 +  if test "x$TOOLCHAIN_VERSION" != "x"; then
  2.1867 +    print_version=" $TOOLCHAIN_VERSION"
  2.1868 +  fi
  2.1869 +  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n"
  2.1870    printf "* C Compiler:     Version $CC_VERSION_NUMBER (at $CC)\n"
  2.1871    printf "* C++ Compiler:   Version $CXX_VERSION_NUMBER (at $CXX)\n"
  2.1872  
     3.1 --- a/common/autoconf/help.m4	Fri May 04 11:00:26 2018 +0100
     3.2 +++ b/common/autoconf/help.m4	Wed May 16 15:52:51 2018 -0700
     3.3 @@ -197,7 +197,10 @@
     3.4      printf "* Environment:    $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n"
     3.5    fi
     3.6    printf "* Boot JDK:       $BOOT_JDK_VERSION (at $BOOT_JDK)\n"
     3.7 -  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n"
     3.8 +  if test "x$TOOLCHAIN_VERSION" != "x"; then
     3.9 +    print_version=" $TOOLCHAIN_VERSION"
    3.10 +  fi
    3.11 +  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n" 
    3.12    printf "* C Compiler:     Version $CC_VERSION_NUMBER (at $CC)\n"
    3.13    printf "* C++ Compiler:   Version $CXX_VERSION_NUMBER (at $CXX)\n"
    3.14  
     4.1 --- a/common/autoconf/libraries.m4	Fri May 04 11:00:26 2018 +0100
     4.2 +++ b/common/autoconf/libraries.m4	Wed May 16 15:52:51 2018 -0700
     4.3 @@ -994,10 +994,9 @@
     4.4  AC_DEFUN_ONCE([LIB_SETUP_ON_WINDOWS],
     4.5  [
     4.6    if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
     4.7 -    TOOLCHAIN_SETUP_MSVCR_DLL
     4.8 +    TOOLCHAIN_SETUP_VS_RUNTIME_DLLS
     4.9      BASIC_DEPRECATED_ARG_WITH([dxsdk])
    4.10      BASIC_DEPRECATED_ARG_WITH([dxsdk-lib])
    4.11      BASIC_DEPRECATED_ARG_WITH([dxsdk-include])
    4.12    fi
    4.13 -  AC_SUBST(MSVCR_DLL)
    4.14  ])
     5.1 --- a/common/autoconf/spec.gmk.in	Fri May 04 11:00:26 2018 +0100
     5.2 +++ b/common/autoconf/spec.gmk.in	Wed May 16 15:52:51 2018 -0700
     5.3 @@ -572,6 +572,7 @@
     5.4  USE_EXTERNAL_LIBZ:=@USE_EXTERNAL_LIBZ@
     5.5  LIBZIP_CAN_USE_MMAP:=@LIBZIP_CAN_USE_MMAP@
     5.6  MSVCR_DLL:=@MSVCR_DLL@
     5.7 +MSVCP_DLL:=@MSVCP_DLL@
     5.8  
     5.9  
    5.10  # ADD_SRCS takes a single argument with source roots
     6.1 --- a/common/autoconf/toolchain.m4	Fri May 04 11:00:26 2018 +0100
     6.2 +++ b/common/autoconf/toolchain.m4	Wed May 16 15:52:51 2018 -0700
     6.3 @@ -808,8 +808,8 @@
     6.4      CC_VERSION_OUTPUT=`$CC 2>&1 | $HEAD -n 1 | $TR -d '\r'`
     6.5      COMPILER_CPU_TEST=`$ECHO $CC_VERSION_OUTPUT | $SED -n "s/^.* \(.*\)$/\1/p"`
     6.6      if test "x$OPENJDK_TARGET_CPU" = "xx86"; then
     6.7 -      if test "x$COMPILER_CPU_TEST" != "x80x86"; then
     6.8 -        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86".])
     6.9 +      if test "x$COMPILER_CPU_TEST" != "x80x86" -a "x$COMPILER_CPU_TEST" != "xx86"; then
    6.10 +        AC_MSG_ERROR([Target CPU mismatch. We are building for $OPENJDK_TARGET_CPU but CL is for "$COMPILER_CPU_TEST"; expected "80x86" or "x86".])
    6.11        fi
    6.12      elif test "x$OPENJDK_TARGET_CPU" = "xx86_64"; then
    6.13        if test "x$COMPILER_CPU_TEST" != "xx64"; then
     7.1 --- a/common/autoconf/toolchain_windows.m4	Fri May 04 11:00:26 2018 +0100
     7.2 +++ b/common/autoconf/toolchain_windows.m4	Wed May 16 15:52:51 2018 -0700
     7.3 @@ -1,5 +1,5 @@
     7.4  #
     7.5 -# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
     7.6 +# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     7.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8  #
     7.9  # This code is free software; you can redistribute it and/or modify it
    7.10 @@ -23,43 +23,90 @@
    7.11  # questions.
    7.12  #
    7.13  
    7.14 +################################################################################
    7.15 +
    7.16 +VALID_VS_VERSIONS="2010 2012 2013"
    7.17 +
    7.18 +VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
    7.19 +VS_VERSION_INTERNAL_2010=100
    7.20 +VS_MSVCR_2010=msvcr100.dll
    7.21 +# We don't use msvcp on Visual Studio 2010
    7.22 +#VS_MSVCP_2010=msvcp100.dll
    7.23 +VS_ENVVAR_2010="VS100COMNTOOLS"
    7.24 +VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
    7.25 +VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
    7.26 +VS_VS_PLATFORM_NAME_2010="v100"
    7.27 +VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
    7.28 +
    7.29 +VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
    7.30 +VS_VERSION_INTERNAL_2012=110
    7.31 +VS_MSVCR_2012=msvcr110.dll
    7.32 +VS_MSVCP_2012=msvcp110.dll
    7.33 +VS_ENVVAR_2012="VS110COMNTOOLS"
    7.34 +VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
    7.35 +VS_SDK_INSTALLDIR_2012=
    7.36 +VS_VS_PLATFORM_NAME_2012="v110"
    7.37 +VS_SDK_PLATFORM_NAME_2012=
    7.38 +
    7.39 +VS_DESCRIPTION_2013="Microsoft Visual Studio 2013"
    7.40 +VS_VERSION_INTERNAL_2013=120
    7.41 +VS_MSVCR_2013=msvcr120.dll
    7.42 +VS_MSVCP_2013=msvcp120.dll
    7.43 +VS_ENVVAR_2013="VS120COMNTOOLS"
    7.44 +VS_VS_INSTALLDIR_2013="Microsoft Visual Studio 12.0"
    7.45 +VS_SDK_INSTALLDIR_2013=
    7.46 +VS_VS_PLATFORM_NAME_2013="v120"
    7.47 +VS_SDK_PLATFORM_NAME_2013=
    7.48 +
    7.49 +################################################################################
    7.50 +
    7.51  AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
    7.52  [
    7.53    if test "x$VS_ENV_CMD" = x; then
    7.54 -    VS100BASE="$1"
    7.55 -    METHOD="$2"
    7.56 -    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS100BASE)
    7.57 -    if test -d "$VS100BASE"; then
    7.58 -      if test -f "$VS100BASE/$VCVARSFILE"; then
    7.59 -        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
    7.60 -        VS_ENV_CMD="$VS100BASE/$VCVARSFILE"
    7.61 +    VS_VERSION="$1"
    7.62 +    VS_BASE="$2"
    7.63 +    METHOD="$3"
    7.64 +
    7.65 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
    7.66 +      VCVARSFILE="vc/bin/vcvars32.bat"
    7.67 +    else
    7.68 +      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
    7.69 +    fi
    7.70 +  
    7.71 +    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
    7.72 +    if test -d "$VS_BASE"; then
    7.73 +      if test -f "$VS_BASE/$VCVARSFILE"; then
    7.74 +        AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
    7.75 +        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
    7.76          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
    7.77          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
    7.78 -        # TODO: improve detection for other versions of VS
    7.79 -        PLATFORM_TOOLSET="v100"
    7.80 +        eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
    7.81        else
    7.82 -        AC_MSG_NOTICE([Found Visual Studio installation at $VS100BASE using $METHOD])
    7.83 +        AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
    7.84          AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
    7.85        fi
    7.86      fi
    7.87    fi
    7.88  ])
    7.89  
    7.90 +################################################################################
    7.91 +
    7.92  AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT],
    7.93  [
    7.94    if test "x$VS_ENV_CMD" = x; then
    7.95 -    WIN_SDK_BASE="$1"
    7.96 -    METHOD="$2"
    7.97 +    VS_VERSION="$1"
    7.98 +    WIN_SDK_BASE="$2"
    7.99 +    METHOD="$3"
   7.100      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(WIN_SDK_BASE)
   7.101      if test -d "$WIN_SDK_BASE"; then
   7.102        # There have been cases of partial or broken SDK installations. A missing
   7.103        # lib dir is not going to work.
   7.104 -      if test ! -d "$WIN_SDK_BASE/../lib"; then
   7.105 +      if test ! -d "$WIN_SDK_BASE/lib"; then
   7.106          AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
   7.107          AC_MSG_NOTICE([Warning: Installation is broken, lib dir is missing. Ignoring])
   7.108 -      elif test -f "$WIN_SDK_BASE/SetEnv.Cmd"; then
   7.109 +      elif test -f "$WIN_SDK_BASE/Bin/SetEnv.Cmd"; then
   7.110          AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
   7.111 -        VS_ENV_CMD="$WIN_SDK_BASE/SetEnv.Cmd"
   7.112 +        VS_ENV_CMD="$WIN_SDK_BASE/Bin/SetEnv.Cmd"
   7.113          if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   7.114            VS_ENV_ARGS="/x86"
   7.115          else
   7.116 @@ -68,7 +115,7 @@
   7.117          # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   7.118          # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
   7.119          # TODO: improve detection for other versions of SDK
   7.120 -        PLATFORM_TOOLSET="Windows7.1SDK"
   7.121 +        eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
   7.122        else
   7.123          AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
   7.124          AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
   7.125 @@ -77,50 +124,121 @@
   7.126    fi
   7.127  ])
   7.128  
   7.129 +################################################################################
   7.130 +# Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
   7.131 +# build environment and assigns it to VS_ENV_CMD
   7.132  AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
   7.133  [
   7.134 -  if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   7.135 -    VCVARSFILE="vc/bin/vcvars32.bat"
   7.136 -  else
   7.137 -    VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   7.138 +  VS_VERSION="$1"
   7.139 +  eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
   7.140 +  eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
   7.141 +  eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
   7.142 +  eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
   7.143 +
   7.144 +  # When using --with-tools-dir, assume it points to the correct and default
   7.145 +  # version of Visual Studio or that --with-toolchain-version was also set.
   7.146 +  if test "x$with_tools_dir" != x; then
   7.147 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   7.148 +        [$with_tools_dir/../..], [--with-tools-dir])
   7.149 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   7.150 +        [$with_tools_dir/../../..], [--with-tools-dir])
   7.151 +    if test "x$VS_ENV_CMD" = x; then
   7.152 +      # Having specified an argument which is incorrect will produce an instant failure;
   7.153 +      # we should not go on looking
   7.154 +      AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
   7.155 +      AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
   7.156 +      AC_MSG_NOTICE([directory within the Visual Studio installation])
   7.157 +      AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
   7.158 +    fi
   7.159    fi
   7.160  
   7.161    VS_ENV_CMD=""
   7.162    VS_ENV_ARGS=""
   7.163 -  if test "x$with_toolsdir" != x; then
   7.164 -    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$with_toolsdir/../..], [--with-tools-dir])
   7.165 +
   7.166 +  if test "x$VS_COMNTOOLS" != x; then
   7.167 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   7.168 +        [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
   7.169 +  fi
   7.170 +  if test "x$PROGRAMFILES" != x; then
   7.171 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   7.172 +        [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
   7.173 +  fi
   7.174 +  # Work around the insanely named ProgramFiles(x86) env variable
   7.175 +  PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
   7.176 +  if test "x$PROGRAMFILES_X86" != x; then
   7.177 +    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   7.178 +        [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
   7.179 +  fi
   7.180 +  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   7.181 +      [C:/Program Files/$VS_INSTALL_DIR], [well-known name])
   7.182 +  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   7.183 +      [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])
   7.184 +
   7.185 +  if test "x$SDK_INSTALL_DIR" != x; then
   7.186 +    if test "x$ProgramW6432" != x; then
   7.187 +      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   7.188 +          [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
   7.189 +    fi
   7.190 +    if test "x$PROGRAMW6432" != x; then
   7.191 +      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   7.192 +          [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
   7.193 +    fi
   7.194 +    if test "x$PROGRAMFILES" != x; then
   7.195 +      TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   7.196 +          [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
   7.197 +    fi
   7.198 +    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   7.199 +        [C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
   7.200 +    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
   7.201 +        [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
   7.202 +  fi
   7.203 +])
   7.204 +
   7.205 +################################################################################
   7.206 +
   7.207 +AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
   7.208 +[
   7.209 +  AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
   7.210 +      [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
   7.211 +
   7.212 +  if test "x$with_toolchain_version" = xlist; then
   7.213 +    # List all toolchains
   7.214 +    AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
   7.215 +    for version in $VALID_VS_VERSIONS; do
   7.216 +      eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
   7.217 +      $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
   7.218 +    done
   7.219 +
   7.220 +    exit 0
   7.221 +  elif test "x$with_toolchain_version" != x; then
   7.222 +    # User override; check that it is valid
   7.223 +    if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
   7.224 +      AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
   7.225 +      AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
   7.226 +      AC_MSG_ERROR([Cannot continue.])
   7.227 +    fi
   7.228 +    VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
   7.229 +  else
   7.230 +    # No flag given, use default
   7.231 +    VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
   7.232    fi
   7.233  
   7.234 -  if test "x$with_toolsdir" != x && test "x$VS_ENV_CMD" = x; then
   7.235 -    # Having specified an argument which is incorrect will produce an instant failure;
   7.236 -    # we should not go on looking
   7.237 -    AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid Visual Studio installation])
   7.238 -    AC_MSG_NOTICE([Please point to the VC/bin directory within the Visual Studio installation])
   7.239 -    AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
   7.240 -  fi
   7.241 -
   7.242 -  if test "x$VS100COMNTOOLS" != x; then
   7.243 -    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$VS100COMNTOOLS/../..], [VS100COMNTOOLS variable])
   7.244 -  fi
   7.245 -  if test "x$PROGRAMFILES" != x; then
   7.246 -    TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([$PROGRAMFILES/Microsoft Visual Studio 10.0], [well-known name])
   7.247 -  fi
   7.248 -  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files/Microsoft Visual Studio 10.0], [well-known name])
   7.249 -  TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([C:/Program Files (x86)/Microsoft Visual Studio 10.0], [well-known name])
   7.250 -
   7.251 -  if test "x$ProgramW6432" != x; then
   7.252 -    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$ProgramW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   7.253 -  fi
   7.254 -  if test "x$PROGRAMW6432" != x; then
   7.255 -    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMW6432/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   7.256 -  fi
   7.257 -  if test "x$PROGRAMFILES" != x; then
   7.258 -    TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([$PROGRAMFILES/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   7.259 -  fi
   7.260 -  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   7.261 -  TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1/Bin], [well-known name])
   7.262 +  for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
   7.263 +    TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
   7.264 +    if test "x$VS_ENV_CMD" != x; then
   7.265 +      TOOLCHAIN_VERSION=$VS_VERSION
   7.266 +      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
   7.267 +      eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
   7.268 +      eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
   7.269 +      eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
   7.270 +      # The rest of the variables are already evaled while probing
   7.271 +      AC_MSG_NOTICE([Found $VS_DESCRIPTION])
   7.272 +      break
   7.273 +    fi
   7.274 +  done
   7.275  ])
   7.276  
   7.277 +################################################################################
   7.278  # Check if the VS env variables were setup prior to running configure.
   7.279  # If not, then find vcvarsall.bat and run it automatically, and integrate
   7.280  # the set env variables into the spec file.
   7.281 @@ -142,7 +260,8 @@
   7.282    fi
   7.283  
   7.284    # First-hand choice is to locate and run the vsvars bat file.
   7.285 -  TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE
   7.286 +  TOOLCHAIN_FIND_VISUAL_STUDIO
   7.287 +
   7.288    if test "x$VS_ENV_CMD" != x; then
   7.289      # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
   7.290      BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
   7.291 @@ -242,16 +361,17 @@
   7.292    fi
   7.293  ])
   7.294  
   7.295 -AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
   7.296 +AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
   7.297  [
   7.298 -  POSSIBLE_MSVCR_DLL="$1"
   7.299 -  METHOD="$2"
   7.300 -  if test -e "$POSSIBLE_MSVCR_DLL"; then
   7.301 -    AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
   7.302 -    
   7.303 +  DLL_NAME="$1"
   7.304 +  POSSIBLE_MSVC_DLL="$2"
   7.305 +  METHOD="$3"
   7.306 +  if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
   7.307 +    AC_MSG_NOTICE([Found $1 at $POSSIBLE_MSVC_DLL using $METHOD])
   7.308 +
   7.309      # Need to check if the found msvcr is correct architecture
   7.310 -    AC_MSG_CHECKING([found msvcr100.dll architecture])
   7.311 -    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
   7.312 +    AC_MSG_CHECKING([found $1 architecture])
   7.313 +    MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
   7.314      if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
   7.315        # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
   7.316        # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
   7.317 @@ -267,96 +387,136 @@
   7.318          CORRECT_MSVCR_ARCH=x86-64
   7.319        fi
   7.320      fi
   7.321 -    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
   7.322 +    if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
   7.323        AC_MSG_RESULT([ok])
   7.324 -      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
   7.325 -      AC_MSG_CHECKING([for msvcr100.dll])
   7.326 -      AC_MSG_RESULT([$MSVCR_DLL])
   7.327 +      MSVC_DLL="$POSSIBLE_MSVC_DLL"
   7.328 +      AC_MSG_CHECKING([for $1])
   7.329 +      AC_MSG_RESULT([$MSVC_DLL])
   7.330      else
   7.331        AC_MSG_RESULT([incorrect, ignoring])
   7.332 -      AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
   7.333 +      AC_MSG_NOTICE([The file type of the located $1 is $MSVC_DLL_FILETYPE])
   7.334      fi
   7.335    fi
   7.336  ])
   7.337  
   7.338 -AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
   7.339 +AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
   7.340  [
   7.341 -  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
   7.342 -      [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
   7.343 +  VAR_NAME="$1"
   7.344 +  DLL_NAME="$2"
   7.345 +  MSVC_DLL=
   7.346  
   7.347 -  if test "x$with_msvcr_dll" != x; then
   7.348 -    # If given explicitely by user, do not probe. If not present, fail directly.
   7.349 -    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
   7.350 -    if test "x$MSVCR_DLL" = x; then
   7.351 -      AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
   7.352 -    fi
   7.353 -  fi
   7.354 -  
   7.355 -  if test "x$MSVCR_DLL" = x; then
   7.356 +  if test "x$MSVC_DLL" = x; then
   7.357      # Probe: Using well-known location from Visual Studio 10.0
   7.358      if test "x$VCINSTALLDIR" != x; then
   7.359        CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
   7.360        BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
   7.361        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   7.362 -        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
   7.363 +        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   7.364        else
   7.365 -        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
   7.366 +        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   7.367        fi
   7.368 -      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
   7.369 +      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
   7.370 +        TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   7.371 +            [well-known location in VCINSTALLDIR])
   7.372      fi
   7.373    fi
   7.374  
   7.375 -  if test "x$MSVCR_DLL" = x; then
   7.376 +  if test "x$MSVC_DLL" = x; then
   7.377      # Probe: Check in the Boot JDK directory.
   7.378 -    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
   7.379 -    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
   7.380 +    POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
   7.381 +    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($[DLL_NAME], [$POSSIBLE_MSVC_DLL],
   7.382 +        [well-known location in Boot JDK])
   7.383    fi
   7.384    
   7.385 -  if test "x$MSVCR_DLL" = x; then
   7.386 +  if test "x$MSVC_DLL" = x; then
   7.387      # Probe: Look in the Windows system32 directory 
   7.388      CYGWIN_SYSTEMROOT="$SYSTEMROOT"
   7.389      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
   7.390 -    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
   7.391 -    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
   7.392 +    POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
   7.393 +    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   7.394 +        [well-known location in SYSTEMROOT])
   7.395    fi
   7.396  
   7.397 -  if test "x$MSVCR_DLL" = x; then
   7.398 +  if test "x$MSVC_DLL" = x; then
   7.399      # Probe: If Visual Studio Express is installed, there is usually one with the debugger
   7.400      if test "x$VS100COMNTOOLS" != x; then
   7.401        CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
   7.402        BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
   7.403        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   7.404 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
   7.405 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
   7.406 +            | $GREP -i /x64/ | $HEAD --lines 1`
   7.407        else
   7.408 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
   7.409 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
   7.410 +            | $GREP -i /x86/ | $HEAD --lines 1`
   7.411        fi
   7.412 -      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
   7.413 +      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   7.414 +          [search of VS100COMNTOOLS])
   7.415      fi
   7.416    fi
   7.417        
   7.418 -  if test "x$MSVCR_DLL" = x; then
   7.419 +  if test "x$MSVC_DLL" = x; then
   7.420      # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
   7.421 -    # (This was the original behaviour; kept since it might turn up something)
   7.422 +    # (This was the original behaviour; kept since it might turn something up)
   7.423      if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
   7.424        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   7.425 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
   7.426 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
   7.427 +          | $GREP x64 | $HEAD --lines 1`
   7.428        else
   7.429 -        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
   7.430 -        if test "x$POSSIBLE_MSVCR_DLL" = x; then
   7.431 +        POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
   7.432 +          | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
   7.433 +        if test "x$POSSIBLE_MSVC_DLL" = x; then
   7.434            # We're grasping at straws now...
   7.435 -          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
   7.436 +          POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
   7.437 +              | $HEAD --lines 1`
   7.438          fi
   7.439        fi
   7.440        
   7.441 -      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
   7.442 +      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   7.443 +          [search of VCINSTALLDIR])
   7.444      fi
   7.445    fi
   7.446    
   7.447 -  if test "x$MSVCR_DLL" = x; then
   7.448 -    AC_MSG_CHECKING([for msvcr100.dll])
   7.449 +  if test "x$MSVC_DLL" = x; then
   7.450 +    AC_MSG_CHECKING([for $DLL_NAME])
   7.451      AC_MSG_RESULT([no])
   7.452 -    AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
   7.453 +    AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
   7.454    fi
   7.455  
   7.456 -  BASIC_FIXUP_PATH(MSVCR_DLL)
   7.457 +  $1=$MSVC_DLL
   7.458 +  BASIC_FIXUP_PATH($1)
   7.459 +  AC_SUBST($1, [$]$1)
   7.460  ])
   7.461 +
   7.462 +AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
   7.463 +[
   7.464 +  AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
   7.465 +      [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
   7.466 +
   7.467 +  if test "x$with_msvcr_dll" != x; then
   7.468 +    # If given explicitely by user, do not probe. If not present, fail directly.
   7.469 +    TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcr_dll],
   7.470 +        [--with-msvcr-dll])
   7.471 +    if test "x$MSVC_DLL" = x; then
   7.472 +      AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
   7.473 +    fi
   7.474 +  else
   7.475 +    TOOLCHAIN_SETUP_MSVC_DLL([MSVCR_DLL], [${MSVCR_NAME}])
   7.476 +  fi
   7.477 +
   7.478 +  AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
   7.479 +      [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
   7.480 +
   7.481 +  if test "x$MSVCP_NAME" != "x"; then
   7.482 +    if test "x$with_msvcp_dll" != x; then
   7.483 +      # If given explicitely by user, do not probe. If not present, fail directly.
   7.484 +      TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcp_dll],
   7.485 +          [--with-msvcp-dll])
   7.486 +      if test "x$MSVC_DLL" = x; then
   7.487 +        AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
   7.488 +      fi
   7.489 +    else
   7.490 +      TOOLCHAIN_SETUP_MSVC_DLL([MSVCP_DLL], [${MSVCP_NAME}])
   7.491 +    fi
   7.492 +  fi
   7.493 +])
   7.494 +
     8.1 --- a/make/common/MakeBase.gmk	Fri May 04 11:00:26 2018 +0100
     8.2 +++ b/make/common/MakeBase.gmk	Wed May 16 15:52:51 2018 -0700
     8.3 @@ -446,4 +446,51 @@
     8.4  
     8.5  ################################################################################
     8.6  
     8.7 +define AddFileToCopy
     8.8 +  # Helper macro for SetupCopyFiles
     8.9 +  # 1 : Source file
    8.10 +  # 2 : Dest file
    8.11 +  # 3 : Variable to add targets to
    8.12 +  # 4 : Macro to call for copy operation
    8.13 +  $2: $1
    8.14 +	$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
    8.15 +	$$($$(strip $4))
    8.16 +
    8.17 +  $3 += $2
    8.18 +endef
    8.19 +
    8.20 +define SetupCopyFiles
    8.21 +  # param 1 is for example COPY_MYFILES
    8.22 +  # param 2,3,4,5 are named args.
    8.23 +  #   SRC     : Source root dir (defaults to dir of first file)
    8.24 +  #   DEST    : Dest root dir
    8.25 +  #   FILES   : List of files to copy with absolute paths, or path relative to SRC.
    8.26 +  #             Must be in SRC.
    8.27 +  #   FLATTEN : Set to flatten the directory structure in the DEST dir.
    8.28 +  #   MACRO   : Optionally override the default macro used for making the copy.
    8.29 +  #             Default is 'install-file'
    8.30 +  $(foreach i,2 3 4 5 6, $(if $($i),$1_$(strip $($i)))$(NEWLINE))
    8.31 +  $(call LogSetupMacroEntry,SetupCopyFiles($1),$2,$3,$4,$5,$6)
    8.32 +  $(if $(7),$(error Internal makefile error: Too many arguments to SetupCopyFiles))
    8.33 +
    8.34 +  ifeq ($$($1_MACRO), )
    8.35 +    $1_MACRO := install-file
    8.36 +  endif
    8.37 +
    8.38 +  # Default SRC to the dir of the first file.
    8.39 +  ifeq ($$($1_SRC), )
    8.40 +    $1_SRC := $$(dir $$(firstword $$($1_FILES)))
    8.41 +  endif
    8.42 +
    8.43 +  # Remove any trailing slash from SRC
    8.44 +  $1_SRC := $$(patsubst %/,%,$$($1_SRC))
    8.45 +
    8.46 +  $$(foreach f, $$(patsubst $$($1_SRC)/%,%,$$($1_FILES)), \
    8.47 +      $$(eval $$(call AddFileToCopy, $$($1_SRC)/$$f, \
    8.48 +      $$($1_DEST)/$$(if $$($1_FLATTEN),$$(notdir $$f),$$f), $1, $$($1_MACRO))))
    8.49 +
    8.50 +endef
    8.51 +
    8.52 +################################################################################
    8.53 +
    8.54  endif # _MAKEBASE_GMK

mercurial