Date: Fri, 9 Jun 2023 11:28:19 +0800
Subject: [PATCH 46/59] 8210960: Allow --with-boot-jdk-jvmargs to work during configure

Bug url: https://bugs.openjdk.org/browse/JDK-8210960
---
 common/autoconf/basics.m4              |   2 +-
 common/autoconf/boot-jdk.m4            |  28 +-
 common/autoconf/generated-configure.sh | 506 ++++++++++++++++++++++---
 3 files changed, 483 insertions(+), 53 deletions(-)

diff --git a/common/autoconf/basics.m4 b/common/autoconf/basics.m4
index 692ef831a..d80e7edad 100644
--- a/common/autoconf/basics.m4
+++ b/common/autoconf/basics.m4
@@ -30,7 +30,7 @@ AC_DEFUN([ADD_JVM_ARG_IF_OK],
 [
   $ECHO "Check if jvm arg is ok: $1" >&AS_MESSAGE_LOG_FD
   $ECHO "Command: $3 $1 -version" >&AS_MESSAGE_LOG_FD
-  OUTPUT=`$3 $1 -version 2>&1`
+  OUTPUT=`$3 $1 $USER_BOOT_JDK_OPTIONS -version 2>&1`
   FOUND_WARN=`$ECHO "$OUTPUT" | grep -i warn`
   FOUND_VERSION=`$ECHO $OUTPUT | grep " version \""`
   if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
index 5be15b869..f86f07644 100644
--- a/common/autoconf/boot-jdk.m4
+++ b/common/autoconf/boot-jdk.m4
@@ -51,7 +51,18 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
+            if [ [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ]; then
+              AC_MSG_NOTICE([You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead.])
+              AC_MSG_NOTICE([Java reports: "$BOOT_JDK_VERSION".])
+              AC_MSG_ERROR([Cannot continue])
+            fi
+            if [ [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ]; then
+              AC_MSG_NOTICE([The specified --with-boot-jdk-jvmargs is invalid for the tested java])
+              AC_MSG_NOTICE([Error message: "$BOOT_JDK_VERSION".])
+              AC_MSG_NOTICE([Please fix arguments, or point to an explicit boot JDK which accept these arguments])
+              AC_MSG_ERROR([Cannot continue])
+            fi
 
             # Extra M4 quote needed to protect [] in grep expression.
             [FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`]
@@ -66,7 +77,7 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
               AC_MSG_CHECKING([for Boot JDK])
               AC_MSG_RESULT([$BOOT_JDK])
               AC_MSG_CHECKING([Boot JDK version])
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               AC_MSG_RESULT([$BOOT_JDK_VERSION])
             fi # end check jdk version
           fi # end check rt.jar
@@ -222,6 +233,11 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
   AC_ARG_WITH(boot-jdk, [AS_HELP_STRING([--with-boot-jdk],
       [path to Boot JDK (used to bootstrap build) @<:@probed@:>@])])
 
+  AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs],
+  [specify additional arguments to be passed to Boot JDK tools @<:@none@:>@])])
+
+  USER_BOOT_JDK_OPTIONS="$with_boot_jdk_jvmargs"
+
   # We look for the Boot JDK through various means, going from more certain to
   # more of a guess-work. After each test, BOOT_JDK_FOUND is set to "yes" if
   # we detected something (if so, the path to the jdk is in BOOT_JDK). But we
@@ -307,17 +323,13 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK_ARGUMENTS],
   #
   # Specify options for anything that is run with the Boot JDK.
   #
-  AC_ARG_WITH(boot-jdk-jvmargs, [AS_HELP_STRING([--with-boot-jdk-jvmargs],
-  [specify JVM arguments to be passed to all invocations of the Boot JDK, overriding the default values,
-  e.g --with-boot-jdk-jvmargs="-Xmx8G -enableassertions"])])
-
   AC_MSG_CHECKING([flags for boot jdk java command] )
 
   # Disable special log output when a debug build is used as Boot JDK...
   ADD_JVM_ARG_IF_OK([-XX:-PrintVMOptions -XX:-UnlockDiagnosticVMOptions -XX:-LogVMOutput],boot_jdk_jvmargs,[$JAVA])
 
-  # Apply user provided options.
-  ADD_JVM_ARG_IF_OK([$with_boot_jdk_jvmargs],boot_jdk_jvmargs,[$JAVA])
+  # Finally append user provided options to allow them to override.
+  ADD_JVM_ARG_IF_OK([$USER_BOOT_JDK_OPTIONS],boot_jdk_jvmargs,[$JAVA])
 
   AC_MSG_RESULT([$boot_jdk_jvmargs])
 
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 3a622dee8..a7f76a15c 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -20447,10 +20447,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -20599,7 +20618,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -20790,10 +20809,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -20942,7 +20980,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -21130,10 +21168,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -21282,7 +21339,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -21329,10 +21386,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -21481,7 +21557,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -21668,10 +21744,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -21820,7 +21915,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -21894,10 +21989,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -22046,7 +22160,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -22085,10 +22199,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -22237,7 +22370,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -22304,10 +22437,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -22456,7 +22608,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -22495,10 +22647,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -22647,7 +22818,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -22714,10 +22885,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -22866,7 +23056,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -22905,10 +23095,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -23057,7 +23266,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -23124,10 +23333,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -23276,7 +23504,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -23315,10 +23543,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -23467,7 +23714,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -23521,10 +23768,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -23673,7 +23939,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -23710,10 +23976,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -23862,7 +24147,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -23917,10 +24202,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -24069,7 +24373,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -24106,10 +24410,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -24258,7 +24581,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -24312,10 +24635,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -24464,7 +24806,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -24501,10 +24843,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -24653,7 +25014,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -24708,10 +25069,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -24860,7 +25240,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -24897,10 +25277,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -25049,7 +25448,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
@@ -25085,10 +25484,29 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.ja
             BOOT_JDK_FOUND=no
           else
             # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | head -n 1`
 
             # Extra M4 quote needed to protect [] in grep expression.
             FOUND_VERSION_78=`echo $BOOT_JDK_VERSION | grep  '\"1\.[78]\.'`
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Picked up" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&5
+  $as_echo "$as_me: You have _JAVA_OPTIONS or JAVA_TOOL_OPTIONS set. This can mess up the build. Please use --with-boot-jdk-jvmargs instead." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Java reports: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Java reports: \"$BOOT_JDK_VERSION\"." >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
+            if  [[ "$BOOT_JDK_VERSION" =~ "Unrecognized option" ]] ; then
+              { $as_echo "$as_me:${as_lineno-$LINENO}: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&5
+  $as_echo "$as_me: The specified --with-boot-jdk-jvmargs is invalid for the tested java" >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Error message: \"$BOOT_JDK_VERSION\"." >&5
+  $as_echo "$as_me: Error message: \"$BOOT_JDK_VERSION\"." >&6;}
+              { $as_echo "$as_me:${as_lineno-$LINENO}: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&5
+  $as_echo "$as_me: Please fix arguments, or point to an explicit boot JDK which accept these arguments" >&6;}
+              as_fn_error $? "Cannot continue" "$LINENO" 5
+            fi
+
             if test "x$FOUND_VERSION_78" = x; then
               { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
 $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
@@ -25237,7 +25655,7 @@ $as_echo_n "checking for Boot JDK... " >&6; }
 $as_echo "$BOOT_JDK" >&6; }
               { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" $USER_BOOT_JDK_OPTIONS -version 2>&1 | $TR '\n\r' '  '`
               { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
             fi # end check jdk version
-- 
2.22.0

