Hi Warren, thanks for the bug report. As Gary already noted, your Java compiler installation is broken, please complain to your vendor or install the missing packages.
We have workarounds in most Java tests but not in this one, e.g., convenience.at or infer-tag.at. So I guess that calls for factorization of the issue. The convenience test needs executability, the rest only linkability. These tests should probably really be somewhere in libtool.m4 ... but ok to commit this, and add Warren to THANKS? So far only tested with a broken and a half-working java installation (convenience test is skipped). Thanks, Ralf Factorize testing gcj installation in the testsuite. * tests/testsuite.at (LT_AT_TAG): For the GCJ tag, actually try to compile a .java file when deciding whether to skip. (LT_AT_EXEC_TAG): New macro, to also ensure runnability. * tests/convenience.at (Java convenience archives): Use LT_AT_EXEC_TAG, simplify accordingly. * tests/flags.at (passing lt_tag flags through libtool): Use m4_defn for tag so LT_AT_TAG works. * tests/infer-tag.at (GCJ inferred tag): Simplify. * THANKS: Update. Report by Warren Dodge. diff --git a/tests/convenience.at b/tests/convenience.at index 339c59a..f076e61 100644 --- a/tests/convenience.at +++ b/tests/convenience.at @@ -1,6 +1,7 @@ # convenience.at -- testing C convenience archives -*- Autotest -*- -# Copyright (C) 2005, 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright (C) 2005, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. # Written by Ralf Wildenhues, 2005 # # This file is part of GNU Libtool. @@ -227,7 +228,7 @@ AT_CLEANUP AT_SETUP([Java convenience archives]) -LT_AT_TAG([GCJ]) +LT_AT_EXEC_TAG([GCJ]) AT_KEYWORDS([libtool]) cat >foo1.java <<EOF @@ -259,15 +260,6 @@ public class A$i { }; EOF - # There are just too many broken gcj installations out there, either missing - # libgcj.spec or unable to find it. Skip this test for them. - if test $i -eq 1; then - AT_CHECK([$GCJ $GCJFLAGS -c foo1.java || exit 77], [], [ignore], [ignore]) - AT_CHECK([$GCJ $GCJFLAGS --main=foo1 -o foo1$EXEEXT foo1.java A1.java || exit 77],[],[ignore],[ignore]) - AT_CHECK([./foo1$EXEEXT || exit 77],[],[ignore],[ignore]) - rm -f foo1.o foo1.obj foo1$EXEEXT - fi - $LIBTOOL --tag=GCJ --mode=compile $GCJ $GCJFLAGS -c foo$i.java $LIBTOOL --tag=GCJ --mode=compile $GCJ $GCJFLAGS -c A$i.java $LIBTOOL --tag=GCJ --mode=link $GCJ $GCJFLAGS $LDFLAGS -o liba$i.la A$i.lo diff --git a/tests/flags.at b/tests/flags.at index eceda74..7f600be 100644 --- a/tests/flags.at +++ b/tests/flags.at @@ -1,6 +1,6 @@ # flags.at -- libtool passing of flags -*- Autotest -*- # -# Copyright (C) 2009 Free Software Foundation, Inc. +# Copyright (C) 2009, 2010 Free Software Foundation, Inc. # # This file is part of GNU Libtool. # @@ -24,7 +24,7 @@ m4_foreach([lt_tag], [CC, CXX, F77, FC, GCJ], [AT_SETUP([passing lt_tag flags through libtool]) AT_KEYWORDS([libtool]) -LT_AT_TAG([lt_tag]) +LT_AT_TAG(m4_defn([lt_tag])) LDFLAGS="$LDFLAGS -no-undefined" eval "`$LIBTOOL --config | $EGREP '^(FGREP)='`" diff --git a/tests/infer-tag.at b/tests/infer-tag.at index ebc7581..57dd728 100644 --- a/tests/infer-tag.at +++ b/tests/infer-tag.at @@ -1,6 +1,6 @@ # infer-tag.at -- libtool without --tag -*- Autotest -*- # -# Copyright (C) 2008 Free Software Foundation, Inc. +# Copyright (C) 2008, 2010 Free Software Foundation, Inc. # # This file is part of GNU Libtool. # @@ -91,10 +91,6 @@ AT_DATA([A.java], }; ]]) -# There are just too many broken gcj installations out there, either missing -# libgcj.spec or unable to find it. Skip this test for them. -AT_CHECK([$GCJ $GCJFLAGS -c A.java || exit 77], [], [ignore], [ignore]) - AT_CHECK([$LIBTOOL --mode=compile $GCJ $GCJCFLAGS -c A.java], [], [ignore], [ignore]) diff --git a/tests/testsuite.at b/tests/testsuite.at index 71b9dc4..423e544 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -275,11 +275,38 @@ AT_CHECK([if $LIBTOOL --mode=execute $2 "$lt_exe" $6; then :; else lt_status=$?; # LT_AT_TAG(TAG) # -------------- +# Declare that the language TAG will be used in this test. +# Skips the test if the compiler is apparently not functional. m4_define([LT_AT_TAG], [AT_KEYWORDS([$1]) AT_CHECK([{ test -n "[$]$1" && test "X[$]$1" != Xno; } || (exit 77)]) -m4_if([$1], [CXX], - [AT_CHECK([test "X$CXX" != Xg++ || (g++ -v >/dev/null 2>&1) || (exit 77)])]) +m4_case([$1], + [CXX], + [AT_CHECK([test "X$CXX" != Xg++ || (g++ -v >/dev/null 2>&1) || (exit 77)])], + [GCJ], + [# There are just too many broken gcj installations out there, either missing + # libgcj.spec or unable to find it. Skip the test for them. + AT_DATA([gcj_test.java], +[[public class gcj_test { + public static void main(String[] argv) { } + } +]]) + AT_CHECK([$GCJ $GCJFLAGS -c gcj_test.java || exit 77], + [], [ignore], [ignore])]) +]) + + +# LT_AT_EXEC_TAG([TAG]) +# --------------------- +# Declare that the language TAG will be used and compiled programs may be run. +# Skips the test if the compiler is apparently not functional. +m4_define([LT_AT_EXEC_TAG], +[LT_AT_TAG([$1]) +m4_case([$1], + [GCJ], + [AT_CHECK([$GCJ $GCJFLAGS --main=gcj_test -o gcj_test$EXEEXT gcj_test.java ]dnl + [|| exit 77], [], [ignore], [ignore]) + AT_CHECK([./gcj_test$EXEEXT || exit 77], [], [ignore], [ignore])]) ])