changeset 2934:62ea56e2d58a

Use javac or ecj binaries in bootstrap rather than always using ecj.jar (largely backported from 7). 2012-11-28 Andrew John Hughes <gnu.andrew@redhat.com> * acinclude.m4: (IT_FIND_COMPILER): Invoke IT_USING_ECJ. * javac.in: Add final else block which exits with an error. 2011-07-05 Andrew John Hughes <gnu.andrew@redhat.com> * javac.in: Add -XDignore.symbol.file=true when using javac to avoid numerous proprietary warnings. 2010-12-08 Andrew John Hughes <gnu.andrew@redhat.com> * javac.in: Pass -Xprefer:source (if javac is used) to pick up local OpenJDK versions of classes prior to those in the boot JDK. 2009-07-21 Andrew John Hughes <gnu.andrew@redhat.com> * acinclude.m4: (IT_USING_ECJ): Work out whether javac is ecj or not. * javac.in: Run @JAVAC@ rather than @ECJ@ and vary arguments as needed depending on @USING_ECJ@.
author Andrew John Hughes <gnu.andrew@redhat.com>
date Wed, 28 Nov 2012 13:34:53 +0000
parents 5e25810d47d2
children 6787928de410
files ChangeLog acinclude.m4 javac.in
diffstat 3 files changed, 60 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Nov 28 10:39:54 2012 +0000
+++ b/ChangeLog	Wed Nov 28 13:34:53 2012 +0000
@@ -1,3 +1,31 @@
+2012-11-28  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	* acinclude.m4:
+	(IT_FIND_COMPILER): Invoke IT_USING_ECJ.
+	* javac.in:
+	Add final else block which exits with an error.
+
+2011-07-05  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	* javac.in: Add -XDignore.symbol.file=true
+	when using javac to avoid numerous proprietary
+	warnings.
+
+2010-12-08  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	* javac.in:
+	Pass -Xprefer:source (if javac is used) to
+	pick up local OpenJDK versions of classes
+	prior to those in the boot JDK.
+
+2009-07-21  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	* acinclude.m4:
+	(IT_USING_ECJ): Work out whether javac is ecj or not.
+	* javac.in:
+	Run @JAVAC@ rather than @ECJ@ and vary arguments as
+	needed depending on @USING_ECJ@.
+
 2009-07-09  Andrew John Hughes  <gnu.andrew@redhat.com>
 
 	* Makefile.am:
--- a/acinclude.m4	Wed Nov 28 10:39:54 2012 +0000
+++ b/acinclude.m4	Wed Nov 28 13:34:53 2012 +0000
@@ -139,6 +139,9 @@
       JAVAC="${ECJ} -nowarn"
     fi
   fi
+
+  IT_USING_ECJ
+
   AC_SUBST(ECJ)
   AC_SUBST(JAVAC)
 ])
@@ -1857,3 +1860,16 @@
   AM_CONDITIONAL([DOWNLOADING], test x"${enable_downloading}" = "xyes")
   AC_SUBST([enable_downloading])
 ])
+
+AC_DEFUN([IT_USING_ECJ],[
+AC_CACHE_CHECK([if we are using ecj as javac], it_cv_ecj, [
+if $JAVAC -version 2>&1| grep '^Eclipse' >&AS_MESSAGE_LOG_FD ; then
+  it_cv_ecj=yes;
+else
+  it_cv_ecj=no;
+fi
+])
+USING_ECJ=$it_cv_ecj
+AC_SUBST(USING_ECJ)
+AC_PROVIDE([$0])dnl
+])
--- a/javac.in	Wed Nov 28 10:39:54 2012 +0000
+++ b/javac.in	Wed Nov 28 13:34:53 2012 +0000
@@ -4,11 +4,13 @@
 use constant STRIP_ARGS => qw(-Werror -implicit:none -J-Xbootclasspath/p:);
 
 my $ECJ_WARNINGS="-nowarn";
+my $JAVAC_WARNINGS="-nowarn";
 
 my @bcoption;
 push @bcoption, '-bootclasspath', glob '@abs_top_builddir@/bootstrap/jdk1.6.0/jre/lib/rt.jar'
     unless grep {$_ eq '-bootclasspath'} @ARGV;
 my @ecj_parms = ($ECJ_WARNINGS, @bcoption);
+my @javac_parms = ($JAVAC_WARNINGS, '-Xprefer:source', '-XDignore.symbol.file=true');
 
 # Work around ecj's inability to handle duplicate command-line
 # options and unknown javac options.
@@ -49,6 +51,18 @@
     my $ecj_args = gen_ecj_opts( \@ARGV );
     exec '@abs_top_builddir@/native-ecj', @ecj_parms, @$ecj_args ;
 }
+elsif ( -e "@JAVAC@" )
+{
+    if ("@USING_ECJ@" eq "yes")
+    {
+	my @ecj_args = gen_ecj_opts( \@ARGV );
+	exec '@JAVAC@', @ecj_parms, @ecj_args ;
+    }
+    else
+    {
+	exec '@JAVAC@', @javac_parms, @ARGV ;
+    }
+}
 elsif ( -e "@ECJ_JAR@" )
 {
     my ($vm_args, $javac_args) = split_vm_args (gen_ecj_opts( \@ARGV ));
@@ -59,6 +73,6 @@
 }
 else
 {
-    my $ecj_args = gen_ecj_opts( \@ARGV );
-    exec '@ECJ@', @ecj_parms, @$ecj_args ;
+    print STDERR "No Java compiler to run";
+    exit -1;
 }