The attached patch cleans up our build a little.
It now successfully allows you to turn off javac or ecj as
required (see PR 33623) and will exit the build when there
is no compiler.

Changelog:

2007-10-08  Andrew John Hughes  <[EMAIL PROTECTED]>

        PR classpath/33623:
        * examples/Makefile.am:
        Exit with no compiler.
        * lib/Makefile.am: Likewise.
        * m4/acinclude.m4: Handle ecj and javac
        using separate variables and catch when JAVAC/ECJ is
        empty.

-- 
Andrew :-)

Escape the Java Trap with GNU Classpath!
http://www.gnu.org/philosophy/java-trap.html
public class gcj extends Freedom implements Java { ... }
Index: examples/Makefile.am
===================================================================
RCS file: /cvsroot/classpath/classpath/examples/Makefile.am,v
retrieving revision 1.22
diff -u -3 -p -u -r1.22 Makefile.am
--- examples/Makefile.am	16 Sep 2007 19:58:08 -0000	1.22
+++ examples/Makefile.am	8 Oct 2007 22:41:33 -0000
@@ -14,7 +14,7 @@ else
 if FOUND_JAVAC
 JCOMPILER = $(JAVAC) -encoding UTF-8 -bootclasspath $(GLIBJ_CLASSPATH) -classpath '$(top_builddir)/tools/tools.zip'
 else
-error dunno how to setup the JCOMPILER and compile
+JCOMPILER = echo "No compiler found" 1>&2; exit 1 
 #endif
 #endif
 endif
Index: lib/Makefile.am
===================================================================
RCS file: /cvsroot/classpath/classpath/lib/Makefile.am,v
retrieving revision 1.135
diff -u -3 -p -u -r1.135 Makefile.am
--- lib/Makefile.am	8 May 2007 01:09:30 -0000	1.135
+++ lib/Makefile.am	8 Oct 2007 22:41:52 -0000
@@ -25,6 +25,9 @@ JCOMPILER = $(JAVAC) -bootclasspath '' -
 #if FOUND_KJC
 ### FIXME: from what I can tell, kjc does not support a -encoding option.
 #JCOMPILER = $(KJC) -classpath .:$(USER_CLASSLIB) -d . @classes
+else
+JCOMPILER = echo "No compiler found" 1>&2; exit 1 
+#endif
 #endif # FOUND_KJC
 #endif # FOUND_GCJ
 #endif # FOUND_JIKES
Index: m4/acinclude.m4
===================================================================
RCS file: /cvsroot/classpath/classpath/m4/acinclude.m4,v
retrieving revision 1.19
diff -u -3 -p -u -r1.19 acinclude.m4
--- m4/acinclude.m4	24 Jun 2007 23:51:19 -0000	1.19
+++ m4/acinclude.m4	8 Oct 2007 22:41:52 -0000
@@ -3,6 +3,7 @@ dnl Used by aclocal to generate configur
 dnl -----------------------------------------------------------
 AC_DEFUN([CLASSPATH_FIND_JAVAC],
 [
+  user_specified_ecj=
   user_specified_javac=
 
 dnl  CLASSPATH_WITH_GCJ
@@ -11,22 +12,27 @@ dnl  CLASSPATH_WITH_KJC
   CLASSPATH_WITH_ECJ
   CLASSPATH_WITH_JAVAC
 
+  if test "x${user_specified_ecj}" = x; then
+    AM_CONDITIONAL(FOUND_ECJ, test "x${ECJ}" != x)
+  else
+    AM_CONDITIONAL(FOUND_ECJ, test "x${user_specified_javac}" = xecj && test "x${ECJ}" != x)
+  fi
+
   if test "x${user_specified_javac}" = x; then
 dnl    AM_CONDITIONAL(FOUND_GCJ, test "x${GCJ}" != x)
 dnl    AM_CONDITIONAL(FOUND_JIKES, test "x${JIKES}" != x)
-    AM_CONDITIONAL(FOUND_ECJ, test "x${ECJ}" != x)
     AM_CONDITIONAL(FOUND_JAVAC, test "x${JAVAC}" != x)
   else
 dnl    AM_CONDITIONAL(FOUND_GCJ, test "x${user_specified_javac}" = xgcj)
 dnl    AM_CONDITIONAL(FOUND_JIKES, test "x${user_specified_javac}" = xjikes)
-    AM_CONDITIONAL(FOUND_ECJ, test "x${user_specified_javac}" = xecj)
-    AM_CONDITIONAL(FOUND_JAVAC, test "x${user_specified_javac}" = xjavac)
+    AM_CONDITIONAL(FOUND_JAVAC, test "x${user_specified_javac}" = xjavac && test "x${JAVAC}" != x)
   fi
+
 dnl  AM_CONDITIONAL(FOUND_KJC, test "x${user_specified_javac}" = xkjc)
 
 dnl  if test "x${GCJ}" = x && test "x${JIKES}" = x && test "x${user_specified_javac}" != xkjc; then
-  if test "x${ECJ}" = x && test "x${JAVAC}" = x && test "x${user_specified_javac}" != xecj; then
-      AC_MSG_ERROR([cannot find javac, try --with-ecj])
+  if test "x${ECJ}" = x && test "x${JAVAC}" = x && test "x${user_specified_ecj}" != xecj && test "x${user_specified_javac}" != xjavac; then
+      AC_MSG_ERROR([cannot find javac, try --with-ecj or --with-javac])
   fi
 ])
 
@@ -397,7 +403,7 @@ AC_DEFUN([CLASSPATH_WITH_ECJ],
         CLASSPATH_CHECK_ECJ
       fi
     fi
-    user_specified_javac=ecj
+    user_specified_ecj=ecj
   ],
   [ 
     CLASSPATH_CHECK_ECJ

Attachment: signature.asc
Description: Digital signature

Reply via email to