common/autoconf/boot-jdk.m4

changeset 478
2ba6f4da4bf3
parent 459
3156dff953b1
child 494
e64f2cb57d05
     1.1 --- a/common/autoconf/boot-jdk.m4	Thu Sep 06 17:27:20 2012 -0700
     1.2 +++ b/common/autoconf/boot-jdk.m4	Tue Sep 18 11:29:16 2012 -0700
     1.3 @@ -23,22 +23,186 @@
     1.4  # questions.
     1.5  #
     1.6  
     1.7 -# Fixes paths on windows to be mixed mode short.
     1.8 -AC_DEFUN([BOOTJDK_WIN_FIX_PATH],
     1.9 +# Execute the check given as argument, and verify the result
    1.10 +# If the Boot JDK was previously found, do nothing
    1.11 +# $1 A command line (typically autoconf macro) to execute
    1.12 +AC_DEFUN([BOOTJDK_DO_CHECK],
    1.13  [
    1.14 -    if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
    1.15 -        AC_PATH_PROG(CYGPATH, cygpath)
    1.16 -        tmp="[$]$1"
    1.17 -        # Convert to C:/ mixed style path without spaces.
    1.18 -        tmp=`$CYGPATH -s -m "$tmp"`
    1.19 -        $1="$tmp"
    1.20 +  if test "x$BOOT_JDK_FOUND" = xno; then
    1.21 +    # Now execute the test
    1.22 +    $1
    1.23 +
    1.24 +    # If previous step claimed to have found a JDK, check it to see if it seems to be valid.
    1.25 +    if test "x$BOOT_JDK_FOUND" = xmaybe; then
    1.26 +      # Do we have a bin/java?
    1.27 +      if test ! -x "$BOOT_JDK/bin/java"; then
    1.28 +        AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring])
    1.29 +        BOOT_JDK_FOUND=no
    1.30 +      else
    1.31 +        # Do we have a bin/javac?
    1.32 +        if test ! -x "$BOOT_JDK/bin/javac"; then
    1.33 +          AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring])
    1.34 +          AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
    1.35 +          BOOT_JDK_FOUND=no
    1.36 +        else 
    1.37 +          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
    1.38 +          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
    1.39 +            AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring])
    1.40 +            BOOT_JDK_FOUND=no
    1.41 +          else
    1.42 +            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
    1.43 +            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
    1.44 +
    1.45 +            # Extra M4 quote needed to protect [] in grep expression.
    1.46 +            [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`]
    1.47 +            if test "x$FOUND_VERSION_78" = x; then
    1.48 +              AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
    1.49 +              AC_MSG_NOTICE([(Your Boot JDK must be version 7 or 8)])
    1.50 +              BOOT_JDK_FOUND=no
    1.51 +            else
    1.52 +              # We're done! :-)
    1.53 +              BOOT_JDK_FOUND=yes
    1.54 +              SPACESAFE(BOOT_JDK,[the path to the Boot JDK])
    1.55 +              AC_MSG_CHECKING([for Boot JDK])
    1.56 +              AC_MSG_RESULT([$BOOT_JDK ($BOOT_JDK_VERSION)])
    1.57 +            fi # end check jdk version
    1.58 +          fi # end check rt.jar
    1.59 +        fi # end check javac
    1.60 +      fi # end check java
    1.61 +    fi # end check boot jdk found
    1.62 +  fi
    1.63 +])
    1.64 +
    1.65 +# Test: Is bootjdk explicitely set by command line arguments?
    1.66 +AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS],
    1.67 +[
    1.68 +if test "x$with_boot_jdk" != x; then
    1.69 +    BOOT_JDK=$with_boot_jdk
    1.70 +    BOOT_JDK_FOUND=maybe
    1.71 +    AC_MSG_NOTICE([Found potential Boot JDK using configure arguments])
    1.72 +fi
    1.73 +])
    1.74 +
    1.75 +# Test: Is bootjdk available from builddeps?
    1.76 +AC_DEFUN([BOOTJDK_CHECK_BUILDDEPS],
    1.77 +[
    1.78 +    BDEPS_CHECK_MODULE(BOOT_JDK, bootjdk, xxx, [BOOT_JDK_FOUND=maybe], [BOOT_JDK_FOUND=no])
    1.79 +])
    1.80 +
    1.81 +# Test: Is $JAVA_HOME set?
    1.82 +AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
    1.83 +[
    1.84 +    if test "x$JAVA_HOME" != x; then
    1.85 +        if test "x$OPENJDK_TARGET_OS" = xwindows; then
    1.86 +          # On Windows, JAVA_HOME is likely in DOS-style
    1.87 +          JAVA_HOME_PROCESSED="`$CYGPATH -u "$JAVA_HOME"`"
    1.88 +        else
    1.89 +          JAVA_HOME_PROCESSED="$JAVA_HOME"
    1.90 +        fi
    1.91 +        if test ! -d "$JAVA_HOME_PROCESSED"; then
    1.92 +            AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
    1.93 +        else
    1.94 +          # Aha, the user has set a JAVA_HOME
    1.95 +          # let us use that as the Boot JDK.
    1.96 +          BOOT_JDK="$JAVA_HOME_PROCESSED"
    1.97 +          BOOT_JDK_FOUND=maybe
    1.98 +          AC_MSG_NOTICE([Found potential Boot JDK using JAVA_HOME])
    1.99 +        fi
   1.100      fi
   1.101  ])
   1.102  
   1.103 -AC_DEFUN([BOOTJDK_MISSING_ERROR],
   1.104 +# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
   1.105 +AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
   1.106  [
   1.107 -    AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk])
   1.108 -    AC_MSG_ERROR([Cannot continue])
   1.109 +    AC_PATH_PROG(JAVAC_CHECK, javac)
   1.110 +    AC_PATH_PROG(JAVA_CHECK, java)
   1.111 +    BINARY="$JAVAC_CHECK"
   1.112 +    if test "x$JAVAC_CHECK" = x; then
   1.113 +        BINARY="$JAVA_CHECK"
   1.114 +    fi
   1.115 +    if test "x$BINARY" != x; then
   1.116 +        # So there is a java(c) binary, it might be part of a JDK.
   1.117 +        # Lets find the JDK/JRE directory by following symbolic links.
   1.118 +        # Linux/GNU systems often have links from /usr/bin/java to 
   1.119 +        # /etc/alternatives/java to the real JDK binary.
   1.120 +        SET_FULL_PATH_SPACESAFE(BINARY)
   1.121 +        REMOVE_SYMBOLIC_LINKS(BINARY)
   1.122 +        BOOT_JDK=`dirname "$BINARY"`
   1.123 +        BOOT_JDK=`cd "$BOOT_JDK/.."; pwd`
   1.124 +        if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
   1.125 +            # Looks like we found ourselves an JDK
   1.126 +            BOOT_JDK_FOUND=maybe
   1.127 +            AC_MSG_NOTICE([Found potential Boot JDK using java(c) in PATH])
   1.128 +        fi
   1.129 +    fi
   1.130 +])
   1.131 +
   1.132 +# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
   1.133 +AC_DEFUN([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME],
   1.134 +[
   1.135 +    if test -x /usr/libexec/java_home; then
   1.136 +        BOOT_JDK=`/usr/libexec/java_home`
   1.137 +        BOOT_JDK_FOUND=maybe
   1.138 +        AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home])
   1.139 +    fi
   1.140 +])
   1.141 +
   1.142 +# Look for a jdk in the given path. If there are multiple, try to select the newest.
   1.143 +# If found, set BOOT_JDK and BOOT_JDK_FOUND.
   1.144 +# $1 = Path to directory containing jdk installations.
   1.145 +# $2 = String to append to the found JDK directory to get the proper JDK home
   1.146 +AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY],
   1.147 +[
   1.148 +  BOOT_JDK_PREFIX="$1"
   1.149 +  BOOT_JDK_SUFFIX="$2"
   1.150 +  BEST_JDK_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $GREP jdk | $SORT -r | $HEAD -n 1 `
   1.151 +  if test "x$BEST_JDK_FOUND" != x; then
   1.152 +    BOOT_JDK="${BOOT_JDK_PREFIX}/${BEST_JDK_FOUND}${BOOT_JDK_SUFFIX}"
   1.153 +    if test -d "$BOOT_JDK"; then
   1.154 +      BOOT_JDK_FOUND=maybe
   1.155 +      AC_MSG_NOTICE([Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX)])
   1.156 +    fi
   1.157 +  fi
   1.158 +])
   1.159 +
   1.160 +# Call BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY, but use the given
   1.161 +# environmental variable as base for where to look.
   1.162 +# $1 Name of an environmal variable, assumed to point to the Program Files directory.
   1.163 +AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY],
   1.164 +[
   1.165 +  if test "x[$]$1" != x; then
   1.166 +    BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([`$CYGPATH -u "[$]$1"`/Java])
   1.167 +  fi
   1.168 +])
   1.169 +
   1.170 +# Test: Is there a JDK installed in default, well-known locations?
   1.171 +AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
   1.172 +[
   1.173 +  if test "x$OPENJDK_TARGET_OS" = xwindows; then
   1.174 +    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramW6432])])
   1.175 +    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMW6432])])
   1.176 +    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMFILES])])
   1.177 +    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramFiles])])
   1.178 +    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/cygdrive/c/Program Files/Java])])
   1.179 +  elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
   1.180 +    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/Library/Java/JavaVirtualMachines],[/Contents/Home])])
   1.181 +    BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/System/Library/Java/JavaVirtualMachines],[/Contents/Home])])
   1.182 +  fi
   1.183 +])
   1.184 +
   1.185 +# Check that a command-line tool in the Boot JDK is correct
   1.186 +# $1 = name of variable to assign
   1.187 +# $2 = name of binary
   1.188 +AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
   1.189 +[
   1.190 +  AC_MSG_CHECKING([for $2 in Boot JDK])
   1.191 +  $1=$BOOT_JDK/bin/$2
   1.192 +  if test ! -x [$]$1; then
   1.193 +      AC_MSG_RESULT(not found)
   1.194 +      AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk])
   1.195 +      AC_MSG_ERROR([Could not find $2 in the Boot JDK])
   1.196 +  fi
   1.197 +  AC_MSG_RESULT(ok)
   1.198  ])
   1.199  
   1.200  ###############################################################################
   1.201 @@ -51,204 +215,74 @@
   1.202  BOOT_JDK_FOUND=no
   1.203  AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk],
   1.204      [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])])
   1.205 -                    
   1.206 -if test "x$with_boot_jdk" != x; then
   1.207 -    BOOT_JDK=$with_boot_jdk
   1.208 -    BOOT_JDK_FOUND=yes
   1.209 -fi
   1.210 -if test "x$BOOT_JDK_FOUND" = xno; then
   1.211 -    BDEPS_CHECK_MODULE(BOOT_JDK, boot-jdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no])
   1.212 +
   1.213 +# We look for the Boot JDK through various means, going from more certain to
   1.214 +# more of a guess-work. After each test, BOOT_JDK_FOUND is set to "yes" if
   1.215 +# we detected something (if so, the path to the jdk is in BOOT_JDK). But we 
   1.216 +# must check if this is indeed valid; otherwise we'll continue looking.
   1.217 +
   1.218 +# Test: Is bootjdk explicitely set by command line arguments?
   1.219 +BOOTJDK_DO_CHECK([BOOTJDK_CHECK_ARGUMENTS])
   1.220 +if test "x$with_boot_jdk" != x && test "x$BOOT_JDK_FOUND" = xno; then
   1.221 +  # Having specified an argument which is incorrect will produce an instant failure;
   1.222 +  # we should not go on looking
   1.223 +  AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK])
   1.224  fi
   1.225  
   1.226 +# Test: Is bootjdk available from builddeps?
   1.227 +BOOTJDK_DO_CHECK([BOOTJDK_CHECK_BUILDDEPS])
   1.228 +
   1.229 +# Test: Is $JAVA_HOME set?
   1.230 +BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME])
   1.231 +
   1.232 +# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
   1.233 +BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME])
   1.234 +
   1.235 +# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
   1.236 +BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK])
   1.237 +
   1.238 +# Test: Is there a JDK installed in default, well-known locations?
   1.239 +BOOTJDK_DO_CHECK([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS])
   1.240 +
   1.241 +# If we haven't found anything yet, we've truly lost. Give up.
   1.242  if test "x$BOOT_JDK_FOUND" = xno; then
   1.243 -    if test "x$JAVA_HOME" != x; then
   1.244 -        if test ! -d "$JAVA_HOME"; then
   1.245 -            AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
   1.246 -            BOOTJDK_MISSING_ERROR
   1.247 -        fi
   1.248 -        # Aha, the user has set a JAVA_HOME
   1.249 -        # let us use that as the Boot JDK.
   1.250 -        BOOT_JDK="$JAVA_HOME"
   1.251 -        BOOT_JDK_FOUND=yes
   1.252 -        # To be on the safe side, lets check that it is a JDK.
   1.253 -        if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
   1.254 -            JAVAC="$BOOT_JDK/bin/javac"
   1.255 -            JAVA="$BOOT_JDK/bin/java"
   1.256 -            BOOT_JDK_FOUND=yes
   1.257 -        else
   1.258 -            AC_MSG_NOTICE([Your JAVA_HOME points to a JRE! The build needs a JDK! Please point JAVA_HOME to a JDK. JAVA_HOME=[$]JAVA_HOME])
   1.259 -            BOOTJDK_MISSING_ERROR
   1.260 -        fi            
   1.261 +  HELP_MSG_MISSING_DEPENDENCY([openjdk])
   1.262 +  AC_MSG_NOTICE([Could not find a valid Boot JDK. $HELP_MSG])
   1.263 +  AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk])
   1.264 +  AC_MSG_ERROR([Cannot continue])
   1.265 +fi
   1.266 +
   1.267 +# Setup proper paths for what we found
   1.268 +BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
   1.269 +if test ! -f "$BOOT_RTJAR"; then
   1.270 +    # On MacOSX it is called classes.jar
   1.271 +    BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
   1.272 +    if test -f "$BOOT_RTJAR"; then
   1.273 +      # Remove the .. 
   1.274 +      BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
   1.275      fi
   1.276  fi
   1.277 -
   1.278 -if test "x$BOOT_JDK_FOUND" = xno; then
   1.279 -    AC_PATH_PROG(JAVAC_CHECK, javac)
   1.280 -    AC_PATH_PROG(JAVA_CHECK, java)
   1.281 -    BINARY="$JAVAC_CHECK"
   1.282 -    if test "x$JAVAC_CHECK" = x; then
   1.283 -        BINARY="$JAVA_CHECK"
   1.284 -    fi
   1.285 -    if test "x$BINARY" != x; then
   1.286 -        # So there is a java(c) binary, it might be part of a JDK.
   1.287 -        # Lets find the JDK/JRE directory by following symbolic links.
   1.288 -        # Linux/GNU systems often have links from /usr/bin/java to 
   1.289 -        # /etc/alternatives/java to the real JDK binary.
   1.290 -	WHICHCMD_SPACESAFE(BINARY,[path to javac])
   1.291 -        REMOVE_SYMBOLIC_LINKS(BINARY)
   1.292 -        BOOT_JDK=`dirname $BINARY`
   1.293 -        BOOT_JDK=`cd $BOOT_JDK/..; pwd`
   1.294 -        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
   1.295 -            JAVAC=$BOOT_JDK/bin/javac
   1.296 -            JAVA=$BOOT_JDK/bin/java
   1.297 -            BOOT_JDK_FOUND=yes
   1.298 -        fi
   1.299 -    fi
   1.300 -fi
   1.301 -
   1.302 -if test "x$BOOT_JDK_FOUND" = xno; then
   1.303 -    # Try the MacOSX way.
   1.304 -    if test -x /usr/libexec/java_home; then
   1.305 -        BOOT_JDK=`/usr/libexec/java_home`
   1.306 -        if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then
   1.307 -            JAVAC=$BOOT_JDK/bin/javac
   1.308 -            JAVA=$BOOT_JDK/bin/java
   1.309 -            BOOT_JDK_FOUND=yes
   1.310 -        fi
   1.311 -    fi
   1.312 -fi
   1.313 -
   1.314 -if test "x$BOOT_JDK_FOUND" = xno; then
   1.315 -    AC_PATH_PROG(JAVA_CHECK, java)
   1.316 -    if test "x$JAVA_CHECK" != x; then
   1.317 -        # There is a java in the path. But apparently we have not found a javac 
   1.318 -        # in the path, since that would have been tested earlier.
   1.319 -        if test "x$OPENJDK_TARGET_OS" = xwindows; then
   1.320 -            # Now if this is a windows platform. The default installation of a JDK
   1.321 -            # actually puts the JRE in the path and keeps the JDK out of the path!
   1.322 -            # Go look in the default installation location.
   1.323 -            BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1`
   1.324 -            if test -d "$BOOT_JDK"; then
   1.325 -                BOOT_JDK_FOUND=yes
   1.326 -            fi
   1.327 -        fi
   1.328 -        if test "x$BOOT_JDK_FOUND" = xno; then
   1.329 -            HELP_MSG_MISSING_DEPENDENCY([openjdk])
   1.330 -            AC_MSG_NOTICE([Found a JRE, not not a JDK! Please remove the JRE from your path and put a JDK there instead. $HELP_MSG])
   1.331 -            BOOTJDK_MISSING_ERROR
   1.332 -        fi
   1.333 -    else
   1.334 -        HELP_MSG_MISSING_DEPENDENCY([openjdk])
   1.335 -        AC_MSG_NOTICE([Could not find a JDK. $HELP_MSG])
   1.336 -        BOOTJDK_MISSING_ERROR
   1.337 -    fi
   1.338 -fi
   1.339 -
   1.340 -BOOTJDK_WIN_FIX_PATH(BOOT_JDK)
   1.341 -
   1.342 -# Now see if we can find the rt.jar, or its nearest equivalent.
   1.343 -BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
   1.344 -SPACESAFE(BOOT_RTJAR,[the path to the Boot JDK rt.jar (or nearest equivalent)])
   1.345 -
   1.346  BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
   1.347 -SPACESAFE(BOOT_TOOLSJAR,[the path to the Boot JDK tools.jar (or nearest equivalent)])
   1.348 -
   1.349 -if test ! -f $BOOT_RTJAR; then
   1.350 -    # On MacOSX it is called classes.jar
   1.351 -    BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar
   1.352 -    if test ! -f $BOOT_RTJAR; then
   1.353 -        AC_MSG_NOTICE([Cannot find the rt.jar or its equivalent!])
   1.354 -        AC_MSG_NOTICE([This typically means that configure failed to automatically find a suitable Boot JDK])
   1.355 -        BOOTJDK_MISSING_ERROR
   1.356 -    fi
   1.357 -    # Remove the .. 
   1.358 -    BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
   1.359 -    # The tools.jar is part of classes.jar
   1.360 -    BOOT_TOOLSJAR="$BOOT_RTJAR"
   1.361 -fi
   1.362 -
   1.363 -AC_SUBST(BOOT_JDK)
   1.364 +BOOT_JDK="$BOOT_JDK"
   1.365  AC_SUBST(BOOT_RTJAR)
   1.366  AC_SUBST(BOOT_TOOLSJAR)
   1.367 -AC_MSG_CHECKING([for Boot JDK])
   1.368 -AC_MSG_RESULT([$BOOT_JDK])
   1.369 -AC_MSG_CHECKING([for Boot rt.jar])
   1.370 -AC_MSG_RESULT([$BOOT_RTJAR])
   1.371 -AC_MSG_CHECKING([for Boot tools.jar])
   1.372 -AC_MSG_RESULT([$BOOT_TOOLSJAR])
   1.373 +AC_SUBST(BOOT_JDK)
   1.374  
   1.375 -# Use the java tool from the Boot JDK.
   1.376 -AC_MSG_CHECKING([for java in Boot JDK])
   1.377 -JAVA=$BOOT_JDK/bin/java
   1.378 -if test ! -x $JAVA; then
   1.379 -    AC_MSG_NOTICE([Could not find a working java])
   1.380 -    BOOTJDK_MISSING_ERROR
   1.381 -fi
   1.382 -BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1`
   1.383 -AC_MSG_RESULT([yes $BOOT_JDK_VERSION])
   1.384 -AC_SUBST(JAVA)
   1.385 +# Setup tools from the Boot JDK.
   1.386 +BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA,java)
   1.387 +BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC,javac)
   1.388 +BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH,javah)
   1.389 +BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAP,javap)
   1.390 +BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR,jar)
   1.391 +BOOTJDK_CHECK_TOOL_IN_BOOTJDK(RMIC,rmic)
   1.392 +BOOTJDK_CHECK_TOOL_IN_BOOTJDK(NATIVE2ASCII,native2ascii)
   1.393  
   1.394 -# Extra M4 quote needed to protect [] in grep expression.
   1.395 -[FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`]
   1.396 -if test "x$FOUND_VERSION_78" = x; then
   1.397 -    HELP_MSG_MISSING_DEPENDENCY([openjdk])
   1.398 -    AC_MSG_NOTICE([Your boot-jdk must be version 7 or 8. $HELP_MSG])
   1.399 -    BOOTJDK_MISSING_ERROR
   1.400 -fi
   1.401 +# Finally, set some other options...
   1.402  
   1.403  # When compiling code to be executed by the Boot JDK, force jdk7 compatibility.
   1.404  BOOT_JDK_SOURCETARGET="-source 7 -target 7"
   1.405  AC_SUBST(BOOT_JDK_SOURCETARGET)
   1.406 -
   1.407 -# Use the javac tool from the Boot JDK.
   1.408 -AC_MSG_CHECKING([for javac in Boot JDK])
   1.409 -JAVAC=$BOOT_JDK/bin/javac
   1.410 -if test ! -x $JAVAC; then
   1.411 -    AC_MSG_ERROR([Could not find a working javac])
   1.412 -fi
   1.413 -AC_MSG_RESULT(yes)
   1.414 -AC_SUBST(JAVAC)
   1.415  AC_SUBST(JAVAC_FLAGS)
   1.416 -
   1.417 -# Use the javah tool from the Boot JDK.
   1.418 -AC_MSG_CHECKING([for javah in Boot JDK])
   1.419 -JAVAH=$BOOT_JDK/bin/javah
   1.420 -if test ! -x $JAVAH; then
   1.421 -    AC_MSG_NOTICE([Could not find a working javah])
   1.422 -    BOOTJDK_MISSING_ERROR
   1.423 -fi
   1.424 -AC_MSG_RESULT(yes)
   1.425 -AC_SUBST(JAVAH)
   1.426 -
   1.427 -# Use the jar tool from the Boot JDK.
   1.428 -AC_MSG_CHECKING([for jar in Boot JDK])
   1.429 -JAR=$BOOT_JDK/bin/jar
   1.430 -if test ! -x $JAR; then
   1.431 -    AC_MSG_NOTICE([Could not find a working jar])
   1.432 -    BOOTJDK_MISSING_ERROR
   1.433 -fi
   1.434 -AC_SUBST(JAR)
   1.435 -AC_MSG_RESULT(yes)
   1.436 -
   1.437 -# Use the rmic tool from the Boot JDK.
   1.438 -AC_MSG_CHECKING([for rmic in Boot JDK])
   1.439 -RMIC=$BOOT_JDK/bin/rmic
   1.440 -if test ! -x $RMIC; then
   1.441 -    AC_MSG_NOTICE([Could not find a working rmic])
   1.442 -    BOOTJDK_MISSING_ERROR
   1.443 -fi
   1.444 -AC_SUBST(RMIC)
   1.445 -AC_MSG_RESULT(yes)
   1.446 -
   1.447 -# Use the native2ascii tool from the Boot JDK.
   1.448 -AC_MSG_CHECKING([for native2ascii in Boot JDK])
   1.449 -NATIVE2ASCII=$BOOT_JDK/bin/native2ascii
   1.450 -if test ! -x $NATIVE2ASCII; then
   1.451 -    AC_MSG_NOTICE([Could not find a working native2ascii])
   1.452 -    BOOTJDK_MISSING_ERROR
   1.453 -fi
   1.454 -AC_MSG_RESULT(yes)
   1.455 -AC_SUBST(NATIVE2ASCII)
   1.456  ])
   1.457  
   1.458  AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],

mercurial