This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java 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]

Patch for Review: libjava Configury Changes for Cross Builds (3.4 version)


Tom,

This cross-configury patch is the same as the one I previously
submitted, but applies cleanly to the CVS trunk (3.4).

If you're hesitating about this, wouldn't now be the best
time to apply it and see if anyone screams, since there's
plenty of time before the next release ( :) )? I tested it
pretty extensively, but not on a newlib build, though I
took great pains to ensure that the behavior for a newlib
build was the same as before.

The WHY THIS PATCH IS NEEDED section of my
previous post should hopefully prove beyond a shadow
of a doubt that the current state of affairs is incorrect....

-- Mohan
http://www.thisiscool.com/
http://www.animalsong.org/

ChangeLog
2003-06-29  Mohan Embar  <gnustuff@thisiscool.com>
	    Ranjit Mathew  <rmathew@hotmail.com>

	* Makefile.am: Use cross-compiling gcjh from the path for
	a crossed-native build.
	* Makefile.in: Rebuilt.
	* configure.in: Include libltdl in non-newlib builds.
	Moved determination of gcj used to build libraries to
	its own section. Fixed cross-compilation issues for
	non-newlib builds.
	* configure: Rebuilt.

Index: Makefile.am
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.292
diff -u -2 -r1.292 Makefile.am
--- Makefile.am	30 Apr 2003 07:23:38 -0000	1.292
+++ Makefile.am	1 May 2003 14:47:47 -0000
@@ -62,8 +62,9 @@
 ## found in the build tree.
 ZIP = $(MULTIBUILDTOP)../$(COMPPATH)/fastjar/jar
+GCJH = gcjh
 else
 ZIP = jar
+GCJH = $(target_alias)-gcjh
 endif
-GCJH = gcjh
 else # CANADIAN
 GCJH = $(MULTIBUILDTOP)../$(COMPPATH)/gcc/gcjh
Index: configure.in
===================================================================
RCS file: /cvsroot/gcc/gcc/libjava/configure.in,v
retrieving revision 1.156
diff -u -2 -r1.156 configure.in
--- configure.in	28 Mar 2003 23:40:51 -0000	1.156
+++ configure.in	1 May 2003 14:47:49 -0000
@@ -24,6 +24,6 @@
 AM_CONFIG_HEADER(include/config.h gcj/libgcj-config.h)
 
-# Only use libltdl for native builds.
-if test -z "${with_cross_host}"; then
+# Only use libltdl for non-newlib builds.
+if test "x${with_newlib}" = "xno"; then
    AC_LIBLTDL_CONVENIENCE
    AC_LIBTOOL_DLOPEN
@@ -556,14 +556,4 @@
    dnl Assume we do not have getuid and friends.
    AC_DEFINE(NO_GETUID)
-
-   # If Canadian cross, then don't pick up tools from the build
-   # directory.
-   if test x"$build" != x"$with_cross_host" \
-        && test x"$build" != x"$target"; then
-      CANADIAN=yes
-      GCC_UNWIND_INCLUDE=
-      GCJ="${target_alias}-gcj"
-   fi
-   NATIVE=no
    PLATFORMNET=NoNet
 else
@@ -806,13 +796,67 @@
 changequote([,])
    fi
-   if test -x "${builddotdot}/../../gcc/gcj"; then
-      dir="`cd ${builddotdot}/../../gcc && ${PWDCMD-pwd}`"
-      GCJ="$dir/gcj -B`${PWDCMD-pwd}`/ -B$dir/"
-   else
+fi
+
+# Which gcj do we use?
+which_gcj=default
+built_gcc_dir="`cd ${builddotdot}/../../gcc && ${PWDCMD-pwd}`"
+if test -n "${with_cross_host}"; then
+  # We are being configured with a cross compiler. We can't
+  # use ac_exeext, because that is for the target platform.
+  NATIVE=no
+  cross_host_exeext=
+  case "${with_cross_host}" in
+     *mingw* | *cygwin*)
+         cross_host_exeext=.exe
+     ;;
+  esac
+  if test -x "${built_gcc_dir}/gcj${cross_host_exeext}"; then
+     if test x"$build" = x"$with_cross_host"; then
+        # Ordinary cross (host!=target and host=build)
+        which_gcj=built
+     else
+        # Canadian cross (host!=target and host!=build)
+        which_gcj=cross
+     fi
+  else
+     which_gcj=cross
+  fi
+else
+  # We are being configured with a native or crossed-native compiler
+  if test -x "${built_gcc_dir}/gcj${ac_exeext}"; then
+     if test x"$build" = x"$host"; then
+        # True native build (host=target and host=build)
+        which_gcj=built
+     else
+        # Crossed-native build (host=target and host!=build)
+        which_gcj=cross
+     fi
+  else
+     which_gcj=path
+  fi
+fi
+case "${which_gcj}" in
+   built)
+      GCJ="$built_gcc_dir/gcj -B`${PWDCMD-pwd}`/ -B$built_gcc_dir/"
+   ;;
+   cross)
+      # See the comment in Makefile.am about CANADIAN being a misnomer
+      CANADIAN=yes
+      NULL_TARGET=no
+      if test "x${with_newlib}" = "xyes"; then
+         # FIXME (comment): Why is this needed?
+         GCC_UNWIND_INCLUDE=
+         GCJ="${target_alias}-gcj"
+      else
+         GCJ="${target_alias}-gcj -B`${PWDCMD-pwd}`/"
+      fi
+   ;;
+   path)
+      # See the comment in Makefile.am about CANADIAN being a misnomer
       CANADIAN=yes
       NULL_TARGET=yes
       GCJ="gcj -B`${PWDCMD-pwd}`/"
-   fi
-fi
+   ;;
+esac
 
 # Create it, so that compile/link tests don't fail





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