+ 2011-04-10 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ test defs: new requirement for the default java compiler
+ * tests/defs.in (for tool in $required): New requirement 'javac'.
+ * tests/java.test: Use it instead of ad-hoc configure check.
+ * tests/java-check.test: Likewise.
++ * tests/java-extra.test: Likewise.
++ * tests/java-noinst.test: Likewise.
+ * tests/instfail-java.test: Likewise.
+ * tests/instdir-java.test: Likewise.
+
2011-04-09 Stefano Lattarini <stefano.lattarini@gmail.com>
java: check_JAVA does not cause compilation by "make all" anymore
# it will try link *nothing* and complain it cannot find
# main(); funny). Use -help so it does not try linking anything.
echo "$me: running $CC -V -help"
- ( $CC -V -help ) || exit 77
+ $CC -V -help || exit 77
;;
+ javac)
+ echo "$me: running javac -version"
+ javac -version || exit 77
+ ;;
makedepend)
echo "$me: running makedepend -f-"
- ( makedepend -f- ) || exit 77
+ makedepend -f- || exit 77
;;
makeinfo-html)
# Make sure makeinfo understands --html.
# If $(javadir) is the empty string, then nothing should be installed there.
+ required=javac
. ./defs || Exit 1
-set -e
-
cat >>configure.in <<'END'
- AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
- ($HAS_JAVAC 77); $HAS_JAVAC 77
AC_OUTPUT
END
# This is the java sister test of instfail.test.
+ required=javac
. ./defs || Exit 1
-set -e
-
cat >>configure.in <<'END'
- AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
- ($HAS_JAVAC 77); $HAS_JAVAC 77
AC_OUTPUT
END
--- /dev/null
- AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
- ($HAS_JAVAC 77); $HAS_JAVAC 77
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check use of EXTRA with the JAVA primary. Also test interaction
+# of JAVA with conditionals (it's natural to test it here, since
+# EXTRA_JAVA exists mostly for ensuring interoperation with Automake
+# conditionals).
+
++required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(pkgdatadir)/java
+
+EXTRA_JAVA = Class1.java Class2.java Class3.java
+
+java_JAVA = Class1.java
+
+if COND
+java_JAVA += Class2.java
+else !COND
+java_JAVA += Class3.java
+endif !COND
+
+Class3.java: Makefile
+ echo 'class Class3 {}' > $@
+CLEANFILES = Class3.java
+END
+
+echo "class Class1 {}" > Class1.java
+echo "class Class2 {}" > Class2.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure cond=yes
+$MAKE
+ls -l
+test -f Class1.class
+test -f Class2.class
+test ! -f Class3.class
+test ! -f Class3.java
+
+$MAKE distclean
+
+./configure cond=no
+$MAKE
+ls -l
+test -f Class1.class
+test ! -f Class2.class
+test -f Class3.class
+test -f Class3.java
+
+:
--- /dev/null
- # Make sure that noinst_JAVA causes generated *.class files not to be installed.
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
- AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
- ($HAS_JAVAC 77); $HAS_JAVAC 77
++# Make sure that noinst_JAVA causes generated *.class files not to be
++# installed.
+
++required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Foo.java <<'END'
+class Foo { }
+END
+
+$ACLOCAL
+$AUTOCONF
+
+: > Makefile.in # Will be updated later.
+
+./configure --prefix="`pwd`/_inst"
+
+# We need this hacky loop because multiple uses of the JAVA primary
+# in the same Makefile.am are not allowed.
+
+for prefix in '' nodist_ dist_; do
+ echo "${prefix}noinst_JAVA = Foo.java" > Makefile.am
+ $AUTOMAKE
+ ./config.status Makefile
+ $MAKE
+ test -f Foo.class
+ $MAKE install
+ test ! -d _inst
+done
+
+:
# Minimal test of Java functionality.
+ required=javac
. ./defs || Exit 1
-set -e
-
cat >>configure.in <<'EOF'
- AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
- ($HAS_JAVAC 77); $HAS_JAVAC 77
AC_OUTPUT
EOF