+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:
}
}
- 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;
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 '';
}
--- /dev/null
+#! /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
--- /dev/null
+#! /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