]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
tests: tweak and improve tests on Automake conditionals
authorStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 May 2011 13:42:02 +0000 (15:42 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 May 2011 20:32:40 +0000 (22:32 +0200)
The "avoid the requirement of a working compiler" we refer about
below is obtained by disabling automatic dependency tracking and
defining `CC' (and `EXEEXT', `OBJEXT', `CXX', etc., if needed) to
dummy values, either directly in the `Makefile.am', or by AC_SUBST
in `configure.in'.

The "cosmetic changes" we refer about below consists in, e.g.,
adding a trailing `:' command to a script, using proper m4 quoting
in `configure.in' files, adding commands that offer more debugging
output, explicitly declaring phony targets as such in Makefiles,
making use of idioms more consistent with those employed in other
tests, following the GNU formatting standards more closely, etc.

* tests/cond.test: Cosmetic changes.
* tests/cond3.test: Likewise.
* tests/cond10.test: Likewise.
* tests/cond14.test: Likewise.
* tests/cond15.test: Likewise.
* tests/cond17.test: Likewise.
* tests/cond40.test: Likewise.
* tests/cond13.test: Likewise, and make grepping of the generated
`Makefile.in' slightly stricter.
* tests/cond6.test: Extend by also running ./configure, make and
"make install".  Few cosmetic changes.
* tests/cond8.test: Likewise.
* tests/cond2.test: Do few cosmetic changes.  Make grepping of
automake stderr stricter.
* tests/cond20.test: Likewise.
* tests/cond23.test: Likewise.
* tests/cond24.test: Likewise.
* tests/cond42.test: Likewise.
* tests/cond46.test: Likewise.
* tests/cond9.test: Move more checks in the `Makefile.am' instead
of grepping make's output.
* tests/cond38.test: Likewise.
* tests/cond11.test: Likewise.  Avoid the requirement of a working
C compiler.
* tests/cond16.test: Likewise.
* tests/cond22.test: Likewise.
* tests/cond30.test: Likewise.
* tests/cond31.test: Likewise.
* tests/cond4.test: Likewise, and drop the now-useless GNU make
requirement as well.
* tests/cond18.test: Likewise.
* tests/cond19.test: Likewise.
* tests/cond22.test: Likewise.
* tests/cond25.test: Add trailing `:' command.
* tests/cond26.test: Likewise.
* tests/cond27.test: Likewise.
* tests/cond28.test: Likewise.
* tests/cond29.test: Use `unindent' function for better formatting.
Other minor cosmetic changes.  Use a `timeout' program (if it's
available) to determine whether the script takes too long, instead
of just hoping that the user will notice an abnormally long test
execution time.
* tests/cond33.test: Extend a bit.  Fix heading comments.  Few more
cosmetic changes.
* tests/cond37.test: Ensure verbose printing of captured make
output.  Minor cosmetic changes.
* tests/cond34.test: Likewise.  Avoid the requirement of a working
C compiler.  Make grepping of make output slightly stricter.
* tests/cond35.test: Quote literal dots in grep regexp.  Add extra
debugging output.  Minor cosmetic changes.
* tests/cond36.test: Likewise.
* tests/cond41.test: Do not simply check that aclocal fails, but
also grep its stderr for the expected error message.
* tests/cond43.test: Likewise (but the program being automake).
Few cosmetic changes.
* tests/condd.test: Avoid the requirement of a working C compiler.
* tests/condman3.test: Extend by using more man pages and more
manpage sections.
* tests/condman.test: Removed, it's completely superseded by
`condman3.test'.
* tests/Makefile.am (TESTS): Update.

45 files changed:
ChangeLog
tests/Makefile.am
tests/Makefile.in
tests/cond.test
tests/cond10.test
tests/cond11.test
tests/cond13.test
tests/cond14.test
tests/cond15.test
tests/cond16.test
tests/cond17.test
tests/cond18.test
tests/cond19.test
tests/cond2.test
tests/cond20.test
tests/cond22.test
tests/cond23.test
tests/cond24.test
tests/cond25.test
tests/cond26.test
tests/cond27.test
tests/cond28.test
tests/cond29.test
tests/cond3.test
tests/cond30.test
tests/cond31.test
tests/cond32.test
tests/cond33.test
tests/cond34.test
tests/cond35.test
tests/cond36.test
tests/cond37.test
tests/cond38.test
tests/cond4.test
tests/cond40.test
tests/cond41.test
tests/cond42.test
tests/cond43.test
tests/cond46.test
tests/cond6.test
tests/cond8.test
tests/cond9.test
tests/condd.test
tests/condman.test [deleted file]
tests/condman3.test

index 3e6269bc036a1c00f4740372a41cdb2471b439b2..62c6ca47d62cc17abb274450a6cd6e34c2af033e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,79 @@
+2011-05-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: tweak and improve tests on Automake conditionals
+       The "avoid the requirement of a working compiler" we refer about
+       below is obtained by disabling automatic dependency tracking and
+       defining `CC' (and `EXEEXT', `OBJEXT', `CXX', etc., if needed) to
+       dummy values, either directly in the `Makefile.am', or by AC_SUBST
+       in `configure.in'.
+       The "cosmetic changes" we refer about below consists in, e.g.,
+       adding a trailing `:' command to a script, using proper m4 quoting
+       in `configure.in' files, adding commands that offer more debugging
+       output, explicitly declaring phony targets as such in Makefiles,
+       making use of idioms more consistent with those employed in other
+       tests, following the GNU formatting standards more closely, etc.
+       * tests/cond.test: Cosmetic changes.
+       * tests/cond3.test: Likewise.
+       * tests/cond10.test: Likewise.
+       * tests/cond14.test: Likewise.
+       * tests/cond15.test: Likewise.
+       * tests/cond17.test: Likewise.
+       * tests/cond40.test: Likewise.
+       * tests/cond13.test: Likewise, and make grepping of the generated
+       `Makefile.in' slightly stricter.
+       * tests/cond6.test: Extend by also running ./configure, make and
+       "make install".  Few cosmetic changes.
+       * tests/cond8.test: Likewise.
+       * tests/cond2.test: Do few cosmetic changes.  Make grepping of
+       automake stderr stricter.
+       * tests/cond20.test: Likewise.
+       * tests/cond23.test: Likewise.
+       * tests/cond24.test: Likewise.
+       * tests/cond42.test: Likewise.
+       * tests/cond46.test: Likewise.
+       * tests/cond9.test: Move more checks in the `Makefile.am' instead
+       of grepping make's output.
+       * tests/cond38.test: Likewise.
+       * tests/cond11.test: Likewise.  Avoid the requirement of a working
+       C compiler.
+       * tests/cond16.test: Likewise.
+       * tests/cond22.test: Likewise.
+       * tests/cond30.test: Likewise.
+       * tests/cond31.test: Likewise.
+       * tests/cond4.test: Likewise, and drop the now-useless GNU make
+       requirement as well.
+       * tests/cond18.test: Likewise.
+       * tests/cond19.test: Likewise.
+       * tests/cond22.test: Likewise.
+       * tests/cond25.test: Add trailing `:' command.
+       * tests/cond26.test: Likewise.
+       * tests/cond27.test: Likewise.
+       * tests/cond28.test: Likewise.
+       * tests/cond29.test: Use `unindent' function for better formatting.
+       Other minor cosmetic changes.  Use a `timeout' program (if it's
+       available) to determine whether the script takes too long, instead
+       of just hoping that the user will notice an abnormally long test
+       execution time.
+       * tests/cond33.test: Extend a bit.  Fix heading comments.  Few more
+       cosmetic changes.
+       * tests/cond37.test: Ensure verbose printing of captured make
+       output.  Minor cosmetic changes.
+       * tests/cond34.test: Likewise.  Avoid the requirement of a working
+       C compiler.  Make grepping of make output slightly stricter.
+       * tests/cond35.test: Quote literal dots in grep regexp.  Add extra
+       debugging output.  Minor cosmetic changes.
+       * tests/cond36.test: Likewise.
+       * tests/cond41.test: Do not simply check that aclocal fails, but
+       also grep its stderr for the expected error message.
+       * tests/cond43.test: Likewise (but the program being automake).
+       Few cosmetic changes.
+       * tests/condd.test: Avoid the requirement of a working C compiler.
+       * tests/condman3.test: Extend by using more man pages and more
+       manpage sections.
+       * tests/condman.test: Removed, it's completely superseded by
+       `condman3.test'.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-05-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        lex tests: avoid spurious failures when LEXLIB isn't found
index 976883341fc3af5599ce7aae4ff22321b2cc68da..bcb65d8db121c38c2c70d3f84abaf584112491c8 100644 (file)
@@ -342,7 +342,6 @@ condhook2.test \
 condinc.test \
 condinc2.test \
 condlib.test \
-condman.test \
 condman2.test \
 condman3.test \
 configure.test \
index 55fb244fd75a02f456c15ba270b74fb7505f3bc2..107b359065e968bcb8898e6a8b042fe0a0185107 100644 (file)
@@ -607,7 +607,6 @@ condhook2.test \
 condinc.test \
 condinc2.test \
 condlib.test \
-condman.test \
 condman2.test \
 condman3.test \
 configure.test \
index f4567f114442fc527442eb98526e251a714c4d46..6bc1e7002a6eaf7ce20563ed730dcffa4ba5d872 100755 (executable)
@@ -20,7 +20,7 @@
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AM_CONDITIONAL(TEST, true)
+AM_CONDITIONAL([TEST], [true])
 AC_OUTPUT
 END
 
@@ -39,3 +39,5 @@ grep '^TEST_FALSE' Makefile.in && Exit 1
 grep '^TEST_TRUE' Makefile.in && Exit 1
 grep '^@TEST_TRUE@VAR = true$' Makefile.in
 grep '^@TEST_FALSE@VAR = false$' Makefile.in
+
+:
index 49a3d6b7c61c8850b3186718ac01ccffe6a1898a..ac2ffe34b5fa3035bbcd280b90400cc11a0726da 100755 (executable)
@@ -20,8 +20,8 @@
 
 cat >> configure.in << 'END'
 AC_PROG_CC
-AM_CONDITIONAL(USE_A,[test x = y])
-AM_CONDITIONAL(USE_B,[test x = z])
+AM_CONDITIONAL([USE_A], [test x = y])
+AM_CONDITIONAL([USE_B], [test x = z])
 AC_OUTPUT
 END
 
@@ -43,3 +43,5 @@ END
 $ACLOCAL
 $AUTOMAKE -a
 grep 'USE_A_FALSE.*USE_B_FALSE.*output_c\...OBJEXT.' Makefile.in
+
+:
index 9e7f6da5371ed9b695d61f3a46b5b530635ed52e..89ab4825e2ee87999992484ff288d039560aa3c9 100755 (executable)
 # This checks that, if LDADD is set from a conditional variable
 # and an AC_SUBST, the _DEPENDENCIES variable is set correctly.
 
-required=cc
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
+AC_SUBST([CC], [false])
 AM_CONDITIONAL([USE_A], [test -z "$two"])
 AC_SUBST([SUBSTVAR], [bar])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-
 if USE_A
 foolibs=faz.la
 else
@@ -40,8 +38,11 @@ noinst_PROGRAMS = foo
 foo_SOURCES = foo.c
 LDADD = $(SUBSTVAR) $(foolibs)
 
-print:
-       @echo BEG: $(foo_DEPENDENCIES) :END
+.PHONY: test1 test2
+test1:
+       test faz.la = $(foo_DEPENDENCIES)
+test2:
+       test -z "`echo $(foo_DEPENDENCIES)`"
 END
 
 : > config.guess
@@ -50,14 +51,12 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --ignore-deps
 
 ./configure
-$MAKE -e print > stdout
-cat stdout
-grep 'BEG: faz.la :END' stdout
+$MAKE test1
 
 ./configure two=yes
-$MAKE -e print > stdout
-cat stdout
-grep 'BEG: :END' stdout
+$MAKE test2
+
+:
index 193b02d4001af5809cbdbad27492ea112c12e73b..190f1e689d8c4491649a6c6bfca123c98bddbaba 100755 (executable)
@@ -23,8 +23,8 @@ cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_RANLIB
-AM_CONDITIONAL(COND1, true)
-AM_CONDITIONAL(COND2, true)
+AM_CONDITIONAL([COND1], [true])
+AM_CONDITIONAL([COND2], [true])
 END
 
 cat > Makefile.am << 'END'
@@ -50,4 +50,6 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-grep 'am_libtest_a_OBJECTS = .*$' Makefile.in
+grep '^am_libtest_a_OBJECTS =' Makefile.in
+
+:
index f5a5e2474f2c27349753121fca06ce259c7853da..6e552c1d209f91764cec4f6dfa41d6fa4d2e94e5 100755 (executable)
@@ -25,7 +25,6 @@ AM_CONDITIONAL([COND1], [true])
 END
 
 cat > Makefile.am << 'END'
-
 if COND1
 BUILD_helldl = helldl
 helldl_SOURCES = dlmain.c
@@ -46,7 +45,7 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-num=`grep 'helldl$(EXEEXT):' Makefile.in | wc -l`
-test $num -eq 2
+$FGREP helldl Makefile.in # For debugging.
+test `$FGREP -c 'helldl$(EXEEXT):' Makefile.in` -eq 2
 
 :
index fbd5e04e20bb22a6289ce69d04213f4ee513d94f..d5fb0a0e82bc1033643305ad5bef4da55eb5c10a 100755 (executable)
@@ -25,7 +25,6 @@ AM_CONDITIONAL([COND2], [true])
 END
 
 cat > Makefile.am << 'END'
-
 if COND1
 if COND2
 bin_SCRIPTS = helldl
@@ -53,6 +52,7 @@ END
 $ACLOCAL
 $AUTOMAKE
 
+$FGREP helldl Makefile.in # For debugging.
 num1=`$FGREP 'helldl$(EXEEXT):' Makefile.in | wc -l`
 num2=`$FGREP '@COND1_FALSE@@COND2_TRUE@helldl$(EXEEXT):' Makefile.in | wc -l`
 test $num1 -eq 4
index d27472c337401dfdb8f837c171f7bc5080c7748b..89182c409eaed7d765416599583c1288447f7863 100755 (executable)
 # references.
 # Report from Richard Boulton
 
-required=cc
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
 AM_CONDITIONAL([COND1], [true])
 AC_OUTPUT
 END
@@ -30,6 +28,9 @@ END
 : > hello.c
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+OBJEXT = o
 
 if COND1
 var = foo.c
@@ -40,18 +41,15 @@ endif
 bin_PROGRAMS = hell
 hell_SOURCES = $(var:=)
 
-echorule:
-       @echo $(hell_SOURCES) $(hell_OBJECTS)
-
+.PHONY: test
+test:
+       test "`echo $(hell_SOURCES) $(hell_OBJECTS)`" = "foo.c foo.o"
 END
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-
 ./configure
-
-val=`$MAKE -s echorule`;
-test "x$val" = "xfoo.c foo.o"
+$MAKE test
 
 :
index 90a38e6ce57d0633cdc8f2c8f5dba8a52dae1804..c934ee8d5a302af0c33f04810833ef55ddf0cd7d 100755 (executable)
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT(Makefile.am)
-AM_INIT_AUTOMAKE(hello,0.23)
+cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
-AM_CONDITIONAL(COND1, true)
-AC_OUTPUT(Makefile)
+AM_CONDITIONAL([COND1], [true])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -40,3 +38,5 @@ END
 
 $ACLOCAL
 $AUTOMAKE -a
+
+:
index 57c5516d70538ade0d78054f68561edbeefdb487..9c404a4bd59a14f69de6dee67740af4bc2730a30 100755 (executable)
 # Regression test for substitution references to conditional variables.
 # Report from Richard Boulton
 
-required='cc GNUmake'
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [true])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+OBJEXT = obj
 
 var1 = dlmain
 
@@ -45,8 +46,10 @@ endif
 
 helldl_SOURCES = $(var3)
 
-echorule:
-       @echo $(helldl_SOURCES) $(helldl_OBJECTS)
+.PHONY: test
+test:
+       test x"`echo $(helldl_SOURCES) $(helldl_OBJECTS)`" = \
+            x"dlmain.c foo.c dlmain.obj foo.obj"
 
 bin_PROGRAMS = helldl
 END
@@ -54,10 +57,7 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-
 ./configure
-
-val=`$MAKE --no-print-directory echorule`;
-test "x$val" = "xdlmain.c foo.c dlmain.o foo.o"
+$MAKE test
 
 :
index c5ac15a320731d540a1327679b3d2f60640de61e..50ae9cbb947afe120ae115e55a4a958807f396e0 100755 (executable)
 # Regression test for substitution references to conditional variables.
 # Report from Richard Boulton
 
-required='cc GNUmake'
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
+AC_SUBST([CC], [false])
+AC_SUBST([OBJEXT], [o])
 AM_CONDITIONAL([COND1], [test "x$CONDITION1" = "xtrue"])
 AM_CONDITIONAL([COND2], [test "x$CONDITION2" = "xtrue"])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+bin_PROGRAMS = helldl
 
 var1 = dlmain
 
@@ -47,28 +48,24 @@ endif
 
 helldl_SOURCES = $(var3:.c=1.c) $(var4:.c=2.c)
 
-echorule:
-       @echo $(helldl_SOURCES) $(helldl_OBJECTS)
+got = `echo $(helldl_SOURCES) $(helldl_OBJECTS)`
 
-bin_PROGRAMS = helldl
+.PHONY: test
+test:
+       test x"$(exp)" = x"$(got)"
 END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -a -i
 
 CONDITION1=true CONDITION2=true ./configure
-vala=`$MAKE --no-print-directory echorule`;
+$MAKE test exp='dlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o'
 CONDITION1=true CONDITION2=false ./configure
-valb=`$MAKE --no-print-directory echorule`;
+$MAKE test exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o'
 CONDITION1=false CONDITION2=true ./configure
-valc=`$MAKE --no-print-directory echorule`;
+$MAKE test exp='dlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o'
 CONDITION1=false CONDITION2=false ./configure
-vald=`$MAKE --no-print-directory echorule`;
-
-test "x$vala" = "xdlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o"
-test "x$valb" = "xdlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o"
-test "x$valc" = "xdlmaina1.c dlmainb2.c dlmaina1.o dlmainb2.o"
-test "x$vald" = "xdlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o"
+$MAKE test exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o'
 
 :
index b47e3245ba19936f6fb18eb28027d66ef434bf19..0f0235bb6c0459f181c15221ac9100135cef803d 100755 (executable)
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AM_CONDITIONAL(TEST, true)
-AC_OUTPUT(Makefile)
+cat >> configure.in << 'END'
+AM_CONDITIONAL([TEST], [true])
 END
 
 cat > Makefile.am << 'END'
@@ -39,4 +36,6 @@ mkdir dir1
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:4:.*dir2.*does not exist' stderr
+grep '^Makefile\.am:4:.*dir2.*does not exist' stderr
+
+:
index f0e1dd8eaeff2126c8f144d20b3412a1aaf0a413..cd2ec0bf05c3a4341470fc908e42fc9a85d1e474 100755 (executable)
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT(Makefile.am)
-AM_INIT_AUTOMAKE(hello,0.23)
+cat >> configure.in << 'END'
 AC_PROG_CC
-AM_CONDITIONAL(COND1, true)
-AC_OUTPUT(Makefile)
+AM_CONDITIONAL([COND1], [true])
 END
 
 cat > Makefile.am << 'END'
-
 var1 = $(var2)
 
 if COND1
@@ -45,4 +41,6 @@ END
 $ACLOCAL
 $AUTOCONF
 AUTOMAKE_fails -a
-grep "recursively defined" stderr
+grep "variable.*var2.*recursively defined" stderr
+
+:
index 4d88f9d2de857d28a8972bd79e6a7099b80bc2b9..72120eb4c6546c1578bbda64fcdacef212ac2419 100755 (executable)
 # Regression test for bug when sources listed in conditional.
 # Report from Richard Boulton.  PR/326.
 
-required=cc
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
-AM_CONDITIONAL(ONE, true)
-AM_CONDITIONAL(TWO, false)
-AM_CONDITIONAL(THREE, false)
+CC=false; AC_SUBST([CC])
+OBJEXT=oo; AC_SUBST([OBJEXT])
+AM_CONDITIONAL([ONE], [true])
+AM_CONDITIONAL([TWO], [false])
+AM_CONDITIONAL([THREE], [false])
 AC_OUTPUT
 END
 
@@ -55,14 +55,15 @@ endif
 
 targ_SOURCES = $(SONE) $(STWO) $(STHREE) $(STHREE2)
 
-echo:
-       echo BEG: $(targ_OBJECTS) :END;
+.PHONY: test
+test:
+       test "`echo $(targ_OBJECTS)`" = "one.oo two.oo three.oo three2.oo"
 END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --ignore-deps
 ./configure
-OBJEXT=oo $MAKE -e echo > output
-cat output
-$FGREP 'BEG: one.oo two.oo three.oo three2.oo :END' output
+$MAKE test
+
+:
index 7cb8292e2e964d1aab036ce4a3f04414c2006ed6..db209b23dfad5f3ec1c278127b93ff9a1ab2bc89 100755 (executable)
@@ -32,4 +32,6 @@ EOF
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'libdir was already defined' stderr
+grep '^Makefile\.am:2:.* libdir was already defined' stderr
+
+:
index 7bfa89f580c0bb644534ca9f3961d3aad9325a02..11f8d870181c126660fba903b896019796815cf7 100755 (executable)
 cat >>configure.in <<EOF
 AC_SUBST([foo], [bar])
 AM_CONDITIONAL([COND], [true])
-AC_OUTPUT
 EOF
 
 cat >Makefile.am <<EOF
 if COND
+## A dummy comment to change line numer.
 foo = baz
 endif
 EOF
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'foo was already defined' stderr
+grep '^Makefile\.am:3:.* foo was already defined' stderr
+grep '^configure\.in:4:.*foo.* previously defined here' stderr
+
+:
index 9d1686d04f57118440a8af5fa457094d85b71213..fe03745bcb463a84eb36f44538092b7434d61ab0 100755 (executable)
@@ -35,3 +35,5 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+
+:
index 7252dbd0baecfe44b97da39585a15d88a532e69b..3c29b59d99946eae0d2996d344045a5f6f62d73a 100755 (executable)
@@ -34,3 +34,5 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+
+:
index 141723c47d4f43c9cc6d7c9e5f778b69cc648971..74f2e485f899f847f31116ba49491c17f8c33c43 100755 (executable)
@@ -34,3 +34,5 @@ $ACLOCAL
 AUTOMAKE_fails
 grep ' USE_FOO' stderr && Exit 1
 grep '!USE_FOO' stderr
+
+:
index e5f254e1c4559f48feb2425bd6fc199652665ec9..0c6cd29d3bda3e05b4bb9b90b38312736fc6ea11 100755 (executable)
@@ -34,3 +34,5 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+
+:
index f2488504c67f8f896498c42df8fc557d84de6875..222743c98dbb2d5c2a9ee23cd147f1bfb4a13912 100755 (executable)
 # possible combinations of conditionals (it would do this five times,
 # to define a01_DEPENDENCIES, a02_DEPENDENCIES, a03_OBJECTS,
 # a04_OBJECTS, and to rewrite bin_PROGRAM), eating all memory, swap,
-# or cpu time it can found.  Although this test won't print `FAIL' if
-# it fails, it will take long enough so it can't go unnoticed.
+# or cpu time it can found.
 
 . ./defs || Exit 1
 
+timeout 10s true || skip_ "timeout command not found"
+
 echo AC_PROG_CC >>configure.in
 
 cat >Makefile.am <<EOF
@@ -35,17 +36,23 @@ a03_SOURCES =
 EOF
 
 for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22; do
-cat >>Makefile.am <<EOF
-if C$i
-bin_PROGRAMS += a$i
-a01_LDADD = foo${i}.o
-a02_LDADD += bar${i}.o
-a03_SOURCES += baz${i}.c
-a04_SOURCES = quux${i}.c
-endif C$i
+  unindent >>Makefile.am <<EOF
+    if C$i
+    bin_PROGRAMS += a$i
+    a01_LDADD = foo${i}.o
+    a02_LDADD += bar${i}.o
+    a03_SOURCES += baz${i}.c
+    a04_SOURCES = quux${i}.c
+    endif C$i
 EOF
-echo "AM_CONDITIONAL([C$i], [:])" >>configure.in
+  echo "AM_CONDITIONAL([C$i], [:])" >>configure.in
 done
 
 $ACLOCAL
-$AUTOMAKE
+# Be lax w.r.t. the timeout for low-priority processes on heavily
+# loaded systems.
+niceness=`nice || echo 0`
+case $niceness in [0-9]*);; *) niceness=0;; esac
+timeout `expr 60 '+' $niceness '*' 20`s $AUTOMAKE
+
+:
index 2a75d432cd4d6382202a9e78c5b4ae0281fc26a5..7e9b3aeb9a2fe57e90f2a69688688545ba65fa6c 100755 (executable)
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat >> configure.in << 'END'
 AC_PROG_CC
-AM_CONDITIONAL(ONE, true)
-AM_CONDITIONAL(TWO, false)
-AM_CONDITIONAL(THREE, maybe)
-AC_OUTPUT(Makefile)
+AM_CONDITIONAL([ONE], [true])
+AM_CONDITIONAL([TWO], [false])
+AM_CONDITIONAL([THREE], [maybe])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -78,3 +76,5 @@ targ_OBJECTS = $(am_targ_OBJECTS)
 EOF
 
 diff expected produced
+
+:
index e1c134194b079d57f9114d15c7945615b2c79303..fb44bf63a1be6573c2e2750cd743b0821c4cb895 100755 (executable)
 
 # For PR/352: make sure we support bin_PROGRAMS being defined conditionally.
 
-required=cc
 . ./defs || Exit 1
 
 cat >>configure.in <<'EOF'
-AC_PROG_CC
-AM_CONDITIONAL(C1, [test -z "$two"])
-AM_CONDITIONAL(C2, [test -n "$two"])
+AM_CONDITIONAL([C1], [test -z "$two"])
+AM_CONDITIONAL([C2], [test -n "$two"])
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+EXEEXT = .foo
+
 if C1
 bin_PROGRAMS = a
 endif
@@ -34,23 +36,24 @@ if C2
 bin_PROGRAMS = b $(undefined)
 endif
 
-print:
-       @echo 'BEG: $(bin_PROGRAMS) :END'
+.PHONY: test-a test-b
+test-a:
+       test a.foo = $(bin_PROGRAMS)
+test-b:
+       test b.foo = $(bin_PROGRAMS)
 EOF
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
+$FGREP 'a_SOURCES = a.c' Makefile.in
+$FGREP 'b_SOURCES = b.c' Makefile.in
+
 ./configure
-EXEEXT=.foo $MAKE -e print > stdout
-cat stdout
-grep 'BEG: a.foo :END' stdout
+$MAKE test-a
 
 ./configure two=yes
-EXEEXT=.foo $MAKE -e print > stdout
-cat stdout
-grep 'BEG: b.foo :END' stdout
+$MAKE test-b
 
-grep 'a_SOURCES = a.c' Makefile.in
-grep 'b_SOURCES = b.c' Makefile.in
+:
index 70feffc1ed7be36d252d1ba630adef561c2bd095..5110ab187dee27bc55410b47edbd11d078a3b072 100755 (executable)
@@ -20,13 +20,14 @@ required=cc
 . ./defs || Exit 1
 
 cat >>configure.in <<'EOF'
-AC_PROG_CC
-AM_CONDITIONAL(C1, [test -z "$two"])
-AM_CONDITIONAL(C2, [test -n "$two"])
+AC_SUBST([CC], [false])
+AC_SUBST([OBJEXT], [o])
+AM_CONDITIONAL([C1], [test -z "$two"])
+AM_CONDITIONAL([C2], [test -n "$two"])
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
 bin_PROGRAMS = a
 a_LDADD = c0.o -L/some/where
 if C1
@@ -35,20 +36,22 @@ endif
 if C2
 a_LDADD += c2.o -dlopen c3.la
 endif
-print:
-       @echo BEG: $(a_DEPENDENCIES) :END
+
+.PHONY: test1 test2
+test1:
+       test "`echo $(a_DEPENDENCIES)`" = "c0.o c1.o"
+test2:
+       test "`echo $(a_DEPENDENCIES)`" = "c0.o c2.o c3.la"
 EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --ignore-deps
 
 ./configure
-$MAKE -e print > stdout
-cat stdout
-grep 'BEG: c0.o c1.o :END' stdout
+$MAKE test1
 
 ./configure two=yes
-$MAKE -e print > stdout
-cat stdout
-grep 'BEG: c0.o c2.o c3.la :END' stdout
+$MAKE test2
+
+:
index 57113dd442c21ac07fe323e3a3ae1bf5b9c33bed..30fde115162ae9ded573d872a9720da5955ca22c 100755 (executable)
 
 # Make sure the user can override a conditional _DEPENDENCIES.
 
-required=cc
 . ./defs || Exit 1
 
 cat >>configure.in <<'EOF'
-AC_PROG_CC
-AM_CONDITIONAL(C1, [test -z "$two"])
-AM_CONDITIONAL(C2, [test -n "$two"])
-AM_CONDITIONAL(C3, [test -z "$three"])
-AC_SUBST([MYSUB], [foo.o])
+AM_CONDITIONAL([C1], [test -z "$two"])
+AM_CONDITIONAL([C2], [test -n "$two"])
+AM_CONDITIONAL([C3], [test -z "$three"])
+# We define CC in Makefile.am, but OBJEXT here.
+OBJEXT=o; AC_SUBST([OBJEXT])
+AC_SUBST([MYSUB], ["foo.$OBJEXT"])
 AC_OUTPUT
 EOF
 
 cat >>Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = no-dependencies
+CC = :
+
 bin_PROGRAMS = a
+
 if C1
 a_LDADD = $(MYSUB)
 a_DEPENDENCIES = $(MYSUB) nonsense.a
 # Note that `nonsense.a' is there just to make sure Automake insn't
 # using some self computed a_DEPENDENCIES variable.
 endif
+
 if C2
 if C3
 BAR = bar.o
@@ -44,8 +49,11 @@ BAR = baz.o
 endif
 a_LDADD = $(BAR)
 endif
-print:
-       @echo BEG: $(a_DEPENDENCIES) :END
+
+got = `echo $(a_DEPENDENCIES)`
+test:
+       test "$(exp)" = "$(got)"
+.PHONY: test
 EOF
 
 $ACLOCAL
@@ -53,16 +61,12 @@ $AUTOCONF
 $AUTOMAKE
 
 ./configure
-$MAKE -e print > stdout
-cat stdout
-grep 'BEG: foo.o nonsense.a :END' stdout
+$MAKE test exp='foo.o nonsense.a'
 
 ./configure two=yes three=
-$MAKE -e print > stdout
-cat stdout
-grep 'BEG: bar.o :END' stdout
+$MAKE test exp='bar.o'
 
 ./configure two=yes three=yes
-$MAKE -e print > stdout
-cat stdout
-grep 'BEG: baz.o :END' stdout
+$MAKE test exp='baz.o'
+
+:
index 6f822aa61391ca817d24736330e8728a7dad652d..126a4c1982acb5c29bdb835dc5c72e5ece9e8f0c 100755 (executable)
@@ -14,7 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check for conditional library with a conditional directory.
+# Check that $(mkdir_p) handles well conditionally-defined install
+# directories.
 # Report from Ralf Corsepius
 
 . ./defs || Exit 1
@@ -24,7 +25,7 @@ AM_CONDITIONAL([INC], [test -z "$two"])
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
 if INC
 include_foodir = $(includedir)/foo
 include_foo_HEADERS = foo.h
@@ -35,6 +36,8 @@ endif
 
 foo.h x.sh:
        :>$@
+
+.PHONY: distdircheck
 distdircheck: distdir
        test -f $(distdir)/foo.h
        test -f $(distdir)/x.sh
@@ -44,9 +47,12 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
+cwd=`pwd` || Exit 99
 mkdir nowhere
 chmod a-w nowhere
-./configure "--prefix=`pwd`/nowhere" "--bindir=`pwd`/bin" "--includedir=`pwd`/inc"
+
+./configure --prefix="$cwd"/nowhere --bindir="$cwd"/bin \
+            --includedir="$cwd"/inc
 $MAKE installdirs
 test ! -d bin
 test -d inc/foo
@@ -55,13 +61,19 @@ rm -rf inc
 $MAKE install
 test ! -d bin
 test -f inc/foo/foo.h
+$MAKE distdircheck
+
 rm -rf inc
-./configure two=two \
-            "--prefix=`pwd`/nowhere" "--bindir=`pwd`/bin" "--includedir=`pwd`/inc"
+
+./configure two=two --prefix="$cwd"/nowhere --bindir="$cwd"/bin \
+                    --includedir="$cwd"/inc
 $MAKE install
 test ! -d inc
 test -f bin/x.sh
+rm -rf inc
 $MAKE installdirs
 test ! -d inc
 test -d bin
 $MAKE distdircheck
+
+:
index 13b7a2751633dddba82d88e820ef7bef06280b33..1e030e834700074572694f94aabccb27721602a3 100755 (executable)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check for _DEPDENDENCIES definition with conditional _LDADD.
+# Check for _DEPENDENCIES definition with conditional _LDADD.
 # Report from Elena A. Vengerova
 
-required=cc
 . ./defs || Exit 1
 
 cat >>configure.in <<'EOF'
-AM_CONDITIONAL([TWO], test -n "$two")
-AC_PROG_CC
+AM_CONDITIONAL([TWO], [test -n "$two"])
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
 OBJEXT=z
+CC=false
+AUTOMAKE_OPTIONS=no-dependencies
 
 bin_PROGRAMS = test1 test2
 
@@ -42,26 +42,34 @@ endif !TWO
 
 test1_DEPENDENCIES = $(test1_LDADD) somethingelse.a
 
+.PHONY: dep-test1 dep-test2
 dep-test1:
        echo BEG: $(test1_DEPENDENCIES) :END
 dep-test2:
        echo BEG: $(test2_DEPENDENCIES) :END
-
 EOF
 
-:> test.c
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 ./configure
-$MAKE dep-test1 >out
-grep 'BEG: one.z somethingelse.a :END' out
-$MAKE dep-test2 >out
-grep 'BEG: three.z :END' out
+
+$MAKE dep-test1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP 'BEG: one.z somethingelse.a :END' stdout
+
+$MAKE dep-test2 >stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP 'BEG: three.z :END' stdout
 
 ./configure two=2
-$MAKE dep-test1 >out
-grep 'BEG: two.z somethingelse.a :END' out
-$MAKE dep-test2 >out
-grep 'BEG: two.z somethingelse.a :END' out
+
+$MAKE dep-test1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP 'BEG: two.z somethingelse.a :END' stdout
+
+$MAKE dep-test2 >stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP 'BEG: two.z somethingelse.a :END' stdout
+
+:
index 348b9c7c26b98851b9cf0601189c8ef55ea7fc87..143c082bd465654cb8b04d7a132289620e075980 100755 (executable)
@@ -28,7 +28,7 @@ AC_PROG_YACC
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
 AM_YFLAGS               =       -d
 
 BUILT_SOURCES           =       tparse.h
@@ -54,7 +54,8 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-test `grep tparse.h: Makefile.in | wc -l` = 1
+$FGREP 'tparse.h' Makefile.in # For debugging.
+test `$FGREP -c 'tparse.h:' Makefile.in` = 1
 
 cat > tscan.l << 'END'
 %%
index 06d5a604ef11d0900a2fbd875b6aa02871de5f56..b4a9a31725368a7aae54cd909668c41f0df7484d 100755 (executable)
 . ./defs || Exit 1
 
 cat >>configure.in <<'EOF'
-AM_CONDITIONAL([CASE_A], test -z "$case_B")
+AM_CONDITIONAL([CASE_A], [test -z "$case_B"])
 AC_PROG_CC
 AM_PROG_LEX
 AC_PROG_YACC
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
 AM_YFLAGS               =       -d
 
 BUILT_SOURCES           =       tparse.h
@@ -49,12 +49,13 @@ $ACLOCAL
 # Presently Automake doesn't fully support partially overriden rules
 # and should complain.
 AUTOMAKE_fails --add-missing
-grep 'tparse.h.*already defined' stderr
+grep 'tparse\.h.*already defined' stderr
 $AUTOMAKE -Wno-error
 
 # Still and all, it should generate two rules.
-test `grep tparse.h: Makefile.in | wc -l` = 2
-grep '@CASE_A_TRUE@tparse.h:' Makefile.in
-grep '@CASE_A_FALSE@tparse.h:' Makefile.in
+$FGREP 'tparse.h' Makefile.in # For debugging.
+test `$FGREP -c 'tparse.h:' Makefile.in` = 2
+$FGREP '@CASE_A_TRUE@tparse.h:' Makefile.in
+$FGREP '@CASE_A_FALSE@tparse.h:' Makefile.in
 
 :
index 59923e8f8856e749b4f8d8b8e816d39e1f20d9e6..e639231a99fcb5ed64de874aefba86a1dd94bd3f 100755 (executable)
 . ./defs || Exit 1
 
 cat >>configure.in <<'EOF'
-AM_CONDITIONAL([CASE_A], test -n "$case_A")
+AM_CONDITIONAL([CASE_A], [test -n "$case_A"])
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
 if CASE_A
 check-local:
        @echo GrepMe1
@@ -39,18 +39,18 @@ $AUTOCONF
 $AUTOMAKE
 
 ./configure
-$MAKE check >stdout
+$MAKE check >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep GrepMe1 stdout && Exit 1
-$MAKE install >stdout
+$MAKE install >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep GrepMe2 stdout
 
 ./configure case_A=1
-$MAKE check >stdout
+$MAKE check >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep GrepMe1 stdout
-$MAKE install >stdout
+$MAKE install >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep GrepMe2 stdout && Exit 1
 
index 222007d5a1fd92ee7671d0075737a79462808f14..8638daee5fa18e80b976df2c44c2c66e4ab1f756 100755 (executable)
@@ -25,7 +25,7 @@ AM_CONDITIONAL([CASE_B], :)
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
 SUBDIRS = a
 if CASE_A
 SUBDIRS += b
@@ -46,8 +46,10 @@ if CASE_B
 SUBDIRS += iXYZ
 SUBDIRS += jZYX
 endif
-print:
-       @echo BEG: $(SUBDIRS) :END
+
+.PHONY: test
+test:
+       test "`echo $(SUBDIRS)`" = 'a b c d e f g h iXYZ jZYX'
 EOF
 
 mkdir a b c d e f g h iXYZ jZYX
@@ -57,9 +59,9 @@ $AUTOCONF
 $AUTOMAKE
 
 ./configure
-$MAKE print >stdout
-cat stdout
-# Check good ordering
-grep 'BEG: a b c d e f g h iXYZ jZYX :END' stdout
 # Make sure no extra variable was created for the last 3 items.
 grep 'append.*=.* h iXYZ jZYX' Makefile
+# Check good ordering.
+$MAKE test
+
+:
index 8a7fcd324247854ac6aff92b99866f313cb05dd4..7d2aaea3ed2f79984f65d7affab35c7168b7533a 100755 (executable)
 
 # Another sources-in-conditional test.  Report from Tim Goodwin.
 
-required='cc GNUmake'
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
+AC_SUBST([CC], [false])
+AC_SUBST([OBJEXT], [o])
 AM_CONDITIONAL([ONE], [test "x$CONDITION1" = "xtrue"])
 AM_CONDITIONAL([TWO], [test "x$CONDITION2" = "xtrue"])
 AC_OUTPUT
@@ -40,35 +40,29 @@ endif
 
 targ_SOURCES = main.c $(OPT1) $(OPT2)
 
-echo-objects:
-       @echo $(targ_OBJECTS)
+got = `echo $(targ_OBJECTS)`
+
+.PHONY: test
+test:
+       test x"$(exp)" = x"$(got)"
 END
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -i
 
 # We should not output useless definitions.
-test "`grep '^@TWO_FALSE@' Makefile.in | wc -l`" -eq 0
+grep '^@ONE_FALSE@' Makefile.in && Exit 1
+grep '^@TWO_FALSE@' Makefile.in && Exit 1
 
 $AUTOCONF
 
 CONDITION1=true CONDITION2=true ./configure
-msgtt=`$MAKE --no-print-directory echo-objects`
+$MAKE test exp='main.o one.o two.o'
 CONDITION1=true CONDITION2=false ./configure
-msgtf=`$MAKE --no-print-directory echo-objects`
+$MAKE test exp='main.o one.o'
 CONDITION1=false CONDITION2=true ./configure
-msgft=`$MAKE --no-print-directory echo-objects`
+$MAKE test exp='main.o two.o'
 CONDITION1=false CONDITION2=false ./configure
-msgff=`$MAKE --no-print-directory echo-objects`
-
-: msgtt = $msgtt
-: msgtf = $msgtf
-: msgft = $msgft
-: msgff = $msgff
-
-test x"$msgtt" = x"main.o one.o two.o"
-test x"$msgtf" = x"main.o one.o"
-test x"$msgft" = x"main.o two.o"
-test x"$msgff" = x"main.o"
+$MAKE test exp='main.o'
 
 :
index 267d1eb31e016cadcabb012e29e96abf5c4027f2..e0ffbd2bf6ccf56985663ab72bae17db42e631ca 100755 (executable)
@@ -21,6 +21,7 @@
 # Test AM_COND_IF.
 
 . ./defs || Exit 1
+
 cat >>configure.in <<'END'
 AC_DEFUN([FOO],
         [AC_CONFIG_FILES([$1])])
@@ -82,4 +83,5 @@ $MAKE file3 && Exit 1
 test ! -f file1
 test -f file2
 test ! -f file3
+
 :
index b68573fca0388f3e59e1765f5c58d3999600cf78..c3778c1a19dc1067d249e35e4581677f8b599fd7 100755 (executable)
 # AM_COND_IF with an undefined condition should fail.
 
 . ./defs || Exit 1
+
 cat >>configure.in <<'END'
-AM_COND_IF([COND],
+AM_COND_IF([BAD_COND],
           [AC_CONFIG_FILES([file1])])
 AC_OUTPUT
 END
 
-$ACLOCAL && Exit 1
+$ACLOCAL 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep '^configure\.in:4:.*AM_COND_IF.* no such condition.*BAD_COND' stderr
+
 :
index 265ab2905caabd549c41087221522b394f0f18c2..9ae88cc1267d6b577167de66944dc07735a92305 100755 (executable)
 # but better to be safe.
 
 . ./defs || Exit 1
+
 cat >>configure.in <<'END'
 AM_CONDITIONAL([COND], [:])
-# next line needed so that cond-if.m4 is pulled in.
+# The next line is needed so that cond-if.m4 is pulled in.
 AM_COND_IF([COND])
 _AM_COND_IF([COND])
 AC_OUTPUT
 END
+
+edit_configure_in ()
+{
+  sed "$@" < configure.in >configure.int
+  mv -f configure.int configure.in
+  rm -rf autom4te*.cache
+}
+
 : >Makefile.am
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'condition stack' stderr
+grep '^configure\.in:8:.* condition stack' stderr
 
-sed 's/_AM_COND_IF/_AM_COND_ELSE/' < configure.in >configure.int
-mv -f configure.int configure.in
-rm -rf autom4te*.cache
+edit_configure_in 's/_AM_COND_IF/_AM_COND_ELSE/'
 AUTOMAKE_fails
-grep 'else without if' stderr
+grep '^configure\.in:7:.* else without if' stderr
 
-sed 's/_AM_COND_ELSE/_AM_COND_ENDIF/' < configure.in >configure.int
-mv -f configure.int configure.in
-rm -rf autom4te*.cache
+edit_configure_in 's/_AM_COND_ELSE/_AM_COND_ENDIF/'
 AUTOMAKE_fails
-grep 'endif without if' stderr
+grep '^configure\.in:7:.* endif without if' stderr
 
-sed 's/\(_AM_COND_ENDIF\).*/_AM_COND_IF\
-_AM_COND_ENDIF/' < configure.in >configure.int
-mv -f configure.int configure.in
-rm -rf autom4te*.cache
+edit_configure_in 's/\(_AM_COND_ENDIF\).*/_AM_COND_IF\
+_AM_COND_ENDIF/'
 AUTOMAKE_fails
+grep '^configure\.in:7:.* not enough arguments.* _AM_COND_IF' stderr
+grep '^configure\.in:8:.* not enough arguments.* _AM_COND_ENDIF' stderr
 test 2 = `grep -c 'not enough arguments' stderr`
+
 :
index befa165f9b7b8862c7326e0d2233e528d3b161ac..d112bd77d15208c1bce9c0f4b2f9a4435c36bad8 100755 (executable)
@@ -21,6 +21,7 @@
 # Ensure an error with underquoted usage of AM_COND_IF in configure.ac.
 
 . ./defs || Exit 1
+
 cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [:])
 AM_CONDITIONAL([COND2], [:])
@@ -29,10 +30,12 @@ AM_COND_IF([COND1],
 )
 AC_OUTPUT
 END
+
 : >Makefile.am
 
 $ACLOCAL
 AUTOMAKE_fails
+$EGREP '^configure\.in:7:.* missing m4 quoting.*macro depth 2( |$)' stderr
 
 sed '/.AM_COND_IF/{
        s/^/[/
@@ -41,3 +44,5 @@ sed '/.AM_COND_IF/{
 mv -f configure.int configure.in
 rm -rf autom4te*.cache
 $AUTOMAKE
+
+:
index ffeebd23eea99ef4b553b1855a6a4b1fd5d1128b..5b15979fae450c01aa144485dd7d9e70dd7ed26e 100755 (executable)
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AM_CONDITIONAL([USE_A],[test x = y])
-AM_CONDITIONAL([USE_B],[test x = z])
+AM_CONDITIONAL([USE_A], [test x = y])
+AM_CONDITIONAL([USE_B], [test x = z])
 AC_OUTPUT
 END
 
+notcompat="incompatible with current conditional"
+
 $ACLOCAL
 
 cat > Makefile.am << 'END'
@@ -32,7 +34,7 @@ endif !USE_A
 END
 
 AUTOMAKE_fails
-grep 'endif.*incompatible with current conditional' stderr
+grep "^Makefile\\.am:2:.*endif.*!USE_A.*$notcompat.*[^!]USE_A" stderr
 
 cat > Makefile.am << 'END'
 if USE_A
@@ -40,7 +42,7 @@ endif USE_B
 END
 
 AUTOMAKE_fails
-grep 'endif.*incompatible with current conditional' stderr
+grep "^Makefile\\.am:2:.*endif.*[^!]USE_B.*$notcompat.*[^!]USE_A" stderr
 
 cat > Makefile.am << 'END'
 if USE_A
@@ -49,7 +51,7 @@ endif USE_A
 END
 
 AUTOMAKE_fails
-grep 'endif.*incompatible with current conditional' stderr
+grep "^Makefile\\.am:3:.*endif.*[^!]USE_A.*$notcompat.*USE_A" stderr
 
 cat > Makefile.am << 'END'
 if USE_A
@@ -68,7 +70,7 @@ endif
 END
 
 AUTOMAKE_fails
-grep 'endif.*incompatible with current conditional' stderr
+grep "^Makefile\\.am:4:.*endif.*!USE_A.*$notcompat.*USE_B" stderr
 
 cat > Makefile.am << 'END'
 if USE_A
@@ -77,32 +79,34 @@ endif
 END
 
 AUTOMAKE_fails
-grep 'else.*incompatible with current conditional' stderr
+grep "^Makefile\\.am:2:.*else.*[^!]USE_A.*$notcompat.*[^!]USE_A" stderr
 
 cat > Makefile.am << 'END'
 if USE_A
-else USE_B
+else !USE_A
 endif
 END
 
-AUTOMAKE_fails
-grep 'else.*incompatible with current conditional' stderr
+$AUTOMAKE
 
 cat > Makefile.am << 'END'
 if USE_A
-if USE_B
-else USE_A
-endif
+else USE_B
 endif
 END
 
 AUTOMAKE_fails
-grep 'else.*incompatible with current conditional' stderr
+grep "^Makefile\\.am:2:.*else.*[^!]USE_B.*$notcompat.*[^!]USE_A" stderr
 
 cat > Makefile.am << 'END'
 if USE_A
-else !USE_A
+if USE_B
+else USE_A
+endif
 endif
 END
 
-$AUTOMAKE
+AUTOMAKE_fails
+grep "^Makefile\\.am:3:.*else.*[^!]USE_A.*$notcompat.*[^!]USE_B" stderr
+
+:
index 4a576b46f5e5a84b8073173f2d0a35abfd82ae1d..60436ab68ba601def3aaafd082f11fc1fbbeed7d 100755 (executable)
 
 . ./defs || Exit 1
 
-echo 'AM_CONDITIONAL(FOO, true)' >> configure.in
+echo 'AM_CONDITIONAL([FOO], [true])' >> configure.in
 
 cat > Makefile.am << 'END'
-
 if FOO
 
 helpdir = $(prefix)/Help
@@ -36,7 +35,37 @@ helpdir = $(prefix)/help
 help_DATA = foo
 
 endif
+
+a b c d e f g h:
+       touch $@
+
+.PHONY: print-data
+print-data:
+       echo BEG: $(help_DATA) :END
 END
 
+
+# Older versions of this test checked that automake could process the above
+# Makefile.am even with no AC_OUTPUT in configure.  So continue to do this
+# check, for completeness.
 $ACLOCAL
 $AUTOMAKE
+
+rm -rf autom4te*.cache
+
+echo AC_OUTPUT >> configure.in
+$AUTOCONF
+$AUTOMAKE Makefile
+
+./configure --prefix="`pwd`/_inst"
+
+$MAKE print-data >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^BEG: a b c d e f g h :END$' stdout
+
+$MAKE install
+for x in a b c d e f g h; do 
+  test -f _inst/Help/$x
+done
+
+:
index 3a81a287a566ca51db524d71eb0b24bd62439749..3fe7b5c9e913ea8f89310b636bfcdb4c025f6426 100755 (executable)
@@ -22,7 +22,8 @@
 
 cat >> configure.in << 'END'
 AC_PROG_CC
-AM_CONDITIONAL(X, false)
+AM_CONDITIONAL([X], [test "$x" = yes])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -31,7 +32,47 @@ bin_PROGRAMS = x y
 else
 noinst_PROGRAMS = x y
 endif
+
+.PHONY: get-built get-install not-install
+get-built:
+       test -f x.$(OBJEXT)
+       test -f y.$(OBJEXT)
+       test -f x$(EXEEXT)
+       test -f y$(EXEEXT)
+get-installed:
+       test -f $(bindir)/x$(EXEEXT)
+       test -f $(bindir)/y$(EXEEXT)
+not-installed:
+       if find $(prefix) -type f | grep .; then exit 1; else :; fi
 END
 
 $ACLOCAL
 $AUTOMAKE
+$AUTOCONF
+
+cat > x.c <<'END'
+int main (void)
+{
+  return 0;
+}
+END
+
+cp x.c y.c
+
+instdir=`pwd`/_inst || Exit 99
+
+# Skip the rest of the test in case of e.g. missing C compiler.
+./configure --prefix="$instdir" x=yes || Exit $?
+$MAKE install
+$MAKE get-built
+$MAKE get-installed
+
+$MAKE distclean
+rm -rf _inst
+
+./configure --prefix="$instdir" x=no
+$MAKE install
+$MAKE get-built
+$MAKE not-installed
+
+:
index 22792aeb5e67266211b63c00040f8763a3a36069..c0398719b7f363d4df847c5169a70a7970e6d1fe 100755 (executable)
@@ -20,7 +20,7 @@
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AM_CONDITIONAL(WRONG, [test x = y])
+AM_CONDITIONAL([WRONG], [test x = y])
 AC_OUTPUT
 END
 
@@ -31,12 +31,15 @@ else
 this=is_something_interesting
 endif
 
-echo-something:
-       echo '$(this)'
+.PHONY: test-this
+test-this:
+       test '$(this)' = is_something_interesting
 END
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 ./configure
-$MAKE echo-something | grep interesting > /dev/null
+$MAKE test-this
+
+:
index 71d10eae50f9d2f27e823501f4c7b24d1a7ede8a..b0cf6f0270ea806ccd491c15263ec27db1dffb65 100755 (executable)
 
 # Test for bug in conditionals.
 
-required=cc
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
 dnl Define a macro with the same name as the conditional to exhibit
 dnl any underquoted bug.
 AC_DEFUN([COND1], ["some'meaningless;characters`])
-AM_CONDITIONAL([COND1], false)
+AM_CONDITIONAL([COND1], [false])
 AC_CONFIG_FILES([foo/Makefile])
 AC_CONFIG_FILES([bar/Makefile])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+
 SUBDIRS = foo
 if COND1
 SUBDIRS += bar
@@ -46,6 +47,7 @@ else
 hello_SOURCES += hello-generic.c
 endif
 
+.PHONY: test
 test: distdir
        test -f $(distdir)/foo/Makefile.am
        test -f $(distdir)/bar/Makefile.am
diff --git a/tests/condman.test b/tests/condman.test
deleted file mode 100755 (executable)
index 8584014..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010, 2011 Free Software Foundation,
-# Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Make sure conditionals work with man pages.
-
-. ./defs || Exit 1
-
-cat >> configure.in << 'END'
-AM_CONDITIONAL([FRED], [true])
-END
-
-cat > Makefile.am << 'END'
-if FRED
-man_MANS = foo.1
-else
-man_MANS = joe.1
-endif
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-:
index 2482d8d552144ebde611fbed9ab321913b22b183..cfba3f802ed5d9a79bb416ee52ec539488c6324c 100755 (executable)
@@ -26,37 +26,48 @@ END
 cat > Makefile.am << 'END'
 if COND
 man_MANS = foo.1
+man4_MANS = 6.man
 else
-man_MANS = bar.2
+man_MANS = bar.2 baz.1
+man5_MANS = zap.5
 endif
 
 .PHONY: test1 test2
 test1:
+       find $(mandir) ;: For debugging.
        test -f $(mandir)/man1/foo.1
+       test -f $(mandir)/man4/6.4
        test ! -f $(mandir)/man2/bar.2
+       test ! -f $(mandir)/man1/baz.1
+       test ! -f $(mandir)/man5/zap.5
 test2:
-       test ! -f $(mandir)/man1/foo.1
+       find $(mandir) ;: For debugging.
        test -f $(mandir)/man2/bar.2
+       test -f $(mandir)/man1/baz.1
+       test -f $(mandir)/man5/zap.5
+       test ! -f $(mandir)/man1/foo.1
+       test ! -f $(mandir)/man4/6.4
+       test ! -f $(mandir)/man4/6.man
 END
 
 $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
-mkdir dir1
-cd dir1
+$EGREP 'MANS|\.([123456789]|man)' Makefile.in # For debugging.
+
+mkdir build
+cd build
 ../configure FOO=true --prefix="`pwd`/_inst"
-sed -n '/man_MANS/p' Makefile # useful for debugging
-: > foo.1
+$EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging.
+touch foo.1 6.man
 $MAKE install
 $MAKE test1
 
 cd ..
-mkdir dir2
-cd dir2
-../configure FOO=false --prefix="`pwd`/_inst"
-sed -n '/man_MANS/p' Makefile # useful for debugging
-: > bar.2
+./configure FOO=false --prefix="`pwd`/_inst"
+$EGREP 'MANS|\.([123456789]|man)' Makefile # For debugging.
+touch bar.2 baz.1 zap.5
 $MAKE install
 $MAKE test2