< prev index next >

common/autoconf/toolchain_windows.m4

Print this page




 193         [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
 194   fi
 195 ])
 196 
 197 ################################################################################
 198 
 199 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
 200 [
 201   AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
 202       [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
 203 
 204   if test "x$with_toolchain_version" = xlist; then
 205     # List all toolchains
 206     AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
 207     for version in $VALID_VS_VERSIONS; do
 208       eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
 209       $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
 210     done
 211 
 212     exit 0































 213   elif test "x$with_toolchain_version" != x; then
 214     # User override; check that it is valid
 215     if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
 216       AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
 217       AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
 218       AC_MSG_ERROR([Cannot continue.])
 219     fi
 220     VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
 221   else
 222     # No flag given, use default
 223     VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
 224   fi
 225 
 226   for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
 227     TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
 228     if test "x$VS_ENV_CMD" != x; then
 229       TOOLCHAIN_VERSION=$VS_VERSION
 230       eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
 231       eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
 232       eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"


 245 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
 246 [
 247   # Store path to cygwin link.exe to help excluding it when searching for
 248   # VS linker. This must be done before changing the PATH when looking for VS.
 249   AC_PATH_PROG(CYGWIN_LINK, link)
 250   if test "x$CYGWIN_LINK" != x; then
 251     AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
 252     "$CYGWIN_LINK" --version > /dev/null
 253     if test $? -eq 0 ; then
 254       AC_MSG_RESULT([yes])
 255     else
 256       AC_MSG_RESULT([no])
 257       # This might be the VS linker. Don't exclude it later on.
 258       CYGWIN_LINK=""
 259     fi
 260   fi
 261 
 262   # First-hand choice is to locate and run the vsvars bat file.
 263   TOOLCHAIN_FIND_VISUAL_STUDIO
 264 


 265   if test "x$VS_ENV_CMD" != x; then
 266     # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
 267     BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
 268 
 269     # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
 270     AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
 271 
 272     # We need to create a couple of temporary files.
 273     VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env"
 274     $MKDIR -p $VS_ENV_TMP_DIR
 275 
 276     # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
 277     # Instead create a shell script which will set the relevant variables when run.
 278     WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
 279     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
 280     WINPATH_BASH="$BASH"
 281     BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
 282 
 283     # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
 284     # script (executable by bash) that will setup the important variables.
 285     EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
 286     $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
 287     # This will end up something like:
 288     # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
 289     $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
 290     # These will end up something like:
 291     # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
 292     # The trailing space for everyone except PATH is no typo, but is needed due
 293     # to trailing \ in the Windows paths. These will be stripped later.
 294     $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
 295     $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
 296     $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
 297     $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
 298     $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE
 299     $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' >> $EXTRACT_VC_ENV_BAT_FILE






 300 
 301     # Now execute the newly created bat file.
 302     # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
 303     # Change directory so we don't need to mess with Windows paths in redirects.
 304     cd $VS_ENV_TMP_DIR
 305     cmd /c extract-vs-env.bat | $CAT
 306     cd $CURDIR
 307 
 308     if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
 309       AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.])
 310       AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 311       AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 312       AC_MSG_ERROR([Cannot continue])
 313     fi
 314 
 315     # Now set all paths and other env variables. This will allow the rest of
 316     # the configure script to find and run the compiler in the proper way.
 317     AC_MSG_NOTICE([Setting extracted environment variables])
 318     . $VS_ENV_TMP_DIR/set-vs-env.sh
 319     # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
 320     # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
 321   else
 322     # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
 323     AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
 324   fi

 325 
 326   # At this point, we should have correct variables in the environment, or we can't continue.
 327   AC_MSG_CHECKING([for Visual Studio variables])
 328 
 329   if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x || test "x$WINDOWSSDKDIR" != x; then

 330     if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
 331       AC_MSG_RESULT([present but broken])
 332       AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
 333     else
 334       AC_MSG_RESULT([ok])
 335       # Remove any trailing "\" and " " from the variables.
 336       VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'`
 337       VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'`
 338       VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
 339       WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'`
 340       WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
 341       # Remove any paths containing # (typically F#) as that messes up make. This
 342       # is needed if visual studio was installed with F# support.
 343       VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
 344 
 345       AC_SUBST(VS_PATH)
 346       AC_SUBST(VS_INCLUDE)
 347       AC_SUBST(VS_LIB)
 348     fi
 349   else
 350     AC_MSG_RESULT([not found])
 351 
 352     if test "x$VS_ENV_CMD" = x; then
 353       AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
 354       AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
 355     else
 356       AC_MSG_NOTICE([Running the extraction script failed.])
 357     fi
 358     AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 359     AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 360     AC_MSG_ERROR([Cannot continue])
 361   fi
 362 ])
 363 
 364 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
 365 [
 366   DLL_NAME="$1"
 367   POSSIBLE_MSVC_DLL="$2"
 368   METHOD="$3"
 369   if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
 370     AC_MSG_NOTICE([Found $1 at $POSSIBLE_MSVC_DLL using $METHOD])
 371 
 372     # Need to check if the found msvcr is correct architecture
 373     AC_MSG_CHECKING([found $1 architecture])
 374     MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
 375     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
 376       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
 377       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
 378       if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
 379         CORRECT_MSVCR_ARCH="PE32 executable"
 380       else
 381         CORRECT_MSVCR_ARCH="PE32+ executable"
 382       fi
 383     else
 384       if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
 385         CORRECT_MSVCR_ARCH=386
 386       else
 387         CORRECT_MSVCR_ARCH=x86-64
 388       fi
 389     fi
 390     if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
 391       AC_MSG_RESULT([ok])
 392       MSVC_DLL="$POSSIBLE_MSVC_DLL"
 393       AC_MSG_CHECKING([for $1])

 394       AC_MSG_RESULT([$MSVC_DLL])
 395     else
 396       AC_MSG_RESULT([incorrect, ignoring])
 397       AC_MSG_NOTICE([The file type of the located $1 is $MSVC_DLL_FILETYPE])
 398     fi
 399   fi
 400 ])
 401 
 402 AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
 403 [
 404   VAR_NAME="$1"
 405   DLL_NAME="$2"
 406   MSVC_DLL=
 407 
 408   if test "x$MSVC_DLL" = x; then
 409     # Probe: Using well-known location from Visual Studio 10.0
 410     if test "x$VCINSTALLDIR" != x; then
 411       CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
 412       BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
 413       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 414         POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 415       else
 416         POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 417       fi
 418       $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
 419         TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 420             [well-known location in VCINSTALLDIR])
 421     fi
 422   fi
 423 
 424   if test "x$MSVC_DLL" = x; then
 425     # Probe: Check in the Boot JDK directory.


 464       else
 465         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 466           | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
 467         if test "x$POSSIBLE_MSVC_DLL" = x; then
 468           # We're grasping at straws now...
 469           POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 470               | $HEAD --lines 1`
 471         fi
 472       fi
 473       
 474       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 475           [search of VCINSTALLDIR])
 476     fi
 477   fi
 478   
 479   if test "x$MSVC_DLL" = x; then
 480     AC_MSG_CHECKING([for $DLL_NAME])
 481     AC_MSG_RESULT([no])
 482     AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
 483   fi
 484 
 485   $1=$MSVC_DLL
 486   BASIC_FIXUP_PATH($1)
 487   AC_SUBST($1, [$]$1)
 488 ])
 489 
 490 AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
 491 [
 492   AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
 493       [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
 494 
 495   if test "x$with_msvcr_dll" != x; then
 496     # If given explicitely by user, do not probe. If not present, fail directly.
 497     TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcr_dll],
 498         [--with-msvcr-dll])
 499     if test "x$MSVC_DLL" = x; then
 500       AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
 501     fi







 502   else
 503     TOOLCHAIN_SETUP_MSVC_DLL([MSVCR_DLL], [${MSVCR_NAME}])

 504   fi

 505 
 506   AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
 507       [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
 508 
 509   if test "x$MSVCP_NAME" != "x"; then
 510     if test "x$with_msvcp_dll" != x; then
 511       # If given explicitely by user, do not probe. If not present, fail directly.
 512       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$with_msvcp_dll],
 513           [--with-msvcp-dll])
 514       if test "x$MSVC_DLL" = x; then
 515         AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
 516       fi







 517     else
 518       TOOLCHAIN_SETUP_MSVC_DLL([MSVCP_DLL], [${MSVCP_NAME}])

 519     fi

 520   fi
 521 ])
 522 


 193         [C:/Program Files (x86)/$SDK_INSTALL_DIR], [well-known name])
 194   fi
 195 ])
 196 
 197 ################################################################################
 198 
 199 AC_DEFUN([TOOLCHAIN_FIND_VISUAL_STUDIO],
 200 [
 201   AC_ARG_WITH(toolchain-version, [AS_HELP_STRING([--with-toolchain-version],
 202       [the version of the toolchain to look for, use '--help' to show possible values @<:@platform dependent@:>@])])
 203 
 204   if test "x$with_toolchain_version" = xlist; then
 205     # List all toolchains
 206     AC_MSG_NOTICE([The following toolchain versions are valid on this platform:])
 207     for version in $VALID_VS_VERSIONS; do
 208       eval VS_DESCRIPTION=\${VS_DESCRIPTION_$version}
 209       $PRINTF "  %-10s  %s\n" $version "$VS_DESCRIPTION"
 210     done
 211 
 212     exit 0
 213   elif test "x$DEVKIT_VS_VERSION" != x; then
 214     VS_VERSION=$DEVKIT_VS_VERSION
 215     TOOLCHAIN_VERSION=$VS_VERSION
 216     eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
 217     eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
 218     eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"
 219     eval MSVCP_NAME="\${VS_MSVCP_${VS_VERSION}}"
 220     eval PLATFORM_TOOLSET="\${VS_VS_PLATFORM_NAME_${VS_VERSION}}"
 221     VS_PATH="$TOOLCHAIN_PATH:$PATH"
 222 
 223     # Convert DEVKIT_VS_INCLUDE into windows style VS_INCLUDE so that it
 224     # can still be exported as INCLUDE for compiler invocations without
 225     # SYSROOT_CFLAGS
 226     OLDIFS="$IFS"
 227     IFS=";"
 228     for i in $DEVKIT_VS_INCLUDE; do
 229       ipath=$i
 230       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([ipath])
 231       VS_INCLUDE="$VS_INCLUDE;$ipath"
 232     done
 233     # Convert DEVKIT_VS_LIB into VS_LIB so that it can still be exported
 234     # as LIB for compiler invocations without SYSROOT_LDFLAGS
 235     for i in $DEVKIT_VS_LIB; do
 236       libpath=$i
 237       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([libpath])
 238       VS_LIB="$VS_LIB;$libpath"
 239     done
 240     IFS="$OLDIFS"
 241 
 242     AC_MSG_NOTICE([Found devkit $VS_DESCRIPTION])
 243 
 244   elif test "x$with_toolchain_version" != x; then
 245     # User override; check that it is valid
 246     if test "x${VALID_VS_VERSIONS/$with_toolchain_version/}" = "x${VALID_VS_VERSIONS}"; then
 247       AC_MSG_NOTICE([Visual Studio version $with_toolchain_version is not valid.])
 248       AC_MSG_NOTICE([Valid Visual Studio versions: $VALID_VS_VERSIONS.])
 249       AC_MSG_ERROR([Cannot continue.])
 250     fi
 251     VS_VERSIONS_PROBE_LIST="$with_toolchain_version"
 252   else
 253     # No flag given, use default
 254     VS_VERSIONS_PROBE_LIST="$VALID_VS_VERSIONS"
 255   fi
 256 
 257   for VS_VERSION in $VS_VERSIONS_PROBE_LIST; do
 258     TOOLCHAIN_FIND_VISUAL_STUDIO_BAT_FILE([$VS_VERSION])
 259     if test "x$VS_ENV_CMD" != x; then
 260       TOOLCHAIN_VERSION=$VS_VERSION
 261       eval VS_DESCRIPTION="\${VS_DESCRIPTION_${VS_VERSION}}"
 262       eval VS_VERSION_INTERNAL="\${VS_VERSION_INTERNAL_${VS_VERSION}}"
 263       eval MSVCR_NAME="\${VS_MSVCR_${VS_VERSION}}"


 276 AC_DEFUN([TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV],
 277 [
 278   # Store path to cygwin link.exe to help excluding it when searching for
 279   # VS linker. This must be done before changing the PATH when looking for VS.
 280   AC_PATH_PROG(CYGWIN_LINK, link)
 281   if test "x$CYGWIN_LINK" != x; then
 282     AC_MSG_CHECKING([if the first found link.exe is actually the Cygwin link tool])
 283     "$CYGWIN_LINK" --version > /dev/null
 284     if test $? -eq 0 ; then
 285       AC_MSG_RESULT([yes])
 286     else
 287       AC_MSG_RESULT([no])
 288       # This might be the VS linker. Don't exclude it later on.
 289       CYGWIN_LINK=""
 290     fi
 291   fi
 292 
 293   # First-hand choice is to locate and run the vsvars bat file.
 294   TOOLCHAIN_FIND_VISUAL_STUDIO
 295 
 296   # If we have a devkit, skip all of the below.
 297   if test "x$DEVKIT_VS_VERSION" = x; then
 298     if test "x$VS_ENV_CMD" != x; then
 299       # We have found a Visual Studio environment on disk, let's extract variables from the vsvars bat file.
 300       BASIC_FIXUP_EXECUTABLE(VS_ENV_CMD)
 301 
 302       # Lets extract the variables that are set by vcvarsall.bat/vsvars32.bat/vsvars64.bat
 303       AC_MSG_NOTICE([Trying to extract Visual Studio environment variables])
 304 
 305       # We need to create a couple of temporary files.
 306       VS_ENV_TMP_DIR="$OUTPUT_ROOT/vs-env"
 307       $MKDIR -p $VS_ENV_TMP_DIR
 308 
 309       # Cannot use the VS10 setup script directly (since it only updates the DOS subshell environment).
 310       # Instead create a shell script which will set the relevant variables when run.
 311       WINPATH_VS_ENV_CMD="$VS_ENV_CMD"
 312       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_VS_ENV_CMD])
 313       WINPATH_BASH="$BASH"
 314       BASIC_WINDOWS_REWRITE_AS_WINDOWS_MIXED_PATH([WINPATH_BASH])
 315 
 316       # Generate a DOS batch file which runs $VS_ENV_CMD, and then creates a shell
 317       # script (executable by bash) that will setup the important variables.
 318       EXTRACT_VC_ENV_BAT_FILE="$VS_ENV_TMP_DIR/extract-vs-env.bat"
 319       $ECHO "@echo off" >  $EXTRACT_VC_ENV_BAT_FILE
 320       # This will end up something like:
 321       # call C:/progra~2/micros~2.0/vc/bin/amd64/vcvars64.bat
 322       $ECHO "call $WINPATH_VS_ENV_CMD $VS_ENV_ARGS" >> $EXTRACT_VC_ENV_BAT_FILE
 323       # These will end up something like:
 324       # C:/CygWin/bin/bash -c 'echo VS_PATH=\"$PATH\" > localdevenv.sh
 325       # The trailing space for everyone except PATH is no typo, but is needed due
 326       # to trailing \ in the Windows paths. These will be stripped later.
 327       $ECHO "$WINPATH_BASH -c 'echo VS_PATH="'\"$PATH\" > set-vs-env.sh' 
 328           >> $EXTRACT_VC_ENV_BAT_FILE
 329       $ECHO "$WINPATH_BASH -c 'echo VS_INCLUDE="'\"$INCLUDE \" >> set-vs-env.sh' \
 330           >> $EXTRACT_VC_ENV_BAT_FILE
 331       $ECHO "$WINPATH_BASH -c 'echo VS_LIB="'\"$LIB \" >> set-vs-env.sh' \
 332           >> $EXTRACT_VC_ENV_BAT_FILE
 333       $ECHO "$WINPATH_BASH -c 'echo VCINSTALLDIR="'\"$VCINSTALLDIR \" >> set-vs-env.sh' \
 334           >> $EXTRACT_VC_ENV_BAT_FILE
 335       $ECHO "$WINPATH_BASH -c 'echo WindowsSdkDir="'\"$WindowsSdkDir \" >> set-vs-env.sh' \
 336           >> $EXTRACT_VC_ENV_BAT_FILE
 337       $ECHO "$WINPATH_BASH -c 'echo WINDOWSSDKDIR="'\"$WINDOWSSDKDIR \" >> set-vs-env.sh' \
 338           >> $EXTRACT_VC_ENV_BAT_FILE
 339 
 340       # Now execute the newly created bat file.
 341       # The | cat is to stop SetEnv.Cmd to mess with system colors on msys.
 342       # Change directory so we don't need to mess with Windows paths in redirects.
 343       cd $VS_ENV_TMP_DIR
 344       cmd /c extract-vs-env.bat | $CAT
 345       cd $CURDIR
 346 
 347       if test ! -s $VS_ENV_TMP_DIR/set-vs-env.sh; then
 348         AC_MSG_NOTICE([Could not succesfully extract the envionment variables needed for the VS setup.])
 349         AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 350         AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 351         AC_MSG_ERROR([Cannot continue])
 352       fi
 353 
 354       # Now set all paths and other env variables. This will allow the rest of
 355       # the configure script to find and run the compiler in the proper way.
 356       AC_MSG_NOTICE([Setting extracted environment variables])
 357       . $VS_ENV_TMP_DIR/set-vs-env.sh
 358       # Now we have VS_PATH, VS_INCLUDE, VS_LIB. For further checking, we
 359       # also define VCINSTALLDIR, WindowsSdkDir and WINDOWSSDKDIR.
 360     else
 361       # We did not find a vsvars bat file, let's hope we are run from a VS command prompt.
 362      AC_MSG_NOTICE([Cannot locate a valid Visual Studio installation, checking current environment])
 363     fi
 364   fi
 365 
 366   # At this point, we should have correct variables in the environment, or we can't continue.
 367   AC_MSG_CHECKING([for Visual Studio variables])
 368 
 369   if test "x$VCINSTALLDIR" != x || test "x$WindowsSDKDir" != x \
 370       || test "x$WINDOWSSDKDIR" != x || test "x$DEVKIT_NAME" != x; then
 371     if test "x$VS_INCLUDE" = x || test "x$VS_LIB" = x; then
 372       AC_MSG_RESULT([present but broken])
 373       AC_MSG_ERROR([Your VC command prompt seems broken, INCLUDE and/or LIB is missing.])
 374     else
 375       AC_MSG_RESULT([ok])
 376       # Remove any trailing "\" and " " from the variables.
 377       VS_INCLUDE=`$ECHO "$VS_INCLUDE" | $SED 's/\\\\* *$//'`
 378       VS_LIB=`$ECHO "$VS_LIB" | $SED 's/\\\\* *$//'`
 379       VCINSTALLDIR=`$ECHO "$VCINSTALLDIR" | $SED 's/\\\\* *$//'`
 380       WindowsSDKDir=`$ECHO "$WindowsSDKDir" | $SED 's/\\\\* *$//'`
 381       WINDOWSSDKDIR=`$ECHO "$WINDOWSSDKDIR" | $SED 's/\\\\* *$//'`
 382       # Remove any paths containing # (typically F#) as that messes up make. This
 383       # is needed if visual studio was installed with F# support.
 384       VS_PATH=`$ECHO "$VS_PATH" | $SED 's/[[^:#]]*#[^:]*://g'`
 385 
 386       AC_SUBST(VS_PATH)
 387       AC_SUBST(VS_INCLUDE)
 388       AC_SUBST(VS_LIB)
 389     fi
 390   else
 391     AC_MSG_RESULT([not found])
 392 
 393     if test "x$VS_ENV_CMD" = x; then
 394       AC_MSG_NOTICE([Cannot locate a valid Visual Studio or Windows SDK installation on disk,])
 395       AC_MSG_NOTICE([nor is this script run from a Visual Studio command prompt.])
 396     else
 397       AC_MSG_NOTICE([Running the extraction script failed.])
 398     fi
 399     AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
 400     AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
 401     AC_MSG_ERROR([Cannot continue])
 402   fi
 403 ])
 404 
 405 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL],
 406 [
 407   DLL_NAME="$1"
 408   POSSIBLE_MSVC_DLL="$2"
 409   METHOD="$3"
 410   if test -n "$POSSIBLE_MSVC_DLL" -a -e "$POSSIBLE_MSVC_DLL"; then
 411     AC_MSG_NOTICE([Found $DLL_NAME at $POSSIBLE_MSVC_DLL using $METHOD])
 412 
 413     # Need to check if the found msvcr is correct architecture
 414     AC_MSG_CHECKING([found $DLL_NAME architecture])
 415     MSVC_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVC_DLL"`
 416     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.msys"; then
 417       # The MSYS 'file' command returns "PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit"
 418       # on x32 and "PE32+ executable for MS Windows (DLL) (GUI) Mono/.Net assembly" on x64 systems.
 419       if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
 420         CORRECT_MSVCR_ARCH="PE32 executable"
 421       else
 422         CORRECT_MSVCR_ARCH="PE32+ executable"
 423       fi
 424     else
 425       if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
 426         CORRECT_MSVCR_ARCH=386
 427       else
 428         CORRECT_MSVCR_ARCH=x86-64
 429       fi
 430     fi
 431     if $ECHO "$MSVC_DLL_FILETYPE" | $GREP "$CORRECT_MSVCR_ARCH" 2>&1 > /dev/null; then
 432       AC_MSG_RESULT([ok])
 433       MSVC_DLL="$POSSIBLE_MSVC_DLL"
 434       BASIC_FIXUP_PATH(MSVC_DLL)
 435       AC_MSG_CHECKING([for $DLL_NAME])
 436       AC_MSG_RESULT([$MSVC_DLL])
 437     else
 438       AC_MSG_RESULT([incorrect, ignoring])
 439       AC_MSG_NOTICE([The file type of the located $DLL_NAME is $MSVC_DLL_FILETYPE])
 440     fi
 441   fi
 442 ])
 443 
 444 AC_DEFUN([TOOLCHAIN_SETUP_MSVC_DLL],
 445 [
 446   DLL_NAME="$1"

 447   MSVC_DLL=
 448 
 449   if test "x$MSVC_DLL" = x; then
 450     # Probe: Using well-known location from Visual Studio 10.0
 451     if test "x$VCINSTALLDIR" != x; then
 452       CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
 453       BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
 454       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
 455         POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 456       else
 457         POSSIBLE_MSVC_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC${VS_VERSION_INTERNAL}.CRT/$DLL_NAME"
 458       fi
 459       $ECHO "POSSIBLE_MSVC_DLL $POSSIBLEMSVC_DLL"
 460         TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 461             [well-known location in VCINSTALLDIR])
 462     fi
 463   fi
 464 
 465   if test "x$MSVC_DLL" = x; then
 466     # Probe: Check in the Boot JDK directory.


 505       else
 506         POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 507           | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
 508         if test "x$POSSIBLE_MSVC_DLL" = x; then
 509           # We're grasping at straws now...
 510           POSSIBLE_MSVC_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name $DLL_NAME \
 511               | $HEAD --lines 1`
 512         fi
 513       fi
 514       
 515       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL([$DLL_NAME], [$POSSIBLE_MSVC_DLL],
 516           [search of VCINSTALLDIR])
 517     fi
 518   fi
 519   
 520   if test "x$MSVC_DLL" = x; then
 521     AC_MSG_CHECKING([for $DLL_NAME])
 522     AC_MSG_RESULT([no])
 523     AC_MSG_ERROR([Could not find $DLL_NAME. Please specify using --with-msvcr-dll.])
 524   fi




 525 ])
 526 
 527 AC_DEFUN([TOOLCHAIN_SETUP_VS_RUNTIME_DLLS],
 528 [
 529   AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
 530       [path to microsoft C runtime dll (msvcr*.dll) (Windows only) @<:@probed@:>@])])
 531 
 532   if test "x$with_msvcr_dll" != x; then
 533     # If given explicitely by user, do not probe. If not present, fail directly.
 534     TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$with_msvcr_dll], [--with-msvcr-dll])

 535     if test "x$MSVC_DLL" = x; then
 536       AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by --with-msvcr-dll])
 537     fi
 538     MSVCR_DLL="$MSVC_DLL"
 539   elif test "x$DEVKIT_MSVCR_DLL" != x; then
 540     TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCR_NAME, [$DEVKIT_MSVCR_DLL], [devkit])
 541     if test "x$MSVC_DLL" = x; then
 542       AC_MSG_ERROR([Could not find a proper $MSVCR_NAME as specified by devkit])
 543     fi
 544     MSVCR_DLL="$MSVC_DLL"
 545   else
 546     TOOLCHAIN_SETUP_MSVC_DLL([${MSVCR_NAME}])
 547     MSVCR_DLL="$MSVC_DLL"
 548   fi
 549   AC_SUBST(MSVCR_DLL)
 550 
 551   AC_ARG_WITH(msvcp-dll, [AS_HELP_STRING([--with-msvcp-dll],
 552       [path to microsoft C++ runtime dll (msvcp*.dll) (Windows only) @<:@probed@:>@])])
 553 
 554   if test "x$MSVCP_NAME" != "x"; then
 555     if test "x$with_msvcp_dll" != x; then
 556       # If given explicitely by user, do not probe. If not present, fail directly.
 557       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$with_msvcp_dll], [--with-msvcp-dll])

 558       if test "x$MSVC_DLL" = x; then
 559         AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by --with-msvcp-dll])
 560       fi
 561       MSVCP_DLL="$MSVC_DLL"
 562     elif test "x$DEVKIT_MSVCP_DLL" != x; then
 563       TOOLCHAIN_CHECK_POSSIBLE_MSVC_DLL($MSVCP_NAME, [$DEVKIT_MSVCP_DLL], [devkit])
 564       if test "x$MSVC_DLL" = x; then
 565         AC_MSG_ERROR([Could not find a proper $MSVCP_NAME as specified by devkit])
 566       fi
 567       MSVCP_DLL="$MSVC_DLL"
 568     else
 569       TOOLCHAIN_SETUP_MSVC_DLL([${MSVCP_NAME}])
 570       MSVCP_DLL="$MSVC_DLL"
 571     fi
 572     AC_SUBST(MSVCP_DLL)
 573   fi
 574 ])
 575 
< prev index next >