From 0d5ddb050e3e97bc465606b98448b4e47aea6ba7 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 9 Mar 2001 16:17:04 +0000 Subject: [PATCH] * automake.in (&conditional_string): Produce a unique string characterizing a condition stack. (&conditional_same): Remove, comparing two strings is now enough. (&variable_defined): Adjust. (&read_am_file): Use conditional_string. --- ChangeLog | 8 ++++++++ automake.in | 38 ++++++++++++++++++++++++-------------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1e78978..60c2bbf0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2001-03-09 Akim Demaille + + * automake.in (&conditional_string): Produce a unique string + characterizing a condition stack. + (&conditional_same): Remove, comparing two strings is now enough. + (&variable_defined): Adjust. + (&read_am_file): Use conditional_string. + 2001-03-08 Akim Demaille * automake.in: Use -w. diff --git a/automake.in b/automake.in index 351d67b1..2d24b103 100755 --- a/automake.in +++ b/automake.in @@ -5491,15 +5491,6 @@ sub make_condition return $res; } -# See if two conditionals are the same. -sub conditional_same -{ - my ($cond1, $cond2) = @_; - - return (&conditional_true_when ($cond1, $cond2) - && &conditional_true_when ($cond2, $cond1)); -} - # &conditional_dump # ----------------- @@ -5521,6 +5512,25 @@ sub conditional_dump () } +# $STRING +# &conditional_string(@COND-STACK) +# -------------------------------- +# Build a string de +sub conditional_string +{ + my (@stack) = @_; + + if (grep (/^FALSE$/, @stack)) + { + return '#'; + } + else + { + return join (' ', uniq (sort (grep (!/^TRUE$/, @stack)))); + } +} + + # $BOOLEAN # &conditional_true_when ($COND, $WHEN) # ------------------------------------- @@ -5613,7 +5623,7 @@ sub variable_defined ($$) # have been asked to check. foreach my $vcond (keys %{$conditional{$var}}) { - if (&conditional_same ($cond, $vcond)) + if ($cond eq $vcond) { # Even a conditional examination is good enough # for us. FIXME: really should maintain examined @@ -6258,7 +6268,7 @@ sub read_am_file $contents{$last_var_name} .= $_; if (@conditional_stack) { - my $cond_string = join (' ', @conditional_stack); + my $cond_string = conditional_string (@conditional_stack); ${conditional{$last_var_name}}{$cond_string} .= $_; } } @@ -6313,7 +6323,7 @@ sub read_am_file $targets{$1} = 1; if (@conditional_stack) { - my $cond_string = join (' ', @conditional_stack); + my $cond_string = conditional_string (@conditional_stack); if ($target_conditional{$1}) { &check_ambiguous_conditional ($1, $cond_string); @@ -6409,7 +6419,7 @@ sub read_am_file # Handle conditionalized macros. if (@conditional_stack) { - my $cond_string = join (' ', @conditional_stack); + my $cond_string = conditional_string (@conditional_stack); my $done = 0; if ($conditional{$last_var_name}) { @@ -6420,7 +6430,7 @@ sub read_am_file # the old value with the new one. foreach my $vcond (keys %{$conditional{$last_var_name}}) { - if (&conditional_same ($vcond, $cond_string)) + if ($vcond eq $cond_string) { $done = 1; ${$conditional{$last_var_name}}{$vcond} -- 2.43.5