]> sourceware.org Git - automake.git/commitdiff
For PR automake/279:
authorTom Tromey <tromey@redhat.com>
Sat, 29 Dec 2001 23:58:06 +0000 (23:58 +0000)
committerTom Tromey <tromey@redhat.com>
Sat, 29 Dec 2001 23:58:06 +0000 (23:58 +0000)
* 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.

ChangeLog
automake.in
tests/Makefile.am
tests/Makefile.in
tests/pr279-2.test [new file with mode: 0755]
tests/pr279.test [new file with mode: 0755]

index f326eb5dc65f8aed95026226073fc13339246852..0711b54b279c9985e4937659fa110db68707c099 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-12-29  Tom Tromey  <tromey@redhat.com>
+
+       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  <tromey@redhat.com>
 
        For PR automake/249:
index 9b538bbbdf1c25d46136b7d77df9d837222e334d..792c25e7f24fc3a7ec7f4df00e62ab8d6d41c175 100755 (executable)
@@ -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 '';
 }
 
 
index a45737961e1988ba5c9af06d9898fc662defea3d..041cf8d15fe5c912ad829a272c861d52aa4f3c65 100644 (file)
@@ -239,6 +239,8 @@ pluseq7.test \
 pluseq8.test \
 ppf77.test \
 pr2.test \
+pr279.test \
+pr279-2.test \
 pr9.test \
 pr72.test \
 pr87.test \
index ecab3a995e0a1ff4e9c93e4df0c516d16aebb1b1..ef7c664f90546b26faa93d20c119e5f0a1089c32 100644 (file)
@@ -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 (executable)
index 0000000..cad73da
--- /dev/null
@@ -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 (executable)
index 0000000..7e4b7fd
--- /dev/null
@@ -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
This page took 0.053164 seconds and 5 git commands to generate.