2009-10-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
+ Allow variable override of, rather than by, silent variables.
+ When overriding variables, check the VAR_SILENT status of the
+ old condition, not the new one: we allow non-silent overrides
+ of silent variables (these do not hit ordering bugs in the
+ automake output), but there is no use case for doing so the
+ other way round. Fixes conditional overrides of variables
+ annotated AM_SUBST_NOTMAKE in configure.ac.
+ * lib/Automake/Variable.pm (_check_ambiguous_condition): Check
+ for VAR_SILENT in $ambig_cond not $cond.
+ * tests/cond44.test, tests/cond45.test: New tests, analogous to
+ cond23.test and cond24.test.
+ * tests/Makefile.am: Update.
+ Spotted originally in binutils/bfd.
+
Fix `make clean check' for the Automake package.
* lib/Automake/Makefile.am (SUBDIRS): Add `.' before `tests',
so that Config.pm is built first.
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = tests
+
+# `make clean check' should build Config.pm first.
+SUBDIRS = . tests
perllibdir = $(pkgvdatadir)/Automake
dist_perllib_DATA = \
ChannelDefs.pm \
my $var = $self->name;
my ($message, $ambig_cond) = $self->conditions->ambiguous_p ($var, $cond);
- # We allow silent variables to be overridden silently.
- my $def = $self->def ($cond);
+ # We allow silent variables to be overridden silently,
+ # by either silent or non-silent variables.
+ my $def = $self->def ($ambig_cond);
if ($message && !($def && $def->pretty == VAR_SILENT))
{
msg 'syntax', $where, "$message ...", partial => 1;
cond41.test \
cond42.test \
cond43.test \
+cond44.test \
+cond45.test \
condd.test \
condhook.test \
condinc.test \
cond41.test \
cond42.test \
cond43.test \
+cond44.test \
+cond45.test \
condd.test \
condhook.test \
condinc.test \
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2002, 2003, 2009 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 that redefinitions of AC_SUBST'ed AM_SUBST_NOTMAKE'd variables
+# are not diagnosed. See cond23.test.
+
+. ./defs
+
+set -e
+
+cat >>configure.in <<EOF
+AM_CONDITIONAL([COND], [true])
+AM_SUBST_NOTMAKE([libdir])
+AC_OUTPUT
+EOF
+
+cat >Makefile.am <<EOF
+if COND
+libdir = mumble
+endif
+EOF
+
+$ACLOCAL
+AUTOMAKE_run 0
+grep 'libdir was already defined' stderr && Exit 1
+grep '^libdir = ' Makefile.in && Exit 1
+Exit 0
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2002, 2003, 2009 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 that redefinitions of AC_SUBST'ed AM_SUBST_NOTMAKE'd variables
+# are not diagnosed. See cond24.test.
+
+. ./defs
+
+set -e
+
+cat >>configure.in <<EOF
+AC_SUBST([foo], [bar])
+AM_SUBST_NOTMAKE([foo])
+AM_CONDITIONAL([COND], [true])
+AC_OUTPUT
+EOF
+
+cat >Makefile.am <<EOF
+if COND
+foo = baz
+endif
+EOF
+
+$ACLOCAL
+AUTOMAKE_run 0
+grep 'foo was already defined' stderr && Exit 1
+grep '^foo =' Makefile.in && Exit 1
+Exit 0