PR43839 almost fixed

Jack Howarth
Thu Apr 22 02:31:00 GMT 2010

   I believe I have a fix for PR43839 (where the jni.exp
script doesn't honor --with-iconv as set during the build).
The following patch *almost* works...

Index: testsuite/
--- testsuite/	(revision 158624)
+++ testsuite/	(working copy)
@@ -401,6 +401,7 @@
 	@echo 'set host_triplet $(host_triplet)' >>site.tmp
 	@echo 'set target_alias "$(target_alias)"' >>site.tmp
 	@echo 'set target_triplet $(target_triplet)' >>site.tmp
+	@echo 'set libiconv "$(LIBICONV)"' >>site.tmp
 	@echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp
 	@test ! -f site.exp || \
 	  sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
Index: testsuite/libjava.jni/jni.exp
--- testsuite/libjava.jni/jni.exp	(revision 158624)
+++ testsuite/libjava.jni/jni.exp	(working copy)
@@ -251,6 +251,7 @@
 proc gcj_jni_get_cxxflags_invocation {} {
+  global libiconv
   global LIBJAVA
   if [info exists LIBJAVA] {
       set libjava $LIBJAVA;
@@ -267,7 +268,7 @@
   # to just make the linker find libgcc using -L options.
   # Similar logic applies to libgcj.
   if { [istarget "*-*-darwin*"] } {
-    lappend cxxflags -shared-libgcc -lgcj -liconv
+    lappend cxxflags "-shared-libgcc -lgcj $libiconv"
   if { [istarget "*-*-solaris*"] } {

However the compilation of PR16923.c now fails with...

Executing on host: /sw/src/ -B/sw/src/ /sw/src/   -bind_at_load -multiply_defined suppress -I. -I.. -I/sw/src/ -I/sw/src/ -I/sw/src/ -fdollars-in-identifiers -L/sw/src/ -ljvm {-shared-libgcc -lgcj -L/sw/lib -liconv}  -lm   -o PR16923    (timeout = 300)
xgcc: unrecognized option '-shared-libgcc -lgcj -L/sw/lib -liconv'
output is:
xgcc: unrecognized option '-shared-libgcc -lgcj -L/sw/lib -liconv'

FAIL: PR16923.c compilation

Can anyone explain why the above syntax ends up adding wrappering
curly brackets around the evaluated $libiconv. This doesn't seem
to happen for $subdir, etc in the same jni.exp script.

More information about the Gcc mailing list