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 # All valid JVM features, regardless of platform
  27 VALID_JVM_FEATURES="compiler1 compiler2 zero minimal dtrace jvmti jvmci \
  28     graal vm-structs jni-check services management cmsgc epsilongc g1gc parallelgc serialgc shenandoahgc zgc nmt cds \
  29     static-build link-time-opt aot jfr"
  30 
  31 # Deprecated JVM features (these are ignored, but with a warning)
  32 DEPRECATED_JVM_FEATURES="trace"
  33 
  34 # All valid JVM variants
  35 VALID_JVM_VARIANTS="server client minimal core zero custom"
  36 
  37 # Valhalla temporarily disabled
  38 VALHALLA_TEMP=false
  39 
  40 ###############################################################################
  41 # Check if the specified JVM variant should be built. To be used in shell if
  42 # constructs, like this:
  43 # if HOTSPOT_CHECK_JVM_VARIANT(server); then
  44 #
  45 # Only valid to use after HOTSPOT_SETUP_JVM_VARIANTS has setup variants.
  46 
  47 # Definition kept in one line to allow inlining in if statements.
  48 # Additional [] needed to keep m4 from mangling shell constructs.
  49 AC_DEFUN([HOTSPOT_CHECK_JVM_VARIANT],
  50 [ [ [[ " $JVM_VARIANTS " =~ " $1 " ]] ] ])
  51 
  52 ###############################################################################
  53 # Check if the specified JVM feature is enabled. To be used in shell if
  54 # constructs, like this:
  55 # if HOTSPOT_CHECK_JVM_FEATURE(jvmti); then
  56 #
  57 # Only valid to use after HOTSPOT_SETUP_JVM_FEATURES has setup features.
  58 
  59 # Definition kept in one line to allow inlining in if statements.
  60 # Additional [] needed to keep m4 from mangling shell constructs.
  61 AC_DEFUN([HOTSPOT_CHECK_JVM_FEATURE],
  62 [ [ [[ " $JVM_FEATURES " =~ " $1 " ]] ] ])
  63 
  64 ###############################################################################
  65 # Check if the specified JVM feature is explicitly disabled. To be used in
  66 # shell if constructs, like this:
  67 # if HOTSPOT_IS_JVM_FEATURE_DISABLED(jvmci); then
  68 #
  69 # This function is internal to hotspot.m4, and is only used when constructing
  70 # the valid set of enabled JVM features. Users outside of hotspot.m4 should just
  71 # use HOTSPOT_CHECK_JVM_FEATURE to check if a feature is enabled or not.
  72 
  73 # Definition kept in one line to allow inlining in if statements.
  74 # Additional [] needed to keep m4 from mangling shell constructs.
  75 AC_DEFUN([HOTSPOT_IS_JVM_FEATURE_DISABLED],
  76 [ [ [[ " $DISABLED_JVM_FEATURES " =~ " $1 " ]] ] ])
  77 
  78 ###############################################################################
  79 # Check which variants of the JVM that we want to build. Available variants are:
  80 #   server: normal interpreter, and a tiered C1/C2 compiler
  81 #   client: normal interpreter, and C1 (no C2 compiler)
  82 #   minimal: reduced form of client with optional features stripped out
  83 #   core: normal interpreter only, no compiler
  84 #   zero: C++ based interpreter only, no compiler
  85 #   custom: baseline JVM with no default features
  86 #
  87 AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_VARIANTS],
  88 [
  89   AC_ARG_WITH([jvm-variants], [AS_HELP_STRING([--with-jvm-variants],
  90       [JVM variants (separated by commas) to build (server,client,minimal,core,zero,custom) @<:@server@:>@])])
  91 
  92   if test "x$with_jvm_variants" = x; then
  93     with_jvm_variants="server"
  94   fi
  95   JVM_VARIANTS_OPT="$with_jvm_variants"
  96 
  97   # Has the user listed more than one variant?
  98   # Additional [] needed to keep m4 from mangling shell constructs.
  99   if [ [[ "$JVM_VARIANTS_OPT" =~ "," ]] ]; then
 100     BUILDING_MULTIPLE_JVM_VARIANTS=true
 101   else
 102     BUILDING_MULTIPLE_JVM_VARIANTS=false
 103   fi
 104   # Replace the commas with AND for use in the build directory name.
 105   JVM_VARIANTS_WITH_AND=`$ECHO "$JVM_VARIANTS_OPT" | $SED -e 's/,/AND/g'`
 106 
 107   AC_MSG_CHECKING([which variants of the JVM to build])
 108   # JVM_VARIANTS is a space-separated list.
 109   # Also use minimal, not minimal1 (which is kept for backwards compatibility).
 110   JVM_VARIANTS=`$ECHO $JVM_VARIANTS_OPT | $SED -e 's/,/ /g' -e 's/minimal1/minimal/'`
 111   AC_MSG_RESULT([$JVM_VARIANTS])
 112 
 113   # Check that the selected variants are valid
 114   BASIC_GET_NON_MATCHING_VALUES(INVALID_VARIANTS, $JVM_VARIANTS, $VALID_JVM_VARIANTS)
 115   if test "x$INVALID_VARIANTS" != x; then
 116     AC_MSG_NOTICE([Unknown variant(s) specified: "$INVALID_VARIANTS"])
 117     AC_MSG_NOTICE([The available JVM variants are: "$VALID_JVM_VARIANTS"])
 118     AC_MSG_ERROR([Cannot continue])
 119   fi
 120 
 121   # All "special" variants share the same output directory ("server")
 122   VALID_MULTIPLE_JVM_VARIANTS="server client minimal"
 123   BASIC_GET_NON_MATCHING_VALUES(INVALID_MULTIPLE_VARIANTS, $JVM_VARIANTS, $VALID_MULTIPLE_JVM_VARIANTS)
 124   if  test "x$INVALID_MULTIPLE_VARIANTS" != x && test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = xtrue; then
 125     AC_MSG_ERROR([You cannot build multiple variants with anything else than $VALID_MULTIPLE_JVM_VARIANTS.])
 126   fi
 127 
 128   # The "main" variant is the one used by other libs to link against during the
 129   # build.
 130   if test "x$BUILDING_MULTIPLE_JVM_VARIANTS" = "xtrue"; then
 131     MAIN_VARIANT_PRIO_ORDER="server client minimal"
 132     for variant in $MAIN_VARIANT_PRIO_ORDER; do
 133       if HOTSPOT_CHECK_JVM_VARIANT($variant); then
 134         JVM_VARIANT_MAIN="$variant"
 135         break
 136       fi
 137     done
 138   else
 139     JVM_VARIANT_MAIN="$JVM_VARIANTS"
 140   fi
 141 
 142   AC_SUBST(JVM_VARIANTS)
 143   AC_SUBST(VALID_JVM_VARIANTS)
 144   AC_SUBST(JVM_VARIANT_MAIN)
 145 
 146   if HOTSPOT_CHECK_JVM_VARIANT(zero); then
 147     # zero behaves as a platform and rewrites these values. This is really weird. :(
 148     # We are guaranteed that we do not build any other variants when building zero.
 149     HOTSPOT_TARGET_CPU=zero
 150     HOTSPOT_TARGET_CPU_ARCH=zero
 151   fi
 152 ])
 153 
 154 ###############################################################################
 155 # Check if dtrace should be enabled and has all prerequisites present.
 156 #
 157 AC_DEFUN_ONCE([HOTSPOT_SETUP_DTRACE],
 158 [
 159   # Test for dtrace dependencies
 160   AC_ARG_ENABLE([dtrace], [AS_HELP_STRING([--enable-dtrace@<:@=yes/no/auto@:>@],
 161       [enable dtrace. Default is auto, where dtrace is enabled if all dependencies
 162       are present.])])
 163 
 164   DTRACE_DEP_MISSING=false
 165 
 166   AC_MSG_CHECKING([for dtrace tool])
 167   if test "x$DTRACE" != "x" && test -x "$DTRACE"; then
 168     AC_MSG_RESULT([$DTRACE])
 169   else
 170     AC_MSG_RESULT([not found, cannot build dtrace])
 171     DTRACE_DEP_MISSING=true
 172   fi
 173 
 174   AC_CHECK_HEADERS([sys/sdt.h], [DTRACE_HEADERS_OK=yes],[DTRACE_HEADERS_OK=no])
 175   if test "x$DTRACE_HEADERS_OK" != "xyes"; then
 176     DTRACE_DEP_MISSING=true
 177   fi
 178 
 179   AC_MSG_CHECKING([if dtrace should be built])
 180   if test "x$enable_dtrace" = "xyes"; then
 181     if test "x$DTRACE_DEP_MISSING" = "xtrue"; then
 182       AC_MSG_RESULT([no, missing dependencies])
 183       HELP_MSG_MISSING_DEPENDENCY([dtrace])
 184       AC_MSG_ERROR([Cannot enable dtrace with missing dependencies. See above. $HELP_MSG])
 185     else
 186       INCLUDE_DTRACE=true
 187       AC_MSG_RESULT([yes, forced])
 188     fi
 189   elif test "x$enable_dtrace" = "xno"; then
 190     INCLUDE_DTRACE=false
 191     AC_MSG_RESULT([no, forced])
 192   elif test "x$enable_dtrace" = "xauto" || test "x$enable_dtrace" = "x"; then
 193     if test "x$DTRACE_DEP_MISSING" = "xtrue"; then
 194       INCLUDE_DTRACE=false
 195       AC_MSG_RESULT([no, missing dependencies])
 196     else
 197       INCLUDE_DTRACE=true
 198       AC_MSG_RESULT([yes, dependencies present])
 199     fi
 200   else
 201     AC_MSG_ERROR([Invalid value for --enable-dtrace: $enable_dtrace])
 202   fi
 203 ])
 204 
 205 ################################################################################
 206 # Check if AOT should be enabled
 207 #
 208 AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_AOT],
 209 [
 210   AC_ARG_ENABLE([aot], [AS_HELP_STRING([--enable-aot@<:@=yes/no/auto@:>@],
 211       [enable ahead of time compilation feature. Default is auto, where aot is enabled if all dependencies are present.])])
 212 
 213   if test "x$enable_aot" = "x" || test "x$enable_aot" = "xauto"; then
 214     ENABLE_AOT="true"
 215   elif test "x$enable_aot" = "xyes"; then
 216     ENABLE_AOT="true"
 217   elif test "x$enable_aot" = "xno"; then
 218     ENABLE_AOT="false"
 219   else
 220     AC_MSG_ERROR([Invalid value for --enable-aot: $enable_aot])
 221   fi
 222 
 223   if test "x$ENABLE_AOT" = "xtrue"; then
 224     # Only enable AOT on X64 platforms.
 225     if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
 226       if test -e "${TOPDIR}/src/jdk.aot"; then
 227         if test -e "${TOPDIR}/src/jdk.internal.vm.compiler"; then
 228           ENABLE_AOT="true"
 229         else
 230           ENABLE_AOT="false"
 231           if test "x$enable_aot" = "xyes"; then
 232             AC_MSG_ERROR([Cannot build AOT without src/jdk.internal.vm.compiler sources. Remove --enable-aot.])
 233           fi
 234         fi
 235       else
 236         ENABLE_AOT="false"
 237         if test "x$enable_aot" = "xyes"; then
 238           AC_MSG_ERROR([Cannot build AOT without src/jdk.aot sources. Remove --enable-aot.])
 239         fi
 240       fi
 241     else
 242       ENABLE_AOT="false"
 243       if test "x$enable_aot" = "xyes"; then
 244         AC_MSG_ERROR([AOT is currently only supported on x86_64 and aarch64. Remove --enable-aot.])
 245       fi
 246     fi
 247   fi
 248 
 249   AC_SUBST(ENABLE_AOT)
 250 ])
 251 
 252 ################################################################################
 253 # Allow to disable CDS
 254 #
 255 AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_CDS],
 256 [
 257   AC_ARG_ENABLE([cds], [AS_HELP_STRING([--enable-cds@<:@=yes/no/auto@:>@],
 258       [enable class data sharing feature in non-minimal VM. Default is auto, where cds is enabled if supported on the platform.])])
 259 
 260   if test "x$enable_cds" = "x" || test "x$enable_cds" = "xauto"; then
 261     ENABLE_CDS="true"
 262   elif test "x$enable_cds" = "xyes"; then
 263     ENABLE_CDS="true"
 264   elif test "x$enable_cds" = "xno"; then
 265     ENABLE_CDS="false"
 266   else
 267     AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds])
 268   fi
 269 
 270   AC_SUBST(ENABLE_CDS)
 271 ])
 272 
 273 ###############################################################################
 274 # Set up all JVM features for each JVM variant.
 275 #
 276 AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
 277 [
 278   # Prettify the VALID_JVM_FEATURES string
 279   BASIC_SORT_LIST(VALID_JVM_FEATURES, $VALID_JVM_FEATURES)
 280 
 281   # The user can in some cases supply additional jvm features. For the custom
 282   # variant, this defines the entire variant.
 283   AC_ARG_WITH([jvm-features], [AS_HELP_STRING([--with-jvm-features],
 284       [JVM features to enable (foo) or disable (-foo), separated by comma. Use '--help' to show possible values @<:@none@:>@])])
 285   if test "x$with_jvm_features" != x; then
 286     AC_MSG_CHECKING([user specified JVM feature list])
 287     USER_JVM_FEATURE_LIST=`$ECHO $with_jvm_features | $SED -e 's/,/ /g'`
 288     AC_MSG_RESULT([$user_jvm_feature_list])
 289     # These features will be added to all variant defaults
 290     JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (!match($i, /^-.*/)) printf("%s ", $i) }'`
 291     # These features will be removed from all variant defaults
 292     DISABLED_JVM_FEATURES=`$ECHO $USER_JVM_FEATURE_LIST | $AWK '{ for (i=1; i<=NF; i++) if (match($i, /^-.*/)) printf("%s ", substr($i, 2))}'`
 293 
 294     # Verify that the user has provided valid features
 295     BASIC_GET_NON_MATCHING_VALUES(INVALID_FEATURES, $JVM_FEATURES $DISABLED_JVM_FEATURES, $VALID_JVM_FEATURES $DEPRECATED_JVM_FEATURES)
 296     if test "x$INVALID_FEATURES" != x; then
 297       AC_MSG_NOTICE([Unknown JVM features specified: "$INVALID_FEATURES"])
 298       AC_MSG_NOTICE([The available JVM features are: "$VALID_JVM_FEATURES"])
 299       AC_MSG_ERROR([Cannot continue])
 300     fi
 301 
 302     # Check if the user has provided deprecated features
 303     BASIC_GET_MATCHING_VALUES(DEPRECATED_FEATURES, $JVM_FEATURES $DISABLED_JVM_FEATURES, $DEPRECATED_JVM_FEATURES)
 304     if test "x$DEPRECATED_FEATURES" != x; then
 305       AC_MSG_WARN([Deprecated JVM features specified (will be ignored): "$DEPRECATED_FEATURES"])
 306       # Filter out deprecated features
 307       BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES, $JVM_FEATURES, $DEPRECATED_FEATURES)
 308       BASIC_GET_NON_MATCHING_VALUES(DISABLED_JVM_FEATURES, $DISABLED_JVM_FEATURES, $DEPRECATED_FEATURES)
 309     fi
 310 
 311   fi
 312 
 313   # Override hotspot cpu definitions for ARM platforms
 314   if test "x$OPENJDK_TARGET_CPU" = xarm; then
 315     HOTSPOT_TARGET_CPU=arm_32
 316     HOTSPOT_TARGET_CPU_DEFINE="ARM32"
 317   fi
 318 
 319   # Verify that dependencies are met for explicitly set features.
 320   if HOTSPOT_CHECK_JVM_FEATURE(jvmti) && ! HOTSPOT_CHECK_JVM_FEATURE(services); then
 321     AC_MSG_ERROR([Specified JVM feature 'jvmti' requires feature 'services'])
 322   fi
 323 
 324   if HOTSPOT_CHECK_JVM_FEATURE(management) && ! HOTSPOT_CHECK_JVM_FEATURE(nmt); then
 325     AC_MSG_ERROR([Specified JVM feature 'management' requires feature 'nmt'])
 326   fi
 327 
 328   if HOTSPOT_CHECK_JVM_FEATURE(jvmci) && ! (HOTSPOT_CHECK_JVM_FEATURE(compiler1) || HOTSPOT_CHECK_JVM_FEATURE(compiler2)); then
 329     AC_MSG_ERROR([Specified JVM feature 'jvmci' requires feature 'compiler2' or 'compiler1'])
 330   fi
 331 
 332   if HOTSPOT_CHECK_JVM_FEATURE(cmsgc) && ! HOTSPOT_CHECK_JVM_FEATURE(serialgc); then
 333     AC_MSG_ERROR([Specified JVM feature 'cmsgc' requires feature 'serialgc'])
 334   fi
 335 
 336   # Enable JFR by default, except for Zero, linux-sparcv9 and on minimal.
 337   if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
 338     if test "x$OPENJDK_TARGET_OS" != xaix; then
 339       if test "x$OPENJDK_TARGET_OS" != xlinux || test "x$OPENJDK_TARGET_CPU" != xsparcv9; then
 340         NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jfr"
 341       fi
 342     fi
 343   fi
 344 
 345   # Only enable Shenandoah on supported arches
 346   AC_MSG_CHECKING([if shenandoah can be built])
 347   # Temp diasable for Valhalla, working in Access API
 348   if $VALHALLA_TEMP && (test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86" || test "x$OPENJDK_TARGET_CPU" = "xaarch64"); then
 349     AC_MSG_RESULT([yes])
 350   else
 351     DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES shenandoahgc"
 352     AC_MSG_RESULT([no, platform not supported])
 353   fi
 354 
 355   # Only enable ZGC on supported platforms
 356   # Temp diasable for Valhalla, working in Access API
 357   AC_MSG_CHECKING([if zgc can be built])
 358   if $VALHALLA_TEMP && ((test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xx86_64") || \
 359      (test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64")); then
 360     AC_MSG_RESULT([yes])
 361   else
 362     DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES zgc"
 363     AC_MSG_RESULT([no, platform not supported])
 364   fi
 365 
 366   # Disable unsupported GCs for Zero
 367   if HOTSPOT_CHECK_JVM_VARIANT(zero); then
 368     DISABLED_JVM_FEATURES="$DISABLED_JVM_FEATURES epsilongc g1gc zgc shenandoahgc"
 369   fi
 370 
 371   # Turn on additional features based on other parts of configure
 372   if test "x$INCLUDE_DTRACE" = "xtrue"; then
 373     JVM_FEATURES="$JVM_FEATURES dtrace"
 374   else
 375     if HOTSPOT_CHECK_JVM_FEATURE(dtrace); then
 376       AC_MSG_ERROR([To enable dtrace, you must use --enable-dtrace])
 377     fi
 378   fi
 379 
 380   if test "x$STATIC_BUILD" = "xtrue"; then
 381     JVM_FEATURES="$JVM_FEATURES static-build"
 382   else
 383     if HOTSPOT_CHECK_JVM_FEATURE(static-build); then
 384       AC_MSG_ERROR([To enable static-build, you must use --enable-static-build])
 385     fi
 386   fi
 387 
 388   if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
 389     if HOTSPOT_CHECK_JVM_FEATURE(zero); then
 390       AC_MSG_ERROR([To enable zero, you must use --with-jvm-variants=zero])
 391     fi
 392   fi
 393 
 394   AC_MSG_CHECKING([if jvmci module jdk.internal.vm.ci should be built])
 395   # Check if jvmci is diabled
 396   if HOTSPOT_IS_JVM_FEATURE_DISABLED(jvmci); then
 397     AC_MSG_RESULT([no, forced])
 398     JVM_FEATURES_jvmci=""
 399     INCLUDE_JVMCI="false"
 400   else
 401     # Only enable jvmci on x86_64 and aarch64
 402     if test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
 403        test "x$OPENJDK_TARGET_CPU" = "xaarch64" ; then
 404       AC_MSG_RESULT([yes])
 405       JVM_FEATURES_jvmci="jvmci"
 406       INCLUDE_JVMCI="true"
 407     else
 408       AC_MSG_RESULT([no])
 409       JVM_FEATURES_jvmci=""
 410       INCLUDE_JVMCI="false"
 411       if HOTSPOT_CHECK_JVM_FEATURE(jvmci); then
 412         AC_MSG_ERROR([JVMCI is currently not supported on this platform.])
 413       fi
 414     fi
 415   fi
 416 
 417   AC_SUBST(INCLUDE_JVMCI)
 418 
 419   AC_MSG_CHECKING([if graal module jdk.internal.vm.compiler should be built])
 420   # Check if graal is diabled
 421   if HOTSPOT_IS_JVM_FEATURE_DISABLED(graal); then
 422     AC_MSG_RESULT([no, forced])
 423     JVM_FEATURES_graal=""
 424     INCLUDE_GRAAL="false"
 425   else
 426     if HOTSPOT_CHECK_JVM_FEATURE(graal); then
 427       AC_MSG_RESULT([yes, forced])
 428       if test "x$JVM_FEATURES_jvmci" != "xjvmci" ; then
 429         AC_MSG_ERROR([Specified JVM feature 'graal' requires feature 'jvmci'])
 430       fi
 431       JVM_FEATURES_graal="graal"
 432       INCLUDE_GRAAL="true"
 433     else
 434       # By default enable graal build on x64 or where AOT is available.
 435       # graal build requires jvmci.
 436       if test "x$JVM_FEATURES_jvmci" = "xjvmci" && \
 437           (test "x$OPENJDK_TARGET_CPU" = "xx86_64" || \
 438            test "x$ENABLE_AOT" = "xtrue") ; then
 439         AC_MSG_RESULT([yes])
 440         JVM_FEATURES_graal="graal"
 441         INCLUDE_GRAAL="true"
 442       else
 443         AC_MSG_RESULT([no])
 444         JVM_FEATURES_graal=""
 445         INCLUDE_GRAAL="false"
 446       fi
 447     fi
 448   fi
 449 
 450   AC_SUBST(INCLUDE_GRAAL)
 451 
 452   # Disable aot with '--with-jvm-features=-aot'
 453   if HOTSPOT_IS_JVM_FEATURE_DISABLED(aot); then
 454     ENABLE_AOT="false"
 455   fi
 456 
 457   AC_MSG_CHECKING([if aot should be enabled])
 458   if test "x$ENABLE_AOT" = "xtrue"; then
 459     if test "x$JVM_FEATURES_graal" != "xgraal"; then
 460       if test "x$enable_aot" = "xyes" || HOTSPOT_CHECK_JVM_FEATURE(aot); then
 461         AC_MSG_RESULT([yes, forced])
 462         AC_MSG_ERROR([Specified JVM feature 'aot' requires feature 'graal'])
 463       else
 464         AC_MSG_RESULT([no])
 465       fi
 466       JVM_FEATURES_aot=""
 467       ENABLE_AOT="false"
 468     else
 469       if test "x$enable_aot" = "xyes" || HOTSPOT_CHECK_JVM_FEATURE(aot); then
 470         AC_MSG_RESULT([yes, forced])
 471       else
 472         AC_MSG_RESULT([yes])
 473       fi
 474       JVM_FEATURES_aot="aot"
 475     fi
 476   else
 477     if test "x$enable_aot" = "xno" || HOTSPOT_IS_JVM_FEATURE_DISABLED(aot); then
 478       AC_MSG_RESULT([no, forced])
 479     else
 480       AC_MSG_RESULT([no])
 481     fi
 482     JVM_FEATURES_aot=""
 483     if HOTSPOT_CHECK_JVM_FEATURE(aot); then
 484       AC_MSG_ERROR([To enable aot, you must use --enable-aot])
 485     fi
 486   fi
 487 
 488   AC_SUBST(ENABLE_AOT)
 489 
 490   if test "x$OPENJDK_TARGET_CPU" = xarm ; then
 491     # Default to use link time optimizations on minimal on arm
 492     JVM_FEATURES_link_time_opt="link-time-opt"
 493   else
 494     JVM_FEATURES_link_time_opt=""
 495   fi
 496 
 497   # All variants but minimal (and custom) get these features
 498   NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cmsgc g1gc parallelgc serialgc epsilongc shenandoahgc jni-check jvmti management nmt services vm-structs zgc"
 499 
 500   # Disable CDS on AIX.
 501   if test "x$OPENJDK_TARGET_OS" = "xaix"; then
 502     ENABLE_CDS="false"
 503     if test "x$enable_cds" = "xyes"; then
 504       AC_MSG_ERROR([CDS is currently not supported on AIX. Remove --enable-cds.])
 505     fi
 506   fi
 507 
 508   # Disable CDS if user requested it with --with-jvm-features=-cds.
 509   if HOTSPOT_IS_JVM_FEATURE_DISABLED(cds); then
 510     ENABLE_CDS="false"
 511     if test "x$enable_cds" = "xyes"; then
 512       AC_MSG_ERROR([CDS was disabled by --with-jvm-features=-cds. Remove --enable-cds.])
 513     fi
 514   fi
 515 
 516   # Disable CDS for zero, minimal, core..
 517   if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(minimal) || HOTSPOT_CHECK_JVM_VARIANT(core); then
 518     # ..except when the user explicitely requested it with --enable-jvm-features
 519     if ! HOTSPOT_CHECK_JVM_FEATURE(cds); then
 520       ENABLE_CDS="false"
 521       if test "x$enable_cds" = "xyes"; then
 522         AC_MSG_ERROR([CDS not implemented for variants zero, minimal, core. Remove --enable-cds.])
 523       fi
 524     fi
 525   fi
 526 
 527   AC_MSG_CHECKING([if cds should be enabled])
 528   if test "x$ENABLE_CDS" = "xtrue"; then
 529     if test "x$enable_cds" = "xyes"; then
 530       AC_MSG_RESULT([yes, forced])
 531     else
 532       AC_MSG_RESULT([yes])
 533     fi
 534     NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds"
 535   else
 536     if test "x$enable_cds" = "xno"; then
 537       AC_MSG_RESULT([no, forced])
 538     else
 539       AC_MSG_RESULT([no])
 540     fi
 541   fi
 542 
 543   # Enable features depending on variant.
 544   JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal"
 545   JVM_FEATURES_client="compiler1 $NON_MINIMAL_FEATURES $JVM_FEATURES"
 546   JVM_FEATURES_core="$NON_MINIMAL_FEATURES $JVM_FEATURES"
 547   JVM_FEATURES_minimal="compiler1 minimal serialgc $JVM_FEATURES $JVM_FEATURES_link_time_opt"
 548   JVM_FEATURES_zero="zero $NON_MINIMAL_FEATURES $JVM_FEATURES"
 549   JVM_FEATURES_custom="$JVM_FEATURES"
 550 
 551   AC_SUBST(JVM_FEATURES_server)
 552   AC_SUBST(JVM_FEATURES_client)
 553   AC_SUBST(JVM_FEATURES_core)
 554   AC_SUBST(JVM_FEATURES_minimal)
 555   AC_SUBST(JVM_FEATURES_zero)
 556   AC_SUBST(JVM_FEATURES_custom)
 557 
 558   # Used for verification of Makefiles by check-jvm-feature
 559   AC_SUBST(VALID_JVM_FEATURES)
 560 
 561   # --with-cpu-port is no longer supported
 562   BASIC_DEPRECATED_ARG_WITH(with-cpu-port)
 563 ])
 564 
 565 ###############################################################################
 566 # Finalize JVM features once all setup is complete, including custom setup.
 567 #
 568 AC_DEFUN_ONCE([HOTSPOT_FINALIZE_JVM_FEATURES],
 569 [
 570   for variant in $JVM_VARIANTS; do
 571     AC_MSG_CHECKING([JVM features for JVM variant '$variant'])
 572     features_var_name=JVM_FEATURES_$variant
 573     JVM_FEATURES_FOR_VARIANT=${!features_var_name}
 574 
 575     # Filter out user-requested disabled features
 576     BASIC_GET_NON_MATCHING_VALUES(JVM_FEATURES_FOR_VARIANT, $JVM_FEATURES_FOR_VARIANT, $DISABLED_JVM_FEATURES)
 577 
 578     # Keep feature lists sorted and free of duplicates
 579     BASIC_SORT_LIST(JVM_FEATURES_FOR_VARIANT, $JVM_FEATURES_FOR_VARIANT)
 580 
 581     # Update real feature set variable
 582     eval $features_var_name='"'$JVM_FEATURES_FOR_VARIANT'"'
 583     AC_MSG_RESULT(["$JVM_FEATURES_FOR_VARIANT"])
 584 
 585     # Verify that we have at least one gc selected
 586     GC_FEATURES=`$ECHO $JVM_FEATURES_FOR_VARIANT | $GREP gc`
 587     if test "x$GC_FEATURES" = x; then
 588       AC_MSG_WARN([Invalid JVM features: No gc selected for variant $variant.])
 589     fi
 590 
 591     # Validate features (for configure script errors, not user errors)
 592     BASIC_GET_NON_MATCHING_VALUES(INVALID_FEATURES, $JVM_FEATURES_FOR_VARIANT, $VALID_JVM_FEATURES)
 593     if test "x$INVALID_FEATURES" != x; then
 594       AC_MSG_ERROR([Internal configure script error. Invalid JVM feature(s): $INVALID_FEATURES])
 595     fi
 596   done
 597 ])
 598 
 599 ################################################################################
 600 # Check if gtest should be built
 601 #
 602 AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_GTEST],
 603 [
 604   AC_ARG_ENABLE([hotspot-gtest], [AS_HELP_STRING([--disable-hotspot-gtest],
 605       [Disables building of the Hotspot unit tests @<:@enabled@:>@])])
 606 
 607   if test -e "${TOPDIR}/test/hotspot/gtest"; then
 608     GTEST_DIR_EXISTS="true"
 609   else
 610     GTEST_DIR_EXISTS="false"
 611   fi
 612 
 613   AC_MSG_CHECKING([if Hotspot gtest unit tests should be built])
 614   if test "x$enable_hotspot_gtest" = "xyes"; then
 615     if test "x$GTEST_DIR_EXISTS" = "xtrue"; then
 616       AC_MSG_RESULT([yes, forced])
 617       BUILD_GTEST="true"
 618     else
 619       AC_MSG_ERROR([Cannot build gtest without the test source])
 620     fi
 621   elif test "x$enable_hotspot_gtest" = "xno"; then
 622     AC_MSG_RESULT([no, forced])
 623     BUILD_GTEST="false"
 624   elif test "x$enable_hotspot_gtest" = "x"; then
 625     if test "x$GTEST_DIR_EXISTS" = "xtrue"; then
 626       AC_MSG_RESULT([yes])
 627       BUILD_GTEST="true"
 628     else
 629       AC_MSG_RESULT([no])
 630       BUILD_GTEST="false"
 631     fi
 632   else
 633     AC_MSG_ERROR([--enable-gtest must be either yes or no])
 634   fi
 635 
 636   AC_SUBST(BUILD_GTEST)
 637 ])