This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[patch] 4.0 branch, port pr16923 fix for darwin
- From: Andreas Tobler <toa at pop dot agri dot ch>
- To: Java Patches <java-patches at gcc dot gnu dot org>
- Date: Mon, 28 Mar 2005 22:51:59 +0200
- Subject: [patch] 4.0 branch, port pr16923 fix for darwin
Is this ok for 4.0 branch?
2005-03-28 Andreas Tobler <a.tobler@schweiz.ch>
* testsuite/lib/libjava.exp (libjava_init): Use the same target
check for Darwin.
(libjava_arguments): Likewise.
* testsuite/libjava.jni/jni.exp (gcj_jni_compile_c_to_so): Likewise.
(gcj_jni_test_one): Likewise.
(gcj_jni_invocation_compile_c_to_binary): Likewise.
Add flags to keep the Darwin linker quiet.
(gcj_jni_invocation_test_one): Use the same target check for Darwin.
Add -liconv and lgcc_s for Darwin.
Andreas
Index: testsuite/lib/libjava.exp
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/lib/libjava.exp,v
retrieving revision 1.66
diff -u -r1.66 libjava.exp
--- testsuite/lib/libjava.exp 31 Dec 2004 12:34:15 -0000 1.66
+++ testsuite/lib/libjava.exp 28 Mar 2005 20:26:58 -0000
@@ -197,8 +197,8 @@
# Finally, add the gcc build directory so that we can find the
# shared libgcc. This, like much of dejagnu, is hideous.
set libjava_libgcc_s_path {}
-
- if { [string match "powerpc-*-darwin*" $target_triplet] } {
+
+ if { [istarget "*-*-darwin*"] } {
set so_extension "dylib"
} else {
set so_extension "so"
Index: testsuite/libjava.jni/jni.exp
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/libjava.jni/jni.exp,v
retrieving revision 1.18.2.1
diff -u -r1.18.2.1 jni.exp
--- testsuite/libjava.jni/jni.exp 3 Mar 2005 21:59:22 -0000 1.18.2.1
+++ testsuite/libjava.jni/jni.exp 28 Mar 2005 20:26:58 -0000
@@ -14,7 +14,7 @@
# so we check against powerpc-apple-darwin and set them to
# dylib, else we assume it's .so
- if { [ regexp {powerpc-apple-darwin} $host_triplet] } {
+ if { [istarget "*-*-darwin*"] } {
set so_extension "dylib"
set so_flag "-dynamiclib"
} else {
@@ -77,10 +77,10 @@
global INTERPRETER
# apple uses a different extension for shared/dynamic libraries
-# so we check against powerpc-apple-darwin and set them to
+# so we check against powerpc-apple-darwin and set them to
# dylib, else we assume it's .so
- if { [ regexp {powerpc-apple-darwin} $host_triplet] } {
+ if { [istarget "*-*-darwin*"] } {
set so_extension "dylib"
} else {
set so_extension "so"
@@ -134,12 +134,12 @@
# Darwin does not yet have a libgcc_s.dylib library.
# So we add it here. If the libgcc_s is installed, the libstdc++
# would pick it up.
- if { [ regexp {powerpc-apple-darwin} $host_triplet] } {
+ if { [istarget "*-*-darwin*"] } {
lappend cxxflaglist "-lgcc_s -lstdc++"
} else {
lappend cxxflaglist "-lstdc++"
}
-
+
set cxxflags [join $cxxflaglist]
}
@@ -194,6 +194,10 @@
set filename [file tail $file]
set name [file rootname $filename]
+ # Set some darwin specific options
+ if { [istarget "*-*-darwin*"] } {
+ lappend options "additional_flags=-multiply_defined suppress"
+ }
# Find the generated header.
lappend options "additional_flags=-I. -I.."
@@ -238,7 +242,14 @@
pass "bytecompile $file"
set cfile [file rootname $file].c
- set cxxflags "-L../.libs -lgcj"
+ # Darwin needs -liconv linked, otherwise we get some unresolved.
+ # Also, like in the cxxtest we need to add -lgcc_s since Darwin
+ # has no libgcc_s.dylib installed yet.
+ if { [istarget "*-*-darwin*"] } {
+ set cxxflags "-L../.libs -lgcc_s -lgcj -liconv"
+ } else {
+ set cxxflags "-L../.libs -lgcj"
+ }
if {! [gcj_jni_invocation_compile_c_to_binary $cfile $cxxflags]} {
# FIXME