I came across this problem a few days ago: just narrowed it down to a
sensible test case.
With CVS automake, if LDADD is set from both a conditional variable
and an AC_SUBST() variable, the _DEPENDENCIES target gets set incorrectly,
having a @TRUE@ preceding it (for each of the conditional variables).
I attach a patch containing a testcase demonstrating the problem
(cond11.test), and a proposed fix (by removing redundant TRUE conditions
in variable_conditions_reduce().)
I'm not sure this patch is the right way to go about this, but with it the
testsuite (including cond11.test) passes.
For the example in cond11.test, CVS automake gives me a Makefile.in
containing the lines:
@TRUE@@USE_A_TRUE@foo_DEPENDENCIES = faz.la
@TRUE@@USE_A_FALSE@foo_DEPENDENCIES =
I would expect the lines:
@USE_A_TRUE@foo_DEPENDENCIES = faz.la
@USE_A_FALSE@foo_DEPENDENCIES =
PS: is this list still the correct place for patches? I thought I saw some
mention of setting up a new list for them a while back, but can't find
anything about that on the webpage.
--
Richard
Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.1414
diff -u -r1.1414 ChangeLog
--- ChangeLog 2001/06/04 15:53:02 1.1414
+++ ChangeLog 2001/06/06 01:13:38
@@ -1,3 +1,10 @@
+2001-06-06 Richard Boulton <[EMAIL PROTECTED]>
+
+ * (variable_conditions_reduce): Remove pure TRUE conditions unless
+ they are the only condition present.
+ * tests/Makefile.am (TESTS): Added cond11.test.
+ * tests/cond11.test: New file.
+
2001-06-04 Kevin Dalley <[EMAIL PROTECTED]>
* lib/am/dejagnu.am (site.exp): Fix typo.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1136
diff -u -r1.1136 automake.in
--- automake.in 2001/06/03 17:16:40 1.1136
+++ automake.in 2001/06/06 01:13:53
@@ -5896,6 +5896,7 @@
{
my (@conds) = @_;
my @ret = ();
+ my $havetrue = 0;
foreach my $cond (@conds)
{
# FALSE is absorbent.
@@ -5903,10 +5904,19 @@
{
return ('FALSE');
}
+ # TRUE is tautologous (unless its the only thing)
+ if ($cond eq 'TRUE')
+ {
+ $havetrue = 1;
+ }
elsif (conditionals_true_when (($cond), (@ret)))
{
push (@ret, $cond);
}
+ }
+ if ($havetrue && ! @ret)
+ {
+ push (@ret, 'TRUE');
}
return @ret;
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.306
diff -u -r1.306 Makefile.am
--- Makefile.am 2001/06/03 17:16:40 1.306
+++ Makefile.am 2001/06/06 01:13:54
@@ -62,6 +62,7 @@
cond8.test \
cond9.test \
cond10.test \
+cond11.test \
condincl.test \
condincl2.test \
condlib.test \
Index: tests/Makefile.in
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.in,v
retrieving revision 1.405
diff -u -r1.405 Makefile.in
--- Makefile.in 2001/06/03 17:16:40 1.405
+++ Makefile.in 2001/06/06 01:13:54
@@ -128,6 +128,7 @@
cond8.test \
cond9.test \
cond10.test \
+cond11.test \
condincl.test \
condincl2.test \
condlib.test \
Index: tests/cond11.test
===================================================================
RCS file: cond11.test
diff -N cond11.test
--- /dev/null Tue May 5 13:32:27 1998
+++ cond11.test Tue Jun 5 18:13:54 2001
@@ -0,0 +1,41 @@
+#! /bin/sh
+
+# Test for bug in conditionals. From Richard Boulton.
+# This checks that, if LDADD is set from a conditional variable
+# and an AC_SUBST, the _DEPENDENCIES variable is set correctly.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(foo,0.0)
+AC_PROG_CC
+AM_CONDITIONAL(USE_A,[test x = x])
+AC_OUTPUT(Makefile)
+AC_SUBST(SUBSTVAR)
+END
+
+cat > Makefile.am << 'END'
+
+if USE_A
+foolibs=faz.la
+else
+foolibs=
+endif
+
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+LDADD = $(SUBSTVAR) $(foolibs)
+END
+
+: > config.guess
+: > config.sub
+: > compile
+
+$ACLOCAL || exit 1
+$AUTOMAKE || exit 1
+
+#Should be two dependency setting lines
+count=`grep 'foo_DEPENDENCIES =' Makefile.in | wc -l|sed 's/ //g'`
+test "x$count" == "x2" &&
+ grep '^.USE_A_TRUE.foo_DEPENDENCIES =' Makefile.in