I submitted a patch for this a little while ago, but received no response.
If there is an alternate forum in which I should be submitting patches, or
if I can do anything to make the patch clearer / more readily applicable,
please let me know.
I attach an updated patch against current CVS HEAD.
--
Richard
On Wed, Jun 06, 2001 at 02:33:16AM +0100, Richard Boulton wrote:
> 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.1415
diff -u -r1.1415 ChangeLog
--- ChangeLog 2001/06/09 00:34:28 1.1415
+++ ChangeLog 2001/06/10 16:06:17
@@ -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-08 Tom Tromey <[EMAIL PROTECTED]>
* tests/version4.test: New file.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1137
diff -u -r1.1137 automake.in
--- automake.in 2001/06/09 00:34:28 1.1137
+++ automake.in 2001/06/10 16:06:31
@@ -5937,6 +5937,7 @@
{
my (@conds) = @_;
my @ret = ();
+ my $havetrue = 0;
foreach my $cond (@conds)
{
# FALSE is absorbent.
@@ -5944,10 +5945,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.307
diff -u -r1.307 Makefile.am
--- Makefile.am 2001/06/09 00:34:29 1.307
+++ Makefile.am 2001/06/10 16:06:32
@@ -60,6 +60,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.406
diff -u -r1.406 Makefile.in
--- Makefile.in 2001/06/09 00:34:30 1.406
+++ Makefile.in 2001/06/10 16:06:33
@@ -126,6 +126,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 Sun Jun 10 09:06:33 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