* automake.in (&conditional_string): Produce a unique string
authorAkim Demaille <akim@epita.fr>
Fri, 9 Mar 2001 16:17:05 +0000 (16:17 +0000)
committerAkim Demaille <akim@epita.fr>
Fri, 9 Mar 2001 16:17:05 +0000 (16:17 +0000)
characterizing a condition stack.
(&conditional_same): Remove, comparing two strings is now enough.
(&variable_defined): Adjust.
(&read_am_file): Use conditional_string.

ChangeLog
automake.in

index f1e7897..60c2bbf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2001-03-09  Akim Demaille  <akim@epita.fr>
+
+       * 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  <akim@epita.fr>
 
        * automake.in: Use -w.
index 351d67b..2d24b10 100755 (executable)
@@ -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}