This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: PR libjava/32098: New libtool doesn't support libjava
As I understand the theory (compile .class files instead of .java files)
this is fine with me. However, being curious about the portability of
the awk expression, I tried it on solaris, there with both awk and nawk,
printf "%c",0; prints nothing at all, so all those 00 above do not end
up in the output. Needs another method to convert text to binary.
We can emit them as FF, and then use "tr" to convert them to NULs. This
ought to work.
Paolo
2007-05-27 Paolo Bonzini <bonzini@gnu.org>
* 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,55 @@ 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 {}"
+# Eliminate NULs (for portability), and turn it into hex using
+# tr \\000 \\377 < foo.class | od -x | 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
+ }' | tr \\377 \\000 > conftest_compile.class << EOF
+cafebabeffffff31ff0d0aff03ff0a07ff0b07ff0c01ff063c696e69743e01ff
+0328295601ff04436f646501ff0f4c696e654e756d6265725461626c6501ff0a
+536f7572636546696c6501ff15636f6e66746573745f636f6d70696c652e6a61
+76610cff04ff0501ff10636f6e66746573745f636f6d70696c6501ff106a6176
+612f6c616e672f4f626a656374ff20ff02ff03ffffffffff01ffffff04ff05ff
+01ff06ffffff1dff01ff01ffffff052ab7ff01b1ffffff01ff07ffffff06ff01
+ffffff01ff01ff08ffffff02ff09
+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
+ }' | tr \\377 \\000 > conftest_link.class << EOF
+cafebabeffffff31ff0f0aff03ff0c07ff0d07ff0e01ff063c696e69743e01ff
+0328295601ff04436f646501ff0f4c696e654e756d6265725461626c6501ff04
+6d61696e01ff16285b4c6a6176612f6c616e672f537472696e673b295601ff0a
+536f7572636546696c6501ff12636f6e66746573745f6c696e6b2e6a6176610c
+ff04ff0501ff0d636f6e66746573745f6c696e6b01ff106a6176612f6c616e67
+2f4f626a656374ff21ff02ff03ffffffffff02ff01ff04ff05ff01ff06ffffff
+1dff01ff01ffffff052ab7ff01b1ffffff01ff07ffffff06ff01ffffff01ff09
+ff08ff09ff01ff06ffffff19ffffff01ffffff01b1ffffff01ff07ffffff06ff
+01ffffff01ff01ff0affffff02ff0bff
+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 +6823,7 @@ if test -n "$compiler"; then
fi
AC_LANG_RESTORE
+ac_compile="$lt_save_ac_compile"
CC="$lt_save_CC"
])# _LT_LANG_GCJ_CONFIG