changeset 2869:9f996c284c84

PR2929: configure: error: "A JDK home directory could not be found." 2016-04-21 Andrew John Hughes <gnu.andrew@member.fsf.org> PR2929: configure: error: "A JDK home directory could not be found." * NEWS: Updated. * acinclude.m4: (IT_FIND_RHINO_JAR): Refactor to be more verbose and helpful to the user. (IT_CHECK_FOR_JDK): Point user to the configure option if we fail to find the JDK.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Fri, 22 Apr 2016 02:46:06 +0100
parents e5af5822ea90
children 208625aa1530
files ChangeLog NEWS acinclude.m4
diffstat 3 files changed, 57 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Apr 21 23:27:41 2016 +0100
+++ b/ChangeLog	Fri Apr 22 02:46:06 2016 +0100
@@ -1,3 +1,14 @@
+2016-04-21  Andrew John Hughes  <gnu.andrew@member.fsf.org>
+
+	PR2929: configure: error: "A JDK home directory
+	could not be found."
+	* NEWS: Updated.
+	* acinclude.m4:
+	(IT_FIND_RHINO_JAR): Refactor to be more
+	verbose and helpful to the user.
+	(IT_CHECK_FOR_JDK): Point user to the
+	configure option if we fail to find the JDK.
+
 2016-04-20  Andrew John Hughes  <gnu.andrew@member.fsf.org>
 
 	PR2665: icedtea/jamvm 2.6 fails as a
--- a/NEWS	Thu Apr 21 23:27:41 2016 +0100
+++ b/NEWS	Fri Apr 22 02:46:06 2016 +0100
@@ -18,6 +18,7 @@
   - S8076221, PR2809: Disable RC4 cipher suites
 * Bug fixes
   - PR2889: OpenJDK should check for system cacerts database (e.g. /etc/pki/java/cacerts)
+  - PR2929: configure: error: "A JDK home directory could not be found."
 * AArch64 port
   - PR2914: byte_map_base is not page aligned on OpenJDK 7
 * JamVM
--- a/acinclude.m4	Thu Apr 21 23:27:41 2016 +0100
+++ b/acinclude.m4	Fri Apr 22 02:46:06 2016 +0100
@@ -602,43 +602,62 @@
   [
     case "${withval}" in
       yes)
-	RHINO_JAR=yes
+	RHINO_RESULT=yes
         ;;
       no)
-        RHINO_JAR=no
+        RHINO_RESULT=no
         ;;
       *)
-    	if test -f "${withval}"; then
-          RHINO_JAR="${withval}"
-        else
-	  AC_MSG_RESULT([not found])
-          AC_MSG_ERROR("The rhino jar ${withval} was not found.")
-        fi
+	RHINO_RESULT=yes
+        RHINO_JAR="${withval}"
 	;;
      esac
   ],
   [
-    RHINO_JAR=yes
+    RHINO_RESULT=yes
   ])
-  if test x"${RHINO_JAR}" = "xyes"; then
-    if test -e "/usr/share/java/rhino.jar"; then
-      RHINO_JAR=/usr/share/java/rhino.jar
-    elif test -e "/usr/share/java/js.jar"; then
-      RHINO_JAR=/usr/share/java/js.jar
-    elif test -e "/usr/share/rhino-1.6/lib/js.jar"; then
-      RHINO_JAR=/usr/share/rhino-1.6/lib/js.jar
+  AC_MSG_RESULT([$RHINO_RESULT])
+  if test "x${RHINO_RESULT}" = "xyes"; then
+    if test "x${RHINO_JAR}" != x; then
+      AC_MSG_CHECKING([if ${RHINO_JAR} is a valid JAR file])
+      if test -f ${RHINO_JAR}; then
+      	 AC_MSG_RESULT([yes])
+      else
+	 AC_MSG_RESULT([no])
+	 RHINO_JAR=
+      fi
     fi
-    if test x"${RHINO_JAR}" = "xyes"; then
-      AC_MSG_RESULT([not found])
-      AC_MSG_ERROR("A rhino jar was not found in /usr/share/java as either rhino.jar or js.jar.")
+    if test "x${RHINO_JAR}" = x; then
+      RHINO_JAR="/usr/share/java/rhino.jar"
+      AC_MSG_CHECKING([if ${RHINO_JAR} is a valid JAR file])
+      if test -f ${RHINO_JAR}; then
+        AC_MSG_RESULT([yes])
+      else
+        AC_MSG_RESULT([no])
+	RHINO_JAR="/usr/share/java/js.jar"
+      	AC_MSG_CHECKING([if ${RHINO_JAR} is a valid JAR file])
+      	if test -f ${RHINO_JAR}; then
+      	  AC_MSG_RESULT([yes])
+      	else
+	  AC_MSG_RESULT([no])
+	  RHINO_JAR="/usr/share/rhino-1.6/lib/js.jar"
+      	  AC_MSG_CHECKING([if ${RHINO_JAR} is a valid JAR file])
+      	  if test -f ${RHINO_JAR}; then
+      	    AC_MSG_RESULT([yes])
+      	  else
+	    AC_MSG_RESULT([no])
+	    RHINO_JAR=
+	  fi
+        fi
+      fi
+    fi
+    if test x"${RHINO_JAR}" = "x"; then
+      AC_MSG_ERROR([A Rhino JAR could not be found; specify one using --with-rhino=jar=<FILE> or use --without-rhino.])
+    else
+      AC_MSG_NOTICE([Using Rhino JAR: ${RHINO_JAR}])
     fi
   fi
-  AC_MSG_RESULT(${RHINO_JAR})
-  AM_CONDITIONAL(WITH_RHINO, test x"${RHINO_JAR}" != "xno")
-dnl Clear RHINO_JAR if it doesn't contain a valid filename
-  if test x"${RHINO_JAR}" = "xno"; then
-    RHINO_JAR=
-  fi
+  AM_CONDITIONAL(WITH_RHINO, test x"${RHINO_JAR}" != "x")
   AC_SUBST(RHINO_JAR)
 ])
 
@@ -1160,7 +1179,7 @@
     AC_MSG_RESULT(${SYSTEM_JDK_DIR})
   fi
   if ! test -d "${SYSTEM_JDK_DIR}"; then
-    AC_MSG_ERROR("A JDK home directory could not be found.")
+    AC_MSG_ERROR("A JDK home directory could not be found. Try specifying one using --with-jdk-home=<DIR>")
   fi
   AC_SUBST(SYSTEM_JDK_DIR)
 ])