1 #
   2 # Copyright (c) 2011, 2020, 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 ###############################################################################
  27 # Check which variant of the JDK that we want to build.
  28 # Currently we have:
  29 #    normal:   standard edition
  30 # but the custom make system may add other variants
  31 #
  32 # Effectively the JDK variant gives a name to a specific set of
  33 # modules to compile into the JDK.
  34 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_VARIANT],
  35 [
  36   # Deprecated in JDK 12
  37   UTIL_DEPRECATED_ARG_WITH([jdk-variant])
  38 ])
  39 
  40 ###############################################################################
  41 # Set the debug level
  42 #    release: no debug information, all optimizations, no asserts.
  43 #    optimized: no debug information, all optimizations, no asserts, HotSpot target is 'optimized'.
  44 #    fastdebug: debug information (-g), all optimizations, all asserts
  45 #    slowdebug: debug information (-g), no optimizations, all asserts
  46 AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_LEVEL],
  47 [
  48   DEBUG_LEVEL="release"
  49 
  50   UTIL_ARG_ENABLE(NAME: debug, DEFAULT: false, RESULT: ENABLE_DEBUG,
  51       DESC: [enable debugging (shorthand for --with-debug-level=fastdebug)],
  52       IF_ENABLED: [ DEBUG_LEVEL="fastdebug" ])
  53 
  54   AC_MSG_CHECKING([which debug level to use])
  55   AC_ARG_WITH([debug-level], [AS_HELP_STRING([--with-debug-level],
  56       [set the debug level (release, fastdebug, slowdebug, optimized) @<:@release@:>@])],
  57       [
  58         DEBUG_LEVEL="${withval}"
  59         if test "x$ENABLE_DEBUG" = xtrue; then
  60           AC_MSG_ERROR([You cannot use both --enable-debug and --with-debug-level at the same time.])
  61         fi
  62       ])
  63   AC_MSG_RESULT([$DEBUG_LEVEL])
  64 
  65   if test "x$DEBUG_LEVEL" != xrelease && \
  66       test "x$DEBUG_LEVEL" != xoptimized && \
  67       test "x$DEBUG_LEVEL" != xfastdebug && \
  68       test "x$DEBUG_LEVEL" != xslowdebug; then
  69     AC_MSG_ERROR([Allowed debug levels are: release, fastdebug, slowdebug and optimized])
  70   fi
  71 
  72   # Translate DEBUG_LEVEL to debug level used by Hotspot
  73   HOTSPOT_DEBUG_LEVEL="$DEBUG_LEVEL"
  74   if test "x$DEBUG_LEVEL" = xrelease; then
  75     HOTSPOT_DEBUG_LEVEL="product"
  76   elif test "x$DEBUG_LEVEL" = xslowdebug; then
  77     HOTSPOT_DEBUG_LEVEL="debug"
  78   fi
  79 
  80   if test "x$DEBUG_LEVEL" = xoptimized; then
  81     # The debug level 'optimized' is a little special because it is currently only
  82     # applicable to the HotSpot build where it means to build a completely
  83     # optimized version of the VM without any debugging code (like for the
  84     # 'release' debug level which is called 'product' in the HotSpot build) but
  85     # with the exception that it can contain additional code which is otherwise
  86     # protected by '#ifndef PRODUCT' macros. These 'optimized' builds are used to
  87     # test new and/or experimental features which are not intended for customer
  88     # shipment. Because these new features need to be tested and benchmarked in
  89     # real world scenarios, we want to build the containing JDK at the 'release'
  90     # debug level.
  91     DEBUG_LEVEL="release"
  92   fi
  93 
  94   AC_SUBST(HOTSPOT_DEBUG_LEVEL)
  95   AC_SUBST(DEBUG_LEVEL)
  96 ])
  97 
  98 ###############################################################################
  99 #
 100 # Should we build only OpenJDK even if closed sources are present?
 101 #
 102 AC_DEFUN_ONCE([JDKOPT_SETUP_OPEN_OR_CUSTOM],
 103 [
 104   UTIL_ARG_ENABLE(NAME: openjdk-only, DEFAULT: false,
 105       RESULT: SUPPRESS_CUSTOM_EXTENSIONS,
 106       DESC: [suppress building custom source even if present],
 107       CHECKING_MSG: [if custom source is suppressed (openjdk-only)])
 108 ])
 109 
 110 AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
 111 [
 112   # Should we build a JDK without a graphical UI?
 113   UTIL_ARG_ENABLE(NAME: headless-only, DEFAULT: false,
 114       RESULT: ENABLE_HEADLESS_ONLY,
 115       DESC: [only build headless (no GUI) support],
 116       CHECKING_MSG: [if we should build headless-only (no GUI)])
 117   AC_SUBST(ENABLE_HEADLESS_ONLY)
 118 
 119   # should we linktime gc unused code sections in the JDK build ?
 120   if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = xs390x; then
 121     LINKTIME_GC_DEFAULT=true
 122   else
 123     LINKTIME_GC_DEFAULT=false
 124   fi
 125 
 126   UTIL_ARG_ENABLE(NAME: linktime-gc, DEFAULT: $LINKTIME_GC_DEFAULT,
 127       DEFAULT_DESC: [auto], RESULT: ENABLE_LINKTIME_GC,
 128       DESC: [use link time gc on unused code sections in the JDK build],
 129       CHECKING_MSG: [if linker should clean out unused code (linktime-gc)])
 130   AC_SUBST(ENABLE_LINKTIME_GC)
 131 
 132   # Check for full doc dependencies
 133   FULL_DOCS_AVAILABLE=true
 134   AC_MSG_CHECKING([for graphviz dot])
 135   if test "x$DOT" != "x"; then
 136     AC_MSG_RESULT([yes])
 137   else
 138     AC_MSG_RESULT([no, cannot generate full docs])
 139     FULL_DOCS_AVAILABLE=false
 140   fi
 141 
 142   AC_MSG_CHECKING([for pandoc])
 143   if test "x$ENABLE_PANDOC" = "xtrue"; then
 144     AC_MSG_RESULT([yes])
 145   else
 146     AC_MSG_RESULT([no, cannot generate full docs])
 147     FULL_DOCS_AVAILABLE=false
 148   fi
 149 
 150   # Should we build the complete docs, or just a lightweight version?
 151   UTIL_ARG_ENABLE(NAME: full-docs, DEFAULT: auto, RESULT: ENABLE_FULL_DOCS,
 152       AVAILABLE: $FULL_DOCS_AVAILABLE, DESC: [build complete documentation],
 153       DEFAULT_DESC: [enabled if all tools found])
 154   AC_SUBST(ENABLE_FULL_DOCS)
 155 
 156   # Choose cacerts source file
 157   AC_ARG_WITH(cacerts-file, [AS_HELP_STRING([--with-cacerts-file],
 158       [specify alternative cacerts file])])
 159   AC_MSG_CHECKING([for cacerts file])
 160   if test "x$with_cacerts_file" == x; then
 161     AC_MSG_RESULT([default])
 162   else
 163     CACERTS_FILE=$with_cacerts_file
 164     if test ! -f "$CACERTS_FILE"; then
 165       AC_MSG_RESULT([fail])
 166       AC_MSG_ERROR([Specified cacerts file "$CACERTS_FILE" does not exist])
 167     fi
 168     AC_MSG_RESULT([$CACERTS_FILE])
 169   fi
 170   AC_SUBST(CACERTS_FILE)
 171 
 172   # Enable or disable unlimited crypto
 173   UTIL_ARG_ENABLE(NAME: unlimited-crypto, DEFAULT: true, RESULT: UNLIMITED_CRYPTO,
 174       DESC: [enable unlimited crypto policy])
 175   AC_SUBST(UNLIMITED_CRYPTO)
 176 
 177   # Should we build the serviceability agent (SA)?
 178   INCLUDE_SA=true
 179   if HOTSPOT_CHECK_JVM_VARIANT(zero); then
 180     INCLUDE_SA=false
 181   fi
 182   if test "x$OPENJDK_TARGET_OS" = xaix ; then
 183     INCLUDE_SA=false
 184   fi
 185   if test "x$OPENJDK_TARGET_CPU" = xs390x ; then
 186     INCLUDE_SA=false
 187   fi
 188   AC_SUBST(INCLUDE_SA)
 189 
 190   # Compress jars
 191   COMPRESS_JARS=false
 192 
 193   AC_SUBST(COMPRESS_JARS)
 194 
 195   # Setup default copyright year. Mostly overridden when building close to a new year.
 196   AC_ARG_WITH(copyright-year, [AS_HELP_STRING([--with-copyright-year],
 197       [Set copyright year value for build @<:@current year@:>@])])
 198   if test "x$with_copyright_year" = xyes; then
 199     AC_MSG_ERROR([Copyright year must have a value])
 200   elif test "x$with_copyright_year" != x; then
 201     COPYRIGHT_YEAR="$with_copyright_year"
 202   else
 203     COPYRIGHT_YEAR=`$DATE +'%Y'`
 204   fi
 205   AC_SUBST(COPYRIGHT_YEAR)
 206 
 207   # Override default library path
 208   AC_ARG_WITH([jni-libpath], [AS_HELP_STRING([--with-jni-libpath],
 209       [override default JNI library search path])])
 210   AC_MSG_CHECKING([for jni library path])
 211   if test "x${with_jni_libpath}" = "x" || test "x${with_jni_libpath}" = "xno"; then
 212     AC_MSG_RESULT([default])
 213   elif test "x${with_jni_libpath}" = "xyes"; then
 214     AC_MSG_RESULT([invalid])
 215     AC_MSG_ERROR([The --with-jni-libpath option requires an argument.])
 216   else
 217     HOTSPOT_OVERRIDE_LIBPATH=${with_jni_libpath}
 218     if test "x$OPENJDK_TARGET_OS" != "xlinux" &&
 219          test "x$OPENJDK_TARGET_OS" != "xbsd" &&
 220          test "x$OPENJDK_TARGET_OS" != "xaix"; then
 221       AC_MSG_RESULT([fail])
 222       AC_MSG_ERROR([Overriding JNI library path is supported only on Linux, BSD and AIX.])
 223     fi
 224     AC_MSG_RESULT(${HOTSPOT_OVERRIDE_LIBPATH})
 225   fi
 226   AC_SUBST(HOTSPOT_OVERRIDE_LIBPATH)
 227 
 228 ])
 229 
 230 ###############################################################################
 231 #
 232 # Enable or disable the elliptic curve crypto implementation
 233 #
 234 AC_DEFUN_ONCE([JDKOPT_DETECT_INTREE_EC],
 235 [
 236   AC_MSG_CHECKING([if elliptic curve crypto implementation is present])
 237 
 238   if test -d "${TOPDIR}/src/jdk.crypto.ec/share/native/libsunec/impl"; then
 239     ENABLE_INTREE_EC=true
 240     AC_MSG_RESULT([yes])
 241   else
 242     ENABLE_INTREE_EC=false
 243     AC_MSG_RESULT([no])
 244   fi
 245 
 246   AC_SUBST(ENABLE_INTREE_EC)
 247 ])
 248 
 249 AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS],
 250 [
 251   #
 252   # Native debug symbols.
 253   # This must be done after the toolchain is setup, since we're looking at objcopy.
 254   #
 255   AC_MSG_CHECKING([what type of native debug symbols to use])
 256   AC_ARG_WITH([native-debug-symbols],
 257       [AS_HELP_STRING([--with-native-debug-symbols],
 258       [set the native debug symbol configuration (none, internal, external, zipped) @<:@varying@:>@])],
 259       [
 260         if test "x$OPENJDK_TARGET_OS" = xaix; then
 261           if test "x$withval" = xexternal || test "x$withval" = xzipped; then
 262             AC_MSG_ERROR([AIX only supports the parameters 'none' and 'internal' for --with-native-debug-symbols])
 263           fi
 264         elif test "x$OPENJDK_TARGET_OS" = xwindows; then
 265           if test "x$withval" = xinternal; then
 266             AC_MSG_ERROR([Windows does not support the parameter 'internal' for --with-native-debug-symbols])
 267           fi
 268         fi
 269       ],
 270       [
 271         if test "x$STATIC_BUILD" = xtrue; then
 272           with_native_debug_symbols="none"
 273         else
 274           if test "x$OPENJDK_TARGET_OS" = xaix; then
 275             # AIX doesn't support 'external' so use 'internal' as default
 276             with_native_debug_symbols="internal"
 277           else
 278             with_native_debug_symbols="external"
 279           fi
 280         fi
 281       ])
 282   AC_MSG_RESULT([$with_native_debug_symbols])
 283 
 284   if test "x$with_native_debug_symbols" = xnone; then
 285     COMPILE_WITH_DEBUG_SYMBOLS=false
 286     COPY_DEBUG_SYMBOLS=false
 287     ZIP_EXTERNAL_DEBUG_SYMBOLS=false
 288   elif test "x$with_native_debug_symbols" = xinternal; then
 289     COMPILE_WITH_DEBUG_SYMBOLS=true
 290     COPY_DEBUG_SYMBOLS=false
 291     ZIP_EXTERNAL_DEBUG_SYMBOLS=false
 292   elif test "x$with_native_debug_symbols" = xexternal; then
 293 
 294     if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
 295       if test "x$OBJCOPY" = x; then
 296         # enabling of enable-debug-symbols and can't find objcopy
 297         # this is an error
 298         AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
 299       fi
 300     fi
 301 
 302     COMPILE_WITH_DEBUG_SYMBOLS=true
 303     COPY_DEBUG_SYMBOLS=true
 304     ZIP_EXTERNAL_DEBUG_SYMBOLS=false
 305   elif test "x$with_native_debug_symbols" = xzipped; then
 306 
 307     if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xlinux; then
 308       if test "x$OBJCOPY" = x; then
 309         # enabling of enable-debug-symbols and can't find objcopy
 310         # this is an error
 311         AC_MSG_ERROR([Unable to find objcopy, cannot enable native debug symbols])
 312       fi
 313     fi
 314 
 315     COMPILE_WITH_DEBUG_SYMBOLS=true
 316     COPY_DEBUG_SYMBOLS=true
 317     ZIP_EXTERNAL_DEBUG_SYMBOLS=true
 318   else
 319     AC_MSG_ERROR([Allowed native debug symbols are: none, internal, external, zipped])
 320   fi
 321 
 322   AC_SUBST(COMPILE_WITH_DEBUG_SYMBOLS)
 323   AC_SUBST(COPY_DEBUG_SYMBOLS)
 324   AC_SUBST(ZIP_EXTERNAL_DEBUG_SYMBOLS)
 325 
 326   # Should we add external native debug symbols to the shipped bundles?
 327   AC_MSG_CHECKING([if we should add external native debug symbols to the shipped bundles])
 328   AC_ARG_WITH([external-symbols-in-bundles],
 329       [AS_HELP_STRING([--with-external-symbols-in-bundles],
 330       [which type of external native debug symbol information shall be shipped in product bundles (none, public, full)
 331       (e.g. ship full/stripped pdbs on Windows) @<:@none@:>@])])
 332 
 333   if test "x$with_external_symbols_in_bundles" = x || test "x$with_external_symbols_in_bundles" = xnone ; then
 334     AC_MSG_RESULT([no])
 335   elif test "x$with_external_symbols_in_bundles" = xfull || test "x$with_external_symbols_in_bundles" = xpublic ; then
 336     if test "x$OPENJDK_TARGET_OS" != xwindows ; then
 337       AC_MSG_ERROR([--with-external-symbols-in-bundles currently only works on windows!])
 338     elif test "x$COPY_DEBUG_SYMBOLS" != xtrue ; then
 339       AC_MSG_ERROR([--with-external-symbols-in-bundles only works when --with-native-debug-symbols=external is used!])
 340     elif test "x$with_external_symbols_in_bundles" = xfull ; then
 341       AC_MSG_RESULT([full])
 342       SHIP_DEBUG_SYMBOLS=full
 343     else
 344       AC_MSG_RESULT([public])
 345       SHIP_DEBUG_SYMBOLS=public
 346     fi
 347   else
 348     AC_MSG_ERROR([$with_external_symbols_in_bundles is an unknown value for --with-external-symbols-in-bundles])
 349   fi
 350 
 351   AC_SUBST(SHIP_DEBUG_SYMBOLS)
 352 ])
 353 
 354 ################################################################################
 355 #
 356 # Native and Java code coverage
 357 #
 358 AC_DEFUN_ONCE([JDKOPT_SETUP_CODE_COVERAGE],
 359 [
 360   UTIL_ARG_ENABLE(NAME: native-coverage, DEFAULT: false, RESULT: GCOV_ENABLED,
 361       DESC: [enable native compilation with code coverage data],
 362       CHECK_AVAILABLE: [
 363         AC_MSG_CHECKING([if native coverage is available])
 364         if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
 365             test "x$TOOLCHAIN_TYPE" = "xclang"; then
 366           AC_MSG_RESULT([yes])
 367         else
 368           AC_MSG_RESULT([no])
 369           AVAILABLE=false
 370         fi
 371       ],
 372       IF_ENABLED: [
 373         GCOV_CFLAGS="-fprofile-arcs -ftest-coverage -fno-inline"
 374         GCOV_LDFLAGS="-fprofile-arcs"
 375         JVM_CFLAGS="$JVM_CFLAGS $GCOV_CFLAGS"
 376         JVM_LDFLAGS="$JVM_LDFLAGS $GCOV_LDFLAGS"
 377         CFLAGS_JDKLIB="$CFLAGS_JDKLIB $GCOV_CFLAGS"
 378         CFLAGS_JDKEXE="$CFLAGS_JDKEXE $GCOV_CFLAGS"
 379         CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $GCOV_CFLAGS"
 380         CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $GCOV_CFLAGS"
 381         LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $GCOV_LDFLAGS"
 382         LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $GCOV_LDFLAGS"
 383       ])
 384   AC_SUBST(GCOV_ENABLED)
 385 
 386   AC_ARG_WITH(jcov, [AS_HELP_STRING([--with-jcov],
 387       [jcov library location])])
 388   AC_ARG_WITH(jcov-input-jdk, [AS_HELP_STRING([--with-jcov-input-jdk],
 389       [jdk image to instrument])])
 390   AC_ARG_WITH(jcov-filters, [AS_HELP_STRING([--with-jcov-filters],
 391       [filters to limit code for jcov instrumentation and report generation])])
 392   JCOV_HOME=
 393   JCOV_INPUT_JDK=
 394   JCOV_ENABLED=
 395   JCOV_FILTERS=
 396   if test "x$with_jcov" = "x" ; then
 397     JCOV_ENABLED="false"
 398   else
 399     JCOV_HOME="$with_jcov"
 400     if test ! -f "$JCOV_HOME/lib/jcov.jar"; then
 401       AC_MSG_RESULT([fail])
 402       AC_MSG_ERROR([Invalid JCov bundle: "$JCOV_HOME/lib/jcov.jar" does not exist])
 403     fi
 404     JCOV_ENABLED="true"
 405     UTIL_FIXUP_PATH(JCOV_HOME)
 406     if test "x$with_jcov_input_jdk" != "x" ; then
 407       JCOV_INPUT_JDK="$with_jcov_input_jdk"
 408       if test ! -f "$JCOV_INPUT_JDK/bin/java$EXE_SUFFIX"; then
 409         AC_MSG_RESULT([fail])
 410         AC_MSG_ERROR([Invalid JDK bundle: "$JCOV_INPUT_JDK/bin/java$EXE_SUFFIX" does not exist])
 411       fi
 412       UTIL_FIXUP_PATH(JCOV_INPUT_JDK)
 413     fi
 414     if test "x$with_jcov_filters" != "x" ; then
 415       JCOV_FILTERS="$with_jcov_filters"
 416     fi
 417   fi
 418   AC_SUBST(JCOV_ENABLED)
 419   AC_SUBST(JCOV_HOME)
 420   AC_SUBST(JCOV_INPUT_JDK)
 421   AC_SUBST(JCOV_FILTERS)
 422 ])
 423 
 424 ###############################################################################
 425 #
 426 # AddressSanitizer
 427 #
 428 AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
 429 [
 430   UTIL_ARG_ENABLE(NAME: asan, DEFAULT: false,
 431       DESC: [enable AddressSanitizer],
 432       CHECK_AVAILABLE: [
 433         AC_MSG_CHECKING([if AddressSanitizer (asan) is available])
 434         if test "x$TOOLCHAIN_TYPE" = "xgcc" ||
 435             test "x$TOOLCHAIN_TYPE" = "xclang"; then
 436           AC_MSG_RESULT([yes])
 437         else
 438           AC_MSG_RESULT([no])
 439           AVAILABLE=false
 440         fi
 441       ],
 442       IF_ENABLED: [
 443         ASAN_CFLAGS="-fsanitize=address -fno-omit-frame-pointer"
 444         ASAN_LDFLAGS="-fsanitize=address"
 445         JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS"
 446         JVM_LDFLAGS="$JVM_LDFLAGS $ASAN_LDFLAGS"
 447         CFLAGS_JDKLIB="$CFLAGS_JDKLIB $ASAN_CFLAGS"
 448         CFLAGS_JDKEXE="$CFLAGS_JDKEXE $ASAN_CFLAGS"
 449         CXXFLAGS_JDKLIB="$CXXFLAGS_JDKLIB $ASAN_CFLAGS"
 450         CXXFLAGS_JDKEXE="$CXXFLAGS_JDKEXE $ASAN_CFLAGS"
 451         LDFLAGS_JDKLIB="$LDFLAGS_JDKLIB $ASAN_LDFLAGS"
 452         LDFLAGS_JDKEXE="$LDFLAGS_JDKEXE $ASAN_LDFLAGS"
 453         ASAN_ENABLED="yes"
 454       ],
 455       IF_DISABLED: [
 456         ASAN_ENABLED="no"
 457       ])
 458 
 459   AC_SUBST(ASAN_ENABLED)
 460 ])
 461 
 462 ################################################################################
 463 #
 464 # Static build support.  When enabled will generate static
 465 # libraries instead of shared libraries for all JDK libs.
 466 #
 467 AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
 468 [
 469   UTIL_ARG_ENABLE(NAME: static-build, DEFAULT: false, RESULT: STATIC_BUILD,
 470       DESC: [enable static library build],
 471       CHECKING_MSG: [if static build is enabled],
 472       CHECK_AVAILABLE: [
 473         AC_MSG_CHECKING([if static build is available])
 474         if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
 475           AC_MSG_RESULT([yes])
 476         else
 477           AC_MSG_RESULT([no])
 478           AVAILABLE=false
 479         fi
 480       ],
 481       IF_ENABLED: [
 482         STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
 483         CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
 484         CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
 485       ])
 486   AC_SUBST(STATIC_BUILD)
 487 ])
 488 
 489 ################################################################################
 490 #
 491 # jlink options.
 492 # We always keep packaged modules in JDK image.
 493 #
 494 AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
 495 [
 496   UTIL_ARG_ENABLE(NAME: keep-packaged-modules, DEFAULT: true,
 497       RESULT: JLINK_KEEP_PACKAGED_MODULES,
 498       DESC: [enable keeping of packaged modules in jdk image],
 499       CHECKING_MSG: [if packaged modules are kept])
 500   AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
 501 ])
 502 
 503 ################################################################################
 504 #
 505 # Check if building of the jtreg failure handler should be enabled.
 506 #
 507 AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER],
 508 [
 509   UTIL_ARG_ENABLE(NAME: jtreg-failure-handler, DEFAULT: auto,
 510       RESULT: BUILD_FAILURE_HANDLER,
 511       DESC: [enable keeping of packaged modules in jdk image],
 512       DEFAULT_DESC: [enabled if jtreg is present],
 513       CHECKING_MSG: [if the jtreg failure handler should be built],
 514       CHECK_AVAILABLE: [
 515         AC_MSG_CHECKING([if the jtreg failure handler is available])
 516         if test "x$JT_HOME" != "x"; then
 517           AC_MSG_RESULT([yes])
 518         else
 519           AVAILABLE=false
 520           AC_MSG_RESULT([no (jtreg not present)])
 521         fi
 522       ])
 523   AC_SUBST(BUILD_FAILURE_HANDLER)
 524 ])
 525 
 526 ################################################################################
 527 #
 528 # Enable or disable generation of the classlist at build time
 529 #
 530 AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST],
 531 [
 532   # In GenerateLinkOptData.gmk, DumpLoadedClassList is used to generate the
 533   # classlist file. It never will work if CDS is disabled, since the VM will report
 534   # an error for DumpLoadedClassList.
 535   UTIL_ARG_ENABLE(NAME: generate-classlist, DEFAULT: auto,
 536       RESULT: ENABLE_GENERATE_CLASSLIST, AVAILABLE: $ENABLE_CDS,
 537       DESC: [enable generation of a CDS classlist at build time],
 538       DEFAULT_DESC: [enabled if the JVM feature 'cds' is enabled for all JVM variants],
 539       CHECKING_MSG: [if the CDS classlist generation should be enabled])
 540   AC_SUBST(ENABLE_GENERATE_CLASSLIST)
 541 ])
 542 
 543 ################################################################################
 544 #
 545 # Optionally filter resource translations
 546 #
 547 AC_DEFUN([JDKOPT_EXCLUDE_TRANSLATIONS],
 548 [
 549   AC_ARG_WITH([exclude-translations], [AS_HELP_STRING([--with-exclude-translations],
 550       [a comma separated list of locales to exclude translations for. Default is
 551       to include all translations present in the source.])])
 552 
 553   EXCLUDE_TRANSLATIONS=""
 554   AC_MSG_CHECKING([if any translations should be excluded])
 555   if test "x$with_exclude_translations" != "x"; then
 556     EXCLUDE_TRANSLATIONS="${with_exclude_translations//,/ }"
 557     AC_MSG_RESULT([yes: $EXCLUDE_TRANSLATIONS])
 558   else
 559     AC_MSG_RESULT([no])
 560   fi
 561 
 562   AC_SUBST(EXCLUDE_TRANSLATIONS)
 563 ])
 564 
 565 ################################################################################
 566 #
 567 # Optionally disable man pages
 568 #
 569 AC_DEFUN([JDKOPT_ENABLE_DISABLE_MANPAGES],
 570 [
 571   UTIL_ARG_ENABLE(NAME: manpages, DEFAULT: true, RESULT: BUILD_MANPAGES,
 572       DESC: [enable copying of static man pages],
 573       CHECKING_MSG: [if static man pages should be copied])
 574   AC_SUBST(BUILD_MANPAGES)
 575 ])
 576 
 577 ################################################################################
 578 #
 579 # Disable the default CDS archive generation
 580 #
 581 AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
 582 [
 583   UTIL_ARG_ENABLE(NAME: cds-archive, DEFAULT: auto, RESULT: BUILD_CDS_ARCHIVE,
 584       DESC: [enable generation of a default CDS archive in the product image],
 585       DEFAULT_DESC: [enabled if possible],
 586       CHECKING_MSG: [if a default CDS archive should be generated],
 587       CHECK_AVAILABLE: [
 588         AC_MSG_CHECKING([if CDS archive is available])
 589         if test "x$ENABLE_CDS" = "xfalse"; then
 590           AC_MSG_RESULT([no (CDS is disabled)])
 591           AVAILABLE=false
 592         elif test "x$COMPILE_TYPE" = "xcross"; then
 593           AC_MSG_RESULT([no (not possible with cross compilation)])
 594           AVAILABLE=false
 595         else
 596           AC_MSG_RESULT([yes])
 597         fi
 598       ])
 599   AC_SUBST(BUILD_CDS_ARCHIVE)
 600 ])
 601 
 602 ################################################################################
 603 #
 604 # Disallow any output from containing absolute paths from the build system.
 605 # This setting defaults to allowed on debug builds and not allowed on release
 606 # builds.
 607 #
 608 AC_DEFUN([JDKOPT_ALLOW_ABSOLUTE_PATHS_IN_OUTPUT],
 609 [
 610   AC_ARG_ENABLE([absolute-paths-in-output],
 611       [AS_HELP_STRING([--disable-absolute-paths-in-output],
 612        [Set to disable to prevent any absolute paths from the build to end up in
 613         any of the build output. @<:@disabled in release builds, otherwise enabled@:>@])
 614       ])
 615 
 616   AC_MSG_CHECKING([if absolute paths should be allowed in the build output])
 617   if test "x$enable_absolute_paths_in_output" = "xno"; then
 618     AC_MSG_RESULT([no, forced])
 619     ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false"
 620   elif test "x$enable_absolute_paths_in_output" = "xyes"; then
 621     AC_MSG_RESULT([yes, forced])
 622     ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true"
 623   elif test "x$DEBUG_LEVEL" = "xrelease"; then
 624     AC_MSG_RESULT([no, release build])
 625     ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="false"
 626   else
 627     AC_MSG_RESULT([yes, debug build])
 628     ALLOW_ABSOLUTE_PATHS_IN_OUTPUT="true"
 629   fi
 630 
 631   AC_SUBST(ALLOW_ABSOLUTE_PATHS_IN_OUTPUT)
 632 ])