]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
java: complain if java_JAVA is used but $(javadir) is undefined
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 18 Sep 2011 21:32:38 +0000 (23:32 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 18 Sep 2011 21:45:22 +0000 (23:45 +0200)
Fixes automake bug#8461.

* automake.in (handle_java): Remove inappropriate "java" argument
from the calls to `&am_install_var' and `&am_primary_prefixes'.
* tests/instdir-java.test (Makefile.am): Define `$(javadir)'.
* tests/javadir-undefined.test: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS: Update.

ChangeLog
NEWS
automake.in
tests/Makefile.am
tests/Makefile.in
tests/instdir-java.test
tests/javadir-undefined.test [new file with mode: 0755]

index 56a8d1ca35987a7348f6b7e269f4c795dede2e5b..8a697e672b0012cc65cf0ea790cf9f7f4e8bdffe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java: complain if java_JAVA is used but $(javadir) is undefined
+       Fixes automake bug#8461.
+       * automake.in (handle_java): Remove inappropriate "java" argument
+       from the calls to `&am_install_var' and `&am_primary_prefixes'.
+       * tests/instdir-java.test (Makefile.am): Define `$(javadir)'.
+       * tests/javadir-undefined.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+       * NEWS: Update.
+
 2011-09-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        cosmetics: fix various typos and grammaros
diff --git a/NEWS b/NEWS
index f26b3322df75a115265256569e06afd73031f3de..9d3f46d3ae374150b6471f25c6a7d40c13ce7932 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -93,6 +93,10 @@ Bugs fixed in 1.11.0a:
   - Java sources specified with check_JAVA are not compiled anymore upon
     "make all", but only upon "make check".
 
+  - An usage like "java_JAVA = foo.java" will now cause Automake to warn
+    and error out if `javadir' is undefined, instead of silently producing
+    a broken Makefile.in.
+
   - Now aclocal and automake, when they've to spawn autoconf or autom4te
     processes, honour the configure-time definitions of AUTOCONF and
     AUTOM4TE.
index 208a66bf9461ea35c5d4818e734698f3dc82fa72..215881b1413b91a006b94f83f639e84d5e05f7f7 100755 (executable)
@@ -5104,11 +5104,11 @@ sub handle_java
 {
     my @sourcelist = &am_install_var ('-candist',
                                      'java', 'JAVA',
-                                     'java', 'noinst', 'check');
+                                     'noinst', 'check');
     return if ! @sourcelist;
 
     my @prefixes = am_primary_prefixes ('JAVA', 1,
-                                     'java', 'noinst', 'check');
+                                       'noinst', 'check');
 
     my $dir;
     my @java_sources = ();
index c2dbf235b3e8b83dad21e2c1766e65f940d59b0e..6c7139d2ba37f45459e2d2d3b48300e01da3b060 100644 (file)
@@ -453,6 +453,7 @@ java2.test \
 java3.test \
 java-check.test \
 java-empty-classpath.test \
+javadir-undefined.test \
 javaprim.test \
 javasubst.test \
 java-clean.test \
index ad4f2c988ef88b6a658c4e832a89b97b8d9200da..ab736580f4fe639c59d8f12aab5f05aef5c51135 100644 (file)
@@ -731,6 +731,7 @@ java2.test \
 java3.test \
 java-check.test \
 java-empty-classpath.test \
+javadir-undefined.test \
 javaprim.test \
 javasubst.test \
 java-clean.test \
index 9d9a03ca775e9f0f8789d0079901564968257bb9..94a6a2569d76c553403380b4f0961160b0246647 100755 (executable)
@@ -26,6 +26,7 @@ AC_OUTPUT
 END
 
 cat >Makefile.am <<'END'
+javadir = $(datarootdir)/java
 java_JAVA = foo.java
 END
 
diff --git a/tests/javadir-undefined.test b/tests/javadir-undefined.test
new file mode 100755 (executable)
index 0000000..9b6d1f3
--- /dev/null
@@ -0,0 +1,37 @@
+#! /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/>.
+
+# Use of JAVA primary should not allow the use of the `java_' prefix
+# when $(javadir) is undefined.  Otherwise, we could silently end up
+# with a broken Makefile.in (where "make install" doesn't install
+# the *.class files).
+# See automake bug#8461.
+
+. ./defs || Exit 1
+
+set -e
+
+$ACLOCAL
+
+echo java_JAVA = a.java > Makefile.am
+AUTOMAKE_fails
+grep '^Makefile\.am:1:.*java_JAVA.*javadir.* undefined' stderr
+$EGREP '(uninitialized|line) ' stderr && Exit 1
+
+echo javadir = a-dummy-value >> Makefile.am
+$AUTOMAKE
+
+: