automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, java-work, updated. v1.11-3


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, java-work, updated. v1.11-363-g62cb9a4
Date: Tue, 26 Apr 2011 16:41:05 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=62cb9a4f4be71d740ff412f0ba7c7ef29feaa8a0

The branch, java-work has been updated
       via  62cb9a4f4be71d740ff412f0ba7c7ef29feaa8a0 (commit)
       via  5a46e0340900136d66dee39450117a70a4190d45 (commit)
       via  aa3ad84fd24967756cb031c4f3529198afdba900 (commit)
       via  59b5f75f6095f40d3316cb2928ba1d1f30ab15ce (commit)
       via  33e8c5aedbcb397954455761bee62715737a309a (commit)
       via  6a5482fcf190641eb46e00fe877ea1e31f241488 (commit)
       via  6b53cb6bfab7d903e5bf72bf2f0697be335707a8 (commit)
       via  01dede4422493957c23b3bc7ecfe596f93a58a54 (commit)
      from  0bf20ac342d7d4e2eaede58e110faf356e34e167 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 62cb9a4f4be71d740ff412f0ba7c7ef29feaa8a0
Author: Stefano Lattarini <address@hidden>
Date:   Tue Apr 26 16:52:45 2011 +0200

    java coverage: test JAVACFLAGS and AM_JAVACFLAGS
    
    * tests/javaflags.test: New test.
    * tests/Makefile.am (TESTS): Update.

commit 5a46e0340900136d66dee39450117a70a4190d45
Author: Stefano Lattarini <address@hidden>
Date:   Tue Apr 26 10:12:43 2011 +0200

    java coverage: test rebuild rules for java
    
    * tests/java-rebuild.test: New test.
    * tests/Makefile.am (TESTS): Update.

commit aa3ad84fd24967756cb031c4f3529198afdba900
Author: Stefano Lattarini <address@hidden>
Date:   Sat Apr 23 20:42:30 2011 +0200

    java coverage: try to build and run a java program
    
    * tests/java-compile-run-flat.test: New test, try to build and run
    a "UNIX-style" java program (complete with wrapper shell script
    and the like) with a "flat" source-tree setup (i.e., everything in
    the top-level directory).
    * tests/java-compile-nested.test: Likewise, but using a more
    typical "nested" source-tree setup.
    * tests/Makefile.am (TESTS): Update.

commit 59b5f75f6095f40d3316cb2928ba1d1f30ab15ce
Author: Stefano Lattarini <address@hidden>
Date:   Sat Apr 23 20:00:11 2011 +0200

    test defs: new requirement for the default java interpreter
    
    * tests/defs.in (for tool in $required): New requirement 'java'.

commit 33e8c5aedbcb397954455761bee62715737a309a
Author: Stefano Lattarini <address@hidden>
Date:   Sat Apr 23 19:10:15 2011 +0200

    java tests: tweak and make stricter a couple of tests
    
    * tests/javasubst.test: Use proper m4 quoting.  Add trailing `:'
    command.  Enable `errexit' shell flag, and related changes.
    Prefer cat + here-doc over echo to append to configure.in.
    Make grepping of Makefile.in stricter.  Add debugging output.
    Improve heading comments.
    * tests/javaprim.test: Likewise.

commit 6a5482fcf190641eb46e00fe877ea1e31f241488
Author: Stefano Lattarini <address@hidden>
Date:   Sat Apr 23 14:20:38 2011 +0200

    java coverage: add test on uninstall with JAVA primary
    
    * tests/java-uninstall.test: New test.
    * tests/Makefile.am (TESTS): Update.

commit 6b53cb6bfab7d903e5bf72bf2f0697be335707a8
Author: Stefano Lattarini <address@hidden>
Date:   Sat Apr 23 14:14:20 2011 +0200

    java tests: require java compiler more properly
    
    * tests/java-extra.test: Use "required=javac" instead of an
    ad-hoc configure check.
    * tests/java-noinst.test: Likewise.

commit 01dede4422493957c23b3bc7ecfe596f93a58a54
Author: Stefano Lattarini <address@hidden>
Date:   Sat Apr 23 13:52:40 2011 +0200

    java: allow both JAVA and nobase_JAVA in the same Makefile.am
    
    * automake.in (handle_java): Also strip `nobase_' from the given
    prefix, when needed.
    * tests/java-clean.test: Update and extend.
    * tests/java-compile-install.test: Likewise.
    * tests/java-no-duplicate.test: Likewise.
    * tests/java-sources.test: Likewise.
    * tests/java-noinst.test: Likewise.
    * tests/java-mix-dist-nodist.test: Renamed to ...
    * tests/java-mix.test: ... this, and extended.
    * tests/java-nobase.test: New test, still xfailing due to
    unrelated issues.
    * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |   67 ++++++
 automake.in                                        |    2 +-
 tests/Makefile.am                                  |    9 +-
 tests/Makefile.in                                  |   11 +-
 tests/defs.in                                      |    5 +
 tests/java-clean.test                              |   25 ++-
 tests/java-compile-install.test                    |   23 ++-
 tests/java-compile-run-flat.test                   |  235 +++++++++++++++++++
 tests/java-compile-run-nested.test                 |  248 ++++++++++++++++++++
 tests/java-extra.test                              |    3 +-
 tests/{java-mix-dist-nodist.test => java-mix.test} |   34 ++-
 tests/java-no-duplicate.test                       |    3 +
 ...{java-compile-install.test => java-nobase.test} |   57 ++---
 tests/java-noinst.test                             |   40 ++--
 tests/java-rebuild.test                            |  126 ++++++++++
 tests/java-sources.test                            |    6 +
 tests/java-uninstall.test                          |  101 ++++++++
 ...dist-acconfig-no-subdir.test => javaflags.test} |   52 +++--
 tests/javaprim.test                                |   13 +-
 tests/javasubst.test                               |   17 +-
 20 files changed, 961 insertions(+), 116 deletions(-)
 create mode 100755 tests/java-compile-run-flat.test
 create mode 100755 tests/java-compile-run-nested.test
 rename tests/{java-mix-dist-nodist.test => java-mix.test} (63%)
 copy tests/{java-compile-install.test => java-nobase.test} (53%)
 create mode 100755 tests/java-rebuild.test
 create mode 100755 tests/java-uninstall.test
 copy tests/{autodist-acconfig-no-subdir.test => javaflags.test} (54%)

diff --git a/ChangeLog b/ChangeLog
index 414f5cb..0031f1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,70 @@
+2011-04-26  Stefano Lattarini  <address@hidden>
+
+       java coverage: test JAVACFLAGS and AM_JAVACFLAGS
+       * tests/javaflags.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-26  Stefano Lattarini  <address@hidden>
+
+       java coverage: test rebuild rules for java
+       * tests/java-rebuild.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-26  Stefano Lattarini  <address@hidden>
+
+       java coverage: try to build and run a java program
+       * tests/java-compile-run-flat.test: New test, try to build and run
+       a "UNIX-style" java program (complete with wrapper shell script
+       and the like) with a "flat" source-tree setup (i.e., everything in
+       the top-level directory).
+       * tests/java-compile-nested.test: Likewise, but using a more
+       typical "nested" source-tree setup.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-23  Stefano Lattarini  <address@hidden>
+
+       test defs: new requirement for the default java interpreter
+       * tests/defs.in (for tool in $required): New requirement 'java'.
+
+2011-04-23  Stefano Lattarini  <address@hidden>
+
+       java tests: tweak and make stricter a couple of tests
+       * tests/javasubst.test: Use proper m4 quoting.  Add trailing `:'
+       command.  Enable `errexit' shell flag, and related changes.
+       Prefer cat + here-doc over echo to append to configure.in.
+       Make grepping of Makefile.in stricter.  Add debugging output.
+       Improve heading comments.
+       * tests/javaprim.test: Likewise.
+
+2011-04-23  Stefano Lattarini  <address@hidden>
+
+       java coverage: add test on uninstall with JAVA primary
+       * tests/java-uninstall.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-23  Stefano Lattarini  <address@hidden>
+
+       java tests: require java compiler more properly
+       * tests/java-extra.test: Use "required=javac" instead of ad-hoc
+       configure check.
+       * tests/java-noinst.test: Likewise.
+
+2011-04-23  Stefano Lattarini  <address@hidden>
+
+       java: allow both JAVA and nobase_JAVA in the same Makefile.am
+       * automake.in (handle_java): Also strip `nobase_' from the given
+       prefix, when needed.
+       * tests/java-clean.test: Update and extend.
+       * tests/java-compile-install.test: Likewise.
+       * tests/java-no-duplicate.test: Likewise.
+       * tests/java-sources.test: Likewise.
+       * tests/java-noinst.test: Likewise.
+       * tests/java-mix-dist-nodist.test: Renamed to ...
+       * tests/java-mix.test: ... this, and extended.
+       * tests/java-nobase.test: New test, still xfailing due to
+       unrelated issues.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
 2011-04-22  Stefano Lattarini  <address@hidden>
 
        testsuite: more environment sanitization
diff --git a/automake.in b/automake.in
index 01b41a1..434ee20 100755
--- a/automake.in
+++ b/automake.in
@@ -5114,7 +5114,7 @@ sub handle_java
     my @java_sources = ();
     foreach my $prefix (@prefixes)
       {
-        (my $curs = $prefix) =~ s/^(?:no)?dist_//;
+        (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//;
 
        next
          if $curs eq 'EXTRA';
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2d59d1e..de1dfda 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -21,6 +21,7 @@ all.test \
 auxdir2.test \
 cond17.test \
 gcj6.test \
+java-nobase.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
 txinfo5.test
@@ -435,12 +436,18 @@ java-check.test \
 java-clean.test \
 javaprim.test \
 javasubst.test \
+javaflags.test \
 java-extra.test \
 java-noinst.test \
+java-nobase.test \
 java-compile-install.test \
+java-compile-run-flat.test \
+java-compile-run-nested.test \
 java-sources.test \
 java-no-duplicate.test \
-java-mix-dist-nodist.test \
+java-mix.test \
+java-uninstall.test \
+java-rebuild.test \
 ldadd.test \
 ldflags.test \
 lex.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index aadb869..db8a6c0 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -277,6 +277,7 @@ all.test \
 auxdir2.test \
 cond17.test \
 gcj6.test \
+java-nobase.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
 txinfo5.test
@@ -301,6 +302,8 @@ color2-p.test \
 comment9-p.test \
 dejagnu-p.test \
 exeext4-p.test \
+java-compile-run-flat-p.test \
+java-compile-run-nested-p.test \
 maken3-p.test \
 maken4-p.test \
 pr401-p.test \
@@ -706,12 +709,18 @@ java-check.test \
 java-clean.test \
 javaprim.test \
 javasubst.test \
+javaflags.test \
 java-extra.test \
 java-noinst.test \
+java-nobase.test \
 java-compile-install.test \
+java-compile-run-flat.test \
+java-compile-run-nested.test \
 java-sources.test \
 java-no-duplicate.test \
-java-mix-dist-nodist.test \
+java-mix.test \
+java-uninstall.test \
+java-rebuild.test \
 ldadd.test \
 ldflags.test \
 lex.test \
diff --git a/tests/defs.in b/tests/defs.in
index ef35d9f..c8c0059 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -195,6 +195,11 @@ do
       echo "$me: running javac -version -help"
       javac -version -help || exit 77
       ;;
+    java)
+      # See the comments above about `javac' for why we use also `-help'.
+      echo "$me: running java -version -help"
+      java -version -help || exit 77
+      ;;
     makedepend)
       echo "$me: running makedepend -f-"
       ( makedepend -f- ) || exit 77
diff --git a/tests/java-clean.test b/tests/java-clean.test
index 4dcc966..7db5e53 100755
--- a/tests/java-clean.test
+++ b/tests/java-clean.test
@@ -27,14 +27,21 @@ END
 
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
+
 java_JAVA = Class.java
 dist_java_JAVA = ClassDist.java
-nodist_java_JAVA = ClassNoDist.java
+nodist_java_JAVA = ClassNodist.java
+
+nobase_java_JAVA = ClassNobase.java
+nobase_dist_java_JAVA = ClassNobaseDist.java
+nobase_nodist_java_JAVA = ClassNobaseNodist.java
 END
 
-echo 'class Class {}' > Class.java
-echo 'class ClassDist {}' > ClassDist.java
-echo 'class ClassNoDist {}' > ClassNoDist.java
+for base in '' Nobase; do
+  for dist in '' Dist Nodist; do
+    echo "class Class$base$dist {}" > Class$base$dist.java
+  done
+done
 
 $ACLOCAL
 $AUTOCONF
@@ -44,14 +51,18 @@ $AUTOMAKE
 $MAKE
 ls -l
 test -f classjava.stamp
-test -f Class.class
-test -f ClassDist.class
-test -f ClassNoDist.class
+for base in '' Nobase; do
+  for dist in '' Dist Nodist; do
+    test -f Class$base$dist.class
+  done
+done
 $MAKE clean
 find . -name '*.class' -o -name '*.stamp' | grep . && Exit 1
 # We should not remove unrelated stamp files.
 echo timestamp > classjava2.stamp
+echo timestamp > classdist_java.stamp
 $MAKE clean
 test -f classjava2.stamp
+test -f classdist_java.stamp
 
 :
diff --git a/tests/java-compile-install.test b/tests/java-compile-install.test
index b2145fb..74b7a00 100755
--- a/tests/java-compile-install.test
+++ b/tests/java-compile-install.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2004, 2007  Free Software Foundation, Inc.
+# 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
@@ -28,12 +28,20 @@ EOF
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
 java_JAVA = Foo.java
-dist_java_JAVA = Bar.java
+nobase_java_JAVA = Foo2.java
+nobase_dist_java_JAVA = Bar.java
 nodist_java_JAVA = Baz.java
 
-# Java files are not distributed by default.
+# Java files are not distributed by default, so we distribute
+# one "by hand" ...
 EXTRA_DIST = Foo.java
+# ... and make the other one generated.
+Foo2.java:
+       rm -f $@ address@hidden
+       echo 'class bClass {}' > address@hidden
+       chmod a-w address@hidden && mv -f address@hidden $@
 
+# Explicitly declared as `nodist_', so generate it.
 Baz.java:
        rm -f $@ address@hidden
        echo 'class Baz {}' > address@hidden
@@ -44,29 +52,34 @@ test:
        ls -l $(srcdir) . ;: For debugging.
        test   -f $(srcdir)/Foo.java
        test   -f $(srcdir)/Bar.java
+       test   -f Foo2.java
        test   -f Baz.java
        test   -f aClass.class
+       test   -f bClass.class
        test   -f Zardoz.class
        test   -f Baz.class
        test   -f Baz2.class
        test ! -r Foo.class
        test ! -r Bar.class
+       test   -f classjava.stamp
 
 test-install:
-       find $(prefix) ;: For debugging.
+       ls -l $(javadir) ;: For debugging.
+       test   -f '$(javadir)/bClass.class'
        test   -f '$(javadir)/aClass.class'
        test   -f '$(javadir)/Zardoz.class'
        test   -f '$(javadir)/Baz.class'
        test   -f '$(javadir)/Baz2.class'
        test ! -r '$(javadir)/Foo.class'
        test ! -r '$(javadir)/Bar.class'
+       if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
 
 check-local: test
 installcheck-local: test-install
 
 .PHONY: test test-install
 
-DISTCLEANFILES = Baz.java
+DISTCLEANFILES = Baz.java Foo2.java
 END
 
 echo 'class aClass {}' > Foo.java
diff --git a/tests/java-compile-run-flat.test b/tests/java-compile-run-flat.test
new file mode 100755
index 0000000..ccf7c11
--- /dev/null
+++ b/tests/java-compile-run-flat.test
@@ -0,0 +1,235 @@
+#! /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/>.
+
+# Test on compilation and execution of Java class files.
+# Also meddle with wrapper scripts, as would be probably seen in a real
+# "UNIX-style" use case.
+# This test uses a "flat" setup for the source tree (i.e., everything in
+# the top-level directory); the sister test `java-compile-run-nested.test'
+# do similar checks with a more usual, "nested" setup.
+
+required='java javac'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_SUBST([JAVA], [java])
+AC_CONFIG_SRCDIR([PkgLocation.jin])
+AC_CONFIG_FILES([PkgLocation.java:PkgLocation.jin])
+AC_OUTPUT
+END
+
+## TOP-LEVEL SETUP AND TARGETS ##
+
+cat > Makefile.am <<'END'
+EXTRA_DIST = # Will be updated later.
+
+test-built:
+       ls -l $(srcdir)               ;: For debugging.
+       test $(srcdir) = . || ls -l . ;: Likewise.
+       test -f $(srcdir)/Main.java
+       test -f $(srcdir)/HelloStream.java
+       test -f $(srcdir)/PkgLocation.jin
+       test -f PkgLocation.java
+       test -f HelloStream.class
+       test -f PkgLocation.class
+       test -f Main.class
+       test -f classjava.stamp
+
+test-installed:
+       ls -l $(javadir) ;: For debugging.
+       test -f $(javadir)/HelloStream.class
+       test -f $(javadir)/PkgLocation.class
+       test -f $(javadir)/Main.class
+       if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
+
+run-installed:
+       jprog_doing_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
+check-local: test-built
+installcheck-local: test-installed run-installed
+
+.PHONY: test-built test-installed run-installed
+END
+
+## WRAPPER SCRIPT ##
+
+cat >> Makefile.am <<'END'
+bin_SCRIPTS = jprog
+
+edit_script = sed -e 's|address@hidden@|$(JAVA)|g' \
+                  -e 's|address@hidden@|$(javadir)|g' \
+                  -e 's|address@hidden@|$(SHELL)|g'
+
+jprog: jprog.sh
+       rm -f $@ address@hidden
+       $(edit_script) `test -f 'address@hidden' || echo 
$(srcdir)/address@hidden >address@hidden
+       chmod a-w address@hidden && chmod a+x address@hidden && mv -f 
address@hidden $@
+       sed 's/^/ | /' $@ ;: for debugging.
+
+EXTRA_DIST += jprog.sh
+CLEANFILES = jprog
+END
+
+cat > jprog.sh <<'END'
address@hidden@
+CLASSPATH=${jprog_classpath-'@javadir@'}${CLASSPATH+":$CLASSPATH"}
+export CLASSPATH
+case $# in
+  0) exec @JAVA@ Main;;
+  *) exec @JAVA@ Main "$@";;
+esac
+END
+
+## JAVA SOURCES ##
+
+cat >> Makefile.am <<'END'
+javadir = $(pkgdatadir)/java
+
+dist_java_JAVA = Main.java HelloStream.java
+nodist_java_JAVA = PkgLocation.java
+END
+
+cat > PkgLocation.jin <<'END'
+public class PkgLocation {
+    public static String prefix() {
+        return new String("@prefix@");
+    }
+}
+END
+
+cat > Main.java <<'END'
+public class Main {
+    public static void main(String[] args) {
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("--print-prefix")) {
+                System.out.println(PkgLocation.prefix());
+            } else if (args[i].equals("--hello-stdout")) {
+                HelloStream.to(System.out);
+            } else if (args[i].equals("--hello-stderr")) {
+                HelloStream.to(System.err);
+            } else {
+               System.err.println("jprog: invalid option '" + args[i] +
+                                  "'");
+               System.exit(2);
+            }
+        }
+        System.exit(0);
+    }
+}
+END
+
+cat > HelloStream.java <<'END'
+import java.io.PrintStream;
+class HelloStream {
+    public static void to(PrintStream stream) {
+        stream.println("Hello, Stream!");
+    }
+}
+END
+
+## TESTS ##
+
+cat >> Makefile.am <<'END'
+## FIXME: Use AM_TESTS_ENVIRONMENT here when it becomes available.
+TESTS_ENVIRONMENT = \
+    if test x"$$jprog_doing_installcheck" != x"yes"; then \
+        jprog_classpath='$(abs_top_builddir):$(abs_top_srcdir)'; \
+        export jprog_classpath; \
+        PATH='$(abs_top_builddir)':$$PATH; \
+        export PATH; \
+    else \
+        unset jprog_classpath || :; \
+        PATH='$(prefix)/bin':$$PATH; \
+        export PATH; \
+    fi; \
+    config_time_prefix='@prefix@'; export config_time_prefix;
+
+TESTS = \
+  simple.test \
+  prefix.test \
+  stdout.test \
+  stderr.test \
+  badarg.test
+
+XFAIL_TESTS = badarg.test
+
+EXTRA_DIST += $(TESTS)
+END
+
+cat > simple.test <<'END'
+#!/bin/sh
+jprog
+END
+
+cat > prefix.test <<'END'
+#!/bin/sh
+jprefix=`jprog --print-prefix` || exit 1
+echo "$0: exp prefix: $config_time_prefix"
+echo "$0: got prefix: $jprefix"
+test x"$jprefix" = x"$config_time_prefix"
+END
+
+cat > stdout.test <<'END'
+#!/bin/sh
+rc=0
+jprog --hello-stdout >stdout.out 2>stdout.err || { echo \$?=$?; rc=1; }
+sed 's/^/out:/' <stdout.out      # For debugging.
+sed 's/^/err:/' <stdout.err >&2  # Likewise.
+test -s stdout.err && rc=1
+test "`cat stdout.out`" = 'Hello, Stream!' || rc=1
+rm -f stdout.out stdout.err || rc=1
+exit $rc
+END
+
+cat > stderr.test <<'END'
+#!/bin/sh
+rc=0
+jprog --hello-stderr >stderr.out 2>stderr.err || { echo \$?=$?; rc=1; }
+sed 's/^/out:/' <stderr.out      # For debugging.
+sed 's/^/err:/' <stderr.err >&2  # Likewise.
+test -s stderr.out && rc=1
+test "`cat stderr.err`" = 'Hello, Stream!' || rc=1
+rm -f stderr.out stderr.err || rc=1
+exit $rc
+END
+
+cat > badarg.test <<'END'
+#!/bin/sh
+jprog --bad-argument
+END
+
+chmod a+x *.test
+
+## DO CHECKS ##
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# To have the parallel testsuite more verbose.
+VERBOSE=yes; export VERBOSE
+
+./configure --prefix="`pwd`/_inst"
+cat PkgLocation.java # For debugging.
+$MAKE check
+$MAKE install
+$MAKE test-installed
+$MAKE run-installed
+$MAKE distcheck
+
+:
diff --git a/tests/java-compile-run-nested.test 
b/tests/java-compile-run-nested.test
new file mode 100755
index 0000000..f5fcaa1
--- /dev/null
+++ b/tests/java-compile-run-nested.test
@@ -0,0 +1,248 @@
+#! /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/>.
+
+# Test on compilation and execution of Java class files.
+# Also meddle with wrapper scripts, as would be probably seen in a real
+# "UNIX-style" use case.
+# This test uses a typical "nested" source tree setup (i.e., different
+# componenets/aspects are separeted into different subdirectories); the
+# sister test `java-compile-run-flat.test' do similar checks with a
+# "flat" setup (i.e., everything in the top-level directory).
+
+required='java javac'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_SUBST([JAVA], [java])
+AC_CONFIG_SRCDIR([jprog/PkgLocation.jin])
+AC_SUBST([jprogdatadir],  ['${pkgdatadir}'])
+AC_SUBST([jprogclassdir], ['${jprogdatadir}/jprog'])
+AC_CONFIG_FILES([jprog/PkgLocation.java:jprog/PkgLocation.jin])
+AC_CONFIG_FILES([jprog/Makefile bin/Makefile tests/Makefile])
+AC_OUTPUT
+END
+
+## TOP-LEVEL SETUP AND TARGETS ##
+
+cat > Makefile.am <<'END'
+SUBDIRS = bin jprog tests
+
+test-built:
+       ls -l $(srcdir)/*             ;: For debugging.
+       test $(srcdir) = . || ls -l * ;: Likewise.
+       test -f $(srcdir)/jprog/Main.java
+       test -f $(srcdir)/jprog/HelloStream.java
+       test -f $(srcdir)/jprog/PkgLocation.jin
+       test -f jprog/PkgLocation.java
+       test -f jprog/HelloStream.class
+       test -f jprog/Main.class
+       test -f jprog/PkgLocation.class
+       test -f jprog/classjprogclass.stamp
+
+test-installed:
+       ls -l $(jprogclassdir) ;: For debugging.
+       test -f $(jprogclassdir)/HelloStream.class
+       test -f $(jprogclassdir)/Main.class
+       test -f $(jprogclassdir)/PkgLocation.class
+       if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
+
+run-installed:
+       jprog_doing_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
+check-local: test-built
+installcheck-local: test-installed run-installed
+
+.PHONY: test-built test-installed run-installed
+END
+
+## WRAPPER SCRIPT ##
+
+mkdir bin
+
+cat > bin/Makefile.am <<'END'
+bin_SCRIPTS = jprog
+
+edit_script = sed -e 's|address@hidden@|$(JAVA)|g' \
+                  -e 's|address@hidden@|$(jprogdatadir)|g' \
+                  -e 's|address@hidden@|$(SHELL)|g'
+
+jprog: jprog.sh
+       rm -f $@ address@hidden
+       $(edit_script) `test -f 'address@hidden' || echo 
$(srcdir)/address@hidden >address@hidden
+       chmod a-w address@hidden && chmod a+x address@hidden && mv -f 
address@hidden $@
+       sed 's/^/ | /' $@ ;: for debugging.
+
+EXTRA_DIST = jprog.sh
+CLEANFILES = jprog
+END
+
+cat > bin/jprog.sh <<'END'
address@hidden@
+CLASSPATH=${jprog_classpath-'@jprogdatadir@'}${CLASSPATH+":$CLASSPATH"}
+export CLASSPATH
+case $# in
+  0) exec @JAVA@ jprog.Main;;
+  *) exec @JAVA@ jprog.Main "$@";;
+esac
+END
+
+## JAVA SOURCES ##
+
+mkdir jprog
+
+cat > jprog/Makefile.am <<'END'
+dist_jprogclass_JAVA = Main.java HelloStream.java
+nodist_jprogclass_JAVA = PkgLocation.java
+END
+
+cat > jprog/PkgLocation.jin <<'END'
+package jprog;
+public class PkgLocation {
+    public static String prefix() {
+        return new String("@prefix@");
+    }
+}
+END
+
+cat > jprog/Main.java <<'END'
+package jprog;
+import jprog.PkgLocation;
+import jprog.HelloStream;
+public class Main {
+    public static void main(String[] args) {
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("--print-prefix")) {
+                System.out.println(PkgLocation.prefix());
+            } else if (args[i].equals("--hello-stdout")) {
+                HelloStream.to(System.out);
+            } else if (args[i].equals("--hello-stderr")) {
+                HelloStream.to(System.err);
+            } else {
+               System.err.println("jprog: invalid option '" + args[i] +
+                                  "'");
+               System.exit(2);
+            }
+        }
+        System.exit(0);
+    }
+}
+END
+
+cat > jprog/HelloStream.java <<'END'
+package jprog;
+import java.io.PrintStream;
+class HelloStream {
+    public static void to(PrintStream stream) {
+        stream.println("Hello, Stream!");
+    }
+}
+END
+
+## TESTS ##
+
+mkdir tests
+
+cat > tests/Makefile.am <<'END'
+## FIXME: Use AM_TESTS_ENVIRONMENT here when it becomes available.
+TESTS_ENVIRONMENT = \
+    if test x"$$jprog_doing_installcheck" != x"yes"; then \
+        jprog_classpath='$(abs_top_builddir):$(abs_top_srcdir)'; \
+        export jprog_classpath; \
+        PATH='$(abs_top_builddir)/bin':$$PATH; \
+        export PATH; \
+    else \
+        unset jprog_classpath || :; \
+        PATH='$(prefix)/bin':$$PATH; \
+        export PATH; \
+    fi; \
+    config_time_prefix='@prefix@'; export config_time_prefix;
+
+TESTS = \
+  simple.test \
+  prefix.test \
+  stdout.test \
+  stderr.test \
+  badarg.test
+
+XFAIL_TESTS = badarg.test
+
+EXTRA_DIST = $(TESTS)
+END
+
+cat > tests/simple.test <<'END'
+#!/bin/sh
+jprog
+END
+
+cat > tests/prefix.test <<'END'
+#!/bin/sh
+jprefix=`jprog --print-prefix` || exit 1
+echo "$0: exp prefix: $config_time_prefix"
+echo "$0: got prefix: $jprefix"
+test x"$jprefix" = x"$config_time_prefix"
+END
+
+cat > tests/stdout.test <<'END'
+#!/bin/sh
+rc=0
+jprog --hello-stdout >stdout.out 2>stdout.err || { echo \$?=$?; rc=1; }
+sed 's/^/out:/' <stdout.out      # For debugging.
+sed 's/^/err:/' <stdout.err >&2  # Likewise.
+test -s stdout.err && rc=1
+test "`cat stdout.out`" = 'Hello, Stream!' || rc=1
+rm -f stdout.out stdout.err || rc=1
+exit $rc
+END
+
+cat > tests/stderr.test <<'END'
+#!/bin/sh
+rc=0
+jprog --hello-stderr >stderr.out 2>stderr.err || { echo \$?=$?; rc=1; }
+sed 's/^/out:/' <stderr.out      # For debugging.
+sed 's/^/err:/' <stderr.err >&2  # Likewise.
+test -s stderr.out && rc=1
+test "`cat stderr.err`" = 'Hello, Stream!' || rc=1
+rm -f stderr.out stderr.err || rc=1
+exit $rc
+END
+
+cat > tests/badarg.test <<'END'
+#!/bin/sh
+jprog --bad-argument
+END
+
+chmod a+x tests/*.test
+
+## DO CHECKS ##
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# To have the parallel testsuite more verbose.
+VERBOSE=yes; export VERBOSE
+
+./configure --prefix="`pwd`/_inst"
+cat jprog/PkgLocation.java # For debugging.
+$MAKE check
+$MAKE install
+$MAKE test-installed
+$MAKE run-installed
+$MAKE distcheck
+
+:
diff --git a/tests/java-extra.test b/tests/java-extra.test
index 5309964..9837d75 100755
--- a/tests/java-extra.test
+++ b/tests/java-extra.test
@@ -19,13 +19,12 @@
 # EXTRA_JAVA exists mostly for ensuring interoperation with Automake
 # conditionals).
 
+required=javac
 . ./defs || Exit 1
 
 set -e
 
 cat >> configure.in << 'END'
-AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
-($HAS_JAVAC 77); $HAS_JAVAC 77
 AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
 AC_OUTPUT
 END
diff --git a/tests/java-mix-dist-nodist.test b/tests/java-mix.test
similarity index 63%
rename from tests/java-mix-dist-nodist.test
rename to tests/java-mix.test
index 786f400..1c8163a 100755
--- a/tests/java-mix-dist-nodist.test
+++ b/tests/java-mix.test
@@ -14,8 +14,9 @@
 # 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 that the JAVA primary can be used with both `dist_' and `nodist_'
-# modifiers in the same directory.
+# Check that the JAVA primary can be used freely in the same Makefile.am
+# with proper combinations of the `dist_', `nodist_' and `nobase_'
+# modifiers .
 
 . ./defs || Exit 1
 
@@ -27,15 +28,23 @@ cat > Makefile.am << 'END'
 # This test does not require compilation of *.java files.
 JAVAC = false
 javadir = $(prefix)
-java_JAVA = Class1.java
-dist_java_JAVA = Class2.java
-nodist_java_JAVA = Class3.java
-Class3.java:
+
+java_JAVA = Class.java
+dist_java_JAVA = ClassDist.java
+nodist_java_JAVA = ClassNodist.java
+
+nobase_java_JAVA = ClassNobase.java
+nobase_dist_java_JAVA = ClassNobaseDist.java
+nobase_nodist_java_JAVA = ClassNobaseNodist.java
+
+Class3.java Class6.java:
        @echo '$@ should not be generated!' >&2; exit 1
 END
 
-: > Class1.java
-: > Class2.java
+: > Class.java
+: > ClassDist.java
+: > ClassNobase.java
+: > ClassNobaseDist.java
 
 $ACLOCAL
 $AUTOCONF
@@ -49,8 +58,11 @@ test ! -s stderr
 
 $MAKE distdir
 ls -l $distdir # For debugging.
-test -f $distdir/Class1.java
-test -f $distdir/Class2.java
-test ! -f $distdir/Class3.java
+test -f $distdir/Class.java
+test -f $distdir/ClassDist.java
+test -f $distdir/NobaseClass.java
+test -f $distdir/NobaseClassDist.java
+test ! -f $distdir/ClassNodist.java
+test ! -f $distdir/NobaseClassNodist.java
 
 :
diff --git a/tests/java-no-duplicate.test b/tests/java-no-duplicate.test
index d5fec4b..ec42a3b 100755
--- a/tests/java-no-duplicate.test
+++ b/tests/java-no-duplicate.test
@@ -26,6 +26,9 @@ javadir = $(datadir)/java
 java_JAVA = a.java
 dist_java_JAVA = b.java
 nodist_java_JAVA = c.java
+nobase_java_JAVA = d.java
+nobase_dist_java_JAVA = e.java
+nobase_nodist_java_JAVA = f.java
 END
 
 $ACLOCAL
diff --git a/tests/java-compile-install.test b/tests/java-nobase.test
similarity index 53%
copy from tests/java-compile-install.test
copy to tests/java-nobase.test
index b2145fb..7b55290 100755
--- a/tests/java-compile-install.test
+++ b/tests/java-nobase.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2004, 2007  Free Software Foundation, Inc.
+# 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
@@ -14,71 +14,52 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test on compilation and installation of Java class files.
+# Test support of `nobase_' with the `JAVA' primary.
 
 required=javac
 . ./defs || Exit 1
 
 set -e
 
-cat >>configure.in <<'EOF'
+cat >>configure.in <<'END'
 AC_OUTPUT
-EOF
+END
 
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
-java_JAVA = Foo.java
-dist_java_JAVA = Bar.java
-nodist_java_JAVA = Baz.java
+nobase_java_JAVA = sub/subsub/Foo.java
+nobase_dist_java_JAVA = sub/Bar.java
+nobase_nodist_java_JAVA = sub2/Baz.java
 
 # Java files are not distributed by default.
-EXTRA_DIST = Foo.java
+EXTRA_DIST = sub/subsub/Foo.java
 
-Baz.java:
+sub2/Baz.java:
        rm -f $@ address@hidden
+       test -d sub2 || mkdir sub2
        echo 'class Baz {}' > address@hidden
-       echo 'class Baz2 {}' >> address@hidden
        chmod a-w address@hidden && mv -f address@hidden $@
 
-test:
-       ls -l $(srcdir) . ;: For debugging.
-       test   -f $(srcdir)/Foo.java
-       test   -f $(srcdir)/Bar.java
-       test   -f Baz.java
-       test   -f aClass.class
-       test   -f Zardoz.class
-       test   -f Baz.class
-       test   -f Baz2.class
-       test ! -r Foo.class
-       test ! -r Bar.class
-
+.PHONY: test-install
 test-install:
        find $(prefix) ;: For debugging.
-       test   -f '$(javadir)/aClass.class'
-       test   -f '$(javadir)/Zardoz.class'
-       test   -f '$(javadir)/Baz.class'
-       test   -f '$(javadir)/Baz2.class'
-       test ! -r '$(javadir)/Foo.class'
-       test ! -r '$(javadir)/Bar.class'
-
-check-local: test
+       test   -f $(javadir)/sub/subsub/Foo.class
+       test   -f $(javadir)/sub/Bar.class
+       test   -f $(javadir)/sub2/Baz.class
 installcheck-local: test-install
-
-.PHONY: test test-install
-
-DISTCLEANFILES = Baz.java
+DISTCLEANFILES = sub2/Baz.java
 END
 
-echo 'class aClass {}' > Foo.java
-echo 'class Zardoz {}' > Bar.java
+mkdir sub sub/subsub
+echo 'class Foo {}' > sub/subsub/Foo.java
+echo 'class Bar {}' > sub/Bar.java
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
 ./configure --prefix="`pwd`"/_inst
-$MAKE
-$MAKE test
+$MAKE check
 $MAKE install
 $MAKE test-install
 $MAKE distcheck
diff --git a/tests/java-noinst.test b/tests/java-noinst.test
index 130ea63..58f96ae 100755
--- a/tests/java-noinst.test
+++ b/tests/java-noinst.test
@@ -14,40 +14,44 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure that noinst_JAVA causes generated *.class files not to be 
installed.
+# 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_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
-($HAS_JAVAC 77); $HAS_JAVAC 77
 AC_OUTPUT
 END
 
-cat > Foo.java <<'END'
-class Foo { }
+cat > Makefile.am <<'END'
+noinst_JAVA = 1.java
+dist_noinst_JAVA = 2.java
+nodist_noinst_JAVA = 3.java
+nobase_noinst_JAVA = 4.java
+nobase_dist_noinst_JAVA = 5.java
+nobase_nodist_noinst_JAVA = 6.java
 END
 
+for i in 1 2 3 4 5 6; do
+  echo "class Class$i {}" > $i.java
+done
+
 $ACLOCAL
+$AUTOMAKE
 $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
+$MAKE
+ls -l
+for i in 1 2 3 4 5 6; do
+  test -f Class$i.class
 done
 
+$MAKE install
+test -d _inst && { ls -l _inst; Exit 1; }
+
 :
diff --git a/tests/java-rebuild.test b/tests/java-rebuild.test
new file mode 100755
index 0000000..75be5f7
--- /dev/null
+++ b/tests/java-rebuild.test
@@ -0,0 +1,126 @@
+#! /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/>.
+
+# Test rebuild rules for Java class files.
+
+required='javac'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AM_JAVACFLAGS = -verbose
+foodir = $(datadir)/java
+foo_JAVA = a.java
+dist_foo_JAVA = d.java
+nodist_foo_JAVA = n.java
+nobase_foo_JAVA = Nobase.java
+nobase_dist_foo_JAVA = NobaseDist.java
+nobase_nodist_foo_JAVA = NobaseNoDist.java
+END
+
+echo 'class _x {}' > a.java
+echo 'class x_ {}' > d.java
+echo 'class a {} class d {}' > n.java
+echo 'class Nobase_Foo {} class Nobase_Bar {}' > Nobase.java
+echo 'class NobaseDist {}' > NobaseDist.java
+echo 'class NobaseNoDist {}' > NobaseNoDist.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+all_classes='_x x_ a d Nobase_Foo Nobase_Bar NobaseDist NobaseNoDist'
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=..
+    mkdir build
+    cd build
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE
+  ls -l # For debugging.
+
+  # Sanity check.
+  test -f classfoo.stamp
+  for cls in $all_classes; do
+    test -f $cls.class
+  done
+
+  # When the stampfile is removed, all the *.class files should
+  # be considered out-of-date.
+  echo timestamp > older
+  $sleep
+  rm -f classfoo.stamp
+  $MAKE
+  for cls in $all_classes; do
+    is_newest $cls.class older
+  done
+
+  # When only a java file is modified, only the *.class files derived from
+  # it should be updated.
+  # The strings we loop on here have the following format:
+  # ``JAVA-FILES-TO-BE-TOUCHED -- CLASSES-THAT-SHOULD-BE-UPDATED''
+  for args in \
+    'a -- _x' \
+    'd -- x_' \
+    'n -- a d' \
+    'a d Nobase -- _x x_ Nobase_Foo Nobase_Bar' \
+    'n NobaseDist -- a d NobaseDist' \
+    'd NobaseNoDist -- x_ NobaseNoDist' \
+    "a d n Nobase NobaseDist NobaseNoDist -- $all_classes" \
+  ; do
+    set $args
+    touched_javas=
+    while test $# -gt 0; do
+      if test x"$1" = x"--"; then
+        shift
+        break
+      else
+        touched_javas="$touched_javas $1"
+        shift
+      fi
+    done
+    updated_classes=$*
+    echo timestamp > older
+    $sleep
+    for j in $touched_javas; do
+      touch $srcdir/$j.java
+    done
+    $MAKE
+    is_newest classfoo.stamp older
+    for cls in $all_classes; do
+      case " $updated_classes " in
+        *" $cls "*) is_newest $cls.class older;;
+        *) is_newest older $cls.class;;
+      esac
+    done
+  done # $args ...
+
+  cd $srcdir
+
+done # $vpath ...
+
+:
diff --git a/tests/java-sources.test b/tests/java-sources.test
index 4a489e4..770eb2d 100755
--- a/tests/java-sources.test
+++ b/tests/java-sources.test
@@ -31,6 +31,9 @@ foodir = $(prefix)
 foo_JAVA = a.java
 dist_foo_JAVA = b.java
 nodist_foo_JAVA = c.java
+nobase_foo_JAVA = d.java
+nobase_dist_foo_JAVA = e.java
+nobase_nodist_foo_JAVA = f.java
 
 .PHONY: debug
 debug:
@@ -48,6 +51,9 @@ cat > exp << 'END'
 a.java
 b.java
 c.java
+d.java
+e.java
+f.java
 END
 
 ./configure
diff --git a/tests/java-uninstall.test b/tests/java-uninstall.test
new file mode 100755
index 0000000..35d1e4a
--- /dev/null
+++ b/tests/java-uninstall.test
@@ -0,0 +1,101 @@
+#! /bin/sh
+# Copyright (C) 1998, 2001, 2002, 2004, 2007  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 uninstallation of Java class files.
+
+required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(prefix)/java
+java_JAVA = Foo.java
+nobase_java_JAVA = Foo2.java
+nobase_dist_java_JAVA = Bar.java
+nodist_java_JAVA = Baz.java
+
+# Java files are not distributed by default, so we distribute
+# one "by hand" ...
+EXTRA_DIST = Foo.java
+# ... and make the other one generated.
+Foo2.java:
+       rm -f $@ address@hidden
+       echo 'class bClass {}' > address@hidden
+       chmod a-w address@hidden && mv -f address@hidden $@
+
+# Explicitly declared as `nodist_', so generate it.
+Baz.java:
+       rm -f $@ address@hidden
+       echo 'class Baz {}' > address@hidden
+       echo 'class Baz2 {}' >> address@hidden
+       chmod a-w address@hidden && mv -f address@hidden $@
+
+DISTCLEANFILES = Baz.java Foo2.java
+END
+
+echo 'class aClass {}' > Foo.java
+echo 'class Zardoz {}' > Bar.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure --prefix="`pwd`"/_inst
+javadir=_inst/java
+
+check_uninstallation()
+{
+  test ! -r $javadir/aClass.class
+  test ! -r $javadir/bClass.class
+  test ! -r $javadir/Zardoz.class
+  test ! -r $javadir/Baz.class
+  test ! -r $javadir/Baz2.class
+  test   -f $javadir/Foo.class
+  test   -f $javadir/Bar.class
+  test   -f $javadir/xClass.class
+  test   -f $javadir/aclass.class
+}
+
+$MAKE
+ls -l
+$MAKE install
+: > $javadir/Foo.class
+: > $javadir/Bar.class
+: > $javadir/xClass.class
+: > $javadir/aclass.class
+ls -l $javadir
+$MAKE uninstall
+ls -l $javadir
+check_uninstallation
+
+# FIXME: "make uninstall" should continue to work also after "make clean",
+#        but currently this doesn't happen.  See automake bug#8540.
+$MAKE install
+ls -l $javadir
+$MAKE clean
+ls -l
+$MAKE uninstall
+ls -l $javadir
+#check_uninstallation
+
+$MAKE distcheck
+
+:
diff --git a/tests/autodist-acconfig-no-subdir.test b/tests/javaflags.test
similarity index 54%
copy from tests/autodist-acconfig-no-subdir.test
copy to tests/javaflags.test
index e6bd5a9..7564322 100755
--- a/tests/autodist-acconfig-no-subdir.test
+++ b/tests/javaflags.test
@@ -14,45 +14,49 @@
 # 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 that `acconfig.h' is *not* automatically distributed when
-# placed in a subdirectory.
-# Related to automake bug#7819.
+# Check support for $(JAVACFLAGS) and $(AM_JAVACFLAGS).
 
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in <<END
-AC_CONFIG_FILES([sub/Makefile])
+cat > fake-javac <<'END'
+#!/bin/sh
+echo "$*" > javaflags.list
+END
+chmod a+x fake-javac
+
+# Remove JAVAC from the environment, so that it won't interfere
+# with `make -e' below.
+unset JAVAC || :
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+# Simulate presence of the java compiler using our fake-javac script.
+AC_SUBST([JAVAC], ['$(abs_top_srcdir)'/fake-javac])
 AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
-SUBDIRS = sub
-sub/acconfig.h:
-       echo target $@ should not be built >&2; exit 1
-check-local: distdir
-       ls -l $(distdir)/sub
-       test ! -f $(distdir)/sub/acconfig.h
+foodir = $(prefix)
+foo_JAVA = bar.java
+AM_JAVACFLAGS = __am_flags__
 END
 
-mkdir sub
+$ACLOCAL
+$AUTOMAKE
 
-cat > sub/Makefile.am <<'END'
-acconfig.h:
-       echo target $@ should not be built >&2; exit 1
-check-local:
-       echo $(DISTFILES) | grep 'acconfig\.h' && exit 1; :
-       echo $(DIST_COMMON) | grep 'acconfig\.h' && exit 1; :
-END
+grep '\$(JAVACFLAGS).*\$(AM_JAVACFLAGS)' Makefile.in && Exit 1
 
-: > sub/acconfig.h
+: > bar.java
 
-$ACLOCAL
-$AUTOMAKE
 $AUTOCONF
-
 ./configure
-$MAKE check
+env JAVACFLAGS=__user_flags__ $MAKE -e
+
+ls -l
+
+cat javaflags.list
+grep '__am_flags__.*__user_flags__' javaflags.list
 
 :
diff --git a/tests/javaprim.test b/tests/javaprim.test
index aa1506b..53d7ac2 100755
--- a/tests/javaprim.test
+++ b/tests/javaprim.test
@@ -14,16 +14,23 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure JAVA variable can be defined.
+# Test to make sure JAVA variable can be defined by AC_SUBST.
 
 . ./defs || Exit 1
 
-echo 'AC_SUBST(JAVA)' >> configure.in
+cat >> configure.in << 'END'
+AC_SUBST([JAVA])
+END
 
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
 java_JAVA = a.java b.java c.java
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+grep -i java Makefile.in # For debugging.
+grep '^JAVA = address@hidden@ *$' Makefile.in
+
+:
diff --git a/tests/javasubst.test b/tests/javasubst.test
index d018645..483da81 100755
--- a/tests/javasubst.test
+++ b/tests/javasubst.test
@@ -14,18 +14,25 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure redefining JAVAC works.
+# Test to make sure redefining JAVAC with AC_SUBST works.
 
 . ./defs || Exit 1
 
-echo 'AC_SUBST(JAVAC)' >> configure.in
+set -e
+
+cat >> configure.in << 'END'
+AC_SUBST([JAVAC])
+END
 
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
 java_JAVA = a.java b.java c.java
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
+
+grep -i java Makefile.in # For debugging.
+grep '^JAVAC = address@hidden@ *$' Makefile.in
 
-grep 'address@hidden@' Makefile.in
+:


hooks/post-receive
-- 
GNU Automake



reply via email to

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