jdk-options.m4 revision 476:2ba6f4da4bf3
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
26AC_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#
39AC_MSG_CHECKING([which variant of the JDK to build])
40AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant],
41	[JDK variant to build (normal) @<:@normal@:>@])])
42
43if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then
44    JDK_VARIANT="normal"
45else
46    AC_MSG_ERROR([The available JDK variants are: normal])
47fi
48
49AC_SUBST(JDK_VARIANT)
50
51AC_MSG_RESULT([$JDK_VARIANT])
52])
53
54AC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
55[
56
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
67AC_MSG_CHECKING([which variants of the JVM that should be built])
68AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
69	[JVM variants (separated by commas) to build (server, client, kernel, zero, zeroshark) @<:@server@:>@])])
70
71if test "x$with_jvm_variants" = x; then
72     with_jvm_variants="server"
73fi
74
75JVM_VARIANTS=",$with_jvm_variants,"
76TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//'`
77
78if test "x$TEST_VARIANTS" != "x,"; then
79   AC_MSG_ERROR([The available JVM variants are: server, client, kernel, zero, zeroshark])
80fi   
81AC_MSG_RESULT([$with_jvm_variants])
82
83JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'`
84JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'` 
85JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'`
86JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
87JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
88
89if 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
93fi
94if 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
98fi
99
100# Replace the commas with AND for use in the build directory name.
101ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/'`
102COUNT_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/'`
103if test "x$COUNT_VARIANTS" != "x,1"; then
104    BUILDING_MULTIPLE_JVM_VARIANTS=yes
105else
106    BUILDING_MULTIPLE_JVM_VARIANTS=no
107fi
108
109AC_SUBST(JVM_VARIANTS)
110AC_SUBST(JVM_VARIANT_SERVER)
111AC_SUBST(JVM_VARIANT_CLIENT)
112AC_SUBST(JVM_VARIANT_KERNEL)
113AC_SUBST(JVM_VARIANT_ZERO)
114AC_SUBST(JVM_VARIANT_ZEROSHARK)
115
116if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
117   MACOSX_UNIVERSAL="true"
118fi
119
120AC_SUBST(MACOSX_UNIVERSAL)
121
122])
123
124AC_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#
133DEBUG_LEVEL="release"              
134AC_MSG_CHECKING([which debug level to use])
135AC_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"])
141
142AC_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    ])
150AC_MSG_RESULT([$DEBUG_LEVEL])
151
152if 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])
156fi
157
158
159###############################################################################
160#
161# Setup legacy vars/targets and new vars to deal with different debug levels.
162#
163
164case $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           ;;
189esac
190
191#####
192# Generate the legacy makefile targets for hotspot.
193# The hotspot api for selecting the build artifacts, really, needs to be improved.
194#
195HOTSPOT_TARGET=""
196
197if test "x$JVM_VARIANT_SERVER" = xtrue; then
198    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} "
199fi
200
201if test "x$JVM_VARIANT_CLIENT" = xtrue; then
202    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 "
203fi
204
205if test "x$JVM_VARIANT_KERNEL" = xtrue; then
206    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel "
207fi
208
209if test "x$JVM_VARIANT_ZERO" = xtrue; then
210    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero "
211fi
212
213if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
214    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark "
215fi
216
217HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
218
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.
223if test "x$MACOSX_UNIVERSAL" = xtrue; then
224    HOTSPOT_TARGET=universal_product
225fi
226
227#####
228
229AC_SUBST(DEBUG_LEVEL)
230AC_SUBST(VARIANT)
231AC_SUBST(FASTDEBUG)
232AC_SUBST(DEBUG_CLASSFILES)
233AC_SUBST(BUILD_VARIANT_RELEASE)
234])
235
236AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
237[
238
239###############################################################################
240#
241# Should we build only OpenJDK even if closed sources are present?
242#
243AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
244    [build OpenJDK regardless of the presence of closed repositories @<:@disabled@:>@])],,)
245
246if test "x$enable_openjdk_only" = "xyes"; then
247    OPENJDK=true
248elif test "x$enable_openjdk_only" = "xno"; then
249    OPENJDK=false
250elif test -d "$SRC_ROOT/jdk/src/closed"; then
251    OPENJDK=false
252else
253    OPENJDK=true
254fi
255
256if test "x$OPENJDK" = "xtrue"; then
257    SET_OPENJDK=OPENJDK=true
258fi
259
260AC_SUBST(SET_OPENJDK)
261
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#
268AC_ARG_ENABLE([jigsaw], [AS_HELP_STRING([--enable-jigsaw],
269    [build Jigsaw images (not yet available) @<:@disabled@:>@])],,)
270
271if test "x$enable_jigsaw" = "xyes"; then
272    JIGSAW=true
273else
274    JIGSAW=false
275fi
276AC_SUBST(JIGSAW)
277
278###############################################################################
279#
280# Should we build a JDK/JVM with headful support (ie a graphical ui)?
281# We always build headless support.
282#
283AC_MSG_CHECKING([headful support])
284AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
285	[build headful support (graphical UI support) @<:@enabled@:>@])],
286    [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
287
288SUPPORT_HEADLESS=yes
289BUILD_HEADLESS="BUILD_HEADLESS:=true"
290
291if test "x$SUPPORT_HEADFUL" = xyes; then
292    # We are building both headful and headless.
293    headful_msg="inlude support for both headful and headless"
294fi
295
296if test "x$SUPPORT_HEADFUL" = xno; then
297    # Thus we are building headless only.
298    BUILD_HEADLESS="BUILD_HEADLESS:=true"
299    headful_msg="headless only"
300fi
301
302AC_MSG_RESULT([$headful_msg])
303
304AC_SUBST(SUPPORT_HEADLESS)
305AC_SUBST(SUPPORT_HEADFUL)
306AC_SUBST(BUILD_HEADLESS)
307
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#
313AC_MSG_CHECKING([whether to build nimbus L&F])
314AC_ARG_ENABLE([nimbus], [AS_HELP_STRING([--disable-nimbus],
315	[disable Nimbus L&F @<:@enabled@:>@])],
316	[ENABLE_NIMBUS="${enableval}"], [ENABLE_NIMBUS='yes'])
317AC_MSG_RESULT([$ENABLE_NIMBUS])
318DISABLE_NIMBUS=
319if test "x$ENABLE_NIMBUS" = xno; then
320    DISABLE_NIMBUS=true
321fi
322AC_SUBST(DISABLE_NIMBUS)
323
324# Control wether Hotspot runs Queens test after build.
325AC_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])
328if test "x$enable_hotspot_test_in_build" = "xyes"; then
329    TEST_IN_BUILD=true
330else
331    TEST_IN_BUILD=false
332fi
333AC_SUBST(TEST_IN_BUILD)
334
335###############################################################################
336#
337# Choose cacerts source file
338#
339AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
340    [specify alternative cacerts file])])
341if test "x$with_cacerts_file" != x; then
342    CACERTS_FILE=$with_cacerts_file
343else
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
349fi
350AC_SUBST(CACERTS_FILE)
351
352###############################################################################
353#
354# Compress jars
355#
356COMPRESS_JARS=false
357
358AC_SUBST(COMPRESS_JARS)
359
360###############################################################################
361#
362# Should we compile JFR
363#   default no, except for on closed-jdk
364#
365ENABLE_JFR=no
366
367# Is the JFR source present
368
369#
370# For closed default is yes
371#
372if test "x${OPENJDK}" != "xtrue"; then
373   ENABLE_JFR=yes
374fi
375
376AC_MSG_CHECKING([whether to build jfr])
377AC_ARG_ENABLE([jfr], [AS_HELP_STRING([--enable-jfr],
378	[enable jfr (default is no)])]
379	[ENABLE_JFR="${enableval}"])
380AC_MSG_RESULT([${ENABLE_JFR}])
381
382if test "x$ENABLE_JFR" = "xyes"; then
383    ENABLE_JFR=true
384elif test "x$ENABLE_JFR" = "xno"; then
385    ENABLE_JFR=false
386else
387   AC_MSG_ERROR([Invalid argument to --enable-jfr])
388fi
389
390AC_SUBST(ENABLE_JFR)
391])
392
393AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VERSION_NUMBERS],
394[
395# Source the version numbers
396. $AUTOCONF_DIR/version.numbers
397if test "x$OPENJDK" = "xfalse"; then
398    . $AUTOCONF_DIR/closed.version.numbers
399fi
400# Now set the JDK version, milestone, build number etc.
401AC_SUBST(JDK_MAJOR_VERSION)
402AC_SUBST(JDK_MINOR_VERSION)
403AC_SUBST(JDK_MICRO_VERSION)
404AC_SUBST(JDK_UPDATE_VERSION)
405AC_SUBST(JDK_BUILD_NUMBER)
406AC_SUBST(MILESTONE)
407AC_SUBST(LAUNCHER_NAME)
408AC_SUBST(PRODUCT_NAME)
409AC_SUBST(PRODUCT_SUFFIX)
410AC_SUBST(JDK_RC_PLATFORM_NAME)
411AC_SUBST(COMPANY_NAME)
412
413COPYRIGHT_YEAR=`date +'%Y'`
414AC_SUBST(COPYRIGHT_YEAR)
415
416RUNTIME_NAME="$PRODUCT_NAME $PRODUCT_SUFFIX"
417AC_SUBST(RUNTIME_NAME)
418
419if test "x$JDK_UPDATE_VERSION" != x; then
420    JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}_${JDK_UPDATE_VERSION}"
421else
422    JDK_VERSION="${JDK_MAJOR_VERSION}.${JDK_MINOR_VERSION}.${JDK_MICRO_VERSION}"
423fi
424AC_SUBST(JDK_VERSION)
425
426if test "x$MILESTONE" != x; then
427    RELEASE="${JDK_VERSION}-${MILESTONE}${BUILD_VARIANT_RELEASE}"
428else
429    RELEASE="${JDK_VERSION}${BUILD_VARIANT_RELEASE}"
430fi
431AC_SUBST(RELEASE)
432
433if test "x$JDK_BUILD_NUMBER" != x; then
434    FULL_VERSION="${RELEASE}-${JDK_BUILD_NUMBER}"
435else
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}"
442fi
443AC_SUBST(FULL_VERSION)
444COOKED_BUILD_NUMBER=`$ECHO $JDK_BUILD_NUMBER | $SED -e 's/^b//' -e 's/^0//'`
445AC_SUBST(COOKED_BUILD_NUMBER)
446])
447
448AC_DEFUN_ONCE([JDKOPT_SETUP_BUILD_TWEAKS],
449[
450HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
451AC_SUBST(HOTSPOT_MAKE_ARGS)
452
453# The name of the Service Agent jar.
454SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
455if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
456    SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
457fi
458AC_SUBST(SALIB_NAME)
459
460])
461
462AC_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#
468ENABLE_DEBUG_SYMBOLS=default
469
470# default on macosx is no...
471if test "x$OPENJDK_TARGET_OS" = xmacosx; then
472   ENABLE_DEBUG_SYMBOLS=no
473fi
474
475AC_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)
479
480AC_MSG_CHECKING([if we should generate debug symbols])
481
482if 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])
486fi
487
488if 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
495fi
496
497AC_MSG_RESULT([$ENABLE_DEBUG_SYMBOLS])
498
499#
500# ZIP_DEBUGINFO_FILES
501#
502ZIP_DEBUGINFO_FILES=yes
503
504AC_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)
508
509AC_MSG_CHECKING([if we should zip debug-info files])
510AC_MSG_RESULT([$ZIP_DEBUGINFO_FILES])
511
512# Hotspot wants ZIP_DEBUGINFO_FILES to be 1 for yes
513#   use that...
514if test "x$ZIP_DEBUGINFO_FILES" = "xyes"; then
515   ZIP_DEBUGINFO_FILES=1
516else
517   ZIP_DEBUGINFO_FILES=0
518fi
519
520AC_SUBST(ENABLE_DEBUG_SYMBOLS)
521AC_SUBST(ZIP_DEBUGINFO_FILES)
522AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
523AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
524])
525
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
530AC_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])
532AC_SUBST(CUSTOM_MAKE_DIR)
533