common/autoconf/toolchain_windows.m4

changeset 857
5b4f14990dd1
parent 839
174a54ce39c4
child 1133
50aaf272884f
child 2208
feba63b3fa36
     1.1 --- a/common/autoconf/toolchain_windows.m4	Wed Oct 16 11:55:44 2013 -0700
     1.2 +++ b/common/autoconf/toolchain_windows.m4	Fri Oct 18 10:41:18 2013 +0200
     1.3 @@ -228,52 +228,113 @@
     1.4      AC_MSG_NOTICE([or run "bash.exe -l" from a VS command prompt and then run configure from there.])
     1.5      AC_MSG_ERROR([Cannot continue])
     1.6    fi
     1.7 +])
     1.8  
     1.9 -  AC_MSG_CHECKING([for msvcr100.dll])
    1.10 +AC_DEFUN([TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL],
    1.11 +[
    1.12 +  POSSIBLE_MSVCR_DLL="$1"
    1.13 +  METHOD="$2"
    1.14 +  if test -e "$POSSIBLE_MSVCR_DLL"; then
    1.15 +    AC_MSG_NOTICE([Found msvcr100.dll at $POSSIBLE_MSVCR_DLL using $METHOD])
    1.16 +    
    1.17 +    # Need to check if the found msvcr is correct architecture
    1.18 +    AC_MSG_CHECKING([found msvcr100.dll architecture])
    1.19 +    MSVCR_DLL_FILETYPE=`$FILE -b "$POSSIBLE_MSVCR_DLL"`
    1.20 +    if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
    1.21 +      CORRECT_MSVCR_ARCH=386
    1.22 +    else
    1.23 +      CORRECT_MSVCR_ARCH=x86-64
    1.24 +    fi
    1.25 +    if $ECHO "$MSVCR_DLL_FILETYPE" | $GREP $CORRECT_MSVCR_ARCH 2>&1 > /dev/null; then
    1.26 +      AC_MSG_RESULT([ok])
    1.27 +      MSVCR_DLL="$POSSIBLE_MSVCR_DLL"
    1.28 +      AC_MSG_CHECKING([for msvcr100.dll])
    1.29 +      AC_MSG_RESULT([$MSVCR_DLL])
    1.30 +    else
    1.31 +      AC_MSG_RESULT([incorrect, ignoring])
    1.32 +      AC_MSG_NOTICE([The file type of the located msvcr100.dll is $MSVCR_DLL_FILETYPE])
    1.33 +    fi
    1.34 +  fi
    1.35 +])
    1.36 +
    1.37 +AC_DEFUN([TOOLCHAIN_SETUP_MSVCR_DLL],
    1.38 +[
    1.39    AC_ARG_WITH(msvcr-dll, [AS_HELP_STRING([--with-msvcr-dll],
    1.40        [copy this msvcr100.dll into the built JDK (Windows only) @<:@probed@:>@])])
    1.41 +
    1.42    if test "x$with_msvcr_dll" != x; then
    1.43 -    MSVCR_DLL="$with_msvcr_dll"
    1.44 -  else
    1.45 +    # If given explicitely by user, do not probe. If not present, fail directly.
    1.46 +    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$with_msvcr_dll], [--with-msvcr-dll])
    1.47 +    if test "x$MSVCR_DLL" = x; then
    1.48 +      AC_MSG_ERROR([Could not find a proper msvcr100.dll as specified by --with-msvcr-dll])
    1.49 +    fi
    1.50 +  fi
    1.51 +  
    1.52 +  if test "x$MSVCR_DLL" = x; then
    1.53 +    # Probe: Using well-known location from Visual Studio 10.0
    1.54      if test "x$VCINSTALLDIR" != x; then
    1.55 +      CYGWIN_VC_INSTALL_DIR="$VCINSTALLDIR"
    1.56 +      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VC_INSTALL_DIR)
    1.57        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
    1.58 -        MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x64 | head --lines 1`
    1.59 +        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x64/Microsoft.VC100.CRT/msvcr100.dll"
    1.60        else
    1.61 -        MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | grep x86 | grep -v ia64 | grep -v x64 | head --lines 1`
    1.62 -        if test "x$MSVCR_DLL" = x; then
    1.63 -          MSVCR_DLL=`find "$VCINSTALLDIR" -name msvcr100.dll | head --lines 1`
    1.64 +        POSSIBLE_MSVCR_DLL="$CYGWIN_VC_INSTALL_DIR/redist/x86/Microsoft.VC100.CRT/msvcr100.dll"
    1.65 +      fi
    1.66 +      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in VCINSTALLDIR])
    1.67 +    fi
    1.68 +  fi
    1.69 +
    1.70 +  if test "x$MSVCR_DLL" = x; then
    1.71 +    # Probe: Check in the Boot JDK directory.
    1.72 +    POSSIBLE_MSVCR_DLL="$BOOT_JDK/bin/msvcr100.dll"
    1.73 +    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in Boot JDK])
    1.74 +  fi
    1.75 +  
    1.76 +  if test "x$MSVCR_DLL" = x; then
    1.77 +    # Probe: Look in the Windows system32 directory 
    1.78 +    CYGWIN_SYSTEMROOT="$SYSTEMROOT"
    1.79 +    BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_SYSTEMROOT)
    1.80 +    POSSIBLE_MSVCR_DLL="$CYGWIN_SYSTEMROOT/system32/msvcr100.dll"
    1.81 +    TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [well-known location in SYSTEMROOT])
    1.82 +  fi
    1.83 +
    1.84 +  if test "x$MSVCR_DLL" = x; then
    1.85 +    # Probe: If Visual Studio Express is installed, there is usually one with the debugger
    1.86 +    if test "x$VS100COMNTOOLS" != x; then
    1.87 +      CYGWIN_VS_TOOLS_DIR="$VS100COMNTOOLS/.."
    1.88 +      BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(CYGWIN_VS_TOOLS_DIR)
    1.89 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
    1.90 +        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x64/ | $HEAD --lines 1`
    1.91 +      else
    1.92 +        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VS_TOOLS_DIR" -name msvcr100.dll | $GREP -i /x86/ | $HEAD --lines 1`
    1.93 +      fi
    1.94 +      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VS100COMNTOOLS])
    1.95 +    fi
    1.96 +  fi
    1.97 +      
    1.98 +  if test "x$MSVCR_DLL" = x; then
    1.99 +    # Probe: Search wildly in the VCINSTALLDIR. We've probably lost by now.
   1.100 +    # (This was the original behaviour; kept since it might turn up something)
   1.101 +    if test "x$CYGWIN_VC_INSTALL_DIR" != x; then
   1.102 +      if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   1.103 +        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x64 | $HEAD --lines 1`
   1.104 +      else
   1.105 +        POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $GREP x86 | $GREP -v ia64 | $GREP -v x64 | $HEAD --lines 1`
   1.106 +        if test "x$POSSIBLE_MSVCR_DLL" = x; then
   1.107 +          # We're grasping at straws now...
   1.108 +          POSSIBLE_MSVCR_DLL=`$FIND "$CYGWIN_VC_INSTALL_DIR" -name msvcr100.dll | $HEAD --lines 1`
   1.109          fi
   1.110        fi
   1.111 -      if test "x$MSVCR_DLL" != x; then
   1.112 -        AC_MSG_NOTICE([msvcr100.dll found in VCINSTALLDIR: $VCINSTALLDIR])
   1.113 -      else
   1.114 -        AC_MSG_NOTICE([Warning: msvcr100.dll not found in VCINSTALLDIR: $VCINSTALLDIR])
   1.115 -      fi
   1.116 -    fi
   1.117 -    # Try some fallback alternatives
   1.118 -    if test "x$MSVCR_DLL" = x; then
   1.119 -      # If visual studio express is installed, there is usually one with the debugger
   1.120 -      if test "x$VS100COMNTOOLS" != x; then
   1.121 -        if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
   1.122 -          MSVCR_DLL=`find "$VS100COMNTOOLS/.." -name msvcr100.dll | grep -i x64 | head --lines 1`
   1.123 -          AC_MSG_NOTICE([msvcr100.dll found in $VS100COMNTOOLS..: $VS100COMNTOOLS..])
   1.124 -        fi
   1.125 -      fi
   1.126 -    fi
   1.127 -    if test "x$MSVCR_DLL" = x; then
   1.128 -      if test "x$OPENJDK_TARGET_CPU_BITS" = x32; then
   1.129 -        # Fallback for 32bit builds, look in the windows directory.
   1.130 -        if test -f "$SYSTEMROOT/system32/msvcr100.dll"; then
   1.131 -          AC_MSG_NOTICE([msvcr100.dll found in $SYSTEMROOT/system32])
   1.132 -          MSVCR_DLL="$SYSTEMROOT/system32/msvcr100.dll"
   1.133 -        fi
   1.134 -      fi
   1.135 +      
   1.136 +      TOOLCHAIN_CHECK_POSSIBLE_MSVCR_DLL([$POSSIBLE_MSVCR_DLL], [search of VCINSTALLDIR])
   1.137      fi
   1.138    fi
   1.139 +  
   1.140    if test "x$MSVCR_DLL" = x; then
   1.141 +    AC_MSG_CHECKING([for msvcr100.dll])
   1.142      AC_MSG_RESULT([no])
   1.143 -    AC_MSG_ERROR([Could not find msvcr100.dll !])
   1.144 +    AC_MSG_ERROR([Could not find msvcr100.dll. Please specify using --with-msvcr-dll.])
   1.145    fi
   1.146 -  AC_MSG_RESULT([$MSVCR_DLL])
   1.147 +
   1.148    BASIC_FIXUP_PATH(MSVCR_DLL)
   1.149  ])

mercurial