From: Tom Tromey Date: Sat, 29 Dec 2001 23:58:06 +0000 (+0000) Subject: For PR automake/279: X-Git-Tag: Release-1-5d~79 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=7db4e0999b2b22722f5c932a9cb3528184c1e92a;p=automake.git For PR automake/279: * automake.in (conditional_ambiguous_p): New sub. (handle_lib_objects_cond): Use it. (check_ambiguous_conditional): Use it. * tests/Makefile.am (TESTS): Added pr279.test, pr279-2.test. * tests/pr279.test: New file. * tests/pr279-2.test: New file. --- diff --git a/ChangeLog b/ChangeLog index f326eb5d..0711b54b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-12-29 Tom Tromey + + For PR automake/279: + * automake.in (conditional_ambiguous_p): New sub. + (handle_lib_objects_cond): Use it. + (check_ambiguous_conditional): Use it. + * tests/Makefile.am (TESTS): Added pr279.test, pr279-2.test. + * tests/pr279.test: New file. + * tests/pr279-2.test: New file. + 2001-12-26 Tom Tromey For PR automake/249: diff --git a/automake.in b/automake.in index 9b538bbb..792c25e7 100755 --- a/automake.in +++ b/automake.in @@ -2369,9 +2369,18 @@ sub handle_lib_objects_cond } } - if ($xname ne '' && ! variable_defined ($xname . '_DEPENDENCIES', $cond)) + if ($xname ne '') { - define_pretty_variable ($xname . '_DEPENDENCIES', $cond, @dep_list); + if (conditional_ambiguous_p ($xname . '_DEPENDENCIES', $cond) ne '') + { + # Note that we've examined this. + &examine_variable ($xname . '_DEPENDENCIES'); + } + else + { + define_pretty_variable ($xname . '_DEPENDENCIES', $cond, + @dep_list); + } } return $seen_libobjs; @@ -5671,6 +5680,22 @@ sub cond_stack_endif ($$$) # definition that is true under the same conditions, then we have an # ambiguity. sub check_ambiguous_conditional ($$) +{ + my ($var, $cond) = @_; + my $message = conditional_ambiguous_p ($var, $cond); + if ($message ne '') + { + macro_error ($var, $message); + macro_dump ($var); + } +} + +# $STRING +# conditional_ambiguous_p ($VAR, $COND) +# ------------------------------------- +# Check for an ambiguous conditional. Return an error message if we +# have one, the empty string otherwise. +sub conditional_ambiguous_p ($$) { my ($var, $cond) = @_; foreach my $vcond (keys %{$var_value{$var}}) @@ -5678,24 +5703,21 @@ sub check_ambiguous_conditional ($$) my $message; if ($vcond eq $cond) { - $message = "$var multiply defined in condition $cond"; + return "$var multiply defined in condition $cond"; } elsif (&conditional_true_when ($vcond, $cond)) { - $message = ("$var was already defined in condition $vcond, " - . "which implies condition $cond"); + return ("$var was already defined in condition $vcond, " + . "which implies condition $cond"); } elsif (&conditional_true_when ($cond, $vcond)) { - $message = ("$var was already defined in condition $vcond, " - . "which is implied by condition $cond"); - } - if ($message) - { - macro_error ($var, $message); - macro_dump ($var); + return ("$var was already defined in condition $vcond, " + . "which is implied by condition $cond"); } } + + return ''; } diff --git a/tests/Makefile.am b/tests/Makefile.am index a4573796..041cf8d1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -239,6 +239,8 @@ pluseq7.test \ pluseq8.test \ ppf77.test \ pr2.test \ +pr279.test \ +pr279-2.test \ pr9.test \ pr72.test \ pr87.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index ecab3a99..ef7c664f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -312,6 +312,8 @@ pluseq7.test \ pluseq8.test \ ppf77.test \ pr2.test \ +pr279.test \ +pr279-2.test \ pr9.test \ pr72.test \ pr87.test \ diff --git a/tests/pr279-2.test b/tests/pr279-2.test new file mode 100755 index 00000000..cad73da6 --- /dev/null +++ b/tests/pr279-2.test @@ -0,0 +1,32 @@ +#! /bin/sh + +# Another test related to PR 279. + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AC_INIT(foo, 0.1, dev@null) +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) +AC_PROG_CC +AM_CONDITIONAL(FOOTEST, false) +AC_CONFIG_FILES(Makefile) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = foreign + +if FOOTEST +foo_LDADD = zardoz +else +foo_LDADD = maude +endif + +bin_PROGRAMS = foo +END + +$ACLOCAL || exit 1 +$AUTOMAKE || exit 1 + +grep '@foo_DEPENDENCIES = zardoz' Makefile.in || exit 1 +grep '@foo_DEPENDENCIES = maude' Makefile.in || exit 1 diff --git a/tests/pr279.test b/tests/pr279.test new file mode 100755 index 00000000..7e4b7fd5 --- /dev/null +++ b/tests/pr279.test @@ -0,0 +1,31 @@ +#! /bin/sh + +# Test for PR 279. + +. $srcdir/defs || exit 1 + +cat > configure.in << 'END' +AC_INIT(foo, 0.1, dev@null) +AM_INIT_AUTOMAKE($PACKAGE, $VERSION) +AC_PROG_CC +AM_CONDITIONAL(FOOTEST, false) +AC_CONFIG_FILES(Makefile) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = foreign + +if FOOTEST +xtralib = +else +xtralib = +endif + +bin_PROGRAMS = foo +foo_LDADD = ${xtralib} +foo_DEPENDENCIES = +END + +$ACLOCAL || exit 1 +$AUTOMAKE