[SCM] master: Fix missing -fsource=1.4 when .java.h: and JAVAC=GCJ.

cagney@sourceware.org cagney@sourceware.org
Fri Dec 7 01:55:00 GMT 2007


The branch, master has been updated
       via  165cdef652b84c712b7d6ade77608d538ec7a02b (commit)
      from  b752273a412939b9d582ee4cf6b8d419dc956909 (commit)

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

- Log -----------------------------------------------------------------
commit 165cdef652b84c712b7d6ade77608d538ec7a02b
Author: Andrew Cagney <cagney@redhat.com>
Date:   Thu Dec 6 20:54:45 2007 -0500

    Fix missing -fsource=1.4 when .java.h: and JAVAC=GCJ.
    
    frysk-common/ChangeLog
    2007-12-06  Andrew Cagney  <cagney@redhat.com>
    
    	* frysk-common.ac (GCJ_FSOURCE): Delete.
    	(AC_LANG(JAVA)): Replace AC_LANG(GCJ).
    	(JAVA_IS): Re-implement using AC_COMPILE_IFELSE.
    	(GCJ_WALL): Default to adding -Wall.
    	* Makefile.rules (.java.h): Use JAVAC.

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

Summary of changes:
 frysk-common/ChangeLog       |    8 +++
 frysk-common/Makefile.rules  |    2 +-
 frysk-common/frysk-common.ac |  102 +++++++++++++++--------------------------
 3 files changed, 46 insertions(+), 66 deletions(-)

First 500 lines of diff:
diff --git a/frysk-common/ChangeLog b/frysk-common/ChangeLog
index 51b8530..7be00a9 100644
--- a/frysk-common/ChangeLog
+++ b/frysk-common/ChangeLog
@@ -1,3 +1,11 @@
+2007-12-06  Andrew Cagney  <cagney@redhat.com>
+
+	* frysk-common.ac (GCJ_FSOURCE): Delete.
+	(AC_LANG(JAVA)): Replace AC_LANG(GCJ).
+	(JAVA_IS): Re-implement using AC_COMPILE_IFELSE.
+	(GCJ_WALL): Default to adding -Wall.
+	* Makefile.rules (.java.h): Use JAVAC.
+
 2007-12-06  Andrew Cagney  <cagney@frysk32.hsv.redhat.com>
 
 	* frysk-common.ac (JAVAC): Pass -1.4 to ECJ compiler.
diff --git a/frysk-common/Makefile.rules b/frysk-common/Makefile.rules
index d696ac2..3b9e075 100644
--- a/frysk-common/Makefile.rules
+++ b/frysk-common/Makefile.rules
@@ -360,7 +360,7 @@ $(GEN_SOURCENAME)/JUnitTests.java: files-java.list
 	tmpdir=$$b.tmp ; \
 	rm -rf $$tmpdir ; \
 	mkdir -p $$tmpdir ; \
-	$(GCJCOMPILE) -C -d $$tmpdir '$<' || exit 1 ; \
+	$(JAVAC) $(JAVACFLAGS) -d $$tmpdir '$<' || exit 1 ; \
 	classes=`cd $$tmpdir; find $$d/$$b*.class \
 		    -name '*\$$[0-9]*' -prune \
 		    -o -name $$b.class -print \
diff --git a/frysk-common/frysk-common.ac b/frysk-common/frysk-common.ac
index 1dbd199..3db1dd3 100644
--- a/frysk-common/frysk-common.ac
+++ b/frysk-common/frysk-common.ac
@@ -99,38 +99,6 @@ AC_CHECK_PROGS([JV_SCAN], [jv-scan4 jv-scan], [no])
 AM_CONDITIONAL([HAVE_JV_SCAN], test x"${JV_SCAN}" != xno)
 
 
-# autoconf doesn't yet know about GCJ, so define it ourselves.
-
-m4_define([AC_LANG(GCJ)],
-[ac_ext=java
-ac_objext=class
-ac_compile='$GCJ $GCJFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
-ac_java_werror_flag=no
-])
-m4_defun([AC_LANG_COMPILER(GCJ)], [])
-m4_define([_AC_LANG_ABBREV(GCJ)], [java])
-AC_LANG(GCJ)
-
-
-# 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 ${GCJ} accepts -fsource=1.4])
-if test "x$ac_env_GCJFLAGS_set" == xset ; then
-	GCJ_FSOURCE="no"
-	AC_MSG_RESULT([not needed])
-else
-	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"
-		GCJFLAGS=$GCJFLAGS_WARN])
-	AC_MSG_RESULT([${GCJ_FSOURCE}])
-fi
-
-
 # Check for the ECJ compiler.
 
 AC_MSG_CHECKING([ecj.jar])
@@ -139,55 +107,59 @@ AC_SUBST([ECJ_JAR])
 AC_MSG_RESULT(${ECJ_JAR})
 
 
+# autoconf doesn't yet know about JAVAC, so define it ourselves.
+
+m4_define([AC_LANG(JAVAC)],
+[ac_ext=java
+ac_objext=class
+ac_compile='$JAVAC $JAVACFLAGS conftest.$ac_ext >&AS_MESSAGE_LOG_FD'
+ac_java_werror_flag=no
+])
+m4_defun([AC_LANG_COMPILER(JAVAC)], [])
+m4_define([_AC_LANG_ABBREV(JAVAC)], [java])
+AC_LANG(JAVAC)
+
+
 # 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 -1.4"
-   else
-      AC_MSG_ERROR([no java compiler])
-   fi
-fi
-AC_SUBST([JAVAC])
-AC_SUBST([JAVAC_IS])
-AC_MSG_RESULT(${JAVAC})
+# things like gnu.gcj.RawDataManaged.  Start out assuming GCJ (with
+# the -fsource=1.4 flag), if that fails, fall back to ECJ.
 
+# See gcj accepts -fsource=1.4, if not only use the warning flags.  If
+# it is available also use it for the GCJFLAGS.
 
-# 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_MSG_CHECKING([for working java compiler])
+JAVAC=${JAVAC:-${GCJ} -C -fsource=1.4}
+JAVACFLAGS=${JAVACFLAGS:-${GCJFLAGS}}
+AC_COMPILE_IFELSE([public class conftest{}],
+	[JAVAC_IS=gcj],
+	[JAVAC_IS=ecj
+         JAVAC='$(GIJ) --classpath $(ECJ_JAR):$(CLASSPATH) org.eclipse.jdt.internal.compiler.batch.Main -1.4'
+	 JAVACFLAGS='-warn:+semicolon -sourcepath $(SOURCEPATH) -classpath $(CLASSPATH)'])
+AC_SUBST([JAVAC])
 AC_SUBST([JAVACFLAGS])
-AC_MSG_RESULT(${JAVACFLAGS})
-
+AC_SUBST([JAVAC_IS])
+AC_MSG_RESULT([${JAVAC_IS} ($JAVAC)])
 
 # Some versions of gcj don't support -Wall.  Some versions generate
 # good warnings without it.  So explictily test for it.
 
-AC_MSG_CHECKING([whether ${JAVAC} accepts -Wall])
+AC_MSG_CHECKING([whether GCJ needs -Wall])
 if test "x$ac_env_GCJFLAGS_set" == xset ; then
-	GCJ_WALL=no
-	AC_MSG_RESULT([not needed])
+	GCJ_WALL="not needed"
 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
-	# compatibility.
+	# A newer GCJ (using it for JAVAC) which has 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 compatibility.
 	GCJ_WALL=-Wextraneous-semicolon
 	JAVACFLAGS="$JAVACFLAGS ${GCJ_WALL}"
 	GCJFLAGS="$GCJFLAGS ${GCJ_WALL}"
 else	
-	GCJ_WALL=no
+	# Older GCJ (not using it for JAVAC) need the full gamit.
+	GCJ_WALL="-Wextraneous-semicolon -Wall"
+	GCJFLAGS="$GCJFLAGS ${GCJ_WALL}"
 fi
 AC_MSG_RESULT([${GCJ_WALL}])
 


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



More information about the Frysk-cvs mailing list