1.1 --- a/common/autoconf/toolchain_windows.m4 Wed May 16 15:52:51 2018 -0700 1.2 +++ b/common/autoconf/toolchain_windows.m4 Mon May 21 06:54:25 2018 -0700 1.3 @@ -210,6 +210,37 @@ 1.4 done 1.5 1.6 exit 0 1.7 + elif test "x$DEVKIT_VS_VERSION" != x; then 1.8 + VS_VERSION=$DEVKIT_VS_VERSION 1.9 + TOOLCHAIN_VERSION=$VS_VERSION 1.10 + eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}" 1.11 + eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}" 1.12 + eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}" 1.13 + eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}" 1.14 + eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}" 1.15 + VS_PATH="$TOOLCHAIN_PATH:$PATH" 1.16 + 1.17 + # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it 1.18 + # can still be exported as INCLUDE for compiler invocations without 1.19 + # SYSROOT_CFLAGS 1.20 + OLDIFS="$IFS" 1.21 + IFS=";" 1.22 + for i in $DEVKIT_VS_INCLUDE; do 1.23 + ipath=$i 1.24 + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([ipath]) 1.25 + VS_INCLUDE="$VS_INCLUDE;$ipath" 1.26 + done 1.27 + # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported 1.28 + # as LIB for compiler invocations without SYSROOT_LDFLAGS 1.29 + for i in $DEVKIT_VS_LIB; do 1.30 + libpath=$i 1.31 + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([libpath]) 1.32 + VS_LIB="$VS_LIB;$libpath" 1.33 + done 1.34 + IFS="$OLDIFS" 1.35 + 1.36 + AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION]) 1.37 + 1.38 elif test "x$with_toolchain_version" != x; then 1.39 # User override; check that it is valid 1.40 if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then 1.41 @@ -262,71 +293,81 @@ 1.42 # First-hand choice is to locate and run the vsvars bat file. 1.43 TOOLCHAIN_FIND_VISUAL_STUDIO 1.44 1.45 - if test "x$VS_ENV_CMD" != x; then 1.46 - # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. 1.47 - BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD) 1.48 + # If we have a devkit, skip all of the below. 1.49 + if test "x$DEVKIT_VS_VERSION" = x; then 1.50 + if test "x$VS_ENV_CMD" != x; then 1.51 + # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file. 1.52 + BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD) 1.53 1.54 - # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat 1.55 - AC_MSG_NOTICE([Trying to extract Visual Studio environment variables]) 1.56 + # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat 1.57 + AC_MSG_NOTICE([Trying to extract Visual Studio environment variables]) 1.58 1.59 - # We need to create a couple of temporary files. 1.60 - VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env" 1.61 - $MKDIR -p $VS_ENV_TMP_DIR 1.62 + # We need to create a couple of temporary files. 1.63 + VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env" 1.64 + $MKDIR -p $VS_ENV_TMP_DIR 1.65 1.66 - # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). 1.67 - # Instead create a shell script which will set the relevant variables when run. 1.68 - WINPATH_VS_ENV_CMD="$VS_ENV_CMD" 1.69 - BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD]) 1.70 - WINPATH_BASH="$BASH" 1.71 - BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH]) 1.72 + # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). 1.73 + # Instead create a shell script which will set the relevant variables when run. 1.74 + WINPATH_VS_ENV_CMD="$VS_ENV_CMD" 1.75 + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD]) 1.76 + WINPATH_BASH="$BASH" 1.77 + BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH]) 1.78 1.79 - # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell 1.80 - # script (executable by bash) that will setup the important variables. 1.81 - EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" 1.82 - $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE 1.83 - # This will end up something like: 1.84 - # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat 1.85 - $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE 1.86 - # These will end up something like: 1.87 - # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh 1.88 - # The trailing space for everyone except PATH is no typo, but is needed due 1.89 - # to trailing \ in the Windows paths. These will be stripped later. 1.90 - $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE 1.91 - $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE 1.92 - $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE 1.93 - $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE 1.94 - $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE 1.95 - $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE 1.96 + # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell 1.97 + # script (executable by bash) that will setup the important variables. 1.98 + EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" 1.99 + $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE 1.100 + # This will end up something like: 1.101 + # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat 1.102 + $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE 1.103 + # These will end up something like: 1.104 + # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh 1.105 + # The trailing space for everyone except PATH is no typo, but is needed due 1.106 + # to trailing \ in the Windows paths. These will be stripped later. 1.107 + $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \ 1.108 + >> $EXTRACT_VC_ENV_BAT_FILE 1.109 + $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' \ 1.110 + >> $EXTRACT_VC_ENV_BAT_FILE 1.111 + $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' \ 1.112 + >> $EXTRACT_VC_ENV_BAT_FILE 1.113 + $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \ 1.114 + >> $EXTRACT_VC_ENV_BAT_FILE 1.115 + $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \ 1.116 + >> $EXTRACT_VC_ENV_BAT_FILE 1.117 + $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \ 1.118 + >> $EXTRACT_VC_ENV_BAT_FILE 1.119 1.120 - # Now execute the newly created bat file. 1.121 - # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. 1.122 - # Change directory so we don't need to mess with Windows paths in redirects. 1.123 - cd $VS_ENV_TMP_DIR 1.124 - cmd /c extract-vs-env.bat | $CAT 1.125 - cd $CURDIR 1.126 + # Now execute the newly created bat file. 1.127 + # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. 1.128 + # Change directory so we don't need to mess with Windows paths in redirects. 1.129 + cd $VS_ENV_TMP_DIR 1.130 + cmd /c extract-vs-env.bat | $CAT 1.131 + cd $CURDIR 1.132 1.133 - if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then 1.134 - AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.]) 1.135 - AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) 1.136 - AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) 1.137 - AC_MSG_ERROR([Cannot continue]) 1.138 + if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then 1.139 + AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.]) 1.140 + AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) 1.141 + AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.]) 1.142 + AC_MSG_ERROR([Cannot continue]) 1.143 + fi 1.144 + 1.145 + # Now set all paths and other env variables. This will allow the rest of 1.146 + # the configure script to find and run the compiler in the proper way. 1.147 + AC_MSG_NOTICE([Setting extracted environment variables]) 1.148 + . $VS_ENV_TMP_DIR/set-vs-env.sh 1.149 + # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we 1.150 + # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. 1.151 + else 1.152 + # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. 1.153 + AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment]) 1.154 fi 1.155 - 1.156 - # Now set all paths and other env variables. This will allow the rest of 1.157 - # the configure script to find and run the compiler in the proper way. 1.158 - AC_MSG_NOTICE([Setting extracted environment variables]) 1.159 - . $VS_ENV_TMP_DIR/set-vs-env.sh 1.160 - # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we 1.161 - # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR. 1.162 - else 1.163 - # We did not find a vsvars bat file, let's hope we are run from a VS command prompt. 1.164 - AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment]) 1.165 fi 1.166 1.167 # At this point, we should have correct variables in the environment, or we can't continue. 1.168 AC_MSG_CHECKING([for Visual Studio variables]) 1.169 1.170 - if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then 1.171 + if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \ 1.172 + || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then 1.173 if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then 1.174 AC_MSG_RESULT([present but broken]) 1.175 AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.]) 1.176 @@ -367,10 +408,10 @@ 1.177 POSSIBLE_MSVC_DLL="$2" 1.178 METHOD="$3" 1.179 if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then 1.180 - AC_MSG_NOTICE([Found $1 at $POSSIBLE_MSVC_DLL using $METHOD]) 1.181 + AC_MSG_NOTICE([Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD]) 1.182 1.183 # Need to check if the found msvcr is correct architecture 1.184 - AC_MSG_CHECKING([found $1 architecture]) 1.185 + AC_MSG_CHECKING([found $DLL_NAME architecture]) 1.186 MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"` 1.187 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then 1.188 # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit" 1.189 @@ -390,19 +431,19 @@ 1.190 if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then 1.191 AC_MSG_RESULT([ok]) 1.192 MSVC_DLL="$POSSIBLE_MSVC_DLL" 1.193 - AC_MSG_CHECKING([for $1]) 1.194 + BASIC_FIXUP_PATH(MSVC_DLL) 1.195 + AC_MSG_CHECKING([for $DLL_NAME]) 1.196 AC_MSG_RESULT([$MSVC_DLL]) 1.197 else 1.198 AC_MSG_RESULT([incorrect, ignoring]) 1.199 - AC_MSG_NOTICE([The file type of the located $1 is $MSVC_DLL_FILETYPE]) 1.200 + AC_MSG_NOTICE([The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE]) 1.201 fi 1.202 fi 1.203 ]) 1.204 1.205 AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL], 1.206 [ 1.207 - VAR_NAME="$1" 1.208 - DLL_NAME="$2" 1.209 + DLL_NAME="$1" 1.210 MSVC_DLL= 1.211 1.212 if test "x$MSVC_DLL" = x; then 1.213 @@ -481,10 +522,6 @@ 1.214 AC_MSG_RESULT([no]) 1.215 AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.]) 1.216 fi 1.217 - 1.218 - $1=$MSVC_DLL 1.219 - BASIC_FIXUP_PATH($1) 1.220 - AC_SUBST($1, [$]$1) 1.221 ]) 1.222 1.223 AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS], 1.224 @@ -494,14 +531,22 @@ 1.225 1.226 if test "x$with_msvcr_dll" != x; then 1.227 # If given explicitely by user, do not probe. If not present, fail directly. 1.228 - TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcr_dll], 1.229 - [--with-msvcr-dll]) 1.230 + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$with_msvcr_dll], [--with-msvcr-dll]) 1.231 if test "x$MSVC_DLL" = x; then 1.232 AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll]) 1.233 fi 1.234 + MSVCR_DLL="$MSVC_DLL" 1.235 + elif test "x$DEVKIT_MSVCR_DLL" != x; then 1.236 + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$DEVKIT_MSVCR_DLL], [devkit]) 1.237 + if test "x$MSVC_DLL" = x; then 1.238 + AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by devkit]) 1.239 + fi 1.240 + MSVCR_DLL="$MSVC_DLL" 1.241 else 1.242 - TOOLCHAIN_SETUP_MSVC_DLL([MSVCR_DLL], [${MSVCR_NAME}]) 1.243 + TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}]) 1.244 + MSVCR_DLL="$MSVC_DLL" 1.245 fi 1.246 + AC_SUBST(MSVCR_DLL) 1.247 1.248 AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll], 1.249 [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])]) 1.250 @@ -509,14 +554,22 @@ 1.251 if test "x$MSVCP_NAME" != "x"; then 1.252 if test "x$with_msvcp_dll" != x; then 1.253 # If given explicitely by user, do not probe. If not present, fail directly. 1.254 - TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcp_dll], 1.255 - [--with-msvcp-dll]) 1.256 + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$with_msvcp_dll], [--with-msvcp-dll]) 1.257 if test "x$MSVC_DLL" = x; then 1.258 AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll]) 1.259 fi 1.260 + MSVCP_DLL="$MSVC_DLL" 1.261 + elif test "x$DEVKIT_MSVCP_DLL" != x; then 1.262 + TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit]) 1.263 + if test "x$MSVC_DLL" = x; then 1.264 + AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit]) 1.265 + fi 1.266 + MSVCP_DLL="$MSVC_DLL" 1.267 else 1.268 - TOOLCHAIN_SETUP_MSVC_DLL([MSVCP_DLL], [${MSVCP_NAME}]) 1.269 + TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}]) 1.270 + MSVCP_DLL="$MSVC_DLL" 1.271 fi 1.272 + AC_SUBST(MSVCP_DLL) 1.273 fi 1.274 ]) 1.275