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]

fix cross-building libjava


This patch fixes a problem with the selection of gcj.  I found that
configuring at the top level with
  --build=powerpc-linux --host=powerpc-linux --target=powerpc64-linux
resulted in the libjava build using an installed powerpc64-linux-gcj
instead of the freshly built gcj.

First obvious bug in configure.in is that $with_cross_host needs to be
compared with $build_alias rather than $build, because $build is
canonicalized.  However, fixing that problem still resulted in the
system gcj being used.  After a further look, I found build_alias=$build
twice in configure.  Of course, the second assignment throws away the
proper value of build_alias as by that time $build is canonicalized.
Some further digging finds the build_alias assignment comes from the
expansion of AC_CANONICAL_BUILD, and LIBGCJ_CONFIGURE in acinclude.m4
contains both AC_CANONICAL_SYSTEM and AC_CANONICAL_BUILD calls.
AC_CANONICAL_SYSTEM calls AC_CANONICAL_BUILD so we get two expansions of
AC_CANONICAL_BUILD.

	* acinclude.m4 (LIBGCJ_CONFIGURE): Remove AC_CANONICAL_BUILD.
	* configure.in: Compare with_cross_host to build_alias, not build.
	* aclocal.m4: Regenerate.
	* configure: Regenerate.

Index: acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libjava/acinclude.m4,v
retrieving revision 1.23
diff -u -p -r1.23 acinclude.m4
--- acinclude.m4	31 Jan 2003 17:59:00 -0000	1.23
+++ acinclude.m4	5 Aug 2003 15:51:19 -0000
@@ -106,12 +106,6 @@ version=0.0.7
 dnl Still use "libjava" here to placate dejagnu.
 AM_INIT_AUTOMAKE(libjava, $version)
 
-# AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we don't
-# run it explicitly here, it will be run implicitly before
-# LIBGCJ_CONFIGURE, which doesn't work because that means that it will
-# be run before AC_CANONICAL_HOST.
-AC_CANONICAL_BUILD
-
 AC_CHECK_TOOL(AS, as)
 AC_CHECK_TOOL(AR, ar)
 AC_CHECK_TOOL(RANLIB, ranlib, :)
Index: configure.in
===================================================================
RCS file: /cvs/gcc/gcc/libjava/configure.in,v
retrieving revision 1.164
diff -u -p -r1.164 configure.in
--- configure.in	1 Aug 2003 16:17:33 -0000	1.164
+++ configure.in	5 Aug 2003 15:51:24 -0000
@@ -823,7 +823,7 @@ if test -n "${with_cross_host}"; then
      ;;
   esac
   if test -x "${built_gcc_dir}/gcj${cross_host_exeext}"; then
-     if test x"$build" = x"$with_cross_host"; then
+     if test x"$build_alias" = x"$with_cross_host"; then
         # Ordinary cross (host!=target and host=build)
         which_gcj=built
      else

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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