automake-patches
[Top][All Lists]
Advanced

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

Patch: FYI: PR 279 test + patch


From: Tom Tromey
Subject: Patch: FYI: PR 279 test + patch
Date: 29 Dec 2001 17:08:14 -0700

I'm checking this in.
This fixes PR 279 and adds a couple related test cases.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        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.

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1245
diff -u -r1.1245 automake.in
--- automake.in 2001/12/12 11:13:12 1.1245
+++ automake.in 2001/12/29 23:10:54
@@ -2369,9 +2369,18 @@
        }
     }
 
-    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;
@@ -5673,29 +5682,42 @@
 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}})
     {
        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 '';
 }
 
 
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.357
diff -u -r1.357 Makefile.am
--- tests/Makefile.am 2001/12/27 06:11:09 1.357
+++ tests/Makefile.am 2001/12/29 23:10:55
@@ -239,6 +239,8 @@
 pluseq8.test \
 ppf77.test \
 pr2.test \
+pr279.test \
+pr279-2.test \
 pr9.test \
 pr72.test \
 pr87.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.464
diff -u -r1.464 Makefile.in
--- tests/Makefile.in 2001/12/27 06:11:09 1.464
+++ tests/Makefile.in 2001/12/29 23:10:55
@@ -312,6 +312,8 @@
 pluseq8.test \
 ppf77.test \
 pr2.test \
+pr279.test \
+pr279-2.test \
 pr9.test \
 pr72.test \
 pr87.test \
Index: tests/pr279-2.test
===================================================================
RCS file: pr279-2.test
diff -N pr279-2.test
--- /dev/null   Tue May  5 13:32:27 1998
+++ tests/pr279-2.test Sat Dec 29 15:10:55 2001
@@ -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, address@hidden)
+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
Index: tests/pr279.test
===================================================================
RCS file: pr279.test
diff -N pr279.test
--- /dev/null   Tue May  5 13:32:27 1998
+++ tests/pr279.test Sat Dec 29 15:10:55 2001
@@ -0,0 +1,31 @@
+#! /bin/sh
+
+# Test for PR 279.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(foo, 0.1, address@hidden)
+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



reply via email to

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