common/autoconf/jdk-options.m4
changeset 37035 08e00f202d7a
parent 36506 17612cee3530
child 37407 9a0927683faa
--- a/common/autoconf/jdk-options.m4	Fri Apr 15 14:57:53 2016 +0200
+++ b/common/autoconf/jdk-options.m4	Fri Apr 15 18:07:34 2016 +0200
@@ -408,7 +408,7 @@
 
 ################################################################################
 #
-# jlink options. 
+# jlink options.
 # We always keep packaged modules in JDK image.
 #
 AC_DEFUN_ONCE([JDKOPT_SETUP_JLINK_OPTIONS],
@@ -433,3 +433,42 @@
 
   AC_SUBST(JLINK_KEEP_PACKAGED_MODULES)
 ])
+
+################################################################################
+#
+# Check if building of the jtreg failure handler should be enabled.
+#
+AC_DEFUN_ONCE([JDKOPT_ENABLE_DISABLE_FAILURE_HANDLER],
+[
+  AC_ARG_ENABLE([jtreg-failure-handler], [AS_HELP_STRING([--enable-jtreg-failure-handler],
+    [forces build of the jtreg failure handler to be enabled, missing dependencies
+     become fatal errors. Default is auto, where the failure handler is built if all
+     dependencies are present and otherwise just disabled.])])
+
+  AC_MSG_CHECKING([if jtreg failure handler should be built])
+
+  if test "x$enable_jtreg_failure_handler" = "xyes"; then
+    if test "x$JT_HOME" = "x"; then
+      AC_MSG_ERROR([Cannot enable jtreg failure handler without jtreg.])
+    else
+      BUILD_FAILURE_HANDLER=true
+      AC_MSG_RESULT([yes, forced])
+    fi
+  elif test "x$enable_jtreg_failure_handler" = "xno"; then
+    BUILD_FAILURE_HANDLER=false
+    AC_MSG_RESULT([no, forced])
+  elif test "x$enable_jtreg_failure_handler" = "xauto" \
+      || test "x$enable_jtreg_failure_handler" = "x"; then
+    if test "x$JT_HOME" = "x"; then
+      BUILD_FAILURE_HANDLER=false
+      AC_MSG_RESULT([no, missing jtreg])
+    else
+      BUILD_FAILURE_HANDLER=true
+      AC_MSG_RESULT([yes, jtreg present])
+    fi
+  else
+    AC_MSG_ERROR([Invalid value for --enable-jtreg-failure-handler: $enable_jtreg_failure_handler])
+  fi
+
+  AC_SUBST(BUILD_FAILURE_HANDLER)
+])