make/autoconf/hotspot.m4
changeset 53434 ddfa4bfabdec
parent 53021 cc4098b3bc10
child 54669 ad45b3802d4e
--- a/make/autoconf/hotspot.m4	Tue Jan 22 15:31:47 2019 -0800
+++ b/make/autoconf/hotspot.m4	Tue Jan 22 18:13:30 2019 -0800
@@ -47,8 +47,8 @@
 [ [ [[ " $JVM_VARIANTS " =~ " $1 " ]] ] ])
 
 ###############################################################################
-# Check if the specified JVM features are explicitly enabled. To be used in
-# shell if constructs, like this:
+# Check if the specified JVM feature is enabled. To be used in shell if
+# constructs, like this:
 # if HOTSPOT_CHECK_JVM_FEATURE(jvmti); then
 #
 # Only valid to use after HOTSPOT_SETUP_JVM_FEATURES has setup features.
@@ -59,6 +59,20 @@
 [ [ [[ " $JVM_FEATURES " =~ " $1 " ]] ] ])
 
 ###############################################################################
+# Check if the specified JVM feature is explicitly disabled. To be used in
+# shell if constructs, like this:
+# if HOTSPOT_IS_JVM_FEATURE_DISABLED(jvmci); then
+#
+# This function is internal to hotspot.m4, and is only used when constructing
+# the valid set of enabled JVM features. Users outside of hotspot.m4 should just
+# use HOTSPOT_CHECK_JVM_FEATURE to check if a feature is enabled or not.
+
+# Definition kept in one line to allow inlining in if statements.
+# Additional [] needed to keep m4 from mangling shell constructs.
+AC_DEFUN([HOTSPOT_IS_JVM_FEATURE_DISABLED],
+[ [ [[ " $DISABLED_JVM_FEATURES " =~ " $1 " ]] ] ])
+
+###############################################################################
 # Check which variants of the JVM that we want to build. Available variants are:
 #   server: normal interpreter, and a tiered C1/C2 compiler
 #   client: normal interpreter, and C1 (no C2 compiler)
@@ -373,8 +387,7 @@
 
   AC_MSG_CHECKING([if jvmci module jdk.internal.vm.ci should be built])
   # Check if jvmci is diabled
-  DISABLE_JVMCI=`$ECHO $DISABLED_JVM_FEATURES | $GREP jvmci`
-  if test "x$DISABLE_JVMCI" = "xjvmci"; then
+  if HOTSPOT_IS_JVM_FEATURE_DISABLED(jvmci); then
     AC_MSG_RESULT([no, forced])
     JVM_FEATURES_jvmci=""
     INCLUDE_JVMCI="false"
@@ -400,8 +413,7 @@
 
   AC_MSG_CHECKING([if graal module jdk.internal.vm.compiler should be built])
   # Check if graal is diabled
-  DISABLE_GRAAL=`$ECHO $DISABLED_JVM_FEATURES | $GREP graal`
-  if test "x$DISABLE_GRAAL" = "xgraal"; then
+  if HOTSPOT_IS_JVM_FEATURE_DISABLED(graal); then
     AC_MSG_RESULT([no, forced])
     JVM_FEATURES_graal=""
     INCLUDE_GRAAL="false"
@@ -433,8 +445,7 @@
   AC_SUBST(INCLUDE_GRAAL)
 
   # Disable aot with '--with-jvm-features=-aot'
-  DISABLE_AOT=`$ECHO $DISABLED_JVM_FEATURES | $GREP aot`
-  if test "x$DISABLE_AOT" = "xaot"; then
+  if HOTSPOT_IS_JVM_FEATURE_DISABLED(aot); then
     ENABLE_AOT="false"
   fi
 
@@ -458,7 +469,7 @@
       JVM_FEATURES_aot="aot"
     fi
   else
-    if test "x$enable_aot" = "xno" || test "x$DISABLE_AOT" = "xaot"; then
+    if test "x$enable_aot" = "xno" || HOTSPOT_IS_JVM_FEATURE_DISABLED(aot); then
       AC_MSG_RESULT([no, forced])
     else
       AC_MSG_RESULT([no])
@@ -490,8 +501,7 @@
   fi
 
   # Disable CDS if user requested it with --with-jvm-features=-cds.
-  DISABLE_CDS=`$ECHO $DISABLED_JVM_FEATURES | $GREP cds`
-  if test "x$DISABLE_CDS" = "xcds"; then
+  if HOTSPOT_IS_JVM_FEATURE_DISABLED(cds); then
     ENABLE_CDS="false"
     if test "x$enable_cds" = "xyes"; then
       AC_MSG_ERROR([CDS was disabled by --with-jvm-features=-cds. Remove --enable-cds.])