Tue, 18 Sep 2012 11:29:16 -0700
7197849: Update new build-infra makefiles
Reviewed-by: ihse, erikj, ohrstrom, tbell
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 #
26 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VARIANT],
27 [
28 ###############################################################################
29 #
30 # Check which variant of the JDK that we want to build.
31 # Currently we have:
32 # normal: standard edition
33 # but the custom make system may add other variants
34 #
35 # Effectively the JDK variant gives a name to a specific set of
36 # modules to compile into the JDK. In the future, these modules
37 # might even be Jigsaw modules.
38 #
39 AC_MSG_CHECKING([which variant of the JDK to build])
40 AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant],
41 [JDK variant to build (normal) @<:@normal@:>@])])
43 if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then
44 JDK_VARIANT="normal"
45 else
46 AC_MSG_ERROR([The available JDK variants are: normal])
47 fi
49 AC_SUBST(JDK_VARIANT)
51 AC_MSG_RESULT([$JDK_VARIANT])
52 ])
54 AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
55 [
57 ###############################################################################
58 #
59 # Check which variants of the JVM that we want to build.
60 # Currently we have:
61 # server: normal interpreter and a tiered C1/C2 compiler
62 # client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms)
63 # kernel: kernel footprint JVM that passes the TCK without major performance problems,
64 # ie normal interpreter and C1, only the serial GC, kernel jvmti etc
65 # zero: no machine code interpreter, no compiler
66 # zeroshark: zero interpreter and shark/llvm compiler backend
67 AC_MSG_CHECKING([which variants of the JVM that should be built])
68 AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
69 [JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])])
71 if test "x$with_jvm_variants" = x; then
72 with_jvm_variants="server"
73 fi
75 JVM_VARIANTS=",$with_jvm_variants,"
76 TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'`
78 if test "x$TEST_VARIANTS" != "x,"; then
79 AC_MSG_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark])
80 fi
81 AC_MSG_RESULT([$with_jvm_variants])
83 JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'`
84 JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'`
85 JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'`
86 JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
87 JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
89 if test "x$JVM_VARIANT_CLIENT" = xtrue; then
90 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
91 AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.])
92 fi
93 fi
94 if test "x$JVM_VARIANT_KERNEL" = xtrue; then
95 if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
96 AC_MSG_ERROR([You cannot build a kernel JVM for a 64-bit machine.])
97 fi
98 fi
100 # Replace the commas with AND for use in the build directory name.
101 ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'`
102 COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/'`
103 if test "x$COUNT_VARIANTS" != "x,1"; then
104 BUILDING_MULTIPLE_JVM_VARIANTS=yes
105 else
106 BUILDING_MULTIPLE_JVM_VARIANTS=no
107 fi
109 AC_SUBST(JVM_VARIANTS)
110 AC_SUBST(JVM_VARIANT_SERVER)
111 AC_SUBST(JVM_VARIANT_CLIENT)
112 AC_SUBST(JVM_VARIANT_KERNEL)
113 AC_SUBST(JVM_VARIANT_ZERO)
114 AC_SUBST(JVM_VARIANT_ZEROSHARK)
116 if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
117 MACOSX_UNIVERSAL="true"
118 fi
120 AC_SUBST(MACOSX_UNIVERSAL)
122 ])
124 AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
125 [
126 ###############################################################################
127 #
128 # Set the debug level
129 # release: no debug information, all optimizations, no asserts.
130 # fastdebug: debug information (-g), all optimizations, all asserts
131 # slowdebug: debug information (-g), no optimizations, all asserts
132 #
133 DEBUG_LEVEL="release"
134 AC_MSG_CHECKING([which debug level to use])
135 AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
136 [set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) @<:@disabled@:>@])],
137 [
138 ENABLE_DEBUG="${enableval}"
139 DEBUG_LEVEL="fastdebug"
140 ], [ENABLE_DEBUG="no"])
142 AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
143 [set the debug level (release, fastdebug, slowdebug) @<:@release@:>@])],
144 [
145 DEBUG_LEVEL="${withval}"
146 if test "x$ENABLE_DEBUG" = xyes; then
147 AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
148 fi
149 ])
150 AC_MSG_RESULT([$DEBUG_LEVEL])
152 if test "x$DEBUG_LEVEL" != xrelease && \
153 test "x$DEBUG_LEVEL" != xfastdebug && \
154 test "x$DEBUG_LEVEL" != xslowdebug; then
155 AC_MSG_ERROR([Allowed debug levels are: release, fastdebug and slowdebug])
156 fi
159 ###############################################################################
160 #
161 # Setup legacy vars/targets and new vars to deal with different debug levels.
162 #
164 case $DEBUG_LEVEL in
165 release )
166 VARIANT="OPT"
167 FASTDEBUG="false"
168 DEBUG_CLASSFILES="false"
169 BUILD_VARIANT_RELEASE=""
170 HOTSPOT_DEBUG_LEVEL="product"
171 HOTSPOT_EXPORT="product"
172 ;;
173 fastdebug )
174 VARIANT="DBG"
175 FASTDEBUG="true"
176 DEBUG_CLASSFILES="true"
177 BUILD_VARIANT_RELEASE="-fastdebug"
178 HOTSPOT_DEBUG_LEVEL="fastdebug"
179 HOTSPOT_EXPORT="fastdebug"
180 ;;
181 slowdebug )
182 VARIANT="DBG"
183 FASTDEBUG="false"
184 DEBUG_CLASSFILES="true"
185 BUILD_VARIANT_RELEASE="-debug"
186 HOTSPOT_DEBUG_LEVEL="jvmg"
187 HOTSPOT_EXPORT="debug"
188 ;;
189 esac
191 #####
192 # Generate the legacy makefile targets for hotspot.
193 # The hotspot api for selecting the build artifacts, really, needs to be improved.
194 #
195 HOTSPOT_TARGET=""
197 if test "x$JVM_VARIANT_SERVER" = xtrue; then
198 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} "
199 fi
201 if test "x$JVM_VARIANT_CLIENT" = xtrue; then
202 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 "
203 fi
205 if test "x$JVM_VARIANT_KERNEL" = xtrue; then
206 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel "
207 fi
209 if test "x$JVM_VARIANT_ZERO" = xtrue; then
210 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero "
211 fi
213 if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
214 HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark "
215 fi
217 HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
219 # On Macosx universal binaries are produced, but they only contain
220 # 64 bit intel. This invalidates control of which jvms are built
221 # from configure, but only server is valid anyway. Fix this
222 # when hotspot makefiles are rewritten.
223 if test "x$MACOSX_UNIVERSAL" = xtrue; then
224 HOTSPOT_TARGET=universal_product
225 fi
227 #####
229 AC_SUBST(DEBUG_LEVEL)
230 AC_SUBST(VARIANT)
231 AC_SUBST(FASTDEBUG)
232 AC_SUBST(DEBUG_CLASSFILES)
233 AC_SUBST(BUILD_VARIANT_RELEASE)
234 ])
236 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
237 [
239 ###############################################################################
240 #
241 # Should we build only OpenJDK even if closed sources are present?
242 #
243 AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
244 [build OpenJDK regardless of the presence of closed repositories @<:@disabled@:>@])],,)
246 if test "x$enable_openjdk_only" = "xyes"; then
247 OPENJDK=true
248 elif test "x$enable_openjdk_only" = "xno"; then
249 OPENJDK=false
250 elif test -d "$SRC_ROOT/jdk/src/closed"; then
251 OPENJDK=false
252 else
253 OPENJDK=true
254 fi
256 if test "x$OPENJDK" = "xtrue"; then
257 SET_OPENJDK=OPENJDK=true
258 fi
260 AC_SUBST(SET_OPENJDK)
262 ###############################################################################
263 #
264 # JIGSAW or not. The JIGSAW variable is used during the intermediate
265 # stage when we are building both the old style JDK and the new style modularized JDK.
266 # When the modularized JDK is finalized, this option will go away.
267 #
268 AC_ARG_ENABLE([jigsaw], [AS_HELP_STRING([--enable-jigsaw],
269 [build Jigsaw images (not yet available) @<:@disabled@:>@])],,)
271 if test "x$enable_jigsaw" = "xyes"; then
272 JIGSAW=true
273 else
274 JIGSAW=false
275 fi
276 AC_SUBST(JIGSAW)
278 ###############################################################################
279 #
280 # Should we build a JDK/JVM with headful support (ie a graphical ui)?
281 # We always build headless support.
282 #
283 AC_MSG_CHECKING([headful support])
284 AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
285 [build headful support (graphical UI support) @<:@enabled@:>@])],
286 [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
288 SUPPORT_HEADLESS=yes
289 BUILD_HEADLESS="BUILD_HEADLESS:=true"
291 if test "x$SUPPORT_HEADFUL" = xyes; then
292 # We are building both headful and headless.
293 headful_msg="inlude support for both headful and headless"
294 fi
296 if test "x$SUPPORT_HEADFUL" = xno; then
297 # Thus we are building headless only.
298 BUILD_HEADLESS="BUILD_HEADLESS:=true"
299 headful_msg="headless only"
300 fi
302 AC_MSG_RESULT([$headful_msg])
304 AC_SUBST(SUPPORT_HEADLESS)
305 AC_SUBST(SUPPORT_HEADFUL)
306 AC_SUBST(BUILD_HEADLESS)
308 ###############################################################################
309 #
310 # Should we compile nimbus swing L&F? We can probably remove this option
311 # since nimbus is officially part of javax now.
312 #
313 AC_MSG_CHECKING([whether to build nimbus L&F])
314 AC_ARG_ENABLE([nimbus], [AS_HELP_STRING([--disable-nimbus],
315 [disable Nimbus L&F @<:@enabled@:>@])],
316 [ENABLE_NIMBUS="${enableval}"], [ENABLE_NIMBUS='yes'])
317 AC_MSG_RESULT([$ENABLE_NIMBUS])
318 DISABLE_NIMBUS=
319 if test "x$ENABLE_NIMBUS" = xno; then
320 DISABLE_NIMBUS=true
321 fi
322 AC_SUBST(DISABLE_NIMBUS)
324 # Control wether Hotspot runs Queens test after build.
325 AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build],
326 [enable running of Queens test after Hotspot build (not yet available) @<:@disabled@:>@])],,
327 [enable_hotspot_test_in_build=no])
328 if test "x$enable_hotspot_test_in_build" = "xyes"; then
329 TEST_IN_BUILD=true
330 else
331 TEST_IN_BUILD=false
332 fi
333 AC_SUBST(TEST_IN_BUILD)
335 ###############################################################################
336 #
337 # Choose cacerts source file
338 #
339 AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
340 [specify alternative cacerts file])])
341 if test "x$with_cacerts_file" != x; then
342 CACERTS_FILE=$with_cacerts_file
343 else
344 if test "x$OPENJDK" = "xtrue"; then
345 CACERTS_FILE=${SRC_ROOT}/jdk/src/share/lib/security/cacerts
346 else
347 CACERTS_FILE=${SRC_ROOT}/jdk/src/closed/share/lib/security/cacerts.internal
348 fi
349 fi
350 AC_SUBST(CACERTS_FILE)
352 ###############################################################################
353 #
354 # Compress jars
355 #
356 COMPRESS_JARS=false
358 AC_SUBST(COMPRESS_JARS)
360 ###############################################################################
361 #
362 # Should we compile JFR
363 # default no, except for on closed-jdk
364 #
365 ENABLE_JFR=no
367 # Is the JFR source present
369 #
370 # For closed default is yes
371 #
372 if test "x${OPENJDK}" != "xtrue"; then
373 ENABLE_JFR=yes
374 fi
376 AC_MSG_CHECKING([whether to build jfr])
377 AC_ARG_ENABLE([jfr], [AS_HELP_STRING([--enable-jfr],
378 [enable jfr (default is no)])]
379 [ENABLE_JFR="${enableval}"])
380 AC_MSG_RESULT([${ENABLE_JFR}])
382 if test "x$ENABLE_JFR" = "xyes"; then
383 ENABLE_JFR=true
384 elif test "x$ENABLE_JFR" = "xno"; then
385 ENABLE_JFR=false
386 else
387 AC_MSG_ERROR([Invalid argument to --enable-jfr])
388 fi
390 AC_SUBST(ENABLE_JFR)
391 ])
393 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS],
394 [
395 # Source the version numbers
396 . $AUTOCONF_DIR/version.numbers
397 if test "x$OPENJDK" = "xfalse"; then
398 . $AUTOCONF_DIR/closed.version.numbers
399 fi
400 # Now set the JDK version, milestone, build number etc.
401 AC_SUBST(JDK_MAJOR_VERSION)
402 AC_SUBST(JDK_MINOR_VERSION)
403 AC_SUBST(JDK_MICRO_VERSION)
404 AC_SUBST(JDK_UPDATE_VERSION)
405 AC_SUBST(JDK_BUILD_NUMBER)
406 AC_SUBST(MILESTONE)
407 AC_SUBST(LAUNCHER_NAME)
408 AC_SUBST(PRODUCT_NAME)
409 AC_SUBST(PRODUCT_SUFFIX)
410 AC_SUBST(JDK_RC_PLATFORM_NAME)
411 AC_SUBST(COMPANY_NAME)
413 COPYRIGHT_YEAR=`date +'%Y'`
414 AC_SUBST(COPYRIGHT_YEAR)
416 RUNTIME_NAME="$PRODUCT_NAME $PRODUCT_SUFFIX"
417 AC_SUBST(RUNTIME_NAME)
419 if test "x$JDK_UPDATE_VERSION" != x; then
420 JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}"
421 else
422 JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}"
423 fi
424 AC_SUBST(JDK_VERSION)
426 if test "x$MILESTONE" != x; then
427 RELEASE="${JDK_VERSION}-${MILESTONE}${BUILD_VARIANT_RELEASE}"
428 else
429 RELEASE="${JDK_VERSION}${BUILD_VARIANT_RELEASE}"
430 fi
431 AC_SUBST(RELEASE)
433 if test "x$JDK_BUILD_NUMBER" != x; then
434 FULL_VERSION="${RELEASE}-${JDK_BUILD_NUMBER}"
435 else
436 JDK_BUILD_NUMBER=b00
437 BUILD_DATE=`date '+%Y_%m_%d_%H_%M'`
438 # Avoid [:alnum:] since it depends on the locale.
439 CLEAN_USERNAME=`echo "$USER" | $TR -d -c 'abcdefghijklmnopqrstuvqxyz0123456789'`
440 USER_RELEASE_SUFFIX=`echo "${CLEAN_USERNAME}_${BUILD_DATE}" | $TR 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvqxyz'`
441 FULL_VERSION="${RELEASE}-${USER_RELEASE_SUFFIX}-${JDK_BUILD_NUMBER}"
442 fi
443 AC_SUBST(FULL_VERSION)
444 COOKED_BUILD_NUMBER=`$ECHO $JDK_BUILD_NUMBER | $SED -e 's/^b//' -e 's/^0//'`
445 AC_SUBST(COOKED_BUILD_NUMBER)
446 ])
448 AC_DEFUN_ONCE([JDKOPT_SETUP_BUILD_TWEAKS],
449 [
450 HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
451 AC_SUBST(HOTSPOT_MAKE_ARGS)
453 # The name of the Service Agent jar.
454 SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
455 if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
456 SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
457 fi
458 AC_SUBST(SALIB_NAME)
460 ])
462 AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
463 [
464 #
465 # ENABLE_DEBUG_SYMBOLS
466 # This must be done after the toolchain is setup, since we're looking at objcopy.
467 #
468 ENABLE_DEBUG_SYMBOLS=default
470 # default on macosx is no...
471 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
472 ENABLE_DEBUG_SYMBOLS=no
473 fi
475 AC_ARG_ENABLE([debug-symbols],
476 [AS_HELP_STRING([--disable-debug-symbols],[disable generation of debug symbols (@<:@enabled@:>@)])],
477 [ENABLE_DEBUG_SYMBOLS=${enable_debug_symbols}],
478 )
480 AC_MSG_CHECKING([if we should generate debug symbols])
482 if test "x$ENABLE_DEBUG_SYMBOLS" = "xyes" && test "x$OBJCOPY" = x; then
483 # explicit enabling of enable-debug-symbols and can't find objcopy
484 # this is an error
485 AC_MSG_ERROR([Unable to find objcopy, cannot enable debug-symbols])
486 fi
488 if test "x$ENABLE_DEBUG_SYMBOLS" = "xdefault"; then
489 # Default is on if objcopy is found, otherwise off
490 if test "x$OBJCOPY" != x; then
491 ENABLE_DEBUG_SYMBOLS=yes
492 else
493 ENABLE_DEBUG_SYMBOLS=no
494 fi
495 fi
497 AC_MSG_RESULT([$ENABLE_DEBUG_SYMBOLS])
499 #
500 # ZIP_DEBUGINFO_FILES
501 #
502 ZIP_DEBUGINFO_FILES=yes
504 AC_ARG_ENABLE([zip-debug-info],
505 [AS_HELP_STRING([--disable-zip-debug-info],[don't zip debug-info files (@<:@enabled@:@)])],
506 [ZIP_DEBUGINFO_FILES=${enable_zip_debug_info}],
507 )
509 AC_MSG_CHECKING([if we should zip debug-info files])
510 AC_MSG_RESULT([$ZIP_DEBUGINFO_FILES])
512 # Hotspot wants ZIP_DEBUGINFO_FILES to be 1 for yes
513 # use that...
514 if test "x$ZIP_DEBUGINFO_FILES" = "xyes"; then
515 ZIP_DEBUGINFO_FILES=1
516 else
517 ZIP_DEBUGINFO_FILES=0
518 fi
520 AC_SUBST(ENABLE_DEBUG_SYMBOLS)
521 AC_SUBST(ZIP_DEBUGINFO_FILES)
522 AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
523 AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
524 ])
526 # Support for customization of the build process. Some build files
527 # will include counterparts from this location, if they exist. This allows
528 # for a degree of customization of the build targets and the rules/recipes
529 # to create them
530 AC_ARG_WITH([custom-make-dir], [AS_HELP_STRING([--with-custom-make-dir],
531 [directory containing custom build/make files])], [CUSTOM_MAKE_DIR=$with_custom_make_dir])
532 AC_SUBST(CUSTOM_MAKE_DIR)