< 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=


  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


 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


 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])


   1 #
   2 # Copyright (c) 2011, 2018, 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=


  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 ################################################################################
  93 
  94 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_VISUAL_STUDIO_ROOT],
  95 [
  96   if test "x$VS_ENV_CMD" = x; then
  97     VS_VERSION="$1"
  98     VS_BASE="$2"
  99     METHOD="$3"
 100 
 101     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VS_BASE)
 102     # In VS 2017, the default installation is in a subdir named after the edition.
 103     # Find the first one present and use that.
 104     if test "x$VS_EDITIONS" != x; then
 105       for edition in $VS_EDITIONS; do
 106         if test -d "$VS_BASE/$edition"; then
 107           VS_BASE="$VS_BASE/$edition"
 108           break
 109         fi
 110       done
 111     fi
 112 
 113     if test -d "$VS_BASE"; then
 114       AC_MSG_NOTICE([Found Visual Studio installation at $VS_BASE using $METHOD])
 115       if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
 116         VCVARSFILES="vc/bin/vcvars32.bat vc/auxiliary/build/vcvars32.bat"
 117       else
 118         VCVARSFILES="vc/bin/amd64/vcvars64.bat vc/bin/x86_amd64/vcvarsx86_amd64.bat \
 119             VC/Auxiliary/Build/vcvarsx86_amd64.bat VC/Auxiliary/Build/vcvars64.bat"
 120       fi
 121 
 122       for VCVARSFILE in $VCVARSFILES; do


 455             >> $EXTRACT_VC_ENV_BAT_FILE
 456         $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \
 457             >> $EXTRACT_VC_ENV_BAT_FILE
 458         $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \
 459             >> $EXTRACT_VC_ENV_BAT_FILE
 460         $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \
 461             >> $EXTRACT_VC_ENV_BAT_FILE
 462         $ECHO "$WINPATH_BASH -c 'echo VCToolsRedistDir="'\"$VCToolsRedistDir \" >> set-vs-env.sh' \
 463             >> $EXTRACT_VC_ENV_BAT_FILE
 464         $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \
 465             >> $EXTRACT_VC_ENV_BAT_FILE
 466         $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \
 467             >> $EXTRACT_VC_ENV_BAT_FILE
 468       fi
 469 
 470       # Now execute the newly created bat file.
 471       # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
 472       # Change directory so we don't need to mess with Windows paths in redirects.
 473       cd $VS_ENV_TMP_DIR
 474       $CMD /c extract-vs-env.bat | $CAT
 475       cd $CURDIR
 476 
 477       if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
 478         AC_MSG_NOTICE([Could not succesfully extract the environment variables needed for the VS setup.])
 479         AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 480         AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 481         AC_MSG_ERROR([Cannot continue])
 482       fi
 483 
 484       # Remove windows line endings
 485       $SED -i -e 's|\r||g' $VS_ENV_TMP_DIR/set-vs-env.sh
 486 
 487       # Now set all paths and other env variables. This will allow the rest of
 488       # the configure script to find and run the compiler in the proper way.
 489       AC_MSG_NOTICE([Setting extracted environment variables])
 490       . $VS_ENV_TMP_DIR/set-vs-env.sh
 491       # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
 492       # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
 493 
 494       # In WSL, the extracted VS_PATH is Windows style. This needs to be
 495       # rewritten as Unix style and the Windows style version is saved


 645 
 646 AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
 647 [
 648   DLL_NAME="$1"
 649   MSVC_DLL=
 650 
 651   if test "x$MSVC_DLL" = x; then
 652     if test "x$VCINSTALLDIR" != x; then
 653       CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
 654       BASIC_FIXUP_PATH(CYGWIN_VC_INSTALL_DIR)
 655       if test "$VS_VERSION" -lt 2017; then
 656         # Probe: Using well-known location from Visual Studio 12.0 and older
 657         if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 658           POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 659         else
 660           POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 661         fi
 662       else
 663         CYGWIN_VC_TOOLS_REDIST_DIR="$VCToolsRedistDir"
 664         BASIC_FIXUP_PATH(CYGWIN_VC_TOOLS_REDIST_DIR)
 665         # Probe: Using well-known location from VS 2017
 666         if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 667           POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_TOOLS_REDIST_DIR/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
 668         else
 669           POSSIBLE_MSVC_DLL="`ls $CYGWIN_VC_TOOLS_REDIST_DIR/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME`"
 670         fi
 671       fi
 672       # In case any of the above finds more than one file, loop over them.
 673       for possible_msvc_dll in $POSSIBLE_MSVC_DLL; do
 674         $ECHO "POSSIBLE_MSVC_DLL $possible_msvc_dll"
 675         TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$possible_msvc_dll],
 676             [well-known location in VCINSTALLDIR])
 677       done
 678     fi
 679   fi
 680 
 681   if test "x$MSVC_DLL" = x; then
 682     # Probe: Check in the Boot JDK directory.
 683     POSSIBLE_MSVC_DLL="$BOOT_JDK/bin/$DLL_NAME"
 684     TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 685         [well-known location in Boot JDK])


< prev index next >