Re: [ping**2] libjava cross-compilation patches

Sandra Loosemore <[email protected]>
Newsgroups gmane.comp.gcc.java.patches
Message-ID <[email protected]>
On 05/20/2013 02:03 PM, Sandra Loosemore wrote:
> On 05/20/2013 01:27 PM, Andrew Haley wrote:
>> On 05/20/2013 08:18 PM, Sandra Loosemore wrote:
>>> We've been trying to get this set of configuration patches to support
>>> cross-compilation of libjava approved since 2009; most recently I pinged
>>> them last July.  Can somebody please review them?
>>
>> I'm sorry.  They look OK to me; please commit.
>>
>> I presume that you have re-checked them with the testsuite and the
>> current
>> sources.  If you have any test failures please let us know.
>
> I actually have not done that yet, but I will do so before committing
> anything.  I was hesitant to spend a lot of time on refreshing the
> patches given the previous lack of interest in them.  :-P

For the record, here is what I checked in (minus all the auto-generated 
bits).  I did a cross build to powerpc-linux-gnu and verified that it's 
no longer dropping target-specific/multilib-specific things in lib/ and 
that the pieces fixed by this patch appear in a more reasonable place. 
It doesn't look like libjava supports remote installed-tree testing yet 
but I did regression-test on x86_64 native instead.

-Sandra
libjava.log (text/x-log, 2.1 KB)
2013-05-22  Mark Mitchell  <[email protected]>
	    Sandra Loosemore  <[email protected]>

	libjava/	    
	* configure.ac (dbexecdir): Base on $(toolexeclibdir), not
	$(libdir).
	* Makefile.am (pkgconfigdir): Likewise.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* gcj/Makefile.in: Regenerated.
	* include/Makefile.in: Regenerated.
	* testsuite/Makefile.in: Regenerated.

	libjava/classpath/
	* configure.ac: Define host_noncanonical and target_noncanonical.
	Support --enable-version-specific-runtime-libs.
	* m4/acinclude.m4 (CLASSPATH_TOOLEXECLIBDIR): Match libjava
	definition of toolexeclibdir.
	* configure: Regenerated.
	* Makefile.in: Regenerated.
	* doc/api/Makefile.in: Regenerated.
	* doc/Makefile.in: Regenerated.
	* examples/Makefile.in: Regenerated.
	* external/jsr166/Makefile.in: Regenerated.
	* external/Makefile.in: Regenerated.
	* external/relaxngDatatype/Makefile.in: Regenerated.
	* external/sax/Makefile.in: Regenerated.
	* external/w3c_dom/Makefile.in: Regenerated.
	* include/Makefile.in: Regenerated.
	* lib/Makefile.in: Regenerated.
	* native/fdlibm/Makefile.in: Regenerated.
	* native/jawt/Makefile.in: Regenerated.
	* native/jni/Makefile.in: Regenerated.
	* native/jni/gconf-peer/Makefile.in: Regenerated.
	* native/jni/gstreamer-peer/Makefile.in: Regenerated.
	* native/jni/gtk-peer/Makefile.in: Regenerated.
	* native/jni/java-io/Makefile.in: Regenerated.
	* native/jni/java-lang/Makefile.in: Regenerated.
	* native/jni/java-math/Makefile.in: Regenerated.
	* native/jni/java-net/Makefile.in: Regenerated.
	* native/jni/java-nio/Makefile.in: Regenerated.
	* native/jni/java-util/Makefile.in: Regenerated.
	* native/jni/Makefile.in: Regenerated.
	* native/jni/midi-alsa/Makefile.in: Regenerated.
	* native/jni/midi-dssi/Makefile.in: Regenerated.
	* native/jni/native-lib/Makefile.in: Regenerated.
	* native/jni/qt-peer/Makefile.in: Regenerated.
	* native/jni/xmlj/Makefile.in: Regenerated.
	* native/Makefile.in: Regenerated.
	* native/plugin/Makefile.in: Regenerated.
	* resource/Makefile.in: Regenerated.
	* scripts/Makefile.in: Regenerated.
	* tools/Makefile.in: Regenerated.
libjava.patch (text/x-patch, 4 KB)
Index: libjava/configure.ac
===================================================================
--- libjava/configure.ac	(revision 199219)
+++ libjava/configure.ac	(working copy)
@@ -1599,10 +1599,10 @@ gcjsubdir=gcj-$gcjversion-$libgcj_sovers
 multi_os_directory=`$CC -print-multi-os-directory`
 case $multi_os_directory in
   .)
-   dbexecdir='$(libdir)/'$gcjsubdir # Avoid /.
+   dbexecdir='$(toolexeclibdir)/'$gcjsubdir # Avoid /.
    ;;
   *)
-   dbexecdir='$(libdir)/'$multi_os_directory/$gcjsubdir
+   dbexecdir='$(toolexeclibdir)/'$multi_os_directory/$gcjsubdir
    ;;
 esac
 AC_SUBST(dbexecdir)
Index: libjava/Makefile.am
===================================================================
--- libjava/Makefile.am	(revision 199219)
+++ libjava/Makefile.am	(working copy)
@@ -221,7 +221,7 @@ endif
 
 dbexec_LTLIBRARIES = libjvm.la
 
-pkgconfigdir = $(libdir)/pkgconfig
+pkgconfigdir = $(toolexeclibdir)/pkgconfig
 
 jardir = $(datadir)/java
 jar_DATA = libgcj-$(gcc_version).jar libgcj-tools-$(gcc_version).jar
Index: libjava/classpath/configure.ac
===================================================================
--- libjava/classpath/configure.ac	(revision 199219)
+++ libjava/classpath/configure.ac	(working copy)
@@ -317,6 +317,26 @@ dnl defined to the same value for all mu
 dnl so that we can refer to the multilib installation directories from
 dnl classpath's build files.
 dnl -----------------------------------------------------------
+case ${host_alias} in
+  "") host_noncanonical=${build_noncanonical} ;;
+  *) host_noncanonical=${host_alias} ;;
+esac
+case ${target_alias} in
+  "") target_noncanonical=${host_noncanonical} ;;
+  *) target_noncanonical=${target_alias} ;;
+esac
+AC_SUBST(target_noncanonical)
+
+AC_ARG_ENABLE(version-specific-runtime-libs,
+  AS_HELP_STRING([--enable-version-specific-runtime-libs],    
+                 [specify that runtime libraries should be installed in a compiler-specific directory]),
+    [case "$enableval" in
+      yes) version_specific_libs=yes ;;
+      no)  version_specific_libs=no ;;
+      *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
+     esac],
+    [version_specific_libs=no]
+)
 CLASSPATH_TOOLEXECLIBDIR
 
 dnl -----------------------------------------------------------
Index: libjava/classpath/m4/acinclude.m4
===================================================================
--- libjava/classpath/m4/acinclude.m4	(revision 199219)
+++ libjava/classpath/m4/acinclude.m4	(working copy)
@@ -249,11 +249,35 @@ dnl GCJ LOCAL: Calculate toolexeclibdir
 dnl -----------------------------------------------------------
 AC_DEFUN([CLASSPATH_TOOLEXECLIBDIR],
 [
-  multi_os_directory=`$CC -print-multi-os-directory`
-  case $multi_os_directory in
-    .) toolexeclibdir=${libdir} ;; # Avoid trailing /.
-    *) toolexeclibdir=${libdir}/${multi_os_directory} ;;
+  case ${version_specific_libs} in
+    yes)
+      # Need the gcc compiler version to know where to install libraries
+      # and header files if --enable-version-specific-runtime-libs option
+      # is selected.
+      includedir='$(libdir)/gcc/$(target_noncanonical)/$(gcc_version)/include/'
+      toolexecdir='$(libdir)/gcc/$(target_noncanonical)'
+      toolexecmainlibdir='$(toolexecdir)/$(gcc_version)$(MULTISUBDIR)'
+      toolexeclibdir=$toolexecmainlibdir
+      ;;
+    no)
+      if test -n "$with_cross_host" &&
+         test x"$with_cross_host" != x"no"; then
+        # Install a library built with a cross compiler in tooldir, not libdir.
+        toolexecdir='$(exec_prefix)/$(target_noncanonical)'
+        toolexecmainlibdir='$(toolexecdir)/lib'
+      else
+        toolexecdir='$(libdir)/gcc-lib/$(target_noncanonical)'
+        toolexecmainlibdir='$(libdir)'
+      fi
+      multi_os_directory=`$CC -print-multi-os-directory`
+      case $multi_os_directory in
+        .) toolexeclibdir=$toolexecmainlibdir ;; # Avoid trailing /.
+        *) toolexeclibdir=$toolexecmainlibdir/$multi_os_directory ;;
+      esac
+      ;;
   esac
+  AC_SUBST(toolexecdir)
+  AC_SUBST(toolexecmainlibdir)
   AC_SUBST(toolexeclibdir)
 ])
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.