This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR libgcj/40868 - ecjx should be build with host compiler


[ http://gcc.gnu.org/ml/gcc-patches/2010-08/msg00930.html ]

Sorry for the delay.

Below is my attempt.  Tested in native configuration.  Can you please
test the cross compile case?  You need to use --enable-maintainer-mode
or run 'cd libjava && autoreconf -v' explicitly for the patch to have
effect.  Thanks.

Tom, if that succeeds, OK to commit?

Notes:

The patch assumes that in the native setup, users expect
CXXFLAGS and GCJFLAGS to be applied to the compile resp. link.
The latter is already done, so the former seems just logical,
which is why the compile rule is placed in the !NATIVE block only.

Ensuring both of the variables are always nonempty was done for
consistency reasons.

The dummy object is needed because, well, there are gcj versions out
there that will refuse to link without finding an object on the command
line.  It could have probably just as well been created with the same
driver, but I don't think that this way makes things worse than they
were before.

Thanks,
Ralf

Fix building ecjx in cross compile mode.

2010-08-26  Dmitrijs Ledkovs  <dmitrij.ledkov@ubuntu.com>
	    Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

libjava/:
	PR libgcj/40868
	* configure.ac: Add GCC_FOR_ECJX variable.  Ensure
	GCJ_FOR_ECJX is always set.
	* Makefile.am [!NATIVE] (ecjx.$(OBJEXT)): New rule.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* gcj/Makefile.in: Regenerate.
	* include/Makefile.in: Regenerate.
	* testsuite/Makefile.in: Regenerate.

diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index dcdf827..52d0995 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -1170,6 +1170,8 @@ ecjx_LINK = $(GCJ_FOR_ECJX_LINK) $(ecjx_LDFLAGS)
 ecjx_LDFLAGS = $(ECJX_BASE_FLAGS) $(ECJ_BUILD_JAR)
 ecjx_LDADD = 
 ecjx_DEPENDENCIES = 
+ecjx.$(OBJEXT): ecjx.cc
+	$(GCC_FOR_ECJX) -c $<
 
 endif !NATIVE
 
diff --git a/libjava/configure.ac b/libjava/configure.ac
index 685cb72..df6bca3 100644
--- a/libjava/configure.ac
+++ b/libjava/configure.ac
@@ -394,7 +394,8 @@ NATIVE=yes
 # Which gcj and host gcj (for ecjx) do we use?
 which_gcj=default
 host_exeext=${ac_exeext}
-GCJ_FOR_ECJX=
+GCJ_FOR_ECJX='$(GCJ)'
+GCC_FOR_ECJX='$(CXX)'
 built_gcc_dir="`cd ${builddotdot}/../../${host_subdir}/gcc && ${PWDCMD-pwd}`"
 if test -n "${with_cross_host}"; then
   # We are being configured with a cross compiler. We can't
@@ -402,6 +403,7 @@ if test -n "${with_cross_host}"; then
   NATIVE=no
   cross_host_exeext=
   GCJ_FOR_ECJX="${with_cross_host}-gcj"
+  GCC_FOR_ECJX="${with_cross_host}-gcc"
   case "${with_cross_host}" in
      *mingw* | *cygwin*)
          cross_host_exeext=.exe
@@ -467,6 +469,7 @@ JAVAC="$GCJ -C"
 export JAVAC
 
 AC_SUBST(GCJ_FOR_ECJX)
+AC_SUBST(GCC_FOR_ECJX)
 AC_SUBST(GCJH)
 AC_SUBST(host_exeext)
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]