libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PATCH: PR libjava/32098: New libtool doesn't support libjava


From: Paolo Bonzini
Subject: Re: PATCH: PR libjava/32098: New libtool doesn't support libjava
Date: Mon, 28 May 2007 09:21:32 +0200
User-agent: Thunderbird 2.0.0.0 (Macintosh/20070326)


No, that's wrong. You can try changing libtool.m4 to run tests on .class files instead; compile them with an old GCJ, and include the bytecode in libtool.m4, using tr or awk to turn ASCII strings into bytecode.


That is the best I can find. I don't know anything about .classs file
nor java bytecode.

So the attached patch (untested because the problem does not reproduce on my machine) should give you an idea of what I meant. Please test it and/or fix it.

Libtool maintainers, would you accept a patch like this one? The problem is that under some configurations, GCC 4.3 cannot compile Java source code until its build has finished.

Paolo
2007-05-27  Paolo Bonzini  <address@hidden>

        * libtool.m4 (_LT_LANG_GCJ_CONFIG): Run tests on .class files.

Index: libtool.m4
===================================================================
--- libtool.m4  (revision 125123)
+++ libtool.m4  (working copy)
@@ -6737,18 +6737,54 @@ m4_defun([_LT_LANG_GCJ_CONFIG],
 [AC_REQUIRE([LT_PROG_GCJ])dnl
 AC_LANG_SAVE
 
-# Source file extension for Java test sources.
-ac_ext=java
+# Source file extension for Java test sources.  Actually, we use a list
+# of input files so that we can prepare binary .class files and keep
+# lt_simple_compile_test_code/lt_simple_link_test_code in ASCII.
+ac_ext=list
 
 # Object file extension for compiled Java test sources.
 objext=o
 _LT_TAGVAR(objext, $1)=$objext
 
 # Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
+# "class conftest_compile {}"
+# Turn it into hex using "od -x foo.class | sed s/^.......// | tr -d ' '"
+lt_simple_compile_test_code='conftest_compile.class'
+awk 'BEGIN { h = "0123456789abcdef" }
+  {
+    for (i = 1; i <= length; i+=2)
+      printf "%c", 16*index(h, substr($0, i, 1))+index(h, substr($0, i+1, 
1))-17
+  }' > conftest_compile.class << EOF
+cafebabe00000031000d0a0003000a07000b07000c0100063c696e69743e0100
+03282956010004436f646501000f4c696e654e756d6265725461626c6501000a
+536f7572636546696c65010015636f6e66746573745f636f6d70696c652e6a61
+76610c00040005010010636f6e66746573745f636f6d70696c650100106a6176
+612f6c616e672f4f626a65637400200002000300000000000100000004000500
+0100060000001d00010001000000052ab70001b1000000010007000000060001
+0000000100010008000000020009
+EOF
 
 # Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void 
main(String[[]] argv) {}; }'
+# "public class conftest_link { public static void main(String[[]] argv) {}; }"
+lt_simple_link_test_code='conftest_link.class'
+awk 'BEGIN { h = "0123456789abcdef" }
+  {
+    for (i = 1; i <= length; i+=2)
+      printf "%c", 16*index(h, substr($0, i, 1))+index(h, substr($0, i+1, 
1))-17
+  }' > conftest_link.class << EOF
+cafebabe00000031000f0a0003000c07000d07000e0100063c696e69743e0100
+03282956010004436f646501000f4c696e654e756d6265725461626c65010004
+6d61696e010016285b4c6a6176612f6c616e672f537472696e673b295601000a
+536f7572636546696c65010012636f6e66746573745f6c696e6b2e6a6176610c
+0004000501000d636f6e66746573745f6c696e6b0100106a6176612f6c616e67
+2f4f626a65637400210002000300000000000200010004000500010006000000
+1d00010001000000052ab70001b1000000010007000000060001000000010009
+0008000900010006000000190000000100000001b10000000100070000000600
+01000000010001000a00000002000b00
+EOF
+
+lt_save_ac_compile="$ac_compile"
+ac_compile='$CC -c $CFLAGS $CPPFLAGS @conftest.$ac_ext >&5'
 
 # ltmain only uses $CC for tagged configurations so make sure $CC is set.
 _LT_TAG_COMPILER
@@ -6786,6 +6822,7 @@ if test -n "$compiler"; then
 fi
 
 AC_LANG_RESTORE
+ac_compile="$lt_save_ac_compile"
 CC="$lt_save_CC"
 ])# _LT_LANG_GCJ_CONFIG
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]