This patch changes the AC_PROG_JAVA, AC_PROG_JAVAC, AC_PROG_JAVA_WORKS
and AC_PROG_JAVAC_WORKS macros so that they are defined only once and
dependent macros AC_REQUIRE their dependencies rather than their
dependencies including them.  This simplifies configure and prevents
the same tests being run multiple times.

2010-05-04  Andrew John Hughes  <ahug...@redhat.com>

        * configure.ac:
        Call AC_PROG_JAVA_WORKS and AC_PROG_JAVAC_WORKS
        in place of AC_PROG_JAVA and AC_PROG_JAVAC
        respectively, as this is the real test we want.
        * m4/ac_prog_java.m4:
        (AC_PROG_JAVA): Don't include AC_PROG_JAVA_WORKS.
        * m4/ac_prog_java_works.m4:
        (AC_PROG_JAVA_WORKS): Require AC_PROG_JAVA and be
        defined only once.  Require AC_PROG_JAVAC_WORKS for
        compilation of test class.  Remove inclusion of
        AC_PROG_JAVAC.
        (AC_TRY_COMPILE_JAVA): Require AC_PROG_JAVAC_WORKS
        rather than AC_PROG_JAVAC.  Be defined only once.
        * m4/ac_prog_javac.m:
        (AC_PROG_JAVAC): Be defined only once.  Don't include
        AC_PROG_JAVAC_WORKS.
        * m4/ac_prog_javac_works.m4:
        (AC_PROG_JAVAC_WORKS): Be defined only once.  Require
        AC_PROG_JAVAC.
--
Andrew :)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net
PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint = F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
Index: configure.ac
===================================================================
RCS file: /sources/classpath/classpath/configure.ac,v
retrieving revision 1.246
diff -u -u -r1.246 configure.ac
--- configure.ac        4 May 2010 12:29:23 -0000       1.246
+++ configure.ac        5 May 2010 15:43:52 -0000
@@ -974,7 +974,7 @@
 
 if test "x${TOOLSDIR}" != x; then
   if test "x${COMPILE_WRAPPERS}" = xno; then
-    AC_PROG_JAVA
+    AC_PROG_JAVA_WORKS
   fi
   if test "x${COMPILE_GJDOC}" = xyes; then
     AC_LIB_ANTLR
@@ -990,7 +990,7 @@
    test "x${EXAMPLESDIR}" != x || \
    test "x${TOOLSDIR}" != x && \
    test "x${build_class_files}" != xno; then   
-       AC_PROG_JAVAC
+       AC_PROG_JAVAC_WORKS
        CLASSPATH_JAVAC_MEM_CHECK
 fi
 
Index: m4/ac_prog_java.m4
===================================================================
RCS file: /sources/classpath/classpath/m4/ac_prog_java.m4,v
retrieving revision 1.3
diff -u -u -r1.3 ac_prog_java.m4
--- m4/ac_prog_java.m4  5 Oct 2008 21:19:19 -0000       1.3
+++ m4/ac_prog_java.m4  5 May 2010 15:43:58 -0000
@@ -12,6 +12,5 @@
         test "x$JAVA" = x && AC_CHECK_PROGS(JAVA, cacao$EXEEXT jamvm$EXEEXT 
kaffe$EXEEXT gij$EXEEXT java$EXEEXT, $JAVAPREFIX)
 fi
 test "x$JAVA" = x && AC_MSG_ERROR([no acceptable Java virtual machine found in 
\$PATH])
-AC_PROG_JAVA_WORKS
 AC_PROVIDE([$0])dnl
 ])
Index: m4/ac_prog_java_works.m4
===================================================================
RCS file: /sources/classpath/classpath/m4/ac_prog_java_works.m4,v
retrieving revision 1.1
diff -u -u -r1.1 ac_prog_java_works.m4
--- m4/ac_prog_java_works.m4    27 May 2008 19:25:32 -0000      1.1
+++ m4/ac_prog_java_works.m4    5 May 2010 15:43:58 -0000
@@ -1,7 +1,8 @@
 dnl Available from the GNU Autoconf Macro Archive at:
 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_prog_java_works.html
 dnl
-AC_DEFUN([AC_PROG_JAVA_WORKS], [
+AC_DEFUN_ONCE([AC_PROG_JAVA_WORKS], [
+AC_REQUIRE([AC_PROG_JAVA])
 AC_CHECK_PROG(uudecode, uudecode$EXEEXT, yes)
 if test x$uudecode = xyes; then
 AC_CACHE_CHECK([if uudecode can decode base 64 file], 
ac_cv_prog_uudecode_base64, [
@@ -45,9 +46,6 @@
         if test x$ac_cv_prog_javac_works = xno; then
                 AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work 
properly])
         fi
-        if test x$ac_cv_prog_javac_works = x; then
-                AC_PROG_JAVAC
-        fi
 fi
 AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [
 JAVA_TEST=Test.java
@@ -63,6 +61,7 @@
 EOF
 changequote([, ])dnl
 if test x$ac_cv_prog_uudecode_base64 != xyes; then
+       AC_REQUIRE([AC_PROG_JAVAC_WORKS])
         if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s 
$CLASS_TEST; then
                 :
         else
@@ -86,8 +85,8 @@
 dnl Available from the GNU Autoconf Macro Archive at:
 dnl http://www.gnu.org/software/ac-archive/htmldoc/ac_try_compile_java.html
 dnl
-AC_DEFUN([AC_TRY_COMPILE_JAVA],[
-AC_REQUIRE([AC_PROG_JAVAC])dnl
+AC_DEFUN_ONCE([AC_TRY_COMPILE_JAVA],[
+AC_REQUIRE([AC_PROG_JAVAC_WORKS])dnl
 cat << \EOF > Test.java
 /* [#]line __oline__ "configure" */
 ifelse([$1], , , [import $1;])
Index: m4/ac_prog_javac.m4
===================================================================
RCS file: /sources/classpath/classpath/m4/ac_prog_javac.m4,v
retrieving revision 1.7
diff -u -u -r1.7 ac_prog_javac.m4
--- m4/ac_prog_javac.m4 4 May 2010 17:31:18 -0000       1.7
+++ m4/ac_prog_javac.m4 5 May 2010 15:43:58 -0000
@@ -34,7 +34,7 @@
 dnl
 dnl Modified to remove jikes by Andrew John Hughes on 2008-02-11
 
-AC_DEFUN([AC_PROG_JAVAC],[
+AC_DEFUN_ONCE([AC_PROG_JAVAC],[
 AC_REQUIRE([AC_EXEEXT])dnl
 ECJ_OPTS="-warn:-deprecation,serial,unusedImport"
 JAVAC_OPTS="-Xlint:unchecked,cast,divzero,empty,finally,overrides"
@@ -55,6 +55,5 @@
 ])
 AC_SUBST(JAVAC_IS_GCJ, $ac_cv_prog_javac_is_gcj)
 AM_CONDITIONAL(GCJ_JAVAC, test x"${JAVAC_IS_GCJ}" = xyes)
-AC_PROG_JAVAC_WORKS
 AC_PROVIDE([$0])dnl
 ])
Index: m4/ac_prog_javac_works.m4
===================================================================
RCS file: /sources/classpath/classpath/m4/ac_prog_javac_works.m4,v
retrieving revision 1.3
diff -u -u -r1.3 ac_prog_javac_works.m4
--- m4/ac_prog_javac_works.m4   13 Sep 2008 03:07:27 -0000      1.3
+++ m4/ac_prog_javac_works.m4   5 May 2010 15:43:58 -0000
@@ -16,7 +16,8 @@
 dnl
 dnl Modified to test for 1.5 by Andrew John Hughes on 2008-02-11
 
-AC_DEFUN([AC_PROG_JAVAC_WORKS],[
+AC_DEFUN_ONCE([AC_PROG_JAVAC_WORKS],[
+AC_REQUIRE([AC_PROG_JAVAC])
 AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [
 JAVA_TEST=Object.java
 CLASS_TEST=Object.class

Reply via email to