|
1 # |
|
2 # Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. |
|
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 # |
|
5 # This code is free software; you can redistribute it and/or modify it |
|
6 # under the terms of the GNU General Public License version 2 only, as |
|
7 # published by the Free Software Foundation. Oracle designates this |
|
8 # particular file as subject to the "Classpath" exception as provided |
|
9 # by Oracle in the LICENSE file that accompanied this code. |
|
10 # |
|
11 # This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 # version 2 for more details (a copy is included in the LICENSE file that |
|
15 # accompanied this code). |
|
16 # |
|
17 # You should have received a copy of the GNU General Public License version |
|
18 # 2 along with this work; if not, write to the Free Software Foundation, |
|
19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 # |
|
21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 # or visit www.oracle.com if you need additional information or have any |
|
23 # questions. |
|
24 # |
|
25 |
|
26 # Fixes paths on windows to be mixed mode short. |
|
27 AC_DEFUN([BOOTJDK_WIN_FIX_PATH], |
|
28 [ |
|
29 if test "x$OPENJDK_BUILD_OS" = "xwindows"; then |
|
30 AC_PATH_PROG(CYGPATH, cygpath) |
|
31 tmp="[$]$1" |
|
32 # Convert to C:/ mixed style path without spaces. |
|
33 tmp=`$CYGPATH -s -m "$tmp"` |
|
34 $1="$tmp" |
|
35 fi |
|
36 ]) |
|
37 |
|
38 AC_DEFUN([BOOTJDK_MISSING_ERROR], |
|
39 [ |
|
40 AC_MSG_NOTICE([This might be fixed by explicitely setting --with-boot-jdk]) |
|
41 AC_MSG_ERROR([Cannot continue]) |
|
42 ]) |
|
43 |
|
44 ############################################################################### |
|
45 # |
|
46 # We need a Boot JDK to bootstrap the build. |
|
47 # |
|
48 |
|
49 AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK], |
|
50 [ |
|
51 BOOT_JDK_FOUND=no |
|
52 AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk], |
|
53 [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])]) |
|
54 |
|
55 if test "x$with_boot_jdk" != x; then |
|
56 BOOT_JDK=$with_boot_jdk |
|
57 BOOT_JDK_FOUND=yes |
|
58 fi |
|
59 if test "x$BOOT_JDK_FOUND" = xno; then |
|
60 BDEPS_CHECK_MODULE(BOOT_JDK, boot-jdk, xxx, [BOOT_JDK_FOUND=yes], [BOOT_JDK_FOUND=no]) |
|
61 fi |
|
62 |
|
63 if test "x$BOOT_JDK_FOUND" = xno; then |
|
64 if test "x$JAVA_HOME" != x; then |
|
65 if test ! -d "$JAVA_HOME"; then |
|
66 AC_MSG_NOTICE([Your JAVA_HOME points to a non-existing directory!]) |
|
67 BOOTJDK_MISSING_ERROR |
|
68 fi |
|
69 # Aha, the user has set a JAVA_HOME |
|
70 # let us use that as the Boot JDK. |
|
71 BOOT_JDK="$JAVA_HOME" |
|
72 BOOT_JDK_FOUND=yes |
|
73 # To be on the safe side, lets check that it is a JDK. |
|
74 if test -x "$BOOT_JDK/bin/javac" && test -x "$BOOT_JDK/bin/java"; then |
|
75 JAVAC="$BOOT_JDK/bin/javac" |
|
76 JAVA="$BOOT_JDK/bin/java" |
|
77 BOOT_JDK_FOUND=yes |
|
78 else |
|
79 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]) |
|
80 BOOTJDK_MISSING_ERROR |
|
81 fi |
|
82 fi |
|
83 fi |
|
84 |
|
85 if test "x$BOOT_JDK_FOUND" = xno; then |
|
86 AC_PATH_PROG(JAVAC_CHECK, javac) |
|
87 AC_PATH_PROG(JAVA_CHECK, java) |
|
88 BINARY="$JAVAC_CHECK" |
|
89 if test "x$JAVAC_CHECK" = x; then |
|
90 BINARY="$JAVA_CHECK" |
|
91 fi |
|
92 if test "x$BINARY" != x; then |
|
93 # So there is a java(c) binary, it might be part of a JDK. |
|
94 # Lets find the JDK/JRE directory by following symbolic links. |
|
95 # Linux/GNU systems often have links from /usr/bin/java to |
|
96 # /etc/alternatives/java to the real JDK binary. |
|
97 WHICHCMD_SPACESAFE(BINARY,[path to javac]) |
|
98 REMOVE_SYMBOLIC_LINKS(BINARY) |
|
99 BOOT_JDK=`dirname $BINARY` |
|
100 BOOT_JDK=`cd $BOOT_JDK/..; pwd` |
|
101 if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then |
|
102 JAVAC=$BOOT_JDK/bin/javac |
|
103 JAVA=$BOOT_JDK/bin/java |
|
104 BOOT_JDK_FOUND=yes |
|
105 fi |
|
106 fi |
|
107 fi |
|
108 |
|
109 if test "x$BOOT_JDK_FOUND" = xno; then |
|
110 # Try the MacOSX way. |
|
111 if test -x /usr/libexec/java_home; then |
|
112 BOOT_JDK=`/usr/libexec/java_home` |
|
113 if test -x $BOOT_JDK/bin/javac && test -x $BOOT_JDK/bin/java; then |
|
114 JAVAC=$BOOT_JDK/bin/javac |
|
115 JAVA=$BOOT_JDK/bin/java |
|
116 BOOT_JDK_FOUND=yes |
|
117 fi |
|
118 fi |
|
119 fi |
|
120 |
|
121 if test "x$BOOT_JDK_FOUND" = xno; then |
|
122 AC_PATH_PROG(JAVA_CHECK, java) |
|
123 if test "x$JAVA_CHECK" != x; then |
|
124 # There is a java in the path. But apparently we have not found a javac |
|
125 # in the path, since that would have been tested earlier. |
|
126 if test "x$OPENJDK_TARGET_OS" = xwindows; then |
|
127 # Now if this is a windows platform. The default installation of a JDK |
|
128 # actually puts the JRE in the path and keeps the JDK out of the path! |
|
129 # Go look in the default installation location. |
|
130 BOOT_JDK=/cygdrive/c/Program\ Files/Java/`ls /cygdrive/c/Program\ Files/Java | grep jdk | sort -r | head --lines 1` |
|
131 if test -d "$BOOT_JDK"; then |
|
132 BOOT_JDK_FOUND=yes |
|
133 fi |
|
134 fi |
|
135 if test "x$BOOT_JDK_FOUND" = xno; then |
|
136 HELP_MSG_MISSING_DEPENDENCY([openjdk]) |
|
137 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]) |
|
138 BOOTJDK_MISSING_ERROR |
|
139 fi |
|
140 else |
|
141 HELP_MSG_MISSING_DEPENDENCY([openjdk]) |
|
142 AC_MSG_NOTICE([Could not find a JDK. $HELP_MSG]) |
|
143 BOOTJDK_MISSING_ERROR |
|
144 fi |
|
145 fi |
|
146 |
|
147 BOOTJDK_WIN_FIX_PATH(BOOT_JDK) |
|
148 |
|
149 # Now see if we can find the rt.jar, or its nearest equivalent. |
|
150 BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar" |
|
151 SPACESAFE(BOOT_RTJAR,[the path to the Boot JDK rt.jar (or nearest equivalent)]) |
|
152 |
|
153 BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar" |
|
154 SPACESAFE(BOOT_TOOLSJAR,[the path to the Boot JDK tools.jar (or nearest equivalent)]) |
|
155 |
|
156 if test ! -f $BOOT_RTJAR; then |
|
157 # On MacOSX it is called classes.jar |
|
158 BOOT_RTJAR=$BOOT_JDK/../Classes/classes.jar |
|
159 if test ! -f $BOOT_RTJAR; then |
|
160 AC_MSG_NOTICE([Cannot find the rt.jar or its equivalent!]) |
|
161 AC_MSG_NOTICE([This typically means that configure failed to automatically find a suitable Boot JDK]) |
|
162 BOOTJDK_MISSING_ERROR |
|
163 fi |
|
164 # Remove the .. |
|
165 BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}" |
|
166 # The tools.jar is part of classes.jar |
|
167 BOOT_TOOLSJAR="$BOOT_RTJAR" |
|
168 fi |
|
169 |
|
170 AC_SUBST(BOOT_JDK) |
|
171 AC_SUBST(BOOT_RTJAR) |
|
172 AC_SUBST(BOOT_TOOLSJAR) |
|
173 AC_MSG_CHECKING([for Boot JDK]) |
|
174 AC_MSG_RESULT([$BOOT_JDK]) |
|
175 AC_MSG_CHECKING([for Boot rt.jar]) |
|
176 AC_MSG_RESULT([$BOOT_RTJAR]) |
|
177 AC_MSG_CHECKING([for Boot tools.jar]) |
|
178 AC_MSG_RESULT([$BOOT_TOOLSJAR]) |
|
179 |
|
180 # Use the java tool from the Boot JDK. |
|
181 AC_MSG_CHECKING([for java in Boot JDK]) |
|
182 JAVA=$BOOT_JDK/bin/java |
|
183 if test ! -x $JAVA; then |
|
184 AC_MSG_NOTICE([Could not find a working java]) |
|
185 BOOTJDK_MISSING_ERROR |
|
186 fi |
|
187 BOOT_JDK_VERSION=`$JAVA -version 2>&1 | head -n 1` |
|
188 AC_MSG_RESULT([yes $BOOT_JDK_VERSION]) |
|
189 AC_SUBST(JAVA) |
|
190 |
|
191 # Extra M4 quote needed to protect [] in grep expression. |
|
192 [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep '\"1\.[78]\.'`] |
|
193 if test "x$FOUND_VERSION_78" = x; then |
|
194 HELP_MSG_MISSING_DEPENDENCY([openjdk]) |
|
195 AC_MSG_NOTICE([Your boot-jdk must be version 7 or 8. $HELP_MSG]) |
|
196 BOOTJDK_MISSING_ERROR |
|
197 fi |
|
198 |
|
199 # When compiling code to be executed by the Boot JDK, force jdk7 compatibility. |
|
200 BOOT_JDK_SOURCETARGET="-source 7 -target 7" |
|
201 AC_SUBST(BOOT_JDK_SOURCETARGET) |
|
202 |
|
203 # Use the javac tool from the Boot JDK. |
|
204 AC_MSG_CHECKING([for javac in Boot JDK]) |
|
205 JAVAC=$BOOT_JDK/bin/javac |
|
206 if test ! -x $JAVAC; then |
|
207 AC_MSG_ERROR([Could not find a working javac]) |
|
208 fi |
|
209 AC_MSG_RESULT(yes) |
|
210 AC_SUBST(JAVAC) |
|
211 AC_SUBST(JAVAC_FLAGS) |
|
212 |
|
213 # Use the javah tool from the Boot JDK. |
|
214 AC_MSG_CHECKING([for javah in Boot JDK]) |
|
215 JAVAH=$BOOT_JDK/bin/javah |
|
216 if test ! -x $JAVAH; then |
|
217 AC_MSG_NOTICE([Could not find a working javah]) |
|
218 BOOTJDK_MISSING_ERROR |
|
219 fi |
|
220 AC_MSG_RESULT(yes) |
|
221 AC_SUBST(JAVAH) |
|
222 |
|
223 # Use the jar tool from the Boot JDK. |
|
224 AC_MSG_CHECKING([for jar in Boot JDK]) |
|
225 JAR=$BOOT_JDK/bin/jar |
|
226 if test ! -x $JAR; then |
|
227 AC_MSG_NOTICE([Could not find a working jar]) |
|
228 BOOTJDK_MISSING_ERROR |
|
229 fi |
|
230 AC_SUBST(JAR) |
|
231 AC_MSG_RESULT(yes) |
|
232 |
|
233 # Use the rmic tool from the Boot JDK. |
|
234 AC_MSG_CHECKING([for rmic in Boot JDK]) |
|
235 RMIC=$BOOT_JDK/bin/rmic |
|
236 if test ! -x $RMIC; then |
|
237 AC_MSG_NOTICE([Could not find a working rmic]) |
|
238 BOOTJDK_MISSING_ERROR |
|
239 fi |
|
240 AC_SUBST(RMIC) |
|
241 AC_MSG_RESULT(yes) |
|
242 |
|
243 # Use the native2ascii tool from the Boot JDK. |
|
244 AC_MSG_CHECKING([for native2ascii in Boot JDK]) |
|
245 NATIVE2ASCII=$BOOT_JDK/bin/native2ascii |
|
246 if test ! -x $NATIVE2ASCII; then |
|
247 AC_MSG_NOTICE([Could not find a working native2ascii]) |
|
248 BOOTJDK_MISSING_ERROR |
|
249 fi |
|
250 AC_MSG_RESULT(yes) |
|
251 AC_SUBST(NATIVE2ASCII) |
|
252 ]) |
|
253 |
|
254 AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS], |
|
255 [ |
|
256 ############################################################################## |
|
257 # |
|
258 # Specify options for anything that is run with the Boot JDK. |
|
259 # |
|
260 AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs], |
|
261 [specify JVM arguments to be passed to all invocations of the Boot JDK, overriding the default values, |
|
262 e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])]) |
|
263 |
|
264 if test "x$with_boot_jdk_jvmargs" = x; then |
|
265 # Not all JVM:s accept the same arguments on the command line. |
|
266 # OpenJDK specific increase in thread stack for JDK build, |
|
267 # well more specifically, when running javac. |
|
268 if test "x$BUILD_NUM_BITS" = x32; then |
|
269 STACK_SIZE=768 |
|
270 else |
|
271 # Running Javac on a JVM on a 64-bit machine, the stack takes more space |
|
272 # since 64-bit pointers are pushed on the stach. Apparently, we need |
|
273 # to increase the stack space when javacing the JDK.... |
|
274 STACK_SIZE=1536 |
|
275 fi |
|
276 |
|
277 # Minimum amount of heap memory. |
|
278 ADD_JVM_ARG_IF_OK([-Xms64M],boot_jdk_jvmargs,[$JAVA]) |
|
279 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then |
|
280 # Why does macosx need more heap? Its the huge JDK batch. |
|
281 ADD_JVM_ARG_IF_OK([-Xmx1600M],boot_jdk_jvmargs,[$JAVA]) |
|
282 else |
|
283 ADD_JVM_ARG_IF_OK([-Xmx1100M],boot_jdk_jvmargs,[$JAVA]) |
|
284 fi |
|
285 # When is adding -client something that speeds up the JVM? |
|
286 # ADD_JVM_ARG_IF_OK([-client],boot_jdk_jvmargs,[$JAVA]) |
|
287 ADD_JVM_ARG_IF_OK([-XX:PermSize=32m],boot_jdk_jvmargs,[$JAVA]) |
|
288 ADD_JVM_ARG_IF_OK([-XX:MaxPermSize=160m],boot_jdk_jvmargs,[$JAVA]) |
|
289 ADD_JVM_ARG_IF_OK([-XX:ThreadStackSize=$STACK_SIZE],boot_jdk_jvmargs,[$JAVA]) |
|
290 # Disable special log output when a debug build is used as Boot JDK... |
|
291 ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA]) |
|
292 fi |
|
293 |
|
294 AC_SUBST(BOOT_JDK_JVMARGS, $boot_jdk_jvmargs) |
|
295 ]) |