jdk-options.m4 revision 1819:aa66642d2fff
155682Smarkm#
2233294Sstas# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
3233294Sstas# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4233294Sstas#
555682Smarkm# This code is free software; you can redistribute it and/or modify it
6233294Sstas# under the terms of the GNU General Public License version 2 only, as
7233294Sstas# published by the Free Software Foundation.  Oracle designates this
8233294Sstas# particular file as subject to the "Classpath" exception as provided
955682Smarkm# by Oracle in the LICENSE file that accompanied this code.
10233294Sstas#
11233294Sstas# This code is distributed in the hope that it will be useful, but WITHOUT
1255682Smarkm# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13233294Sstas# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14233294Sstas# version 2 for more details (a copy is included in the LICENSE file that
15233294Sstas# accompanied this code).
1655682Smarkm#
17233294Sstas# You should have received a copy of the GNU General Public License version
18233294Sstas# 2 along with this work; if not, write to the Free Software Foundation,
19233294Sstas# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2055682Smarkm#
21233294Sstas# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22233294Sstas# or visit www.oracle.com if you need additional information or have any
23233294Sstas# questions.
24233294Sstas#
25233294Sstas
26233294SstasAC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VARIANT],
27233294Sstas[
28233294Sstas  ###############################################################################
29233294Sstas  #
30233294Sstas  # Check which variant of the JDK that we want to build.
31233294Sstas  # Currently we have:
3255682Smarkm  #    normal:   standard edition
3355682Smarkm  # but the custom make system may add other variants
3455682Smarkm  #
35178825Sdfr  # Effectively the JDK variant gives a name to a specific set of
3655682Smarkm  # modules to compile into the JDK. In the future, these modules
3755682Smarkm  # might even be Jigsaw modules.
3855682Smarkm  #
3955682Smarkm  AC_MSG_CHECKING([which variant of the JDK to build])
40178825Sdfr  AC_ARG_WITH([jdk-variant], [AS_HELP_STRING([--with-jdk-variant],
41178825Sdfr      [JDK variant to build (normal) @<:@normal@:>@])])
4255682Smarkm
4355682Smarkm  if test "x$with_jdk_variant" = xnormal || test "x$with_jdk_variant" = x; then
4455682Smarkm    JDK_VARIANT="normal"
4555682Smarkm  else
4655682Smarkm    AC_MSG_ERROR([The available JDK variants are: normal])
4755682Smarkm  fi
4878527Sassar
49178825Sdfr  AC_SUBST(JDK_VARIANT)
50178825Sdfr
51178825Sdfr  AC_MSG_RESULT([$JDK_VARIANT])
5255682Smarkm])
5355682Smarkm
5455682SmarkmAC_DEFUN_ONCE([JDKOPT_SETUP_JVM_INTERPRETER],
55233294Sstas[
5678527Sassar###############################################################################
57233294Sstas#
58233294Sstas# Check which interpreter of the JVM we want to build.
59233294Sstas# Currently we have:
60233294Sstas#    template: Template interpreter (the default)
6155682Smarkm#    cpp     : C++ interpreter
6255682SmarkmAC_MSG_CHECKING([which interpreter of the JVM to build])
63233294SstasAC_ARG_WITH([jvm-interpreter], [AS_HELP_STRING([--with-jvm-interpreter],
6455682Smarkm	[JVM interpreter to build (template, cpp) @<:@template@:>@])])
6555682Smarkm
66233294Sstasif test "x$with_jvm_interpreter" = x; then
67233294Sstas     with_jvm_interpreter="template"
68233294Sstasfi
6955682Smarkm
70233294SstasJVM_INTERPRETER="$with_jvm_interpreter"
71233294Sstas
72233294Sstasif test "x$JVM_INTERPRETER" != xtemplate && test "x$JVM_INTERPRETER" != xcpp; then
7355682Smarkm   AC_MSG_ERROR([The available JVM interpreters are: template, cpp])
74233294Sstasfi
75233294Sstas
76233294SstasAC_SUBST(JVM_INTERPRETER)
7755682Smarkm
78233294SstasAC_MSG_RESULT([$with_jvm_interpreter])
79233294Sstas])
80178825Sdfr
81233294SstasAC_DEFUN_ONCE([JDKOPT_SETUP_JVM_VARIANTS],
82178825Sdfr[
83178825Sdfr
84178825Sdfr  ###############################################################################
85178825Sdfr  #
86178825Sdfr  # Check which variants of the JVM that we want to build.
87178825Sdfr  # Currently we have:
88233294Sstas  #    server: normal interpreter and a tiered C1/C2 compiler
89233294Sstas  #    client: normal interpreter and C1 (no C2 compiler) (only 32-bit platforms)
90233294Sstas  #    minimal1: reduced form of client with optional VM services and features stripped out
9155682Smarkm  #    kernel: kernel footprint JVM that passes the TCK without major performance problems,
9255682Smarkm  #             ie normal interpreter and C1, only the serial GC, kernel jvmti etc
9355682Smarkm  #    zero: no machine code interpreter, no compiler
9455682Smarkm  #    zeroshark: zero interpreter and shark/llvm compiler backend
9555682Smarkm#    core: interpreter only, no compiler (only works on some platforms)
9655682Smarkm  AC_MSG_CHECKING([which variants of the JVM to build])
9755682Smarkm  AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
9855682Smarkm	[JVM variants (separated by commas) to build (server, client, minimal1, kernel, zero, zeroshark, core) @<:@server@:>@])])
9955682Smarkm
100178825Sdfr  if test "x$with_jvm_variants" = x; then
10155682Smarkm    with_jvm_variants="server"
102178825Sdfr  fi
10355682Smarkm
10455682Smarkm  JVM_VARIANTS=",$with_jvm_variants,"
10555682Smarkm  TEST_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,//' -e 's/client,//'  -e 's/minimal1,//' -e 's/kernel,//' -e 's/zero,//' -e 's/zeroshark,//' -e 's/core,//'`
106178825Sdfr
107178825Sdfr  if test "x$TEST_VARIANTS" != "x,"; then
10855682Smarkm     AC_MSG_ERROR([The available JVM variants are: server, client, minimal1, kernel, zero, zeroshark, core])
109178825Sdfr  fi
11055682Smarkm  AC_MSG_RESULT([$with_jvm_variants])
111178825Sdfr
112178825Sdfr  JVM_VARIANT_SERVER=`$ECHO "$JVM_VARIANTS" | $SED -e '/,server,/!s/.*/false/g' -e '/,server,/s/.*/true/g'`
11355682Smarkm  JVM_VARIANT_CLIENT=`$ECHO "$JVM_VARIANTS" | $SED -e '/,client,/!s/.*/false/g' -e '/,client,/s/.*/true/g'`
11455682Smarkm  JVM_VARIANT_MINIMAL1=`$ECHO "$JVM_VARIANTS" | $SED -e '/,minimal1,/!s/.*/false/g' -e '/,minimal1,/s/.*/true/g'`
11555682Smarkm  JVM_VARIANT_KERNEL=`$ECHO "$JVM_VARIANTS" | $SED -e '/,kernel,/!s/.*/false/g' -e '/,kernel,/s/.*/true/g'`
11655682Smarkm  JVM_VARIANT_ZERO=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zero,/!s/.*/false/g' -e '/,zero,/s/.*/true/g'`
11755682Smarkm  JVM_VARIANT_ZEROSHARK=`$ECHO "$JVM_VARIANTS" | $SED -e '/,zeroshark,/!s/.*/false/g' -e '/,zeroshark,/s/.*/true/g'`
11855682Smarkm  JVM_VARIANT_CORE=`$ECHO "$JVM_VARIANTS" | $SED -e '/,core,/!s/.*/false/g' -e '/,core,/s/.*/true/g'`
11955682Smarkm
12055682Smarkm  if test "x$JVM_VARIANT_CLIENT" = xtrue; then
12155682Smarkm    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
12255682Smarkm      AC_MSG_ERROR([You cannot build a client JVM for a 64-bit machine.])
123178825Sdfr    fi
12455682Smarkm  fi
125178825Sdfr  if test "x$JVM_VARIANT_KERNEL" = xtrue; then
12655682Smarkm    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
12755682Smarkm      AC_MSG_ERROR([You cannot build a kernel JVM for a 64-bit machine.])
128233294Sstas    fi
12955682Smarkm  fi
13055682Smarkm  if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
13155682Smarkm    if test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
13255682Smarkm      AC_MSG_ERROR([You cannot build a minimal JVM for a 64-bit machine.])
13355682Smarkm    fi
134233294Sstas  fi
135233294Sstas
136233294Sstas  # Replace the commas with AND for use in the build directory name.
137233294Sstas  ANDED_JVM_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/^,//' -e 's/,$//' -e 's/,/AND/g'`
13855682Smarkm  COUNT_VARIANTS=`$ECHO "$JVM_VARIANTS" | $SED -e 's/server,/1/' -e 's/client,/1/' -e 's/minimal1,/1/' -e 's/kernel,/1/' -e 's/zero,/1/' -e 's/zeroshark,/1/' -e 's/core,/1/'`
13955682Smarkm  if test "x$COUNT_VARIANTS" != "x,1"; then
14055682Smarkm    BUILDING_MULTIPLE_JVM_VARIANTS=yes
14155682Smarkm  else
14255682Smarkm    BUILDING_MULTIPLE_JVM_VARIANTS=no
14355682Smarkm  fi
14455682Smarkm
14555682Smarkm  AC_SUBST(JVM_VARIANTS)
146178825Sdfr  AC_SUBST(JVM_VARIANT_SERVER)
14755682Smarkm  AC_SUBST(JVM_VARIANT_CLIENT)
148178825Sdfr  AC_SUBST(JVM_VARIANT_MINIMAL1)
149178825Sdfr  AC_SUBST(JVM_VARIANT_KERNEL)
15055682Smarkm  AC_SUBST(JVM_VARIANT_ZERO)
15178527Sassar  AC_SUBST(JVM_VARIANT_ZEROSHARK)
15255682Smarkm  AC_SUBST(JVM_VARIANT_CORE)
15372445Sassar
15472445Sassar  INCLUDE_SA=true
15572445Sassar  if test "x$JVM_VARIANT_ZERO" = xtrue ; then
156233294Sstas    INCLUDE_SA=false
157178825Sdfr  fi
15890926Snectar  if test "x$JVM_VARIANT_ZEROSHARK" = xtrue ; then
15955682Smarkm    INCLUDE_SA=false
16055682Smarkm  fi
16155682Smarkm  if test "x$OPENJDK_TARGET_OS" = xaix ; then
16255682Smarkm    INCLUDE_SA=false
16355682Smarkm  fi
16455682Smarkm  if test "x$OPENJDK_TARGET_CPU" = xaarch64; then
16555682Smarkm    INCLUDE_SA=false
16655682Smarkm  fi
16755682Smarkm  AC_SUBST(INCLUDE_SA)
168178825Sdfr
169178825Sdfr  if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
17055682Smarkm    MACOSX_UNIVERSAL="true"
171178825Sdfr  fi
172178825Sdfr
173178825Sdfr  AC_SUBST(MACOSX_UNIVERSAL)
174178825Sdfr])
17555682Smarkm
17655682SmarkmAC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
177178825Sdfr[
178178825Sdfr  ###############################################################################
179178825Sdfr  #
180233294Sstas  # Set the debug level
181178825Sdfr  #    release: no debug information, all optimizations, no asserts.
182178825Sdfr  #    optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'.
183233294Sstas  #    fastdebug: debug information (-g), all optimizations, all asserts
184178825Sdfr  #    slowdebug: debug information (-g), no optimizations, all asserts
185233294Sstas  #
18655682Smarkm  DEBUG_LEVEL="release"
18755682Smarkm  AC_MSG_CHECKING([which debug level to use])
18855682Smarkm  AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug],
18955682Smarkm      [set the debug level to fastdebug (shorthand for --with-debug-level=fastdebug) @<:@disabled@:>@])],
19055682Smarkm      [
19155682Smarkm        ENABLE_DEBUG="${enableval}"
19255682Smarkm        DEBUG_LEVEL="fastdebug"
19355682Smarkm      ], [ENABLE_DEBUG="no"])
19455682Smarkm
19555682Smarkm  AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
19655682Smarkm      [set the debug level (release, fastdebug, slowdebug, optimized (HotSpot build only)) @<:@release@:>@])],
19755682Smarkm      [
19855682Smarkm        DEBUG_LEVEL="${withval}"
19955682Smarkm        if test "x$ENABLE_DEBUG" = xyes; then
20055682Smarkm          AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
20155682Smarkm        fi
20255682Smarkm      ])
20355682Smarkm  AC_MSG_RESULT([$DEBUG_LEVEL])
204178825Sdfr
205178825Sdfr  if test "x$DEBUG_LEVEL" != xrelease && \
206178825Sdfr      test "x$DEBUG_LEVEL" != xoptimized && \
207178825Sdfr      test "x$DEBUG_LEVEL" != xfastdebug && \
208178825Sdfr      test "x$DEBUG_LEVEL" != xslowdebug; then
209178825Sdfr    AC_MSG_ERROR([Allowed debug levels are: release, fastdebug and slowdebug])
210178825Sdfr  fi
211178825Sdfr
212233294Sstas
213178825Sdfr  ###############################################################################
214233294Sstas  #
215178825Sdfr  # Setup legacy vars/targets and new vars to deal with different debug levels.
216233294Sstas  #
217178825Sdfr
218178825Sdfr  case $DEBUG_LEVEL in
219178825Sdfr    release )
220178825Sdfr      VARIANT="OPT"
221178825Sdfr      FASTDEBUG="false"
222178825Sdfr      DEBUG_CLASSFILES="false"
223178825Sdfr      BUILD_VARIANT_RELEASE=""
224233294Sstas      HOTSPOT_DEBUG_LEVEL="product"
225233294Sstas      HOTSPOT_EXPORT="product"
22655682Smarkm      ;;
22755682Smarkm    fastdebug )
22855682Smarkm      VARIANT="DBG"
229233294Sstas      FASTDEBUG="true"
23055682Smarkm      DEBUG_CLASSFILES="true"
231178825Sdfr      BUILD_VARIANT_RELEASE="-fastdebug"
232178825Sdfr      HOTSPOT_DEBUG_LEVEL="fastdebug"
233178825Sdfr      HOTSPOT_EXPORT="fastdebug"
234178825Sdfr      ;;
235178825Sdfr    slowdebug )
236178825Sdfr      VARIANT="DBG"
237178825Sdfr      FASTDEBUG="false"
238178825Sdfr      DEBUG_CLASSFILES="true"
239178825Sdfr      BUILD_VARIANT_RELEASE="-debug"
24078527Sassar      HOTSPOT_DEBUG_LEVEL="debug"
241178825Sdfr      HOTSPOT_EXPORT="debug"
242178825Sdfr      ;;
24378527Sassar    optimized )
24478527Sassar      VARIANT="OPT"
24578527Sassar      FASTDEBUG="false"
24678527Sassar      DEBUG_CLASSFILES="false"
24778527Sassar      BUILD_VARIANT_RELEASE="-optimized"
24878527Sassar      HOTSPOT_DEBUG_LEVEL="optimized"
249178825Sdfr      HOTSPOT_EXPORT="optimized"
250233294Sstas      ;;
25155682Smarkm  esac
25255682Smarkm
25355682Smarkm  # The debug level 'optimized' is a little special because it is currently only
254233294Sstas  # applicable to the HotSpot build where it means to build a completely
25555682Smarkm  # optimized version of the VM without any debugging code (like for the
256233294Sstas  # 'release' debug level which is called 'product' in the HotSpot build) but
25755682Smarkm  # with the exception that it can contain additional code which is otherwise
25855682Smarkm  # protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to
25972445Sassar  # test new and/or experimental features which are not intended for customer
26072445Sassar  # shipment. Because these new features need to be tested and benchmarked in
26172445Sassar  # real world scenarios, we want to build the containing JDK at the 'release'
26272445Sassar  # debug level.
26372445Sassar  if test "x$DEBUG_LEVEL" = xoptimized; then
26472445Sassar    DEBUG_LEVEL="release"
26555682Smarkm  fi
266178825Sdfr
26755682Smarkm  #####
26855682Smarkm  # Generate the legacy makefile targets for hotspot.
269178825Sdfr  # The hotspot api for selecting the build artifacts, really, needs to be improved.
270178825Sdfr  # JDK-7195896 will fix this on the hotspot side by using the JVM_VARIANT_* variables to
271178825Sdfr  # determine what needs to be built. All we will need to set here is all_product, all_fastdebug etc
272178825Sdfr  # But until then ...
273178825Sdfr  HOTSPOT_TARGET=""
274178825Sdfr
275178825Sdfr  if test "x$JVM_VARIANT_SERVER" = xtrue; then
276178825Sdfr    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL} "
277178825Sdfr  fi
278178825Sdfr
279178825Sdfr  if test "x$JVM_VARIANT_CLIENT" = xtrue; then
280178825Sdfr    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}1 "
281178825Sdfr  fi
28255682Smarkm
28355682Smarkm  if test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
28455682Smarkm    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}minimal1 "
285178825Sdfr  fi
28655682Smarkm
287  if test "x$JVM_VARIANT_KERNEL" = xtrue; then
288    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}kernel "
289  fi
290
291  if test "x$JVM_VARIANT_ZERO" = xtrue; then
292    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}zero "
293  fi
294
295  if test "x$JVM_VARIANT_ZEROSHARK" = xtrue; then
296    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}shark "
297  fi
298
299  if test "x$JVM_VARIANT_CORE" = xtrue; then
300    HOTSPOT_TARGET="$HOTSPOT_TARGET${HOTSPOT_DEBUG_LEVEL}core "
301  fi
302
303  HOTSPOT_TARGET="$HOTSPOT_TARGET docs export_$HOTSPOT_EXPORT"
304
305  # On Macosx universal binaries are produced, but they only contain
306  # 64 bit intel. This invalidates control of which jvms are built
307  # from configure, but only server is valid anyway. Fix this
308  # when hotspot makefiles are rewritten.
309  if test "x$MACOSX_UNIVERSAL" = xtrue; then
310    HOTSPOT_TARGET=universal_${HOTSPOT_EXPORT}
311  fi
312
313  #####
314
315  AC_SUBST(DEBUG_LEVEL)
316  AC_SUBST(VARIANT)
317  AC_SUBST(FASTDEBUG)
318  AC_SUBST(DEBUG_CLASSFILES)
319  AC_SUBST(BUILD_VARIANT_RELEASE)
320])
321
322
323###############################################################################
324#
325# Should we build only OpenJDK even if closed sources are present?
326#
327AC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM],
328[
329  AC_ARG_ENABLE([openjdk-only], [AS_HELP_STRING([--enable-openjdk-only],
330      [suppress building custom source even if present @<:@disabled@:>@])],,[enable_openjdk_only="no"])
331
332  AC_MSG_CHECKING([for presence of closed sources])
333  if test -d "$SRC_ROOT/jdk/src/closed"; then
334    CLOSED_SOURCE_PRESENT=yes
335  else
336    CLOSED_SOURCE_PRESENT=no
337  fi
338  AC_MSG_RESULT([$CLOSED_SOURCE_PRESENT])
339
340  AC_MSG_CHECKING([if closed source is suppressed (openjdk-only)])
341  SUPPRESS_CLOSED_SOURCE="$enable_openjdk_only"
342  AC_MSG_RESULT([$SUPPRESS_CLOSED_SOURCE])
343
344  if test "x$CLOSED_SOURCE_PRESENT" = xno; then
345    OPENJDK=true
346    if test "x$SUPPRESS_CLOSED_SOURCE" = "xyes"; then
347      AC_MSG_WARN([No closed source present, --enable-openjdk-only makes no sense])
348    fi
349  else
350    if test "x$SUPPRESS_CLOSED_SOURCE" = "xyes"; then
351      OPENJDK=true
352    else
353      OPENJDK=false
354    fi
355  fi
356
357  if test "x$OPENJDK" = "xtrue"; then
358    SET_OPENJDK="OPENJDK=true"
359  fi
360
361  AC_SUBST(SET_OPENJDK)
362
363  # custom-make-dir is deprecated. Please use your custom-hook.m4 to override
364  # the IncludeCustomExtension macro.
365  BASIC_DEPRECATED_ARG_WITH(custom-make-dir)
366])
367
368AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
369[
370
371  ###############################################################################
372  #
373  # Should we build a JDK/JVM with headful support (ie a graphical ui)?
374  # We always build headless support.
375  #
376  AC_MSG_CHECKING([headful support])
377  AC_ARG_ENABLE([headful], [AS_HELP_STRING([--disable-headful],
378      [disable building headful support (graphical UI support) @<:@enabled@:>@])],
379      [SUPPORT_HEADFUL=${enable_headful}], [SUPPORT_HEADFUL=yes])
380
381  SUPPORT_HEADLESS=yes
382  BUILD_HEADLESS="BUILD_HEADLESS:=true"
383
384  if test "x$SUPPORT_HEADFUL" = xyes; then
385    # We are building both headful and headless.
386    headful_msg="include support for both headful and headless"
387  fi
388
389  if test "x$SUPPORT_HEADFUL" = xno; then
390    # Thus we are building headless only.
391    BUILD_HEADLESS="BUILD_HEADLESS:=true"
392    headful_msg="headless only"
393  fi
394
395  AC_MSG_RESULT([$headful_msg])
396
397  AC_SUBST(SUPPORT_HEADLESS)
398  AC_SUBST(SUPPORT_HEADFUL)
399  AC_SUBST(BUILD_HEADLESS)
400
401  # Control wether Hotspot runs Queens test after build.
402  AC_ARG_ENABLE([hotspot-test-in-build], [AS_HELP_STRING([--enable-hotspot-test-in-build],
403      [run the Queens test after Hotspot build @<:@disabled@:>@])],,
404      [enable_hotspot_test_in_build=no])
405  if test "x$enable_hotspot_test_in_build" = "xyes"; then
406    TEST_IN_BUILD=true
407  else
408    TEST_IN_BUILD=false
409  fi
410  AC_SUBST(TEST_IN_BUILD)
411
412  ###############################################################################
413  #
414  # Choose cacerts source file
415  #
416  AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
417      [specify alternative cacerts file])])
418  if test "x$with_cacerts_file" != x; then
419    CACERTS_FILE=$with_cacerts_file
420  fi
421  AC_SUBST(CACERTS_FILE)
422
423  ###############################################################################
424  #
425  # Enable or disable unlimited crypto
426  #
427  AC_ARG_ENABLE(unlimited-crypto, [AS_HELP_STRING([--enable-unlimited-crypto],
428      [Enable unlimited crypto policy @<:@disabled@:>@])],,
429      [enable_unlimited_crypto=no])
430  if test "x$enable_unlimited_crypto" = "xyes"; then
431    UNLIMITED_CRYPTO=true
432  else
433    UNLIMITED_CRYPTO=false
434  fi
435  AC_SUBST(UNLIMITED_CRYPTO)
436
437  ###############################################################################
438  #
439  # Compress jars
440  #
441  COMPRESS_JARS=false
442
443  AC_SUBST(COMPRESS_JARS)
444
445  # Setup default copyright year. Mostly overridden when building close to a new year.
446  AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year],
447      [Set copyright year value for build @<:@current year@:>@])])
448  if test "x$with_copyright_year" = xyes; then
449    AC_MSG_ERROR([Copyright year must have a value])
450  elif test "x$with_copyright_year" != x; then
451    COPYRIGHT_YEAR="$with_copyright_year"
452  else
453    COPYRIGHT_YEAR=`date +'%Y'`
454  fi
455  AC_SUBST(COPYRIGHT_YEAR)
456])
457
458AC_DEFUN_ONCE([JDKOPT_SETUP_BUILD_TWEAKS],
459[
460  HOTSPOT_MAKE_ARGS="$HOTSPOT_TARGET"
461  AC_SUBST(HOTSPOT_MAKE_ARGS)
462
463  # The name of the Service Agent jar.
464  SALIB_NAME="${LIBRARY_PREFIX}saproc${SHARED_LIBRARY_SUFFIX}"
465  if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
466    SALIB_NAME="${LIBRARY_PREFIX}sawindbg${SHARED_LIBRARY_SUFFIX}"
467  fi
468  AC_SUBST(SALIB_NAME)
469])
470
471###############################################################################
472#
473# Enable or disable the elliptic curve crypto implementation
474#
475AC_DEFUN_ONCE([JDKOPT_DETECT_INTREE_EC],
476[
477  AC_MSG_CHECKING([if elliptic curve crypto implementation is present])
478
479  if test -d "${SRC_ROOT}/jdk/src/jdk.crypto.ec/share/native/libsunec/impl"; then
480    ENABLE_INTREE_EC=yes
481    AC_MSG_RESULT([yes])
482  else
483    ENABLE_INTREE_EC=no
484    AC_MSG_RESULT([no])
485  fi
486
487  AC_SUBST(ENABLE_INTREE_EC)
488])
489
490
491AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
492[
493  #
494  # NATIVE_DEBUG_SYMBOLS
495  # This must be done after the toolchain is setup, since we're looking at objcopy.
496  #
497  AC_MSG_CHECKING([what type of native debug symbols to use])
498  AC_ARG_WITH([native-debug-symbols],
499      [AS_HELP_STRING([--with-native-debug-symbols],
500      [set the native debug symbol configuration (none, internal, external, zipped) @<:@zipped@:>@])],
501      [],
502      [with_native_debug_symbols="zipped"])
503  NATIVE_DEBUG_SYMBOLS=$with_native_debug_symbols
504  AC_MSG_RESULT([$NATIVE_DEBUG_SYMBOLS])
505
506  if test "x$NATIVE_DEBUG_SYMBOLS" = xzipped; then
507
508    if test "x$OBJCOPY" = x; then
509      # explicit enabling of enable-debug-symbols and can't find objcopy
510      # this is an error
511      AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
512    fi
513
514    ENABLE_DEBUG_SYMBOLS=true
515    ZIP_DEBUGINFO_FILES=true
516    DEBUG_BINARIES=true
517    STRIP_POLICY=min_strip
518  elif test "x$NATIVE_DEBUG_SYMBOLS" = xnone; then
519    ENABLE_DEBUG_SYMBOLS=false
520    ZIP_DEBUGINFO_FILES=false
521    DEBUG_BINARIES=false
522    STRIP_POLICY=no_strip
523  elif test "x$NATIVE_DEBUG_SYMBOLS" = xinternal; then
524    ENABLE_DEBUG_SYMBOLS=false  # -g option only
525    ZIP_DEBUGINFO_FILES=false
526    DEBUG_BINARIES=true
527    STRIP_POLICY=no_strip
528    STRIP=""
529  elif test "x$NATIVE_DEBUG_SYMBOLS" = xexternal; then
530
531    if test "x$OBJCOPY" = x; then
532      # explicit enabling of enable-debug-symbols and can't find objcopy
533      # this is an error
534      AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
535    fi
536
537    ENABLE_DEBUG_SYMBOLS=true
538    ZIP_DEBUGINFO_FILES=false
539    DEBUG_BINARIES=true
540    STRIP_POLICY=min_strip
541  else
542    AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped])
543  fi
544
545  # --enable-debug-symbols is deprecated.
546  # Please use --with-native-debug-symbols=[internal,external,zipped] .
547  BASIC_DEPRECATED_ARG_ENABLE(debug-symbols, debug_symbols,
548        [Please use --with-native-debug-symbols=[[internal,external,zipped]] .])
549
550  # --enable-zip-debug-info is deprecated.
551  # Please use --with-native-debug-symbols=zipped .
552  BASIC_DEPRECATED_ARG_ENABLE(zip-debug-info, zip_debug_info,
553                              [Please use --with-native-debug-symbols=zipped .])
554
555  AC_SUBST(NATIVE_DEBUG_SYMBOLS)
556  AC_SUBST(DEBUG_BINARIES)
557  AC_SUBST(STRIP_POLICY)
558  AC_SUBST(ENABLE_DEBUG_SYMBOLS)
559  AC_SUBST(ZIP_DEBUGINFO_FILES)
560])
561
562################################################################################
563#
564# Gcov coverage data for hotspot
565#
566AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
567[
568  AC_ARG_ENABLE(native-coverage, [AS_HELP_STRING([--enable-native-coverage],
569      [enable native compilation with code coverage data@<:@disabled@:>@])])
570  GCOV_ENABLED="false"
571  if test "x$enable_native_coverage" = "xyes"; then
572    if test "x$TOOLCHAIN_TYPE" = "xgcc"; then
573      AC_MSG_CHECKING([if native coverage is enabled])
574      AC_MSG_RESULT([yes])
575      GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
576      GCOV_LDFLAGS="-fprofile-arcs"
577      LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $GCOV_CFLAGS"
578      LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $GCOV_CFLAGS"
579      LEGACY_EXTRA_LDFLAGS="$LEGACY_EXTRA_LDFLAGS $GCOV_LDFLAGS"
580      CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
581      CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
582      CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
583      CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
584      LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
585      LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
586      GCOV_ENABLED="true"
587    else
588      AC_MSG_ERROR([--enable-native-coverage only works with toolchain type gcc])
589    fi
590  elif test "x$enable_native_coverage" = "xno"; then
591    AC_MSG_CHECKING([if native coverage is enabled])
592    AC_MSG_RESULT([no])
593  elif test "x$enable_native_coverage" != "x"; then
594    AC_MSG_ERROR([--enable-native-coverage can only be assigned "yes" or "no"])
595  fi
596
597  AC_SUBST(GCOV_ENABLED)
598])
599
600################################################################################
601#
602# Static build support.  When enabled will generate static 
603# libraries instead of shared libraries for all JDK libs.
604#
605AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
606[
607  AC_ARG_ENABLE([static-build], [AS_HELP_STRING([--enable-static-build],
608    [enable static library build @<:@disabled@:>@])])
609  STATIC_BUILD=false
610  if test "x$enable_static_build" = "xyes"; then
611    AC_MSG_CHECKING([if static build is enabled])
612    AC_MSG_RESULT([yes])
613    if test "x$OPENJDK_TARGET_OS" != "xmacosx"; then
614      AC_MSG_ERROR([--enable-static-build is only supported for macosx builds])
615    fi
616    STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
617    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $STATIC_BUILD_CFLAGS"
618    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $STATIC_BUILD_CFLAGS"
619    CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
620    CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
621    STATIC_BUILD=true
622  elif test "x$enable_static_build" = "xno"; then
623    AC_MSG_CHECKING([if static build is enabled])
624    AC_MSG_RESULT([no])
625  elif test "x$enable_static_build" != "x"; then
626    AC_MSG_ERROR([--enable-static-build can only be assigned "yes" or "no"])
627  fi
628
629  AC_SUBST(STATIC_BUILD)
630])
631
632
633