common/autoconf/toolchain_windows.m4
changeset 20643 fa095e917446
parent 20363 fa7663fc5d50
child 23429 fe4f0848a307
equal deleted inserted replaced
20626:ad67c34f79c2 20643:fa095e917446
   226     fi
   226     fi
   227     AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
   227     AC_MSG_NOTICE([Try setting --with-tools-dir to the VC/bin directory within the VS installation])
   228     AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
   228     AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
   229     AC_MSG_ERROR([Cannot continue])
   229     AC_MSG_ERROR([Cannot continue])
   230   fi
   230   fi
   231 
   231 ])
   232   AC_MSG_CHECKING([for msvcr100.dll])
   232 
       
   233 AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
       
   234 [
       
   235   POSSIBLE_MSVCR_DLL="$1"
       
   236   METHOD="$2"
       
   237   if test -e "$POSSIBLE_MSVCR_DLL"; then
       
   238     AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
       
   239     
       
   240     # Need to check if the found msvcr is correct architecture
       
   241     AC_MSG_CHECKING([found msvcr100.dll architecture])
       
   242     MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
       
   243     if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
       
   244       CORRECT_MSVCR_ARCH=386
       
   245     else
       
   246       CORRECT_MSVCR_ARCH=x86-64
       
   247     fi
       
   248     if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
       
   249       AC_MSG_RESULT([ok])
       
   250       MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
       
   251       AC_MSG_CHECKING([for msvcr100.dll])
       
   252       AC_MSG_RESULT([$MSVCR_DLL])
       
   253     else
       
   254       AC_MSG_RESULT([incorrect, ignoring])
       
   255       AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
       
   256     fi
       
   257   fi
       
   258 ])
       
   259 
       
   260 AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
       
   261 [
   233   AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
   262   AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
   234       [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
   263       [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
       
   264 
   235   if test "x$with_msvcr_dll" != x; then
   265   if test "x$with_msvcr_dll" != x; then
   236     MSVCR_DLL="$with_msvcr_dll"
   266     # If given explicitely by user, do not probe. If not present, fail directly.
   237   else
   267     TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
       
   268     if test "x$MSVCR_DLL" = x; then
       
   269       AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
       
   270     fi
       
   271   fi
       
   272   
       
   273   if test "x$MSVCR_DLL" = x; then
       
   274     # Probe: Using well-known location from Visual Studio 10.0
   238     if test "x$VCINSTALLDIR" != x; then
   275     if test "x$VCINSTALLDIR" != x; then
       
   276       CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
       
   277       BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
   239       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   278       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   240         MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x64 | head --lines 1`
   279         POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
   241       else
   280       else
   242         MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
   281         POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
   243         if test "x$MSVCR_DLL" = x; then
   282       fi
   244           MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | head --lines 1`
   283       TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
       
   284     fi
       
   285   fi
       
   286 
       
   287   if test "x$MSVCR_DLL" = x; then
       
   288     # Probe: Check in the Boot JDK directory.
       
   289     POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
       
   290     TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
       
   291   fi
       
   292   
       
   293   if test "x$MSVCR_DLL" = x; then
       
   294     # Probe: Look in the Windows system32 directory 
       
   295     CYGWIN_SYSTEMROOT="$SYSTEMROOT"
       
   296     BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
       
   297     POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
       
   298     TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
       
   299   fi
       
   300 
       
   301   if test "x$MSVCR_DLL" = x; then
       
   302     # Probe: If Visual Studio Express is installed, there is usually one with the debugger
       
   303     if test "x$VS100COMNTOOLS" != x; then
       
   304       CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
       
   305       BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
       
   306       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
       
   307         POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
       
   308       else
       
   309         POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
       
   310       fi
       
   311       TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
       
   312     fi
       
   313   fi
       
   314       
       
   315   if test "x$MSVCR_DLL" = x; then
       
   316     # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
       
   317     # (This was the original behaviour; kept since it might turn up something)
       
   318     if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
       
   319       if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
       
   320         POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
       
   321       else
       
   322         POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
       
   323         if test "x$POSSIBLE_MSVCR_DLL" = x; then
       
   324           # We're grasping at straws now...
       
   325           POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
   245         fi
   326         fi
   246       fi
   327       fi
   247       if test "x$MSVCR_DLL" != x; then
   328       
   248         AC_MSG_NOTICE([msvcr100.dll found in VCINSTALLDIR: $VCINSTALLDIR])
   329       TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
   249       else
   330     fi
   250         AC_MSG_NOTICE([Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR])
   331   fi
   251       fi
   332   
   252     fi
   333   if test "x$MSVCR_DLL" = x; then
   253     # Try some fallback alternatives
   334     AC_MSG_CHECKING([for msvcr100.dll])
   254     if test "x$MSVCR_DLL" = x; then
       
   255       # If visual studio express is installed, there is usually one with the debugger
       
   256       if test "x$VS100COMNTOOLS" != x; then
       
   257         if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
       
   258           MSVCR_DLL=`find "$VS100COMNTOOLS/.." -name msvcr100.dll | grep -i x64 | head --lines 1`
       
   259           AC_MSG_NOTICE([msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS..])
       
   260         fi
       
   261       fi
       
   262     fi
       
   263     if test "x$MSVCR_DLL" = x; then
       
   264       if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
       
   265         # Fallback for 32bit builds, look in the windows directory.
       
   266         if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
       
   267           AC_MSG_NOTICE([msvcr100.dll found in $SYSTEMROOT/system32])
       
   268           MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
       
   269         fi
       
   270       fi
       
   271     fi
       
   272   fi
       
   273   if test "x$MSVCR_DLL" = x; then
       
   274     AC_MSG_RESULT([no])
   335     AC_MSG_RESULT([no])
   275     AC_MSG_ERROR([Could not find msvcr100.dll !])
   336     AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
   276   fi
   337   fi
   277   AC_MSG_RESULT([$MSVCR_DLL])
   338 
   278   BASIC_FIXUP_PATH(MSVCR_DLL)
   339   BASIC_FIXUP_PATH(MSVCR_DLL)
   279 ])
   340 ])