2012-07-06 01:27:07 +00:00
|
|
|
#
|
2023-02-21 22:10:36 +00:00
|
|
|
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
|
2012-07-06 01:27:07 +00:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
#
|
|
|
|
# This code is free software; you can redistribute it and/or modify it
|
|
|
|
# under the terms of the GNU General Public License version 2 only, as
|
|
|
|
# published by the Free Software Foundation. Oracle designates this
|
|
|
|
# particular file as subject to the "Classpath" exception as provided
|
|
|
|
# by Oracle in the LICENSE file that accompanied this code.
|
|
|
|
#
|
|
|
|
# This code is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
# version 2 for more details (a copy is included in the LICENSE file that
|
|
|
|
# accompanied this code).
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version
|
|
|
|
# 2 along with this work; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
|
|
|
# or visit www.oracle.com if you need additional information or have any
|
|
|
|
# questions.
|
|
|
|
#
|
|
|
|
|
2024-09-03 15:31:09 +00:00
|
|
|
################################################################################
|
2014-11-27 14:41:56 +00:00
|
|
|
# This file handles detection of the Boot JDK. The Boot JDK detection
|
|
|
|
# process has been developed as a response to solve a complex real-world
|
|
|
|
# problem. Initially, it was simple, but it has grown as platform after
|
2022-04-14 19:33:28 +00:00
|
|
|
# platform, idiosyncrasy after idiosyncrasy has been supported.
|
2014-01-29 21:55:43 +00:00
|
|
|
#
|
|
|
|
# The basic idea is this:
|
|
|
|
# 1) You need an acceptable *) JDK to use as a Boot JDK
|
2014-11-27 14:41:56 +00:00
|
|
|
# 2) There are several ways to locate a JDK, that are mostly platform
|
2014-01-29 21:55:43 +00:00
|
|
|
# dependent **)
|
|
|
|
# 3) You can have multiple JDKs installed
|
2014-11-27 14:41:56 +00:00
|
|
|
# 4) If possible, configure should try to dig out an acceptable JDK
|
2014-01-29 21:55:43 +00:00
|
|
|
# automatically, without having to resort to command-line options
|
|
|
|
#
|
2014-11-27 14:41:56 +00:00
|
|
|
# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with
|
|
|
|
# javac) and not a JRE, etc.
|
2014-01-29 21:55:43 +00:00
|
|
|
#
|
2014-11-27 14:41:56 +00:00
|
|
|
# **) On Windows we typically use a well-known path.
|
2014-01-29 21:55:43 +00:00
|
|
|
# On MacOSX we typically use the tool java_home.
|
2014-11-27 14:41:56 +00:00
|
|
|
# On Linux we typically find javac in the $PATH, and then follow a
|
|
|
|
# chain of symlinks that often ends up in a real JDK.
|
2014-01-29 21:55:43 +00:00
|
|
|
#
|
2014-11-27 14:41:56 +00:00
|
|
|
# This leads to the code where we check in different ways to locate a
|
|
|
|
# JDK, and if one is found, check if it is acceptable. If not, we print
|
|
|
|
# our reasons for rejecting it (useful when debugging non-working
|
|
|
|
# configure situations) and continue checking the next one.
|
2024-09-03 15:31:09 +00:00
|
|
|
################################################################################
|
2014-01-29 21:55:43 +00:00
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# Execute the check given as argument, and verify the result
|
|
|
|
# If the Boot JDK was previously found, do nothing
|
|
|
|
# $1 A command line (typically autoconf macro) to execute
|
|
|
|
AC_DEFUN([BOOTJDK_DO_CHECK],
|
2012-07-06 01:27:07 +00:00
|
|
|
[
|
2012-09-18 18:29:16 +00:00
|
|
|
if test "x$BOOT_JDK_FOUND" = xno; then
|
|
|
|
# Now execute the test
|
|
|
|
$1
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# If previous step claimed to have found a JDK, check it to see if it seems to be valid.
|
|
|
|
if test "x$BOOT_JDK_FOUND" = xmaybe; then
|
|
|
|
# Do we have a bin/java?
|
2020-12-07 15:55:53 +00:00
|
|
|
if test ! -x "$BOOT_JDK/bin/java" && test ! -x "$BOOT_JDK/bin/java.exe"; then
|
2012-09-18 18:29:16 +00:00
|
|
|
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring])
|
|
|
|
BOOT_JDK_FOUND=no
|
|
|
|
else
|
|
|
|
# Do we have a bin/javac?
|
2020-12-07 15:55:53 +00:00
|
|
|
if test ! -x "$BOOT_JDK/bin/javac" && test ! -x "$BOOT_JDK/bin/javac.exe"; then
|
2012-09-18 18:29:16 +00:00
|
|
|
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring])
|
|
|
|
AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
|
|
|
|
BOOT_JDK_FOUND=no
|
2013-10-10 12:58:19 +00:00
|
|
|
else
|
2014-12-09 07:49:22 +00:00
|
|
|
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
|
2020-12-07 15:55:53 +00:00
|
|
|
java_to_test="$BOOT_JDK/bin/java"
|
|
|
|
UTIL_FIXUP_EXECUTABLE(java_to_test)
|
|
|
|
BOOT_JDK_VERSION_OUTPUT=`$java_to_test $USER_BOOT_JDK_OPTIONS -version 2>&1`
|
2020-05-07 18:13:21 +00:00
|
|
|
# Additional [] needed to keep m4 from mangling shell constructs.
|
2020-12-07 15:55:53 +00:00
|
|
|
[ BOOT_JDK_VERSION=`echo $BOOT_JDK_VERSION_OUTPUT | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ]
|
|
|
|
|
2018-09-20 16:39:53 +00:00
|
|
|
if [ [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ]; then
|
|
|
|
AC_MSG_NOTICE([You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead.])
|
|
|
|
AC_MSG_NOTICE([Java reports: "$BOOT_JDK_VERSION".])
|
|
|
|
AC_MSG_ERROR([Cannot continue])
|
|
|
|
fi
|
|
|
|
if [ [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ]; then
|
|
|
|
AC_MSG_NOTICE([The specified --with-boot-jdk-jvmargs is invalid for the tested java])
|
|
|
|
AC_MSG_NOTICE([Error message: "$BOOT_JDK_VERSION".])
|
|
|
|
AC_MSG_NOTICE([Please fix arguments, or point to an explicit boot JDK which accept these arguments])
|
|
|
|
AC_MSG_ERROR([Cannot continue])
|
|
|
|
fi
|
2014-12-09 07:49:22 +00:00
|
|
|
|
|
|
|
# Extra M4 quote needed to protect [] in grep expression.
|
2018-03-08 21:17:57 +00:00
|
|
|
[FOUND_CORRECT_VERSION=`$ECHO $BOOT_JDK_VERSION \
|
|
|
|
| $EGREP "\"(${DEFAULT_ACCEPTABLE_BOOT_VERSIONS// /|})([\.+-].*)?\""`]
|
2020-12-07 15:55:53 +00:00
|
|
|
|
|
|
|
if test "x$BOOT_JDK_VERSION" = x; then
|
|
|
|
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is not a working JDK; ignoring])
|
|
|
|
AC_MSG_NOTICE([Output from java -version was: $BOOT_JDK_VERSION_OUTPUT])
|
|
|
|
BOOT_JDK_FOUND=no
|
|
|
|
elif test "x$FOUND_CORRECT_VERSION" = x; then
|
2014-12-09 07:49:22 +00:00
|
|
|
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
|
2018-03-08 21:17:57 +00:00
|
|
|
AC_MSG_NOTICE([(Your Boot JDK version must be one of: $DEFAULT_ACCEPTABLE_BOOT_VERSIONS)])
|
2012-09-18 18:29:16 +00:00
|
|
|
BOOT_JDK_FOUND=no
|
|
|
|
else
|
2014-12-09 07:49:22 +00:00
|
|
|
# We're done! :-)
|
|
|
|
BOOT_JDK_FOUND=yes
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_FIXUP_PATH(BOOT_JDK)
|
2014-12-09 07:49:22 +00:00
|
|
|
AC_MSG_CHECKING([for Boot JDK])
|
|
|
|
AC_MSG_RESULT([$BOOT_JDK])
|
|
|
|
AC_MSG_CHECKING([Boot JDK version])
|
2020-12-07 15:55:53 +00:00
|
|
|
BOOT_JDK_VERSION=`$java_to_test $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR -d '\r'`
|
|
|
|
# This is not a no-op; it will portably convert newline to space
|
|
|
|
BOOT_JDK_VERSION=`$ECHO $BOOT_JDK_VERSION`
|
2014-12-09 07:49:22 +00:00
|
|
|
AC_MSG_RESULT([$BOOT_JDK_VERSION])
|
|
|
|
fi # end check jdk version
|
2012-09-18 18:29:16 +00:00
|
|
|
fi # end check javac
|
|
|
|
fi # end check java
|
|
|
|
fi # end check boot jdk found
|
|
|
|
fi
|
|
|
|
])
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2016-12-02 15:17:52 +00:00
|
|
|
# Test: Is bootjdk explicitly set by command line arguments?
|
2012-09-18 18:29:16 +00:00
|
|
|
AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS],
|
2012-07-06 01:27:07 +00:00
|
|
|
[
|
2013-10-10 12:58:19 +00:00
|
|
|
if test "x$with_boot_jdk" != x; then
|
2022-06-02 12:49:35 +00:00
|
|
|
BOOT_JDK_ARG="$with_boot_jdk"
|
|
|
|
UTIL_FIXUP_PATH(BOOT_JDK_ARG)
|
|
|
|
if test -d "$BOOT_JDK_ARG"; then
|
|
|
|
BOOT_JDK=$BOOT_JDK_ARG
|
2018-02-12 08:12:41 +00:00
|
|
|
BOOT_JDK_FOUND=maybe
|
2022-06-02 12:49:35 +00:00
|
|
|
elif test -f "$BOOT_JDK_ARG"; then
|
|
|
|
case "$BOOT_JDK_ARG" in
|
2018-02-12 08:12:41 +00:00
|
|
|
*.tar.gz )
|
|
|
|
BOOT_JDK_SUPPORT_DIR=$CONFIGURESUPPORT_OUTPUTDIR/boot-jdk
|
|
|
|
$RM -rf $BOOT_JDK_SUPPORT_DIR
|
|
|
|
$MKDIR -p $BOOT_JDK_SUPPORT_DIR
|
2022-06-02 12:49:35 +00:00
|
|
|
$GUNZIP -c $BOOT_JDK_ARG | $TAR xf - -C $BOOT_JDK_SUPPORT_DIR
|
2018-02-12 08:12:41 +00:00
|
|
|
|
|
|
|
# Try to find javac to determine BOOT_JDK path
|
|
|
|
BOOT_JDK_JAVAC_PATH=`$FIND $BOOT_JDK_SUPPORT_DIR | $GREP "/bin/javac"`
|
|
|
|
if test "x$BOOT_JDK_JAVAC_PATH" != x; then
|
|
|
|
BOOT_JDK_FOUND=maybe
|
|
|
|
BOOT_JDK=$($DIRNAME $($DIRNAME $BOOT_JDK_JAVAC_PATH))
|
|
|
|
else
|
|
|
|
BOOT_JDK_FOUND=no
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
BOOT_JDK_FOUND=no
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
else
|
|
|
|
BOOT_JDK_FOUND=no
|
|
|
|
fi
|
2012-09-18 18:29:16 +00:00
|
|
|
AC_MSG_NOTICE([Found potential Boot JDK using configure arguments])
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2012-09-18 18:29:16 +00:00
|
|
|
])
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# Test: Is $JAVA_HOME set?
|
|
|
|
AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME],
|
|
|
|
[
|
2013-10-10 12:58:19 +00:00
|
|
|
if test "x$JAVA_HOME" != x; then
|
|
|
|
JAVA_HOME_PROCESSED="$JAVA_HOME"
|
2020-12-07 15:55:53 +00:00
|
|
|
UTIL_FIXUP_PATH(JAVA_HOME_PROCESSED, NOFAIL)
|
|
|
|
if test "x$JAVA_HOME_PROCESSED" = x || test ! -d "$JAVA_HOME_PROCESSED"; then
|
2013-10-10 12:58:19 +00:00
|
|
|
AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!])
|
|
|
|
else
|
|
|
|
# Aha, the user has set a JAVA_HOME
|
|
|
|
# let us use that as the Boot JDK.
|
|
|
|
BOOT_JDK="$JAVA_HOME_PROCESSED"
|
|
|
|
BOOT_JDK_FOUND=maybe
|
|
|
|
AC_MSG_NOTICE([Found potential Boot JDK using JAVA_HOME])
|
2012-07-06 01:27:07 +00:00
|
|
|
fi
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2012-09-18 18:29:16 +00:00
|
|
|
])
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
|
|
|
|
AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK],
|
|
|
|
[
|
2020-12-07 15:55:53 +00:00
|
|
|
UTIL_LOOKUP_PROGS(JAVAC_CHECK, javac, , NOFIXPATH)
|
|
|
|
UTIL_LOOKUP_PROGS(JAVA_CHECK, java, , NOFIXPATH)
|
2013-10-10 12:58:19 +00:00
|
|
|
BINARY="$JAVAC_CHECK"
|
|
|
|
if test "x$JAVAC_CHECK" = x; then
|
|
|
|
BINARY="$JAVA_CHECK"
|
|
|
|
fi
|
|
|
|
if test "x$BINARY" != x; then
|
|
|
|
# So there is a java(c) binary, it might be part of a JDK.
|
|
|
|
# Lets find the JDK/JRE directory by following symbolic links.
|
|
|
|
# Linux/GNU systems often have links from /usr/bin/java to
|
|
|
|
# /etc/alternatives/java to the real JDK binary.
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_REMOVE_SYMBOLIC_LINKS(BINARY)
|
2013-10-10 12:58:19 +00:00
|
|
|
BOOT_JDK=`dirname "$BINARY"`
|
|
|
|
BOOT_JDK=`cd "$BOOT_JDK/.."; pwd`
|
|
|
|
if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then
|
|
|
|
# Looks like we found ourselves an JDK
|
|
|
|
BOOT_JDK_FOUND=maybe
|
|
|
|
AC_MSG_NOTICE([Found potential Boot JDK using java(c) in PATH])
|
2012-07-06 01:27:07 +00:00
|
|
|
fi
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2012-09-18 18:29:16 +00:00
|
|
|
])
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX)
|
2014-01-29 21:55:43 +00:00
|
|
|
# $1: Argument to the java_home binary (optional)
|
2012-09-18 18:29:16 +00:00
|
|
|
AC_DEFUN([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME],
|
|
|
|
[
|
2013-10-10 12:58:19 +00:00
|
|
|
if test -x /usr/libexec/java_home; then
|
2014-01-29 21:55:43 +00:00
|
|
|
BOOT_JDK=`/usr/libexec/java_home $1`
|
2013-10-10 12:58:19 +00:00
|
|
|
BOOT_JDK_FOUND=maybe
|
2014-01-29 21:55:43 +00:00
|
|
|
AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home $1])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
|
|
|
|
AC_DEFUN([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR],
|
|
|
|
[
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
# First check at user selected default
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME()])
|
|
|
|
# If that did not work out (e.g. too old), try explicit versions instead
|
2020-12-07 15:55:53 +00:00
|
|
|
for ver in $DEFAULT_ACCEPTABLE_BOOT_VERSIONS ; do
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v $ver])])
|
|
|
|
done
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2012-09-18 18:29:16 +00:00
|
|
|
])
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2012-09-18 18:29:16 +00:00
|
|
|
# Look for a jdk in the given path. If there are multiple, try to select the newest.
|
|
|
|
# If found, set BOOT_JDK and BOOT_JDK_FOUND.
|
|
|
|
# $1 = Path to directory containing jdk installations.
|
|
|
|
# $2 = String to append to the found JDK directory to get the proper JDK home
|
|
|
|
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY],
|
|
|
|
[
|
|
|
|
BOOT_JDK_PREFIX="$1"
|
|
|
|
BOOT_JDK_SUFFIX="$2"
|
2012-10-26 21:29:57 +00:00
|
|
|
ALL_JDKS_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $SORT -r`
|
|
|
|
if test "x$ALL_JDKS_FOUND" != x; then
|
|
|
|
for JDK_TO_TRY in $ALL_JDKS_FOUND ; do
|
|
|
|
BOOTJDK_DO_CHECK([
|
|
|
|
BOOT_JDK="${BOOT_JDK_PREFIX}/${JDK_TO_TRY}${BOOT_JDK_SUFFIX}"
|
|
|
|
if test -d "$BOOT_JDK"; then
|
|
|
|
BOOT_JDK_FOUND=maybe
|
|
|
|
AC_MSG_NOTICE([Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX/$JDK_TO_TRY)])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
done
|
2012-09-18 18:29:16 +00:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
# Call BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY, but use the given
|
|
|
|
# environmental variable as base for where to look.
|
|
|
|
# $1 Name of an environmal variable, assumed to point to the Program Files directory.
|
|
|
|
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY],
|
|
|
|
[
|
|
|
|
if test "x[$]$1" != x; then
|
2012-10-26 21:29:57 +00:00
|
|
|
VIRTUAL_DIR="[$]$1/Java"
|
2020-12-07 15:55:53 +00:00
|
|
|
UTIL_FIXUP_PATH(VIRTUAL_DIR, NOFAIL)
|
|
|
|
if test "x$VIRTUAL_DIR" != x; then
|
|
|
|
BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY($VIRTUAL_DIR)
|
|
|
|
fi
|
2012-09-18 18:29:16 +00:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
# Test: Is there a JDK installed in default, well-known locations?
|
|
|
|
AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS],
|
|
|
|
[
|
|
|
|
if test "x$OPENJDK_TARGET_OS" = xwindows; then
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramW6432])])
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMW6432])])
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMFILES])])
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramFiles])])
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/cygdrive/c/Program Files/Java])])
|
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/Library/Java/JavaVirtualMachines],[/Contents/Home])])
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/System/Library/Java/JavaVirtualMachines],[/Contents/Home])])
|
2012-10-26 21:29:57 +00:00
|
|
|
elif test "x$OPENJDK_TARGET_OS" = xlinux; then
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/usr/lib/jvm])])
|
2012-09-18 18:29:16 +00:00
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
# Check that a command-line tool in the Boot JDK is correct
|
|
|
|
# $1 = name of variable to assign
|
|
|
|
# $2 = name of binary
|
|
|
|
AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK],
|
|
|
|
[
|
2014-01-29 21:55:43 +00:00
|
|
|
# Use user overridden value if available, otherwise locate tool in the Boot JDK.
|
2020-12-07 15:55:53 +00:00
|
|
|
UTIL_REQUIRE_SPECIAL($1,
|
2014-01-29 21:55:43 +00:00
|
|
|
[
|
2020-12-07 15:55:53 +00:00
|
|
|
AC_MSG_CHECKING([for $2 [[Boot JDK]]])
|
2014-01-29 21:55:43 +00:00
|
|
|
$1=$BOOT_JDK/bin/$2
|
2020-12-07 15:55:53 +00:00
|
|
|
if test ! -x [$]$1 && test ! -x [$]$1.exe; then
|
2014-01-29 21:55:43 +00:00
|
|
|
AC_MSG_RESULT(not found)
|
2016-12-02 15:17:52 +00:00
|
|
|
AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitly setting --with-boot-jdk])
|
2014-01-29 21:55:43 +00:00
|
|
|
AC_MSG_ERROR([Could not find $2 in the Boot JDK])
|
|
|
|
fi
|
2020-12-07 15:55:53 +00:00
|
|
|
AC_MSG_RESULT(\[$]BOOT_JDK/bin/$2)
|
|
|
|
UTIL_FIXUP_EXECUTABLE($1)
|
2014-01-29 21:55:43 +00:00
|
|
|
AC_SUBST($1)
|
|
|
|
])
|
2012-09-18 18:29:16 +00:00
|
|
|
])
|
|
|
|
|
2021-08-30 11:37:47 +00:00
|
|
|
# Setup CLASSPATH environment variable
|
|
|
|
AC_DEFUN([BOOTJDK_SETUP_CLASSPATH],
|
|
|
|
[
|
|
|
|
AC_ARG_WITH([classpath], [AS_HELP_STRING([--with-classpath],
|
|
|
|
[Optional classpath to set as CLASSPATH to all Java invocations @<:@none@:>@])])
|
|
|
|
|
|
|
|
if test "x$CLASSPATH" != x; then
|
|
|
|
AC_MSG_WARN([CLASSPATH is set in the environment. This will be ignored. Use --with-classpath instead.])
|
|
|
|
fi
|
|
|
|
|
|
|
|
CLASSPATH=
|
|
|
|
|
|
|
|
if test "x$with_classpath" != x && test "x$with_classpath" != xyes &&
|
|
|
|
test "x$with_classpath" != xno ; then
|
|
|
|
CLASSPATH="$with_classpath"
|
|
|
|
AC_MSG_CHECKING([for classpath to use for all Java invocations])
|
|
|
|
AC_MSG_RESULT([$CLASSPATH])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(CLASSPATH)
|
|
|
|
])
|
|
|
|
|
2024-09-03 15:31:09 +00:00
|
|
|
################################################################################
|
2012-09-18 18:29:16 +00:00
|
|
|
#
|
2013-10-10 12:58:19 +00:00
|
|
|
# We need a Boot JDK to bootstrap the build.
|
2012-09-18 18:29:16 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
|
|
|
|
[
|
2013-10-10 12:58:19 +00:00
|
|
|
BOOT_JDK_FOUND=no
|
|
|
|
AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk],
|
|
|
|
[path to Boot JDK (used to bootstrap build) @<:@probed@:>@])])
|
2012-09-18 18:29:16 +00:00
|
|
|
|
2018-09-20 16:39:53 +00:00
|
|
|
AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs],
|
|
|
|
[specify additional arguments to be passed to Boot JDK tools @<:@none@:>@])])
|
|
|
|
|
|
|
|
USER_BOOT_JDK_OPTIONS="$with_boot_jdk_jvmargs"
|
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
# We look for the Boot JDK through various means, going from more certain to
|
|
|
|
# more of a guess-work. After each test, BOOT_JDK_FOUND is set to "yes" if
|
|
|
|
# we detected something (if so, the path to the jdk is in BOOT_JDK). But we
|
|
|
|
# must check if this is indeed valid; otherwise we'll continue looking.
|
2012-09-18 18:29:16 +00:00
|
|
|
|
2016-12-02 15:17:52 +00:00
|
|
|
# Test: Is bootjdk explicitly set by command line arguments?
|
2013-10-10 12:58:19 +00:00
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_ARGUMENTS])
|
|
|
|
if test "x$with_boot_jdk" != x && test "x$BOOT_JDK_FOUND" = xno; then
|
|
|
|
# Having specified an argument which is incorrect will produce an instant failure;
|
|
|
|
# we should not go on looking
|
|
|
|
AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK])
|
|
|
|
fi
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
# Test: Is $JAVA_HOME set?
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME])
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2020-12-07 15:55:53 +00:00
|
|
|
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home?
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR])
|
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK?
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK])
|
2012-09-18 18:29:16 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
# Test: Is there a JDK installed in default, well-known locations?
|
|
|
|
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS])
|
2012-09-18 18:29:16 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
# If we haven't found anything yet, we've truly lost. Give up.
|
|
|
|
if test "x$BOOT_JDK_FOUND" = xno; then
|
|
|
|
HELP_MSG_MISSING_DEPENDENCY([openjdk])
|
|
|
|
AC_MSG_NOTICE([Could not find a valid Boot JDK. $HELP_MSG])
|
2016-12-02 15:17:52 +00:00
|
|
|
AC_MSG_NOTICE([This might be fixed by explicitly setting --with-boot-jdk])
|
2013-10-10 12:58:19 +00:00
|
|
|
AC_MSG_ERROR([Cannot continue])
|
|
|
|
fi
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
AC_SUBST(BOOT_JDK)
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
# Setup tools from the Boot JDK.
|
2020-12-07 15:55:53 +00:00
|
|
|
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java)
|
|
|
|
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac)
|
|
|
|
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVADOC, javadoc)
|
|
|
|
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar)
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2013-10-10 12:58:19 +00:00
|
|
|
# Finally, set some other options...
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2021-12-23 11:01:26 +00:00
|
|
|
# Determine if the boot jdk jar supports the --date option
|
2023-02-21 22:10:36 +00:00
|
|
|
if $JAR --help 2>&1 | $GREP -q -e "--date=TIMESTAMP"; then
|
2021-12-23 11:01:26 +00:00
|
|
|
BOOT_JDK_JAR_SUPPORTS_DATE=true
|
|
|
|
else
|
|
|
|
BOOT_JDK_JAR_SUPPORTS_DATE=false
|
|
|
|
fi
|
|
|
|
AC_MSG_CHECKING([if Boot JDK jar supports --date=TIMESTAMP])
|
|
|
|
AC_MSG_RESULT([$BOOT_JDK_JAR_SUPPORTS_DATE])
|
|
|
|
AC_SUBST(BOOT_JDK_JAR_SUPPORTS_DATE)
|
|
|
|
|
2017-10-19 12:16:45 +00:00
|
|
|
# When compiling code to be executed by the Boot JDK, force compatibility with the
|
|
|
|
# oldest supported bootjdk.
|
2020-04-20 17:38:16 +00:00
|
|
|
OLDEST_BOOT_JDK=`$ECHO $DEFAULT_ACCEPTABLE_BOOT_VERSIONS \
|
|
|
|
| $TR " " "\n" | $SORT -n | $HEAD -n1`
|
2020-04-29 13:54:57 +00:00
|
|
|
# -Xlint:-options is added to avoid "warning: [options] system modules path not set in conjunction with -source"
|
|
|
|
BOOT_JDK_SOURCETARGET="-source $OLDEST_BOOT_JDK -target $OLDEST_BOOT_JDK -Xlint:-options"
|
2013-10-10 12:58:19 +00:00
|
|
|
AC_SUBST(BOOT_JDK_SOURCETARGET)
|
2016-03-17 19:03:53 +00:00
|
|
|
|
2015-10-20 15:29:53 +00:00
|
|
|
# Check if the boot jdk is 32 or 64 bit
|
2020-12-07 15:55:53 +00:00
|
|
|
if $JAVA -version 2>&1 | $GREP -q "64-Bit"; then
|
2015-10-20 15:29:53 +00:00
|
|
|
BOOT_JDK_BITS="64"
|
|
|
|
else
|
|
|
|
BOOT_JDK_BITS="32"
|
|
|
|
fi
|
|
|
|
AC_MSG_CHECKING([if Boot JDK is 32 or 64 bits])
|
|
|
|
AC_MSG_RESULT([$BOOT_JDK_BITS])
|
2017-10-10 11:33:39 +00:00
|
|
|
|
|
|
|
# Try to enable CDS
|
|
|
|
AC_MSG_CHECKING([for local Boot JDK Class Data Sharing (CDS)])
|
|
|
|
BOOT_JDK_CDS_ARCHIVE=$CONFIGURESUPPORT_OUTPUTDIR/classes.jsa
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-XX:+UnlockDiagnosticVMOptions -XX:-VerifySharedSpaces -XX:SharedArchiveFile=$BOOT_JDK_CDS_ARCHIVE],boot_jdk_cds_args,[$JAVA])
|
2017-10-10 11:33:39 +00:00
|
|
|
|
|
|
|
if test "x$boot_jdk_cds_args" != x; then
|
|
|
|
# Try creating a CDS archive
|
2020-12-07 15:55:53 +00:00
|
|
|
$JAVA $boot_jdk_cds_args -Xshare:dump > /dev/null 2>&1
|
2017-10-10 11:33:39 +00:00
|
|
|
if test $? -eq 0; then
|
|
|
|
BOOTJDK_USE_LOCAL_CDS=true
|
|
|
|
AC_MSG_RESULT([yes, created])
|
|
|
|
else
|
|
|
|
# Generation failed, don't use CDS.
|
|
|
|
BOOTJDK_USE_LOCAL_CDS=false
|
|
|
|
AC_MSG_RESULT([no, creation failed])
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
BOOTJDK_USE_LOCAL_CDS=false
|
|
|
|
AC_MSG_RESULT([no, -XX:SharedArchiveFile not supported])
|
|
|
|
fi
|
2021-08-30 11:37:47 +00:00
|
|
|
|
|
|
|
BOOTJDK_SETUP_CLASSPATH
|
2012-07-06 01:27:07 +00:00
|
|
|
])
|
|
|
|
|
|
|
|
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
|
|
|
|
[
|
2013-10-10 12:58:19 +00:00
|
|
|
##############################################################################
|
|
|
|
#
|
2014-03-03 17:21:42 +00:00
|
|
|
# Specify jvm options for anything that is run with the Boot JDK.
|
|
|
|
# Not all JVM:s accept the same arguments on the command line.
|
2013-10-10 12:58:19 +00:00
|
|
|
#
|
2014-03-03 17:21:42 +00:00
|
|
|
AC_MSG_CHECKING([flags for boot jdk java command] )
|
|
|
|
|
2016-07-21 16:47:22 +00:00
|
|
|
# Force en-US environment
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-Duser.language=en -Duser.country=US],boot_jdk_jvmargs,[$JAVA])
|
2016-07-21 16:47:22 +00:00
|
|
|
|
2017-10-10 11:33:39 +00:00
|
|
|
if test "x$BOOTJDK_USE_LOCAL_CDS" = xtrue; then
|
|
|
|
# Use our own CDS archive
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([$boot_jdk_cds_args -Xshare:auto],boot_jdk_jvmargs,[$JAVA])
|
2017-10-10 11:33:39 +00:00
|
|
|
else
|
|
|
|
# Otherwise optimistically use the system-wide one, if one is present
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-Xshare:auto],boot_jdk_jvmargs,[$JAVA])
|
2017-10-10 11:33:39 +00:00
|
|
|
fi
|
|
|
|
|
2018-09-20 16:39:53 +00:00
|
|
|
# Finally append user provided options to allow them to override.
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([$USER_BOOT_JDK_OPTIONS],boot_jdk_jvmargs,[$JAVA])
|
2014-03-14 12:16:46 +00:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$boot_jdk_jvmargs])
|
|
|
|
|
|
|
|
# For now, general JAVA_FLAGS are the same as the boot jdk jvmargs
|
|
|
|
JAVA_FLAGS=$boot_jdk_jvmargs
|
|
|
|
AC_SUBST(JAVA_FLAGS)
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([flags for boot jdk java command for big workloads])
|
|
|
|
|
2014-03-03 17:21:42 +00:00
|
|
|
# Starting amount of heap memory.
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs_big,[$JAVA])
|
2016-06-28 12:20:17 +00:00
|
|
|
BOOTCYCLE_JVM_ARGS_BIG=-Xms64M
|
|
|
|
|
2020-04-28 18:54:06 +00:00
|
|
|
# Maximum amount of heap memory.
|
2018-04-16 10:20:36 +00:00
|
|
|
JVM_HEAP_LIMIT_32="768"
|
2016-06-28 12:20:17 +00:00
|
|
|
# Running a 64 bit JVM allows for and requires a bigger heap
|
|
|
|
JVM_HEAP_LIMIT_64="1600"
|
|
|
|
JVM_HEAP_LIMIT_GLOBAL=`expr $MEMORY_SIZE / 2`
|
|
|
|
if test "$JVM_HEAP_LIMIT_GLOBAL" -lt "$JVM_HEAP_LIMIT_32"; then
|
|
|
|
JVM_HEAP_LIMIT_32=$JVM_HEAP_LIMIT_GLOBAL
|
|
|
|
fi
|
|
|
|
if test "$JVM_HEAP_LIMIT_GLOBAL" -lt "$JVM_HEAP_LIMIT_64"; then
|
|
|
|
JVM_HEAP_LIMIT_64=$JVM_HEAP_LIMIT_GLOBAL
|
|
|
|
fi
|
|
|
|
if test "$JVM_HEAP_LIMIT_GLOBAL" -lt "512"; then
|
|
|
|
JVM_HEAP_LIMIT_32=512
|
|
|
|
JVM_HEAP_LIMIT_64=512
|
|
|
|
fi
|
2014-03-03 17:21:42 +00:00
|
|
|
|
2015-10-20 15:29:53 +00:00
|
|
|
if test "x$BOOT_JDK_BITS" = "x32"; then
|
2016-06-28 12:20:17 +00:00
|
|
|
JVM_MAX_HEAP=$JVM_HEAP_LIMIT_32
|
2014-03-03 17:21:42 +00:00
|
|
|
else
|
2016-06-28 12:20:17 +00:00
|
|
|
JVM_MAX_HEAP=$JVM_HEAP_LIMIT_64
|
2013-10-10 12:58:19 +00:00
|
|
|
fi
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-Xmx${JVM_MAX_HEAP}M],boot_jdk_jvmargs_big,[$JAVA])
|
2014-03-03 17:21:42 +00:00
|
|
|
|
2014-03-14 12:16:46 +00:00
|
|
|
AC_MSG_RESULT([$boot_jdk_jvmargs_big])
|
2014-03-03 17:21:42 +00:00
|
|
|
|
2014-03-14 12:16:46 +00:00
|
|
|
JAVA_FLAGS_BIG=$boot_jdk_jvmargs_big
|
|
|
|
AC_SUBST(JAVA_FLAGS_BIG)
|
2014-03-03 17:21:42 +00:00
|
|
|
|
2016-06-28 12:20:17 +00:00
|
|
|
if test "x$OPENJDK_TARGET_CPU_BITS" = "x32"; then
|
|
|
|
BOOTCYCLE_MAX_HEAP=$JVM_HEAP_LIMIT_32
|
|
|
|
else
|
|
|
|
BOOTCYCLE_MAX_HEAP=$JVM_HEAP_LIMIT_64
|
|
|
|
fi
|
|
|
|
BOOTCYCLE_JVM_ARGS_BIG="$BOOTCYCLE_JVM_ARGS_BIG -Xmx${BOOTCYCLE_MAX_HEAP}M"
|
|
|
|
AC_MSG_CHECKING([flags for bootcycle boot jdk java command for big workloads])
|
|
|
|
AC_MSG_RESULT([$BOOTCYCLE_JVM_ARGS_BIG])
|
|
|
|
AC_SUBST(BOOTCYCLE_JVM_ARGS_BIG)
|
|
|
|
|
2014-03-14 12:16:46 +00:00
|
|
|
AC_MSG_CHECKING([flags for boot jdk java command for small workloads])
|
|
|
|
|
|
|
|
# Use serial gc for small short lived tools if possible
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-XX:+UseSerialGC],boot_jdk_jvmargs_small,[$JAVA])
|
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-Xms32M],boot_jdk_jvmargs_small,[$JAVA])
|
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-Xmx512M],boot_jdk_jvmargs_small,[$JAVA])
|
|
|
|
UTIL_ADD_JVM_ARG_IF_OK([-XX:TieredStopAtLevel=1],boot_jdk_jvmargs_small,[$JAVA])
|
2014-03-14 12:16:46 +00:00
|
|
|
|
|
|
|
AC_MSG_RESULT([$boot_jdk_jvmargs_small])
|
2012-07-06 01:27:07 +00:00
|
|
|
|
2014-03-14 12:16:46 +00:00
|
|
|
JAVA_FLAGS_SMALL=$boot_jdk_jvmargs_small
|
|
|
|
AC_SUBST(JAVA_FLAGS_SMALL)
|
2014-08-17 14:51:37 +00:00
|
|
|
|
2020-04-28 17:41:39 +00:00
|
|
|
# Don't presuppose SerialGC is present in the buildjdk. Also, we cannot test
|
|
|
|
# the buildjdk, but on the other hand we know what it will support.
|
2023-11-24 06:30:08 +00:00
|
|
|
BUILD_JAVA_FLAGS_SMALL="-Xms32M -Xmx512M -XX:TieredStopAtLevel=1"
|
|
|
|
AC_SUBST(BUILD_JAVA_FLAGS_SMALL)
|
2020-04-28 17:41:39 +00:00
|
|
|
|
2014-08-17 14:51:37 +00:00
|
|
|
JAVA_TOOL_FLAGS_SMALL=""
|
|
|
|
for f in $JAVA_FLAGS_SMALL; do
|
|
|
|
JAVA_TOOL_FLAGS_SMALL="$JAVA_TOOL_FLAGS_SMALL -J$f"
|
|
|
|
done
|
|
|
|
AC_SUBST(JAVA_TOOL_FLAGS_SMALL)
|
2012-07-06 01:27:07 +00:00
|
|
|
])
|
2016-03-17 19:03:53 +00:00
|
|
|
|
|
|
|
# BUILD_JDK: the location of the latest JDK that can run
|
|
|
|
# on the host system and supports the target class file version
|
|
|
|
# generated in this JDK build. This variable should only be
|
|
|
|
# used after the launchers are built.
|
|
|
|
#
|
|
|
|
|
|
|
|
# Execute the check given as argument, and verify the result.
|
|
|
|
# If the JDK was previously found, do nothing.
|
|
|
|
# $1 A command line (typically autoconf macro) to execute
|
|
|
|
AC_DEFUN([BOOTJDK_CHECK_BUILD_JDK],
|
|
|
|
[
|
|
|
|
if test "x$BUILD_JDK_FOUND" = xno; then
|
|
|
|
# Execute the test
|
|
|
|
$1
|
|
|
|
|
|
|
|
# If previous step claimed to have found a JDK, check it to see if it seems to be valid.
|
|
|
|
if test "x$BUILD_JDK_FOUND" = xmaybe; then
|
|
|
|
# Do we have a bin/java?
|
|
|
|
if test ! -x "$BUILD_JDK/bin/java"; then
|
|
|
|
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/java; ignoring])
|
|
|
|
BUILD_JDK_FOUND=no
|
|
|
|
elif test ! -x "$BUILD_JDK/bin/jlink"; then
|
|
|
|
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/jlink; ignoring])
|
|
|
|
BUILD_JDK_FOUND=no
|
2016-05-09 15:15:05 +00:00
|
|
|
elif test ! -x "$BUILD_JDK/bin/jmod"; then
|
|
|
|
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/jmod; ignoring])
|
|
|
|
BUILD_JDK_FOUND=no
|
2016-03-17 19:03:53 +00:00
|
|
|
elif test ! -x "$BUILD_JDK/bin/javac"; then
|
|
|
|
# Do we have a bin/javac?
|
|
|
|
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK did not contain bin/javac; ignoring])
|
|
|
|
AC_MSG_NOTICE([(This might be a JRE instead of an JDK)])
|
|
|
|
BUILD_JDK_FOUND=no
|
|
|
|
else
|
|
|
|
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
|
2020-05-07 18:13:21 +00:00
|
|
|
# Additional [] needed to keep m4 from mangling shell constructs.
|
2020-11-18 21:54:12 +00:00
|
|
|
[ BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $AWK '/version "[0-9a-zA-Z\._\-]+"/ {print $ 0; exit;}'` ]
|
2016-03-17 19:03:53 +00:00
|
|
|
|
|
|
|
# Extra M4 quote needed to protect [] in grep expression.
|
2018-03-08 21:17:57 +00:00
|
|
|
[FOUND_CORRECT_VERSION=`echo $BUILD_JDK_VERSION | $EGREP "\"$VERSION_FEATURE([\.+-].*)?\""`]
|
2016-03-17 19:03:53 +00:00
|
|
|
if test "x$FOUND_CORRECT_VERSION" = x; then
|
2016-04-12 13:20:39 +00:00
|
|
|
AC_MSG_NOTICE([Potential Build JDK found at $BUILD_JDK is incorrect JDK version ($BUILD_JDK_VERSION); ignoring])
|
2018-03-08 21:17:57 +00:00
|
|
|
AC_MSG_NOTICE([(Your Build JDK must be version $VERSION_FEATURE)])
|
2016-03-17 19:03:53 +00:00
|
|
|
BUILD_JDK_FOUND=no
|
|
|
|
else
|
|
|
|
# We're done!
|
|
|
|
BUILD_JDK_FOUND=yes
|
2020-02-21 17:37:10 +00:00
|
|
|
UTIL_FIXUP_PATH(BUILD_JDK)
|
2016-03-17 19:03:53 +00:00
|
|
|
AC_MSG_CHECKING([for Build JDK])
|
|
|
|
AC_MSG_RESULT([$BUILD_JDK])
|
|
|
|
AC_MSG_CHECKING([Build JDK version])
|
|
|
|
BUILD_JDK_VERSION=`"$BUILD_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '`
|
|
|
|
AC_MSG_RESULT([$BUILD_JDK_VERSION])
|
|
|
|
fi # end check jdk version
|
|
|
|
fi # end check java
|
|
|
|
fi # end check build jdk found
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
# By default the BUILD_JDK is the JDK_OUTPUTDIR. If the target architecture
|
|
|
|
# is different than the host system doing the build (e.g. cross-compilation),
|
|
|
|
# a special BUILD_JDK is built as part of the build process. An external
|
|
|
|
# prebuilt BUILD_JDK can also be supplied.
|
|
|
|
AC_DEFUN([BOOTJDK_SETUP_BUILD_JDK],
|
|
|
|
[
|
|
|
|
AC_ARG_WITH(build-jdk, [AS_HELP_STRING([--with-build-jdk],
|
|
|
|
[path to JDK of same version as is being built@<:@the newly built JDK@:>@])])
|
|
|
|
|
2016-05-06 23:21:08 +00:00
|
|
|
CREATE_BUILDJDK=false
|
|
|
|
EXTERNAL_BUILDJDK=false
|
2016-03-17 19:03:53 +00:00
|
|
|
BUILD_JDK_FOUND="no"
|
|
|
|
if test "x$with_build_jdk" != "x"; then
|
|
|
|
BOOTJDK_CHECK_BUILD_JDK([
|
2024-08-30 08:58:18 +00:00
|
|
|
if test "x$with_build_jdk" != x; then
|
|
|
|
BUILD_JDK=$with_build_jdk
|
|
|
|
BUILD_JDK_FOUND=maybe
|
|
|
|
AC_MSG_NOTICE([Found potential Build JDK using configure arguments])
|
|
|
|
fi
|
|
|
|
])
|
2016-05-06 23:21:08 +00:00
|
|
|
EXTERNAL_BUILDJDK=true
|
2016-03-17 19:03:53 +00:00
|
|
|
else
|
|
|
|
if test "x$COMPILE_TYPE" = "xcross"; then
|
|
|
|
BUILD_JDK="\$(BUILDJDK_OUTPUTDIR)/jdk"
|
|
|
|
BUILD_JDK_FOUND=yes
|
|
|
|
CREATE_BUILDJDK=true
|
|
|
|
AC_MSG_CHECKING([for Build JDK])
|
|
|
|
AC_MSG_RESULT([yes, will build it for the host platform])
|
|
|
|
else
|
|
|
|
BUILD_JDK="\$(JDK_OUTPUTDIR)"
|
|
|
|
BUILD_JDK_FOUND=yes
|
|
|
|
AC_MSG_CHECKING([for Build JDK])
|
|
|
|
AC_MSG_RESULT([yes, will use output dir])
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-12-07 15:55:53 +00:00
|
|
|
# Since these tools do not yet exist, we cannot use UTIL_FIXUP_EXECUTABLE to
|
|
|
|
# detect the need of fixpath
|
2016-05-09 15:15:05 +00:00
|
|
|
JMOD="$BUILD_JDK/bin/jmod"
|
2020-12-07 15:55:53 +00:00
|
|
|
UTIL_ADD_FIXPATH(JMOD)
|
2016-05-09 15:15:05 +00:00
|
|
|
JLINK="$BUILD_JDK/bin/jlink"
|
2020-12-07 15:55:53 +00:00
|
|
|
UTIL_ADD_FIXPATH(JLINK)
|
2016-05-09 15:15:05 +00:00
|
|
|
AC_SUBST(JMOD)
|
|
|
|
AC_SUBST(JLINK)
|
|
|
|
|
2016-03-17 19:03:53 +00:00
|
|
|
if test "x$BUILD_JDK_FOUND" != "xyes"; then
|
|
|
|
AC_MSG_CHECKING([for Build JDK])
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
AC_MSG_ERROR([Could not find a suitable Build JDK])
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(CREATE_BUILDJDK)
|
|
|
|
AC_SUBST(BUILD_JDK)
|
2016-05-06 23:21:08 +00:00
|
|
|
AC_SUBST(EXTERNAL_BUILDJDK)
|
2016-03-17 19:03:53 +00:00
|
|
|
])
|
2021-01-07 14:57:30 +00:00
|
|
|
|
|
|
|
# The docs-reference JDK is used to run javadoc for the docs-reference targets.
|
|
|
|
# If not set, the reference docs will be built using the interim javadoc.
|
|
|
|
AC_DEFUN([BOOTJDK_SETUP_DOCS_REFERENCE_JDK],
|
|
|
|
[
|
|
|
|
AC_ARG_WITH(docs-reference-jdk, [AS_HELP_STRING([--with-docs-reference-jdk],
|
|
|
|
[path to JDK to use for building the reference documentation])])
|
|
|
|
|
|
|
|
AC_MSG_CHECKING([for docs-reference JDK])
|
|
|
|
if test "x$with_docs_reference_jdk" != "x"; then
|
|
|
|
DOCS_REFERENCE_JDK="$with_docs_reference_jdk"
|
|
|
|
AC_MSG_RESULT([$DOCS_REFERENCE_JDK])
|
|
|
|
DOCS_REFERENCE_JAVADOC="$DOCS_REFERENCE_JDK/bin/javadoc"
|
|
|
|
if test ! -x "$DOCS_REFERENCE_JAVADOC"; then
|
|
|
|
AC_MSG_ERROR([docs-reference JDK found at $DOCS_REFERENCE_JDK did not contain bin/javadoc])
|
|
|
|
fi
|
|
|
|
UTIL_FIXUP_EXECUTABLE(DOCS_REFERENCE_JAVADOC)
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no, using interim javadoc for the docs-reference targets])
|
|
|
|
# By leaving this empty, Docs.gmk will revert to the default interim javadoc
|
|
|
|
DOCS_REFERENCE_JAVADOC=
|
|
|
|
fi
|
|
|
|
|
|
|
|
AC_SUBST(DOCS_REFERENCE_JAVADOC)
|
|
|
|
])
|