diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2011-05-26 15:42:02 +0200 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2011-05-26 22:32:40 +0200 |
commit | fc5ac9a1e1573fa286da745491daaf373271578f (patch) | |
tree | 41519a29b186b5efb008e8a8f04b32b89048a934 /tests | |
parent | eb147a19783b1cee960502697124e68e4c109df5 (diff) | |
download | automake-fc5ac9a1e1573fa286da745491daaf373271578f.tar.gz |
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.
Diffstat (limited to 'tests')
44 files changed, 417 insertions, 304 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index 976883341..bcb65d8db 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -342,7 +342,6 @@ condhook2.test \ condinc.test \ condinc2.test \ condlib.test \ -condman.test \ condman2.test \ condman3.test \ configure.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 55fb244fd..107b35906 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -607,7 +607,6 @@ condhook2.test \ condinc.test \ condinc2.test \ condlib.test \ -condman.test \ condman2.test \ condman3.test \ configure.test \ diff --git a/tests/cond.test b/tests/cond.test index f4567f114..6bc1e7002 100755 --- a/tests/cond.test +++ b/tests/cond.test @@ -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 + +: diff --git a/tests/cond10.test b/tests/cond10.test index 49a3d6b7c..ac2ffe34b 100755 --- a/tests/cond10.test +++ b/tests/cond10.test @@ -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 + +: diff --git a/tests/cond11.test b/tests/cond11.test index 9e7f6da53..89ab4825e 100755 --- a/tests/cond11.test +++ b/tests/cond11.test @@ -18,18 +18,16 @@ # 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 + +: diff --git a/tests/cond13.test b/tests/cond13.test index 193b02d40..190f1e689 100755 --- a/tests/cond13.test +++ b/tests/cond13.test @@ -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 + +: diff --git a/tests/cond14.test b/tests/cond14.test index f5a5e2474..6e552c1d2 100755 --- a/tests/cond14.test +++ b/tests/cond14.test @@ -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 : diff --git a/tests/cond15.test b/tests/cond15.test index fbd5e04e2..d5fb0a0e8 100755 --- a/tests/cond15.test +++ b/tests/cond15.test @@ -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 diff --git a/tests/cond16.test b/tests/cond16.test index d27472c33..89182c409 100755 --- a/tests/cond16.test +++ b/tests/cond16.test @@ -18,11 +18,9 @@ # 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 : diff --git a/tests/cond17.test b/tests/cond17.test index 90a38e6ce..c934ee8d5 100755 --- a/tests/cond17.test +++ b/tests/cond17.test @@ -20,13 +20,11 @@ . ./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 + +: diff --git a/tests/cond18.test b/tests/cond18.test index 57c5516d7..9c404a4bd 100755 --- a/tests/cond18.test +++ b/tests/cond18.test @@ -17,17 +17,18 @@ # 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 : diff --git a/tests/cond19.test b/tests/cond19.test index c5ac15a32..50ae9cbb9 100755 --- a/tests/cond19.test +++ b/tests/cond19.test @@ -17,17 +17,18 @@ # 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' : diff --git a/tests/cond2.test b/tests/cond2.test index b47e3245b..0f0235bb6 100755 --- a/tests/cond2.test +++ b/tests/cond2.test @@ -19,11 +19,8 @@ . ./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 + +: diff --git a/tests/cond20.test b/tests/cond20.test index f0e1dd8ea..cd2ec0bf0 100755 --- a/tests/cond20.test +++ b/tests/cond20.test @@ -19,16 +19,12 @@ . ./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 + +: diff --git a/tests/cond22.test b/tests/cond22.test index 4d88f9d2d..72120eb4c 100755 --- a/tests/cond22.test +++ b/tests/cond22.test @@ -17,14 +17,14 @@ # 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 + +: diff --git a/tests/cond23.test b/tests/cond23.test index 7cb8292e2..db209b23d 100755 --- a/tests/cond23.test +++ b/tests/cond23.test @@ -32,4 +32,6 @@ EOF $ACLOCAL AUTOMAKE_fails -grep 'libdir was already defined' stderr +grep '^Makefile\.am:2:.* libdir was already defined' stderr + +: diff --git a/tests/cond24.test b/tests/cond24.test index 7bfa89f58..11f8d8701 100755 --- a/tests/cond24.test +++ b/tests/cond24.test @@ -22,15 +22,18 @@ 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 + +: diff --git a/tests/cond25.test b/tests/cond25.test index 9d1686d04..fe03745bc 100755 --- a/tests/cond25.test +++ b/tests/cond25.test @@ -35,3 +35,5 @@ EOF $ACLOCAL $AUTOMAKE + +: diff --git a/tests/cond26.test b/tests/cond26.test index 7252dbd0b..3c29b59d9 100755 --- a/tests/cond26.test +++ b/tests/cond26.test @@ -34,3 +34,5 @@ EOF $ACLOCAL $AUTOMAKE + +: diff --git a/tests/cond27.test b/tests/cond27.test index 141723c47..74f2e485f 100755 --- a/tests/cond27.test +++ b/tests/cond27.test @@ -34,3 +34,5 @@ $ACLOCAL AUTOMAKE_fails grep ' USE_FOO' stderr && Exit 1 grep '!USE_FOO' stderr + +: diff --git a/tests/cond28.test b/tests/cond28.test index e5f254e1c..0c6cd29d3 100755 --- a/tests/cond28.test +++ b/tests/cond28.test @@ -34,3 +34,5 @@ EOF $ACLOCAL $AUTOMAKE + +: diff --git a/tests/cond29.test b/tests/cond29.test index f2488504c..222743c98 100755 --- a/tests/cond29.test +++ b/tests/cond29.test @@ -21,11 +21,12 @@ # 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 + +: diff --git a/tests/cond3.test b/tests/cond3.test index 2a75d432c..7e9b3aeb9 100755 --- a/tests/cond3.test +++ b/tests/cond3.test @@ -20,14 +20,12 @@ . ./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 + +: diff --git a/tests/cond30.test b/tests/cond30.test index e1c134194..fb44bf63a 100755 --- a/tests/cond30.test +++ b/tests/cond30.test @@ -16,17 +16,19 @@ # 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 +: diff --git a/tests/cond31.test b/tests/cond31.test index 70feffc1e..5110ab187 100755 --- a/tests/cond31.test +++ b/tests/cond31.test @@ -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 + +: diff --git a/tests/cond32.test b/tests/cond32.test index 57113dd44..30fde1151 100755 --- a/tests/cond32.test +++ b/tests/cond32.test @@ -16,26 +16,31 @@ # 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' + +: diff --git a/tests/cond33.test b/tests/cond33.test index 6f822aa61..126a4c198 100755 --- a/tests/cond33.test +++ b/tests/cond33.test @@ -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 + +: diff --git a/tests/cond34.test b/tests/cond34.test index 13b7a2751..1e030e834 100755 --- a/tests/cond34.test +++ b/tests/cond34.test @@ -14,20 +14,20 @@ # 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 + +: diff --git a/tests/cond35.test b/tests/cond35.test index 348b9c7c2..143c082bd 100755 --- a/tests/cond35.test +++ b/tests/cond35.test @@ -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' %% diff --git a/tests/cond36.test b/tests/cond36.test index 06d5a604e..b4a9a3172 100755 --- a/tests/cond36.test +++ b/tests/cond36.test @@ -19,14 +19,14 @@ . ./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 : diff --git a/tests/cond37.test b/tests/cond37.test index 59923e8f8..e639231a9 100755 --- a/tests/cond37.test +++ b/tests/cond37.test @@ -20,11 +20,11 @@ . ./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 diff --git a/tests/cond38.test b/tests/cond38.test index 222007d5a..8638daee5 100755 --- a/tests/cond38.test +++ b/tests/cond38.test @@ -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 + +: diff --git a/tests/cond4.test b/tests/cond4.test index 8a7fcd324..7d2aaea3e 100755 --- a/tests/cond4.test +++ b/tests/cond4.test @@ -17,11 +17,11 @@ # 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' : diff --git a/tests/cond40.test b/tests/cond40.test index 267d1eb31..e0ffbd2bf 100755 --- a/tests/cond40.test +++ b/tests/cond40.test @@ -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 + : diff --git a/tests/cond41.test b/tests/cond41.test index b68573fca..c3778c1a1 100755 --- a/tests/cond41.test +++ b/tests/cond41.test @@ -21,11 +21,15 @@ # 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 + : diff --git a/tests/cond42.test b/tests/cond42.test index 265ab2905..9ae88cc12 100755 --- a/tests/cond42.test +++ b/tests/cond42.test @@ -23,35 +23,41 @@ # 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` + : diff --git a/tests/cond43.test b/tests/cond43.test index befa165f9..d112bd77d 100755 --- a/tests/cond43.test +++ b/tests/cond43.test @@ -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 + +: diff --git a/tests/cond46.test b/tests/cond46.test index ffeebd23e..5b15979fa 100755 --- a/tests/cond46.test +++ b/tests/cond46.test @@ -19,11 +19,13 @@ . ./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 + +: diff --git a/tests/cond6.test b/tests/cond6.test index 4a576b46f..60436ab68 100755 --- a/tests/cond6.test +++ b/tests/cond6.test @@ -19,10 +19,9 @@ . ./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 + +: diff --git a/tests/cond8.test b/tests/cond8.test index 3a81a287a..3fe7b5c9e 100755 --- a/tests/cond8.test +++ b/tests/cond8.test @@ -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 + +: diff --git a/tests/cond9.test b/tests/cond9.test index 22792aeb5..c0398719b 100755 --- a/tests/cond9.test +++ b/tests/cond9.test @@ -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 + +: diff --git a/tests/condd.test b/tests/condd.test index 71d10eae5..b0cf6f027 100755 --- a/tests/condd.test +++ b/tests/condd.test @@ -17,21 +17,22 @@ # 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 index 85840144c..000000000 --- a/tests/condman.test +++ /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 - -: diff --git a/tests/condman3.test b/tests/condman3.test index 2482d8d55..cfba3f802 100755 --- a/tests/condman3.test +++ b/tests/condman3.test @@ -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 |