< prev index next >

make/autoconf/toolchain_windows.m4

Print this page


   1 #
   2 # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 ################################################################################
  27 # The order of these defines the priority by which we try to find them.
  28 VALID_VS_VERSIONS="2017 2019 2013 2015 2012 2010"
  29 
  30 VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
  31 VS_VERSION_INTERNAL_2010=100
  32 VS_MSVCR_2010=msvcr100.dll
  33 # We don't use msvcp on Visual Studio 2010
  34 #VS_MSVCP_2010=msvcp100.dll
  35 VS_ENVVAR_2010="VS100COMNTOOLS"
  36 VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
  37 VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
  38 VS_VS_PLATFORM_NAME_2010="v100"
  39 VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
  40 VS_SUPPORTED_2010=false
  41 
  42 VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
  43 VS_VERSION_INTERNAL_2012=110
  44 VS_MSVCR_2012=msvcr110.dll
  45 VS_MSVCP_2012=msvcp110.dll
  46 VS_ENVVAR_2012="VS110COMNTOOLS"
  47 VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
  48 VS_SDK_INSTALLDIR_2012=


  70 VS_SDK_INSTALLDIR_2015=
  71 VS_VS_PLATFORM_NAME_2015="v140"
  72 VS_SDK_PLATFORM_NAME_2015=
  73 # The vcvars of 2015 breaks if 2017 is also installed. Work around this by
  74 # explicitly specifying Windows Kit 8.1 to be used.
  75 VS_ENV_ARGS_2015="8.1"
  76 VS_SUPPORTED_2015=false
  77 
  78 VS_DESCRIPTION_2017="Microsoft Visual Studio 2017"
  79 VS_VERSION_INTERNAL_2017=141
  80 VS_MSVCR_2017=vcruntime140.dll
  81 VS_MSVCP_2017=msvcp140.dll
  82 VS_ENVVAR_2017="VS150COMNTOOLS"
  83 VS_USE_UCRT_2017="true"
  84 VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017"
  85 VS_EDITIONS_2017="BuildTools Community Professional Enterprise"
  86 VS_SDK_INSTALLDIR_2017=
  87 VS_VS_PLATFORM_NAME_2017="v141"
  88 VS_SDK_PLATFORM_NAME_2017=
  89 VS_SUPPORTED_2017=true
  90 VS_TOOLSET_SUPPORTED_2017=true
  91 
  92 VS_DESCRIPTION_2019="Microsoft Visual Studio 2019"
  93 VS_VERSION_INTERNAL_2019=141
  94 VS_MSVCR_2019=vcruntime140.dll
  95 VS_MSVCP_2019=msvcp140.dll
  96 VS_ENVVAR_2019="VS160COMNTOOLS"
  97 VS_USE_UCRT_2019="true"
  98 VS_VS_INSTALLDIR_2019="Microsoft Visual Studio/2019"
  99 VS_EDITIONS_2019="BuildTools Community Professional Enterprise"
 100 VS_SDK_INSTALLDIR_2019=
 101 VS_VS_PLATFORM_NAME_2019="v142"
 102 VS_SDK_PLATFORM_NAME_2019=
 103 VS_SUPPORTED_2019=false
 104 VS_TOOLSET_SUPPORTED_2019=false
 105 
 106 ################################################################################
 107 
 108 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
 109 [
 110   if test "x$VS_ENV_CMD" = x; then
 111     VS_VERSION="$1"
 112     VS_BASE="$2"
 113     METHOD="$3"
 114 
 115     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
 116     # In VS 2017 and VS 2019, the default installation is in a subdir named after the edition.
 117     # Find the first one present and use that.
 118     if test "x$VS_EDITIONS" != x; then
 119       for edition in $VS_EDITIONS; do
 120         if test -d "$VS_BASE/$edition"; then
 121           VS_BASE="$VS_BASE/$edition"
 122           break
 123         fi
 124       done
 125     fi
 126 
 127     if test -d "$VS_BASE"; then
 128       AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
 129       if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
 130         VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
 131       else
 132         VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
 133             VC/Auxiliary/Build/vcvarsx86_amd64.bat VC/Auxiliary/Build/vcvars64.bat"
 134       fi
 135 
 136       for VCVARSFILE in $VCVARSFILES; do
 137         if test -f "$VS_BASE/$VCVARSFILE"; then
 138           VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
 139           break
 140         fi
 141       done
 142 
 143       if test "x$VS_ENV_CMD" = x; then
 144         AC_MSG_NOTICE([Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring])
 145       else
 146         # PLATFORM_TOOLSET is used during the compilation of the freetype sources
 147         # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
 148         # 'v110' or 'v120' for VS 2010, 2012 or VS2013
 149         eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
 150       fi
 151     fi
 152   fi
 153 ])


 175         else
 176           VS_ENV_ARGS="/x64"
 177         fi
 178         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
 179         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
 180         # TODO: improve detection for other versions of SDK
 181         eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
 182       else
 183         AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
 184         AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
 185       fi
 186     fi
 187   fi
 188 ])
 189 
 190 ################################################################################
 191 # Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
 192 # build environment and assigns it to VS_ENV_CMD
 193 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
 194 [
 195   # VS2017 provides the option to install previous minor versions of the MSVC
 196   # toolsets. It is not possible to directly download earlier minor versions of
 197   # VS2017 and in order to build with a previous minor compiler toolset version,
 198   # it is now possible to compile with earlier minor versions by passing
 199   # -vcvars_ver=<toolset_version> argument to vcvarsall.bat.
 200   AC_ARG_WITH(msvc-toolset-version, [AS_HELP_STRING([--with-msvc-toolset-version],
 201       [specific MSVC toolset version to use, passed as -vcvars_ver argument to
 202        pass to vcvarsall.bat (Windows only)])])
 203 
 204   VS_VERSION="$1"
 205   eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
 206   eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
 207   eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
 208   eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}"
 209   eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
 210   eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"
 211   eval VS_TOOLSET_SUPPORTED="\${VS_TOOLSET_SUPPORTED_${VS_VERSION}}"
 212 
 213   # When using --with-tools-dir, assume it points to the correct and default
 214   # version of Visual Studio or that --with-toolchain-version was also set.
 215   if test "x$with_tools_dir" != x; then
 216     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 217         [$with_tools_dir/../..], [--with-tools-dir])
 218     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 219         [$with_tools_dir/../../..], [--with-tools-dir])
 220     if test "x$VS_ENV_CMD" = x; then
 221       # Having specified an argument which is incorrect will produce an instant failure;
 222       # we should not go on looking
 223       AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
 224       AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
 225       AC_MSG_NOTICE([directory within the Visual Studio installation])
 226       AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
 227     fi
 228   fi
 229 
 230   VS_ENV_CMD=""
 231 
 232   if test "x$VS_COMNTOOLS" != x; then
 233     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 234         [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
 235   fi
 236   if test "x$PROGRAMFILES" != x; then
 237     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 238         [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
 239   fi
 240   # Work around the insanely named ProgramFiles(x86) env variable
 241   PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
 242   if test "x$PROGRAMFILES_X86" != x; then
 243     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 244         [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
 245   fi
 246   TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 247       [C:/Program Files/$VS_INSTALL_DIR], [well-known name])
 248   TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 249       [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])

 250   if test "x$SDK_INSTALL_DIR" != x; then
 251     if test "x$ProgramW6432" != x; then
 252       TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 253           [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
 254     fi
 255     if test "x$PROGRAMW6432" != x; then
 256       TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 257           [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
 258     fi
 259     if test "x$PROGRAMFILES" != x; then
 260       TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 261           [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
 262     fi
 263     TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 264         [C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
 265     TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 266         [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
 267   fi
 268 
 269   if test "x$VS_TOOLSET_SUPPORTED" != x; then
 270     if test "x$with_msvc_toolset_version" != x; then
 271       VS_ENV_ARGS="$VS_ENV_ARGS -vcvars_ver=$with_msvc_toolset_version"
 272     fi
 273   fi
 274 ])
 275 
 276 ################################################################################
 277 
 278 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
 279 [
 280   AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
 281       [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
 282 
 283   if test "x$with_toolchain_version" = xlist; then
 284     # List all toolchains
 285     AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
 286     for version in $VALID_VS_VERSIONS; do
 287       eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
 288       $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
 289     done
 290 
 291     exit 0
 292   elif test "x$DEVKIT_VS_VERSION" != x; then
 293     VS_VERSION=$DEVKIT_VS_VERSION
 294     TOOLCHAIN_VERSION=$VS_VERSION
 295     # If the devkit has a name, use that as description
 296     VS_DESCRIPTION="$DEVKIT_NAME"
 297     if test "x$VS_DESCRIPTION" = x; then
 298       eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
 299     fi
 300     eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
 301     eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
 302     eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
 303     eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
 304     eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
 305     eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
 306 
 307     # The TOOLCHAIN_PATH from a devkit is in Unix format. In WSL we need a
 308     # windows version of the complete VS_PATH as VS_PATH_WINDOWS
 309     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
 310       # Convert the toolchain path
 311       OLDIFS="$IFS"
 312       IFS=":"
 313       VS_PATH_WINDOWS=""
 314       for i in $TOOLCHAIN_PATH; do
 315         path=$i
 316         BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([path])
 317         VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$path"
 318       done
 319       IFS="$OLDIFS"
 320       # Append the current path from Windows env
 321       WINDOWS_PATH="`$CMD /c echo %PATH%`"
 322       VS_PATH_WINDOWS="$VS_PATH_WINDOWS;$WINDOWS_PATH"
 323     else
 324       VS_PATH="$TOOLCHAIN_PATH:$PATH"
 325     fi
 326 
 327     # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it
 328     # can still be exported as INCLUDE for compiler invocations without
 329     # SYSROOT_CFLAGS
 330     OLDIFS="$IFS"
 331     IFS=";"
 332     for i in $DEVKIT_VS_INCLUDE; do
 333       ipath=$i
 334       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([ipath])
 335       VS_INCLUDE="$VS_INCLUDE;$ipath"
 336     done
 337     # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported
 338     # as LIB for compiler invocations without SYSROOT_LDFLAGS
 339     for i in $DEVKIT_VS_LIB; do
 340       libpath=$i
 341       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([libpath])
 342       VS_LIB="$VS_LIB;$libpath"
 343     done
 344     IFS="$OLDIFS"
 345 


 371       # The rest of the variables are already evaled while probing
 372       AC_MSG_NOTICE([Found $VS_DESCRIPTION])
 373       break
 374     fi
 375   done
 376 
 377   TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
 378   if test "x$VS_SUPPORTED" = "xfalse"; then
 379     UNSUPPORTED_TOOLCHAIN_VERSION=yes
 380   fi
 381 ])
 382 
 383 ################################################################################
 384 # Check if the VS env variables were setup prior to running configure.
 385 # If not, then find vcvarsall.bat and run it automatically, and integrate
 386 # the set env variables into the spec file.
 387 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
 388 [
 389   # Store path to cygwin link.exe to help excluding it when searching for
 390   # VS linker. This must be done before changing the PATH when looking for VS.
 391   AC_PATH_PROG(CYGWIN_LINK, link.exe)
 392   if test "x$CYGWIN_LINK" != x; then
 393     AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
 394     "$CYGWIN_LINK" --version > /dev/null
 395     if test $? -eq 0 ; then
 396       AC_MSG_RESULT([yes])
 397     else
 398       AC_MSG_RESULT([no])
 399       # This might be the VS linker. Don't exclude it later on.
 400       CYGWIN_LINK=""
 401     fi
 402   fi
 403 
 404   # First-hand choice is to locate and run the vsvars bat file.
 405   TOOLCHAIN_FIND_VISUAL_STUDIO
 406 
 407   # If we have a devkit, skip all of the below.
 408   if test "x$DEVKIT_VS_VERSION" = x; then
 409     if test "x$VS_ENV_CMD" != x; then
 410       # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
 411       BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
 412 
 413       # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
 414       AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
 415 
 416       # We need to create a couple of temporary files.
 417       VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env"
 418       $MKDIR -p $VS_ENV_TMP_DIR
 419 
 420       # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
 421       # Instead create a shell script which will set the relevant variables when run.
 422       WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
 423       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
 424 
 425       if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
 426         WINPATH_BASH="bash"
 427       else
 428         WINPATH_BASH="$BASH"
 429         BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
 430       fi
 431 
 432       # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
 433       # script (executable by bash) that will setup the important variables.
 434       EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
 435       $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
 436       # This will end up something like:
 437       # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
 438       $ECHO "call \"$WINPATH_VS_ENV_CMD\" $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
 439       # In some cases, the VS_ENV_CMD will change directory, change back so
 440       # the set-vs-env.sh ends up in the right place.
 441       $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE
 442       if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
 443         # These will end up something like:
 444         # echo VS_PATH=\"$PATH\" > set-vs-env.sh
 445         # The trailing space for everyone except PATH is no typo, but is needed due
 446         # to trailing \ in the Windows paths. These will be stripped later.
 447         # Trying pure CMD extract. This results in windows paths that need to
 448         # be converted post extraction, but a simpler script.
 449         $ECHO 'echo VS_PATH="%PATH%" > set-vs-env.sh' \
 450             >> $EXTRACT_VC_ENV_BAT_FILE
 451         $ECHO 'echo VS_INCLUDE="%INCLUDE% " >> set-vs-env.sh' \
 452             >> $EXTRACT_VC_ENV_BAT_FILE
 453         $ECHO 'echo VS_LIB="%LIB% " >> set-vs-env.sh' \
 454             >> $EXTRACT_VC_ENV_BAT_FILE
 455         $ECHO 'echo VCINSTALLDIR="%VCINSTALLDIR% " >> set-vs-env.sh' \
 456             >> $EXTRACT_VC_ENV_BAT_FILE
 457         $ECHO 'echo VCToolsRedistDir="%VCToolsRedistDir% " >> set-vs-env.sh' \
 458             >> $EXTRACT_VC_ENV_BAT_FILE
 459         $ECHO 'echo WindowsSdkDir="%WindowsSdkDir% " >> set-vs-env.sh' \
 460             >> $EXTRACT_VC_ENV_BAT_FILE
 461         $ECHO 'echo WINDOWSSDKDIR="%WINDOWSSDKDIR% " >> set-vs-env.sh' \
 462             >> $EXTRACT_VC_ENV_BAT_FILE
 463       else
 464         # These will end up something like:
 465         # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
 466         # The trailing space for everyone except PATH is no typo, but is needed due
 467         # to trailing \ in the Windows paths. These will be stripped later.
 468         $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \
 469             >> $EXTRACT_VC_ENV_BAT_FILE
 470         $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \
 471             >> $EXTRACT_VC_ENV_BAT_FILE
 472         $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \
 473             >> $EXTRACT_VC_ENV_BAT_FILE
 474         $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \
 475             >> $EXTRACT_VC_ENV_BAT_FILE
 476         $ECHO "$WINPATH_BASH -c 'echo VCToolsRedistDir="'\"$VCToolsRedistDir \" >> set-vs-env.sh' \
 477             >> $EXTRACT_VC_ENV_BAT_FILE
 478         $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \
 479             >> $EXTRACT_VC_ENV_BAT_FILE
 480         $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \
 481             >> $EXTRACT_VC_ENV_BAT_FILE
 482       fi
 483 
 484       # Now execute the newly created bat file.
 485       # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
 486       # Change directory so we don't need to mess with Windows paths in redirects.
 487       cd $VS_ENV_TMP_DIR
 488       $CMD /c extract-vs-env.bat | $CAT
 489       cd $CONFIGURE_START_DIR
 490 
 491       if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
 492         AC_MSG_NOTICE([Could not succesfully extract the environment variables needed for the VS setup.])
 493         AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 494         AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 495         AC_MSG_ERROR([Cannot continue])
 496       fi
 497 
 498       # Remove windows line endings
 499       $SED -i -e 's|\r||g' $VS_ENV_TMP_DIR/set-vs-env.sh
 500 
 501       # Now set all paths and other env variables. This will allow the rest of
 502       # the configure script to find and run the compiler in the proper way.
 503       AC_MSG_NOTICE([Setting extracted environment variables])
 504       . $VS_ENV_TMP_DIR/set-vs-env.sh
 505       # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
 506       # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
 507 
 508       # In WSL, the extracted VS_PATH is Windows style. This needs to be
 509       # rewritten as Unix style and the Windows style version is saved
 510       # in VS_PATH_WINDOWS.
 511       if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then
 512         OLDIFS="$IFS"
 513         IFS=";"
 514         # Convert VS_PATH to unix style
 515         VS_PATH_WINDOWS="$VS_PATH"
 516         VS_PATH=""
 517         for i in $VS_PATH_WINDOWS; do
 518           path=$i
 519           # Only process non-empty elements
 520           if test "x$path" != x; then
 521             IFS="$OLDIFS"
 522             # Check that directory exists before calling fixup_path
 523             testpath=$path
 524             BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
 525             if test -d "$testpath"; then
 526               BASIC_FIXUP_PATH([path])
 527               BASIC_APPEND_TO_PATH(VS_PATH, $path)
 528             fi
 529             IFS=";"
 530           fi
 531         done
 532         IFS="$OLDIFS"
 533       fi
 534 
 535     else
 536       # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
 537       AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
 538     fi
 539   fi
 540 
 541   # At this point, we should have correct variables in the environment, or we can't continue.
 542   AC_MSG_CHECKING([for Visual Studio variables])
 543 
 544   if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \
 545       || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then
 546     if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
 547       AC_MSG_RESULT([present but broken])
 548       AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
 549     else
 550       AC_MSG_RESULT([ok])
 551       # Remove any trailing "\" ";" and " " from the variables.
 552       VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'`
 553       VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'`
 554       VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
 555       VCToolsRedistDir=`$ECHO "$VCToolsRedistDir" | $SED 's/\\\\* *$//'`
 556       WindowsSdkDir=`$ECHO "$WindowsSdkDir" | $SED 's/\\\\* *$//'`
 557       WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
 558       if test -z "$WINDOWSSDKDIR"; then
 559         WINDOWSSDKDIR="$WindowsSdkDir"
 560       fi
 561       # Remove any paths containing # (typically F#) as that messes up make. This
 562       # is needed if visual studio was installed with F# support.
 563       VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
 564 
 565       AC_SUBST(VS_PATH)
 566       AC_SUBST(VS_INCLUDE)
 567       AC_SUBST(VS_LIB)
 568 
 569       # Convert VS_INCLUDE into SYSROOT_CFLAGS
 570       OLDIFS="$IFS"
 571       IFS=";"
 572       for i in $VS_INCLUDE; do
 573         ipath=$i
 574         # Only process non-empty elements
 575         if test "x$ipath" != x; then


 584           IFS=";"
 585         fi
 586       done
 587       # Convert VS_LIB into SYSROOT_LDFLAGS
 588       for i in $VS_LIB; do
 589         libpath=$i
 590         # Only process non-empty elements
 591         if test "x$libpath" != x; then
 592           IFS="$OLDIFS"
 593           # Check that directory exists before calling fixup_path
 594           testpath=$libpath
 595           BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
 596           if test -d "$testpath"; then
 597             BASIC_FIXUP_PATH([libpath])
 598             SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
 599           fi
 600           IFS=";"
 601         fi
 602       done
 603       IFS="$OLDIFS"
 604 
 605       AC_SUBST(VS_PATH_WINDOWS)
 606     fi
 607   else
 608     AC_MSG_RESULT([not found])
 609 
 610     if test "x$VS_ENV_CMD" = x; then
 611       AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
 612       AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
 613     else
 614       AC_MSG_NOTICE([Running the extraction script failed.])
 615     fi
 616     AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 617     AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 618     AC_MSG_ERROR([Cannot continue])
 619   fi
 620 ])
 621 
 622 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
 623 [
 624   DLL_NAME="$1"
 625   POSSIBLE_MSVC_DLL="$2"


 657   fi
 658 ])
 659 
 660 AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
 661 [
 662   DLL_NAME="$1"
 663   MSVC_DLL=
 664 
 665   if test "x$MSVC_DLL" = x; then
 666     if test "x$VCINSTALLDIR" != x; then
 667       CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
 668       BASIC_FIXUP_PATH(CYGWIN_VC_INSTALL_DIR)
 669       if test "$VS_VERSION" -lt 2017; then
 670         # Probe: Using well-known location from Visual Studio 12.0 and older
 671         if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 672           POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 673         else
 674           POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 675         fi
 676       else
 677         CYGWIN_VC_TOOLS_REDIST_DIR="$VCToolsRedistDir"
 678         BASIC_FIXUP_PATH(CYGWIN_VC_TOOLS_REDIST_DIR)
 679         # Probe: Using well-known location from VS 2017 and VS 2019
 680         if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 681           POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_TOOLS_REDIST_DIR/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
 682         else
 683           POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_TOOLS_REDIST_DIR/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
 684         fi
 685       fi
 686       # In case any of the above finds more than one file, loop over them.
 687       for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
 688         $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
 689         TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
 690             [well-known location in VCINSTALLDIR])
 691       done
 692     fi
 693   fi
 694 
 695   if test "x$MSVC_DLL" = x; then
 696     # Probe: Check in the Boot JDK directory.
 697     POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
 698     TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 699         [well-known location in Boot JDK])
 700   fi
 701 
 702   if test "x$MSVC_DLL" = x; then
 703     # Probe: Look in the Windows system32 directory
 704     CYGWIN_SYSTEMROOT="$SYSTEMROOT"
 705     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
 706     POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
 707     TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 708         [well-known location in SYSTEMROOT])
 709   fi
 710 
 711   if test "x$MSVC_DLL" = x; then
 712     # Probe: If Visual Studio Express is installed, there is usually one with the debugger
 713     if test "x$VS100COMNTOOLS" != x; then
 714       CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
 715       BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
 716       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 717         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
 718         | $GREP -i /x64/ | $HEAD --lines 1`
 719       else
 720         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
 721         | $GREP -i /x86/ | $HEAD --lines 1`
 722       fi
 723       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 724           [search of VS100COMNTOOLS])
 725     fi
 726   fi
 727 
 728   if test "x$MSVC_DLL" = x; then
 729     # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
 730     # (This was the original behaviour; kept since it might turn something up)
 731     if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
 732       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 733         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 734         | $GREP x64 | $HEAD --lines 1`
 735       else
 736         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 737         | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
 738         if test "x$POSSIBLE_MSVC_DLL" = x; then
 739           # We're grasping at straws now...
 740           POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 741           | $HEAD --lines 1`
 742         fi
 743       fi
 744 
 745       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 746           [search of VCINSTALLDIR])
 747     fi
 748   fi
 749 
 750   if test "x$MSVC_DLL" = x; then
 751     AC_MSG_CHECKING([for $DLL_NAME])
 752     AC_MSG_RESULT([no])
 753     AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
 754   fi
 755 ])
 756 
 757 AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
 758 [
 759   AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
 760       [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
 761 


 791       MSVCP_DLL="$MSVC_DLL"
 792     elif test "x$DEVKIT_MSVCP_DLL" != x; then
 793       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit])
 794       if test "x$MSVC_DLL" = x; then
 795         AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit])
 796       fi
 797       MSVCP_DLL="$MSVC_DLL"
 798     else
 799       TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}])
 800       MSVCP_DLL="$MSVC_DLL"
 801     fi
 802     AC_SUBST(MSVCP_DLL)
 803   fi
 804 
 805   AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir],
 806       [path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])])
 807 
 808   if test "x$USE_UCRT" = "xtrue"; then
 809     AC_MSG_CHECKING([for UCRT DLL dir])
 810     if test "x$with_ucrt_dll_dir" != x; then
 811       if test -z "$(ls -d $with_ucrt_dll_dir/*.dll 2> /dev/null)"; then
 812         AC_MSG_RESULT([no])
 813         AC_MSG_ERROR([Could not find any dlls in $with_ucrt_dll_dir])
 814       else
 815         AC_MSG_RESULT([$with_ucrt_dll_dir])
 816         UCRT_DLL_DIR="$with_ucrt_dll_dir"
 817         BASIC_FIXUP_PATH([UCRT_DLL_DIR])
 818       fi
 819     elif test "x$DEVKIT_UCRT_DLL_DIR" != "x"; then
 820       UCRT_DLL_DIR="$DEVKIT_UCRT_DLL_DIR"
 821       AC_MSG_RESULT($UCRT_DLL_DIR)
 822     else
 823       CYGWIN_WINDOWSSDKDIR="${WINDOWSSDKDIR}"
 824       BASIC_FIXUP_PATH([CYGWIN_WINDOWSSDKDIR])
 825       dll_subdir=$OPENJDK_TARGET_CPU
 826       if test "x$dll_subdir" = "xx86_64"; then
 827         dll_subdir="x64"
 828       fi
 829       UCRT_DLL_DIR="$CYGWIN_WINDOWSSDKDIR/Redist/ucrt/DLLs/$dll_subdir"
 830       if test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
 831         # Try with version subdir
 832         UCRT_DLL_DIR="`ls -d $CYGWIN_WINDOWSSDKDIR/Redist/*/ucrt/DLLs/$dll_subdir \
 833             2> /dev/null | $SORT -d | $HEAD -n1`"
 834         if test -z "$UCRT_DLL_DIR" \
 835             || test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
 836           AC_MSG_RESULT([no])
 837           AC_MSG_ERROR([Could not find any dlls in $UCRT_DLL_DIR])
 838         else
 839           AC_MSG_RESULT($UCRT_DLL_DIR)
 840         fi
 841       else
 842         AC_MSG_RESULT($UCRT_DLL_DIR)
 843       fi
 844     fi
 845   else
 846     UCRT_DLL_DIR=
 847   fi
 848   AC_SUBST(UCRT_DLL_DIR)
 849 ])
   1 #
   2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any
  23 # questions.
  24 #
  25 
  26 ################################################################################
  27 # The order of these defines the priority by which we try to find them.
  28 VALID_VS_VERSIONS="2017 2013 2015 2012 2010"
  29 
  30 VS_DESCRIPTION_2010="Microsoft Visual Studio 2010"
  31 VS_VERSION_INTERNAL_2010=100
  32 VS_MSVCR_2010=msvcr100.dll
  33 # We don't use msvcp on Visual Studio 2010
  34 #VS_MSVCP_2010=msvcp100.dll
  35 VS_ENVVAR_2010="VS100COMNTOOLS"
  36 VS_VS_INSTALLDIR_2010="Microsoft Visual Studio 10.0"
  37 VS_SDK_INSTALLDIR_2010="Microsoft SDKs/Windows/v7.1"
  38 VS_VS_PLATFORM_NAME_2010="v100"
  39 VS_SDK_PLATFORM_NAME_2010="Windows7.1SDK"
  40 VS_SUPPORTED_2010=false
  41 
  42 VS_DESCRIPTION_2012="Microsoft Visual Studio 2012"
  43 VS_VERSION_INTERNAL_2012=110
  44 VS_MSVCR_2012=msvcr110.dll
  45 VS_MSVCP_2012=msvcp110.dll
  46 VS_ENVVAR_2012="VS110COMNTOOLS"
  47 VS_VS_INSTALLDIR_2012="Microsoft Visual Studio 11.0"
  48 VS_SDK_INSTALLDIR_2012=


  70 VS_SDK_INSTALLDIR_2015=
  71 VS_VS_PLATFORM_NAME_2015="v140"
  72 VS_SDK_PLATFORM_NAME_2015=
  73 # The vcvars of 2015 breaks if 2017 is also installed. Work around this by
  74 # explicitly specifying Windows Kit 8.1 to be used.
  75 VS_ENV_ARGS_2015="8.1"
  76 VS_SUPPORTED_2015=false
  77 
  78 VS_DESCRIPTION_2017="Microsoft Visual Studio 2017"
  79 VS_VERSION_INTERNAL_2017=141
  80 VS_MSVCR_2017=vcruntime140.dll
  81 VS_MSVCP_2017=msvcp140.dll
  82 VS_ENVVAR_2017="VS150COMNTOOLS"
  83 VS_USE_UCRT_2017="true"
  84 VS_VS_INSTALLDIR_2017="Microsoft Visual Studio/2017"
  85 VS_EDITIONS_2017="BuildTools Community Professional Enterprise"
  86 VS_SDK_INSTALLDIR_2017=
  87 VS_VS_PLATFORM_NAME_2017="v141"
  88 VS_SDK_PLATFORM_NAME_2017=
  89 VS_SUPPORTED_2017=true















  90 
  91 ################################################################################
  92 
  93 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
  94 [
  95   if test "x$VS_ENV_CMD" = x; then
  96     VS_VERSION="$1"
  97     VS_BASE="$2"
  98     METHOD="$3"
  99 
 100     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
 101     # In VS 2017, the default installation is in a subdir named after the edition.
 102     # Find the first one present and use that.
 103     if test "x$VS_EDITIONS" != x; then
 104       for edition in $VS_EDITIONS; do
 105         if test -d "$VS_BASE/$edition"; then
 106           VS_BASE="$VS_BASE/$edition"
 107           break
 108         fi
 109       done
 110     fi
 111 
 112     if test -d "$VS_BASE"; then
 113       AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
 114       if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
 115         VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
 116       else
 117         VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
 118             vc/auxiliary/build/vcvarsx86_amd64.bat vc/auxiliary/build/vcvars64.bat"
 119       fi
 120 
 121       for VCVARSFILE in $VCVARSFILES; do
 122         if test -f "$VS_BASE/$VCVARSFILE"; then
 123           VS_ENV_CMD="$VS_BASE/$VCVARSFILE"
 124           break
 125         fi
 126       done
 127 
 128       if test "x$VS_ENV_CMD" = x; then
 129         AC_MSG_NOTICE([Warning: None of $VCVARSFILES were found, Visual Studio installation not recognized. Ignoring])
 130       else
 131         # PLATFORM_TOOLSET is used during the compilation of the freetype sources
 132         # (see 'LIB_BUILD_FREETYPE' in libraries.m4) and must be one of 'v100',
 133         # 'v110' or 'v120' for VS 2010, 2012 or VS2013
 134         eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
 135       fi
 136     fi
 137   fi
 138 ])


 160         else
 161           VS_ENV_ARGS="/x64"
 162         fi
 163         # PLATFORM_TOOLSET is used during the compilation of the freetype sources (see
 164         # 'LIB_BUILD_FREETYPE' in libraries.m4) and must be 'Windows7.1SDK' for Windows7.1SDK
 165         # TODO: improve detection for other versions of SDK
 166         eval PLATFORM_TOOLSET="\${VS_SDK_PLATFORM_NAME_${VS_VERSION}}"
 167       else
 168         AC_MSG_NOTICE([Found Windows SDK installation at $WIN_SDK_BASE using $METHOD])
 169         AC_MSG_NOTICE([Warning: Installation is broken, SetEnv.Cmd is missing. Ignoring])
 170       fi
 171     fi
 172   fi
 173 ])
 174 
 175 ################################################################################
 176 # Finds the bat or cmd file in Visual Studio or the SDK that sets up a proper
 177 # build environment and assigns it to VS_ENV_CMD
 178 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE],
 179 [









 180   VS_VERSION="$1"
 181   eval VS_COMNTOOLS_VAR="\${VS_ENVVAR_${VS_VERSION}}"
 182   eval VS_COMNTOOLS="\$${VS_COMNTOOLS_VAR}"
 183   eval VS_INSTALL_DIR="\${VS_VS_INSTALLDIR_${VS_VERSION}}"
 184   eval VS_EDITIONS="\${VS_EDITIONS_${VS_VERSION}}"
 185   eval SDK_INSTALL_DIR="\${VS_SDK_INSTALLDIR_${VS_VERSION}}"
 186   eval VS_ENV_ARGS="\${VS_ENV_ARGS_${VS_VERSION}}"

 187 
 188   # When using --with-tools-dir, assume it points to the correct and default
 189   # version of Visual Studio or that --with-toolchain-version was also set.
 190   if test "x$with_tools_dir" != x; then
 191     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 192         [$with_tools_dir/../..], [--with-tools-dir])
 193     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 194         [$with_tools_dir/../../..], [--with-tools-dir])
 195     if test "x$VS_ENV_CMD" = x; then
 196       # Having specified an argument which is incorrect will produce an instant failure;
 197       # we should not go on looking
 198       AC_MSG_NOTICE([The path given by --with-tools-dir does not contain a valid])
 199       AC_MSG_NOTICE([Visual Studio installation. Please point to the VC/bin or VC/bin/amd64])
 200       AC_MSG_NOTICE([directory within the Visual Studio installation])
 201       AC_MSG_ERROR([Cannot locate a valid Visual Studio installation])
 202     fi
 203   fi
 204 
 205   VS_ENV_CMD=""
 206 
 207   if test "x$VS_COMNTOOLS" != x; then
 208     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 209         [$VS_COMNTOOLS/../..], [$VS_COMNTOOLS_VAR variable])
 210   fi
 211   if test "x$PROGRAMFILES" != x; then
 212     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 213         [$PROGRAMFILES/$VS_INSTALL_DIR], [well-known name])
 214   fi
 215   # Work around the insanely named ProgramFiles(x86) env variable
 216   PROGRAMFILES_X86="`env | $SED -n 's/^ProgramFiles(x86)=//p'`"
 217   if test "x$PROGRAMFILES_X86" != x; then
 218     TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 219         [$PROGRAMFILES_X86/$VS_INSTALL_DIR], [well-known name])
 220   fi
 221   TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 222       [C:/Program Files/$VS_INSTALL_DIR], [well-known name])
 223   TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT([${VS_VERSION}],
 224       [C:/Program Files (x86)/$VS_INSTALL_DIR], [well-known name])
 225 
 226   if test "x$SDK_INSTALL_DIR" != x; then
 227     if test "x$ProgramW6432" != x; then
 228       TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 229           [$ProgramW6432/$SDK_INSTALL_DIR], [well-known name])
 230     fi
 231     if test "x$PROGRAMW6432" != x; then
 232       TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 233           [$PROGRAMW6432/$SDK_INSTALL_DIR], [well-known name])
 234     fi
 235     if test "x$PROGRAMFILES" != x; then
 236       TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 237           [$PROGRAMFILES/$SDK_INSTALL_DIR], [well-known name])
 238     fi
 239     TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 240         [C:/Program Files/$SDK_INSTALL_DIR], [well-known name])
 241     TOOLCHAIN_CHECK_POSSIBLE_WIN_SDK_ROOT([${VS_VERSION}],
 242         [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
 243   fi






 244 ])
 245 
 246 ################################################################################
 247 
 248 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
 249 [
 250   AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
 251       [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
 252 
 253   if test "x$with_toolchain_version" = xlist; then
 254     # List all toolchains
 255     AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
 256     for version in $VALID_VS_VERSIONS; do
 257       eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
 258       $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
 259     done
 260 
 261     exit 0
 262   elif test "x$DEVKIT_VS_VERSION" != x; then
 263     VS_VERSION=$DEVKIT_VS_VERSION
 264     TOOLCHAIN_VERSION=$VS_VERSION
 265     # If the devkit has a name, use that as description
 266     VS_DESCRIPTION="$DEVKIT_NAME"
 267     if test "x$VS_DESCRIPTION" = x; then
 268       eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
 269     fi
 270     eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
 271     eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
 272     eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
 273     eval USE_UCRT="\${VS_USE_UCRT_${VS_VERSION}}"
 274     eval VS_SUPPORTED="\${VS_SUPPORTED_${VS_VERSION}}"
 275     eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
 276     VS_PATH="$TOOLCHAIN_PATH:$PATH"



















 277 
 278     # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it
 279     # can still be exported as INCLUDE for compiler invocations without
 280     # SYSROOT_CFLAGS
 281     OLDIFS="$IFS"
 282     IFS=";"
 283     for i in $DEVKIT_VS_INCLUDE; do
 284       ipath=$i
 285       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([ipath])
 286       VS_INCLUDE="$VS_INCLUDE;$ipath"
 287     done
 288     # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported
 289     # as LIB for compiler invocations without SYSROOT_LDFLAGS
 290     for i in $DEVKIT_VS_LIB; do
 291       libpath=$i
 292       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([libpath])
 293       VS_LIB="$VS_LIB;$libpath"
 294     done
 295     IFS="$OLDIFS"
 296 


 322       # The rest of the variables are already evaled while probing
 323       AC_MSG_NOTICE([Found $VS_DESCRIPTION])
 324       break
 325     fi
 326   done
 327 
 328   TOOLCHAIN_DESCRIPTION="$VS_DESCRIPTION"
 329   if test "x$VS_SUPPORTED" = "xfalse"; then
 330     UNSUPPORTED_TOOLCHAIN_VERSION=yes
 331   fi
 332 ])
 333 
 334 ################################################################################
 335 # Check if the VS env variables were setup prior to running configure.
 336 # If not, then find vcvarsall.bat and run it automatically, and integrate
 337 # the set env variables into the spec file.
 338 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
 339 [
 340   # Store path to cygwin link.exe to help excluding it when searching for
 341   # VS linker. This must be done before changing the PATH when looking for VS.
 342   AC_PATH_PROG(CYGWIN_LINK, link)
 343   if test "x$CYGWIN_LINK" != x; then
 344     AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
 345     "$CYGWIN_LINK" --version > /dev/null
 346     if test $? -eq 0 ; then
 347       AC_MSG_RESULT([yes])
 348     else
 349       AC_MSG_RESULT([no])
 350       # This might be the VS linker. Don't exclude it later on.
 351       CYGWIN_LINK=""
 352     fi
 353   fi
 354 
 355   # First-hand choice is to locate and run the vsvars bat file.
 356   TOOLCHAIN_FIND_VISUAL_STUDIO
 357 
 358   # If we have a devkit, skip all of the below.
 359   if test "x$DEVKIT_VS_VERSION" = x; then
 360     if test "x$VS_ENV_CMD" != x; then
 361       # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
 362       BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
 363 
 364       # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
 365       AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
 366 
 367       # We need to create a couple of temporary files.
 368       VS_ENV_TMP_DIR="$CONFIGURESUPPORT_OUTPUTDIR/vs-env"
 369       $MKDIR -p $VS_ENV_TMP_DIR
 370 
 371       # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
 372       # Instead create a shell script which will set the relevant variables when run.
 373       WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
 374       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
 375       WINPATH_BASH="$BASH"
 376       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])





 377 
 378       # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
 379       # script (executable by bash) that will setup the important variables.
 380       EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
 381       $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
 382       # This will end up something like:
 383       # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
 384       $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
 385       # In some cases, the VS_ENV_CMD will change directory, change back so
 386       # the set-vs-env.sh ends up in the right place.
 387       $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE
 388       # These will end up something like:
 389       # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
 390       # The trailing space for everyone except PATH is no typo, but is needed due
 391       # to trailing \ in the Windows paths. These will be stripped later.
 392       $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \
 393           >> $EXTRACT_VC_ENV_BAT_FILE
 394       $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \
 395           >> $EXTRACT_VC_ENV_BAT_FILE
 396       $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \
 397           >> $EXTRACT_VC_ENV_BAT_FILE
 398       $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \
 399           >> $EXTRACT_VC_ENV_BAT_FILE
 400       $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \
 401           >> $EXTRACT_VC_ENV_BAT_FILE
 402       $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \
 403           >> $EXTRACT_VC_ENV_BAT_FILE

























 404 
 405       # Now execute the newly created bat file.
 406       # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
 407       # Change directory so we don't need to mess with Windows paths in redirects.
 408       cd $VS_ENV_TMP_DIR
 409       cmd /c extract-vs-env.bat | $CAT
 410       cd $CURDIR
 411 
 412       if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
 413         AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.])
 414         AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 415         AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 416         AC_MSG_ERROR([Cannot continue])
 417       fi
 418 



 419       # Now set all paths and other env variables. This will allow the rest of
 420       # the configure script to find and run the compiler in the proper way.
 421       AC_MSG_NOTICE([Setting extracted environment variables])
 422       . $VS_ENV_TMP_DIR/set-vs-env.sh
 423       # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
 424       # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.




























 425     else
 426       # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
 427       AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
 428     fi
 429   fi
 430 
 431   # At this point, we should have correct variables in the environment, or we can't continue.
 432   AC_MSG_CHECKING([for Visual Studio variables])
 433 
 434   if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \
 435       || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then
 436     if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
 437       AC_MSG_RESULT([present but broken])
 438       AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
 439     else
 440       AC_MSG_RESULT([ok])
 441       # Remove any trailing "\" ";" and " " from the variables.
 442       VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED -e 's/\\\\*;* *$//'`
 443       VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\*;* *$//'`
 444       VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`

 445       WindowsSdkDir=`$ECHO "$WindowsSdkDir" | $SED 's/\\\\* *$//'`
 446       WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
 447       if test -z "$WINDOWSSDKDIR"; then
 448         WINDOWSSDKDIR="$WindowsSdkDir"
 449       fi
 450       # Remove any paths containing # (typically F#) as that messes up make. This
 451       # is needed if visual studio was installed with F# support.
 452       VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
 453 
 454       AC_SUBST(VS_PATH)
 455       AC_SUBST(VS_INCLUDE)
 456       AC_SUBST(VS_LIB)
 457 
 458       # Convert VS_INCLUDE into SYSROOT_CFLAGS
 459       OLDIFS="$IFS"
 460       IFS=";"
 461       for i in $VS_INCLUDE; do
 462         ipath=$i
 463         # Only process non-empty elements
 464         if test "x$ipath" != x; then


 473           IFS=";"
 474         fi
 475       done
 476       # Convert VS_LIB into SYSROOT_LDFLAGS
 477       for i in $VS_LIB; do
 478         libpath=$i
 479         # Only process non-empty elements
 480         if test "x$libpath" != x; then
 481           IFS="$OLDIFS"
 482           # Check that directory exists before calling fixup_path
 483           testpath=$libpath
 484           BASIC_WINDOWS_REWRITE_AS_UNIX_PATH([testpath])
 485           if test -d "$testpath"; then
 486             BASIC_FIXUP_PATH([libpath])
 487             SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS -libpath:$libpath"
 488           fi
 489           IFS=";"
 490         fi
 491       done
 492       IFS="$OLDIFS"


 493     fi
 494   else
 495     AC_MSG_RESULT([not found])
 496 
 497     if test "x$VS_ENV_CMD" = x; then
 498       AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
 499       AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
 500     else
 501       AC_MSG_NOTICE([Running the extraction script failed.])
 502     fi
 503     AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 504     AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 505     AC_MSG_ERROR([Cannot continue])
 506   fi
 507 ])
 508 
 509 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
 510 [
 511   DLL_NAME="$1"
 512   POSSIBLE_MSVC_DLL="$2"


 544   fi
 545 ])
 546 
 547 AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
 548 [
 549   DLL_NAME="$1"
 550   MSVC_DLL=
 551 
 552   if test "x$MSVC_DLL" = x; then
 553     if test "x$VCINSTALLDIR" != x; then
 554       CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
 555       BASIC_FIXUP_PATH(CYGWIN_VC_INSTALL_DIR)
 556       if test "$VS_VERSION" -lt 2017; then
 557         # Probe: Using well-known location from Visual Studio 12.0 and older
 558         if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 559           POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 560         else
 561           POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 562         fi
 563       else
 564         # Probe: Using well-known location from VS 2017


 565         if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 566           POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
 567         else
 568           POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_INSTALL_DIR/Redist/MSVC/*/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
 569         fi
 570       fi
 571       # In case any of the above finds more than one file, loop over them.
 572       for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
 573         $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
 574         TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
 575             [well-known location in VCINSTALLDIR])
 576       done
 577     fi
 578   fi
 579 
 580   if test "x$MSVC_DLL" = x; then
 581     # Probe: Check in the Boot JDK directory.
 582     POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
 583     TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 584         [well-known location in Boot JDK])
 585   fi
 586 
 587   if test "x$MSVC_DLL" = x; then
 588     # Probe: Look in the Windows system32 directory
 589     CYGWIN_SYSTEMROOT="$SYSTEMROOT"
 590     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
 591     POSSIBLE_MSVC_DLL="$CYGWIN_SYSTEMROOT/system32/$DLL_NAME"
 592     TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 593         [well-known location in SYSTEMROOT])
 594   fi
 595 
 596   if test "x$MSVC_DLL" = x; then
 597     # Probe: If Visual Studio Express is installed, there is usually one with the debugger
 598     if test "x$VS100COMNTOOLS" != x; then
 599       CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
 600       BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
 601       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 602         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
 603             | $GREP -i /x64/ | $HEAD --lines 1`
 604       else
 605         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name $DLL_NAME \
 606             | $GREP -i /x86/ | $HEAD --lines 1`
 607       fi
 608       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 609           [search of VS100COMNTOOLS])
 610     fi
 611   fi
 612 
 613   if test "x$MSVC_DLL" = x; then
 614     # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
 615     # (This was the original behaviour; kept since it might turn something up)
 616     if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
 617       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 618         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 619             | $GREP x64 | $HEAD --lines 1`
 620       else
 621         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 622             | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
 623         if test "x$POSSIBLE_MSVC_DLL" = x; then
 624           # We're grasping at straws now...
 625           POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 626               | $HEAD --lines 1`
 627         fi
 628       fi
 629 
 630       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 631           [search of VCINSTALLDIR])
 632     fi
 633   fi
 634 
 635   if test "x$MSVC_DLL" = x; then
 636     AC_MSG_CHECKING([for $DLL_NAME])
 637     AC_MSG_RESULT([no])
 638     AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
 639   fi
 640 ])
 641 
 642 AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
 643 [
 644   AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
 645       [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
 646 


 676       MSVCP_DLL="$MSVC_DLL"
 677     elif test "x$DEVKIT_MSVCP_DLL" != x; then
 678       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit])
 679       if test "x$MSVC_DLL" = x; then
 680         AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit])
 681       fi
 682       MSVCP_DLL="$MSVC_DLL"
 683     else
 684       TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}])
 685       MSVCP_DLL="$MSVC_DLL"
 686     fi
 687     AC_SUBST(MSVCP_DLL)
 688   fi
 689 
 690   AC_ARG_WITH(ucrt-dll-dir, [AS_HELP_STRING([--with-ucrt-dll-dir],
 691       [path to Microsoft Windows Kit UCRT DLL dir (Windows only) @<:@probed@:>@])])
 692 
 693   if test "x$USE_UCRT" = "xtrue"; then
 694     AC_MSG_CHECKING([for UCRT DLL dir])
 695     if test "x$with_ucrt_dll_dir" != x; then
 696       if test -z "$(ls -d "$with_ucrt_dll_dir/*.dll" 2> /dev/null)"; then
 697         AC_MSG_RESULT([no])
 698         AC_MSG_ERROR([Could not find any dlls in $with_ucrt_dll_dir])
 699       else
 700         AC_MSG_RESULT([$with_ucrt_dll_dir])
 701         UCRT_DLL_DIR="$with_ucrt_dll_dir"
 702         BASIC_FIXUP_PATH([UCRT_DLL_DIR])
 703       fi
 704     elif test "x$DEVKIT_UCRT_DLL_DIR" != "x"; then
 705       UCRT_DLL_DIR="$DEVKIT_UCRT_DLL_DIR"
 706       AC_MSG_RESULT($UCRT_DLL_DIR)
 707     else
 708       CYGWIN_WINDOWSSDKDIR="${WINDOWSSDKDIR}"
 709       BASIC_FIXUP_PATH([CYGWIN_WINDOWSSDKDIR])
 710       dll_subdir=$OPENJDK_TARGET_CPU
 711       if test "x$dll_subdir" = "xx86_64"; then
 712         dll_subdir="x64"
 713       fi
 714       UCRT_DLL_DIR="$CYGWIN_WINDOWSSDKDIR/Redist/ucrt/DLLs/$dll_subdir"
 715       if test -z "$(ls -d "$UCRT_DLL_DIR/"*.dll 2> /dev/null)"; then
 716         AC_MSG_RESULT([no])
 717         AC_MSG_ERROR([Could not find any dlls in $UCRT_DLL_DIR])








 718       else
 719         AC_MSG_RESULT($UCRT_DLL_DIR)
 720       fi
 721     fi
 722   else
 723     UCRT_DLL_DIR=
 724   fi
 725   AC_SUBST(UCRT_DLL_DIR)
 726 ])
< prev index next >