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