* tests/cond18.test: New file.
* tests/cond19.test: New file.
* tests/cond20.test: New file.
* tests/cond4.test: Updated to check the generated _OBJECTS more
thoroughly.
* tests/Makefile.am (TESTS): Added cond18.test, cond19.test and
cond20.test
+2001-08-08 Richard Boulton <richard@tartarus.org>
+
+ * tests/cond18.test: New file.
+ * tests/cond19.test: New file.
+ * tests/cond20.test: New file.
+ * tests/cond4.test: Updated to check the generated _OBJECTS more
+ thoroughly.
+ * tests/Makefile.am (TESTS): Added cond18.test, cond19.test and
+ cond20.test
+
2001-08-08 Richard Boulton <richard@tartarus.org>
* automake.in (file_contents_internal): if a rule is conditionally
cond15.test \
cond16.test \
cond17.test \
+cond18.test \
+cond19.test \
+cond20.test \
condincl.test \
condincl2.test \
condlib.test \
cond15.test \
cond16.test \
cond17.test \
+cond18.test \
+cond19.test \
+cond20.test \
condincl.test \
condincl2.test \
condlib.test \
--- /dev/null
+#! /bin/sh
+
+# Regression test for substitution references to conditional variables.
+# Report from Richard Boulton
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(hello,0.23)
+AC_PROG_CC
+AM_CONDITIONAL(COND1, true)
+AM_CONDITIONAL(COND2, true)
+AC_OUTPUT(Makefile)
+END
+
+cat > Makefile.am << 'END'
+
+var1 = dlmain
+
+if COND1
+var2 = $(var1:=.c) foo.cc
+else
+var2 = $(var1:=.c)
+endif
+
+if COND2
+var3 = $(var2:.cc=.c)
+else
+var3 = $(var2:.cc=.c)
+endif
+
+helldl_SOURCES = $(var3)
+
+echorule:
+ @echo $(helldl_SOURCES) $(helldl_OBJECTS)
+
+bin_PROGRAMS = helldl
+END
+
+$needs_autoconf
+(gcc -v) > /dev/null 2>&1 || exit 77
+$needs_gnu_make
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+CC='gcc' ./configure
+
+val=`$MAKE --no-print-directory echorule`;
+echo $val
+test "x$val" = "xdlmain.c foo.c dlmain.o foo.o"
--- /dev/null
+#! /bin/sh
+
+# Regression test for substitution references to conditional variables.
+# Report from Richard Boulton
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(hello,0.23)
+AC_PROG_CC
+AM_CONDITIONAL(COND1, test "x$CONDITION1" = "xtrue")
+AM_CONDITIONAL(COND2, test "x$CONDITION2" = "xtrue")
+AC_OUTPUT(Makefile)
+END
+
+cat > Makefile.am << 'END'
+
+var1 = dlmain
+
+if COND1
+var2 = $(var1:=.c)
+else
+var2 = $(var1:=.c)
+endif
+
+if COND2
+var3 = $(var2:.c=a.c)
+var4 = $(var2:.c=b.c)
+else
+var3 = $(var2:.c=b.c)
+var4 = $(var2:.c=a.c)
+endif
+
+helldl_SOURCES = $(var3:.c=1.c) $(var4:.c=2.c)
+
+echorule:
+ @echo $(helldl_SOURCES) $(helldl_OBJECTS)
+
+bin_PROGRAMS = helldl
+END
+
+$needs_autoconf
+(gcc -v) > /dev/null 2>&1 || exit 77
+$needs_gnu_make
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+CONDITION1=true CONDITION2=true CC='gcc' ./configure
+vala=`$MAKE --no-print-directory echorule`;
+CONDITION1=true CONDITION2=false CC='gcc' ./configure
+valb=`$MAKE --no-print-directory echorule`;
+CONDITION1=false CONDITION2=true CC='gcc' ./configure
+valc=`$MAKE --no-print-directory echorule`;
+CONDITION1=false CONDITION2=false CC='gcc' ./configure
+vald=`$MAKE --no-print-directory echorule`;
+
+echo $vala
+echo $valb
+echo $valc
+echo $vald
+test "x$vala" = "xdlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o" || exit 1
+test "x$valb" = "xdlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o" || exit 1
+test "x$valc" = "xdlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o" || exit 1
+test "x$vald" = "xdlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o" || exit 1
--- /dev/null
+#! /bin/sh
+
+# Regression test for recursion handling in substitution references to
+# conditional variables.
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(hello,0.23)
+AC_PROG_CC
+AM_CONDITIONAL(COND1, true)
+AC_OUTPUT(Makefile)
+END
+
+cat > Makefile.am << 'END'
+
+var1 = $(var2)
+
+if COND1
+var2 = $(var1:=.c) foo.cc
+else
+var2 = $(var1:=.c)
+endif
+
+helldl_SOURCES = $(var2)
+
+bin_PROGRAMS = helldl
+END
+
+$needs_autoconf
+
+set -e
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a && exit 1
+$AUTOMAKE -a 2>&1| grep "recursively defined"
. $srcdir/defs || exit 1
cat > configure.in << 'END'
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(foo,0.0)
AC_PROG_CC
-AM_CONDITIONAL(ONE, true)
-AM_CONDITIONAL(TWO, false)
+AM_CONDITIONAL(ONE, test "x$CONDITION1" = "xtrue")
+AM_CONDITIONAL(TWO, test "x$CONDITION2" = "xtrue")
AC_OUTPUT(Makefile)
END
endif
targ_SOURCES = main.c $(OPT1) $(OPT2)
+
+echo-objects:
+ @echo $(targ_OBJECTS)
END
+$needs_autoconf
+
$ACLOCAL || exit 1
$AUTOMAKE || exit 1
-
-test "`grep TWO_FALSE Makefile.in | wc -l`" -eq 2
+test "`grep TWO_FALSE Makefile.in | wc -l`" -eq 2 || exit 1
+
+$AUTOCONF || exit 1
+(gcc -v) > /dev/null 2>&1 || exit 77
+$needs_gnu_make
+
+CC='gcc' CONDITION1=true CONDITION2=true ./configure || exit 1
+msgtt=`$MAKE --no-print-directory echo-objects`
+CC='gcc' CONDITION1=true CONDITION2=false ./configure || exit 1
+msgtf=`$MAKE --no-print-directory echo-objects`
+CC='gcc' CONDITION1=false CONDITION2=true ./configure || exit 1
+msgft=`$MAKE --no-print-directory echo-objects`
+CC='gcc' CONDITION1=false CONDITION2=false ./configure || exit 1
+msgff=`$MAKE --no-print-directory echo-objects`
+
+echo $msgtt
+echo $msgtf
+echo $msgft
+echo $msgff
+
+test "$msgtt" = "main.o one.o two.o" || exit 1
+test "$msgtf" = "main.o one.o" || exit 1
+test "$msgft" = "main.o two.o" || exit 1
+test "$msgff" = "main.o" || exit 1