author | vlivanov |
Fri, 20 Mar 2015 11:41:34 -0700 | |
changeset 30189 | 0dce8215957a |
parent 27865 | 6c830e3b9caf |
child 30093 | c8c926543552 |
permissions | -rw-r--r-- |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
1 |
# |
22477 | 2 |
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
4 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
5 |
# This code is free software; you can redistribute it and/or modify it |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
7 |
# published by the Free Software Foundation. Oracle designates this |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
8 |
# particular file as subject to the "Classpath" exception as provided |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
10 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
15 |
# accompanied this code). |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
16 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
17 |
# You should have received a copy of the GNU General Public License version |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
20 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
22 |
# or visit www.oracle.com if you need additional information or have any |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
23 |
# questions. |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
24 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
25 |
|
22477 | 26 |
######################################################################## |
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
27 |
# This file handles detection of the Boot JDK. The Boot JDK detection |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
28 |
# process has been developed as a response to solve a complex real-world |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
29 |
# problem. Initially, it was simple, but it has grown as platform after |
22477 | 30 |
# platform, idiosyncracy after idiosyncracy has been supported. |
31 |
# |
|
32 |
# The basic idea is this: |
|
33 |
# 1) You need an acceptable *) JDK to use as a Boot JDK |
|
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
34 |
# 2) There are several ways to locate a JDK, that are mostly platform |
22477 | 35 |
# dependent **) |
36 |
# 3) You can have multiple JDKs installed |
|
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
37 |
# 4) If possible, configure should try to dig out an acceptable JDK |
22477 | 38 |
# automatically, without having to resort to command-line options |
39 |
# |
|
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
40 |
# *) acceptable means e.g. JDK7 for building JDK8, a complete JDK (with |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
41 |
# javac) and not a JRE, etc. |
22477 | 42 |
# |
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
43 |
# **) On Windows we typically use a well-known path. |
22477 | 44 |
# On MacOSX we typically use the tool java_home. |
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
45 |
# On Linux we typically find javac in the $PATH, and then follow a |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
46 |
# chain of symlinks that often ends up in a real JDK. |
22477 | 47 |
# |
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
48 |
# This leads to the code where we check in different ways to locate a |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
49 |
# JDK, and if one is found, check if it is acceptable. If not, we print |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
50 |
# our reasons for rejecting it (useful when debugging non-working |
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
51 |
# configure situations) and continue checking the next one. |
22477 | 52 |
######################################################################## |
53 |
||
13697 | 54 |
# Execute the check given as argument, and verify the result |
55 |
# If the Boot JDK was previously found, do nothing |
|
56 |
# $1 A command line (typically autoconf macro) to execute |
|
57 |
AC_DEFUN([BOOTJDK_DO_CHECK], |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
58 |
[ |
13697 | 59 |
if test "x$BOOT_JDK_FOUND" = xno; then |
60 |
# Now execute the test |
|
61 |
$1 |
|
62 |
||
63 |
# If previous step claimed to have found a JDK, check it to see if it seems to be valid. |
|
64 |
if test "x$BOOT_JDK_FOUND" = xmaybe; then |
|
65 |
# Do we have a bin/java? |
|
66 |
if test ! -x "$BOOT_JDK/bin/java"; then |
|
67 |
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/java; ignoring]) |
|
68 |
BOOT_JDK_FOUND=no |
|
69 |
else |
|
70 |
# Do we have a bin/javac? |
|
71 |
if test ! -x "$BOOT_JDK/bin/javac"; then |
|
72 |
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain bin/javac; ignoring]) |
|
73 |
AC_MSG_NOTICE([(This might be an JRE instead of an JDK)]) |
|
74 |
BOOT_JDK_FOUND=no |
|
20363 | 75 |
else |
27865
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
76 |
# Oh, this is looking good! We probably have found a proper JDK. Is it the correct version? |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
77 |
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1` |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
78 |
|
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
79 |
# Extra M4 quote needed to protect [] in grep expression. |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
80 |
[FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep '\"1\.[89]\.'`] |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
81 |
if test "x$FOUND_CORRECT_VERSION" = x; then |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
82 |
AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring]) |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
83 |
AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)]) |
13697 | 84 |
BOOT_JDK_FOUND=no |
85 |
else |
|
27865
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
86 |
# We're done! :-) |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
87 |
BOOT_JDK_FOUND=yes |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
88 |
BASIC_FIXUP_PATH(BOOT_JDK) |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
89 |
AC_MSG_CHECKING([for Boot JDK]) |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
90 |
AC_MSG_RESULT([$BOOT_JDK]) |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
91 |
AC_MSG_CHECKING([Boot JDK version]) |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
92 |
BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' ' '` |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
93 |
AC_MSG_RESULT([$BOOT_JDK_VERSION]) |
6c830e3b9caf
8066828: configure fails if it's set --with-boot-jdk to use JDK 9 modular image
erikj
parents:
27602
diff
changeset
|
94 |
fi # end check jdk version |
13697 | 95 |
fi # end check javac |
96 |
fi # end check java |
|
97 |
fi # end check boot jdk found |
|
98 |
fi |
|
99 |
]) |
|
100 |
||
101 |
# Test: Is bootjdk explicitely set by command line arguments? |
|
102 |
AC_DEFUN([BOOTJDK_CHECK_ARGUMENTS], |
|
103 |
[ |
|
20363 | 104 |
if test "x$with_boot_jdk" != x; then |
13697 | 105 |
BOOT_JDK=$with_boot_jdk |
106 |
BOOT_JDK_FOUND=maybe |
|
107 |
AC_MSG_NOTICE([Found potential Boot JDK using configure arguments]) |
|
20363 | 108 |
fi |
13697 | 109 |
]) |
110 |
||
111 |
# Test: Is bootjdk available from builddeps? |
|
112 |
AC_DEFUN([BOOTJDK_CHECK_BUILDDEPS], |
|
113 |
[ |
|
20363 | 114 |
BDEPS_CHECK_MODULE(BOOT_JDK, bootjdk, xxx, [BOOT_JDK_FOUND=maybe], [BOOT_JDK_FOUND=no]) |
13697 | 115 |
]) |
116 |
||
117 |
# Test: Is $JAVA_HOME set? |
|
118 |
AC_DEFUN([BOOTJDK_CHECK_JAVA_HOME], |
|
119 |
[ |
|
20363 | 120 |
if test "x$JAVA_HOME" != x; then |
121 |
JAVA_HOME_PROCESSED="$JAVA_HOME" |
|
122 |
BASIC_FIXUP_PATH(JAVA_HOME_PROCESSED) |
|
123 |
if test ! -d "$JAVA_HOME_PROCESSED"; then |
|
124 |
AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!]) |
|
125 |
else |
|
126 |
# Aha, the user has set a JAVA_HOME |
|
127 |
# let us use that as the Boot JDK. |
|
128 |
BOOT_JDK="$JAVA_HOME_PROCESSED" |
|
129 |
BOOT_JDK_FOUND=maybe |
|
130 |
AC_MSG_NOTICE([Found potential Boot JDK using JAVA_HOME]) |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
131 |
fi |
20363 | 132 |
fi |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
133 |
]) |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
134 |
|
13697 | 135 |
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK? |
136 |
AC_DEFUN([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK], |
|
137 |
[ |
|
20363 | 138 |
AC_PATH_PROG(JAVAC_CHECK, javac) |
139 |
AC_PATH_PROG(JAVA_CHECK, java) |
|
140 |
BINARY="$JAVAC_CHECK" |
|
141 |
if test "x$JAVAC_CHECK" = x; then |
|
142 |
BINARY="$JAVA_CHECK" |
|
143 |
fi |
|
144 |
if test "x$BINARY" != x; then |
|
145 |
# So there is a java(c) binary, it might be part of a JDK. |
|
146 |
# Lets find the JDK/JRE directory by following symbolic links. |
|
147 |
# Linux/GNU systems often have links from /usr/bin/java to |
|
148 |
# /etc/alternatives/java to the real JDK binary. |
|
149 |
BASIC_REMOVE_SYMBOLIC_LINKS(BINARY) |
|
150 |
BOOT_JDK=`dirname "$BINARY"` |
|
151 |
BOOT_JDK=`cd "$BOOT_JDK/.."; pwd` |
|
152 |
if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then |
|
153 |
# Looks like we found ourselves an JDK |
|
154 |
BOOT_JDK_FOUND=maybe |
|
155 |
AC_MSG_NOTICE([Found potential Boot JDK using java(c) in PATH]) |
|
13697 | 156 |
fi |
20363 | 157 |
fi |
13697 | 158 |
]) |
159 |
||
160 |
# Test: Is there a /usr/libexec/java_home? (Typically on MacOSX) |
|
22477 | 161 |
# $1: Argument to the java_home binary (optional) |
13697 | 162 |
AC_DEFUN([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME], |
163 |
[ |
|
20363 | 164 |
if test -x /usr/libexec/java_home; then |
22477 | 165 |
BOOT_JDK=`/usr/libexec/java_home $1` |
20363 | 166 |
BOOT_JDK_FOUND=maybe |
22477 | 167 |
AC_MSG_NOTICE([Found potential Boot JDK using /usr/libexec/java_home $1]) |
168 |
fi |
|
169 |
]) |
|
170 |
||
171 |
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home? |
|
172 |
AC_DEFUN([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR], |
|
173 |
[ |
|
174 |
if test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
175 |
# First check at user selected default |
|
176 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME()]) |
|
177 |
# If that did not work out (e.g. too old), try explicit versions instead |
|
178 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.9])]) |
|
179 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.8])]) |
|
180 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_LIBEXEC_JAVA_HOME([-v 1.7])]) |
|
20363 | 181 |
fi |
13697 | 182 |
]) |
183 |
||
184 |
# Look for a jdk in the given path. If there are multiple, try to select the newest. |
|
185 |
# If found, set BOOT_JDK and BOOT_JDK_FOUND. |
|
186 |
# $1 = Path to directory containing jdk installations. |
|
187 |
# $2 = String to append to the found JDK directory to get the proper JDK home |
|
188 |
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY], |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
189 |
[ |
13697 | 190 |
BOOT_JDK_PREFIX="$1" |
191 |
BOOT_JDK_SUFFIX="$2" |
|
14111 | 192 |
ALL_JDKS_FOUND=`$LS "$BOOT_JDK_PREFIX" 2> /dev/null | $SORT -r` |
193 |
if test "x$ALL_JDKS_FOUND" != x; then |
|
194 |
for JDK_TO_TRY in $ALL_JDKS_FOUND ; do |
|
195 |
BOOTJDK_DO_CHECK([ |
|
196 |
BOOT_JDK="${BOOT_JDK_PREFIX}/${JDK_TO_TRY}${BOOT_JDK_SUFFIX}" |
|
197 |
if test -d "$BOOT_JDK"; then |
|
198 |
BOOT_JDK_FOUND=maybe |
|
199 |
AC_MSG_NOTICE([Found potential Boot JDK using well-known locations (in $BOOT_JDK_PREFIX/$JDK_TO_TRY)]) |
|
200 |
fi |
|
201 |
]) |
|
202 |
done |
|
13697 | 203 |
fi |
204 |
]) |
|
205 |
||
206 |
# Call BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY, but use the given |
|
207 |
# environmental variable as base for where to look. |
|
208 |
# $1 Name of an environmal variable, assumed to point to the Program Files directory. |
|
209 |
AC_DEFUN([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY], |
|
210 |
[ |
|
211 |
if test "x[$]$1" != x; then |
|
14111 | 212 |
VIRTUAL_DIR="[$]$1/Java" |
213 |
BASIC_WINDOWS_REWRITE_AS_UNIX_PATH(VIRTUAL_DIR) |
|
214 |
BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY($VIRTUAL_DIR) |
|
13697 | 215 |
fi |
216 |
]) |
|
217 |
||
218 |
# Test: Is there a JDK installed in default, well-known locations? |
|
219 |
AC_DEFUN([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS], |
|
220 |
[ |
|
221 |
if test "x$OPENJDK_TARGET_OS" = xwindows; then |
|
222 |
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramW6432])]) |
|
223 |
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMW6432])]) |
|
224 |
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([PROGRAMFILES])]) |
|
225 |
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_WINDOWS_VIRTUAL_DIRECTORY([ProgramFiles])]) |
|
226 |
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/cygdrive/c/Program Files/Java])]) |
|
227 |
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then |
|
228 |
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/Library/Java/JavaVirtualMachines],[/Contents/Home])]) |
|
229 |
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/System/Library/Java/JavaVirtualMachines],[/Contents/Home])]) |
|
14111 | 230 |
elif test "x$OPENJDK_TARGET_OS" = xlinux; then |
231 |
BOOTJDK_DO_CHECK([BOOTJDK_FIND_BEST_JDK_IN_DIRECTORY([/usr/lib/jvm])]) |
|
13697 | 232 |
fi |
233 |
]) |
|
234 |
||
235 |
# Check that a command-line tool in the Boot JDK is correct |
|
236 |
# $1 = name of variable to assign |
|
237 |
# $2 = name of binary |
|
238 |
AC_DEFUN([BOOTJDK_CHECK_TOOL_IN_BOOTJDK], |
|
239 |
[ |
|
22477 | 240 |
# Use user overridden value if available, otherwise locate tool in the Boot JDK. |
27595
cff167b3bfa2
8065914: Various improvements and cleanup of build system
ihse
parents:
26131
diff
changeset
|
241 |
BASIC_SETUP_TOOL($1, |
22477 | 242 |
[ |
243 |
AC_MSG_CHECKING([for $2 in Boot JDK]) |
|
244 |
$1=$BOOT_JDK/bin/$2 |
|
245 |
if test ! -x [$]$1; then |
|
246 |
AC_MSG_RESULT(not found) |
|
247 |
AC_MSG_NOTICE([Your Boot JDK seems broken. This might be fixed by explicitely setting --with-boot-jdk]) |
|
248 |
AC_MSG_ERROR([Could not find $2 in the Boot JDK]) |
|
249 |
fi |
|
250 |
AC_MSG_RESULT(ok) |
|
251 |
AC_SUBST($1) |
|
252 |
]) |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
253 |
]) |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
254 |
|
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
255 |
############################################################################### |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
256 |
# |
20363 | 257 |
# We need a Boot JDK to bootstrap the build. |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
258 |
# |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
259 |
|
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
260 |
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK], |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
261 |
[ |
20363 | 262 |
BOOT_JDK_FOUND=no |
263 |
AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk], |
|
264 |
[path to Boot JDK (used to bootstrap build) @<:@probed@:>@])]) |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
265 |
|
20363 | 266 |
# We look for the Boot JDK through various means, going from more certain to |
267 |
# more of a guess-work. After each test, BOOT_JDK_FOUND is set to "yes" if |
|
268 |
# we detected something (if so, the path to the jdk is in BOOT_JDK). But we |
|
269 |
# must check if this is indeed valid; otherwise we'll continue looking. |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
270 |
|
20363 | 271 |
# Test: Is bootjdk explicitely set by command line arguments? |
272 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_ARGUMENTS]) |
|
273 |
if test "x$with_boot_jdk" != x && test "x$BOOT_JDK_FOUND" = xno; then |
|
274 |
# Having specified an argument which is incorrect will produce an instant failure; |
|
275 |
# we should not go on looking |
|
276 |
AC_MSG_ERROR([The path given by --with-boot-jdk does not contain a valid Boot JDK]) |
|
277 |
fi |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
278 |
|
20363 | 279 |
# Test: Is bootjdk available from builddeps? |
280 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_BUILDDEPS]) |
|
13697 | 281 |
|
22477 | 282 |
# Test: On MacOS X, can we find a boot jdk using /usr/libexec/java_home? |
283 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_MACOSX_JAVA_LOCATOR]) |
|
284 |
||
20363 | 285 |
# Test: Is $JAVA_HOME set? |
286 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_HOME]) |
|
13697 | 287 |
|
20363 | 288 |
# Test: Is there a java or javac in the PATH, which is a symlink to the JDK? |
289 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_JAVA_IN_PATH_IS_SYMLINK]) |
|
13697 | 290 |
|
20363 | 291 |
# Test: Is there a JDK installed in default, well-known locations? |
292 |
BOOTJDK_DO_CHECK([BOOTJDK_CHECK_WELL_KNOWN_LOCATIONS]) |
|
13697 | 293 |
|
20363 | 294 |
# If we haven't found anything yet, we've truly lost. Give up. |
295 |
if test "x$BOOT_JDK_FOUND" = xno; then |
|
296 |
HELP_MSG_MISSING_DEPENDENCY([openjdk]) |
|
297 |
AC_MSG_NOTICE([Could not find a valid Boot JDK. $HELP_MSG]) |
|
298 |
AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk]) |
|
299 |
AC_MSG_ERROR([Cannot continue]) |
|
300 |
fi |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
301 |
|
20363 | 302 |
AC_SUBST(BOOT_JDK) |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
303 |
|
20363 | 304 |
# Setup tools from the Boot JDK. |
22477 | 305 |
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVA, java) |
306 |
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAC, javac) |
|
307 |
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAVAH, javah) |
|
308 |
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JAR, jar) |
|
309 |
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(NATIVE2ASCII, native2ascii) |
|
310 |
BOOTJDK_CHECK_TOOL_IN_BOOTJDK(JARSIGNER, jarsigner) |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
311 |
|
20363 | 312 |
# Finally, set some other options... |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
313 |
|
24304
f51622799778
8042932: Bump up the -source version for JDK 9 builds
coffeys
parents:
23982
diff
changeset
|
314 |
# When compiling code to be executed by the Boot JDK, force jdk8 compatibility. |
f51622799778
8042932: Bump up the -source version for JDK 9 builds
coffeys
parents:
23982
diff
changeset
|
315 |
BOOT_JDK_SOURCETARGET="-source 8 -target 8" |
20363 | 316 |
AC_SUBST(BOOT_JDK_SOURCETARGET) |
317 |
AC_SUBST(JAVAC_FLAGS) |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
318 |
]) |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
319 |
|
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
320 |
AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS], |
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
321 |
[ |
20363 | 322 |
############################################################################## |
323 |
# |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
324 |
# Specify jvm options for anything that is run with the Boot JDK. |
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
325 |
# Not all JVM:s accept the same arguments on the command line. |
20363 | 326 |
# |
327 |
AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs], |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
328 |
[specify JVM arguments to be passed to all java invocations of boot JDK, overriding the default values, |
20363 | 329 |
e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])]) |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
330 |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
331 |
AC_MSG_CHECKING([flags for boot jdk java command] ) |
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
332 |
|
23171 | 333 |
# Disable special log output when a debug build is used as Boot JDK... |
334 |
ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA]) |
|
335 |
||
336 |
# Apply user provided options. |
|
337 |
ADD_JVM_ARG_IF_OK([$with_boot_jdk_jvmargs],boot_jdk_jvmargs,[$JAVA]) |
|
338 |
||
339 |
AC_MSG_RESULT([$boot_jdk_jvmargs]) |
|
340 |
||
341 |
# For now, general JAVA_FLAGS are the same as the boot jdk jvmargs |
|
342 |
JAVA_FLAGS=$boot_jdk_jvmargs |
|
343 |
AC_SUBST(JAVA_FLAGS) |
|
344 |
||
345 |
||
346 |
AC_MSG_CHECKING([flags for boot jdk java command for big workloads]) |
|
347 |
||
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
348 |
# Starting amount of heap memory. |
23171 | 349 |
ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs_big,[$JAVA]) |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
350 |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
351 |
# Maximum amount of heap memory. |
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
352 |
# Maximum stack size. |
26131 | 353 |
JVM_MAX_HEAP=`expr $MEMORY_SIZE / 2` |
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
354 |
if test "x$BUILD_NUM_BITS" = x32; then |
26131 | 355 |
if test "$JVM_MAX_HEAP" -gt "1100"; then |
356 |
JVM_MAX_HEAP=1100 |
|
357 |
elif test "$JVM_MAX_HEAP" -lt "512"; then |
|
358 |
JVM_MAX_HEAP=512 |
|
359 |
fi |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
360 |
STACK_SIZE=768 |
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
361 |
else |
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
362 |
# Running Javac on a JVM on a 64-bit machine, takes more space since 64-bit |
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
363 |
# pointers are used. Apparently, we need to increase the heap and stack |
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
364 |
# space for the jvm. More specifically, when running javac to build huge |
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
365 |
# jdk batch |
26131 | 366 |
if test "$JVM_MAX_HEAP" -gt "1600"; then |
367 |
JVM_MAX_HEAP=1600 |
|
368 |
elif test "$JVM_MAX_HEAP" -lt "512"; then |
|
369 |
JVM_MAX_HEAP=512 |
|
370 |
fi |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
371 |
STACK_SIZE=1536 |
20363 | 372 |
fi |
26131 | 373 |
ADD_JVM_ARG_IF_OK([-Xmx${JVM_MAX_HEAP}M],boot_jdk_jvmargs_big,[$JAVA]) |
23171 | 374 |
ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs_big,[$JAVA]) |
375 |
||
376 |
AC_MSG_RESULT([$boot_jdk_jvmargs_big]) |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
377 |
|
23171 | 378 |
JAVA_FLAGS_BIG=$boot_jdk_jvmargs_big |
379 |
AC_SUBST(JAVA_FLAGS_BIG) |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
380 |
|
23171 | 381 |
|
382 |
AC_MSG_CHECKING([flags for boot jdk java command for small workloads]) |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
383 |
|
23171 | 384 |
# Use serial gc for small short lived tools if possible |
385 |
ADD_JVM_ARG_IF_OK([-XX:+UseSerialGC],boot_jdk_jvmargs_small,[$JAVA]) |
|
386 |
ADD_JVM_ARG_IF_OK([-Xms32M],boot_jdk_jvmargs_small,[$JAVA]) |
|
387 |
ADD_JVM_ARG_IF_OK([-Xmx512M],boot_jdk_jvmargs_small,[$JAVA]) |
|
22728
0a9d96bf2023
8036079: --with-boot-jdk-jvmargs configure options are ignored
mduigou
parents:
22477
diff
changeset
|
388 |
|
23171 | 389 |
AC_MSG_RESULT([$boot_jdk_jvmargs_small]) |
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
390 |
|
23171 | 391 |
JAVA_FLAGS_SMALL=$boot_jdk_jvmargs_small |
392 |
AC_SUBST(JAVA_FLAGS_SMALL) |
|
25854 | 393 |
|
394 |
JAVA_TOOL_FLAGS_SMALL="" |
|
395 |
for f in $JAVA_FLAGS_SMALL; do |
|
396 |
JAVA_TOOL_FLAGS_SMALL="$JAVA_TOOL_FLAGS_SMALL -J$f" |
|
397 |
done |
|
398 |
AC_SUBST(JAVA_TOOL_FLAGS_SMALL) |
|
13133
701e61c32ece
7182051: Update of latest build-infra Makefiles (missing files)
erikj
parents:
diff
changeset
|
399 |
]) |