From: Alexandre Duret-Lutz Date: Sun, 1 Feb 2004 18:06:50 +0000 (+0000) Subject: * lib/Automake/Variable.pm (transform_variable_recursively): X-Git-Tag: Release-1-8b~63 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=5c0f711811729aedd603179609457dbd98747642;p=automake.git * 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 --- diff --git a/ChangeLog b/ChangeLog index 5cc62254..9c719750 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2004-02-01 Alexandre Duret-Lutz + * 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. diff --git a/THANKS b/THANKS index f049c0c8..253b9b61 100644 --- a/THANKS +++ b/THANKS @@ -55,6 +55,7 @@ Dmitry Mikhin dmitrym@acres.com.au 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 diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm index cec6b564..e743011c 100644 --- a/lib/Automake/Variable.pm +++ b/lib/Automake/Variable.pm @@ -1510,17 +1510,26 @@ sub transform_variable_recursively ($$$$$&;%) # 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)"; }, diff --git a/tests/Makefile.am b/tests/Makefile.am index 91f01746..07a58a90 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -120,6 +120,7 @@ cond30.test \ cond31.test \ cond32.test \ cond33.test \ +cond34.test \ condd.test \ condinc.test \ condinc2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 75145f45..7df7cf0a 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -235,6 +235,7 @@ cond30.test \ cond31.test \ cond32.test \ cond33.test \ +cond34.test \ condd.test \ condinc.test \ condinc2.test \ diff --git a/tests/cond34.test b/tests/cond34.test new file mode 100755 index 00000000..4f716566 --- /dev/null +++ b/tests/cond34.test @@ -0,0 +1,72 @@ +#!/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