/hg/icedtea6: 2 new changesets

andrew at icedtea.classpath.org andrew at icedtea.classpath.org
Tue Mar 20 06:35:29 PDT 2012


changeset ccdd6a1bd958 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=ccdd6a1bd958
author: Andrew John Hughes <ahughes at redhat.com>
date: Tue Mar 20 13:34:06 2012 +0000

	Bring compiler detection into line with other jdk tools and check java/javac work before running other macros.

	2012-03-20  Andrew John Hughes  <ahughes at redhat.com>

		* acinclude.m4:
		(IT_FIND_COMPILER): Define only once and
		rename from IT_FIND_JAVAC.
		(IT_FIND_ECJ): Use same form as detection
		for java, javah, jar and rmic.
		(IT_FIND_JAVAC): Likewise.
		(IT_CHECK_JAVA_AND_JAVAC_WORK): New macro to check
		java and javac actually work together to compile code
		before running other tests such as the dtdtype one.
		(IT_CHECK_FOR_CLASS): Depend on java/javac working.
		(IT_CHECK_IF_INSTANTIABLE): Likewise.
		(IT_GETDTDTYPE_CHECK): Likewise.  Add -target 5.
		(IT_JAVAH): Depend on java/javac working.
		* configure.ac: Invoke IT_FIND_COMPILER rather than
		IT_FIND_JAVAC.


changeset f4bcb05229c9 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=f4bcb05229c9
author: Andrew John Hughes <ahughes at redhat.com>
date: Tue Mar 20 13:35:23 2012 +0000

	Merge


diffstat:

 ChangeLog    |   22 ++++++++
 Makefile.am  |    2 +-
 acinclude.m4 |  149 +++++++++++++++++++++++++++++++++++++---------------------
 configure.ac |    2 +-
 4 files changed, 119 insertions(+), 56 deletions(-)

diffs (289 lines):

diff -r af04fa17f62f -r f4bcb05229c9 ChangeLog
--- a/ChangeLog	Tue Mar 20 10:43:41 2012 +0000
+++ b/ChangeLog	Tue Mar 20 13:35:23 2012 +0000
@@ -1,3 +1,25 @@
+2012-03-20  Mark Wielaard  <mjw at redhat.com>
+
+	* Makefile.am (clean-jtreg): Depend on clean-jtreg-reports.
+
+2012-03-20  Andrew John Hughes  <ahughes at redhat.com>
+
+	* acinclude.m4:
+	(IT_FIND_COMPILER): Define only once and
+	rename from IT_FIND_JAVAC.
+	(IT_FIND_ECJ): Use same form as detection
+	for java, javah, jar and rmic.
+	(IT_FIND_JAVAC): Likewise.
+	(IT_CHECK_JAVA_AND_JAVAC_WORK): New macro to check
+	java and javac actually work together to compile code
+	before running other tests such as the dtdtype one.
+	(IT_CHECK_FOR_CLASS): Depend on java/javac working.
+	(IT_CHECK_IF_INSTANTIABLE): Likewise.
+	(IT_GETDTDTYPE_CHECK): Likewise.  Add -target 5.
+	(IT_JAVAH): Depend on java/javac working.
+	* configure.ac: Invoke IT_FIND_COMPILER rather than
+	IT_FIND_JAVAC.
+
 2012-03-19  Andrew John Hughes  <ahughes at redhat.com>
 
 	* acinclude.m4:
diff -r af04fa17f62f -r f4bcb05229c9 Makefile.am
--- a/Makefile.am	Tue Mar 20 10:43:41 2012 +0000
+++ b/Makefile.am	Tue Mar 20 13:35:23 2012 +0000
@@ -2157,7 +2157,7 @@
 	mkdir -p stamps
 	touch $@
 
-clean-jtreg:
+clean-jtreg: clean-jtreg-reports
 	rm -rf test/jtreg/classes
 	if [ -e test/jtreg ] ; then \
 	  rmdir test/jtreg ; \
diff -r af04fa17f62f -r f4bcb05229c9 acinclude.m4
--- a/acinclude.m4	Tue Mar 20 10:43:41 2012 +0000
+++ b/acinclude.m4	Tue Mar 20 13:35:23 2012 +0000
@@ -129,49 +129,46 @@
   AC_SUBST(OS_PATH)
 ])
 
-AC_DEFUN([IT_FIND_JAVAC],
+AC_DEFUN_ONCE([IT_FIND_COMPILER],
 [
-  JAVAC=${SYSTEM_JDK_DIR}/bin/javac
   IT_FIND_JAVAC
   IT_FIND_ECJ
 
-  AC_SUBST(JAVAC)
-])
-
-AC_DEFUN([IT_FIND_ECJ],
-[
-  AC_ARG_WITH([ecj],
-	      [AS_HELP_STRING(--with-ecj,bytecode compilation with ecj)],
-  [
-    if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
-      IT_CHECK_ECJ(${withval})
-    else
-      if test "x${withval}" != xno; then
-        IT_CHECK_ECJ
-      fi
-    fi
-  ],
-  [ 
-    IT_CHECK_ECJ
-  ])
   if test "x${JAVAC}" = "x"; then
     if test "x{ECJ}" != "x"; then
       JAVAC="${ECJ} -nowarn"
     fi
   fi
+  AC_SUBST(ECJ)
+  AC_SUBST(JAVAC)
 ])
 
-AC_DEFUN([IT_CHECK_ECJ],
+AC_DEFUN_ONCE([IT_FIND_ECJ],
 [
-  if test "x$1" != x; then
-    if test -f "$1"; then
-      AC_MSG_CHECKING(for ecj)
-      ECJ="$1"
-      AC_MSG_RESULT(${ECJ})
+  ECJ_DEFAULT=/usr/bin/ecj
+  AC_MSG_CHECKING([if an ecj binary was specified])
+  AC_ARG_WITH([ecj],
+	      [AS_HELP_STRING(--with-ecj,bytecode compilation with ecj)],
+  [
+    if test "x${withval}" = "xyes"; then
+      ECJ=no
     else
-      AC_PATH_PROG(ECJ, "$1")
+      ECJ="${withval}"
     fi
+  ],
+  [ 
+    ECJ=no
+  ])
+  AC_MSG_RESULT(${ECJ})
+  if test "x${ECJ}" = "xno"; then
+    ECJ=${ECJ_DEFAULT}
+  fi
+  AC_MSG_CHECKING([if $ECJ is a valid executable file])
+  if test -x "${ECJ}" && test -f "${ECJ}"; then
+    AC_MSG_RESULT([yes])
   else
+    AC_MSG_RESULT([no])
+    ECJ=""
     AC_PATH_PROG(ECJ, "ecj")
     if test -z "${ECJ}"; then
       AC_PATH_PROG(ECJ, "ecj-3.1")
@@ -182,43 +179,45 @@
     if test -z "${ECJ}"; then
       AC_PATH_PROG(ECJ, "ecj-3.3")
     fi
+    if test -z "${ECJ}"; then
+      AC_PATH_PROG(ECJ, "ecj-3.4")
+    fi
   fi
 ])
 
-AC_DEFUN([IT_FIND_JAVAC],
+AC_DEFUN_ONCE([IT_FIND_JAVAC],
 [
+  JAVAC_DEFAULT=${SYSTEM_JDK_DIR}/bin/javac
+  AC_MSG_CHECKING([if a javac binary was specified])
   AC_ARG_WITH([javac],
 	      [AS_HELP_STRING(--with-javac,bytecode compilation with javac)],
   [
-    if test "x${withval}" != x && test "x${withval}" != xyes && test "x${withval}" != xno; then
-      IT_CHECK_JAVAC(${withval})
+    if test "x${withval}" = "xyes"; then
+      JAVAC=no
     else
-      if test "x${withval}" != xno; then
-        IT_CHECK_JAVAC
-      fi
+      JAVAC="${withval}"
     fi
   ],
-  [ 
-    IT_CHECK_JAVAC
+  [
+    JAVAC=no
+  ])
+  AC_MSG_RESULT(${JAVAC})
+  if test "x${JAVAC}" = "xno"; then
+    JAVAC=${JAVAC_DEFAULT}
+  fi
+  AC_MSG_CHECKING([if $JAVAC is a valid executable file])
+  if test -x "${JAVAC}" && test -f "${JAVAC}"; then
+    AC_MSG_RESULT([yes])
+  else
+    AC_MSG_RESULT([no])
+    JAVAC=""
+    AC_PATH_PROG(JAVAC, "javac")
+  fi
+  AC_SUBST(JAVAC)
   ])
 ])
 
-AC_DEFUN([IT_CHECK_JAVAC],
-[
-  if test "x$1" != x; then
-    if test -f "$1"; then
-      AC_MSG_CHECKING(for javac)
-      JAVAC="$1"
-      AC_MSG_RESULT(${JAVAC})
-    else
-      AC_PATH_PROG(JAVAC, "$1")
-    fi
-  else
-    AC_PATH_PROG(JAVAC, "javac")
-  fi
-])
-
-AC_DEFUN([IT_FIND_JAVA],
+AC_DEFUN_ONCE([IT_FIND_JAVA],
 [
   JAVA_DEFAULT=${SYSTEM_JDK_DIR}/bin/java
   AC_MSG_CHECKING([if a java binary was specified])
@@ -1241,6 +1240,44 @@
 fi
 ])
 
+dnl check that javac and java work
+AC_DEFUN_ONCE([IT_CHECK_JAVA_AND_JAVAC_WORK],[
+  AC_REQUIRE([IT_FIND_JAVA])
+  AC_REQUIRE([IT_FIND_COMPILER])
+  AC_CACHE_CHECK([if the VM and compiler work together], it_cv_jdk_works, [
+  CLASS=Test.java
+  BYTECODE=$(echo $CLASS|sed 's#\.java##')
+  mkdir tmp.$$
+  cd tmp.$$
+  cat << \EOF > $CLASS
+[/* [#]line __oline__ "configure" */
+
+public class Test
+{
+    public static void main(String[] args)
+    {
+      System.out.println("Hello World!");
+    }
+}]
+EOF
+  if $JAVAC -cp . $JAVACFLAGS -source 5 -target 5 $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then
+    if $JAVA -classpath . $BYTECODE >&AS_MESSAGE_LOG_FD 2>&1; then
+      it_cv_jdk_works=yes;
+    else
+      it_cv_jdk_works=no;
+      AC_MSG_ERROR([VM failed to run compiled class.])
+    fi
+  else
+    it_cv_jdk_works=no;
+    AC_MSG_ERROR([Compiler failed to compile Java code.])
+  fi
+  rm -f $CLASS *.class
+  cd ..
+  rmdir tmp.$$
+  ])
+AC_PROVIDE([$0])dnl
+])
+
 dnl Generic macro to check for a Java class
 dnl Takes two arguments: the name of the macro
 dnl and the name of the class.  The macro name
@@ -1248,6 +1285,7 @@
 dnl replaced by '_' and all letters capitalised.
 dnl e.g. IT_CHECK_FOR_CLASS([JAVA_UTIL_SCANNER],[java.util.Scanner])
 AC_DEFUN([IT_CHECK_FOR_CLASS],[
+AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK])
 AC_CACHE_CHECK([if $2 is missing], it_cv_$1, [
 CLASS=Test.java
 BYTECODE=$(echo $CLASS|sed 's#\.java##')
@@ -1291,6 +1329,7 @@
 dnl e.g. IT_CHECK_FOR_INSTANTIABLE_CLASS([JAVA_LANG_INTEGER],
 dnl        [java.lang.Integer],[0],[./bin])
 AC_DEFUN([IT_CHECK_IF_INSTANTIABLE],[
+AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK])
 AC_CACHE_CHECK([if $2 is instantiable], it_cv_$1, [
 CLASS=Test.java
 BYTECODE=$(echo $CLASS|sed 's#\.java##')
@@ -1350,7 +1389,8 @@
   AC_PROVIDE([$0])dnl
 ])
 
-AC_DEFUN([IT_GETDTDTYPE_CHECK],[
+AC_DEFUN_ONCE([IT_GETDTDTYPE_CHECK],[
+  AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK])
   AC_CACHE_CHECK([if javax.xml.stream.events.Attribute.getDTDType() wrongly returns a QName], it_cv_dtdtype, [
   CLASS=Test.java
   BYTECODE=$(echo $CLASS|sed 's#\.java##')
@@ -1407,7 +1447,7 @@
     }
 }]
 EOF
-  if $JAVAC -cp . $JAVACFLAGS -source 5 $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then
+  if $JAVAC -cp . $JAVACFLAGS -source 5 -target 5 $CLASS >&AS_MESSAGE_LOG_FD 2>&1; then
     if $JAVA -classpath . $BYTECODE >&AS_MESSAGE_LOG_FD 2>&1; then
       it_cv_dtdtype=no;
     else
@@ -1672,6 +1712,7 @@
 ])
 
 AC_DEFUN([IT_JAVAH],[
+AC_REQUIRE([IT_CHECK_JAVA_AND_JAVAC_WORK])
 AC_CACHE_CHECK([if $JAVAH exhibits Classpath bug 39408], it_cv_cp39408_javah, [
 SUPERCLASS=Test.java
 SUBCLASS=TestImpl.java
diff -r af04fa17f62f -r f4bcb05229c9 configure.ac
--- a/configure.ac	Tue Mar 20 10:43:41 2012 +0000
+++ b/configure.ac	Tue Mar 20 13:35:23 2012 +0000
@@ -144,7 +144,7 @@
 IT_CHECK_IF_BOOTSTRAPPING
 IT_CHECK_FOR_JDK
 IT_FIND_JAVA
-IT_FIND_JAVAC
+IT_FIND_COMPILER
 IT_FIND_JAVAH
 IT_FIND_JAR
 IT_FIND_RMIC



More information about the distro-pkg-dev mailing list