tags 8461 patch close 8461 thanks Reference: <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8461>
I've decided to go with the third option listed there; attached is the patch I've pushed to maint. Regards, Stefano
From c9dfc368a623178f32b67b164f051e9ab65edd99 Mon Sep 17 00:00:00 2001 Message-Id: <c9dfc368a623178f32b67b164f051e9ab65edd99.1316382331.git.stefano.lattar...@gmail.com> From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Sun, 18 Sep 2011 23:32:38 +0200 Subject: [PATCH] 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. --- ChangeLog | 11 +++++++++++ NEWS | 4 ++++ automake.in | 4 ++-- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/instdir-java.test | 1 + tests/javadir-undefined.test | 37 +++++++++++++++++++++++++++++++++++++ 7 files changed, 57 insertions(+), 2 deletions(-) create mode 100755 tests/javadir-undefined.test diff --git a/ChangeLog b/ChangeLog index 56a8d1c..8a697e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-09-18 Stefano Lattarini <stefano.lattar...@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.lattar...@gmail.com> cosmetics: fix various typos and grammaros diff --git a/NEWS b/NEWS index f26b332..9d3f46d 100644 --- 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. diff --git a/automake.in b/automake.in index 208a66b..215881b 100755 --- a/automake.in +++ b/automake.in @@ -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 = (); diff --git a/tests/Makefile.am b/tests/Makefile.am index c2dbf23..6c7139d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 \ diff --git a/tests/Makefile.in b/tests/Makefile.in index ad4f2c9..ab73658 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 \ diff --git a/tests/instdir-java.test b/tests/instdir-java.test index 9d9a03c..94a6a25 100755 --- a/tests/instdir-java.test +++ b/tests/instdir-java.test @@ -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 index 0000000..9b6d1f3 --- /dev/null +++ b/tests/javadir-undefined.test @@ -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 + +: -- 1.7.2.3