automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

12-true-and-false.patch


From: Akim Demaille
Subject: 12-true-and-false.patch
Date: Fri, 09 Mar 2001 00:47:33 +0100

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        * automake.in (read_am_file): TRUE and FALSE are predefined
        conditionals.
        (&by_condition): Adjust.
        (&conditional_string): Recognize (TRUE|FALSE)_(TRUE|FALSE).
        (&make_condition): Use it.
        * tests/cond9.test: s/FALSE/WRONG/.

Index: automake.in
--- automake.in Thu, 08 Mar 2001 21:05:12 +0100 akim (am/f/39_automake.i 1.123 
755)
+++ automake.in Thu, 08 Mar 2001 21:29:24 +0100 akim (am/f/39_automake.i 1.123 
755)
@@ -5482,12 +5482,14 @@ sub target_defined
 # Correctly returns the empty string when there are no conditions.
 sub make_condition
 {
-    my $res = join ('@@', @_);
-    return ''
-      unless $res;
+    my $res = conditional_string (@_);
+
+    return $res
+      if $res eq '' or $res eq '#' ;

     $res = '@' . $res . '@';
     $res =~ s/ /@@/;
+
     return $res;
 }

@@ -5526,7 +5528,7 @@ sub conditional_string
     }
   else
     {
-      return join (' ', uniq (sort (grep (!/^TRUE$/, @stack))));
+      return join (' ', uniq sort grep (!/^TRUE$/, @stack));
     }
 }

@@ -5667,8 +5669,8 @@ sub examine_variable
 # If the variable is defined in terms of any variables which are
 # defined conditionally, then this returns a full set of permutations
 # of the subvariable conditions.  For example, if the variable is
-# defined in terms of a variable which is defined for @COND_TRUE@,
-# then this returns both @COND_TRUE@ and @address@hidden  This is
+# defined in terms of a variable which is defined for COND_TRUE,
+# then this returns both COND_TRUE and COND_FALSE.  This is
 # because we will need to define the variable under both conditions.

 sub variable_conditions
@@ -5823,10 +5825,11 @@ sub variable_conditions_sub
 # Issue them in alphabetical order, foo_TRUE before foo_FALSE.
 sub by_condition
 {
+    # Be careful we might be comparing `' or `#'.
     $a =~ /^(.*)_(TRUE|FALSE)$/;
-    my ($aname, $abool) = ($1, $2);
+    my ($aname, $abool) = ($1 || '', $2 || '');
     $b =~ /^(.*)_(TRUE|FALSE)$/;
-    my ($bname, $bbool) = ($1, $2);
+    my ($bname, $bbool) = ($1 || '', $2 || '');
     return ($aname cmp $bname
            # Don't bother with IFs, given that TRUE is after FALSE
            # just cmp in the reverse order.
@@ -6275,9 +6278,11 @@ sub read_am_file
        }
        elsif (/$IF_PATTERN/o)
        {
-           &am_line_error ($., "$1 does not appear in AM_CONDITIONAL")
-               if (! $configure_cond{$1});
-           push (@conditional_stack, "$1_TRUE");
+           my $cond = $1;
+           &am_line_error ($., "$cond does not appear in AM_CONDITIONAL")
+               if ! $configure_cond{$cond} && $cond !~ /^TRUE|FALSE$/;
+           push (@conditional_stack,
+                 ($cond =~ /^TRUE|FALSE$/) ? "$cond" : "${cond}_TRUE");
        }
        elsif (/$ELSE_PATTERN/o)
        {
@@ -6285,14 +6290,14 @@ sub read_am_file
            {
                &am_line_error ($., "else without if");
            }
-           elsif ($conditional_stack[$#conditional_stack] =~ /_FALSE$/)
+           elsif ($conditional_stack[$#conditional_stack] =~ /^(.*_)?FALSE$/)
            {
                &am_line_error ($., "else after else");
            }
            else
            {
                $conditional_stack[$#conditional_stack]
-                   =~ s/_TRUE$/_FALSE/;
+                   =~ s/TRUE$/FALSE/;
            }
        }
        elsif (/$ENDIF_PATTERN/o)
Index: tests/cond9.test
--- tests/cond9.test Wed, 31 Jan 2001 00:08:51 +0100 akim (am/e/2_cond9.test 
1.2 755)
+++ tests/cond9.test Thu, 08 Mar 2001 21:32:46 +0100 akim (am/e/2_cond9.test 
1.2 755)
@@ -7,12 +7,12 @@
 cat > configure.in << 'END'
 AC_INIT(Makefile.am)
 AM_INIT_AUTOMAKE(foo,0.0)
-AM_CONDITIONAL(FALSE, [test x = y])
+AM_CONDITIONAL(WRONG, [test x = y])
 AC_OUTPUT(Makefile)
 END

 cat > Makefile.am << 'END'
-if FALSE
+if WRONG
 this=
 else
 this=is_something_interesting



reply via email to

[Prev in Thread] Current Thread [Next in Thread]