370 |
369 |
371 # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment). |
370 # 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. |
371 # Instead create a shell script which will set the relevant variables when run. |
373 WINPATH_VS_ENV_CMD="$VS_ENV_CMD" |
372 WINPATH_VS_ENV_CMD="$VS_ENV_CMD" |
374 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD]) |
373 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD]) |
375 WINPATH_BASH="$BASH" |
374 |
376 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH]) |
375 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then |
|
376 WINPATH_BASH="bash" |
|
377 else |
|
378 WINPATH_BASH="$BASH" |
|
379 BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH]) |
|
380 fi |
377 |
381 |
378 # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell |
382 # 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. |
383 # script (executable by bash) that will setup the important variables. |
380 EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" |
384 EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat" |
381 $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE |
385 $ECHO "@echo off" > $EXTRACT_VC_ENV_BAT_FILE |
382 # This will end up something like: |
386 # This will end up something like: |
383 # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat |
387 # 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 |
388 $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 |
389 # 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. |
390 # the set-vs-env.sh ends up in the right place. |
387 $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE |
391 $ECHO 'cd %~dp0' >> $EXTRACT_VC_ENV_BAT_FILE |
388 # These will end up something like: |
392 if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.wsl"; then |
389 # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh |
393 # These will end up something like: |
390 # The trailing space for everyone except PATH is no typo, but is needed due |
394 # echo VS_PATH=\"$PATH\" > set-vs-env.sh |
391 # to trailing \ in the Windows paths. These will be stripped later. |
395 # The trailing space for everyone except PATH is no typo, but is needed due |
392 $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \ |
396 # to trailing \ in the Windows paths. These will be stripped later. |
393 >> $EXTRACT_VC_ENV_BAT_FILE |
397 # Trying pure CMD extract. This results in windows paths that need to |
394 $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \ |
398 # be converted post extraction, but a simpler script. |
395 >> $EXTRACT_VC_ENV_BAT_FILE |
399 $ECHO 'echo VS_PATH="%PATH%" > set-vs-env.sh' \ |
396 $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \ |
400 >> $EXTRACT_VC_ENV_BAT_FILE |
397 >> $EXTRACT_VC_ENV_BAT_FILE |
401 $ECHO 'echo VS_INCLUDE="%INCLUDE% " >> set-vs-env.sh' \ |
398 $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \ |
402 >> $EXTRACT_VC_ENV_BAT_FILE |
399 >> $EXTRACT_VC_ENV_BAT_FILE |
403 $ECHO 'echo VS_LIB="%LIB% " >> set-vs-env.sh' \ |
400 $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \ |
404 >> $EXTRACT_VC_ENV_BAT_FILE |
401 >> $EXTRACT_VC_ENV_BAT_FILE |
405 $ECHO 'echo VCINSTALLDIR="%VCINSTALLDIR% " >> set-vs-env.sh' \ |
402 $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \ |
406 >> $EXTRACT_VC_ENV_BAT_FILE |
403 >> $EXTRACT_VC_ENV_BAT_FILE |
407 $ECHO 'echo WindowsSdkDir="%WindowsSdkDir% " >> set-vs-env.sh' \ |
|
408 >> $EXTRACT_VC_ENV_BAT_FILE |
|
409 $ECHO 'echo WINDOWSSDKDIR="%WINDOWSSDKDIR% " >> set-vs-env.sh' \ |
|
410 >> $EXTRACT_VC_ENV_BAT_FILE |
|
411 else |
|
412 # These will end up something like: |
|
413 # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh |
|
414 # The trailing space for everyone except PATH is no typo, but is needed due |
|
415 # to trailing \ in the Windows paths. These will be stripped later. |
|
416 $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' \ |
|
417 >> $EXTRACT_VC_ENV_BAT_FILE |
|
418 $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE\;$include \" >> set-vs-env.sh' \ |
|
419 >> $EXTRACT_VC_ENV_BAT_FILE |
|
420 $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB\;$lib \" >> set-vs-env.sh' \ |
|
421 >> $EXTRACT_VC_ENV_BAT_FILE |
|
422 $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \ |
|
423 >> $EXTRACT_VC_ENV_BAT_FILE |
|
424 $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \ |
|
425 >> $EXTRACT_VC_ENV_BAT_FILE |
|
426 $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \ |
|
427 >> $EXTRACT_VC_ENV_BAT_FILE |
|
428 fi |
404 |
429 |
405 # Now execute the newly created bat file. |
430 # Now execute the newly created bat file. |
406 # The | cat is to stop SetEnv.Cmd to mess with system colors on msys. |
431 # 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. |
432 # Change directory so we don't need to mess with Windows paths in redirects. |
408 cd $VS_ENV_TMP_DIR |
433 cd $VS_ENV_TMP_DIR |
409 cmd /c extract-vs-env.bat | $CAT |
434 $CMD /c extract-vs-env.bat | $CAT |
410 cd $CURDIR |
435 cd $CURDIR |
411 |
436 |
412 if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then |
437 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.]) |
438 AC_MSG_NOTICE([Could not succesfully extract the environment variables needed for the VS setup.]) |
414 AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation]) |
439 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.]) |
440 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]) |
441 AC_MSG_ERROR([Cannot continue]) |
417 fi |
442 fi |
|
443 |
|
444 # Remove windows line endings |
|
445 $SED -i -e 's|\r||g' $VS_ENV_TMP_DIR/set-vs-env.sh |
418 |
446 |
419 # Now set all paths and other env variables. This will allow the rest of |
447 # 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. |
448 # the configure script to find and run the compiler in the proper way. |
421 AC_MSG_NOTICE([Setting extracted environment variables]) |
449 AC_MSG_NOTICE([Setting extracted environment variables]) |
422 . $VS_ENV_TMP_DIR/set-vs-env.sh |
450 . $VS_ENV_TMP_DIR/set-vs-env.sh |
614 # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now. |
664 # 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) |
665 # (This was the original behaviour; kept since it might turn something up) |
616 if test "x$CYGWIN_VC_INSTALL_DIR" != x; then |
666 if test "x$CYGWIN_VC_INSTALL_DIR" != x; then |
617 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then |
667 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then |
618 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ |
668 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ |
619 | $GREP x64 | $HEAD --lines 1` |
669 | $GREP x64 | $HEAD --lines 1` |
620 else |
670 else |
621 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ |
671 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ |
622 | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1` |
672 | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1` |
623 if test "x$POSSIBLE_MSVC_DLL" = x; then |
673 if test "x$POSSIBLE_MSVC_DLL" = x; then |
624 # We're grasping at straws now... |
674 # We're grasping at straws now... |
625 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ |
675 POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \ |
626 | $HEAD --lines 1` |
676 | $HEAD --lines 1` |
627 fi |
677 fi |
628 fi |
678 fi |
629 |
679 |
630 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], |
680 TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL], |
631 [search of VCINSTALLDIR]) |
681 [search of VCINSTALLDIR]) |