2004-02-01 Alexandre Duret-Lutz <adl@gnu.org>
+ * lib/Automake/Variable.pm (transform_variable_recursively):
+ Define rewritten variables in all conditions not *covered* by user
+ definitions, not simply in conditions without a previous
+ definition.
+ * tests/cond34.test: New file.
+ * tests/Makefile.am (TESTS): Add cond34.test.
+ Report from Elena A. Vengerova
+
* doc/automake.texi (Multiple Outputs): Typo.
* doc/automake.texi (Emacs Lisp): Typos.
Doug Evans devans@cygnus.com
Duncan Gibson duncan@thermal.esa.int
Eleftherios Gkioulekas lf@amath.washington.edu
+Elena A. Vengerova helen@oktetlabs.ru
Elmar Hoffmann elho@elho.net
Elrond Elrond@Wunder-Nett.org
Enrico Scholz enrico.scholz@informatik.tu-chemnitz.de
# we are trying to override a user variable. Delete
# the old variable first.
variable_delete ($varname) if $varname eq $var->name;
- # Define for all conditions. Make sure we define
- # an empty variable in condition TRUE otherwise.
+ # Define an empty variable in condition TRUE if there is no
+ # result.
@allresults = ([TRUE, '']) unless @allresults;
+ # Define the rewritten variable in all conditions not
+ # already covered by user definitions.
foreach my $pair (@allresults)
{
my ($cond, @result) = @$pair;
- define ($varname, VAR_AUTOMAKE, '', $cond, "@result",
- '', $where, VAR_PRETTY)
- unless vardef ($varname, $cond);
- rvardef ($varname, $cond)->set_seen;
+ my $var = var $varname;
+ my @conds = ($var
+ ? $var->not_always_defined_in_cond ($cond)->conds
+ : $cond);
+
+ foreach (@conds)
+ {
+ define ($varname, VAR_AUTOMAKE, '', $_, "@result",
+ '', $where, VAR_PRETTY);
+ }
}
+ set_seen $varname;
}
return "\$($varname)";
},
cond31.test \
cond32.test \
cond33.test \
+cond34.test \
condd.test \
condinc.test \
condinc2.test \
cond31.test \
cond32.test \
cond33.test \
+cond34.test \
condd.test \
condinc.test \
condinc2.test \
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2004 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Check for _DEPDENDENCIES definition with conditional _LDADD.
+# Report from Elena A. Vengerova
+
+. ./defs
+
+set -e
+
+cat >>configure.in <<'EOF'
+AM_CONDITIONAL([TWO], test -n "$two")
+AC_PROG_CC
+AC_OUTPUT
+EOF
+
+cat >>Makefile.am <<'EOF'
+OBJEXT=z
+
+bin_PROGRAMS = test1 test2
+
+if TWO
+ test1_LDADD = two.$(OBJEXT)
+ test2_LDADD = two.$(OBJEXT)
+ test2_DEPENDENCIES = $(test2_LDADD) somethingelse.a
+else !TWO
+ test1_LDADD = one.$(OBJEXT)
+ test2_LDADD = three.$(OBJEXT)
+endif !TWO
+
+test1_DEPENDENCIES = $(test1_LDADD) somethingelse.a
+
+dep-test1:
+ echo BEG: $(test1_DEPENDENCIES) :END
+dep-test2:
+ echo BEG: $(test2_DEPENDENCIES) :END
+
+EOF
+
+:> test.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE dep-test1 >out
+grep 'BEG: one.z somethingelse.a :END' out
+$MAKE dep-test2 >out
+grep 'BEG: three.z :END' out
+
+./configure two=2
+$MAKE dep-test1 >out
+grep 'BEG: two.z somethingelse.a :END' out
+$MAKE dep-test2 >out
+grep 'BEG: two.z somethingelse.a :END' out