8196108: Add build support for VS 2015/2017

Fri, 08 Jun 2018 14:06:17 -0700

author
kevinw
date
Fri, 08 Jun 2018 14:06:17 -0700
changeset 2228
1a5c98aae346
parent 2227
77b81e582939
child 2229
b50838ae1046

8196108: Add build support for VS 2015/2017
Reviewed-by: ihse, tbell

common/autoconf/basics.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/toolchain_windows.m4 file | annotate | diff | comparison | revisions
     1.1 --- a/common/autoconf/basics.m4	Thu May 31 13:57:22 2018 +0100
     1.2 +++ b/common/autoconf/basics.m4	Fri Jun 08 14:06:17 2018 -0700
     1.3 @@ -470,61 +470,71 @@
     1.4  AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
     1.5  [
     1.6    AC_ARG_WITH([devkit], [AS_HELP_STRING([--with-devkit],
     1.7 -      [use this devkit for compilers, tools and resources])],
     1.8 -      [
     1.9 -        BASIC_FIXUP_PATH([with_devkit])
    1.10 -        DEVKIT_ROOT="$with_devkit"
    1.11 -        # Check for a meta data info file in the root of the devkit
    1.12 -        if test -f "$DEVKIT_ROOT/devkit.info"; then
    1.13 -          . $DEVKIT_ROOT/devkit.info
    1.14 -          # This potentially sets the following:
    1.15 -          # A descriptive name of the devkit
    1.16 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME])
    1.17 -          # Corresponds to --with-extra-path
    1.18 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH])
    1.19 -          # Corresponds to --with-toolchain-path
    1.20 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH])
    1.21 -          # Corresponds to --with-sysroot
    1.22 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT])
    1.23 +      [use this devkit for compilers, tools and resources])])
    1.24  
    1.25 -          # Identifies the Visual Studio version in the devkit
    1.26 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION])
    1.27 -          # The Visual Studio include environment variable
    1.28 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE])
    1.29 -          # The Visual Studio lib environment variable
    1.30 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB])
    1.31 -          # Corresponds to --with-msvcr-dll
    1.32 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL])
    1.33 -          # Corresponds to --with-msvcp-dll
    1.34 -          BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL])
    1.35 -        fi
    1.36 +  if test "x$with_devkit" = xyes; then
    1.37 +    AC_MSG_ERROR([--with-devkit must have a value])
    1.38 +  elif test "x$with_devkit" != x && test "x$with_devkit" != xno; then
    1.39 +    BASIC_FIXUP_PATH([with_devkit])
    1.40 +    DEVKIT_ROOT="$with_devkit"
    1.41 +    # Check for a meta data info file in the root of the devkit
    1.42 +    if test -f "$DEVKIT_ROOT/devkit.info"; then
    1.43 +      . $DEVKIT_ROOT/devkit.info
    1.44 +      # This potentially sets the following:
    1.45 +      # A descriptive name of the devkit
    1.46 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_NAME])
    1.47 +      # Corresponds to --with-extra-path
    1.48 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_EXTRA_PATH])
    1.49 +      # Corresponds to --with-toolchain-path
    1.50 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_TOOLCHAIN_PATH])
    1.51 +      # Corresponds to --with-sysroot
    1.52 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_SYSROOT])
    1.53  
    1.54 -        AC_MSG_CHECKING([for devkit])
    1.55 -        if test "x$DEVKIT_NAME" != x; then
    1.56 -          AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
    1.57 -        else
    1.58 -          AC_MSG_RESULT([$DEVKIT_ROOT])
    1.59 -        fi
    1.60 +      # Identifies the Visual Studio version in the devkit
    1.61 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_VERSION])
    1.62 +      # The Visual Studio include environment variable
    1.63 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_INCLUDE])
    1.64 +      # The Visual Studio lib environment variable
    1.65 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_VS_LIB])
    1.66 +      # Corresponds to --with-msvcr-dll
    1.67 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCR_DLL])
    1.68 +      # Corresponds to --with-msvcp-dll
    1.69 +      BASIC_EVAL_DEVKIT_VARIABLE([DEVKIT_MSVCP_DLL])
    1.70 +    fi
    1.71  
    1.72 -        BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
    1.73 +    AC_MSG_CHECKING([for devkit])
    1.74 +    if test "x$DEVKIT_NAME" != x; then
    1.75 +      AC_MSG_RESULT([$DEVKIT_NAME in $DEVKIT_ROOT])
    1.76 +    else
    1.77 +      AC_MSG_RESULT([$DEVKIT_ROOT])
    1.78 +    fi
    1.79  
    1.80 -        # Fallback default of just /bin if DEVKIT_PATH is not defined
    1.81 -        if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
    1.82 -          DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
    1.83 -        fi
    1.84 -        BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
    1.85 +    BASIC_PREPEND_TO_PATH([EXTRA_PATH],$DEVKIT_EXTRA_PATH)
    1.86  
    1.87 -        # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
    1.88 -        # places for backwards compatiblity.
    1.89 -        if test "x$DEVKIT_SYSROOT" != x; then
    1.90 -          SYSROOT="$DEVKIT_SYSROOT"
    1.91 -        elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
    1.92 -          SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
    1.93 -        elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
    1.94 -          SYSROOT="$DEVKIT_ROOT/$host/sys-root"
    1.95 -        fi
    1.96 -      ]
    1.97 -  )
    1.98 +    # Fallback default of just /bin if DEVKIT_PATH is not defined
    1.99 +    if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
   1.100 +      DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
   1.101 +    fi
   1.102 +    BASIC_PREPEND_TO_PATH([TOOLCHAIN_PATH],$DEVKIT_TOOLCHAIN_PATH)
   1.103 +
   1.104 +    # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
   1.105 +    # places for backwards compatiblity.
   1.106 +    if test "x$DEVKIT_SYSROOT" != x; then
   1.107 +      SYSROOT="$DEVKIT_SYSROOT"
   1.108 +    elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
   1.109 +      SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
   1.110 +    elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
   1.111 +      SYSROOT="$DEVKIT_ROOT/$host/sys-root"
   1.112 +    fi
   1.113 +
   1.114 +    if test "x$DEVKIT_ROOT" != x; then
   1.115 +      DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib"
   1.116 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   1.117 +        DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64"
   1.118 +      fi
   1.119 +      AC_SUBST(DEVKIT_LIB_DIR)
   1.120 +    fi
   1.121 +  fi
   1.122  
   1.123    # You can force the sysroot if the sysroot encoded into the compiler tools
   1.124    # is not correct.
     2.1 --- a/common/autoconf/generated-configure.sh	Thu May 31 13:57:22 2018 +0100
     2.2 +++ b/common/autoconf/generated-configure.sh	Fri Jun 08 14:06:17 2018 -0700
     2.3 @@ -868,6 +868,7 @@
     2.4  OUTPUT_ROOT
     2.5  CONF_NAME
     2.6  SPEC
     2.7 +DEVKIT_LIB_DIR
     2.8  BUILD_VARIANT_RELEASE
     2.9  DEBUG_CLASSFILES
    2.10  FASTDEBUG
    2.11 @@ -4230,8 +4231,8 @@
    2.12  #
    2.13  
    2.14  ################################################################################
    2.15 -
    2.16 -VALID_VS_VERSIONS="2010 2012 2013"
    2.17 +# The order of these defines the priority by which we try to find them.
    2.18 +VALID_VS_VERSIONS="2010 2012 2013 2015 2017"
    2.19  
    2.20  VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
    2.21  VS_VERSION_INTERNAL_2010=100
    2.22 @@ -4264,6 +4265,30 @@
    2.23  VS_VS_PLATFORM_NAME_2013="v120"
    2.24  VS_SDK_PLATFORM_NAME_2013=
    2.25  
    2.26 +VS_DESCRIPTION_2015="Microsoft Visual Studio 2015 - CURRENTLY NOT WORKING"
    2.27 +VS_VERSION_INTERNAL_2015=140
    2.28 +VS_MSVCR_2015=vcruntime140.dll
    2.29 +VS_MSVCP_2015=msvcp140.dll
    2.30 +VS_ENVVAR_2015="VS140COMNTOOLS"
    2.31 +VS_VS_INSTALLDIR_2015="Microsoft Visual Studio 14.0"
    2.32 +VS_SDK_INSTALLDIR_2015=
    2.33 +VS_VS_PLATFORM_NAME_2015="v140"
    2.34 +VS_SDK_PLATFORM_NAME_2015=
    2.35 +# The vcvars of 2015 breaks if 2017 is also installed. Work around this by
    2.36 +# explicitly specifying Windows Kit 8.1 to be used.
    2.37 +VS_ENV_ARGS_2015="8.1"
    2.38 +
    2.39 +VS_DESCRIPTION_2017="Microsoft Visual Studio 2017 - CURRENTLY NOT WORKING"
    2.40 +VS_VERSION_INTERNAL_2017=141
    2.41 +VS_MSVCR_2017=vcruntime140.dll
    2.42 +VS_MSVCP_2017=msvcp140.dll
    2.43 +VS_ENVVAR_2017="VS150COMNTOOLS"
    2.44 +VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017"
    2.45 +VS_EDITIONS_2017="Community Professional Enterprise"
    2.46 +VS_SDK_INSTALLDIR_2017=
    2.47 +VS_VS_PLATFORM_NAME_2017="v141"
    2.48 +VS_SDK_PLATFORM_NAME_2017=
    2.49 +
    2.50  ################################################################################
    2.51  
    2.52  
    2.53 @@ -4305,7 +4330,7 @@
    2.54  #CUSTOM_AUTOCONF_INCLUDE
    2.55  
    2.56  # Do not change or remove the following line, it is needed for consistency checks:
    2.57 -DATE_WHEN_GENERATED=1527770995
    2.58 +DATE_WHEN_GENERATED=1528448223
    2.59  
    2.60  ###############################################################################
    2.61  #
    2.62 @@ -14691,6 +14716,12 @@
    2.63  # Check whether --with-devkit was given.
    2.64  if test "${with_devkit+set}" = set; then :
    2.65    withval=$with_devkit;
    2.66 +fi
    2.67 +
    2.68 +
    2.69 +  if test "x$with_devkit" = xyes; then
    2.70 +    as_fn_error $? "--with-devkit must have a value" "$LINENO" 5
    2.71 +  elif test "x$with_devkit" != x && test "x$with_devkit" != xno; then
    2.72  
    2.73    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
    2.74  
    2.75 @@ -14813,77 +14844,77 @@
    2.76      with_devkit="`cd "$path"; $THEPWDCMD -L`"
    2.77    fi
    2.78  
    2.79 -        DEVKIT_ROOT="$with_devkit"
    2.80 -        # Check for a meta data info file in the root of the devkit
    2.81 -        if test -f "$DEVKIT_ROOT/devkit.info"; then
    2.82 -          . $DEVKIT_ROOT/devkit.info
    2.83 -          # This potentially sets the following:
    2.84 -          # A descriptive name of the devkit
    2.85 +    DEVKIT_ROOT="$with_devkit"
    2.86 +    # Check for a meta data info file in the root of the devkit
    2.87 +    if test -f "$DEVKIT_ROOT/devkit.info"; then
    2.88 +      . $DEVKIT_ROOT/devkit.info
    2.89 +      # This potentially sets the following:
    2.90 +      # A descriptive name of the devkit
    2.91  
    2.92    if test "x$DEVKIT_NAME" = x; then
    2.93      eval DEVKIT_NAME="\${DEVKIT_NAME_${OPENJDK_TARGET_CPU}}"
    2.94    fi
    2.95  
    2.96 -          # Corresponds to --with-extra-path
    2.97 +      # Corresponds to --with-extra-path
    2.98  
    2.99    if test "x$DEVKIT_EXTRA_PATH" = x; then
   2.100      eval DEVKIT_EXTRA_PATH="\${DEVKIT_EXTRA_PATH_${OPENJDK_TARGET_CPU}}"
   2.101    fi
   2.102  
   2.103 -          # Corresponds to --with-toolchain-path
   2.104 +      # Corresponds to --with-toolchain-path
   2.105  
   2.106    if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
   2.107      eval DEVKIT_TOOLCHAIN_PATH="\${DEVKIT_TOOLCHAIN_PATH_${OPENJDK_TARGET_CPU}}"
   2.108    fi
   2.109  
   2.110 -          # Corresponds to --with-sysroot
   2.111 +      # Corresponds to --with-sysroot
   2.112  
   2.113    if test "x$DEVKIT_SYSROOT" = x; then
   2.114      eval DEVKIT_SYSROOT="\${DEVKIT_SYSROOT_${OPENJDK_TARGET_CPU}}"
   2.115    fi
   2.116  
   2.117  
   2.118 -          # Identifies the Visual Studio version in the devkit
   2.119 +      # Identifies the Visual Studio version in the devkit
   2.120  
   2.121    if test "x$DEVKIT_VS_VERSION" = x; then
   2.122      eval DEVKIT_VS_VERSION="\${DEVKIT_VS_VERSION_${OPENJDK_TARGET_CPU}}"
   2.123    fi
   2.124  
   2.125 -          # The Visual Studio include environment variable
   2.126 +      # The Visual Studio include environment variable
   2.127  
   2.128    if test "x$DEVKIT_VS_INCLUDE" = x; then
   2.129      eval DEVKIT_VS_INCLUDE="\${DEVKIT_VS_INCLUDE_${OPENJDK_TARGET_CPU}}"
   2.130    fi
   2.131  
   2.132 -          # The Visual Studio lib environment variable
   2.133 +      # The Visual Studio lib environment variable
   2.134  
   2.135    if test "x$DEVKIT_VS_LIB" = x; then
   2.136      eval DEVKIT_VS_LIB="\${DEVKIT_VS_LIB_${OPENJDK_TARGET_CPU}}"
   2.137    fi
   2.138  
   2.139 -          # Corresponds to --with-msvcr-dll
   2.140 +      # Corresponds to --with-msvcr-dll
   2.141  
   2.142    if test "x$DEVKIT_MSVCR_DLL" = x; then
   2.143      eval DEVKIT_MSVCR_DLL="\${DEVKIT_MSVCR_DLL_${OPENJDK_TARGET_CPU}}"
   2.144    fi
   2.145  
   2.146 -          # Corresponds to --with-msvcp-dll
   2.147 +      # Corresponds to --with-msvcp-dll
   2.148  
   2.149    if test "x$DEVKIT_MSVCP_DLL" = x; then
   2.150      eval DEVKIT_MSVCP_DLL="\${DEVKIT_MSVCP_DLL_${OPENJDK_TARGET_CPU}}"
   2.151    fi
   2.152  
   2.153 -        fi
   2.154 -
   2.155 -        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devkit" >&5
   2.156 +    fi
   2.157 +
   2.158 +    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for devkit" >&5
   2.159  $as_echo_n "checking for devkit... " >&6; }
   2.160 -        if test "x$DEVKIT_NAME" != x; then
   2.161 -          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_NAME in $DEVKIT_ROOT" >&5
   2.162 +    if test "x$DEVKIT_NAME" != x; then
   2.163 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_NAME in $DEVKIT_ROOT" >&5
   2.164  $as_echo "$DEVKIT_NAME in $DEVKIT_ROOT" >&6; }
   2.165 -        else
   2.166 -          { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_ROOT" >&5
   2.167 +    else
   2.168 +      { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEVKIT_ROOT" >&5
   2.169  $as_echo "$DEVKIT_ROOT" >&6; }
   2.170 -        fi
   2.171 +    fi
   2.172  
   2.173  
   2.174    if test "x$DEVKIT_EXTRA_PATH" != x; then
   2.175 @@ -14895,10 +14926,10 @@
   2.176    fi
   2.177  
   2.178  
   2.179 -        # Fallback default of just /bin if DEVKIT_PATH is not defined
   2.180 -        if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
   2.181 -          DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
   2.182 -        fi
   2.183 +    # Fallback default of just /bin if DEVKIT_PATH is not defined
   2.184 +    if test "x$DEVKIT_TOOLCHAIN_PATH" = x; then
   2.185 +      DEVKIT_TOOLCHAIN_PATH="$DEVKIT_ROOT/bin"
   2.186 +    fi
   2.187  
   2.188    if test "x$DEVKIT_TOOLCHAIN_PATH" != x; then
   2.189      if test "x$TOOLCHAIN_PATH" = x; then
   2.190 @@ -14909,19 +14940,24 @@
   2.191    fi
   2.192  
   2.193  
   2.194 -        # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
   2.195 -        # places for backwards compatiblity.
   2.196 -        if test "x$DEVKIT_SYSROOT" != x; then
   2.197 -          SYSROOT="$DEVKIT_SYSROOT"
   2.198 -        elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
   2.199 -          SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
   2.200 -        elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
   2.201 -          SYSROOT="$DEVKIT_ROOT/$host/sys-root"
   2.202 -        fi
   2.203 -
   2.204 -
   2.205 -fi
   2.206 -
   2.207 +    # If DEVKIT_SYSROOT is set, use that, otherwise try a couple of known
   2.208 +    # places for backwards compatiblity.
   2.209 +    if test "x$DEVKIT_SYSROOT" != x; then
   2.210 +      SYSROOT="$DEVKIT_SYSROOT"
   2.211 +    elif test -d "$DEVKIT_ROOT/$host_alias/libc"; then
   2.212 +      SYSROOT="$DEVKIT_ROOT/$host_alias/libc"
   2.213 +    elif test -d "$DEVKIT_ROOT/$host/sys-root"; then
   2.214 +      SYSROOT="$DEVKIT_ROOT/$host/sys-root"
   2.215 +    fi
   2.216 +
   2.217 +    if test "x$DEVKIT_ROOT" != x; then
   2.218 +      DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib"
   2.219 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   2.220 +        DEVKIT_LIB_DIR="$DEVKIT_ROOT/lib64"
   2.221 +      fi
   2.222 +
   2.223 +    fi
   2.224 +  fi
   2.225  
   2.226    # You can force the sysroot if the sysroot encoded into the compiler tools
   2.227    # is not correct.
   2.228 @@ -25357,7 +25393,11 @@
   2.229    elif test "x$DEVKIT_VS_VERSION" != x; then
   2.230      VS_VERSION=$DEVKIT_VS_VERSION
   2.231      TOOLCHAIN_VERSION=$VS_VERSION
   2.232 -    eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
   2.233 +    # If the devkit has a name, use that as description
   2.234 +    VS_DESCRIPTION="$DEVKIT_NAME"
   2.235 +    if test "x$VS_DESCRIPTION" = x; then
   2.236 +      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
   2.237 +    fi
   2.238      eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
   2.239      eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
   2.240      eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
   2.241 @@ -25425,7 +25465,9 @@
   2.242    eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
   2.243    eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
   2.244    eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
   2.245 +  eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}"
   2.246    eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
   2.247 +  eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"
   2.248  
   2.249    # When using --with-tools-dir, assume it points to the correct and default
   2.250    # version of Visual Studio or that --with-toolchain-version was also set.
   2.251 @@ -25436,12 +25478,6 @@
   2.252      VS_BASE="$with_tools_dir/../.."
   2.253      METHOD="--with-tools-dir"
   2.254  
   2.255 -    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.256 -      VCVARSFILE="vc/bin/vcvars32.bat"
   2.257 -    else
   2.258 -      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.259 -    fi
   2.260 -
   2.261  
   2.262    windows_path="$VS_BASE"
   2.263    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.264 @@ -25452,19 +25488,43 @@
   2.265      VS_BASE="$unix_path"
   2.266    fi
   2.267  
   2.268 +    # In VS 2017, the default installation is in a subdir named after the edition.
   2.269 +    # Find the first one present and use that.
   2.270 +    if test "x$VS_EDITIONS" != x; then
   2.271 +      for edition in $VS_EDITIONS; do
   2.272 +        if test -d "$VS_BASE/$edition"; then
   2.273 +          VS_BASE="$VS_BASE/$edition"
   2.274 +          break
   2.275 +        fi
   2.276 +      done
   2.277 +    fi
   2.278 +
   2.279      if test -d "$VS_BASE"; then
   2.280 -      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.281 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.282 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.283  $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.284 -        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.285 -        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.286 -        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.287 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.288 +        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
   2.289 +      else
   2.290 +        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
   2.291 +            vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
   2.292 +      fi
   2.293 +
   2.294 +      for VCVARSFILE in $VCVARSFILES; do
   2.295 +        if test -f "$VS_BASE/$VCVARSFILE"; then
   2.296 +          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.297 +          break
   2.298 +        fi
   2.299 +      done
   2.300 +
   2.301 +      if test "x$VS_ENV_CMD" = x; then
   2.302 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5
   2.303 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;}
   2.304 +      else
   2.305 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
   2.306 +        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
   2.307 +        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.308          eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.309 -      else
   2.310 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.311 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.312 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.313 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.314 +
   2.315        fi
   2.316      fi
   2.317    fi
   2.318 @@ -25475,12 +25535,6 @@
   2.319      VS_BASE="$with_tools_dir/../../.."
   2.320      METHOD="--with-tools-dir"
   2.321  
   2.322 -    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.323 -      VCVARSFILE="vc/bin/vcvars32.bat"
   2.324 -    else
   2.325 -      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.326 -    fi
   2.327 -
   2.328  
   2.329    windows_path="$VS_BASE"
   2.330    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.331 @@ -25491,19 +25545,43 @@
   2.332      VS_BASE="$unix_path"
   2.333    fi
   2.334  
   2.335 +    # In VS 2017, the default installation is in a subdir named after the edition.
   2.336 +    # Find the first one present and use that.
   2.337 +    if test "x$VS_EDITIONS" != x; then
   2.338 +      for edition in $VS_EDITIONS; do
   2.339 +        if test -d "$VS_BASE/$edition"; then
   2.340 +          VS_BASE="$VS_BASE/$edition"
   2.341 +          break
   2.342 +        fi
   2.343 +      done
   2.344 +    fi
   2.345 +
   2.346      if test -d "$VS_BASE"; then
   2.347 -      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.348 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.349 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.350  $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.351 -        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.352 -        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.353 -        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.354 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.355 +        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
   2.356 +      else
   2.357 +        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
   2.358 +            vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
   2.359 +      fi
   2.360 +
   2.361 +      for VCVARSFILE in $VCVARSFILES; do
   2.362 +        if test -f "$VS_BASE/$VCVARSFILE"; then
   2.363 +          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.364 +          break
   2.365 +        fi
   2.366 +      done
   2.367 +
   2.368 +      if test "x$VS_ENV_CMD" = x; then
   2.369 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5
   2.370 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;}
   2.371 +      else
   2.372 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
   2.373 +        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
   2.374 +        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.375          eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.376 -      else
   2.377 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.378 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.379 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.380 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.381 +
   2.382        fi
   2.383      fi
   2.384    fi
   2.385 @@ -25522,7 +25600,6 @@
   2.386    fi
   2.387  
   2.388    VS_ENV_CMD=""
   2.389 -  VS_ENV_ARGS=""
   2.390  
   2.391    if test "x$VS_COMNTOOLS" != x; then
   2.392  
   2.393 @@ -25531,12 +25608,6 @@
   2.394      VS_BASE="$VS_COMNTOOLS/../.."
   2.395      METHOD="$VS_COMNTOOLS_VAR variable"
   2.396  
   2.397 -    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.398 -      VCVARSFILE="vc/bin/vcvars32.bat"
   2.399 -    else
   2.400 -      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.401 -    fi
   2.402 -
   2.403  
   2.404    windows_path="$VS_BASE"
   2.405    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.406 @@ -25547,19 +25618,43 @@
   2.407      VS_BASE="$unix_path"
   2.408    fi
   2.409  
   2.410 +    # In VS 2017, the default installation is in a subdir named after the edition.
   2.411 +    # Find the first one present and use that.
   2.412 +    if test "x$VS_EDITIONS" != x; then
   2.413 +      for edition in $VS_EDITIONS; do
   2.414 +        if test -d "$VS_BASE/$edition"; then
   2.415 +          VS_BASE="$VS_BASE/$edition"
   2.416 +          break
   2.417 +        fi
   2.418 +      done
   2.419 +    fi
   2.420 +
   2.421      if test -d "$VS_BASE"; then
   2.422 -      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.423 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.424 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.425  $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.426 -        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.427 -        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.428 -        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.429 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.430 +        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
   2.431 +      else
   2.432 +        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
   2.433 +            vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
   2.434 +      fi
   2.435 +
   2.436 +      for VCVARSFILE in $VCVARSFILES; do
   2.437 +        if test -f "$VS_BASE/$VCVARSFILE"; then
   2.438 +          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.439 +          break
   2.440 +        fi
   2.441 +      done
   2.442 +
   2.443 +      if test "x$VS_ENV_CMD" = x; then
   2.444 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5
   2.445 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;}
   2.446 +      else
   2.447 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
   2.448 +        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
   2.449 +        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.450          eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.451 -      else
   2.452 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.453 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.454 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.455 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.456 +
   2.457        fi
   2.458      fi
   2.459    fi
   2.460 @@ -25572,12 +25667,6 @@
   2.461      VS_BASE="$PROGRAMFILES/$VS_INSTALL_DIR"
   2.462      METHOD="well-known name"
   2.463  
   2.464 -    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.465 -      VCVARSFILE="vc/bin/vcvars32.bat"
   2.466 -    else
   2.467 -      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.468 -    fi
   2.469 -
   2.470  
   2.471    windows_path="$VS_BASE"
   2.472    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.473 @@ -25588,19 +25677,43 @@
   2.474      VS_BASE="$unix_path"
   2.475    fi
   2.476  
   2.477 +    # In VS 2017, the default installation is in a subdir named after the edition.
   2.478 +    # Find the first one present and use that.
   2.479 +    if test "x$VS_EDITIONS" != x; then
   2.480 +      for edition in $VS_EDITIONS; do
   2.481 +        if test -d "$VS_BASE/$edition"; then
   2.482 +          VS_BASE="$VS_BASE/$edition"
   2.483 +          break
   2.484 +        fi
   2.485 +      done
   2.486 +    fi
   2.487 +
   2.488      if test -d "$VS_BASE"; then
   2.489 -      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.490 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.491 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.492  $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.493 -        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.494 -        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.495 -        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.496 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.497 +        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
   2.498 +      else
   2.499 +        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
   2.500 +            vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
   2.501 +      fi
   2.502 +
   2.503 +      for VCVARSFILE in $VCVARSFILES; do
   2.504 +        if test -f "$VS_BASE/$VCVARSFILE"; then
   2.505 +          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.506 +          break
   2.507 +        fi
   2.508 +      done
   2.509 +
   2.510 +      if test "x$VS_ENV_CMD" = x; then
   2.511 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5
   2.512 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;}
   2.513 +      else
   2.514 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
   2.515 +        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
   2.516 +        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.517          eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.518 -      else
   2.519 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.520 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.521 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.522 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.523 +
   2.524        fi
   2.525      fi
   2.526    fi
   2.527 @@ -25615,12 +25728,6 @@
   2.528      VS_BASE="$PROGRAMFILES_X86/$VS_INSTALL_DIR"
   2.529      METHOD="well-known name"
   2.530  
   2.531 -    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.532 -      VCVARSFILE="vc/bin/vcvars32.bat"
   2.533 -    else
   2.534 -      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.535 -    fi
   2.536 -
   2.537  
   2.538    windows_path="$VS_BASE"
   2.539    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.540 @@ -25631,19 +25738,43 @@
   2.541      VS_BASE="$unix_path"
   2.542    fi
   2.543  
   2.544 +    # In VS 2017, the default installation is in a subdir named after the edition.
   2.545 +    # Find the first one present and use that.
   2.546 +    if test "x$VS_EDITIONS" != x; then
   2.547 +      for edition in $VS_EDITIONS; do
   2.548 +        if test -d "$VS_BASE/$edition"; then
   2.549 +          VS_BASE="$VS_BASE/$edition"
   2.550 +          break
   2.551 +        fi
   2.552 +      done
   2.553 +    fi
   2.554 +
   2.555      if test -d "$VS_BASE"; then
   2.556 -      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.557 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.558 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.559  $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.560 -        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.561 -        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.562 -        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.563 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.564 +        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
   2.565 +      else
   2.566 +        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
   2.567 +            vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
   2.568 +      fi
   2.569 +
   2.570 +      for VCVARSFILE in $VCVARSFILES; do
   2.571 +        if test -f "$VS_BASE/$VCVARSFILE"; then
   2.572 +          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.573 +          break
   2.574 +        fi
   2.575 +      done
   2.576 +
   2.577 +      if test "x$VS_ENV_CMD" = x; then
   2.578 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5
   2.579 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;}
   2.580 +      else
   2.581 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
   2.582 +        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
   2.583 +        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.584          eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.585 -      else
   2.586 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.587 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.588 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.589 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.590 +
   2.591        fi
   2.592      fi
   2.593    fi
   2.594 @@ -25655,12 +25786,6 @@
   2.595      VS_BASE="C:/Program Files/$VS_INSTALL_DIR"
   2.596      METHOD="well-known name"
   2.597  
   2.598 -    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.599 -      VCVARSFILE="vc/bin/vcvars32.bat"
   2.600 -    else
   2.601 -      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.602 -    fi
   2.603 -
   2.604  
   2.605    windows_path="$VS_BASE"
   2.606    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.607 @@ -25671,19 +25796,43 @@
   2.608      VS_BASE="$unix_path"
   2.609    fi
   2.610  
   2.611 +    # In VS 2017, the default installation is in a subdir named after the edition.
   2.612 +    # Find the first one present and use that.
   2.613 +    if test "x$VS_EDITIONS" != x; then
   2.614 +      for edition in $VS_EDITIONS; do
   2.615 +        if test -d "$VS_BASE/$edition"; then
   2.616 +          VS_BASE="$VS_BASE/$edition"
   2.617 +          break
   2.618 +        fi
   2.619 +      done
   2.620 +    fi
   2.621 +
   2.622      if test -d "$VS_BASE"; then
   2.623 -      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.624 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.625 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.626  $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.627 -        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.628 -        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.629 -        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.630 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.631 +        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
   2.632 +      else
   2.633 +        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
   2.634 +            vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
   2.635 +      fi
   2.636 +
   2.637 +      for VCVARSFILE in $VCVARSFILES; do
   2.638 +        if test -f "$VS_BASE/$VCVARSFILE"; then
   2.639 +          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.640 +          break
   2.641 +        fi
   2.642 +      done
   2.643 +
   2.644 +      if test "x$VS_ENV_CMD" = x; then
   2.645 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5
   2.646 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;}
   2.647 +      else
   2.648 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
   2.649 +        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
   2.650 +        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.651          eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.652 -      else
   2.653 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.654 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.655 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.656 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.657 +
   2.658        fi
   2.659      fi
   2.660    fi
   2.661 @@ -25694,12 +25843,6 @@
   2.662      VS_BASE="C:/Program Files (x86)/$VS_INSTALL_DIR"
   2.663      METHOD="well-known name"
   2.664  
   2.665 -    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.666 -      VCVARSFILE="vc/bin/vcvars32.bat"
   2.667 -    else
   2.668 -      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
   2.669 -    fi
   2.670 -
   2.671  
   2.672    windows_path="$VS_BASE"
   2.673    if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
   2.674 @@ -25710,19 +25853,43 @@
   2.675      VS_BASE="$unix_path"
   2.676    fi
   2.677  
   2.678 +    # In VS 2017, the default installation is in a subdir named after the edition.
   2.679 +    # Find the first one present and use that.
   2.680 +    if test "x$VS_EDITIONS" != x; then
   2.681 +      for edition in $VS_EDITIONS; do
   2.682 +        if test -d "$VS_BASE/$edition"; then
   2.683 +          VS_BASE="$VS_BASE/$edition"
   2.684 +          break
   2.685 +        fi
   2.686 +      done
   2.687 +    fi
   2.688 +
   2.689      if test -d "$VS_BASE"; then
   2.690 -      if test -f "$VS_BASE/$VCVARSFILE"; then
   2.691 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.692 +      { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.693  $as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.694 -        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.695 -        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
   2.696 -        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.697 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   2.698 +        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
   2.699 +      else
   2.700 +        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
   2.701 +            vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
   2.702 +      fi
   2.703 +
   2.704 +      for VCVARSFILE in $VCVARSFILES; do
   2.705 +        if test -f "$VS_BASE/$VCVARSFILE"; then
   2.706 +          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
   2.707 +          break
   2.708 +        fi
   2.709 +      done
   2.710 +
   2.711 +      if test "x$VS_ENV_CMD" = x; then
   2.712 +        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&5
   2.713 +$as_echo "$as_me: Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring" >&6;}
   2.714 +      else
   2.715 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
   2.716 +        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
   2.717 +        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
   2.718          eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
   2.719 -      else
   2.720 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Found Visual Studio installation at $VS_BASE using $METHOD" >&5
   2.721 -$as_echo "$as_me: Found Visual Studio installation at $VS_BASE using $METHOD" >&6;}
   2.722 -        { $as_echo "$as_me:${as_lineno-$LINENO}: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&5
   2.723 -$as_echo "$as_me: Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring" >&6;}
   2.724 +
   2.725        fi
   2.726      fi
   2.727    fi
   2.728 @@ -25975,6 +26142,11 @@
   2.729      fi
   2.730    done
   2.731  
   2.732 +  TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
   2.733 +  if test "$TOOLCHAIN_VERSION" -gt 2013; then
   2.734 +    UNSUPPORTED_TOOLCHAIN_VERSION=yes
   2.735 +  fi
   2.736 +
   2.737  
   2.738    # If we have a devkit, skip all of the below.
   2.739    if test "x$DEVKIT_VS_VERSION" = x; then
   2.740 @@ -26303,6 +26475,9 @@
   2.741        # This will end up something like:
   2.742        # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
   2.743        $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
   2.744 +      # In some cases, the VS_ENV_CMD will change directory, change back so
   2.745 +      # the set-vs-env.sh ends up in the right place.
   2.746 +      $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE
   2.747        # These will end up something like:
   2.748        # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
   2.749        # The trailing space for everyone except PATH is no typo, but is needed due
   2.750 @@ -48482,7 +48657,6 @@
   2.751    MSVC_DLL=
   2.752  
   2.753    if test "x$MSVC_DLL" = x; then
   2.754 -    # Probe: Using well-known location from Visual Studio 10.0
   2.755      if test "x$VCINSTALLDIR" != x; then
   2.756        CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
   2.757  
   2.758 @@ -48495,15 +48669,27 @@
   2.759      CYGWIN_VC_INSTALL_DIR="$unix_path"
   2.760    fi
   2.761  
   2.762 -      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   2.763 -        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.764 -      else
   2.765 -        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.766 -      fi
   2.767 -      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
   2.768 +      if test "$VS_VERSION" -lt 2017; then
   2.769 +        # Probe: Using well-known location from Visual Studio 12.0 and older
   2.770 +        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   2.771 +          POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.772 +        else
   2.773 +          POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.774 +        fi
   2.775 +      else
   2.776 +        # Probe: Using well-known location from VS 2017
   2.777 +        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   2.778 +          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
   2.779 +        else
   2.780 +          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
   2.781 +        fi
   2.782 +      fi
   2.783 +      # In case any of the above finds more than one file, loop over them.
   2.784 +      for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
   2.785 +        $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
   2.786  
   2.787    DLL_NAME="$DLL_NAME"
   2.788 -  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
   2.789 +  POSSIBLE_MSVC_DLL="$possible_msvc_dll"
   2.790    METHOD="well-known location in VCINSTALLDIR"
   2.791    if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
   2.792      { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
   2.793 @@ -48666,6 +48852,7 @@
   2.794      fi
   2.795    fi
   2.796  
   2.797 +      done
   2.798      fi
   2.799    fi
   2.800  
   2.801 @@ -49761,7 +49948,6 @@
   2.802    MSVC_DLL=
   2.803  
   2.804    if test "x$MSVC_DLL" = x; then
   2.805 -    # Probe: Using well-known location from Visual Studio 10.0
   2.806      if test "x$VCINSTALLDIR" != x; then
   2.807        CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
   2.808  
   2.809 @@ -49774,15 +49960,27 @@
   2.810      CYGWIN_VC_INSTALL_DIR="$unix_path"
   2.811    fi
   2.812  
   2.813 -      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   2.814 -        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.815 -      else
   2.816 -        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.817 -      fi
   2.818 -      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
   2.819 +      if test "$VS_VERSION" -lt 2017; then
   2.820 +        # Probe: Using well-known location from Visual Studio 12.0 and older
   2.821 +        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   2.822 +          POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.823 +        else
   2.824 +          POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   2.825 +        fi
   2.826 +      else
   2.827 +        # Probe: Using well-known location from VS 2017
   2.828 +        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   2.829 +          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
   2.830 +        else
   2.831 +          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
   2.832 +        fi
   2.833 +      fi
   2.834 +      # In case any of the above finds more than one file, loop over them.
   2.835 +      for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
   2.836 +        $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
   2.837  
   2.838    DLL_NAME="$DLL_NAME"
   2.839 -  POSSIBLE_MSVC_DLL="$POSSIBLE_MSVC_DLL"
   2.840 +  POSSIBLE_MSVC_DLL="$possible_msvc_dll"
   2.841    METHOD="well-known location in VCINSTALLDIR"
   2.842    if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
   2.843      { $as_echo "$as_me:${as_lineno-$LINENO}: Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD" >&5
   2.844 @@ -49945,6 +50143,7 @@
   2.845      fi
   2.846    fi
   2.847  
   2.848 +      done
   2.849      fi
   2.850    fi
   2.851  
   2.852 @@ -52863,10 +53062,7 @@
   2.853      printf "* Environment:    $WINDOWS_ENV_VENDOR version $WINDOWS_ENV_VERSION (root at $WINDOWS_ENV_ROOT_PATH)\n"
   2.854    fi
   2.855    printf "* Boot JDK:       $BOOT_JDK_VERSION (at $BOOT_JDK)\n"
   2.856 -  if test "x$TOOLCHAIN_VERSION" != "x"; then
   2.857 -    print_version=" $TOOLCHAIN_VERSION"
   2.858 -  fi
   2.859 -  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n"
   2.860 +  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\n"
   2.861    printf "* C Compiler:     Version $CC_VERSION_NUMBER (at $CC)\n"
   2.862    printf "* C++ Compiler:   Version $CXX_VERSION_NUMBER (at $CXX)\n"
   2.863  
   2.864 @@ -52908,3 +53104,9 @@
   2.865      printf "\n"
   2.866    fi
   2.867  
   2.868 +  if test "x$UNSUPPORTED_TOOLCHAIN_VERSION" = "xyes"; then
   2.869 +    printf "WARNING: The toolchain version used is known to have issues. Please\n"
   2.870 +    printf "consider using a supported version unless you know what you are doing.\n"
   2.871 +    printf "\n"
   2.872 +  fi
   2.873 +
     3.1 --- a/common/autoconf/help.m4	Thu May 31 13:57:22 2018 +0100
     3.2 +++ b/common/autoconf/help.m4	Fri Jun 08 14:06:17 2018 -0700
     3.3 @@ -197,10 +197,7 @@
     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 -  if test "x$TOOLCHAIN_VERSION" != "x"; then
     3.8 -    print_version=" $TOOLCHAIN_VERSION"
     3.9 -  fi
    3.10 -  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION$print_version)\n" 
    3.11 +  printf "* Toolchain:      $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)\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  
    3.15 @@ -241,4 +238,10 @@
    3.16      printf "proper build. Failure to do so might result in strange build problems.\n"
    3.17      printf "\n"
    3.18    fi
    3.19 +
    3.20 +  if test "x$UNSUPPORTED_TOOLCHAIN_VERSION" = "xyes"; then
    3.21 +    printf "WARNING: The toolchain version used is known to have issues. Please\n"
    3.22 +    printf "consider using a supported version unless you know what you are doing.\n"
    3.23 +    printf "\n"
    3.24 +  fi
    3.25  ])
     4.1 --- a/common/autoconf/toolchain_windows.m4	Thu May 31 13:57:22 2018 +0100
     4.2 +++ b/common/autoconf/toolchain_windows.m4	Fri Jun 08 14:06:17 2018 -0700
     4.3 @@ -24,8 +24,8 @@
     4.4  #
     4.5  
     4.6  ################################################################################
     4.7 -
     4.8 -VALID_VS_VERSIONS="2010 2012 2013"
     4.9 +# The order of these defines the priority by which we try to find them.
    4.10 +VALID_VS_VERSIONS="2010 2012 2013 2015 2017"
    4.11  
    4.12  VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
    4.13  VS_VERSION_INTERNAL_2010=100
    4.14 @@ -58,6 +58,30 @@
    4.15  VS_VS_PLATFORM_NAME_2013="v120"
    4.16  VS_SDK_PLATFORM_NAME_2013=
    4.17  
    4.18 +VS_DESCRIPTION_2015="Microsoft Visual Studio 2015 - CURRENTLY NOT WORKING"
    4.19 +VS_VERSION_INTERNAL_2015=140
    4.20 +VS_MSVCR_2015=vcruntime140.dll
    4.21 +VS_MSVCP_2015=msvcp140.dll
    4.22 +VS_ENVVAR_2015="VS140COMNTOOLS"
    4.23 +VS_VS_INSTALLDIR_2015="Microsoft Visual Studio 14.0"
    4.24 +VS_SDK_INSTALLDIR_2015=
    4.25 +VS_VS_PLATFORM_NAME_2015="v140"
    4.26 +VS_SDK_PLATFORM_NAME_2015=
    4.27 +# The vcvars of 2015 breaks if 2017 is also installed. Work around this by
    4.28 +# explicitly specifying Windows Kit 8.1 to be used.
    4.29 +VS_ENV_ARGS_2015="8.1"
    4.30 +
    4.31 +VS_DESCRIPTION_2017="Microsoft Visual Studio 2017 - CURRENTLY NOT WORKING"
    4.32 +VS_VERSION_INTERNAL_2017=141
    4.33 +VS_MSVCR_2017=vcruntime140.dll
    4.34 +VS_MSVCP_2017=msvcp140.dll
    4.35 +VS_ENVVAR_2017="VS150COMNTOOLS"
    4.36 +VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017"
    4.37 +VS_EDITIONS_2017="Community Professional Enterprise"
    4.38 +VS_SDK_INSTALLDIR_2017=
    4.39 +VS_VS_PLATFORM_NAME_2017="v141"
    4.40 +VS_SDK_PLATFORM_NAME_2017=
    4.41 +
    4.42  ################################################################################
    4.43  
    4.44  AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
    4.45 @@ -67,23 +91,42 @@
    4.46      VS_BASE="$2"
    4.47      METHOD="$3"
    4.48  
    4.49 -    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
    4.50 -      VCVARSFILE="vc/bin/vcvars32.bat"
    4.51 -    else
    4.52 -      VCVARSFILE="vc/bin/amd64/vcvars64.bat"
    4.53 +    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
    4.54 +    # In VS 2017, the default installation is in a subdir named after the edition.
    4.55 +    # Find the first one present and use that.
    4.56 +    if test "x$VS_EDITIONS" != x; then
    4.57 +      for edition in $VS_EDITIONS; do
    4.58 +        if test -d "$VS_BASE/$edition"; then
    4.59 +          VS_BASE="$VS_BASE/$edition"
    4.60 +          break
    4.61 +        fi
    4.62 +      done
    4.63      fi
    4.64    
    4.65 -    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
    4.66      if test -d "$VS_BASE"; then
    4.67 -      if test -f "$VS_BASE/$VCVARSFILE"; then
    4.68 -        AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
    4.69 -        VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
    4.70 -        # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
    4.71 -        # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100', 'v110' or 'v120' for VS 2010, 2012 or VS2013
    4.72 +      AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
    4.73 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
    4.74 +        VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
    4.75 +      else
    4.76 +        VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
    4.77 +            vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
    4.78 +      fi
    4.79 +
    4.80 +      for VCVARSFILE in $VCVARSFILES; do
    4.81 +        if test -f "$VS_BASE/$VCVARSFILE"; then
    4.82 +          VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
    4.83 +          break
    4.84 +        fi
    4.85 +      done
    4.86 +
    4.87 +      if test "x$VS_ENV_CMD" = x; then
    4.88 +        AC_MSG_NOTICE([Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring])
    4.89 +      else
    4.90 +        # PLATFORM_TOOLSET is used during the compilation of the freetype sources
    4.91 +        # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
    4.92 +        # 'v110' or 'v120' for VS 2010, 2012 or VS2013
    4.93          eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
    4.94 -      else
    4.95 -        AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
    4.96 -        AC_MSG_NOTICE([Warning: $VCVARSFILE is missing, this is probably Visual Studio Express. Ignoring])
    4.97 +
    4.98        fi
    4.99      fi
   4.100    fi
   4.101 @@ -133,7 +176,9 @@
   4.102    eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
   4.103    eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
   4.104    eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
   4.105 +  eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}"
   4.106    eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
   4.107 +  eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"
   4.108  
   4.109    # When using --with-tools-dir, assume it points to the correct and default
   4.110    # version of Visual Studio or that --with-toolchain-version was also set.
   4.111 @@ -153,7 +198,6 @@
   4.112    fi
   4.113  
   4.114    VS_ENV_CMD=""
   4.115 -  VS_ENV_ARGS=""
   4.116  
   4.117    if test "x$VS_COMNTOOLS" != x; then
   4.118      TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
   4.119 @@ -213,7 +257,11 @@
   4.120    elif test "x$DEVKIT_VS_VERSION" != x; then
   4.121      VS_VERSION=$DEVKIT_VS_VERSION
   4.122      TOOLCHAIN_VERSION=$VS_VERSION
   4.123 -    eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
   4.124 +    # If the devkit has a name, use that as description
   4.125 +    VS_DESCRIPTION="$DEVKIT_NAME"
   4.126 +    if test "x$VS_DESCRIPTION" = x; then
   4.127 +      eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
   4.128 +    fi
   4.129      eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
   4.130      eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
   4.131      eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
   4.132 @@ -267,6 +315,11 @@
   4.133        break
   4.134      fi
   4.135    done
   4.136 +
   4.137 +  TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
   4.138 +  if test "$TOOLCHAIN_VERSION" -gt 2013; then
   4.139 +    UNSUPPORTED_TOOLCHAIN_VERSION=yes
   4.140 +  fi
   4.141  ])
   4.142  
   4.143  ################################################################################
   4.144 @@ -320,6 +373,9 @@
   4.145        # This will end up something like:
   4.146        # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
   4.147        $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
   4.148 +      # In some cases, the VS_ENV_CMD will change directory, change back so
   4.149 +      # the set-vs-env.sh ends up in the right place.
   4.150 +      $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE
   4.151        # These will end up something like:
   4.152        # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
   4.153        # The trailing space for everyone except PATH is no typo, but is needed due
   4.154 @@ -447,18 +503,30 @@
   4.155    MSVC_DLL=
   4.156  
   4.157    if test "x$MSVC_DLL" = x; then
   4.158 -    # Probe: Using well-known location from Visual Studio 10.0
   4.159      if test "x$VCINSTALLDIR" != x; then
   4.160        CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
   4.161        BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
   4.162 -      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   4.163 -        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   4.164 +      if test "$VS_VERSION" -lt 2017; then
   4.165 +        # Probe: Using well-known location from Visual Studio 12.0 and older
   4.166 +        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   4.167 +          POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   4.168 +        else
   4.169 +          POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   4.170 +        fi
   4.171        else
   4.172 -        POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
   4.173 +        # Probe: Using well-known location from VS 2017
   4.174 +        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   4.175 +          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
   4.176 +        else
   4.177 +          POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
   4.178 +        fi
   4.179        fi
   4.180 -      $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
   4.181 -        TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
   4.182 +      # In case any of the above finds more than one file, loop over them.
   4.183 +      for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
   4.184 +        $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
   4.185 +        TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
   4.186              [well-known location in VCINSTALLDIR])
   4.187 +      done
   4.188      fi
   4.189    fi
   4.190  

mercurial