From 3f95a8dd61a34bf37f588a92c331a51edaaad1d4 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Mon, 30 Sep 2002 18:08:06 +0000 Subject: [PATCH] * automake.in (require_variables): The fix introduced in 2002-09-19 is imcomplete. Rewrite the conditional variable definition check using &variable_not_always_defined_in_cond. * tests/cond26.test, tests/cond27.test, tests/cond28.test: New file. * tests/Makefile.am (TESTS): Add cond26.test, cond27.test, and cond28.test. Reported by Juergen Keil. --- ChangeLog | 8 ++++++++ THANKS | 1 + automake.in | 17 ++++++++--------- tests/Makefile.am | 3 +++ tests/Makefile.in | 3 +++ tests/cond26.test | 42 ++++++++++++++++++++++++++++++++++++++++++ tests/cond27.test | 43 +++++++++++++++++++++++++++++++++++++++++++ tests/cond28.test | 42 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 150 insertions(+), 9 deletions(-) create mode 100755 tests/cond26.test create mode 100755 tests/cond27.test create mode 100755 tests/cond28.test diff --git a/ChangeLog b/ChangeLog index 7eea8410..1a7949c6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2002-09-30 Alexandre Duret-Lutz + * automake.in (require_variables): The fix introduced in 2002-09-19 + is imcomplete. Rewrite the conditional variable definition check + using &variable_not_always_defined_in_cond. + * tests/cond26.test, tests/cond27.test, tests/cond28.test: New file. + * tests/Makefile.am (TESTS): Add cond26.test, cond27.test, and + cond28.test. + Reported by Juergen Keil. + * automake.in (INTERNAL): Redefine as an empty location, so that internal locations get displayed as `automake:'. diff --git a/THANKS b/THANKS index 9be301a3..e9e0cad0 100644 --- a/THANKS +++ b/THANKS @@ -95,6 +95,7 @@ Josh MacDonald jmacd@cs.berkeley.edu Joshua Cowan jcowan@jcowan.reslife.okstate.edu js pendry js.pendry@msdw.com Juergen A. Erhard jae@laden.ilk.de +Juergen Keil jk@tools.de Karl Berry kb@cs.umb.edu Karl Heuer kwzh@gnu.org Kevin Dalley kevin@aimnet.com diff --git a/automake.in b/automake.in index a76fa231..8b183511 100755 --- a/automake.in +++ b/automake.in @@ -9172,20 +9172,19 @@ sub require_variables ($$$@) if ((exists $var_value{$var} && exists $var_value{$var}{$cond}) || exists $configure_vars{$var}); - # If the variable exists but was not defined in $cond, - # look for any definition implied by $cond. - if (exists $var_value{$var}) + my @undef_cond = variable_not_always_defined_in_cond $var, $cond; + next VARIABLE + unless @undef_cond; + + my $text = "$reason`$var' is undefined\n"; + if (@undef_cond && $undef_cond[0] ne 'TRUE') { - for my $vcond (keys %{$var_value{$var}}) - { - next VARIABLE - if (conditional_true_when ($vcond, $cond)); - } + $text .= ("in the following conditions:\n " + . join ("\n ", @undef_cond)); } ++$res; - my $text = "$reason`$var' is undefined."; if (exists $am_macro_for_var{$var}) { $text .= "\nThe usual way to define `$var' is to add " diff --git a/tests/Makefile.am b/tests/Makefile.am index ca0e322f..40a59d7d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -91,6 +91,9 @@ cond22.test \ cond23.test \ cond24.test \ cond25.test \ +cond26.test \ +cond27.test \ +cond28.test \ condd.test \ condincl.test \ condincl2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index f4cb0a43..603b986f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -183,6 +183,9 @@ cond22.test \ cond23.test \ cond24.test \ cond25.test \ +cond26.test \ +cond27.test \ +cond28.test \ condd.test \ condincl.test \ condincl2.test \ diff --git a/tests/cond26.test b/tests/cond26.test new file mode 100755 index 00000000..36968eaf --- /dev/null +++ b/tests/cond26.test @@ -0,0 +1,42 @@ +#!/bin/sh +# Copyright (C) 2002 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 autoconf; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check that non-conditional primaries can use conditional directories. +# Reported by Juergen Keil. + +. ./defs + +set -e + +cat >>configure.in << 'EOF' +AM_CONDITIONAL([USE_FOO], [true]) +EOF + +cat >Makefile.am << 'EOF' +if USE_FOO +mydir = /foo +else +mydir = /bar +endif +my_DATA = foo +EOF + +$ACLOCAL +$AUTOMAKE diff --git a/tests/cond27.test b/tests/cond27.test new file mode 100755 index 00000000..f43fce37 --- /dev/null +++ b/tests/cond27.test @@ -0,0 +1,43 @@ +#!/bin/sh +# Copyright (C) 2002 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 autoconf; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check that non-conditional primaries cannot use directories defined +# in some conditions (but not others). + +. ./defs + +set -e + +cat >>configure.in << 'EOF' +AM_CONDITIONAL([USE_FOO], [true]) +EOF + +cat >Makefile.am << 'EOF' +if USE_FOO +mydir = /foo +endif +my_DATA = foo +EOF + +$ACLOCAL +$AUTOMAKE 2>stderr && exit 1 +cat stderr +grep USE_FOO_TRUE stderr && exit 1 +grep USE_FOO_FALSE stderr diff --git a/tests/cond28.test b/tests/cond28.test new file mode 100755 index 00000000..95dfbd65 --- /dev/null +++ b/tests/cond28.test @@ -0,0 +1,42 @@ +#!/bin/sh +# Copyright (C) 2002 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 autoconf; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check that conditional primaries can use directories defined +# in the same conditions (but not others). + +. ./defs + +set -e + +cat >>configure.in << 'EOF' +AM_CONDITIONAL([USE_FOO], [true]) +EOF + +cat >Makefile.am << 'EOF' +if USE_FOO +mydir = /foo +endif +if USE_FOO +my_DATA = foo +endif +EOF + +$ACLOCAL +$AUTOMAKE -- 2.43.5