[SCM] master: Require an up-to-date GCJ, or GCJ.

cagney@sourceware.org cagney@sourceware.org
Thu Dec 6 17:02:00 GMT 2007


The branch, master has been updated
       via  a53d055d1c2501c03156b10e493a0f39126b7184 (commit)
      from  e84fae5b93e545c70551225ae9c14907f1433ad6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit a53d055d1c2501c03156b10e493a0f39126b7184
Author: Andrew Cagney <cagney@redhat.com>
Date:   Thu Dec 6 12:01:50 2007 -0500

    Require an up-to-date GCJ, or GCJ.
    
    frysk-common/ChangeLog
    2007-12-06  Andrew Cagney  <cagney@redhat.com>
    
    	* frysk-common.ac (JAVAC): Set to either GCJ or $ECJ_JAR.
    	(ECJ): Delete variable.
    	(--enable-jar-compile): Use "yes" and "no", not "true" and "false.
    	(JAVAC_IS): New variable; either gcj or ecj.
    	(HAVE_ECJ): Delete.
    	* Makefile.rules (checked-ecj-compile): Delete.
    	(.g.antlred): Use $(JAVAC) and $(JAVAC_IS)

-----------------------------------------------------------------------

Summary of changes:
 frysk-common/ChangeLog       |   10 ++++
 frysk-common/Makefile.rules  |   54 ++++---------------
 frysk-common/frysk-common.ac |  122 ++++++++++++++++++++++--------------------
 3 files changed, 84 insertions(+), 102 deletions(-)

First 500 lines of diff:
diff --git a/frysk-common/ChangeLog b/frysk-common/ChangeLog
index 3ee3af2..6fc3df6 100644
--- a/frysk-common/ChangeLog
+++ b/frysk-common/ChangeLog
@@ -1,3 +1,13 @@
+2007-12-06  Andrew Cagney  <cagney@redhat.com>
+
+	* frysk-common.ac (JAVAC): Set to either GCJ or $ECJ_JAR.
+	(ECJ): Delete variable.
+	(--enable-jar-compile): Use "yes" and "no", not "true" and "false.
+	(JAVAC_IS): New variable; either gcj or ecj.
+	(HAVE_ECJ): Delete.
+	* Makefile.rules (checked-ecj-compile): Delete.
+	(.g.antlred): Use $(JAVAC) and $(JAVAC_IS)
+
 2007-11-27  Andrew Cagney  <cagney@redhat.com>
 
 	* Makefile.rules (GEN_GCJ_SO_DIRS): Fix typo, match -L%.
diff --git a/frysk-common/Makefile.rules b/frysk-common/Makefile.rules
index 84ae020..d696ac2 100644
--- a/frysk-common/Makefile.rules
+++ b/frysk-common/Makefile.rules
@@ -524,23 +524,20 @@ SUFFIXES += .antlred .g
 		echo "Parsing compiler warnings from $$b..." ; \
 		rm -f $$t/*.antlr-fixes ; \
 	        rm -rf $$t/classes ; mkdir -p $$t/classes ; \
-		if test "x@HAVE_ECJ_TRUE@" = x ; then \
-		    $(GIJ) 2>&1 \
-			--classpath $(ECJ_JAR):$(CLASSPATH) \
-			org.eclipse.jdt.internal.compiler.batch.Main \
-			\
+		case "$(JAVAC_IS)" in \
+		    gcj) $(JAVAC) $(JAVACFLAGS) \
 			-d $$t/classes \
+			-I $$t \
+			$$t/$$d/$$b.java \
+			2>&1 || true ;; \
+		    ecj) $(JAVAC) \
+                        -d $$t/classes \
 			-warn:+semicolon \
 			-sourcepath  $$t:$(SOURCEPATH) \
 			-classpath $(CLASSPATH) \
-			$$t/$$d/$$b.java || true ; \
-		else \
-		    $(GCJCOMPILE) 2>&1 \
-			-C \
-			-I $$t \
-			-d $$t/classes \
-			$$t/$$d/$$b.java || true ; \
-		fi | ( \
+			$$t/$$d/$$b.java \
+			2>&1 || true ;; \
+		esac | ( \
 		    cd $$t ; \
 		    $(AWK) -f @abs_srcdir@/common/antlr-warnings.awk \
 		) ; \
@@ -668,37 +665,6 @@ ${GEN_DIRNAME}.jar: files-java.list
 		| $(JAR) -@ -cf $@
 	mv $(JAVAROOT)/$@ $@
 
-# When ECJ is available, use it as an extra lint pass.  GCJ has the
-# habit of silently compiling invalid Java code (garbage in, garbage
-# out), fortunately ECJ rejects it.
-
-# This is part of all-local, since, if this fails the build won't fly.
-
-all-local: checked-ecj-compile
-CLEANFILES += checked-ecj-compile files-java-gen.list
-CLEANDIRS += ecj
-checked-ecj-compile: files-java.list $(if $(GEN_DIRS),$(GEN_DIRNAME).jar)
-	rm -rf ecj
-	mkdir -p ecj
-if HAVE_ECJ
-	echo Compiling all the generated files.
-	( test -s files-java.list && $(GIJ) \
-		--classpath $(ECJ_JAR):$(CLASSPATH) \
-		org.eclipse.jdt.internal.compiler.batch.Main \
-		\
-		-d ecj \
-		-warn:+semicolon \
-		-sourcepath $(SOURCEPATH) \
-		-classpath $(CLASSPATH) \
-		@files-java.list \
-		2>&1 ) | tee $@.log
-	if test -s $@.log ; \
-	then rm $@.log ; false ; \
-	fi
-	rm -f $@.log $(top_builddir)/files-{java,genjava}.list.ecj
-endif
-	touch $@
-
 # Check that everything, well except for a few exceptions, is using
 # frysk.junit and not the junit stuff directly.  Depend on the
 # directories .jar file as that is updated when ever any java files
diff --git a/frysk-common/frysk-common.ac b/frysk-common/frysk-common.ac
index 3897b0b..f72c24a 100644
--- a/frysk-common/frysk-common.ac
+++ b/frysk-common/frysk-common.ac
@@ -99,56 +99,78 @@ AC_CHECK_PROGS([JV_SCAN], [jv-scan4 jv-scan], [no])
 AM_CONDITIONAL([HAVE_JV_SCAN], test x"${JV_SCAN}" != xno)
 
 
-# Always use GCJ as the Java compiler.  While other, possibly better,
-# alternatives might be available, using those alternatives can (and
-# did) lead to problems such as: developers missing problems in the
-# base-line build compiler; and developers testing code different to
-# what will be shipped.  Having said that, do allow people to override
-# this.
-
-JAVAC="${JAVAC:-$GCJ -C}"
-AC_SUBST([JAVAC])
+# autoconf doesn't yet know about GCJ, so define it ourselves.
 
-# autoconf doesn't yet know about JAVA, so define it ourselves.
-m4_define([AC_LANG(JAVA)],
+m4_define([AC_LANG(GCJ)],
 [ac_ext=java
 ac_objext=class
-ac_compile='$JAVAC $JAVACFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
+ac_compile='$GCJ $GCJFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
 ac_java_werror_flag=no
 ])
-m4_defun([AC_LANG_COMPILER(JAVA)], [])
-m4_define([_AC_LANG_ABBREV(JAVA)], [java])
-
-AC_LANG(JAVA)
+m4_defun([AC_LANG_COMPILER(GCJ)], [])
+m4_define([_AC_LANG_ABBREV(GCJ)], [java])
+AC_LANG(GCJ)
 
-# Only add -warn flags when the compiler is known to be ECJ.
-AC_MSG_CHECKING([java flags])
-case "${JAVAC}" in
-gcj* | */gcj* ) JAVACFLAGS='-g -classpath $(SOURCEPATH):$(CLASSPATH)' ;;
-ecj | */ecj ) JAVACFLAGS='-warn:+semicolon -sourcepath $(SOURCEPATH) -classpath $(CLASSPATH)' ;;
-* ) JAVACFLAGS='-g -sourcepath $(SOURCEPATH) -classpath $(CLASSPATH)' ;;
-esac
-AC_SUBST([JAVACFLAGS])
-AC_MSG_RESULT(${JAVACFLAGS})
 
-# See if -fsource=1.4 can be added, if not only use the warning flags.
-# If it is available also use it for the GCJFLAGS.
+# See gcj accepts -fsource=1.4, if not only use the warning flags.  If
+# it is available also use it for the GCJFLAGS.
 
-AC_MSG_CHECKING([whether ${JAVAC} accepts -fsource=1.4])
+AC_MSG_CHECKING([whether ${GCJ} accepts -fsource=1.4])
 if test "x$ac_env_GCJFLAGS_set" == xset ; then
 	GCJ_FSOURCE="no"
 	AC_MSG_RESULT([not needed])
 else
-	JAVACFLAGS_WARN=$JAVACFLAGS
-	JAVACFLAGS="$JAVACFLAGS -fsource=1.4"
+	GCJFLAGS_WARN=$GCJFLAGS
+	GCJFLAGS="$GCJFLAGS -fsource=1.4"
 	AC_COMPILE_IFELSE([public class conftest{}],
 		[GCJ_FSOURCE="yes"
 		 GCJFLAGS="$GCJFLAGS -fsource=1.4"],
 		[GCJ_FSOURCE="no"
-		JAVACFLAGS=$JAVACFLAGS_WARN])
+		GCJFLAGS=$GCJFLAGS_WARN])
 	AC_MSG_RESULT([${GCJ_FSOURCE}])
 fi
 
+
+# Check for the ECJ compiler.
+
+AC_MSG_CHECKING([ecj.jar])
+ECJ_JAR=${ECJ_JAR:-/usr/share/java/eclipse-ecj.jar}
+AC_SUBST([ECJ_JAR])
+AC_MSG_RESULT(${ECJ_JAR})
+
+
+# Two possible compilers: either GCJ (wrapper round ECJ); or ECJ.  In
+# the latter case, need to explicitly run compiler from within the GIJ
+# runtime so that ECJ sees the classpath environment, in particular
+# things like gnu.gcj.RawDataManaged.
+
+AC_MSG_CHECKING([JAVAC])
+if test x"${JAVAC}" = x ; then
+   if test "x${GCJ_FSOURCE}" = xyes ; then
+      JAVAC_IS=gcj
+      JAVAC="\$(GCJ) -C"
+   elif test "x${ECJ_JAR}" != xno ; then
+      JAVAC_IS=ecj
+      JAVAC="\$(GIJ) --classpath \$(ECJ_JAR):\$(CLASSPATH) org.eclipse.jdt.internal.compiler.batch.Main"
+   else
+      AC_MSG_ERROR([no java compiler])
+   fi
+fi
+AC_SUBST([JAVAC])
+AC_SUBST([JAVAC_IS])
+AC_MSG_RESULT(${JAVAC})
+
+
+# Only add -warn flags when the compiler is known to be ECJ.
+AC_MSG_CHECKING([java flags])
+case "${JAVAC_IS}" in
+     gcj) JAVACFLAGS='-g -classpath $(SOURCEPATH):$(CLASSPATH)' ;;
+     ecj) JAVACFLAGS='-warn:+semicolon -sourcepath $(SOURCEPATH) -classpath $(CLASSPATH)' ;;
+esac
+AC_SUBST([JAVACFLAGS])
+AC_MSG_RESULT(${JAVACFLAGS})
+
+
 # Some versions of gcj don't support -Wall.  Some versions generate
 # good warnings without it.  So explictily test for it.
 
@@ -156,7 +178,7 @@ AC_MSG_CHECKING([whether ${JAVAC} accepts -Wall])
 if test "x$ac_env_GCJFLAGS_set" == xset ; then
 	GCJ_WALL=no
 	AC_MSG_RESULT([not needed])
-elif test "x${GCJ_FSOURCE}" == xyes ; then
+elif test x"${JAVAC_IS}" = xgcj ; then
 	# Newer compilers have a good default set of warnings so do
 	# not need -Wall.  However, older GCJs barf on stray
 	# semicolons so always check for them to help with
@@ -164,36 +186,20 @@ elif test "x${GCJ_FSOURCE}" == xyes ; then
 	GCJ_WALL=-Wextraneous-semicolon
 	JAVACFLAGS="$JAVACFLAGS ${GCJ_WALL}"
 	GCJFLAGS="$GCJFLAGS ${GCJ_WALL}"
-	AC_MSG_RESULT([${GCJ_WALL}])
-else
-	JAVACFLAGS_WARN=$JAVACFLAGS
-	JAVACFLAGS="$JAVACFLAGS -Wall"
-	AC_COMPILE_IFELSE([public class conftest{}],
-		[GCJ_WALL=yes
-		 GCJFLAGS="$GCJFLAGS -Wall"],
-		[GCJ_WALL=no
-		 JAVACFLAGS=$JAVACFLAGS_WARN])
-	AC_MSG_RESULT([${GCJ_WALL}])
+else	
+	GCJ_WALL=no
 fi
+AC_MSG_RESULT([${GCJ_WALL}])
+
 
 # Always use GIJ as the byte code interpreter.  java programs, run
 # during the build, need to see the GNU Java environment.  That
-# environment classes such as gnu.gcj.RawData which can be found using
-# reflection.
+# environment contains classes such as gnu.gcj.RawData which can be
+# found using reflection.
 
 JAVA="${JAVA:-$GIJ}"
 AC_SUBST([JAVA])
 
-# Check for the ECJ compiler.  If available, enable rules that push
-# all the java code through that compiler.  Doing this adds an
-# additional (but optional) code check -- ECJ tends to find more
-# errors than GCJ. Ignore when gcj support -fsource since then it
-# already uses a source -> byte code compiler that is sane.
-
-ECJ_JAR=${ECJ_JAR:-/usr/share/java/eclipse-ecj.jar}
-AC_SUBST([ECJ_JAR])
-AC_CHECK_PROGS([ECJ], [ecj], [no])
-AM_CONDITIONAL(HAVE_ECJ, test x"${ECJ}" != xno -a x"${GCJ_FSOURCE}" != xyes)
 
 # Check for the availablity of fig2dev
 
@@ -270,8 +276,8 @@ AC_ARG_WITH(libopcodes,
 AC_ARG_ENABLE([jar-compile],
 	[  --enable-jar-compile	Enable compilation of jars],
 	[case "${enableval}" in
-	      yes) jar_compile=true ;;
-	      no) jar_compile=false;;
+	      yes) jar_compile=yes ;;
+	      no) jar_compile=no;;
 	      *) AC_MSG_ERROR([bad value ${enableval} for --enable-jar-compile]) ;;
-	esac],[jar_compile=false])
-AM_CONDITIONAL([JAR_COMPILE], [test x$jar_compile = xtrue])
+	esac],[jar_compile=no])
+AM_CONDITIONAL([JAR_COMPILE], [test x$jar_compile = xyes])


hooks/post-receive
--
frysk system monitor/debugger



More information about the Frysk-cvs mailing list