Merge branch 'maint'
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 15 Feb 2012 18:32:07 +0000 (19:32 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 15 Feb 2012 18:32:07 +0000 (19:32 +0100)
* maint:
  fixup: distribute 'lib/update-copyright'

1334 files changed:
.gitignore
ChangeLog.01
ChangeLog.02
ChangeLog.04
ChangeLog.09
ChangeLog.11
ChangeLog.96
ChangeLog.98
GNUmakefile [new file with mode: 0644]
HACKING
INSTALL
Makefile.am
NEWS
THANKS
aclocal.in
automake.in
bootstrap
configure.ac
contrib/Makefile.am
contrib/README
contrib/check-html.am [moved from lib/am/check-html.am with 91% similarity]
contrib/multilib/README [new file with mode: 0644]
contrib/multilib/config-ml.in [moved from lib/config-ml.in with 100% similarity]
contrib/multilib/multilib.am [new file with mode: 0644]
contrib/multilib/symlink-tree [moved from lib/symlink-tree with 100% similarity]
doc/Makefile.am
doc/automake-history.texi [new file with mode: 0644]
doc/automake.texi
lib/Automake/ChannelDefs.pm
lib/Automake/Channels.pm
lib/Automake/Condition.pm
lib/Automake/Configure_ac.pm
lib/Automake/Location.pm
lib/Automake/Options.pm
lib/Automake/Rule.pm
lib/Automake/RuleDef.pm
lib/Automake/VarDef.pm
lib/Automake/Variable.pm
lib/Automake/Wrap.pm
lib/Automake/XFile.pm
lib/Makefile.am
lib/am/Makefile.am
lib/am/ansi2knr.am [deleted file]
lib/am/check.am
lib/am/check2.am
lib/am/dejagnu.am
lib/am/distdir.am
lib/am/ltlib.am
lib/am/multilib.am [deleted file]
lib/am/progs.am
lib/am/tags.am
lib/am/texibuild.am
lib/am/texinfos.am
lib/am/yacc.am
lib/ansi2knr.1 [deleted file]
lib/ansi2knr.c [deleted file]
lib/ar-lib [new file with mode: 0755]
lib/compile
lib/depcomp
lib/elisp-comp
lib/install-sh
lib/mdate-sh
lib/missing
lib/mkinstalldirs
lib/tap-driver.pl [new file with mode: 0755]
lib/tap-driver.sh [new file with mode: 0755]
lib/test-driver [new file with mode: 0755]
lib/ylwrap
m4/Makefile.am
m4/acdir/.placeholder [new file with mode: 0644]
m4/acdir/dirlist [deleted file]
m4/amversion.in
m4/amversion.m4
m4/ar-lib.m4 [new file with mode: 0644]
m4/cond.m4
m4/depend.m4
m4/depout.m4
m4/dmalloc.m4
m4/gcj.m4
m4/init.m4
m4/install-sh.m4
m4/lex.m4
m4/lispdir.m4
m4/maintainer.m4
m4/multi.m4 [deleted file]
m4/options.m4
m4/protos.m4
m4/python.m4
m4/regex.m4 [deleted file]
m4/sanity.m4
m4/silent.m4
syntax-checks.mk [new file with mode: 0644]
tests/.gitignore [new file with mode: 0644]
tests/CheckListOfTests.am
tests/Makefile.am
tests/README
tests/ac-output-old.tap [new file with mode: 0755]
tests/acloca10.test
tests/acloca11.test
tests/acloca12.test
tests/acloca13.test
tests/acloca14.test
tests/acloca15.test
tests/acloca16.test
tests/acloca17.test
tests/acloca18.test
tests/acloca19.test
tests/acloca20.test
tests/acloca21.test
tests/acloca22.test
tests/acloca23.test [moved from tests/nogzip2.test with 66% similarity]
tests/aclocal-acdir.test
tests/aclocal-install-absdir.test
tests/aclocal-path-install-serial.test
tests/aclocal-path-install.test
tests/aclocal-path-nonexistent.test
tests/aclocal-path-precedence.test
tests/aclocal-path.test
tests/aclocal-print-acdir.test
tests/aclocal.test
tests/aclocal3.test
tests/aclocal4.test
tests/aclocal5.test
tests/aclocal6.test
tests/aclocal7.test
tests/aclocal8.test
tests/aclocal9.test
tests/acoutbs2.test [deleted file]
tests/acoutnoq.test [deleted file]
tests/acoutpt.test [deleted file]
tests/acsilent.test
tests/acsubst.test
tests/acsubst2.test
tests/add-missing.tap [new file with mode: 0755]
tests/all.test
tests/all2.test
tests/alloca.test
tests/alloca2.test
tests/alpha.test
tests/alpha2.test
tests/am-tests-environment.test [new file with mode: 0755]
tests/amassign.test
tests/amhello-binpkg.test
tests/amhello-cflags.test
tests/amhello-cross-compile.test
tests/ammissing.test
tests/amopt.test
tests/amopts-location.test [new file with mode: 0755]
tests/amopts-variable-expansion.test [new file with mode: 0755]
tests/amsubst.test
tests/ansi10.test [deleted file]
tests/ansi2knr-deprecation.test [deleted file]
tests/ansi2knr-no-more.test [new file with mode: 0755]
tests/ansi3.test [deleted file]
tests/ansi3b.test [deleted file]
tests/ansi5.test [deleted file]
tests/ansi6.test [deleted file]
tests/ansi7.test [deleted file]
tests/ansi9.test [deleted file]
tests/ar-lib.test [new file with mode: 0755]
tests/ar-lib2.test [new file with mode: 0755]
tests/ar-lib3.test [moved from tests/ansi4.test with 69% similarity]
tests/ar-lib4.test [moved from tests/aclibobj.test with 66% similarity]
tests/ar-lib5a.test [new file with mode: 0755]
tests/ar-lib5b.test [new file with mode: 0755]
tests/ar-lib6a.test [new file with mode: 0755]
tests/ar-lib6b.test [moved from tests/regex-obsolete.test with 66% similarity]
tests/ar-lib7.test [moved from tests/condman.test with 73% similarity]
tests/ar.test
tests/ar2.test
tests/ar3.test [moved from tests/lex4.test with 70% similarity]
tests/ar4.test [new file with mode: 0755]
tests/ar5.test [new file with mode: 0755]
tests/asm.test
tests/asm2.test
tests/asm3.test
tests/autodist-acconfig-no-subdir.test
tests/autodist-acconfig.test
tests/autodist-aclocal-m4.test
tests/autodist-config-headers.test
tests/autodist-configure-no-subdir.test
tests/autodist-no-duplicate.test
tests/autodist-stamp-vti.test
tests/autodist-subdir.test
tests/autodist.test
tests/autohdr.test
tests/autohdr2.test
tests/autohdr3.test
tests/autohdr4.test
tests/autohdrdry.test
tests/automake-cmdline.tap [new file with mode: 0755]
tests/automake.test [deleted file]
tests/auxdir-autodetect.test [new file with mode: 0755]
tests/auxdir-computed.tap [moved from tests/auxdir2.test with 66% similarity]
tests/auxdir-misplaced.test [moved from tests/auxdir3.test with 86% similarity]
tests/auxdir-nonexistent.test [moved from tests/auxdir4.test with 72% similarity]
tests/auxdir-unportable.tap [new file with mode: 0755]
tests/auxdir.test
tests/auxdir6.test [new file with mode: 0755]
tests/auxdir7.test [new file with mode: 0755]
tests/auxdir8.test [new file with mode: 0755]
tests/backcompat.test [new file with mode: 0755]
tests/backcompat2.test [new file with mode: 0755]
tests/backcompat3.test [new file with mode: 0755]
tests/backcompat4.test [new file with mode: 0755]
tests/backcompat5.test [new file with mode: 0755]
tests/backcompat6.test [new file with mode: 0755]
tests/backsl.test
tests/backsl2.test
tests/backsl3.test
tests/backsl4.test
tests/badline.test
tests/badopt.test
tests/badprog.test
tests/block.test
tests/bsource.test
tests/candist.test [new file with mode: 0755]
tests/canon-name.test
tests/canon.test
tests/canon2.test
tests/canon3.test
tests/canon4.test
tests/canon5.test
tests/canon6.test [new file with mode: 0755]
tests/canon7.test [new file with mode: 0755]
tests/canon8.test [moved from tests/ansi2.test with 70% similarity]
tests/ccnoco.test
tests/ccnoco2.test
tests/ccnoco3.test
tests/check-concurrency-bug9245.test
tests/check-exported-srcdir.test
tests/check-fd-redirect.test [new file with mode: 0755]
tests/check-no-test-driver.test [moved from tests/self-check-env-sanitize.test with 61% similarity]
tests/check-subst-prog.test [moved from tests/check9.test with 67% similarity]
tests/check-subst.test [new file with mode: 0755]
tests/check-tests-in-builddir.test
tests/check.test
tests/check10.test
tests/check11.test
tests/check12.test
tests/check2.test
tests/check3.test
tests/check4.test
tests/check5.test
tests/check6.test
tests/check7.test
tests/check8.test
tests/checkall.test
tests/clean.test
tests/clean2.test
tests/colneq.test
tests/colneq2.test
tests/colneq3.test [moved from tests/xz.test with 69% similarity]
tests/colon.test
tests/colon2.test
tests/colon3.test
tests/colon4.test
tests/colon5.test
tests/colon6.test
tests/colon7.test
tests/color.test
tests/color2.test
tests/commen10.test
tests/commen11.test
tests/comment.test
tests/comment2.test
tests/comment3.test
tests/comment4.test
tests/comment5.test
tests/comment6.test
tests/comment7.test
tests/comment8.test
tests/comment9.test
tests/comments-in-var-def.test
tests/compile.test
tests/compile2.test
tests/compile3.test [new file with mode: 0755]
tests/compile4.test [new file with mode: 0755]
tests/compile5.test [new file with mode: 0755]
tests/compile6.test [new file with mode: 0755]
tests/compile_f90_c_cxx.test
tests/compile_f_c_cxx.test
tests/cond-basic.test [moved from tests/ctarget1.test with 77% similarity]
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/cond21.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/cond39.test
tests/cond4.test
tests/cond40.test
tests/cond41.test
tests/cond42.test
tests/cond43.test
tests/cond44.test
tests/cond45.test
tests/cond46.test [new file with mode: 0755]
tests/cond5.test
tests/cond6.test
tests/cond7.test
tests/cond8.test
tests/cond9.test
tests/condd.test
tests/condhook.test
tests/condhook2.test
tests/condinc.test
tests/condinc2.test
tests/condlib.test
tests/condman2.test
tests/condman3.test
tests/confdeps.test
tests/conff.test
tests/conff2.test
tests/conffile-leading-dot.test
tests/confh.test
tests/confh4.test
tests/confh5.test
tests/confh6.test
tests/confh7.test
tests/confh8.test
tests/configure.test
tests/confincl.test
tests/conflnk.test
tests/conflnk2.test
tests/conflnk3.test
tests/conflnk4.test
tests/confsub.test
tests/confvar.test
tests/confvar2.test
tests/copy.test
tests/cscope.tap [new file with mode: 0755]
tests/cscope2.test [moved from tests/regex.test with 79% similarity]
tests/cscope3.test [moved from tests/nogzip.test with 65% similarity]
tests/cxx.test
tests/cxx2.test
tests/cxxcpp.test
tests/cxxlibobj.test
tests/cxxlink.test
tests/cxxnoc.test
tests/cxxo.test
tests/cygnus-check-without-all.test [new file with mode: 0755]
tests/cygnus-dependency-tracking.test [new file with mode: 0755]
tests/cygnus-imply-foreign.test [new file with mode: 0755]
tests/cygnus-no-dist.test [new file with mode: 0755]
tests/cygnus-no-installinfo.test [new file with mode: 0755]
tests/cygnus-requires-maintainer-mode.test [new file with mode: 0755]
tests/cygwin32.test
tests/dash.test
tests/defs [new file with mode: 0644]
tests/defs-static.in [new file with mode: 0644]
tests/defs.in [deleted file]
tests/defun.test
tests/defun2.test
tests/dejagnu-absolute-builddir.test
tests/dejagnu-relative-srcdir.test
tests/dejagnu-siteexp-append.test
tests/dejagnu-siteexp-extend.test
tests/dejagnu-siteexp-useredit.test
tests/dejagnu.test
tests/dejagnu2.test
tests/dejagnu3.test
tests/dejagnu4.test
tests/dejagnu5.test
tests/dejagnu6.test
tests/dejagnu7.test
tests/deleted-am.test
tests/deleted-m4.test
tests/depacl2.test
tests/depcomp.sh [new file with mode: 0755]
tests/depcomp.test
tests/depcomp10.test [deleted file]
tests/depcomp2.test
tests/depcomp6.test [deleted file]
tests/depcomp7.test [deleted file]
tests/depcomp8a.test
tests/depcomp8b.test
tests/depcomp9.test [deleted file]
tests/depdist.test
tests/depend.test
tests/depend3.test
tests/depend4.test
tests/depend5.test
tests/depend6.test
tests/deprecated-acinit.test [new file with mode: 0755]
tests/destdir.test
tests/dirlist-abspath.test [moved from tests/acoutpt2.test with 59% similarity]
tests/dirlist.test
tests/dirlist2.test
tests/discover.test
tests/dist-auxdir-many-subdirs.test [new file with mode: 0755]
tests/dist-auxfile-2.test
tests/dist-auxfile.test
tests/dist-formats.tap [new file with mode: 0755]
tests/dist-included-parent-dir.test
tests/dist-missing-am.test
tests/dist-missing-included-m4.test
tests/dist-missing-m4.test
tests/dist-readonly.test [new file with mode: 0755]
tests/dist-repeated.test [new file with mode: 0755]
tests/distcheck-configure-flags-am.test
tests/distcheck-configure-flags-subpkg.test
tests/distcheck-configure-flags.test
tests/distcheck-hook.test
tests/distcheck-hook2.test
tests/distcheck-missing-m4.test
tests/distcheck-outdated-m4.test
tests/distcheck-override-infodir.test
tests/distcheck-pr10470.test
tests/distcheck-pr9579.test
tests/distcleancheck.test
tests/distcom-subdir.test [moved from tests/distcom6.test with 53% similarity]
tests/distcom2.test
tests/distcom3.test
tests/distcom4.test
tests/distcom5.test
tests/distdir.test
tests/distlinks.test
tests/distlinksbrk.test
tests/distname.test
tests/dmalloc.test
tests/doc-parsing-buglets-colneq-subst.test
tests/doc-parsing-buglets-tabs.test
tests/dollar.test
tests/dollarvar.test
tests/dollarvar2.test
tests/double.test
tests/dup2.test
tests/else.test
tests/empty.test
tests/empty2.test
tests/empty3.test
tests/empty4.test
tests/exdir.test
tests/exdir2.test
tests/exdir3.test
tests/exeext.test
tests/exeext2.test
tests/exeext3.test
tests/exeext4.test
tests/exsource.test
tests/ext.test
tests/ext2.test
tests/ext3.test [new file with mode: 0755]
tests/extra-portability.test [new file with mode: 0755]
tests/extra-portability2.test [new file with mode: 0755]
tests/extra-portability3.test [new file with mode: 0755]
tests/extra-programs-empty.test [moved from tests/yacc3.test with 50% similarity]
tests/extra.test
tests/extra10.test
tests/extra11.test
tests/extra12.test
tests/extra2.test
tests/extra3.test
tests/extra4.test
tests/extra5.test
tests/extra6.test
tests/extra7.test
tests/extra8.test
tests/extra9.test [new file with mode: 0755]
tests/extract-testsuite-summary [new file with mode: 0644]
tests/extradep.test
tests/extradep2.test
tests/f90only.test
tests/flavor.test
tests/flibs.test
tests/fn99.test
tests/fn99subdir.test
tests/fnoc.test
tests/fo.test
tests/fonly.test
tests/forcemiss.test
tests/forcemiss2.test
tests/fort1.test
tests/fort2.test
tests/fort4.test
tests/fort5.test
tests/fortdep.test
tests/gcj.test
tests/gcj2.test
tests/gcj3.test
tests/gcj4.test
tests/gcj5.test
tests/gcj6.test
tests/gen-parallel-tests [deleted file]
tests/gen-testsuite-part [new file with mode: 0755]
tests/get-sysconf.test
tests/gettext-macros.test
tests/gettext.test
tests/gettext2.test
tests/gettext3.test
tests/gnits.test
tests/gnits2.test
tests/gnits3.test
tests/gnumake.test
tests/gnuwarn.test
tests/gnuwarn2.test
tests/hdr-vars-defined-once.test
tests/header.test
tests/help-depend.test
tests/help-depend2.test
tests/help-dmalloc.test
tests/help-init.test
tests/help-lispdir.test
tests/help-multilib.test
tests/help-python.test
tests/help-silent.test
tests/help-upc.test
tests/help.test
tests/help2.test
tests/help3.test
tests/help4.test
tests/hfs.test
tests/hosts.test [deleted file]
tests/implicit.test
tests/info.test
tests/init.test
tests/init2.test
tests/insh2.test
tests/install-info-dir.test
tests/install2.test
tests/installdir.test
tests/instdat.test
tests/instdat2.test
tests/instdir-java.test
tests/instdir-lisp.test
tests/instdir-ltlib.test
tests/instdir-prog.test
tests/instdir-python.test
tests/instdir-texi.test
tests/instdir.test
tests/instdir2.test
tests/instexec.test
tests/instfail-info.test
tests/instfail-java.test
tests/instfail-libtool.test
tests/instfail.test
tests/insthook.test
tests/instman.test
tests/instman2.test
tests/instmany-mans.test
tests/instmany-python.test
tests/instmany.test
tests/instsh.test
tests/instsh2.test
tests/instsh3.test
tests/instspc.tap [new file with mode: 0755]
tests/instspc.test [deleted file]
tests/interp.test
tests/interp2.test
tests/is [new file with mode: 0755]
tests/java-check.test
tests/java-clean.test
tests/java-compile-install.test
tests/java-compile-run-flat.test [new file with mode: 0755]
tests/java-compile-run-nested.test [new file with mode: 0755]
tests/java-empty-classpath.test
tests/java-extra.test [new file with mode: 0755]
tests/java-mix.test
tests/java-no-duplicate.test
tests/java-nobase.test
tests/java-noinst.test [new file with mode: 0755]
tests/java-rebuild.test [new file with mode: 0755]
tests/java-sources.test
tests/java-uninstall.test [new file with mode: 0755]
tests/java.test
tests/java2.test
tests/java3.test
tests/javadir-undefined.test
tests/javaflags.test [new file with mode: 0755]
tests/javaprim.test
tests/javasubst.test
tests/ldadd.test
tests/ldflags.test
tests/lex-clean-cxx.test [new file with mode: 0755]
tests/lex-clean.test [new file with mode: 0755]
tests/lex-depend-cxx.test [new file with mode: 0755]
tests/lex-depend-grep.test [new file with mode: 0755]
tests/lex-depend.test [new file with mode: 0755]
tests/lex-lib-external.test [new file with mode: 0755]
tests/lex-lib.test [moved from tests/depcomp3.test with 55% similarity]
tests/lex-libobj.test [new file with mode: 0755]
tests/lex-line.test [new file with mode: 0755]
tests/lex-nodist.test [new file with mode: 0755]
tests/lex-noyywrap.test [new file with mode: 0755]
tests/lex-pr204.test [new file with mode: 0755]
tests/lex-subobj-nodep.test
tests/lex.test
tests/lex2.test
tests/lex3.test
tests/lex5.test
tests/lexcpp.test [moved from tests/cxxansi.test with 63% similarity]
tests/lexvpath.test [new file with mode: 0755]
tests/lflags.test
tests/lflags2.test
tests/libexec.test
tests/libobj-basic.test [new file with mode: 0755]
tests/libobj10.test
tests/libobj12.test
tests/libobj13.test
tests/libobj14.test
tests/libobj15a.test [moved from tests/libobj11.test with 71% similarity]
tests/libobj15b.test [new file with mode: 0755]
tests/libobj15c.test [moved from tests/libobj8.test with 51% similarity]
tests/libobj16a.test [new file with mode: 0755]
tests/libobj16b.test [new file with mode: 0755]
tests/libobj17.test [moved from tests/depcomp4.test with 52% similarity]
tests/libobj18.test [moved from tests/depend2.test with 58% similarity]
tests/libobj19.test [new file with mode: 0755]
tests/libobj2.test
tests/libobj20a.test [new file with mode: 0755]
tests/libobj20b.test [new file with mode: 0755]
tests/libobj20c.test [moved from tests/depcomp5.test with 52% similarity]
tests/libobj3.test
tests/libobj4.test
tests/libobj5.test
tests/libobj7.test
tests/library.test
tests/library2.test
tests/library3.test
tests/libtoo10.test
tests/libtoo11.test
tests/libtool-macros.test
tests/libtool.test
tests/libtool2.test
tests/libtool3.test
tests/libtool4.test
tests/libtool5.test
tests/libtool6.test
tests/libtool7.test
tests/libtool8.test
tests/libtool9.test
tests/license.test
tests/license2.test
tests/link_c_cxx.test
tests/link_dist.test
tests/link_f90_only.test
tests/link_f_only.test
tests/link_fc.test
tests/link_fccxx.test
tests/link_fcxx.test
tests/link_override.test [new file with mode: 0755]
tests/lisp2.test
tests/lisp3.test
tests/lisp4.test
tests/lisp5.test
tests/lisp6.test
tests/lisp7.test
tests/lisp8.test
tests/lispdry.test
tests/list-of-tests.mk
tests/listval.test
tests/location.test
tests/longlin2.test
tests/longline.test
tests/ltcond.test
tests/ltcond2.test
tests/ltconv.test
tests/ltdeps.test
tests/ltinit.test
tests/ltinstloc.test
tests/ltlibobjs.test
tests/ltlibsrc.test
tests/ltorder.test
tests/lzma.test
tests/m4-inclusion.test
tests/maintclean-vpath.test
tests/maintclean.test
tests/maintmode-configure-msg.test
tests/make-dryrun.test
tests/make.test
tests/makefile-deps.test
tests/makej.test
tests/makej2.test
tests/maken.test
tests/maken3.test
tests/makevars.test
tests/man.test
tests/man2.test
tests/man3.test
tests/man4.test
tests/man5.test
tests/man6.test [new file with mode: 0755]
tests/man7.test [new file with mode: 0755]
tests/man8.test [new file with mode: 0755]
tests/mdate.test
tests/mdate2.test
tests/mdate3.test
tests/mdate4.test
tests/mdate5.test
tests/mdate6.test
tests/missing-auxfile-stops-makefiles-creation.test [new file with mode: 0755]
tests/missing.test
tests/missing2.test
tests/missing3.test
tests/missing4.test
tests/missing5.test
tests/missing6.test
tests/mkinst2.test
tests/mkinst3.test
tests/mkinstall.test
tests/mmode.test
tests/mmodely.test
tests/multlib.test
tests/no-extra-makefile-code.test [moved from tests/acoutbs.test with 56% similarity]
tests/no-outdir-option.test [moved from tests/acoutqnl.test with 69% similarity]
tests/nobase-libtool.test
tests/nobase-nodist.test
tests/nobase-python.test
tests/nobase.test
tests/nodef.test
tests/nodef2.test
tests/nodep.test
tests/nodep2.test
tests/nodepcomp.test
tests/nodist.test
tests/nodist2.test
tests/nodist3.test
tests/noinst.test
tests/noinstdir.test
tests/nolink.test
tests/nostdinc.test
tests/notrans.test
tests/number.test
tests/objc.test
tests/objc2.test
tests/objext-pr10128.test
tests/obsolete.test
tests/oldvars.test [new file with mode: 0755]
tests/order.test
tests/outdir.test [deleted file]
tests/output-order.test
tests/output.test
tests/output10.test
tests/output11.test
tests/output12.test
tests/output13.test
tests/output2.test
tests/output3.test
tests/output4.test
tests/output5.test
tests/output6.test
tests/output7.test
tests/output8.test
tests/output9.test
tests/overrid.test [deleted file]
tests/override-conditional-1.test [new file with mode: 0755]
tests/override-conditional-2.test [new file with mode: 0755]
tests/override-html.test [moved from tests/ansi8.test with 70% similarity]
tests/override-suggest-local.test [new file with mode: 0755]
tests/parallel-am.test
tests/parallel-am2.test
tests/parallel-am3.test
tests/parallel-tests-cmdline-override.test [new file with mode: 0755]
tests/parallel-tests-console-output.test [new file with mode: 0755]
tests/parallel-tests-driver-install.test [new file with mode: 0755]
tests/parallel-tests-dry-run-1.test [moved from tests/parallel-tests-dryrun.test with 77% similarity]
tests/parallel-tests-dry-run-2.test [new file with mode: 0755]
tests/parallel-tests-empty-testlogs.test [new file with mode: 0755]
tests/parallel-tests-exeext.test [new file with mode: 0755]
tests/parallel-tests-exit-statuses.test [new file with mode: 0755]
tests/parallel-tests-extra-programs.test [new file with mode: 0755]
tests/parallel-tests-fd-redirect-exeext.test [new file with mode: 0755]
tests/parallel-tests-fd-redirect.test [new file with mode: 0755]
tests/parallel-tests-fork-bomb.test [new file with mode: 0755]
tests/parallel-tests-harderror.test
tests/parallel-tests-interrupt.tap [new file with mode: 0755]
tests/parallel-tests-log-compiler-1.test [new file with mode: 0755]
tests/parallel-tests-log-compiler-2.test [moved from tests/parallel-tests7.test with 63% similarity]
tests/parallel-tests-log-compiler-example.test
tests/parallel-tests-log-override-1.test
tests/parallel-tests-log-override-2.test
tests/parallel-tests-log-override-recheck.test
tests/parallel-tests-no-color-in-log.test [new file with mode: 0755]
tests/parallel-tests-no-spurious-summary.test [new file with mode: 0755]
tests/parallel-tests-once.test [moved from tests/distcom7.test with 62% similarity]
tests/parallel-tests-reset-term.test [new file with mode: 0755]
tests/parallel-tests-subdir.test
tests/parallel-tests-suffix-prog.test [new file with mode: 0755]
tests/parallel-tests-suffix.test [moved from tests/parallel-tests4.test with 79% similarity]
tests/parallel-tests-trailing-bslash.test [new file with mode: 0755]
tests/parallel-tests-unreadable.test [new file with mode: 0755]
tests/parallel-tests.test
tests/parallel-tests10.test
tests/parallel-tests2.test
tests/parallel-tests3.test
tests/parallel-tests5.test
tests/parallel-tests6.test
tests/parallel-tests8.test
tests/parallel-tests9.test
tests/parse.test
tests/percent.test
tests/percent2.test
tests/phony.test
tests/plain-functions.sh [new file with mode: 0644]
tests/pluseq.test
tests/pluseq10.test
tests/pluseq11.test
tests/pluseq2.test
tests/pluseq3.test
tests/pluseq4.test
tests/pluseq5.test
tests/pluseq6.test
tests/pluseq7.test
tests/pluseq8.test
tests/pluseq9.test
tests/pm/Cond2.pl [new file with mode: 0644]
tests/pm/Cond3.pl [new file with mode: 0644]
tests/pm/Condition-t.pl
tests/pm/Condition.pl
tests/pm/DisjCon2.pl [new file with mode: 0644]
tests/pm/DisjCon3.pl [new file with mode: 0644]
tests/pm/DisjConditions-t.pl
tests/pm/DisjConditions.pl
tests/pm/Version.pl
tests/pm/Version2.pl [new file with mode: 0644]
tests/pm/Version3.pl [new file with mode: 0644]
tests/pm/Wrap.pl
tests/posixsubst-data.test [new file with mode: 0755]
tests/posixsubst-extradist.test [moved from tests/ansi.test with 56% similarity]
tests/posixsubst-ldadd.test [new file with mode: 0755]
tests/posixsubst-libraries.test [new file with mode: 0755]
tests/posixsubst-ltlibraries.test [new file with mode: 0755]
tests/posixsubst-programs.test [new file with mode: 0755]
tests/posixsubst-scripts.test [new file with mode: 0755]
tests/posixsubst-sources.test [new file with mode: 0755]
tests/posixsubst-tests.test [new file with mode: 0755]
tests/postproc.test
tests/ppf77.test
tests/pr2.test
tests/pr211.test
tests/pr220.test
tests/pr224.test
tests/pr229.test
tests/pr243.test
tests/pr266.test
tests/pr279-2.test
tests/pr279.test
tests/pr287.test
tests/pr300-lib.test
tests/pr300-ltlib.test
tests/pr300-prog.test
tests/pr307.test
tests/pr401.test
tests/pr401b.test
tests/pr401c.test
tests/pr72.test
tests/pr8365-remake-timing.test
tests/pr87.test
tests/pr9.test
tests/prefix.test
tests/primary-prefix-couples-documented-valid.test
tests/primary-prefix-couples-force-valid.test
tests/primary-prefix-invalid-couples.tap [moved from tests/primary-prefix-invalid-couples.test with 91% similarity]
tests/primary-prefix-valid-couples.test
tests/primary.test
tests/primary2.test
tests/primary3.test
tests/proginst.test
tests/programs-primary-rewritten.test [moved from tests/subst2.test with 51% similarity]
tests/prove-runner [new file with mode: 0755]
tests/py-compile-basedir.test
tests/py-compile-basic.test
tests/py-compile-basic2.test
tests/py-compile-destdir.test
tests/py-compile-env.test
tests/py-compile-option-terminate.test
tests/py-compile-usage.test
tests/python-dist.test [new file with mode: 0755]
tests/python-vars.test [new file with mode: 0755]
tests/python-virtualenv.test [new file with mode: 0755]
tests/python.test
tests/python10.test
tests/python11.test
tests/python12.test
tests/python2.test
tests/python3.test
tests/python4.test
tests/python5.test
tests/python5b.test [new file with mode: 0755]
tests/python6.test
tests/python7.test
tests/python8.test
tests/python9.test
tests/recurs.test
tests/recurs2.test
tests/remake-all-1.test [new file with mode: 0755]
tests/remake-all-2.test [new file with mode: 0755]
tests/remake-am-pr10111.test
tests/remake-deleted-am-2.test
tests/remake-deleted-am-subdir.test
tests/remake-deleted-am.test
tests/remake-deleted-m4-file.test [new file with mode: 0755]
tests/remake-gnulib-add-acsubst.test [new file with mode: 0755]
tests/remake-gnulib-add-header.test [new file with mode: 0755]
tests/remake-gnulib-remove-header.test [new file with mode: 0755]
tests/remake-m4-pr10111.test
tests/remake-moved-m4-file.test [new file with mode: 0755]
tests/remake-renamed-am.test
tests/remake-renamed-m4-file.test [new file with mode: 0755]
tests/remake-renamed-m4-macro-and-file.test [new file with mode: 0755]
tests/remake-renamed-m4-macro.test [new file with mode: 0755]
tests/remake-subdir-from-subdir.test
tests/remake-subdir-gnu.test
tests/remake-subdir-long-time.test
tests/remake-subdir.test
tests/remake-subdir2.test
tests/remake.test
tests/remake10a.test [new file with mode: 0755]
tests/remake10b.test [new file with mode: 0755]
tests/remake10c.test [new file with mode: 0755]
tests/remake11.test [new file with mode: 0755]
tests/remake12.test [new file with mode: 0755]
tests/remake1a.test [new file with mode: 0755]
tests/remake2.test
tests/remake3.test
tests/remake3a.test [new file with mode: 0755]
tests/remake4.test
tests/remake5.test
tests/remake6.test
tests/remake7.test
tests/remake8a.test [new file with mode: 0755]
tests/remake8b.test [new file with mode: 0755]
tests/remake9a.test [new file with mode: 0755]
tests/remake9b.test [new file with mode: 0755]
tests/remake9c.test [new file with mode: 0755]
tests/remake9d.test [new file with mode: 0755]
tests/repeated-options.test [new file with mode: 0755]
tests/req.test
tests/reqd.test
tests/reqd2.test
tests/rst-formatting.test [new file with mode: 0755]
tests/rulepat.test
tests/sanity.test
tests/scripts.test
tests/seenc.test
tests/self-check-cleanup.tap [new file with mode: 0755]
tests/self-check-configure-help.test [new file with mode: 0755]
tests/self-check-dir.tap [new file with mode: 0755]
tests/self-check-env-sanitize.tap [new file with mode: 0755]
tests/self-check-exit.tap [new file with mode: 0755]
tests/self-check-explicit-skips.test [new file with mode: 0755]
tests/self-check-is-blocked-signal.tap [new file with mode: 0755]
tests/self-check-is_newest.tap [new file with mode: 0755]
tests/self-check-me.tap [new file with mode: 0755]
tests/self-check-reexec.tap [new file with mode: 0755]
tests/self-check-report.test
tests/self-check-sanity.test [new file with mode: 0755]
tests/self-check-seq.tap [new file with mode: 0755]
tests/self-check-tap.test [new file with mode: 0755]
tests/self-check-unindent.tap [new file with mode: 0755]
tests/silent-configsite.test
tests/silent-lex-gcc.test [deleted file]
tests/silent-lex-generic.test [deleted file]
tests/silent-lex.test [new file with mode: 0755]
tests/silent-many-gcc.test
tests/silent-many-generic.test
tests/silent-nested-vars.test
tests/silent-nowarn.test [new file with mode: 0755]
tests/silent-yacc-gcc.test [deleted file]
tests/silent-yacc-generic.test [deleted file]
tests/silent-yacc-headers.test [new file with mode: 0755]
tests/silent-yacc.test [new file with mode: 0755]
tests/silent.test
tests/silent2.test
tests/silent3.test
tests/silent4.test
tests/silent6.test
tests/silent7.test
tests/silent8.test [new file with mode: 0755]
tests/silent9.test
tests/silentcxx-gcc.test [new file with mode: 0755]
tests/silentcxx.test
tests/silentf77.test
tests/silentf90.test
tests/space.test
tests/specflg-dummy.test
tests/specflg.test
tests/specflg10.test
tests/specflg2.test
tests/specflg3.test
tests/specflg6.test
tests/specflg7.test
tests/specflg8.test
tests/specflg9.test
tests/spell.test
tests/spell2.test
tests/spell3.test
tests/spelling.test
tests/spy.test
tests/srcsub.test
tests/srcsub2.test
tests/stamph2.test
tests/stdinc.test
tests/stdlib.test
tests/stdlib2.test
tests/strictness-override.test [new file with mode: 0755]
tests/strictness-precedence.test [new file with mode: 0755]
tests/strip.test
tests/strip2.test
tests/strip3.test
tests/subcond.test
tests/subcond2.test
tests/subcond3.test
tests/subdir.test
tests/subdir10.test
tests/subdir2.test
tests/subdir3.test
tests/subdir4.test
tests/subdir5.test
tests/subdir6.test
tests/subdir7.test
tests/subdir8.test
tests/subdir9.test
tests/subdirbuiltsources.test
tests/subobj.test
tests/subobj10.test
tests/subobj11a.test
tests/subobj11b.test
tests/subobj11c.test
tests/subobj2.test
tests/subobj4.test
tests/subobj5.test
tests/subobj6.test
tests/subobj7.test
tests/subobj8.test
tests/subobj9.test
tests/subobjname.test
tests/subpkg-yacc.test
tests/subpkg.test
tests/subpkg2.test
tests/subpkg3.test
tests/subpkg4.test
tests/subst-no-trailing-empty-line.test [new file with mode: 0755]
tests/subst.test
tests/subst3.test
tests/subst4.test
tests/subst5.test [new file with mode: 0755]
tests/substre2.test
tests/substref.test
tests/substtarg.test
tests/suffix-chain.tap [new file with mode: 0755]
tests/suffix.test
tests/suffix10.tap [new file with mode: 0755]
tests/suffix11.tap [new file with mode: 0755]
tests/suffix11.test [deleted file]
tests/suffix12.test
tests/suffix13.test
tests/suffix2.test
tests/suffix3.tap [new file with mode: 0755]
tests/suffix3.test [deleted file]
tests/suffix4.test
tests/suffix5.test
tests/suffix6.test
tests/suffix6b.test [new file with mode: 0755]
tests/suffix6c.test [new file with mode: 0755]
tests/suffix7.test
tests/suffix8.tap [new file with mode: 0755]
tests/suffix8.test [deleted file]
tests/suffix9.test
tests/symlink.test
tests/symlink2.test
tests/syntax.test
tests/tags.test
tests/tags2.test [new file with mode: 0755]
tests/tagsub.test
tests/tap-ambiguous-directive.test [new file with mode: 0755]
tests/tap-autonumber.test [new file with mode: 0755]
tests/tap-bad-prog.tap [new file with mode: 0755]
tests/tap-bailout-and-logging.test [new file with mode: 0755]
tests/tap-bailout-leading-space.test [new file with mode: 0755]
tests/tap-bailout-suppress-badexit.test [new file with mode: 0755]
tests/tap-bailout-suppress-later-diagnostic.test [new file with mode: 0755]
tests/tap-bailout-suppress-later-errors.test [new file with mode: 0755]
tests/tap-bailout.test [new file with mode: 0755]
tests/tap-basic.test [new file with mode: 0755]
tests/tap-color.test [new file with mode: 0755]
tests/tap-common-setup.test [moved from tests/lzip.test with 71% similarity]
tests/tap-deps.test [new file with mode: 0755]
tests/tap-diagnostic-custom.test [new file with mode: 0755]
tests/tap-diagnostic.test [new file with mode: 0755]
tests/tap-doc.test [new file with mode: 0755]
tests/tap-doc2.test [new file with mode: 0755]
tests/tap-driver-stderr.test [new file with mode: 0755]
tests/tap-empty-diagnostic.test [new file with mode: 0755]
tests/tap-empty.test [new file with mode: 0755]
tests/tap-escape-directive-2.test [new file with mode: 0755]
tests/tap-escape-directive.test [new file with mode: 0755]
tests/tap-exit.test [new file with mode: 0755]
tests/tap-fancy.test [new file with mode: 0755]
tests/tap-fancy2.test [new file with mode: 0755]
tests/tap-functions.sh [new file with mode: 0644]
tests/tap-global-log.test [new file with mode: 0755]
tests/tap-global-result.test [new file with mode: 0755]
tests/tap-log.test [new file with mode: 0755]
tests/tap-merge-stdout-stderr.test [new file with mode: 0755]
tests/tap-missing-plan-and-bad-exit.test [new file with mode: 0755]
tests/tap-more.test [new file with mode: 0755]
tests/tap-more2.test [new file with mode: 0755]
tests/tap-msg0-bailout.test [new file with mode: 0755]
tests/tap-msg0-directive.test [new file with mode: 0755]
tests/tap-msg0-misc.test [new file with mode: 0755]
tests/tap-msg0-planskip.test [new file with mode: 0755]
tests/tap-msg0-result.test [new file with mode: 0755]
tests/tap-negative-numbers.test [new file with mode: 0755]
tests/tap-no-disable-hard-error.test [new file with mode: 0755]
tests/tap-no-merge-stdout-stderr.test [new file with mode: 0755]
tests/tap-no-spurious-numbers.test [new file with mode: 0755]
tests/tap-no-spurious-summary.test [new file with mode: 0755]
tests/tap-no-spurious.test [new file with mode: 0755]
tests/tap-not-ok-skip.test [new file with mode: 0755]
tests/tap-number-wordboundary.test [new file with mode: 0755]
tests/tap-numbers-leading-zero.test [new file with mode: 0755]
tests/tap-numeric-description.test [new file with mode: 0755]
tests/tap-out-of-order.test [new file with mode: 0755]
tests/tap-passthrough-exit.test [new file with mode: 0755]
tests/tap-passthrough.test [new file with mode: 0755]
tests/tap-plan-corner.test [new file with mode: 0755]
tests/tap-plan-errors.test [new file with mode: 0755]
tests/tap-plan-leading-zero.test [new file with mode: 0755]
tests/tap-plan-malformed.test [new file with mode: 0755]
tests/tap-plan-middle.test [new file with mode: 0755]
tests/tap-plan-whitespace.test [moved from tests/help-regex.test with 60% similarity]
tests/tap-plan.test [new file with mode: 0755]
tests/tap-planskip-and-logging.test [new file with mode: 0755]
tests/tap-planskip-badexit.test [new file with mode: 0755]
tests/tap-planskip-bailout.test [new file with mode: 0755]
tests/tap-planskip-case-insensitive.test [new file with mode: 0755]
tests/tap-planskip-late.test [new file with mode: 0755]
tests/tap-planskip-later-errors.test [new file with mode: 0755]
tests/tap-planskip-unplanned-corner.test [new file with mode: 0755]
tests/tap-planskip-unplanned.test [new file with mode: 0755]
tests/tap-planskip-whitespace.test [new file with mode: 0755]
tests/tap-planskip.test [new file with mode: 0755]
tests/tap-realtime.test [new file with mode: 0755]
tests/tap-recheck-logs.test [new file with mode: 0755]
tests/tap-recheck.test [new file with mode: 0755]
tests/tap-result-comment.test [new file with mode: 0755]
tests/tap-setup.sh [new file with mode: 0755]
tests/tap-signal.tap [new file with mode: 0755]
tests/tap-summary-aux.sh [new file with mode: 0755]
tests/tap-summary-color.test [new file with mode: 0755]
tests/tap-summary.test [new file with mode: 0755]
tests/tap-test-number-0.test [new file with mode: 0755]
tests/tap-todo-skip-together.test [new file with mode: 0755]
tests/tap-todo-skip-whitespace.test [new file with mode: 0755]
tests/tap-todo-skip.test [new file with mode: 0755]
tests/tap-unplanned.test [new file with mode: 0755]
tests/tap-whitespace-normalization.test [new file with mode: 0755]
tests/tap-with-and-without-number.test [new file with mode: 0755]
tests/tap-xfail-tests.test [new file with mode: 0755]
tests/tar-override.test
tests/tar.test
tests/tar2.test
tests/tar3.test
tests/target-cflags.test
tests/targetclash.test
tests/test-driver-acsubst.test [new file with mode: 0755]
tests/test-driver-cond.test [new file with mode: 0755]
tests/test-driver-create-log-dir.test [new file with mode: 0755]
tests/test-driver-custom-multitest-recheck.test [new file with mode: 0755]
tests/test-driver-custom-multitest-recheck2.test [new file with mode: 0755]
tests/test-driver-custom-multitest.test [new file with mode: 0755]
tests/test-driver-custom-no-extra-driver.test [new file with mode: 0755]
tests/test-driver-custom-xfail-tests.test [new file with mode: 0755]
tests/test-driver-custom.test [new file with mode: 0755]
tests/test-driver-fail.test [new file with mode: 0755]
tests/test-driver-is-distributed.test [new file with mode: 0755]
tests/test-driver-strip-vpath.test [new file with mode: 0755]
tests/test-driver-trs-suffix-registered.test [new file with mode: 0755]
tests/test-extensions-cond.test
tests/test-extensions.test
tests/test-harness-vpath-rewrite.test [new file with mode: 0755]
tests/test-log.test [new file with mode: 0755]
tests/test-logs-repeated.test [new file with mode: 0755]
tests/test-metadata-global-log.test [new file with mode: 0755]
tests/test-metadata-global-result.test [new file with mode: 0755]
tests/test-metadata-recheck.test [new file with mode: 0755]
tests/test-metadata-results.test [new file with mode: 0755]
tests/test-missing.test [new file with mode: 0755]
tests/test-missing2.test [moved from tests/parallel-tests-unreadable-log.test with 54% similarity]
tests/test-trs-basic.test [new file with mode: 0755]
tests/test-trs-recover.test [new file with mode: 0755]
tests/test-trs-recover2.test [new file with mode: 0755]
tests/tests-environment-and-log-compiler.test [new file with mode: 0755]
tests/tests-environment-backcompat.test
tests/tests-environment-fd-redirect.test [new file with mode: 0755]
tests/tests-environment.test [moved from tests/check-tests_environment.test with 99% similarity]
tests/testsuite-summary-checks.sh [new file with mode: 0755]
tests/testsuite-summary-color.test [new file with mode: 0755]
tests/testsuite-summary-count-many.test [new file with mode: 0755]
tests/testsuite-summary-count.test [new file with mode: 0755]
tests/testsuite-summary-reference-log.test [new file with mode: 0755]
tests/transform.test
tests/transform2.test
tests/trivial-test-driver [new file with mode: 0644]
tests/txinfo-unrecognized-extension.test [new file with mode: 0755]
tests/txinfo.test
tests/txinfo10.test
tests/txinfo13.test
tests/txinfo16.test
tests/txinfo17.test
tests/txinfo18.test
tests/txinfo19.test
tests/txinfo2.test
tests/txinfo20.test
tests/txinfo21.test
tests/txinfo22.test
tests/txinfo23.test
tests/txinfo24.test
tests/txinfo25.test
tests/txinfo26.test
tests/txinfo27.test
tests/txinfo28.test
tests/txinfo29.test
tests/txinfo3.test
tests/txinfo30.test
tests/txinfo31.test
tests/txinfo32.test
tests/txinfo33.test
tests/txinfo4.test
tests/txinfo5.test
tests/txinfo5b.test
tests/txinfo6.test
tests/txinfo7.test
tests/txinfo8.test
tests/txinfo9.test
tests/uninstall-fail.test
tests/uninstall-pr9578.test
tests/unused.test
tests/upc.test
tests/upc2.test
tests/upc3.test
tests/vala-mix.test
tests/vala-vpath.test
tests/vala.test
tests/vala1.test
tests/vala2.test
tests/vala3.test
tests/vala4.test
tests/vala5.test
tests/vars.test
tests/vars3.test
tests/vartar.test
tests/vartypo2.test [new file with mode: 0755]
tests/vartypos.test [new file with mode: 0755]
tests/version.test
tests/version2.test
tests/version3.test
tests/version4.test
tests/version6.test
tests/version7.test
tests/version8.test
tests/vpath.test
tests/vtexi.test
tests/vtexi2.test
tests/vtexi3.test
tests/vtexi4.test
tests/warning-groups-win-over-strictness.test [new file with mode: 0755]
tests/warnings-override.test [new file with mode: 0755]
tests/warnings-precedence.test [new file with mode: 0755]
tests/warnings-strictness-interactions.test [new file with mode: 0755]
tests/warnings-unknown.test [new file with mode: 0755]
tests/warnings-win-over-strictness.test [new file with mode: 0755]
tests/warnopts.test
tests/werror.test
tests/werror2.test
tests/werror3.test
tests/werror4.test [new file with mode: 0755]
tests/whoami.test
tests/xsource.test
tests/yacc-auxdir.test [moved from tests/subobj3.test with 54% similarity]
tests/yacc-basic.test [new file with mode: 0755]
tests/yacc-bison-skeleton-cxx.test [new file with mode: 0755]
tests/yacc-bison-skeleton.test [new file with mode: 0755]
tests/yacc-clean-cxx.test [new file with mode: 0755]
tests/yacc-clean.test [new file with mode: 0755]
tests/yacc-cxx.test [new file with mode: 0755]
tests/yacc-d-basic.test [new file with mode: 0755]
tests/yacc-d-cxx.test [new file with mode: 0755]
tests/yacc-d-vpath.test [new file with mode: 0755]
tests/yacc-deleted-headers.test [new file with mode: 0755]
tests/yacc-depend.test [new file with mode: 0755]
tests/yacc-depend2.test [new file with mode: 0755]
tests/yacc-dist-nobuild-subdir.test
tests/yacc-dist-nobuild.test [new file with mode: 0755]
tests/yacc-line.test [new file with mode: 0755]
tests/yacc-mix-c-cxx.test [new file with mode: 0755]
tests/yacc-nodist.test [new file with mode: 0755]
tests/yacc-pr204.test [moved from tests/pr204.test with 76% similarity]
tests/yacc-weirdnames.test [new file with mode: 0755]
tests/yacc.test
tests/yacc2.test
tests/yacc4.test
tests/yacc5.test
tests/yacc6.test [deleted file]
tests/yacc7.test
tests/yacc8.test
tests/yaccdry.test
tests/yaccpp.test
tests/yaccvpath.test
tests/yflags-cmdline-override.test [new file with mode: 0755]
tests/yflags-conditional.test [new file with mode: 0755]
tests/yflags-d-false-positives.test [moved from tests/suffix10.test with 56% similarity]
tests/yflags-force-conditional.test [new file with mode: 0755]
tests/yflags-force-override.test [new file with mode: 0755]
tests/yflags-var-expand.test [new file with mode: 0755]
tests/yflags.test
tests/yflags2.test

index f219153..59e80ab 100644 (file)
@@ -12,32 +12,32 @@ Makefile
 /aclocal
 /automake
 /doc/amhello-*.tar.gz
-/doc/automake.info
-/doc/automake.info-[0-9]
+/doc/automake*.info
+/doc/automake*.info-[0-9]
 /doc/automake*.1
 /doc/aclocal*.1
 /doc/stamp-vti
 /doc/version.texi
-/doc/automake.ac
-/doc/automake.aux
-/doc/automake.cm
-/doc/automake.cp
-/doc/automake.cps
-/doc/automake.dvi
-/doc/automake.fn
-/doc/automake.fns
-/doc/automake.html
-/doc/automake.ky
-/doc/automake.log
-/doc/automake.op
-/doc/automake.pdf
-/doc/automake.pg
-/doc/automake.ps
-/doc/automake.toc
-/doc/automake.tp
-/doc/automake.tr
-/doc/automake.vr
-/doc/automake.vrs
+/doc/automake*.ac
+/doc/automake*.aux
+/doc/automake*.cm
+/doc/automake*.cp
+/doc/automake*.cps
+/doc/automake*.dvi
+/doc/automake*.fn
+/doc/automake*.fns
+/doc/automake*.html
+/doc/automake*.ky
+/doc/automake*.log
+/doc/automake*.op
+/doc/automake*.pdf
+/doc/automake*.pg
+/doc/automake*.ps
+/doc/automake*.toc
+/doc/automake*.tp
+/doc/automake*.tr
+/doc/automake*.vr
+/doc/automake*.vrs
 /doc/amhello/Makefile.in
 /doc/amhello/aclocal.m4
 /doc/amhello/config.h.in
@@ -47,15 +47,21 @@ Makefile
 /doc/amhello/install-sh
 /doc/amhello/missing
 /lib/Automake/Config.pm
-/tests/*.log
-/tests/*.log-t
-/tests/pm/*.log
-/tests/pm/*.log-t
-/tests/*.dir
-/tests/*-p.test
 /tests/aclocal-1.*
 /tests/automake-1.*
-/tests/defs
-/tests/parallel-tests.am
+/tests/defs-static
+/tests/testsuite-part.am
+/tests/*-w.tap
+/tests/*-w.test
+/tests/depcomp-*.tap
+/tests/*.dir
+/tests/*.log
+/tests/*.trs
+/tests/pm/*.log
+/tests/pm/*.trs
+cscope.files
+cscope.in.out
+cscope.out
+cscope.po.out
 tags
 TAGS
index d3150b2..2bd9d47 100644 (file)
        * m4/auxdir.m4: More comments.
 
 2001-07-31  Richard Boulton <richard@tartarus.org>
-            Raja R Harinath <harinath@cs.umn.edu>
+           Raja R Harinath <harinath@cs.umn.edu>
 
        * automake.in (variable_conditions_sub): Remove @parent_conds
        argument.  This was old logic - duplicate or impossible
        * lib/am/tags.am (GTAGS): Added GTAGS_ARGS.  From Shigio Yamaguchi.
 
 2001-07-19  Tom Tromey  <tromey@redhat.com>
-            Alexandre Duret-Lutz  <duret_g@epita.fr>
+           Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        Fix for ccnoco.test, subobj8.test:
        * m4/Makefile.am (m4data_DATA): Added auxdir.m4.
index 7e5caa7..45a7c67 100644 (file)
        Reported by Braden N. McDaniel.
 
 2002-05-08  Charles Wilson  <cwilson@ece.gatech.edu>
-            Alexandre Duret-Lutz  <duret_g@epita.fr>
+           Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        * lib/am/progs.am (clean-%DIR%PROGRAMS): If Libtool is used, clean
        both `program$(EXEEXT)' and `program'; needed under Cygwin.
 2002-01-06  Raja R Harinath  <harinath@cs.umn.edu>
 
        * automake.in (handle_languages): Emit an automake
-        internal variable 'am__depfiles_maybe'.
+       internal variable 'am__depfiles_maybe'.
        * lib/am/configure.am (%MAKEFILE%): Use am__depfiles_maybe.
 
        * lib/am/configure.am (%MAKEFILE%): Pass `depfiles' to
index 5dfcd9e..ee393ca 100644 (file)
        (generate_makefile): Likewise.
        * tests/nodist3.test: Ensure that DIST_SOURCES is not created,
        and that dist target does not exist.
-        Reported by Tom Fitzsimmons.
+       Reported by Tom Fitzsimmons.
 
 2004-01-02  Alexandre Duret-Lutz  <adl@gnu.org>
 
index 063c06b..7b07c36 100644 (file)
        * lib/gnupload: Mention ncftpput in `--help' output.
        Report by Bruce Korb.
 
+2009-12-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       * NEWS: Update.
+
 2009-12-05  Antonio Diaz Diaz  <ant_diaz@teleline.es>
 
        Replace unlzma, gunzip, bunzip2 with pack tool -d invocation.
        current directory.  Use it instead of `pwd` command substitution,
        to avoid Heirloom/Solaris Sh bug with `set -e'.
 
+2009-12-05  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix requirements of silent8.test.
+       * tests/silent8.test: Require makeinfo --html, tex, texi2dvi -o,
+       dvips.
+
+2009-12-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       File `automake.in' is not meant to be executed (only to be
+       preprocessed into `automake'), so don't leave it executable.
+       * automake.in: Remove executable bit.
+
+2009-12-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Don't make the generated Automake's Config.pm executable.
+       * lib/Automake/Makefile.am (Config.pm): Don't make the generated
+       `Config.pm' file executable.
+
 2009-11-28  Jim Meyering  <meyering@redhat.com>
 
        do not put world-writable directories in distribution tarballs
        * Makefile.am (EXTRA_DIST): Add bootstrap.
        Report by Jan Engelhardt.
 
+2009-11-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Coverage for corner cases in derive_suffix.
+       Ensure unrelatex SUFFIXES entries and unrelated inference rules
+       are ignored silently.
+       * tests/ext3.test: New test.
+       * tests/Makefile.am: Update.
+
+       Coverage for user-provided _LINK variables.
+       * tests/link_override.test: New test.
+       * tests/Makefile.am: Adjust.
+
+       Coverage: warn about substitutions that need EXTRA_PRIMARY.
+       * tests/extra9.test: New test.
+       * tests/Makefile.am: Adjust.
+
+       Coverage: warn about configure substitution in EXTRA_PRIMARY.
+       * tests/subst5.test: New test.
+       * tests/Makefile.am: Update.
+
+       Coverage for syntax errors with conditionals in included fragments.
+       * tests/condinc2.test: Amend test.
+
+       Coverage: diagnose variables with forbidden dist_ prefix.
+       * tests/candist.test: New test.
+       * tests/Makefile.am: Update.
+
+       Coverage for conditional `else' and `endif' arguments.
+       * tests/cond46.test: New test.
+       * tests/Makefile.am: Update.
+
 2009-10-31  Jim Meyering  <meyering@redhat.com>
            Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * tests/subdir10.test: New test.
        * tests/Makefile.am: Update.
 
+2009-10-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Simplify Variable::_check_ambiguous_condition.
+       * lib/Automake/Variable.pm (_check_ambiguous_condition): No need
+       to check for $def since ambiguous_p returns an empty $message if
+       there is no other condition which is ambiguous to $cond.
+
+       Coverage for DisjConditions.pm.
+       * lib/Automake/tests/DisjConditions.pl (test_basics): Increase
+       test coverage: test ->human, ->merge, ->simplify, ->multiply.
+       * lib/Automake/tests/DisjConditions-t.pl (test_basics): Likewise
+       changes, but including state copies across thread creation.
+       * lib/Automake/tests/DisjCon2.pl: New test.
+       * lib/Automake/tests/DisjCon3.pl: Likewise.
+       * lib/Automake/tests/Makefile.am (TESTS, XFAIL_TESTS): Adjust.
+
+       Coverage and fixes for Condition.pm.
+       * lib/Automake/Condition.pm (new): Catch common programming
+       errors better by checking type of passed argument before
+       munging them to all be strings through split.
+       * lib/Automake/tests/Condition.pl (test_basics): Also test
+       ->human.
+       (test_merge): New function, test ->merge, ->merge_conds,
+       ->strip.
+       * lib/Automake/tests/Condition-t.pl (test_basics, test_merge):
+       Likewise changes, but including state copies across thread
+       creation.
+       * lib/Automake/tests/Cond2.pl: New test for programming error.
+       * lib/Automake/tests/Cond3.pl: Likewise.
+       * lib/Automake/tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
+       Coverage for Wrap.pm.
+       * lib/Automake/tests/Wrap.pl (@tests): Add test for word with
+       trailing space.
+       (test_makefile_wrap, @makefile_tests): New function, new list of
+       tests, to test makefile_wrap.
+
+       Coverage for Version.pm.
+       * lib/Automake/tests/Version.pl (test_version_compare): Also
+       try Automake::Version::check for the version pairs, taking into
+       account the special-case naming of code forks.
+       (@tests): Add more test cases.
+       (test_bad_versions, @bad_versions): New function, new test cases,
+       to ensure bad version strings are rejected.
+       * lib/Automake/tests/Version2.pl: New test.
+       * lib/Automake/tests/Version3.pl: Likewise.
+       * lib/Automake/tests/Makefile.am (TESTS): Add tests here ...
+       (XFAIL_TESTS): ... and here, new.
+
+       Pod coverage for Perl modules.
+       * lib/Automake/ChannelDefs.pm (parse_warnings): Fix
+       typo in Pod documentation.
+       * lib/Automake/Condition.pm: Add a couple of missing `=back'
+       lines.
+       (_has): Renamed from ...
+       (has): ... this, as this is an internal method.
+       (strip, false, true_when): Adjust callers.
+       * lib/Automake/Configure_ac.pm: Add Pod `Functions' section with
+       documentation for find_configure_ac and require_configure_ac.
+       * lib/Automake/Location.pm: Fix typo in Pod.  Add `Methods'
+       section, document methods.
+       * lib/Automake/RuleDef.pm: New `Methods' Pod section.
+       * lib/Automake/VarDef.pm: Document `raw_value'.
+       * lib/Automake/Wrap.pm (_tab_length): Rename from ...
+       (tab_length): ... this, as this is an internal method.
+       (wrap): Adjust callers.
+       * lib/Automake/XFile.pm: Reorganize Pod a bit, add `Methods'
+       section.
+
 2009-10-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Perl coverage support using Devel::Cover.
+       This introduces makefile rules to run the testsuite with Perl
+       coverage enabled.  It skips tests that use perl ithreads, by
+       unsetting AUTOMAKE_JOBS and setting WANT_NO_THREADS to make the
+       threaded tests skip.
+       * Makefile.am (PERL_COVERAGE_DB, PERL_COVERAGE_FLAGS)
+       (PERL_COVER): New variables.
+       (check-coverage, recheck-coverage, clean-coverage): New phony
+       targets.
+       (check-coverage-run, recheck-coverage-run): New phony helper
+       targets.
+       (clean-local): New, depend on clean-coverage.
+       * lib/Automake/tests/Condition-t.pl: Skip if WANT_NO_THREADS is
+       set.
+       * lib/Automake/tests/DisjConditions-t.pl: Likewise.
+       * tests/defs.in: New required entry 'perl-threads'.
+       * tests/parallel-am.test: Use it to skip if WANT_NO_THREADS is
+       set.
+       * tests/parallel-am2.test: Likewise.
+       * tests/parallel-am3.test: Likewise.
+
+       Add convenience `recheck' target to our toplevel Makefile.am.
+       * Makefile.am (recheck): New convenience target.
+       * tests/README: Give examples for running only failed or
+       outdated or otherwise selected tests.
+
+       dist: allow running several compressors in parallel.
+       * lib/am/distdir.am (am__post_remove_distdir): New internal
+       variable.
+       (DIST_TARGETS): New variable, set to list of chosen distribution
+       formats.  Order formats by expected duration, slowest first, for
+       better parallelism.
+       (dist-gzip, dist-bzip2, dist-lzma, dist-xz, dist-tarZ)
+       (dist-shar, dist-zip): Use $(am__post_remove_distdir).
+       (dist, dist-all): Do not depend on distdir.  Instead of
+       replicating each compression command, use a recursive invocation
+       to allow running all $(DIST_TARGETS) in parallel.
+       * NEWS: Update.
+       Report by Peter Breitenlohner.
+
+       Fix license headers of cscope tests to be GPLv2+.
+       * tests/cscope.test: Revert to GPL version 2.
+       * tests/cscope2.test: Likewise.
+       * tests/cscope3.test: Likewise.
+
        Sync auxiliary files from upstream.
        * INSTALL, lib/INSTALL, lib/config.guess, lib/config.sub,
        lib/texinfo.tex: Sync from upstream.
        `--no-function-argzero', since the latter does not work with
        versions 3.x of Zsh.
 
+2009-09-26  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fixups and tests for cscope functionality.
+       It seems cscope is not able to take into account relative
+       file names of included cscope.files files, but it is able to
+       canonicalize file names containing '../' sequences.
+       This patch makes the cscope references relative again, and
+       fixes some corner cases.
+       * NEWS: Reword a bit.
+       * THANKS: Update.
+       * automake.in (handle_tags): Use $(am__cd).  Provide default
+       empty rule for the `cscope' target, for empty sources.
+       * lib/am/tags.am (cscopelist): Construct relative path to files
+       in $(srcdir) if $(srcdir) is relative.
+       [TOPDIR_P] (cscope): Do not depend on cscope-clean.  Only invoke
+       $(CSCOPE) if cscope.files is nonemtpy.
+       (clean-cscope): Rename from ...
+       (cscopeclean): ... this.
+       (cscope.files): Depend on clean-cscope.
+       (distclean-tags) [!TOPDIR_P]: No need to remove cscope files
+       here.
+       * tests/cscope.test, tests/cscope2.test, tests/cscope3.test: New
+       tests.
+       * tests/Makefile.am: Adjust.
+
+2009-09-25  Debarshi Ray  <rishi@gnu.org>
+
+       New target to generate cscope database.
+       * automake.in (handle_tags): Handle cscope.
+       * doc/automake.texi (Tags): Document cscope.
+       * lib/am/tags.am (CSCOPE): New macro.
+       [TOPDIR_P] (AM_RECURSIVE_TARGETS): Add cscope.
+       (cscope): New target.
+       (cscopeclean): Likewise.
+       (cscope.files): Likewise.
+       (cscopelist): Likewise.
+       (distclean-tags): Remove `cscope.out', `cscope.in.out',
+       `cscope.po.out' and `cscope.files'.
+       * NEWS: Update.
+       Based upon earlier patch from Jesse Barnes.
+
+2009-09-25  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Use silent-rules for building the Automake package.
+       * configure.ac (AM_INIT_AUTOMAKE): Add silent-rules option.
+       * Makefile.am (automake, aclocal, INSTALL): Add silencing
+       variables to recipe.
+       * doc/Makefile.am (update_mans, $(srcdir)/aclocal.1)
+       ($(srcdir)/automake.1, $(srcdir)/amhello-1.0.tar.gz): Likewise.
+       * lib/Automake/Makefile.am (Config.pm): Likewise.
+       * tests/Makefile.am ($(srcdir)/parallel-tests.am)
+       ($(parallel_tests), defs-p): Likewise.
+
+2009-09-25  Jack Kelly  <endgame.dos@gmail.com>
+
+       Add silent rules support for texinfo outputs.
+       * automake.in (define_verbose_texinfo): Define several new verbose
+       tagvars and verbose vars.
+       (define_verbose_tagvar): Increase spacing to 8 to accommodate
+       MAKEINFO, TEXI2DVI, TEXI2PDF.
+       (handle_texinfo): Additional substitution for silencing dvips.
+       (output_texinfo_build_rules): Additional substitutions for
+       silencing texi2dvi and texi2pdf.
+       * lib/am/texibuild.am: Add silencing to makeinfo, makeinfo --html,
+       texi2dvi and texi2pdf rules.
+       * lib/am/texinfos.am: Add silencing to .dvi.ps rule.
+       * tests/Makefile.am: Add silent8.test.
+       * tests/silent8.test: New test: tests that silent texinfo rules
+       produce quiet messages.
+       * NEWS: Update.
+
 2009-09-18  Peter Johansson  <trojkan@gmail.com>  (tiny change)
 
        Fix link to "Recursive Make Considered Harmful" paper.
 
 2009-05-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Post-release version bump.
+       * configure.ac, NEWS: Bump version to 1.11a.
+
+2009-05-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
        Automake 1.11.
        * configure.ac: Bump version to 1.11.
        * doc/automake.texi (Releases): Add line for 1.11.  Remove line
index 234bf2f..c9efbcf 100644 (file)
 
 2011-12-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       regex: remove obsolete macro AM_WITH_REGEX
+       Today, practically nobody uses the GNU rx library, which, according
+       to its own website <http://www.gnu.org/software/rx/rx.html>, has
+       been "decommissioned".  Consequently, the automake-provided macro
+       AM_WITH_REGEX is not used nor required anymore.
+       * m4/regex.m4: Delete.
+       * m4/Makefile.am (dist_automake_ac_DATA): Do not list it anymore.
+       * doc/automake.texi (Obsolete Macros): Remove description, and in
+       fact any mention, of `AM_WITH_REGEX'.
+       * tests/regex.test: Delete.
+       * tests/help-regex.test: Likewise.
+       * tests/regex-obsolete.test: Likewise.
+       * tests/list-of-tests.mk: Do not list them anymore.
+       * NEWS: Update.
+       See also commits `v1.11-587-g5f335be' and `v1.11-433-g37b0aee',
+       where that macro had been deprecated.
+
+2011-12-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetics: be more consistent in copyright notices in tests
+       * tests/cond39.test: Update the heading copyright notice, to be
+       consistent with the formulation used in the other files.
+       * tests/cond40.test: Likewise.
+       * tests/cond41.test: Likewise.
+       * tests/cond42.test: Likewise.
+       * tests/cond43.test: Likewise.
+       * tests/conflnk4.test: Likewise.
+       * tests/extra8.test: Likewise.
+       * tests/extra9.test: Likewise.
+       * tests/suffix13.test: Likewise.
+       * tests/vala.test: Likewise.
+       * tests/vala1.test: Likewise.
+       * tests/vala2.test: Likewise.
+       * tests/vala3.test: Likewise.
+       * tests/vala4.test: Likewise.
+       * tests/vala5.test: Likewise.
+       * lib/Automake/tests/Condition.pl: Likewise.
+       * lib/Automake/tests/Condition-t.pl: Likewise.
+       * lib/Automake/tests/DisjConditions.pl: Likewise.
+       * lib/Automake/tests/DisjConditions-t.pl: Likewise.
+       * lib/Automake/tests/Version.pl: Likewise.
+       * lib/Automake/tests/Wrap.pl: Likewise.
+       * lib/Automake/tests/Cond2.pl: Add copyright notice.
+       * lib/Automake/tests/Cond3.pl: Likewise.
+       * lib/Automake/tests/DisjCon2.pl: Likewise.
+       * lib/Automake/tests/DisjCon3.pl: Likewise.
+       * lib/Automake/tests/Version2.pl: Likewise.
+       * lib/Automake/tests/Version3.pl: Likewise.
+
+2011-12-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: "Bail out!" recognized also after leading whitespace
+       Newer versions of TAP::Harness (e.g., 3.23 on Perl 5.14.1)
+       recognize a "Bail out!" directive also when it is prepended by
+       leading whitespace; this was not the case for older TAP:Harness
+       versions, (e.g., for version 3.17 on Perl 5.12.4), and for our
+       TAP driver implemented in awk.
+       * lib/tap-driver.sh: Handle the "Bail out!" directive also when
+       it is preceded by leading whitespace.
+       * tests/tap-spurious.test: Remove the tests checking that a
+       "Bail out!" string coming right after leading whitespace does
+       not trigger a bailout action.
+       * tests/tap-bailout-leading-space.test: New test.
+       * tests/list-of-tests.mk: Add it.
+       Problem reported by Jim Meyering in automake bug#10374.
+
+2011-12-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure of cond29.test
+       * tests/cond29.test: Limit the amount of virtual memory available
+       to the automake process to ~ 150 MB, rather than only ~ 20 MB, to
+       account for higher (but still acceptable) memory usages on some
+       systems (in this case, a Fedora 16 distro on ppc64).  To be
+       sure not to reduce coverage, increase the number of potential
+       combinations of automake conditionals from 2**22 = 4194304 to
+       2**24 = 16777216.
+       We have actually verified that the new version of the test case
+       catches the Automake 1.7 it is intended to check against, using
+       the Automake 1.7.9 tarball downloaded from:
+         <http://ftp.gnu.org/gnu/automake/automake-1.7.9.tar.gz>
+       Reported by Jim Meyering in automake bug#10374.
+
+2011-12-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        docs: "aclocal --install -I /abs/dir" actually copies files
 
        This change is for automake bug#8407.
        (extract_program_version):... this new function, and saved ...
        ($autopoint_version): ... in this new variable.
 
+2011-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: automatically handle deps also for generated tests
+       * tests/gen-testsuite-part: The test scripts are now scanned for
+       automatic dependency generation *after* the auto-generated tests
+       have been created, so they too will be scanned.  It is a little
+       tricky to ensure that the freshly-generated tests are correctly
+       scanned, and we do that with the help of ...
+       (@generated_tests): ... this new variable.
+       Other related minor changes and refactorings.
+
+2011-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: auto-generate deps for tests requiring libtool/gettext
+       * tests/gen-testsuite-part: Tests requiring libtool (or related
+       programs) will need libtool-provided m4 macros, so they should
+       be run after `libtool-macros.test'.  Similarly for gettext tests.
+       So, generate proper declarations of such dependencies.
+       * tests/Makefile.am: Remove now-unneeded hand-written declaration
+       of those dependencies.
+
+2011-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove FIXME comments from tricks to pacify syntax checks
+       Originally, I myself had insisted on adding those "FIXME" comments
+       near every unusual construct or use of "creative quoting" whose
+       only purpose was to avoid false positive from out syntax checks.
+       I did that with the expectation that we could have easily and soon
+       added a whitelisting capability to our maintainer-specific syntax
+       checks.  This hasn't been the case unfortunately, and now those
+       "FIXME" in the comments are just distracting noise, making it more
+       difficult to grep the test cases for stuff that could really use a
+       fix or an improvement.  So just get rid of them.
+       * tests/instdir-ltlib.test: Remove that extra "FIXME".
+       * tests/instdir-prog.test: Likewise.
+       * tests/parallel-tests3.test: Likewise.
+       * tests/parallel-tests-dry-run.test: Likewise.
+       * tests/parallel-tests-console-output.test: Likewise.
+       * tests/parallel-tests-no-color-in-log.test: Likewise.
+       * tests/tap-realtime.test: Likewise.
+       * tests/test-trs-recover.test: Likewise.
+       * tests/tap-deps.test: Likewise.
+
+2011-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: few minor fixlets, improvements and tweakings
+       * tests/defs-static.in ($top_testbuilddir): New, for consistency
+       and completeness.
+       * tests/Makefile.am (do_subst): Substitute @abs_top_testbuilddir@
+       as well.
+       * tests/java-compile-run-mested.test: Prefer AM_TESTS_ENVIRONMENT
+       over TESTS_ENVIRONMENT, now that the former has become available.
+       * tests/java-compile-run-flat.test: Correct a botched "FIXME"
+       comment.
+       * tests/tap-realtime.test: Remove extra whitespace in comments.
+       * tests/missing-tar.test: Use `get_shell_script' to bring in the
+       `missing' script, to increase coverage.  Remove redundant call to
+       `set -e'.  Fix a typo in comments.
+       * tests/get-sysconf.test: Remove redundant definitions of
+       `$top_testsrcdir', `testbuilddir' and `$top_testbuilddir'.
+
+2011-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundant uses of `set -e'
+       * tests/deleted-am.test: Do not set the `errexit' shell flag, as
+       it is already set by `tests/defs'.
+       * tests/deleted-m4.test: Likewise.
+       * tests/dist-missing-am.test: Likewise.
+       * tests/dist-missing-am.test: Likewise.
+       * tests/dist-missing-m4.test: Likewise.
+       * tests/dist-missing-included-m4.test: Likewise.
+       * tests/get-sysconf.test: Likewise.
+       * tests/makefile-deps.test: Likewise.
+       * tests/remake-m4-pr10111.test: Likewise.
+       * tests/remake-am-pr10111.test: Likewise.
+       * tests/remake-deleted-am.test: Likewise.
+       * tests/remake-deleted-am2.test: Likewise.
+       * tests/remake-deleted-am-subdir.test: Likewise.
+       * tests/remake-renamed-am.test: Likewise.
+
 2011-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: fix failure due to debugging code forgotten into a test
 
 2011-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       Merge branch 'master' into testsuite-work
+       * tests/gettext-macros.test: In the generated `get.sh' file,
+       use `skip_all_', not `skip_'.
+       * tests/libtool-macros.test: Likewise.
+       * tests/list-of-tests.mk: Update.
+
+2011-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        tests: avoid spurious failure of libtool and gettext tests
 
        On Solaris 10 (and presumably earlier), /bin/sh trips up on
 
 2011-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       Merge branch 'maint' into master.
+       * m4/regex.m4: Bump serial number by some notches, for good
+       measure.  Prefer the deprecation message from maint over that
+       from master.
+       * m4/python.m4: Bump serial number.
+       * tests/Makefile.am (canon6.log): Depend on `libtool-macros.log'.
+       (canon7.log): Likewise.
+       (extradep2.log): Likewise.
+       (ar-lib4.log): Likewise.
+       (ar-lib6a.log): Likewise.
+       (ar-lib6b.log): Likewise.
+       (vartypo2): Likewise.
+       (posixsubst-ltlibraries.log): Likewise.
+       * tests/defs: Adjust the path of the included `get.sh' scripts
+       generated by `libtool-macros.test' and `gettext-macros.test'.
+       * aclocal.m4: Delete, it's auto-generated now.
+       * configure: Likewise.
+       * Makefile.in: Likewise.
+       * doc/Makefile.in: Likewise.
+       * m4/Makefile.in: Likewise.
+       * tests/Makefile.in: Likewise.
+       * lib/Makefile.in: Likewise.
+       * lib/am/Makefile.in: Likewise.
+       * lib/Automake/Makefile.in: Likewise.
+       * lib/Automake/tests/Makefile.in: Likewise.
+       * .gitignore: Correctly ignored the autogenerated files
+       that are not committed anymore.
+
+2011-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        hacking: distribute it, and mention it in the ChangeLog
        Not distributing the HACKING file might make it more difficult,
        for some random curious user, to get informed about or interested
        unistd.h to be present (it is not present when compiling with,
        e.g., MSVC 9).
 
+2011-12-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure on MSYS/MinGW and Cygwin
+       * tests/primary-prefix-couples-force-valid.test (Makefile.am):
+       Correctly append $(EXEEXT) to the path of built binaries.
+
 2011-12-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        test defs: hack to support autoconf-wrapper programs
-       * tests/defs.in ($AUTOCONF): Add a dummy `-B' option to the
-       autoconf invocation, so that, when the Debian autoconf wrapper
-       is involved, it will correctly dispatch an autoconf >= 2.50
-       instead of defaulting to autoconf 2.13.
+       * tests/defs-static.in ($AUTOCONF): Add a dummy `-B' option to the
+       autoconf invocation, so that, when the Debian autoconf wrapper is
+       involved, it will correctly dispatch an autoconf >= 2.50 instead of
+       defaulting to autoconf 2.13.
        ($AUTOHEADER, $AUTORECONF): Likewise, but for autoheader and
        autoreconf respectively.
        Reported by Bruno Haible:
        * tests/remake-am-pr10111.test: Make executable.
        * tests/remake-m4-pr10111.test: Likewise.
 
+2011-12-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc/lex tests: remove an unneeded workaround for bug#8485
+
+       * tests/yacc-d-cxx.test: Remove the workaround previously required
+       to avoid spurious failures due to automake bug#8485: that bug has
+       been solved with commit `v1.11-512-g40c3432'.
+
+2011-12-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc/lex tests: avoid too much failures with FreeBSD make
+
+       In various Yacc/Lex tests, we used to run "make distcheck" commands
+       whose value was mostly dubious, and, even when it was there, was
+       very, very little.  The presence of these extra distchecks had two
+       disadvantages: it slowed down our already-too-slow testsuite even
+       more, and, much worse, caused a lot of extra failures with FreeBSD,
+       all due to automake bug#7884, which is already exposed by the test
+       case `yacc-dist-nobuild.test'.
+
+       We can improve this situation by simply removing "make distcheck"
+       calls from a few testcases, or making them conditional to the use
+       of GNU make.
+
+       * tests/lex-clean-cxx.test: Do not call "make distcheck".
+       * tests/lex-clean.test: Likewise.
+       * tests/yacc-clean-cxx.test: Likewise.
+       * tests/yacc-clean.test: Likewise.
+       * tests/yflags-force-override.test: Likewise.
+       * tests/yacc-nodist.test: Only run "make distcheck" if make
+       is GNU make.
+
+2011-12-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Merge branch 'maint' into 'yacc-work'
+       * tests/silent-lex.test: Provide a dummy `yywrap()' function, to
+       avoid link errors on systems that doesn't provide a "lex library".
+       See also commit `v1.11-546-gca0ba5d'.
+
 2011-12-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        readme: reference webpages for automake mailing lists
        * HACKING (Release procedure): ... state here that "make check"
        and "make distcheck" should be run before calling "make git-dist".
 
+2011-12-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in 'color2.test'
+       * tests/color2.test: (expect-make): Add an "expect eof" directive,
+       so that the collected output from the spawned make program will be
+       displayed on stdout, as desired.
+       Since we are at it, also correctly remove a temporary file which
+       we was trying to delete using a wrong filename.
+       Problem introduced in merge `v1.11-1579-g8d3466c', probably by a
+       botched edit or conflict resolution.
+
+2011-12-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in 'lex3.test'
+       * tests/lex3.test (foo.l): Remove duplicated definition of
+       `yywrap'.  Problem introduced in merge `v1.11-1579-g8d3466c'.
+
 2011-12-09  Jim Meyering  <meyering@redhat.com>
            Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        since that induced inordinately large virtual memory usage when
        merely decompressing.  Instead, use its XZ_OPT envvar, defaulting
        to -e if not defined.  Suggested by Lasse Collin.
-       (dist, dist-all) [?XZ?]: Likewise
        (dist-bzip2): Similarly, do not hard-code -9, but do continue to
        use -9 by default.  Honor the BZIP2 envvar.
-       (dist, dist-all) [?BZIP2?]: Likewise
        * NEWS: Update.
        * doc/automake.texi (The Types of Distributions): Describe the
        newly enabled environment variables.
        * tests/uninstall-fail.test: Always use `$rm_f_is_silent_on_error'
        instead of the bogus `$rm_f_is_silent_on_failure'.
 
+2011-11-19  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * lib/install-sh: Spelling fix in comment.
+
 2011-11-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: avoid a spurious failure of 'ltinit.test' MinGW
        Yikes.  Cater to this incompatibility, by relaxing the test when
        a faulty `rm' is detected.
 
+2011-11-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: various minor tweakings, mostly related to AM_PROG_AR
+       * tests/alloca2.test: Ensure we don't experience a spurious failure
+       due to a missing `AM_PROG_AR' macro or a missing `ar-lib' auxiliary
+       script.
+       * tests/libtool4.test: Likewise.
+       * tests/ldadd.test: Likewise.  Since we are at it, make grepping of
+       automake stderr stricter.
+       * tests/reqd2.test: Likewise.
+       * tests/pr211.test: Ensure automake fails also with `-Wnone', since
+       the error we are testing for is an hard error, not a mere warning.
+       * tests/syntax.test: Likewise, and ensure we don't fail to other
+       errors by removing use of `lib_LTLIBRARIES' in Makefile.am.  Since
+       we are at it, make grepping of automake stderr stricter.
+
+2011-11-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       ar-lib: fix configure output for "unrecognized archiver interface"
+       * m4/ar-lib.m4: Ensure that, even when an error is hit while trying
+       to determine the archiver interface kind, the "checking archiver
+       interface" message from configure is properly terminated before
+       an error message is printed, to avoid slightly garbled output.
+       * tests/ar4.test: Enhance.
+       * tests/ar5.test: Likewise.
+
+2011-11-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       warnings: fix buglets for portability warnings
+       * lib/Automake/ChannelDefs.pm (switch_warning): Ensure the
+       correct implications and inter-dependencies between warnings
+       in the categories `portability', `extra-portability' and
+       `recursive-portability' are respected.  Also add detailed
+       explicative comments, and references to the relevant tests.
+       * tests/dollarvar2.test: Update and extend.  Also, remove
+       some unnecessary uses of `--force' option in automake calls.
+       * tests/extra-portability3.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-11-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: extend tests on 'extra-portability' warning category
+       * tests/extra-portability.test: Redefine `$AUTOMAKE' to ensure we
+       have complete control over the automake options.  Extend by using
+       also a setup where no `portability' warning is present (only an
+       `extra-portability' warning is).  Other minor extensions.  Remove
+       some redundant, verbose comments about the expected diagnostic.
+
+2011-11-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: various minor tweakings, mostly related to AM_PROG_AR
+       * tests/alloca.test: Adjust to new portability requirements due
+       to the new AM_PROG_AR macro.
+       * tests/discover.test: Likewise.
+       * tests/libobj3.test: Likewise.
+       * tests/pluseq7.test: Likewise.  Also, make grepping of automake
+       expected error message stricter.
+       * tests/stdlib.test: Likewise, and extend the test a bit.
+       * tests/parse.test (configure.in): Remove redundant call to
+       AC_PROG_RANLIB.
+       * tests/library2.test: Adjust to new portability requirements
+       due to the new AM_PROG_AR macro.  Also ...
+       (configure.in): ... add call to AC_PROG_CC, to ensure automake
+       really fails for the expected reason.
+
+2011-11-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       ar-lib: fix configure output for "unrecognized archiver interface"
+       * m4/ar-lib.m4: Ensure that, even when an error is hit while trying
+       to determine the archiver interface kind, the "checking archiver
+       interface" message from configure is properly terminated before
+       an error message is printed, to avoid slightly garbled output.
+       * tests/ar4.test: Enhance.
+       * tests/ar5.test: Likewise.
+
+2011-11-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more faithful 'installcheck' support in few tests
+       * tests/ar-lib5a.test: Use the `$am_scriptdir' variable instead
+       of "$testsrcdir/../lib" or "$top_testsrcdir/lib", to test more
+       faithfully under "make installcheck".
+       * tests/ar-lib5a.test: Likewise.
+       * tests/libobj-basic.test: Likewise.
+       * tests/libobj19.test: Likewise.
+       * tests/suffix5.test: Likewise.
+
+2011-11-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundant settings of `errexit' shell flag
+       * tests/aclocal-path-install-serial.test: Do not set the
+       `errexit' shell flag, as it is already set by `tests/defs'.
+       * tests/ar-lib2.test: Likewise.
+       * tests/ar-lib3.test: Likewise.
+       * tests/ar-lib4.test: Likewise.
+       * tests/ar-lib5a.test: Likewise.
+       * tests/ar-lib5b.test: Likewise.
+       * tests/ar-lib6a.test: Likewise.
+       * tests/ar-lib6b.test: Likewise.
+       * tests/ar-lib7.test: Likewise.
+       * tests/ar3.test: Likewise.
+       * tests/ar4.test: Likewise.
+       * tests/ar5.test: Likewise.
+       * tests/extra-portability.test: Likewise.
+       * tests/extra-portability2.test: Likewise.
+       * tests/extra-portability3.test: Likewise.
+       * tests/install-info-dir.test: Likewise.
+       * tests/maintmode-configure-msg.test: Likewise.
+
+2011-11-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       generated tests: avoid extra "FIXME" comments
+       * tests/gen-testsuite-part: Avoid putting too much "FIXME"
+       comments in the generated test scripts, since they end up
+       being just counter-productive noise when one has to grep
+       the test scripts looking for real "FIXME" items.
+
+2011-09-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetics: fix typo in 'prove-runner' script
+       * tests/prove-runner: Remove erroneously-repeated word.
+       * THANKS: Update.
+       Reported by Dave Hart.
+
+2011-11-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Merge branch 'master' into testsuite-work
+       * tests/extra-portability.test: Use `$am_original_AUTOMAKE'
+       instead of the obsolete `$original_AUTOMAKE'.
+       * tests/extra-portability3.test: Likewise.
+       * tests/list-of-tests.mk: Update.
+
+2011-11-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Merge branch 'msvc' into master
+       * tests/extra-portability3.test: Use `$original_AUTOMAKE' instead
+       of hackishly extracting the first component of `$AUTOMAKE'.
+       * tests/extra-portability.test: Likewise.  Also, since we are at
+       it, throw in a couple of small extensions and tweakings (suggested
+       by the minor merge conflicts).
+
+2011-11-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       warnings: fix buglets for portability warnings
+       * lib/Automake/ChannelDefs.pm (switch_warning): Ensure the
+       correct implications and inter-dependencies between warnings
+       in the categories `portability', `extra-portability' and
+       `recursive-portability' are respected.  Also add detailed
+       explicative comments, and references to the relevant tests.
+       * tests/dollarvar2.test: Update and extend.  Also, remove
+       some unnecessary uses of `--force' option in automake calls.
+       * tests/extra-portability3.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-11-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: extend tests on 'extra-portability' warning category
+       * tests/extra-portability.test: Redefine `$AUTOMAKE' to ensure we
+       have complete control over the automake options.  Extend by using
+       also a setup where no `portability' warning is present (only an
+       `extra-portability' warning is).  Other minor extensions.  Remove
+       some redundant, verbose comments about the expected diagnostic.
+
+2011-11-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: new functions to analyze configure help screen
+       * tests/defs (extract_configure_help, grep_configure_help): New
+       functions.
+       * tests/maintmode-configure-msg.test: Use them, reducing code
+       duplication and test brittleness.
+       * tests/help-depend.test: Likewise.
+       * tests/help-depend2.test: Likewise.
+       * tests/help-dmalloc.test: Likewise.
+       * tests/help-lispdir.test: Likewise.
+       * tests/help-multilib.test: Likewise.
+       * tests/help-python.test: Likewise.
+       * tests/help-regex.test: Likewise.
+       * tests/help-silent.test: Likewise.
+       * tests/help-upc.test: Likewise.
+       * tests/help-init.test: Make grepping of configure help screen
+       slightly stricter.
+       * tests/self-check-configure-help.test: New self test.
+       * tests/Makefile.am (TESTS): Add it.
+       From a report by Jim Meyering.
+
+2011-11-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Merge branch 'master' into testsuite-work
+
+       * tests/instspc.tap: Adjust to new portability requirements
+       due to the new AM_PROG_AR macro.
+       * tests/lex-lib.test: Likewise.
+       * tests/extra-portability2.test: Use `$am_original_AUTOMAKE'
+       instead of the obsolete `$original_AUTOMAKE'.
+       * tests/list-of-tests.mk: Update.
+
+2011-11-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: various minor tweakings, mostly related to AM_PROG_AR
+       * tests/alloca.test: Adjust to new portability requirements due
+       to the new AM_PROG_AR macro.
+       * tests/discover.test: Likewise.
+       * tests/libobj3.test: Likewise.
+       * tests/pluseq7.test: Likewise.  Also, make grepping of automake
+       expected error message stricter.
+       * tests/stdlib.test: Likewise, and extend the test a bit.
+       * tests/parse.test (configure.in): Remove redundant call to
+       AC_PROG_RANLIB.
+       * tests/library2.test: Adjust to new portability requirements
+       due to the new AM_PROG_AR macro.  Also ...
+       (configure.in): ... add call to AC_PROG_CC, to ensure automake
+       really fails for the expected reason.
+
+2011-11-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Merge branch 'msvc' into master
+
+       * tests/instspc-tests.sh: Adjust to new portability requirements
+       due to the new AM_PROG_AR macro.
+       * tests/libobj-basic.test: Likewise.
+       * tests/libobj2.test: Likewise.
+       * tests/libobj15a.test: Likewise.
+       * tests/libobj15b.test: Likewise.
+       * tests/libobj15c.test: Likewise.
+       * tests/libobj16a.test: Likewise.
+       * tests/libobj16b.test: Likewise.
+       * tests/libobj17.test: Likewise.
+       * tests/libobj18.test: Likewise.
+       * tests/libobj19.test: Likewise.
+       * tests/libobj20a.test: Likewise.
+       * tests/libobj20b.test: Likewise.
+       * tests/libobj20c.test: Likewise.
+       * tests/canon6.test: Likewise.
+       * tests/canon6.test: Likewise.
+       * tests/canon7.tests: Likewise.
+       * tests/extra9.test: Likewise.
+       * tests/extradep.test: Likewise.
+       * tests/extradep2.test: Likewise.
+       * tests/posixsubst-ldadd.test: Likewise.
+       * tests/posixsubst-libraries.test: Likewise.
+       * tests/posixsubst-ltlibraries.test: Likewise.
+       * tests/python-virtualenv.test: Likewise.
+       * tests/vartypos.test: Likewise.
+       * tests/vartypo2.test: Likewise.
+       * tests/suffix.test: Update to take into account previous
+       master-only changes.
+       * tests/suffix2.test: Likewise.
+       * tests/libobj7.test: Call automake with the `--add-missing'
+       option, instead of creating a dummy `ar-lib' file, since this
+       test now also runs "./configure" and "make".
+       * tests/suffix5.test: Copy the real `ar-lib' script file,
+       instead of creating a dummy one, since this test now also
+       runs "./configure" and "make".
+       * tests/extra-portability2.test: Fix this test not to rely
+       on the older, faulty semantics of "strictness specification
+       always reset warning level", which has been fixed in commit
+       v1.11-623-g1609491 (see also automake bug#7669 a.k.a. PR/547).
+       Since we are at it, throw inf few other minor unrelated
+       improvements.
+       * tests/extra-portability.test: Explicitly pass `-Wall' to
+       automake calls, for clarity.
+
+2011-10-21  Peter Rosin  <peda@lysator.liu.se>
+
+       warnings: new 'extra-portability' category, for AM_PROG_AR
+       * lib/Automake/ChannelDefs.pm: Register new extra-portability
+       warning channel.
+       (switch_warning): Turn off extra-portability if portability is
+       turned off, and turn on portability if extra-portability is
+       turned on.
+       (set_strictness): Silence extra-portability for --gnits, --gnu
+       and --foreign.
+       * tests/extra-portability2.test: New test, checking that the
+       extra-portability channel is silenced by --gnits, --gnu and
+       --foreign.
+       * doc/automake.texi (Invoking Automake): Document the new warning
+       category and its interaction with the portability category.
+       * tests/extra-portability.test: New test, checking the interaction
+       between the portability and extra-portability warning categories.
+       * automake.in (handle_libraries, handle_ltlibraries): Move the
+       AM_PROG_AR warnings to the new extra-portability channel.
+       * tests/ar2.test: Adjust to the new warning channel.
+       * tests/pr300-lib.test: Likewise.
+       * tests/pr300-ltlib.test: Likewise.
+       * tests/pr307.test: Likewise.
+       * tests/pr401.test: Likewise.
+       * tests/pr401b.test: Likewise.
+       * tests/pr401c.test: Likewise.
+       * tests/pr72.test: Likewise.
+       * NEWS: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-10-21  Peter Rosin  <peda@lysator.liu.se>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+           Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Add new 'AM_PROG_AR' macro, triggering the 'ar-lib' script.
+       * m4/ar-lib.m4: New macro AM_PROG_AR, which locates an
+       archiver and triggers the auxiliary 'ar-lib' script if needed.
+       * m4/Makefile.am (dist_m4data_DATA): Update.
+       * automake.in ($seen_ar): New variable.
+       (scan_autoconf_traces): Set it.
+       (handle_libraries, handle_ltlibraries): Require AM_PROG_AR for
+       portability.
+       * doc/automake.texi (Public Macros): Mention the new
+       'AM_PROG_AR' macro.
+       (Subpackages): Add AM_PROG_AR to the example.
+       (A Library): Adjust recommendations for AR given the new
+       AM_PROG_AR macro.
+       * All relevant tests: Adjust to new portability requirements due
+       to the new AM_PROG_AR macro.
+       * tests/ar-lib2.test: New test, checking that AM_PROG_AR triggers
+       install of ar-lib.
+       * tests/ar-lib3.test: New test, checking that lib_LIBRARIES
+       requires AM_PROG_AR.
+       * tests/ar-lib4.test: New test, checking that lib_LTLIBRARIES
+       requires AM_PROG_AR.
+       * tests/ar-lib5a.test: New test, checking that AM_PROG_AR triggers
+       use of ar-lib when the archiver is Microsoft lib.
+       * tests/ar-lib5b.test: New test, checking that AM_PROG_AR triggers
+       use of ar-lib when the archiver is a faked lib.
+       * tests/ar-lib6a.test: New test, checking the ordering of
+       AM_PROG_AR and LT_INIT.
+       * tests/ar-lib6b.test: New test, checking the ordering of
+       AM_PROG_AR and AC_PROG_LIBTOOL.
+       * tests/ar-lib7.test: New test, checking that automake warns
+       if ar-lib is missing.
+       * tests/ar3.test: New test, checking that AR and ARFLAGS may
+       be overridden by the user even if AM_PROG_AR is used.
+       * tests/ar4.test: New test, checking that AM_PROG_AR bails out
+       if it cannot determine the archiver interface.
+       * tests/ar5.test: New test, checking that AM_PROG_AR runs its
+       optional argument if it cannot determine the archiver interface.
+       * tests/defs.in: New required entry 'lib'.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
 2011-11-03  Zack Weinberg <zackw@panix.com>  (tiny change)
            Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        * THANKS: Likewise.
        Report by Jonathan Nieder.
 
+2011-10-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: new function 'am_keeping_testdirs', for better APIs
+
+       This change is meant to make it easier for TAP-based test scripts
+       to remove files left over by completed (sub)tests, while still
+       honoring the user-provided `$keep_testdirs' setting.
+
+       * tests/defs (am_keeping_testdirs): New function, telling whether
+       we should keep the test directories around, even in case of
+       success (by default, we don't).
+       (exit trap): Use it.
+       * tests/depmod.tap: Likewise.
+       * tests/instspc.tap: Likewise.  Also, fix some pre-existing
+       "copy & paste" bugs, and a typo in comments.
+
+2011-10-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundant `set -e', and other minor improvements
+       * tests/dejagnu-absolute-builddir.test: Do not set the `errexit'
+       shell flag, as it is already set by `tests/defs'.
+       * tests/dejagnu-relative-srcdir.test: Likewise.
+       * tests/dejagnu-siteexp-append.test: Likewise.
+       * tests/dejagnu-siteexp-useredit.test: Likewise, and fix a typo
+       in comments.
+       * tests/dejagnu-siteexp-extend.test: Likewise, and prefer the
+       use of `$distdir' over hard-coded `$me-1.0'.  Also ...
+       (write_check_for): ... use `unindent' when writing from an
+       here-doc, for better code indentation.
+
 2011-10-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        deps: partially revert commit `v1.11-512-geeee551'
        * tests/Makefile.am (XFAIL_TESTS): Add lex-subobj-nodep.test,
        remove yacc-dist-nobuild-subdir.test.
 
+2011-10-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: few improvements to some `ar-lib' related tests
+
+       * tests/ar-lib5a.test (Makefile.am): Also check that the target
+       library has truly been created.
+       (ar-lib): Use the real `ar-lib' script (mildly patched) rather
+       than a dummy one, to ensure better "real-life coverage".  Fix
+       botched shebang line.
+       * tests/ar-lib5b.test: Extend the PATH variable to make the dummy
+       `lib' script accessible, instead of explicitly calling it by its
+       relative/absolute path.
+       (ar-lib): Fix botched shebang line.
+       (bin/lib): Likewise.  Also, add explicative comments, and make
+       slightly stricter.
+
+2011-10-24  Peter Rosin  <peda@lysator.liu.se>
+
+       Merge branch 'maint' into msvc
+
+       * tests/subpkg-yacc.test: Adjust to new portability requirements due
+       to the new AM_PROG_AR macro.
+
 2011-10-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        dejagnu: allow the package developer to extend site.exp
 
        * THANKS: Fix whitespace issue.
 
+2011-10-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failures due to missing 'yywrap()' function
+
+       The AC_PROG_LEX Autoconf macro does not diagnose a failure to find
+       the "lex library" expected to provide a `yywrap' function (function
+       which is required to link most lex-generated programs).  On the
+       contrary, when all the link attempts (i.e., with `-ll' and `-lfl')
+       fail, configure declares that no lex library is needed, and simply
+       proceeds with the configuration process -- only for the build to
+       possibly fail later, at make time.
+
+       This behaviour is intended; the Autoconf manual reads:
+        ``You are encouraged to use Flex in your sources, since it is
+          both more pleasant to use than plain Lex and the C source it
+          produces is portable.  In order to ensure portability, however,
+          you must either provide a function `yywrap' or, if you don't use
+          it (e.g., your scanner has no `#include'-like feature), simply
+          include a `%noyywrap' statement in the scanner's source.''
+
+       This AC_PROG_LEX behaviour is causing some spurious failures of
+       the Automake testsuite in environments which lack a proper library
+       providing `yywrap' (this happens for example on Fedora-based
+       systems).   The proper workaround is to simply provide a fall-back
+       implementation of `yywrap' in our lexers.
+
+       See also partially-overlapping commit `v1.11-871-geb147a1' (from
+       the 'testsuite-work' branch), which was motivated by similar
+       spurious failures experienced when cross-compiling.
+
+       Reported by Jim Meyering:
+       <http://lists.gnu.org/archive/html/automake-patches/2011-10/msg00092.html>
+
+       * tests/cond35.test: Provide a dummy `yywrap' function.
+       * tests/lex3.test: Likewise.
+       * tests/lexvpath.test: Likewise.
+       * tests/silent-lex-generic.test: Likewise.
+       * tests/silent-lex-gcc.test: Likewise.
+
+2011-10-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more faithful 'installcheck' support in few tests
+       * tests/test-driver-acsubst.test: Use the `$am_scriptdir'
+       variable instead of `$testsrcdir/../lib', to test more
+       faithfully under "make installcheck".
+       * tests/test-driver-cond.test: Likewise.
+       * tests/dist-auxfile.test: Likewise, and add one more use
+       of `fatal_' to report hard errors.
+       * tests/tests/dist-auxdir-many-subdirs.test: Likewise.
+
+2011-10-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundant settings of `errexit' shell flag
+       * tests/aclocal-path-install-serial.test: Do not set the
+       `errexit' shell flag, as it is already set by `tests/defs'.
+       * tests/aclocal-path-install.test: Likewise.
+       * tests/aclocal-path-nonexistent.test: Likewise.
+       * tests/aclocal-path-precedence.test: Likewise.
+       * tests/aclocal-path.test: Likewise.
+       * tests/dist-auxfile-2.test: Likewise.
+       * tests/dist-auxfile.test: Likewise.
+       * tests/distcheck-pr9579.test: Likewise.
+       * tests/javadir-undefined.test: Likewise.
+       * tests/subpkg-yacc.test: Likewise.
+       * tests/test-extensions-cond.test: Likewise.
+       * tests/test-extensions.test: Likewise.
+       * tests/uninstall-fail.test: Likewise.
+       * tests/uninstall-pr9578.test: Likewise.
+       * tests/distcheck-override-infodir.test: Likewise.  Also,
+       fix typo in heading comments since we are at it.
+
+2011-10-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       fixup: add forgotten test scripts to $(TESTS)
+       * tests/list-of-tests.mk: Add various test scripts that are in
+       the git repository but weren't correctly listed in $(TESTS).
+       The inconsistency had been caused by botched/incomplete merges,
+       and revealed by the "maintainer-check-list-of-tests" target.
+
 2011-10-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: fix spurious failure with FreeBSD make and Yacc in VPATH
        which doesn't report the `cd' builtin anywhere.  Relax the grepping
        of the error message accordingly.
 
+2011-10-20  Jim Meyering  <meyering@redhat.com>
+
+       tests: fix aclocal-print-acdir.test
+       * tests/aclocal-print-acdir.test: Adjust to pass.
+
 2011-10-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: avoid spurious failure of 'uninstall-fail.test' on Cygwin
        * THANKS: Update.
        Reported by Дилян Палаузов.
 
+2011-10-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       refactor: improve signature of 'check_directory' sub in automake
+       * automake.in (check_directory): Take the relative directory
+       the directory to be checked is expected to be found into as
+       an optional parameter, rather than reading it from the global
+       variable `$relative_dir'.
+       (scan_autoconf_traces, check_directories_in_var): Adjust.
+
+2011-10-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetics: remove obsolete comment
+       * automake.in (push_required_file): Remove "FIXME" comment stating
+       that the special handling of `$config_aux_dir' breaks threaded
+       automake: this is not true anymore after the recent commits (see
+       in particular commit `v1.11-1225-gf672944').
+
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure with Solaris /bin/sh
+       * tests/dist-auxfile.test: Don't use redirected `:' in a loop,
+       it hits a bug in Solaris 10 /bin/sh.
+
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       threaded-am: better serialization for required config files
+       With this change, we make serialization/de-serialization of
+       required config files installs more granular, and in the process
+       fix the bug introduced by commit `v1.11-1219-g326ecba'.
+       * automake.in ($required_conf_file_queue): Move its declaration
+       earlier.
+       (require_file_internal): Add a new argument telling whether the
+       function should act immediately or queue its action for the master
+       thread to handle.
+       (queue_required_conf_file): Renamed ...
+       (queue_required_file_check_or_copy): ... to this.
+       (require_queued_conf_file): Renamed ...
+       (require_queued_file_check_or_copy): ... to this, and make it call
+       `required_file_check_or_copy' instead of `require_file_internal'.
+       (require_conf_file, handle_makefiles_threaded): Adjust and simplify
+       accordingly.
+       * tests/Makefile.am (XFAIL_TESTS): Remove `parallel-am.test'.
+
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       automake: refactor, break up 'require_file_internal'
+       This refactoring is only required in view of future changes.
+       * automake.in (require_file_internal): Move the guts of this
+       function ...
+       (required_file_check_or_copy): ... into this new function.  This
+       ensures that calls to `push_required_file' and code that copies
+       required files are placed in separate functions; this will be
+       very useful for reorganizing de-serialization of file installs
+       in future changes.
+
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       dist: separate auxiliary file instantiation from DIST_COMMON update
+       This change simplifies the automake internals dealing with the
+       checking, copying and distributing of required auxiliary files.
+       With this change, a required auxiliary file is *unconditionally*
+       added to the contents of the DIST_COMMON variable in the generated
+       Makefile.in, before checking whether it exists, or trying to copy
+       it (if `--add-missing' is in use).  This shouldn't be a problem,
+       since if the checking or copying of the file fails, automake will
+       bail out, the Makefile.in won't be created, and thus its content
+       will not matter.  OK, this is not completely true when threaded
+       automake is in use, but then, such a situation was also possible
+       before this patch, so no regression here, which is enough for us.
+       This change is the first of a series of steps aimed at fixing
+       the regression introduced in threaded automake usage by commit
+       `v1.11-1219-g326ecba'.
+       * automake.in (require_file_internal): Add the required file to
+       DIST_COMMON unconditionally.
+       * tests/missing-auxfile-stops-makefiles-creation.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       refactor: rename a subroutine to a more proper name
+       * automake.in (maybe_push_require_file): Renamed ...
+       (push_required_file): ... to this.
+       All callers adjusted.
+
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       dist: truly always distribute files in AC_REQUIRE_AUX_FILE
+       This change fixes automake bug#9651.
+       * automake.in (handle_dist): Files whose distribution is required
+       by configure.ac are now correctly distributed even if the build-aux
+       directory coincides with the top-level directory.
+       * tests/Makefile.am (XFAIL_TESTS): Remove `dist-auxfile.test'.
+       * NEWS: Update.
+
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       dist: simplify automake code accordingly to the previous changes
+       After the previous change `v1.11-1219-g326ecba', every Makefile.am
+       requiring a file in the "config auxdir" will cause it to be listed
+       in the DIST_COMMON variable of the corresponding generated
+       Makefile.in, not only of the top-level Makefile.in.  Thus we don't
+       need to worry anymore about trying to distribute files in the
+       config auxdir from the top-level Makefile or the Makefile in
+       config auxdir (if any).  This allows us to carry out some useful
+       simplifications in the automake script.
+       This will however cause some changes in the generated Makefile;
+       for example, if the `PROGRAMS' primary is used only in a subdir
+       Makefile.am, the `depcomp' script will be distributed only by
+       `subdir/Makefile', not by the top-level Makefile.  This change
+       can be seen as an internal detail though, and definitely warranted
+       by the nice simplifications the current commit provides.
+       * automake.in ($automake_will_process_aux_dir): Variable removed.
+       (scan_autoconf_files): Adjust and simplify.
+       (handle_makefiles_threaded): Likewise.
+       (get_number_of_threads): Likewise.
+       (require_file_internal): Likewise.
+       (maybe_push_required_file): Its return value is not used anymore,
+       so return nothing.  Add special handling for distributed files from
+       `$config_libobj_dir'.  Also, catch "this can't happen" situations,
+       and abort accordingly.  Fix function description to better fit its
+       new role.
+       * tests/libobj19.test: Extend to also check situations where the
+       Makefile.am using $(LIBOBJS) is not the top-level one.
+       * tests/distcom6.test: Delete, merged into ...
+       * tests/distcom2.test: ... this test, which has been update to
+       account for the changed automake semantics.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
+2011-10-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       dist: auxiliary files can be distributed from subdir Makefiles
+       With this change, we make it possible for a subdir Makefile.am
+       to distribute files in the config auxdir; while this means that
+       some files might be copied multiple times, it simplify some logic
+       in the automake script, and fix at least one important bug.  In
+       fact, before this change, the auxiliary script `test-driver' was
+       not being distributed as expected when TESTS was defined only in
+       a subdir Makefile (which is a pretty common setup indeed).  Now
+       this does not happen anymore: so the present change fixes automake
+       bug#9546.
+       Another welcome collateral effect is that `dist-auxfile-2.test'
+       now passes.
+       OTOH, the present changes *breaks threaded automake*.  The reason
+       is that automake needs to serialize file installations spawned
+       by `--add-missing' (this isn't for cosmetic reasons, but is
+       really needed to avoid possible race conditions and botched output
+       files).  Currently the code that installs required files is
+       intertwined with the code that declares the DIST_COMMON variables;
+       so, upon de-serialization, the definition of DIST_COMMON might get
+       emitted in the wrong Makefile.in.
+       Some follow-up refactoring in automake will soon take care of
+       remedying this situation.  For the moment, we just declare some
+       "parallel-am" tests as xfailing.
+       * automake.in (maybe_push_required_file): Add ad-hoc handling for
+       the case where the directory part of the required file is different
+       from the subdir where the current Makefile.am resides, but is equal
+       to the "config-aux directory" ($config_auxdir).  This is needed to
+       allow a construct in a non-top-level Makefile.am to require a file
+       in the config-aux directory.
+       * tests/test-driver-is-distributed.test: Extend and adjust.  This
+       test now passes.
+       * tests/java-compile-run-nested.test: Call automake with the `-a'
+       option to ensure that the `test-driver' auxiliary script gets
+       correctly installed.  This test now passes.
+       * tests/distcom-subdir.test: New test.
+       * tests/dist-readonly.test: Likewise.
+       * tests/dist-repeated.test: Likewise.
+       * tests/dist-auxdir-many-subdirs.test: Likewise.
+       * tests/distcom7.test: Removed, it's obsolete now.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
+2011-10-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: conditional contents in LOG_DRIVER variables
+       * tests/test-driver-cond.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-10-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: LOG_DRIVER variables can be defined through AC_SUBST
+       * tests/test-driver-acsubst.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
 2011-10-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        parallel-tests: warn on conditional TEST_EXTENSIONS definition
        (is_valid_test_extension): ... into this subroutine.  Don't allow
        generic @substitutions@ anymore (possibly making an exception for
        `@EXEEXT@' under the proper circumstances).
-       * tests/test-extensions.test: Adjust and extend.
+       * tests/test-extensions.test: Adjust and extend.  This test does
+       not cause any internal error in automake anymore now.
 
 2011-10-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        complaints from the `sc_no_brace_variable_expansions' maintainer
        check.
 
+2011-10-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       * tests/yacc-dist-nobuild.test: Add reference to relevant bug#7884.
+
+2011-10-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious error in 'test-extensions.test'
+       * tests/test-extensions.test: Call automake with the option
+       `--add-missing', to ensure the required script `test-driver'
+       gets installed.  Note that the test still fails due to an
+       internal error in automake, though.
+
+2011-10-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid few useless uses of the `-e' make option
+       * tests/python12.test: Using `make -e' is not required to override
+       the DESTDIR variable, since this variable shouldn't be defined in
+       any automake-generated Makefile.in file.
+       * tests/man2.test: Likewise.
+       * tests/man5.test: Likewise.
+
 2011-10-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        fix: make a test script executable
 
 2011-09-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       tap/awk: improve comments about Korn shell signal handling issues
+       * lib/tap-driver.sh: Link an Austin Group discussion about how
+       shells are allowed, and even encouraged, to set the special
+       variable `$?' to values greater than 256 to report termination
+       of a child by a signal.  Improve and extend comments about our
+       workarounds for unusual korn shell signals' propagation.
+       Thanks to Eric Blake for the pointers.
+
+2011-09-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        maintcheck: fix usage of `cd' instead of `$(am__cd)'
        * lib/am/inst-vars.am (am__uninstall_files_from_dir): Use
        `$(am__cd)', not plain `cd'.
 
+2011-09-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: account for unusual korn shell signal handling behaviour
+       This change has been motivated by a testsuite failure on Debian
+       with the AT&T Korn Shell version 93u-1.
+       * lib/tap-driver.sh: Temporarily ignore some common signals when
+       waiting for the test command to complete, to avoid premature exit
+       in Korn shells that propagate to themselves signals that have
+       killed a child process.
+       See also related commit `v1.11-1342-g6321ad3'.
+
+2011-09-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: handle exit statuses > 256 (seen on few korn shells)
+       Some Korn shells, when a child process die due to signal number
+       n, can leave in $? an exit status of 256+n instead of the more
+       standard 128+n.  Apparently, both behaviours are allowed by
+       POSIX, so be prepared to handle them both.
+       This change has been motivated by a testsuite failure on Debian
+       with the AT&T Korn Shell version 93u-1.
+       * lib/tap-driver.sh (get_test_exit_message): Handle the described
+       Korn Shell behaviour too.
+       ($scriptversion): Update.
+
+2011-09-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundant workaround for Solaris /bin/sh
+       After previous commit `v1.11-1424-g27a399a', some workarounds for
+       Solaris 10 /bin/sh are no more required, and in fact they have
+       started causing XPASS results on Solaris.
+       * tests/tap-signal.tap: Remove unneeded workarounds for Solaris 10
+       /bin/sh.  Some related minor code reorganizations.
+
 2011-09-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        uninstall: "make uninstall" before "make install" works
        * tests/aclocal-path-precedence.test: Call `$ACLOCAL' with the
        proper overridden system acdir.
 
+2011-09-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failures in tests on TAP + signals
+       * tests/tap-signal.tap: Write the dummy test scripts as perl
+       scripts, not as shell scripts, to work around unportabilities
+       in the handling of signals.  In fact, even with bash, the older
+       script were unable to properly deliver a SIGQUIT to themselves
+       consistently.
+
+2011-09-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in test on ACLOCAL_PATH precedences
+       * tests/aclocal-path-precedence.test: Do not merely append to
+       `configure.in', it should be created from scratch.  Pass package
+       name and version to AC_INIT as arguments, otherwise autoconf will
+       complain.
+
+2011-09-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: remove mention of deprecated option `--acdir'
+       * doc/automake.texi (aclocal Options): Remove mention of
+       deprecated `--acdir' option.
+
+2011-09-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       * NEWS: Cleanup after botched merges.
+
 2011-09-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        * NEWS: Fix typo.
        * tests/Makefile.am (TESTS): Add it.
        * NEWS: Update.
 
-2011-09-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-09-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       cosmetics: fix various typos and grammaros
-       * NEWS: Fix typos.
-       * tests/py-compile-basic.test: Likewise.
-       * tests/py-compile-basedir.test: Fix botched wording in comments.
-       * tests/py-compile-option-terminate.test: Fix typo and incomplete
-       comment.
-       Suggestions by Peter Rosin.
+       parallel-tests: expose automake bug#9546
+       * tests/test-driver-is-distributed.test: New test.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Add it.
 
 2011-09-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       coverage: test interactions of `nobase_' and `nodist_'
-       * tests/nobase-nodist.test: New test.
-       * tests/Makefile.am (TESTS): Add it.
+       py-compile tests: more faithful 'installcheck' support
+       * tests/py-compile-basedir.test: Use the `$am_scriptsdir' variable
+       instead of `$testsrcdir/../lib', to test more faithfully under
+       "make installcheck".  More uses of the `fatal_' subroutine to
+       diagnose hard errors.
+       * tests/py-compile-basic.test: Likewise.
+       * tests/py-compile-basic2.test: Likewise.
+       * tests/py-compile-destdir.test: Likewise.
+       * tests/py-compile-env.test: Likewise.
+       * tests/py-compile-option-terminate.test: Likewise.
+       * tests/py-compile-usage.test: Likewise.
 
 2011-09-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       java: fix various blunders in test 'java-mix.test'
-       * tests/java-mix.test: Add missing call to `set -e'.  Fix inverted
-       semantics (`.java' files are expected *not* to be distributed by
-       default, not the other way round).  Fix various typos in the name
-       of the `.java' files.  Correct other minor blunders.  Improve some
-       comments.
-
-2011-04-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
-
-       java: allow both JAVA and nobase_JAVA in the same Makefile.am
-       * automake.in (handle_java): Also strip `nobase_' from the given
-       prefix, when needed.
-       * tests/java-clean.test: Update and extend.
+       tests: remove redundant settings of `errexit' shell flag
+       * tests/aclocal-acdir.test: Do not set the `errexit' shell
+       flag, as it is already set by `tests/defs'.
+       * tests/aclocal-print-acdir.test: Likewise.
+       * tests/distcheck-missing-m4.test: Likewise.
+       * tests/distcheck-outdated-m4.test: Likewise.
+       * tests/java-clean.test: Likewise.
        * tests/java-compile-install.test: Likewise.
+       * tests/java-compile-run-flat.test: Likewise.
+       * tests/java-compile-run-nested.test: Likewise.
+       * tests/java-mix.test: Likewise.
        * tests/java-no-duplicate.test: Likewise.
+       * tests/java-nobase.test: Likewise.
+       * tests/java-rebuild.test: Likewise.
        * tests/java-sources.test: Likewise.
-       * tests/java-noinst.test: Likewise.
-       * tests/java-mix-dist-nodist.test: Renamed to ...
-       * tests/java-mix.test: ... this, and extended.
-       * tests/java-nobase.test: New test, still xfailing due to
-       unrelated issues.
-       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+       * tests/java-uninstall.test: Likewise.
+       * tests/javaflags.test: Likewise.
+       * tests/nobase-nodist.test: Likewise.
+       * tests/py-compile-basedir.test: Likewise.
+       * tests/py-compile-basic.test: Likewise.
+       * tests/py-compile-basic2.test: Likewise.
+       * tests/py-compile-destdir.test: Likewise.
+       * tests/py-compile-env.test: Likewise.
+       * tests/py-compile-option-terminate.test: Likewise.
+       * tests/py-compile-usage.test: Likewise.  Since we are at it,
+       add an extra blank line, for clarity.
 
-2011-04-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-09-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       java: allow both dist_JAVA and nodist_JAVA in the same Makefile.am
-       Fixes automake bug#8434.
-       * automake.in (handle_java): Strip `dist_' and `nodist_' from
-       the given prefix.  Define a new internal Makefile variable
-       `am__java_sources'.  Related adjustments.
-       * lib/am/java.am (JAVAC, JAVAROOT, CLASSPATH_ENV): Define only the
-       first time this am file is processed.
-       (class%DIR%.stamp): Stamp file renamed ...
-       (class%NDIR%.stamp): ... to this, so that the `dist_' and `nodist_'
-       prefixes are stripped from the name of the stampfile.  Adjust
-       declaration of dependencies by using the new automake-generated
-       internal variable `$(am__java_sources)'.  In the rule, use `$@'
-       as the name of the target, rather than hard-coding it.
-       * tests/java.test: Update and extend.
-       * tests/java-no-duplicate.test: New test.
-       * tests/java-mix-dist-nodist.test: Likewise.
-       * tests/java-compile-and-install.test: Likewise.
-       * tests/java-clean.test: Likewise.
-       * tests/java-sources.test: Likewise.
+       automake: remove special handling of `ANSI2KNR' make variable
+       * automake.in (define_configure_variable): Remove special-cased
+       handling of `ANSI2KNR' variable.  Related minor simplifications.
+
+2011-09-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: test interactions of `nobase_' and `nodist_'
+       * tests/nobase-nodist.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-09-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java: fix various blunders in test 'java-mix.test'
+       * tests/java-mix.test: Add missing call to `set -e'.  Fix inverted
+       semantics (`.java' files are expected *not* to be distributed by
+       default, not the other way round).  Fix various typos in the name
+       of the `.java' files.  Correct other minor blunders.  Improve some
+       comments.
+
+2011-09-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       automake: remove code duplication in 'handle_tests'
+       * automake.in (handle_tests): Factor out some code dealing with
+       test extensions and rules for generation of `.log' files into ...
+       (handle_per_suffix_test): ... this new subroutine.
+       * tests/parallel-tests-exeext.test: New test.
        * tests/Makefile.am (TESTS): Update.
 
+2011-09-13  Peter Rosin  <peda@lysator.liu.se>
+
+       * tests/defs [$sh_errexit_works = yes]: Output 'SIGINT' for signal 2.
+
+2011-09-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: work around 'unset' spurious non-zero return value
+       * tests/self-check-exit.tap ($init): Unset the possibly already
+       unset variable `am_explicit_skips' when the `errexit' shell flag
+       is not yet active, for the benefit of shell that return a non-zero
+       status when unsetting an already-unset variable.
+
+2011-09-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: an explicative comment on signal-related woes
+       * tests/self-check-exit.tap: Add pointer to a bug-autoconf
+       discussion explaining why this test needs to temporarily block
+       SIGINT.
+
+2011-09-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: also trap SIGQUIT; other fixes
+       Some shells seems to just ignore SIGQUIT under some circumstances,
+       even when it is not blocked; however, if the signal it trapped,
+       the trap gets correctly executed.
+       * tests/defs [$sh_errexit_works = yes]: Also trap SIGQUIT. Add
+       extensive explanation of why we do so.
+       * tests/self-check-cleanup.tap: Improve and fix to ensure that an
+       earlier failure does not prevent the rest of the test to execute.
+       Problem revealed by a failure in `self-check-cleanup.tap'.
+
+2011-09-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: work around weird ksh behaviour w.r.t. signal handling
+       * tests/defs (is_blocked_signal): Use perl to determine whether a
+       signal is trapped, since trying to do it portably within the shell
+       means opening a nasty can of worms.
+       For more information and background, see:
+        <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
+        <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
+        <http://www.cons.org/cracauer/sigint.html>
+
+2011-09-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetics: fix various typos and grammaros
+       * NEWS: Fix typos.
+       * tests/py-compile-basic.test: Likewise.
+       * tests/py-compile-basedir.test: Fix botched wording in comments.
+       * tests/py-compile-option-terminate.test: Fix typo and incomplete
+       comment.
+       Suggestions by Peter Rosin.
+
+2011-09-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundant line from a test script
+       * tests/test-log.test (fail.test): Remove extra `echo' command,
+       probably due to a past copy&paste blunder.
+
+2011-09-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: convert another test to TAP
+       * tests/primary-prefix-invalid-couples.test: Renamed ...
+       * tests/primary-prefix-invalid-couples.tap: ... to this, and
+       converted to the use of the TAP protocols (this requires only
+       very minimal changes this time).
+       * tests/list-of-tests.mk: Update.
+
 2011-09-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: fix spurious failure on fast machines
        invocations, and by always calling autoconf with the `--force'
        flag.
 
+2011-09-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: minor optimizations/simplifications in some aclocal tests
+       * acloca11.test: Instead of running ./configure and then grepping
+       the file it has produced, directly grep configure.  Add trailing
+       `:' command.
+       * acloca12.test: Likewise.
+       * acloca10.test: Likewise.  Also, remove the autom4te caches
+       by hand, instead of sleeping to ensure they get outdated and
+       ignored.
+       * aclocal9.test: Likewise.
+       * acloca18.test: Likewise.  Also, do not remove file `foo',
+       which is not being created anymore.
+       * acloca20.test: The test makes sense only if the system support
+       real symlinks, so skip it if this is not the case.  This allows
+       for various simplifications.
+
+2011-09-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       prove: avoid weird signal-related bug
+       * tests/defs (trap): In the trap code dealing with SIGPIPE
+       signal, ignore further signals of the same kind.
+       See also Test::Harness issue [rt.cpan.org #70855], archived at
+       <https://rt.cpan.org/Ticket/Display.html?id=70855>
+
+2011-09-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: allow use of `prove' to run automake testsuite
+       * tests/prove-runner: New helper script; mostly it wraps
+       our `*.test' test scripts to make them runnable by the
+       `prove' utility.
+       * tests/Makefile.am (EXTRA_DIST): Distribute it.
+       (PROVE, AM_PROVEFLAGS, AM_PROVECMD): New variables.
+       (prove, installprove): New targets, used run the automake
+       testsuite through the `prove' utility.
+       * tests/gen-testsuite-part: For any considered dependency,
+       generate a variables that groups all the tests depending on
+       it.  This is especially useful for use in the new `prove'
+       and `installprove' targets, which cannot rely on make for
+       inter-test dependencies, and have to handle them "by hand".
+
+2011-09-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests defs: more namespace-safeness
+       ($using_tap): Renamed ...
+       ($am_using_tap): ... to this.
+       ($parallel_tests): Renamed ...
+       ($am_parallel_tests): ... to this.
+       ($test_prefer_config_shell): Renamed ...
+       ($am_test_prefer_config_shell): ... to this.
+       ($original_AUTOMAKE): Renamed ...
+       ($am_original_AUTOMAKE): ... to this.
+       ($original_ACLOCAL): Renamed ...
+       ($am_original_ACLOCAL): ... to this.
+       * tests/defs, tests/defs-static.in, tests/gen-testsuite-part,
+       tests/README, and all callers: Adjusted.
+       * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Adjust, and rewrite
+       to make future adjustments easier.
+       * tests/defs (funcs_file_): Renamed ...
+       (am_funcs_file): ... to this.
+       * Makefile.am (sc_tests_obsolete_variables): New maintainer
+       check.
+       (syntax_check_rules): Add it.
+
 2011-09-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        aclocal: better URL reference in error message
        definitions, reference the automake page at `www.gnu.org', not
        at `sources.redhat.com'.
 
+2011-09-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid creating useless files in some test directories
+       * tests/aclocal.test: Define `$am_create_testdir' to "empty"
+       before sourcing ./defs, to avoid bringing in unused auxiliary
+       files.  Related adjustments.
+       * tests/aclocal3.test: Likewise.
+       * tests/aclocal8.test: Likewise.
+       * tests/aclocal9.test: Likewise.
+       * tests/acloca10.test: Likewise.
+       * tests/acloca11.test: Likewise.
+       * tests/acloca12.test: Likewise.
+       * tests/acloca15.test: Likewise.
+       * tests/acloca16.test: Likewise.
+       * tests/acloca17.test: Likewise.
+       * tests/acloca18.test: Likewise.
+       * tests/acloca20.test: Likewise.
+       * tests/acloca21.test: Likewise.
+       * tests/acloca23.test: Likewise.
+       * tests/aclocal-print-acdir.test: Likewise.
+       * tests/ar-lib.test: Likewise.
+       * tests/compile.test: Likewise.
+       * tests/compile2.test: Likewise.
+       * tests/compile3.test: Likewise.
+       * tests/compile6.test: Likewise.
+       * tests/instsh2.test: Likewise.
+       * tests/instsh3.test: Likewise.
+       * tests/mdate5.test: Likewise.
+       * tests/mdate6.test: Likewise.
+       * tests/missing3.test: Likewise.
+       * tests/missing5.test: Likewise.
+       * tests/mkinst3.test: Likewise.
+       * tests/self-check-explicit-skips.test: Likewise.
+       * tests/self-check-report.test: Likewise.
+       * tests/self-check-sanity.test: Likewise.
+       * tests/tap-driver-stderr.test: Likewise.
+
+2011-09-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: more environment cleanup
+       * tests/defs: Also unset the XFAIL_TESTS, and various
+       LOG_DRIVER, LOG_COMPILER variables (and corresponding
+       flags variable).
+
+2011-09-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: allow depmod.tap to only run a subset of its tests
+       * tests/depmod.tap: If command-line arguments are passed to the
+       tests, they are now taken as the list of test names for which the
+       checks are to be run.
+
+2011-09-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: allow instspc.tap to only run a subset of its tests
+       * tests/instspc.tap: If command-line arguments are passed to the
+       tests, they are now taken as the list of test names for which the
+       checks are to be run.
+
 2011-09-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        coverage: distcheck-hook to catch missing/outdated *.m4 files
        (EXTRA_DIST): Distribute it.
        (TESTS): Add the new tests.
 
+2011-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more granularity in variables for tools overriding
+       Among the other things, this change makes it possible to use, at
+       the same time, an autoconf version in the automake testsuite and
+       another one in the automake build system; even more importantly, it
+       makes it possible to use, say, a non-GNU make implementation in the
+       test scripts, while at the same time using GNU make to drive the
+       execution of the automake's test suite.
+       * tests/defs-static.in (TEX, EGREP, FGREP, SHELL, PERL, MAKE,
+       AUTOCONF, AUTOM4TE, AUTORECONF, AUTOHEADER, AUTOUPDATE,
+       original_AUTOMAKE, original_ACLOCAL): Allow and prefer overriding
+       through corresponding `AM_TESTSUITE_..' variables; for example,
+       $GREP can now be overridden by an exported `$AM_TESTSUITE_GREP'
+
+2011-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix `skip_row_' subroutine in tap-functions.sh
+       * tests/tap-functions.sh (skip_row_): Use `seq_', not `seq', to
+       be portable to non-GNU systems.
+       Bug revealed by a testsuite error on Solaris.
+
+2011-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       installcheck: support it in our own testsuite
+       * NEWS: Update.
+       * tests/defs-static.in ($am_running_installcheck): New variable.
+       Initialize it to a default of "no", and sanity-check its value.
+       ($am_datadir, $am_docdir, $am_automake_acdir, $am_system_acdir,
+       $am_bindir, $am_scriptdir, $am_pkgvdir): New variables,
+       initialized from AC_SUBST'ed values which are adaptively chosen
+       depending on whether the testsuite is running in "simple" mode
+       or in "installcheck" mode.
+       ($MISSING): Remove, it's not really required by the testsuite.
+       ($PATH): Update using `$am_bindir', not `$testbuilddir'.
+       * Makefile.am (installcheck-local): New target.
+       * lib/Automake/tests/Makefile.am (installcheck-local): New target.
+       (AM_TESTS_ENVIRONMENT, AM_PL_LOG_FLAGS): Adaptively choose the
+       `-I' flags for perl based on whether the tests are being run by
+       "make check" or "make installcheck".
+       * tests/Makefile.am (installcheck-local): New target.
+       (defs-static): Generate it at make time, not at configure time,
+       in order to correctly resolve all the indirections in the
+       AC_SUBST'd variables; done with the help of ...
+       (do_subst): ... this new macro.
+       (EXTRA_DIST): Explicitly distribute `defs-static.in'.
+       (CLEANFILES): Remove `defs-static'.
+       * configure.ac (AC_CONFIG_FILES): Remove `tests/defs-static'.
+       (AC_SUBST): Substitute also `automake_acdir', `system_acdir',
+       `scriptdir' and `amdir' to proper values.
+       * lib/Makefile.am (scriptdir):  Don't explicitly define anymore.
+       * lib/am/Makefile.am (amdir): Likewise.
+       * m4/acdir/dirlist: Remove, it's not needed anymore.  Instead
+       use ...
+       * m4/acdir/.placeholder: ... this file.
+       * m4/Makefile.am (EXTRA_DIST): Update.
+       (automake_acdir, system_acdir): Don't explicitly define anymore.
+       * tests/aclocal-print-acdir.test: Use new `$am_...dir' variables,
+       instead of hard-coding values with $testsrcdir and $testbuilddir,
+       to test more faithfully under "make installcheck".
+       * tests/amhello-binpkg.test: Likewise.
+       * tests/amhello-cflags.test: Likewise.
+       * tests/amhello-cross-compile.test: Likewise.
+       * tests/ansi2knr-no-more.test: Likewise.
+       * tests/autodist-stamp-vti.test: Likewise.
+       * tests/auxdir.test: Likewise.
+       * tests/check2.test: Likewise.
+       * tests/copy.test: Likewise.
+       * tests/multlib.test: Likewise.
+       * tests/obsolete.test: Likewise.
+       * tests/parallel-tests-interrupt.test: Likewise.
+       * tests/repeated-options.test: Likewise.
+       * tests/suffix5.test: Likewise.
+       * tests/tap-doc2.test: Likewise.
+       * tests/txinfo22.test: Likewise.
+       * tests/vtexi3.test: Likewise.
+       * tests/defs: Likewise.  Also, print the values of `$using_tap'
+       and `$am_running_installcheck', to simplify debugging, and do
+       some related code movings and tweakings.
+       * tests/aclocal3.test: Update to avoid possible spurious failures
+       when running under "make installcheck".
+       * tests/warnings-unknown.test: Likewise.
+       * tests/location.test: Likewise, and improve debugging input since
+       we are at it.
+       * tests/acloca10.test: Adapt and tweak to work also during a
+       "make installcheck", and not to require a pre-populated `dirlist'
+       file.
+       * tests/acloca18.test: Likewise.
+       * tests/dirlist2.test: Likewise.
+       * tests/dirlist.test: Likewise, and remove an obsolete comment.
+       * tests/README: Update.
+       * tests/dirlist-abspath.test: New test.
+       * tests/list-of-tests.mk: Update.
+
+2011-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: fix spurious failures
+       * tests/gen-testsuite-part (write_wrapper_script): More uses of
+       creative quoting in the generated tests, to avoid triggering
+       failures in the `sc_tests_Exit_not_exit' maintcheck.
+       * Makefile.am (sc_tests_tap_plan): It's OK for auto-generated
+       TAP tests that sources an hand-written one not to declare a TAP
+       plan: the sourced test will do so.
+       * tests/Makefile.am (checked_test_extensions): Don't define
+       anymore, the default value `$(TEST_EXTENSIONS)' is correct now.
+       (expected_list_of_tests): Don't define anymore, the default
+       value `$(TESTS)' is correct now.
+
 2011-09-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        aclocal: more granularity in acdir overriding
        * NEWS, bootstrap: Update.
        * doc/automake.texi (aclocal Options, Macro Search Path): Update.
 
+2011-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetic: rename gen-tests-deps -> gen-testsuite-part
+       * tests/gen-tests-deps: Renamed ...
+       * tests/gen-testsuite-part: ... to this.
+       * bootstrap: Update.
+       * tests/Makefile.am ($(srcdir)/tests-deps.am): Don't generate
+       nor include this ...
+       ($(srcdir)/testsuite-part.am): ... do with this instead.
+       * tests/.gitignore (tests-deps.am): Don't ignore this ...
+       (testsuite-part.am): ... ignore this instead.
+
+2011-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: revamp generation of autogenerated tests
+       With this change, we make generated tests be real scripts again
+       -- albeit only thin layers around the tests they wrap.  It turned
+       out that the apparently clever tricks we played by having lots
+       of custom (and auto-generated) `..._LOG_COMPILER' variables and
+       by having the tests in $(wrap_TESTS) not being real on-file-system
+       scripts caused more pain and confusion than expected, for only
+       marginal gains.  Also, that previous setup didn't interact very
+       well with "make check RECHECK_LOGS=", since the log files for
+       the "wrappee" tests were always considered out-of-date (which in
+       hindsight is natural, since these log files depended on wrappee
+       tests that didn't exist -- and weren't created).  And finally, it
+       wasn't possible to easily and naturally run the wrappee tests
+       from the command line -- definitely harmful for debugging and
+       sanity checking.
+       * tests/gen-wrap-tests: Deleted, its role subsumed into ...
+       * tests/gen-tests-deps: ... this script, with the help of
+       (unindent, atomic_write, build_matcher, write_wrapper_script,
+       %test_generators): ... these new functions and variables.
+       Other few minor fixlets and improvements.
+       * tests/wrap-tests.sh: Delete, not needed anymore.
+       * tests/Makefile.am ($(srcdir)/wrap-tests.am): Don't generate
+       nor include anymore.
+       (EXTRA_DIST): Update.
+       (wrap_TESTS): Renamed to ...
+       (generated_TESTS): ... this.
+       ($(generated_TESTS)): Must have the same dependencies of
+       `$(srcdir)/tests-deps.am'.
+       Other minor related reordering and adjustments.
+       * bootstrap: Do not generate `wrap-tests.am' anymore.
+       * tests/.gitignore (wrap-tests.am): Don't ignore anymore.
+       (*-w.test, *-w.tap): Ignore.
+       * tests/README: Update paragraph on automatically-generated
+       tests.
+
+2011-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: automatize generation of dependencies for tests
+       * tests/gen-test-deps: New script, automatically generates
+       dependencies for the tests.
+       * tests/Makefile.am (EXTRA_DIST): Distribute it.
+       ($(srcdir)/tests-deps.am): New rule.
+       (include $(srcdir)/tests-deps.am): New inclusion.
+       Remove hand-written dependencies for tests.  Other related
+       updates.
+       * tests/list-of-tests (tap_with_common_setup_TESTS,
+       tap_other_TESTS): Delete, their content merged back into ...
+       (handwritten_TESTS): ... this.
+       * tests/.gitignore (tests-deps.am): New ignored file.
+       * bootstrap: Generate `tests/tests-deps.am'.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid spurious failure due to bug in older TAP::Parser
+       Older TAP::Parser versions (e.g., 3.10) erroneously convert a test
+       number `0' into `1'; do not let this bug cause a spurious failure
+       in our testsuite.
+       * tests/tap-test-number-0.test: Skip if the aforementioned
+       TAP::Parser bug is detected.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/perl: be more portable to older perl versions
+       * lib/tap-driver.pl (trap_perl_warnings_and_errors): Do not use
+       the three-args version of the `open' builtin, it is not well
+       supported by older perl versions (at least perl 5.6.2).
+       (start): Add a no-op statement to pacify a "possible typo ... used
+       only once" perl warning.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/perl: be more portable to older TAP::Parser versions
+       * lib/tap-driver.pl (start): Do not call the `ignore_exit' method
+       on our TAP parser: it is not supported in older TAP::Parser
+       versions (e.g., 3.10), and is not really required by our usage of
+       the parser object.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious Cygwin failure of a test on TAP support
+       * tests/tap-bad-prog.tap (noexec.test): Add forgotten `echo'.
+       When trying to run it, redirect its output to /dev/null, to
+       avoid confusing automake's testsuite own TAP driver.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: fix glitch in TAP version of `warn_' function
+       * tests/tap-functions.sh (warn_): Do not display the warning
+       message two times.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix another spurious failure due to ignored signals
+       * tests/tap-signal.test: Renamed ...
+       * tests/tap-signal.tap: ... to this, converted to the use of the
+       TAP protocol, and improved not to try to use/trap signals that
+       are ignored by the parent shell (they will be forcibly ignored
+       by all the child processes too).  Extend the test a bit since we
+       are at it.
+       * tests/list-of-tests.mk: Update.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix a spurious failure due to lacking Fortran compilers
+       * tests/silent-many-generic.test (configure.in): Cause the test
+       to be skipped if `configure' fails to find working C++, Fortran
+       and Fortran 77 compilers.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: more use of TAP
+       * tests/self-check-reexec.test: Renamed ...
+       * tests/self-check-reexec.tap: ... to this, converted to the
+       use of TAP protocol, and extended a bit.
+       * tests/self-check-seq.test: Renamed ...
+       * tests/self-check-seq.tap: ... to this, and converted to the
+       use of TAP protocol.
+       * tests/list-of-tests.mk: Update.
+
+2011-09-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: fix spurious failures when /bin/ksh do not exists
+       * tests/self-check-reexec.test: Ensure that the non-bash shells
+       we look do really exists.  Since we are at it, also try the name
+       `ash', non `dash', for the Almquist Shell, for Cygwin 1.5.
+
+2011-09-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more use of TAP in our own testsuite
+       * tests/parallel-tests-interrupt.test: Renamed ...
+       * tests/parallel-tests-interrupt.tap: ... to this, and converted
+       to the use of TAP protocol.
+       * tests/self-check-cleanup.test: Renamed ...
+       * tests/self-check-cleanup.tap: ... to this, and converted to the
+       use of TAP protocol.
+       * tests/self-check-dir.test: Renamed ...
+       * tests/self-check-dir.tap: ... to this, and converted to the use
+       of TAP protocol.
+       * tests/self-check-is_newest.test: Renamed ...
+       * tests/self-check-is_newest.tap: ... to this, and converted to
+       the use of TAP protocol.
+       * tests/self-check-unindent.test: Renamed ...
+       * tests/self-check-unindent.tap: ... to this, and converted to
+       the use of TAP protocol.
+       * tests/list-of-tests.mk: Update.
+
+2011-09-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: sanity check on 'is_blocked_signal' function
+       * tests/self-check-is-blocked-signal.tap: New test.
+       * tests/list-of-tests.mk: Update.
+
+2011-09-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failures due to ignored signals
+       * tests/defs (is_blocked_signal): New function.
+       * tests/parallel-tests-interrupt.test: Do not try to use/trap
+       signals that are ignored by the parent shell: they will be
+       ignored by all the child processes too.
+       * tests/self-check-exit.test: Likewise.
+       * tests/self-check-cleanup.test: Likewise, and do few minor
+       improvements and extensions since we are at it.
+
 2011-09-05  Peter Rosin  <peda@lysator.liu.se>
 
        * tests/amhello-binpkg.test: Add missing $EXEEXT usage.
 
 2011-09-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       tests: remove redundant settings of `errexit' shell flag
+       * doc-parsing-buglets-colneq-subst.test: Do not set the
+       `errexit' shell flag, as it is already set by `tests/defs'.
+       * doc-parsing-buglets-tabs.test: Likewise.
+       * java-empty-classpath.test: Likewise.
+       * vala-vpath.test: Likewise.
+
+2011-09-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more uses of `$top_testsrcdir', in the `amhello' tests
+       * tests/amhello-binpkg.test: Use `$top_testsrcdir' instead
+       of `$testsrcdir/..'.
+       * tests/amhello-cflags.test: Likewise.
+       * tests/amhello-cross-compile.test: Likewise.
+
+2011-09-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid creating useless files in the `amhello' tests
+       * tests/amhello-binpkg.test: Define `$am_create_testdir' to
+       "empty" before sourcing ./defs, to avoid bringing in unused
+       auxiliary files.
+       * tests/amhello-cflags.test: Likewise.
+       * tests/amhello-cross-compile.test: Likewise.
+
+2011-09-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        coverage: vala support failing for VPATH from-scratch builds
        * tests/vala-vpath.test: New test, xfailing.
        * tests/Makefile.am (TESTS): Update.
        * tests/doc-parsing-buglets-tabs.test: Likewise.
        * tests/Makefile.am (TESTS): Update.
 
+2011-09-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       automake: fix regression due to de-ansification support removal
+       The last change `v1.11-947-g136b489' removed code that automake
+       was using to decide whether binary objects were built by the
+       generated Makefile.in, so that it could avoid to emit unneeded
+       code when this was not the case.  Re-introduce such code in a
+       less-obfuscated form, and add a test to ensure we don't regress
+       again.
+       * automake.in ($must_handle_compiled_objects): New global
+       variable, telling whether the generated Makefile has to build
+       compiled objects.
+       (initialize_per_input): Reset it.
+       (handle_programs, handle_libraries, handle_ltlibraries): Set
+       it to a true value when required.
+       (handle_compile): Don't generate any code if the variable
+       `$must_handle_compiled_objects' is not set to a true value.
+       * tests/no-extra-makefile-code.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-08-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       automake: cleanups after de-ansification support removal (2)
+       * automake.in ($get_object_extension_was_run): Remove, it's not
+       really needed anymore.
+       (&get_object_extension): Remove, it's a no-op now.
+       All callers adjusted.
+
+2011-08-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       automake: cleanups after de-ansification support removal (1)
+       * automake.in (lang_c_rewrite, handle_single_transform): Rename
+       variable `$nonansi_obj' to `$obj'.
+
+2011-08-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       ansi: remove obsolete code/files for de-ANSI-fication support
+       * lib/ansi2knr.1, lib/ansi2knr.c: Deleted.
+       * lib/Makefile.am (dist_pkgvdata_DATA): Do not list them anymore.
+       * lib/am/ansi2knr.am: Delete.
+       * lib/am/Makefile.am (dist_am_DATA): Do not list it anymore.
+       * lib/Automake/Variable.pm (%_am_macro_for_var): Remove entries for
+       `ANSI2KNR' and `U'.
+       * m4/depout.m4 (_AM_OUTPUT_DEPENDENCY_COMMANDS): Don't care anymore
+       about possible definition of the `$U' variable.
+       * automake.in (@common_files): Drop `ansi2knr.1' and `ansi2knr.c'.
+       (struct): Remove scalar field `ansi'.
+       All callers adjusted.
+       (&lang_c_finish, %de_ansi_files): Remove, they're not required
+       anymore.
+       All callers adjusted.
+       ($get_object_extension_was_run): Fix typo in comment.
+       (&get_object_extension): Drop code dealing with de-ansification;
+       this function basically a no-op now, but is required to properly
+       initialize `$get_object_extension_was_run' variable.
+       (&handle_languages, &handle_compile, &lang_c_rewrite): Drop code
+       dealing with de-ansification.
+
+2011-08-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       ansi: reject attempts to use automatic de-ANSI-fication support
+       * tests/protos.m4 (AM_C_PROTOTYPES): Error out whenever called.
+       * lib/Automake/Options.pm (_process_option_list ): Error out
+       with a proper error message when the `ansi2knr' option is used.
+       Related updates to comments.
+       * tests/depacl2.test: Update.
+       * tests/ansi2knr-no-more.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+       * NEWS: Update.
+
+2011-08-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove tests about obsolete de-ANSI-fication support
+       * tests/ansi.test: Delete.
+       * tests/ansi10.test: Likewise.
+       * tests/ansi2.test: Likewise.
+       * tests/ansi2knr-deprecation.test: Likewise.
+       * tests/ansi3.test: Likewise.
+       * tests/ansi3b.test: Likewise.
+       * tests/ansi4.test: Likewise.
+       * tests/ansi5.test: Likewise.
+       * tests/ansi6.test: Likewise.
+       * tests/ansi7.test: Likewise.
+       * tests/ansi8.test: Likewise.
+       * tests/ansi9.test: Likewise.
+       * tests/cxxansi.test: Likewise.
+       * tests/libobj8.test: Likewise.
+       * tests/subobj3.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-08-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: remove description of de-ANSI-fication support from manual
+       * doc/automake.texi (Auxiliary Programs): Remove mention of
+       `ansi2knr.c' and `ansi2knr.1'.
+       (Obsolete Macros): Remove mention of `AM_C_PROTOTYPES'.  Do not
+       index it nor variables `ANSI2KNR' and `U' anymore.
+       (List of Automake options): Remove mention of `ansi2knr' option,
+       and obsolete entries for concept and option indexes.
+       (Optional): Remove entry about `AM_C_PROTOTYPES'.
+       (@c LocalWords): Remove `ansi' and `knr'.
+       (@menu, @detailmenu): Remove entries about de-ANSI-fication
+       support.
+
+2011-08-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: better respect of TAP usage in wrapped tests
+       * tests/gen-wrap-tests: Partial rewrite to take into account the
+       possibility that the wrapped test uses the TAP protocol.  This
+       complicates the code quite a bit, but is essential to ensure real
+       correctness in all the wrapped scripts.
+       * tests/wrap-tests.sh: Update, and add few more sanity checks.
+
+2011-08-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: use both perl and awk implementations for tests on TAP
+       * tests/gen-wrap-tests (get_list_for_pltap): New function, gets
+       the list of tests that check the Automake TAP support.
+       ($defines_for_pltap): New variable.
+       ($wrapper_type_list): Add "pltap".
+       * tests/defs-static.in: Check that `$am_tap_implementation' is
+       not exported in the environment.
+       * tests/self-check-env-sanitize.tap: Update.
+
+2011-08-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: two single auxiliary scripts to run/generate wrapped tests
+       * tests/config-shell-tests.sh, tests/parallel-tests.sh,
+       tests/gen-config-shell-tests, tests/gen-parallel-tests: Deleted,
+       their roles taken over by ...
+       * tests/wrap-tests.sh, tests/gen-wrap-tests: ... these new more
+       general scripts.
+       * tests/Makefile.am (EXTRA_DIST): Distribute the new scripts, and
+       do not distribute the obsolete ones anymore.
+       ($(srcdir)/parallel-tests.am, $(srcdir)/config-shell-tests.am): Do
+       not include nor generate anymore, they have been superseded by ...
+       ($(srcdir)/wrap-tests.am): ... this new fragment, automatically
+       generated by `gen-wrap-tests'.
+       (PTEST_LOG_COMPILER, SHTST_LOG_COMPILER): Delete, they are now
+       defined in the new `wrap-tests.am' makefile fragment.
+       (TEST_EXTENSIONS): Do not append to it anymore, that is now done
+       by the new `wrap-tests.am' makefile fragment above.
+       ($(parallel_tests:.ptest=.log), $(config_shell_tests:.shtst=.log),
+       $(parallel_tests), $(config_shell_tests): Remove this dependencies,
+       superseded by ...
+       ($(wrap_TESTS), $(wrap_LOGS)): ... these ones.
+       (MAINTAINERCLEANFILES): Delete, it's not used anymore.
+       (TESTS): Do not contain anymore `$(config_shell_tests)' nor
+       `$(parallel_tests)', contain `$(wrap_TESTS)' instead, as defined
+       by `$(srcdir)/wrap-tests.am'.
+       Other related minor edits and reorderings.
+       * bootstrap, tests/.gitignore, tests/README: Update.
+
+2011-08-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: list of tests placed in a separate Makefile fragment
+       This change allows us to easily use make instead of by-hand (and
+       more fragile) grepping to extract the list of hand-written tests
+       from our Makefiles.
+       * bootstrap (BOOTSTRAP_MAKE): New variable.
+       Use it to run make in order to extract the list of hand-written
+       tests from ...
+       * tests/list-of-tests.mk: ... this new file, where they are
+       listed in ...
+       (handwritten_TESTS, tap_with_common_setup_TESTS, tap_other_TESTS):
+       ... these variables, extracted respectively from ...
+       * tests/Makefile.am (handwritten_tests, tap_other_tests,
+       tap_with_common_setup_tests): ... these older variables, now
+       removed.
+       (EXTRA_DIST, expected_list_of_tests): Update w.r.t. the variable
+       names' changes.
+       (include $(srcdir)/list-of-tests.mk): New inclusion.
+       Remove an overkill indirection, and with it ...
+       (tap_with_common_setup_logs): ... this variable.
+       ($(srcdir)/parallel-tests.am, $(srcdir)/config-shell-tests.am):
+       Update to match the new interface of ...
+       (gen-parallel-tests, gen-config-shell-tests): ... these scripts,
+       that now read the list of tests from the standard input.
+
+2011-08-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: prefer AM_... variables to user-reserved ones in Makefile
+       * tests/Makefile.am (TAP_LOG_DRIVER_FLAGS): Renamed ...
+       (AM_TAP_LOG_DRIVER_FLAGS): ... to this.
+
+2011-08-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: some minor fixlets w.r.t. TAP-based tests
+       The variable that is used by our test scripts to decide whether
+       they are "plain" or TAP-based is `using_tap'; however, some
+       peripheral sanity checks and sanitization code in our testsuite
+       were erroneously using the `use_tap' variable instead.  Fix that.
+       * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Nullify `using_tap',
+       not `use_tap'.
+       * tests/defs-static.in: Check that `using_tap', not `use_tap',
+       is not exported.
+       * tests/self-check-env-sanitize.test: Update.
+
+2011-08-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid re-running a test with the 'parallel-tests' option
+       * tests/backcompat5.test (parallel_tests): Define to "no", to
+       prevent the generation of a sibling test script that uses the
+       'parallel-tests' driver.  That would be useless anyway, since
+       we manually override the contents of configure.in, thus clobbering
+       the `parallel-tests' option in AM_INIT_AUTOMAKE.
+       Fix a typo in comments since we are at it.
+
+2011-08-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: defaults to awk+shell driver in tests on TAP support
+       * tests/defs ($am_tap_implementation): Default to "shell", not
+       to "perl".
+
 2011-08-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: list "forgotten" test script in TESTS
        * lib/ylwrap: Convert tabs to spaces.
        Reported by Karl Berry.
 
+2011-08-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: different test scripts cannot share the same basename
+       If two test scripts have the same basename, they will end up
+       sharing the same log file, leading to all sort of undefined and
+       undesired behaviours.  Add a Makefile check verifying that this
+       is not the case.
+       * tests/test-logs-repeated.test: New test, verifying previously
+       unspecified semantics (in the definition of $(TEST_LOGS) from
+       $(TESTS)) that we use in our new check.
+       * tests/Makefile.am (TESTS): Update.
+       (check-no-repeated-test-name): New .PHONY check.
+       (check-local): Depend on it.
+
+2011-08-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure for awk implementation of TAP driver
+       * tests/tap-realtime.test: The awk+shell implementation of the TAP
+       driver must "read ahead" of one line in order to catch the exit
+       status of the test script it runs.  So, in the TAP-producer script
+       here, be sure to echo one "dummy" line after each TAP result line
+       in order not to cause false positives.
+
+2011-08-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: allow escaping of TAP directives
+       * lib/tap-driver.sh (setup_result_obj): Handle escaping of TAP
+       directives in a way tat is (mostly) compatible by what is done
+       by the TAP::Parser module.
+       With this change, the tests `tap-escape-directive.test' and
+       `tap-escape-directive-2.test' now also pass with the shell/awk
+       implementation of the TAP driver.
+
+2011-08-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: more about escaping of TAP directives
+       * tests/tap-escape-directive.test: Make grepping of testsuite
+       progress output slightly stricter.
+       * tests/tap-escape-directive-2.test: New test (failing with the
+       awk implementation of the TAP driver).
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: improve syncing between awk+shell and perl implementations
+       * lib/tap-driver.pl (stringify_test_result): Renamed ...
+       (stringify_result_obj): ... to this.  Break up a clause in the
+       long "if/elsif/.../else" construct to avoid unaesthetic line
+       breaks and to be more synced with the sibling function in
+       `tap-driver.sh'.  Rename the `$result', `$PASS' and `$FAIL'
+       variables to respectively `$result_obj', `$COOKED_PASS' and
+       `$COOKED_FAIL', for clarity and better syncing.
+       (handle_tap_test): Renamed  ...
+       (handle_tap_result): ... to this, and change the name of the
+       `$test' local variable to `$result_obj'.
+       (extract_comment): Reimplement using the simpler `index' and
+       `substr' builtins, rather than with more advanced uses of
+       regular expressions.
+       (%test_results, @test_results): Renamed respectively ...
+       (%test_results_seen, @test_results_list): ... to these, and
+       related adjustments throughout the `TEST_RESULTS' block.
+       (main, get_global_test_result): Refactor and do some cosmetic
+       changes to make these functions clearer and better synced with
+       sibling code in `tap-driver.sh'.
+       Other minor cosmetic and typo fixes.
+       * lib/tap-driver.sh (extract_tap_comment): Remove outdated
+       "FIXME" comments.
+       (get_global_test_result): Small reordering to make it better
+       synced with its sibling function in `tap-driver.pl'.
+       (stringify_result_obj): Consistently use `result_obj' as the
+       parameter name.
+       Other minor cosmetic and typo fixes.
+
+2011-08-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/perl: don't redirect perl warnings/errors to log files
+       With this change, the test `tap-driver-stderr.test' also passes
+       with the perl implementation of the TAP driver.
+       * lib/tap-driver.pl (start): Save the original stderr into the
+       `OLDERR' file handle, and call ...
+       (trap_perl_warnings_and_errors): ... this new function, trapping
+       the `__WARN__' and `__DIE__' "pseudo-signals" to ensure that the
+       warning and error messages goes to that original stderr stream.
+       Since we are at it, be sure to prepend all possible "die" message
+       with the name of the script as given by the `$ME' variable.
+
+2011-08-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/perl: add copyright notice, version string, and emacs stuff
+       * lib/tap-driver.pl: Add proper copyright notice and bug reporting
+       address.  Remove obsolete heading comments.  Add trailing comments
+       for emacs w.r.t. code-formatting rules and automatic updating of
+       the date-based script version saved into the `$VERSION' variable.
+       ($VERSION): Define to the current UTC date.
+
+2011-08-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: don't redirect awk stderr to log files
+       * lib/tap-driver.sh: Handle the file descriptors redirections
+       more smartly, to avoid sending error messages from awk (about
+       e.g. syntax or I/O errors) to the log files instead that to the
+       console.
+       * tests/tap-driver-stderr.test: New test, verifying the improved
+       driver behaviour.  Notice that this test still fails when using
+       the perl implementation of the TAP driver.
+       * tests/Makefile.am (tap_other_tests): Update.
+
+2011-08-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: remove obsolete "FIXME" comment
+       * lib/tap-driver.sh: Remove obsolete "FIXME" comment about our
+       driver losing the exit status of the tested program; this issue
+       has been solved in precedent commit `v1.11-1052-gd630a0d'.  Fix
+       an unrelated typo in comments since we are at it.
+
+2011-08-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: avoid spurious failure on Solaris
+       * tests/tap-signal.test (signal_caught): Fix a regression from
+       commit `v1.11-1052-gd630a0d' that was causing this test to fail
+       spuriously on Solaris (due to an already worked-around Solaris
+       /bin/sh bug, see commit `v1.11-981-g0ef3ef5').
+
+2011-08-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use the new awk+shell TAP driver in our own testsuite
+       * tests/Makefile.am (TAP_LOG_DRIVER): Redefine to use the new
+       awk+shell tap driver, which should be complete enough for use in
+       a "controlled" production environment.
+
+2011-08-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: handle non-zero exit status from the test command
+       * lib/tap-driver.sh (get_test_exit_message): New function in the
+       awk script, used to extract the exit status of the test program,
+       or at least a good guess of it.
+       (write_test_results): Use it, reporting an ERROR result if it
+       detects that the test program exited with a non-zero status.
+       * tests/tap-signal.test: Account for the differences in the
+       error messages generated by the awk and perl TAP drivers.  Fix
+       an unrelated typo in comments since we are at it.
+
+2011-08-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: prepare to fetch the exit status of the test command
+       * lib/tap-driver.sh: Rewrite some logic in the main parsing loop,
+       to make it possible to read the exit status of the test command
+       from the last line of the input stream.
+
+2011-08-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: refactor for future changes
+       * lib/tap-driver.sh: Rewrite the awk script so that the parsing
+       of the input stream is implemented as a hand-rolled loop in the
+       BEGIN block, using the `getline' builtin.
+
+2011-08-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: avoid spurious failure if rst2html program is missing
+       * tests/tap-html.test ($required): Require `rst2html'.
+
+2011-08-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: support Solaris /usr/xpg4/bin/awk
+       * lib/tap-driver.sh: Use `\t', not `\\t', to represent tabulation
+       character in regexps, even when inside double-quoted strings; that
+       seems to be more portable to Solaris 10 XPG4 awk.
+
+2011-08-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: support Solaris /usr/bin/nawk
+       * lib/tap-driver.sh (close_or_die): Remove, the use of the `close'
+       builtin in there was confusing /usr/bin/nawk from Solaris 10 into
+       a syntax error.
+       (write_test_results): Simply use `close' on the `*.trs' file, that
+       should be enough.
+
+2011-08-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: correctly extract message from SKIP plans
+       * lib/tap-driver.sh (/^1\.\.0+[ \t]*#/): Add a forgotten `?' to
+       the regex used to extract the skip message from a "1..0" TAP plan.
+       * tests/planskip.test: Check for the just-fixed bug.
+       * tests/tap-planskip-unplanned-corner.test: Don't be too strict
+       w.r.t. the formatting of the "skip whole test" message, to avoid
+       failing due to bugs irrelevant for this test (like the one just
+       fixed).
+
+2011-08-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap/awk: support colorized output
+       * lib/tap-driver.sh: Pass definition of colors to the BEGIN block
+       of the awk script, using ...
+       ($init_colors): ... this new variable, which supersedes ...
+       ($red, $grn, $lgn, $blu, $mgn, $std): ... these variables, which
+       have been consequently removed.
+       ($color_tests): We don't have to pass this anymore to the awk
+       script, so do not convert it to a numeric boolean.
+       (decorate_result): Implement for real.
+       With this change, the test 'tap-color.test' now passes.
+
+2011-08-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: real (but still incomplete) awk implementation of TAP driver
+       * lib/tap-driver.sh: Add an incomplete, but mostly working,
+       implementation of a TAP parser and driver in awk.  It doesn't yet
+       support colorized output, fetching of exit status from test
+       programs, nor a way to escape TAP directives in TAP result lines,
+       but passes all the tests of TAP support in the automake testsuite,
+       apart from the following ones:
+         - tap-color.test
+         - tap-escape-directive.test
+         - tap-exit.test
+         - tap-missing-plan-and-bad-exit.test
+         - tap-passthrough-exit.test
+         - tap-planskip-badexit.test
+         - tap-planskip-unplanned-corner.test
+         - tap-signal.test
+       Tested on Debian GNU/Linux with GNU awk 3.1.7 and 3.0.2, "original
+       awk" 2010-05-23-1, and mawk 1.3.3-15 (with which also the test
+       `tap-realtime.test' fails, in addition to those listed above).
+
+2011-08-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix spurious failure due to Solaris 'wc' incompatibility
+       * tests/tap-number-wordboundary.test ($planned): Strip any extra
+       whitespace from the output of `wc', to cater to Solaris 10.
+
+2011-08-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: keyword "SKIP" in TAP plan is case-insensitive
+       * tests/tap-planskip-case-insensitive.test: New test.
+       * tests/tap-planskip.test: Remove now-duplicated checks.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: ambiguous use of TAP "TODO"/"SKIP" directives
+       * tests/tap-ambiguous-directive.test: New test.
+       * tests/tap-todo-skip-together.test: Reference it in heading
+       comments.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: non-directive comments in TAP results are preserved
+       * tests/tap-result-comment.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: TAP result number followed by non-whitespace word boundary
+       * tests/tap-number-wordboundary.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: a TAP result numbered "0" is always out-of-order
+       * tests/tap-test-number-0.test: New, checks that a test result
+       numbered as 0 is to be considered out-of-order; this is
+       consistent with the behaviour of the `prove' utility.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetics: fix botched indentation in perl TAP driver
+       * lib/tap-driver.pl (main, Getopt::Long::GetOptions): Fix
+       improper or botched indentation.
+
+2011-08-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: some more tests on corner cases of TAP support
+       * tests/tap-no-spurious.test: Extend checks verifying that a line
+       matching, say, the regex "^ok[a-zA-Z0-9_]" is *not* considered a
+       TAP result.
+       * tests/tap-no-spurious-numbers.test: New test, checking that our
+       TAP driver doesn't spuriously recognize as TAP result numbers what
+       is not (even if it seems pretty close).
+       * tests/tap-negative-numbers.test: New test, checking that our
+       TAP driver doesn't spuriously recognize negative TAP result
+       numbers, but correctly interprets them as test descriptions
+       instead.
+       * tests/tap-plan-leading-zero.test, tap-numbers-leading-zero.test:
+       New tests, checking how our driver fares in recognizing numbers
+       with leading zeroes in TAP results or TAP plans.
+       * tests/tap-planskip-malformed.test: New test, checking that a
+       malformed TAP plan is not recognized as a valid plan.
+       * tests/tap-plan-whitespace.test: New test, checking that a TAP
+       plan line with trailing whitespace is recognized and handled
+       correctly.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: various fixlets and tweakings
+       * tests/seenc.test: Make grepping of automake stderr stricter.
+       Add a trailing `:' command.
+       * tests/symlink.test: Likewise.  Also, define `$am_create_testdir'
+       to "empty" to avoid bringing in unused auxiliary files (only to
+       have to remove them right away), and use proper m4 quoting in
+       `configure.in'.
+       * tests/vpath.test: Make grepping of generated `Makefile.in'
+       slightly stricter.  Prefer trailing `:' over trailing `Exit 0'.
+       * tests/suffix6c.test: Unset OBJEXT to avoid interferences from
+       the environment.
+       * tests/suffix12.test: Do not whitespace-indent `##' comments
+       when they are embedded in a makefile rule: having them indented
+       is not part of the Automake API, and might cause failures with
+       e.g., Tru64 make.
+       * tests/syntax.test: Simplify the `Makefile.am' to ensure that
+       automake doesn't fail for the wrong reasons.  Make grepping of
+       automake stderr slightly stricter.
+       * tests/test-harness-vpath-rewrite.test: Remove useless variable
+       definition from `Makefile.am'.
+       * tests/test-driver-custom-multitest.test: Fix typo in comments.
+       * tests/self-check-me.tap: Fix minor typo in test description.
+       * tests/vars3.test: Make grepping of automake stderr stricter
+       and safer.
+       * tests/version6.test: Add sanity check, verifying that the
+       version number extracted from `automake --version' output seems
+       legit.
+       * tests/auxdir2.test: Renamed ...
+       * tests/auxdir-compauted.tap: ... to this, and converted to the
+       use of TAP.
+       * tests/auxdir4.test: Renamed ...
+       * tests/auxdir-unportable.tap: ... to this, and converted to the
+       use of TAP.
+       * tests/auxdir3.test: Renamed ...
+       * tests/auxdir-misplaced.test: ... to this.
+       * tests/auxdir5.test: Renamed ...
+       * tests/auxdir-nonexistent.test: ... to this.
+       * tests/auxdir9.test: Renamed ...
+       * tests/auxdir-autodetect.test: ... to this.
+       * tests/Makefile.am (TESTS): Update.
+       (XFAIL_TESTS): Remove `auxdir2.test'.
+
+2011-08-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix some redundant autotools calls in tests on TAP
+       * tests/tap-deps.test: Do not call autotools and configure; there
+       is no need to, since this script sources `tap-setup.sh'.
+       * tests/tap-empty-diagnostic.test: Likewise.
+       * tests/tap-escape-directive.test: Likewise.
+       * tests/tap-fancy2.test: Likewise.
+       * tests/tap-no-spurious.test: Likewise.
+       * tests/tap-out-of-order.test: Likewise.
+
 2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        * THANKS (Daniel Richard G.): Update e-mail address.
        * HACKING ("Working in git"): Use autoconf and autom4te 2.68,
        not 2.67, in the examples.
 
-2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       test defs: more environment cleanup
-       * tests/defs.in: Also unset variables AM_COLOR_TESTS and
-       AM_TESTS_ENVIRONMENT.
+       tap: improve granularity for tests on problematic TAP messages
+       * tests/tap-message-0.test: Break up into ...
+       * tests/tap-msg0-result.test, tests/tap-msg0-directive.test,
+       tests/tap-msg0-planskip.test, tests/tap-msg0-misc.test,
+       tests/tap-msg0-bailout.test: ... these new tests, and extend
+       a little.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
 
-2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       tests: fix spurious failure with Solaris make
-       * tests/distcheck-configure-flags-am.test: Avoid using `+=' too
-       liberally with AM_DISTCHECK_CONFIGURE_FLAGS, since the line breaks
-       so introduced, in conjunction with single quotes, might confuse
-       Solaris make.
+       tap: correctly handle string "0" in TAP messages
+       * lib/tap-driver.pl (is_null_string): New function, can be used
+       to determine whether a given string variable is empty or undefined.
+       Useful to avoid pitfalls like:
+         if ($message) { print "$message\n"; }
+       which wouldn't print anything if $message is the literal "0".
+       (handle_tap_test, handle_tap_plan, handle_tap_bailout): Use it,
+       to avoid missing messages composed only by a literal "0" in TAP
+       result descriptions and in skip, todo and bailout explanations.
+       * tests/tap-message-0.test: Enhance.
+       * tests/Makefile.am (XFAIL_TESTS): Remove it, it passes now.
 
-2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       maintcheck: fix maintainer-check failures, both real and spurious
-       * tests/amhello-binpkg.test: Use "$MAKE", not bare "make".
-       * Makefile.am (sc_perl_local): Also allow perl special variable
-       `$~' to be localized.  And be slightly laxer in the regexp, to
-       allow for usages like "local $_ = $foo;".
-       (sc_tests_overriding_macros_on_cmdline): Also allow for command
-       line overriding of the `DISABLE_HARD_ERRORS' make variable.  Try
-       to avoid false positives for usages like "$MAKE || st=$?".
+       tap: a minor simplification in the perl TAP driver
+       * lib/tap-driver.pl: The `--disable-hard-errors' option is a
+       no-op, so just ignore it and its argument.
 
-2011-08-03  Bruno Haible  <bruno@clisp.org>
+2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       docs: how to use '-I' option in AM_CPPFLAGS for best VPATH support
-       * doc/automake.texi (Program Variables): Recommend -I options to
-       both the build directory and the source directory when needed.
+       parallel-tests: fix help screen for test driver scripts
+       * lib/tap-driver.pl ($USAGE): The `--trs-file' option is mandatory
+       too.
+       * lib/tap-driver.sh (print_usage): Likewise.
+       * lib/test-driver (print_usage): Likewise.
+       ($scriptversion): Update.
 
-2011-07-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       tests: relax a test on amhello examples to cater to Solaris tar
-       * tests/amhello-binpkg.test: When the tar implementation in use
-       is not GNU tar, relax the tests on tar output, to avoid spurious
-       failures.  For example, "tar cvf ..." with GNU tar can output
-       lines like "./usr/bin/hello" on the standard output, while with
-       Solaris tar it can output lines like "a ./usr/bin/hello 8K" on
-       standard output, and with Heirloom tar it can output lines like
-       "a ./usr/bin/hello 15 tape blocks" on standard error.
+       tap: add a dummy TAP driver script implemented in shell + awk
+       The user can also now decide which implementation of the TAP driver
+       to use in the testsuite by defining the `$am_tap_implementation'
+       variable to either "perl" or "shell".  Future enhancements will
+       allow the testsuite to automatically run the test scripts on TAP
+       support with both the TAP driver implementations, to improve
+       coverage.
+       * tests/defs (fetch_tap_driver): Honor the `$am_tap_implementation'
+       variable to decide which implementation of the TAP driver to fetch.
+       ($am_tap_implementation): Default to "perl".
+       * tests/tap-common-setup.test: Do not fetch the TAP driver, the
+       code in tap-setup.sh does that already (and respecting runtime
+       overriding of `$am_tap_implementation').
+       * lib/tap-driver: Renamed ...
+       * lib/tap-driver.pl: ... to this, and ...
+       ($ME): ... adjusted this.
+       * doc/automake.texi: Adjust to the renaming.
+       * tests/Makefile.am (TAP_LOG_DRIVER): Likewise.
+       * tests/tap-doc2.test: Likewise.
+       * lib/tap-driver.sh: New script, still mostly dummy.
+       * lib/Makefile.am (dist_script_DATA): Update, and since we are at
+       it, rewrite it to make it easier to add new entries in the future.
 
-2011-07-15  Benoit Sigoure  <tsunanet@gmail.com>
+2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       docs: add references between the 2 sections on java support
-       * doc/automake.texi (Java Support, Java): Add cross-references.
+       testsuite: refactor tests on TAP support in view of future changes
+       * tests/defs (fetch_tap_driver): New subroutine; it fetches the
+       automake-provided TAP driver from the `lib/' directory into the
+       current directory, and edits its shebang line so that it will be
+       run with the perl interpreter determined at configure time.
+       * tests/tap-setup.sh: Use it.
+       * tests/tap-common-setup.test: There's no need to AC_SUBST `PERL'
+       anymore, nor to use it in the Makefile to run the TAP driver.
+       Also, use the `fetch_tap_driver' function instead of copying the
+       `tap-driver' auxiliary script directly.
+       * tests/tap-bad-prog.tap: Likewise.
+       * tests/tap-diagnostic-custom.test: Likewise.
+       * tests/tap-doc.test: Likewise.
+       * tests/tap-merge-stdout-stderr.test: Likewise.
+       * tests/tap-more.test: Likewise.
+       * tests/tap-more2.test: Likewise.
+       * tests/tap-recheck.test: Likewise.
+       * tests/tap-summary-aux.sh: Likewise.
+       * tests/tap-basic.test: Likewise, and fix a grammaro in comments
+       since we are at it.
 
-2011-07-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+2011-08-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       Sync auxiliary files from upstream.
-       * INSTALL, lib/INSTALL, lib/config.guess, lib/config.sub,
-       lib/texinfo.tex: Sync from upstream.
+       test defs: fix typo in comments
+       * tests/defs (get_shell_script): Fix typo in the function
+       description.
+
+2011-08-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: missing tap plan and non-zero exit status
+       * tests/tap-missing-plan-and-bad-exit.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix an unportable use of sed
+       * tests/tap-todo-skip-whitespace.test: Alternation with "\|" in
+       sed regular expressions is not portable to (at least) FreeBSD
+       sed; do not use it.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: avoid spurious failure if rst2html program is missing
+       * tests/test-driver-custom-no-html.test: Account for the
+       possibility of a lacking `rst2html' program in our final
+       grepping of make output.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: improve diagnosing and reporting of plan mismatches
+       Problem exposed by a failure in the test 'tap-plan-errors.test'.
+       * lib/tap-driver (NO_PLAN, EARLY_PLAN, LATE_PLAN): New constants.
+       (Throughout the file): Use more complex semantics for `$plan_seen',
+       which now also remember whether the plan that has been seen is an
+       "early" or "late" plan; in turn, this makes ...
+       ($tap_stopped): ... this variable redundant; remove it.
+       (handle_tap_plan): Adjust to avoid producing spurious or confusing
+       error messages about extra or mismatched "late" TAP plans.
+       * tests/tap-plan-corned.test: Adjust and extend.
+       * tests/tap-color.test: Likewise.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: log all TAP stream, even after a "Bail out!"
+       * lib/tap-driver ($bailed_out): New global boolean variable,
+       telling whether a "Bail out!" directive has been seen or not.
+       (handle_tap_bailout): This function does not anymore stop the
+       reading from TAP stream; instead, it sets `$bailed_out' to a
+       true value, so that only the subsequent parsing of the input
+       TAP stream is stopped.
+       (finish): Remove, no more needed, its contents inlined into ...
+       (main): ... this function, with related adjustments in the code
+       flow.
+       (get_test_exit_message): Do not "flush" the input TAP stream
+       to fetch the exit status of test script, it is not anymore
+       required.  Add a sanity check.
+       * tests/tap-bailout-and-logging.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: TAP diagnostics after "Bail out!" aren't reported
+       This is compatible with the behaviour of the `prove' utility.
+       * tests/tap-bailout-suppress-later-diagnostic.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: TAP errors after a "Bail out!" directive aren't reported
+       This is compatible with the behaviour of the `prove' utility.
+       * tests/tap-bailout-suppress-later-errors.test: New test.
+       * tests/tap-bailout-badexit.test: Renamed ...
+       * tests/tap-bailout-suppress-badexit.test: ... to this, for
+       consistency.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: reorganize tests on TAP plans
+       * tests/tap-skip-whole.test: Rename ...
+       * tests/tap-planskip.test: ... to this
+       * tests/tap-skip-whole-badexit.test: Rename ...
+       * tests/tap-planskip-badexit.test: ... to this.
+       * tests/tap-skip-whole-bailout.test: Rename ...
+       * tests/tap-planskip-bailout.test: ... to this.
+       * tests/tap-skip-whole-bailout.test: Rename ...
+       * tests/tap-planskip-later-errors.test: ... to this.
+       * tests/tap-skip-whole-unplanned.test: Rename ...
+       * tests/tap-planskip-unplanned.test: ... to this.
+       * tests/tap-skip-whole-whitespace.test: Rename ...
+       * tests/tap-planskip-whitespace.test: ... to this.
+       * tests/tap-skip-whole-continue.test: Rename ...
+       * tests/tap-planskip-and-logging.test: ... to this, extend to try
+       more cases, and fix heading comments.
+       * tests/tap-skip-whole-lastline.test: Rename ...
+       * tests/tap-planskip-late.test: ... to this, fix heading comments,
+       and remove some checks that are just a duplication of those already
+       performed in the previous script.
+       * tests/tap-results-with-planskip.test: Rename to ...
+       * tests/tap-planskip-unplanned-corner.test: ... this, and improve
+       hading comments.
+       * tests/tap-planskip-later-errors.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: more TAP driver consistency w.r.t. 'prove'
+       * tests/skip-results-with-planskip.test: New test, verifies that
+       test results seen in a TAP stream that has a "plan with SKIP" are
+       flagged as errors.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: improve some comments in the TAP driver
+       * lib/tap-driver (handle_tap_plan): Improve comments describing
+       possible errors in a "plan with SKIP" directive.
+
+2011-08-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: non-zero exit status after "Bail out!" should not be reported
+       This new behaviour is more consistent with that of the `prove'
+       utility.  Also, experience with the use of TAP in the Automake's
+       own test suite has shown that reporting non-zero exit status from
+       a script after it has issued a "Bail out!" directive is mostly
+       redundant, more introducing noise rather than conveying useful
+       information.
+       * lib/tap-driver (finish): Inline the part of it that was getting
+       the script exit status ...
+       (main): ... in here.
+       * tests/tap-bailout-badexit.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
 
-2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-08-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       tests: fix weakness in 'tests-environment-backcompat.test'
-       * tests/tests-environment-backcompat.test: Do not override the
-       content of xfailing test `baz.test' with a "weaker" version that
-       fails unconditionally: the test must fail only when the 'strict'
-       pragma is in use, in order not to reduce coverage.
+       tap: a "plan with SKIP" after test results is an error
+       This new behaviour is both more natural and more consistent with
+       that of the `prove' utility.
+       * lib/tap-driver (handle_tap_plan): Do not stop TAP parsing when
+       a "plan with SKIP" line (e.g., "1..0 # SKIP") is encountered, and
+       do not print a "SKIP" line if some TAP result has already been
+       seen.
+       * tests/tap-skip-whole.test: Adapt.
+       * tests/tap-skip-whole-lastline.test: Likewise.
+       * tests/tap-global-result.test: Adapt and extend.
+       * tests/tap-skip-plan-errors.test: Likewise, and fix an obsolete
+       small part of a comment.
+       * tests/tap-skip-whole-bailout.test: New test.
+       * tests/tap-skip-whole-unplanned.test: Likewise.
+       * tests/tap-skip-whole-continue.test: Likewise.
+       * tests/Makefile.am (tap_with_common_setup_tests): Update.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: avoid possible fork bomb
+       This fixes a regression w.r.t. the master branch, exposed by
+       test 'parallel-tests-fork-bomb.test'.
+       * lib/am/check.am (am--redo-logs): Detect possible infinite
+       recursion due to a test log in $(TEST_LOGS) being the same
+       as $(TEST_SUITE_LOG).
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: enhance test against infinite recursion in test harness
+       * tests/parallel-tests-fork-bomb.test: Enhance and extend a
+       little now, for soon-to-be-implemented more explicit and safer
+       semantics.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: possible infinite recursion in the test harness
+       Motivated by a regression in the 'test-protocols' branch.
+       * tests/parallel-tests-fork-bomb.test: New test, checking that
+       if $(TEST_SUITE_LOG) is in $(TEST_LOGS), we obtain a diagnosed
+       error rather than a make hang or a fork bomb.
+       * tests/Makefile.am (TESTS): Update.
 
-2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       docs, tests: synchronize examples on silent-rules from config.site
-       * doc/automake.texi (Automake silent-rules Option): Reference test
-       'silent-configsite.test' in comments.
+       test defs: yet more environment cleanup
+       * tests/defs: Also unset the TEST_SUITE_LOG variable.
 
-2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-08-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       tests: portability fixes in tests on amhello examples
-       * tests/amhello-binpkg.test: Don't use "tar xzf too.tag.gz" to
-       extract a gzip-compressed tarball, that's unportable to some
-       tar implementations; use the "gzip -dc fo.tar.gz | tar xf -"
-       idiom instead.
-       * tests/amhello-cflags.test: Likewise.
-       * tests/amhello-cross-compile.test: Likewise.
+       self tests: some minor refactoring
+       * tests/self-check-exit.tap: Disable the `errexit' shell flag;
+       this allow to remove some boilerplate idioms and to make some
+       code slightly less cumbersome.
+       * tests/self-check-me.tap: Likewise.
+
+2011-08-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: look for TAP-based tests without TAP plan
+       * Makefile.am (sc_tests_tap_plan): New maintainer check.
+       (syntax_check_rules): Add it.
+       * tests/suffix10.tap: Declare a TAP plan.
+       * tests/add-missing.tap: Likewise.
+
+2011-08-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: avoid confusing SKIP messages for errored tests
+       * tests/defs [$use_tap] (exit trap): Don't print the test plan
+       in case the client script exited with a non-zero status.  This
+       avoids the display of redundant "SKIP" messages for tests with
+       lazy plans that error out before any test is run.
+
+2011-08-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: keep more debugging info around in 'add-missing.tap'
+       * tests/add-missing.tap: Use a different directory for each test,
+       so that in case of failure more information is kept around.
+       Since we are at it, remove redundant TAP diagnostic, and define
+       `$am_create_testdir' to "empty" to avoid bringing in unused
+       auxiliary files.
+
+2011-08-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: more granular count of test results in our TAP library
+       * tests/tap-functions.sh ($tap_bad_count_): Removed, superseded
+       by ...
+       ($tap_fail_count_, $tap_xpass_count_): ... these new variables,
+       which keep more granular counts.
+       ($tap_pass_count_: New variable.
+       * tests/defs (exit trap): Adjust and simplify accordingly.
+
+2011-08-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fixlets and improvements in two long TAP-based tests
+       * tests/depmod.tap: Clean up the subdirectories used by tests that
+       passed, to avoid ending up with a too big test directory.  This is
+       especially important since, on each and every system, at least some
+       tests in this script are expected to be skipped (which ones exactly
+       depends on the system), thus causing the test directory not to be
+       removed when the script terminates.
+       * tests/instspc.tap: Likewise (with the difference that tests here
+       are not expected to be skipped, but to xfail).  Give more explicit
+       error message in case of setup failure.  Skip the proper number of
+       tests when required, to avoid spurious errors due to mismatched
+       plan.  Also, really avoid to run the unsupported test cases when
+       the need to skip them is detected.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: recursive make invocations must use $(AM_MAKEFLAGS)
+       * lib/am/check.am ($(TEST_SUITE_LOG)): Pass $(AM_MAKEFLAGS)
+       to $(MAKE) when issuing a recursive make call.
+       Problem detected by the `sc_tests_make_without_am_makeflags'
+       maintainer check.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in 'suffix-chain.tap'
+       * tests/suffix-chain.test: Use more uncommon suffixes that
+       don't trigger built-in recipes with FreeBSD make.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: improvements to our shell TAP library and APIs
+       These improvements impact only the Automake's own testsuite.
+       * tests/tap-functions.sh (plan_): Allow new special arguments
+       "unknown" a.k.a. "later" and "lazy" a.k.a. "now".  Perform
+       sanity check the given arguments.  Adjust incorrect comments.
+       (lazy_plan_): Removed, superseded by the new version of `plan_'.
+       (not): New function, run a command and inverts its exit status.
+       (ok_, not_ok_, skip_): These are just shorthands for common
+       `result_' usages.
+       (xfail_, xpass_, reset_test_count_): Removed, they are not used,
+       nor does a legitimate use for them seem in sight.
+       (not): New function, to run a command inverting its exit status.
+       (command_not_ok_): Removed, superseded by `command_ok_' + `not'.
+       (command_ok_): Extended to accept TAP directives.
+       * tests/defs (trap): Don't use `late_plan_' anymore, use
+       `plan_ "now"' instead.
+       * tests/ac-output-old.tap: Update to take advantage of the new
+       APIs.
+       * tests/self-check-env-sanitize.tap: Likewise.
+       * tests/suffix-chain.tap: Likewise.
+       * tests/suffix10.tap: Likewise.
+       * tests/suffix11.tap: Likewise.
+       * tests/suffix3.tap: Likewise.
+       * tests/suffix8.tap: Likewise.
+       * tests/tap-bad-prog.tap: Likewise.
+       * tests/self-check-exit.tap: Likewise, plus a small improvement
+       in the name of a variable.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: convert some `suffix*' tests to TAP
+       This will allow us to explicitly declare some expected failures
+       involving Solaris make as such, instead of partly papering over
+       them with skips and partly letting them fail too loudly.
+       * tests/suffix-chain.test: Rename ...
+       * tests/suffix-chain.tap: ... to this, and convert to the use of
+       TAP.  Also, fix some bugs since we are at it, and ...
+       ($required): ... require `cc'.
+       * tests/suffix3.test: Rename ...
+       * tests/suffix3.tap: ... to this, and convert to the use of TAP.
+       Also, since we are at it, throw in some formatting fixes.
+       * tests/suffix8.test: Rename ...
+       * tests/suffix8.tap: ... to this, and convert to the use of TAP.
+       Also, since we are at it, throw in some formatting fixes.
+       * tests/suffix10.test: Rename ...
+       * tests/suffix10.tap: ... to this, and convert to the use of TAP.
+       * tests/suffix11.test: Rename ...
+       * tests/suffix11.tap: ... to this, and convert to the use of TAP.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: don't let a known Solaris make bug poison too many tests
+       See automake bug#7670 and bug#7824.
+       * tests/defs (make_can_chain_suffix_rules): New function, tell
+       whether the make implementation in use can chain suffix rules
+       automatically or not.
+       * tests/suffix3.test: Use it to avoid issuing calls to make that
+       are unportable to make implementations that are not smart enough
+       to chain suffix rules automatically.
+       * tests/suffix8.test: Use it to avoid issuing calls to make that
+       * tests/suffix10.test: Use it to avoid issuing calls to make that
+       * tests/suffix11.test: Use it to avoid issuing calls to make that
+       * tests/suffix-chain.test: New test, exposes the limitation that
+       we have papered over in the tests above.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       gitignore: more use of anchors
+       * .gitignore: Anchor files that are intended to be ignored only
+       if found in the same directory of the `.gitignore' file, not also
+       in its subdirectories.
+       * doc/.gitignore, doc/amhello/.gitignore, lib/Automake/.gitignore,
+       lib/Automake/tests/.gitignore, tests/.gitignore: Likewise.  Also,
+       where needed, add new entries that were once implied by the
+       non-anchored entries in the upper-level `.gitignore' files.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: avoid spurious output on console, and related fixlets
+       * tests/self-check-cleanup.test: Set `$stderr_fileno_' to `2'
+       in the self tests, to avoid spurious diagnostic on console.
+       * tests/self-check-exit.tap: Only unset `am_explicit_skips' and
+       `$stderr_fileno_' in the self tests, not at the global level, it
+       is more correct.
+       ($init): New variable, to reduce code duplication.
+       Some refactoring and adjustments to the name of the tests.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: few more sanity checks
+       * tests/defs: Catch some more (very unlikely) set-up or internal
+       errors, and diagnose them explicitly.  This is intended mostly
+       to be a theoretic-only improvement.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: really make them "set -e" clean
+       Motivated by a spurious failure of test `instsh3-w.shtst' on
+       Solaris 10.
+       * tests/defs: Make really "set -e" clean, to avoid spurious
+       failures in case this file is sourced by a test script that has
+       already set the `errexit' flag.  To be sure we don't regress,
+       move the `set -e' call much earlier, and make the comment telling
+       about the expected "set -e" cleanliness more loud and outstanding.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: register an expected failures with Solaris /bin/sh
+       Solaris 10 /bin/sh erroneously exit with success right away when
+       the following three conditions are met at the same time:
+        1. the `errexit' flag is active,
+        2. an exit trap is installed, and
+        3. a non-existing command is issued.
+       * tests/self-exit.tap: When that bug is detected, issue an XFAIL
+       rather than a FAIL.  Since we are at it, improve by avoiding
+       creation of stray temporary files when testing for non-executable
+       commands.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       gitignore: update and improve for the testsuite files
+       * tests/.gitignore: Don't ignore temporary partial log files,
+       autogenerated tests and makefile fragments that are not used
+       anymore.  Anchor all the remaining patterns.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: some new uses of TAP, few extensions
+       * tests/self-check-me.test: Renamed ...
+       * tests/self-check-me.tap: .. to this, and converted to use TAP.
+       * tests/self-check-exit.test: Renamed ...
+       * tests/self-check-exit.tap: .. to this, and converted to use TAP.
+       Set `$stderr_fileno_' to `2', to avoid spurious messages on the
+       console.  Add a new test, and relax another one.
+       * tests/self-check-env-sanitize.test: Renamed ...
+       * tests/self-check-env-sanitize.tap: .. to this, and converted to
+       the use TAP.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: test directory creation more configurable
+       After this change, the individual tests will be able to tell
+       `./defs' whether or not to create a temporary test directory
+       for them, and if yes, whether or not to pre-populate it.
+       * tests/defs: Only create the temporary test directory if the
+       variable `$am_create_testdir' is not set to "no".  In this
+       case, only pre-populate it if that variable is not set to
+       `$empty'.
+       * tests/defs-static.in: Check that `$am_create_testdir' is not
+       exported in the environment.
+       * tests/self-check-env-sanitize.test: Update.
+       * tests/self-check-dir.test: Extend, and make deeper and more
+       robust.
+       * tests/README (Section "Writing test cases" subsection "Do"):
+       Update.
+       * tests/autodist.test: Set `$am_create_testdir' instead of
+       removing by hand files created by ./defs.
+       * tests/tap-doc2.test: Likewise.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: more uses of the `seq_' function
+       * tests/parallel-tests-exit-statuses.test: Use the `seq_' function
+       from `tests/defs', instead of duplicating its semantics.
+       * tests/testsuite-summary-count.test: Likewise.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: drop redundant environment sanitization
+       * tests/Makefile.am (TESTS_ENVIRONMENT): Don't remove `planned'
+       from the environment.
+       * tests/defs-static.in: Don't complain if `planned' is set in
+       the environment.
+       * tests/self-check-env-sanitize.test: Update.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: fix bug in plain version of `skip_all_'
+       * tests/plain-functions.sh (skip_all_): Call `skip_', not `skip'.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: small cleanups and tweakings
+       * tests/defs: Where possible, prefer `framework_failure_' or
+       `fatal_' to `Exit 99'.  Try to catch more possible hard errors
+       and setup failures.  Do not hide expected error messages.  Avoid
+       a couple of forks when copying files from `$(top_srcdir)/lib'.
+       ($signal): Remove, no more needed.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: improve interface for giving early TAP plan
+       Since commit `v1.11-976-g4740f56', an early TAP plan can also be
+       specified after input lines have already been seen, as long as
+       no one of them is a TAP result line.  We can now take advantage
+       of this in our own testsuite, allowing the TAP-based scripts to
+       specify their earlier plan after having included `./defs'.  In
+       particular, this offers the benefit of allowing those scripts to
+       issue a "skip all" plan (e.g., "1..0 # SKIP reason ...") after
+       the inclusion of `./defs', which wasn't possible with the older
+       interface (introduced in commit `v1.11-1114-g0286308').
+       * tests/defs: Don't try to call `plan_' if `$planned' is defined,
+       the calling scripts can do that directly now.
+       * tests/ac-output-old.tap: Use `plan_' directly instead of
+       setting `$planned' before including `./defs'.
+       * tests/automake-cmdline.tap: Likewise.
+       * tests/depmod.tap: Likewise.
+       * tests/instspc.tap: Likewise.
+       * tests/tap-bad-prog.tap: Likewise.
+       * tests/add-missing.tap: Don't set `$planned'.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: fix bug in TAP version of `skip_all_'
+       * tests/tap-functions (skip_all_): Set `$have_tap_plan_' to "yes"
+       when called, so that the exit trap won't write another TAP plan.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: fix skip directives to work also with TAP-based tests
+       * test/defs: Use `skip_all_', not `skip_', to issue a skip of the
+       whole calling test script.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: more environment cleanup
+       * tests/defs: Also unset variables AM_COLOR_TESTS and
+       AM_TESTS_ENVIRONMENT.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: more minor VPATH-rewrite issues
+       * tests/am/check.am (am__set_TESTS_bases, $(TEST_SUITE_LOGS),
+       am--redo-logs, recheck, recheck-html): Cosmetic fixlets to
+       minimize the risk of unwanted VPATH rewrites.
+       (check-TESTS): Likewise, and normalize trailing whitespace
+       since we are at it.
+       Bugs exposed by test cases `check6-p.test' and `check7-p.test'.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: "make -n check" works correctly with Solaris make
+       To avoid some recipes being executed with "make -n", we used the
+       trick of issuing recursive make calls not directly with $(MAKE),
+       but with a simple indirection instead:
+         ...
+         am__stealth_MAKE = $(MAKE)
+         ...
+         target:
+             ... $(am__stealth_MAKE) ...
+         ...
+       This hack worked with GNU make, but, unfortunately, not with
+       Solaris make.  The present change removes the hack, and uses more
+       proper idioms to avoid unwanted recipe executions with "make -n".
+       Bug exposed by test case `parallel-tests-dry-run.test'.
+       * lib/am/check.am (am__stealth_MAKE): Remove, no more used.
+       (.log.trs): Break recipe in multiple shell invocations.
+       ($(TEST_SUITE_LOG)): Likewise, and move some corner-case parts of
+       the recipe to ...
+       (am--redo-logs): ... this new internal helper .PHONY target.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure with Solaris make
+       * tests/distcheck-configure-flags-am.test: Avoid using `+=' too
+       liberally with AM_DISTCHECK_CONFIGURE_FLAGS, since the line breaks
+       so introduced, in conjunction with single quotes, might confuse
+       Solaris make.
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: fixlet in workaround for VPATH rewrite issue
+       Fixes a minor in previous commit `v1.11-983-gfda3de5'.
+       * lib/am/check.am (am__set_TESTS_bases): Add forgotten end-of-line
+       anchor to sed expression.  In comments, add reference to ...
+       * tests/test-trs-basic.test: ... this test, which has been adapted
+       and tightened (and tweaked).
+
+2011-08-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: work around a VPATH rewrite issue
+       * lib/am/check.am (am__TEST_BASES): Removed, it's role taken
+       over by ...
+       (am__set_TESTS_bases): ... these new variable.
+       ($(TEST_SUITE_LOG): Use it, to avoid VPATH rewrite issues.
+       * automake.in (handle_tests): Update the code for the cleanup
+       of the `.trs' file to use `$(TEST_LOGS)' instead of
+       `$(am__TEST_BASES)'.
+       * tests/test-harness-vpath-rewrite.test: New test, better
+       exposing the problem fixed by this change
+       * tests/Makefile.am (TESTS): Add it.
+       * tests/test-trs-basic.test: Update and extend.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: work around Solaris XPG4 make segfault
+       Issue exposed by test `posixsubst-tests-p.test', and similar to
+       the problem solved by commit `v1.11-159-ge7aa360'.
+       * lib/am/check.am [%?PARALLEL_TESTS%] (check-TESTS): Trim trailing
+       whitespace from $list, to avoid triggering a nasty bug (potential
+       segfault) on Solaris XPG4 make and Heirloom make.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix weird spurious failure with Solaris /bin/sh
+       Solaris /bin/sh, when killed with a SIGTERM or SIGINT signal, can
+       apparently end up exiting with exit status 208, instead of leaving
+       the correct wide exit status to the parent.  See:
+        <http://dbaspot.com/shell/396118-bourne-shell-exit-code-term.html>
+       Work around this incompatibility.
+       * tap-signal.test: Look for the above Solaris bug.
+       (signal_caught): Adapt to handle it.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix another spurious failure on Solaris make
+       * tests/parallel-tests-log-override-recheck.test: Filter make
+       output before grepping it, for make implementations that, like
+       Solaris' one, print the whole of the failed recipe on failure.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix two spurious failures on Solaris make
+       * tests/tests-environment-and-log-compiler.test: Do not fail if
+       "make -n check" fails, as that is issued only for debugging, its
+       semantics being tested in other test scripts.
+       * tests/test-driver-strip-vpath.test: Likewise.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap driver: refactor and remove dead code
+       * lib/tap-driver (get_tap_line): Removed, ...
+       (all callers): ... updated to use $parser->next directly instead.
+       (peek_tap_line, unget_tap_line, @tap_lines): Remove, they're not
+       used anymore.
+       (TAP_PEEKING): Block deleted, all its subroutines and variables
+       having been removed.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix spurious failure in a test on TAP support
+       * tests/tap-passthrough-exit.test: When the `--ignore-exit' flag
+       of the TAP driver is used, don't look for a message reporting the
+       non-zero exit statuses of tests in the log files; such message is
+       not expected to be there anymore.  Related simplifications.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: plan location is more liberal w.r.t. non-TAP lines
+       With this change, only lines that are TAP results will matter
+       w.r.t. the position of the TAP plan in the input; for example,
+       this input:
+         this is a non-TAP line
+         # and this a TAP diagnostic line
+         1..1
+         ok 1
+       was considered to be an error, diagnosed with a message "test
+       plan in middle of output"; as effect of the current change, such
+       input is now valid.  This is more consistent with the behaviour
+       of the `prove' utility.
+       * lib/tap-driver ($lineno): Removed, no more needed.
+       ($tap_stopped): New global variable.
+       (stringify_test_result): Return "ERROR" if a TAP result is found
+       when `$tap_stopped' is set to true.
+       (handle_tap_test): Diagnose TAP results that comes after a late
+       plan.  Add a couple of blank lines, for clarity.
+       (handle_tap_plan): Set `$tap_stopped' to true after a late plan
+       is encountered.  Do not complain anymore for extra non-TAP lines
+       preceding or following the plan.  Adjust comments.
+       (main): Don't increment $lineno anymore.
+       * tests/tap-plan.test: Extend a bit, and remove stale comment.
+       * tests/tap-color.test: Adjust.
+       * tests/tap-passthrough.test: Likewise.
+       * tests/tap-plan-corner.test: Adjust and extend.
+       * tests/tap-plan-errors.test: Likewise.
+       * tests/tap-plan-middle.test: New test.
+       * tests/tap-plan-corner2.test: Delete, it's obsolete now.
+       * tests/Makefile.am (XFAIL_TESTS): Remove it.
+       (tap_with_common_setup_tests): Likewise, and add
+       `tap-plan-corner.test'.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: remove now-passing test from XFAIL_TESTS
+       * tests/Makefile.am (XFAIL_TESTS): Remove `tap-signal.test',
+       which is passing since previous commit `v1.11-974-gc7fa872'.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: get name of TAP-using tests correctly
+       This change fixes the names of the temporary directories used
+       by the TAP-based tests (e.g., test `foo.tap' now uses `foo.dir'
+       rather than `foo.tap.dir'); more importantly, this make the
+       variable `$destdir' defined in `tests/defs' usable also in the
+       TAP tests.
+       ($me): Also strip the any `.tap' suffix from the name of the
+       test.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: TAP tests properly decide when to remove tempdirs
+       Before this change, the TAP tests in the Automake testsuite were
+       removing the temporary test directory even when they failed or
+       were skipped, thus making debugging more difficult.
+       * tests/tap-functions.sh (incr_tap_count): Removed, superseded
+       by ...
+       (incr_): ... this function, which can increment the value of any
+       variable passed to it.
+       (result_):  Updated to use `incr_' instead of the now-removed
+       `incr_tap_count_'.  Keep count of failures, xfailures, xpasses,
+       and skips, using ...
+       ($tap_skip_count_, $tap_bad_count, _$tap_xfail_count_): ...
+       these new variables.
+       * tests/defs (trap): Try to use their values to decide whether
+       the temporary directory being used by the test script should be
+       removed or not.  Other code reorganizations.  And move the code
+       for the removal of the temporary directory out to ...
+       (rm_rf_): ... this new subroutine.
+       (Main code): Use that instead of duplicating the code.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: improve and refactor our custom TAP shell library
+       This change is mostly done in preparation for the next one.
+       * tests/tap-functions.sh (result_with_directive_): Merge into ...
+       (result_): ... this function, which has been greatly extended and
+       improved in various ways.
+       (ok_, not_ok_, skip_, xfail_, xpass_): Adjust.
+       Adjust comments.  Remove an extra empty line.
+       * tests/instspc.tap: Use the new improved interface of `result_'.
+       * tests/tap-bad-prog.tap: Likewise.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: update "user interface" description in tests/README
+       * tests/README (Subsection "Interpretation"): Mention the "ERROR"
+       outcome.
+       (Subsection "Getting details from failures"): Don't tell that the
+       test scripts can be run directly, this is not 100% true; anymore;
+       instead ...
+       (Subsection "About the tests"): ... use this new subsection to
+       explain how to run the tests (either simple or TAP-based) by hand.
+       (Subsection "Supported shells"): Extend to refer to TAP tests too.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: TAP tests can have early plan now
+       * tests/defs: When using TAP, allow the user to specify the number
+       of tests through the `$planned' variable.
+       (trap): Do not print the auto-generated plan if an explicit one
+       has already been printed.
+       * tests/defs-static.in: Complain and bail out if the `$planned'
+       variable is exported in the environment.  Reformat the code to
+       facilitate future additions.
+       * tests/Makefile.am (TESTS_ENVIRONMENT): Neutralize `$planned'.
+       * tests/self-check-env-sanitize.test: Update.
+       * tests/ac-output-old.tap: Give an explicit TAP plan, by defining
+       `$planned' just before including `./defs'.
+       * tests/depmode.tap: Likewise.
+       * tests/automake-cmdline.tap: Likewise.
+       * tests/tap-bad-prog.tap: Likewise.
+       * tests/instspc.tap: Likewise, and related adjustments.
+       * tests/add-missing.tap: Make it explicit that we have no a-priori
+       plan, and tell why.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: run autogenerated tests with $(LOG_COMPILER) too
+       This change enhances consistency in the testsuite.
+       * tests/Makefile.am: Some cosmetic reordering, to keep the
+       definition of FOO_LOG_COMPILER near to the place where `.foo'
+       is added to $(TEST_EXTENSIONS).
+       (PTEST_LOG_COMPILER): Run `$(srcdir)/parallel-tests.sh' with
+       `$(LOG_COMPILER)', not with `$(SHELL)'.
+       (SHTST_LOG_COMPILER): Likewise.
+
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: run TAP and "plain" tests with the same $(LOG_COMPILER)
+       With this change, it will be easier to override, at make time, the
+       shell used to run the tests.
+       * tests/Makefile.am (LOG_COMPILER): Define to `$(SHELL)'.
+       (TEST_LOG_COMPILER): Re-define to `$(LOG_COMPILER)'.
+       (TAP_LOG_COMPILER): Likewise.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: run TAP-based tests explicitly with $(SHELL)
+       * tests/Makefile.am (TAP_LOG_COMPILER): Define to `$(SHELL)'.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap driver: handle signals received by the tests being run
+       * lib/tap-driver (get_test_exit_message): Also deal with signals,
+       by using the `wait' method of the TAP::Parser object instead of
+       the `exit' method.  This required the use of the standard perl
+       module `POSIX'.
+       * doc/automake.texi (Use TAP with the Automake test harness):
+       Document that `--ignore-exit' has effect also on terminating
+       signals.  Add a "synchronizing" comment that references the tests
+       'tap-exit.test' and 'tap-signal.test'.
+       * tests/tap-signal.test: Extend and adjust.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test driver: a preparatory refactoring (2)
+       * lib/tap-driver (finish): Move code to fetch the message about
+       the exit status of the test being run to ...
+       (get_test_exit_message): ... this new subroutine.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap driver: a preparatory refactoring (1)
+       * lib/tap-driver (finish): Do not flush the TAP stream nor
+       fetch the exit status of the TAP producer if running with
+       the `--ignore-exit' option.  Obviously, don't try to write
+       such exit status in the test log anymore.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetics: typofix in the name of a function in the TAP driver
+       * lib/tap-driver (testuite_error): Renamed ...
+       (testsuite_error): ... to this, and minor related reformatting.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: scripts with a SKIP plan but with exit status != 0 must error
+       This change has been motivated by Automake's own testsuite.  Some
+       TAP tests there were erroring out (due to unexpected, unhandled
+       failures) before having encountered TAP result, so that the
+       simple-minded shell library implementing TAP generation ended up
+       printing a "1..0" trailing test plan; this caused the script to be
+       reported as a SKIP rather than an ERROR -- a nasty false negative.
+       * lib/tap-driver: Add prototypes for each subroutine, to free up
+       the order in which they can be defined and called.
+       (main): Move the code checking for a bad exit status of the TAP
+       producer ...
+       (finish): ... here, and flush the TAP stream to ensure that the
+       parser always obtains the producer's exit status.
+       * tests/tap-skip-whole-badexit.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Add it.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: fix whitespace munging of diagnostic messages
+       * lib/tap-driver (extract_tap_comment): Pass the `g' flag to the
+       substitution operator, to strip also trailing whitespaces.  Fixes
+       a failure in test `tap-whitespace-normalization.test'.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: refactor and cleanup 'instspc.tap'
+       * tests/instspc.tap (is_in_list): New helper subroutine.
+       (expected_to_fail): Re-implement using it.
+       (define_problematic_string): Likewise.  Also, rename the special
+       arguments `build-fail' and 'install-fail' to respectively
+       `builddir-fail' and `destdir-fail', and other related changes.
+       (Test data definition): Adapt.
+       ($instspc_xfail_builds_list): Renamed ...
+       ($builddir_xfails): ... to this.
+       ($instspc_xfail_installs_list): Renamed ...
+       ($destdir_xfails): ... to this.
+       ($instspc_names_list): Renamed ...
+       ($test_names_list): ... to this.
+       ($instspc_test_string): Renamed ...
+       ($test_string): ... to this.
+       Add some explicative and "FIXME" comments.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use TAP for `depmod*' tests, related simplifications
+       * tests/depmod-tests.sh: Delete this complex and multifarious
+       script, moving all it checks it used to perform into ...
+       * tests/depmod.tap: ... this TAP-based test script.  And extend
+       it quite a bit, since the new form of the test was papering over
+       some pre-existing failures (this was due to the fact that the
+       values used for the VPATH were shorter in the new test script).
+       * tests/depmod-data.test: Deleted.
+       * tests/Makefile.am ($(srcdir)/depmod-tests.am): Don't include
+       nor generate it anymore.
+       (EXTRA_DIST): Don't distribute depmod-tests.sh anymore.
+       (TEST_EXTENSIONS): Remove '.depmod'.
+       (DEPMOD_LOG_COMPILER): Deleted.
+       (depmod-data.log, $(depmod_tests:.depmod=.log)): Delete
+       dependencies for these files, which are not used anymore.
+       ($(depmod_tests)): Delete this dummy dependency declaration.
+       (TESTS): Remove $(depmod_tests).
+       (handwritten_tests): Remove depmod-data.test, add depmod.tap.
+       * bootstrap: Don't generate tests/depmod-tests.am anymore.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use TAP for `instspc*' tests, related simplifications
+       * tests/instspc-tests.sh: Delete this complex and multifarious
+       script, moving all it checks it used to perform into ...
+       * tests/instspc.tap: ... this TAP-based test script.
+       * tests/instspc-data.test: Deleted.
+       * tests/Makefile.am ($(srcdir)/instspc-tests.am): Don't include
+       nor generate it anymore.
+       (EXTRA_DIST): Don't distribute instspc-tests.sh anymore.
+       (TEST_EXTENSIONS): Remove '.instspc'.
+       (INSTSPC_LOG_COMPILER): Deleted.
+       (XFAIL_TESTS): Remove $(instspc_xfail_tests).
+       (instspc-data.log, $(instspc_tests:.instspc=.log)): Delete
+       dependencies for these files, which are not used anymore.
+       ($(instspc_tests)): Delete this dummy dependency declaration.
+       (TESTS): Remove $(instspc_tests).
+       (handwritten_tests): Remove instspc-data.test, add instspc.tap.
+       * bootstrap: Don't generate tests/instspc-tests.am anymore.
+
+2011-08-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: do fd redirections with $(AM_TESTS_FD_REDIRECT)
+       * tests/Makefile.am: The redirections of file descriptors needed
+       by our test scripts is now done using the $(AM_TESTS_FD_REDIRECT)
+       variable (the new blessed way since commit `v1.11-906-gb9e9d54'),
+       not using an hack involving $(AM_TESTS_ENVIRONMENT).  This has
+       the further benefit of allowing the use of $(TESTS_ENVIRONMENT)
+       again on part of the users.
+       * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Remove redirection of
+       file descriptors.
+       (AM_TESTS_FD_REDIRECT): Redirect file descriptor 9 to original
+       stderr.
+       Comments adjusted.
+       * tests/plain-functions.sh ($stderr_fileno_): Update comment.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use custom TAP diagnostic in our own tests
+       This change allow us to easily and transparently avoid spurious
+       TAP diagnostic in our own testsuite, with the help of the new
+       `--diagnostic-string' option of our TAP test driver.
+       * tests/Makefile.am (TAP_LOG_DRIVER_FLAGS): Also pass option
+       `--diagnostic-string' with value `#%#' (necessarily obtained
+       through some shell indirections).
+       * tests/tap-functions.sh (diag_): Assume that the string denoting
+       TAP diagnostic is stored in the `$diag_string_' variable.  Update
+       comments.
+       ($diag_string_): Initialize to "#".
+       * tests/defs ($diag_string_): Re-define to "#%#".
+       (show_): Remove, it's obsolete now.
+       * add-missing.tap: Don't use `show_' anymore to avoid spurious
+       TAP diagnostic; `cat' should suffice now.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: fix typo in TAP driver version message
+       * lib/tap-driver (anonymous subroutine printing the script version
+       message): Add missing trailing newline to the version message.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap docs: we don't support pragma or version directives (yet)
+       * doc/automake.texi (Incompatibilities with other TAP parsers
+       and drivers): Document that limitation.  Normalize an unrelated
+       "TODO" item.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: new option to change the string designating TAP diagnostic
+       Here we introduce a new option `--diagnostic-string' in our TAP
+       test driver, that allows the user to specify which string should
+       denote the beginning of a TAP diagnostic line.  This change is
+       not gratuitous, nor result if over-engineering: it is motivated
+       by real issues that have emerged during the use of TAP in the
+       Automake's own testsuite (see the commit `v1.11-1082-g9b967c2'
+       "testsuite: yet more use of TAP, and related extensions").
+       * doc/automake.texi (Use TAP with Automake test harness): Document
+       the new option.
+       (Incompatibilities with other TAP parsers and drivers): Report it
+       as a potential source of incompatibility.
+       * lib/tap-driver ($diag_string): New global variable, defaulting
+       to "#", and whose value can be changed ...
+       (Getopt::Long::GetOptions): ... by the newly recognized option
+       `--diagnostic-string'.
+       (handle_tap_comment): Subroutine removed, some of its simple logic
+       inlined ...
+       (main): ... in here, where now ...
+       (extract_tap_comment): ... this new subroutine is used.
+       ($USAGE): Adjust.
+       * tests/tap-diagnostic.test: Make one check slightly stricter.
+       * tests/tap-diag-custom.test: New test.
+       * tests/Makefile.am (tap_other_tests): Add it.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       check: add small "synchronization" comment to `test-driver'
+       * lib/test-driver: Add comment to the code initializing ANSI color
+       escapes, telling to keep it in sync with the similar initialization
+       in `lib/am/check.am'.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: fix spurious failure w.r.t. use of bare "exit"
+       * tests/check12.test: Cosmetic changes to avoid triggering a
+       spurious failure of the `sc_tests_Exit_not_exit' maintainer
+       check.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       check: update comments to reflect recent heavy changes
+       * lib/am/check.am [%?PARALLEL_TESTS%]: Update the comments to
+       reflect the recent changes.  Remove quite many comments that
+       were merely duplicating excerpts from the Automake manual.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       check: small cleanups and refactorings in test harness and drivers
+       * lib/tap-driver (yn): New subroutine, converts a boolean value to
+       a "yes" or "no" string.
+       (write_test_results): Use it, and related reformatting.
+       * lib/test-driver (trap): Also remove the `.trs' file on signals,
+       for extra safety.
+       (fatal): Remove this function, it's never used.
+       ($logfile, $trsfile): Renamed ...
+       ($log_file, $trs_file): ... to these, for clarity, and in order to
+       be more consistent with the `tap-driver' script.
+       Improve a couple of comments.
+       * automake.in (handle_tests): Don't define anymore the now-obsolete
+       make macro `$(TEST_LOGS_TMP)', nor add it to the list of files to
+       be removed upon "make mostlyclean".
+       * lib/am/check.am ($(TEST_SUITE_LOG)): New shell function `f_ok',
+       tells whether a path refers to an existing, regular, readable file.
+       Use it throughout.
+       (recheck): Be safer w.r.t. make implementation that run recipes
+       with `errexit' shell flag active.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use AM_TESTS_FD_REDIRECT where appropriate
+       * parallel-tests-interrupt.test: Use AM_TESTS_FD_REDIRECT, not
+       AM_TESTS_ENVIRONMENT, to define file descriptors' redirection
+       for "make check".  Fix botched comment.
+
+2011-08-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: some fixlets in documentation on testsuites support
+       * doc/automake.texi (Script-based Testsuites): Rename node ...
+       (Scripts-based Testsuites): ... to this.  Break overly long lines
+       in an example (were causing problems with PDF output).
+       (Parallel Test Harness): Don't intend paragraphs that come after
+       examples or bulleted list.
+       (Overview of Custom Test Drivers Support): Fix typo s/the the/the/.
+       (Declaring Custom Test Drivers): When giving an aside, prefer comma
+       to parentheses, as it disrupts the reading flow less.
+       (API for Custom Test Drivers): Remove a sentence that was basically
+       duplicated from the previous subsection.
+       (Command-line arguments for test drivers): Don't intend paragraph
+       coming after an itemized list.  Clarify wording and fix grammaros.
+       Add a couple of cross-references to earlier explanations of `.log'
+       and `.trs' files.
+       (Links and external resources): Node renamed ...
+       (Links and external resources on TAP): ... to this, for clarity.
+       Slightly extend and clarify introductory sentence.
+
+2011-08-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: be aware of more metadata, simplify test drivers
+       * lib/am/check.am ($(TEST_SUITE_LOG)):  When producing the
+       global test log, take into account the new metadata field
+       `:global-test-result:, to write nicely formatted RST section
+       titles, instead of leaving this chore to the individual test
+       drivers.
+       (am_rst_section): Re-introduce this variable, as removed in
+       commit `v1.11-870-ga27c9c4'.
+       * lib/test-driver, lib/tap-driver: Write the global test result
+       as metadata in the `.trs' file, not as (part of) a formatted RST
+       subsection title in the `.log' file.  Related simplifications;
+       in particular, get rid of temporary files usage.
+       * doc/automake.texi (Log files generation and test results
+       recording): Document the new metadata.
+       * tests/check12.test: Update.
+       * tests/parallel-tests-harderror.test: Likewise.
+       * tests/parallel-tests-interrupt.test: Likewise.
+       * tests/parallel-tests-log-override-2.test: Likewise.
+       * tests/parallel-tests-log-override-recheck.test: Likewise.
+       * tests/parallel-tests-unreadable.test: Likewise.
+       * tests/tap-global-result.test: Likewise.
+       * tests/test-metadata-results.test: Likewise.
+       * tests/test-log.test: Likewise, and another minor unrelated fix.
+       * tests/test-metadata-global-result.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: check that also a trailing TAP plan can hold a skip directive
+       * tests/tap-skip-whole-lastline.test: New test.
+       * tests/Makefile.am (tap_with_common_setup_tests): Add it.
+
+2011-08-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: more correct names for a couple of tests
+       * tests/parallel-tests-ext-driver.test: Rename ...
+       * tests/parallel-tests-log-compiler-1.test: ... to this, and
+       adjust heading comments.
+       * tests/parallel-tests-ext-driver-prog.test: Rename ...
+       * tests/parallel-tests-log-compiler-2.test: ... to this, and
+       adjust heading comments.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-08-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix another spurious failure
+       * tests/parallel-tests-ext-driver.test: Name out custom/dummy
+       log compilers as `foo-compiler' rather `foo-driver'; not only
+       this is less confusing, it also avoids errors due to the dummy
+       log compiler `test-driver' overriding the `test-driver' helper
+       script installed by Automake.
+       * tests/parallel-tests-ext-driver-prog.test: Adjust heading
+       comments.
+
+2011-08-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix a spurious failure
+       * tests/parallel-tests-ext-driver.test: Exporting of environment
+       variables directly from $(LOG_COMPILER) variables is not allowed
+       anymore.  Adjust to this.
+
+2011-08-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: yet more use of TAP, and related extensions
+       * tests/defs (show_): New function, display the contents of one or
+       more files on stdout, with bells & whistles (both for cosmetic and
+       practical reasons, the latter aimed at avoiding spurious TAP
+       diagnostic).
+       (AUTOMAKE_run): Extend and adapt to make it compatible with TAP
+       based tests.  Since we are at it, make its implementation more
+       namespace-safe, and improve its command-line interface.
+       (AUTOMAKE_fails): Adapt to the new command-line interface of
+       `AUTOMAKE_run'.
+       * tests/add-missing.test: Renamed ...
+       * tests/add-missing.tap: ... to this, and converted to the use
+       of the TAP protocol, and of the new `show_' function.
+       * tests/automake.test: Renamed ...
+       * tests/automake-cmdline.tap: ... to this, and converted to the
+       use of the TAP protocol.
+       * tests/getopt.test:  Adapt to the new command-line interface
+       of `AUTOMAKE_run'.
+       * tests/cond44.test: Likewise.
+       * tests/cond45.test: Likewise.
+       * tests/configure.test: Likewise.
+       * tests/license2.test: Likewise.
+       * tests/parallel-am.test: Likewise.
+       * tests/parallel-am3.test: Likewise.
+       * tests/tags2.test: Likewise.
+       * tests/werror3.test: Likewise.
+       * tests/werror4.test: Likewise.
+       * tests/amopts-variable-expansion.test: Likewise.
+       * tests/warnings-win-over-strictness.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       (TAP_LOG_DRIVER_FLAGS): Add `--merge', so that TAP diagnostic is
+       reported in the testsuite progress output.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: fix more maintainer-check failures
+       * tests/test-driver-custom-no-html.test (no-rst): Use `EOF',
+       not `EoL', as the here-document delimiter.
+       * tests/test-trs-basic.test: Use `cat + here-doc' rather
+       than `echo' when creating the dummy test scripts, to please
+       maintainer-check.
+       * tests/test-trs-recover.test: Use creative quoting where
+       needed, to please maintainer-check.
+       * tests/parallel-tests-no-color-in-log.test: Likewise.
+       * tests/parallel-tests-dry-run.test: Likewise.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: fix maintainer-check failures, both real and spurious
+       * tests/amhello-binpkg.test: Use "$MAKE", not bare "make".
+       * Makefile.am (sc_perl_local): Also allow perl special variable
+       `$~' to be localized.  And be slightly laxer in the regexp, to
+       allow for usages like "local $_ = $foo;".
+       (sc_tests_overriding_macros_on_cmdline): Also allow for command
+       line overriding of the `DISABLE_HARD_ERRORS' make variable.  Try
+       to avoid false positives for usages like "$MAKE || st=$?".
+
+2011-08-03  Bruno Haible  <bruno@clisp.org>
+
+       docs: how to use '-I' option in AM_CPPFLAGS for best VPATH support
+       * doc/automake.texi (Program Variables): Recommend -I options to
+       both the build directory and the source directory when needed.
+
+2011-07-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: relax a test on amhello examples to cater to Solaris tar
+       * tests/amhello-binpkg.test: When the tar implementation in use
+       is not GNU tar, relax the tests on tar output, to avoid spurious
+       failures.  For example, "tar cvf ..." with GNU tar can output
+       lines like "./usr/bin/hello" on the standard output, while with
+       Solaris tar it can output lines like "a ./usr/bin/hello 8K" on
+       standard output, and with Heirloom tar it can output lines like
+       "a ./usr/bin/hello 15 tape blocks" on standard error.
+
+2011-07-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: function 'is_newest' now works also with directories
+       * tests/defs (is_newest): Call `find' with the `-prune' option,
+       so that it won't descend in the directories (which could cause
+       spurious results).
+       * tests/self-check-is_newest: Extend accordingly.
+       From a report by Jim Meyering, see automake bug#9147.
+
+2011-07-15  Benoit Sigoure  <tsunanet@gmail.com>
+
+       docs: add references between the 2 sections on java support
+       * doc/automake.texi (Java Support, Java): Add cross-references.
+
+2011-07-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Sync auxiliary files from upstream.
+       * INSTALL, lib/INSTALL, lib/config.guess, lib/config.sub,
+       lib/texinfo.tex: Sync from upstream.
+
+2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix weakness in 'tests-environment-backcompat.test'
+       * tests/tests-environment-backcompat.test: Do not override the
+       content of xfailing test `baz.test' with a "weaker" version that
+       fails unconditionally: the test must fail only when the 'strict'
+       pragma is in use, in order not to reduce coverage.
+
+2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs, tests: synchronize examples on silent-rules from config.site
+       * doc/automake.texi (Automake silent-rules Option): Reference test
+       'silent-configsite.test' in comments.
+
+2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: portability fixes in tests on amhello examples
+       * tests/amhello-binpkg.test: Don't use "tar xzf too.tag.gz" to
+       extract a gzip-compressed tarball, that's unportable to some
+       tar implementations; use the "gzip -dc fo.tar.gz | tar xf -"
+       idiom instead.
+       * tests/amhello-cflags.test: Likewise.
+       * tests/amhello-cross-compile.test: Likewise.
        Suggestion from Ralf Wildenhues.
 
 2011-07-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
        in the manual.
        * tests/output11.test:Likewise.
        * tests/txinfo21.test:Likewise.
-       * tests/interp.test: Likewise.  Since we are at it, and enable
-       the `errexit' shell flag, do related changes, and add trailing
-       `:'command.
+       * tests/interp.test: Likewise.
        * tests/amhello-cflags.test: New test.
        * tests/amhello-cross-compile.test: Likewise.
        * tests/amhello-binpkg.test: Likewise.
        * tests/parallel-tests-log-compiler-example.test: Likewise.
        * tests/Makefile.am (TESTS): Update.
 
+2011-06-30   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: new test on parallel-tests TESTS runtime overriding
+       * tests/parallel-tests-cmdline-override.test: New test, check that
+       we can use indirections when overriding TESTS and TEST_LOGS from
+       the command line.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       gitignore: ignore `*.trs' files in lib/Automake/tests
+       * lib/Automake/tests/.gitignore: Add `*.trs' pattern.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: list another "forgotten" test script in Makefile.am
+       * tests/Makefile.am (TESTS): Also list test script
+       `test-driver-trs-suffix-registered.test'; it had been introduced
+       in commit `v1.11-910-g0c81b43', but by mistake it wasn't added
+       to the list of tests in the Makefile back then.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: list "forgotten" test script in Makefile.am
+       * tests/Makefile.am (TESTS): Also list the test script
+       `parallel-tests-no-color-in-log.test'; it had been introduced in
+       commit `v1.11-899-geaac33f', but by mistake it wasn't added to
+       the list of tests in the Makefile back then.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: remove duplicated mention of a test in Makefile.am
+       * tests/Makefile.am (tap_other_tests): Remove `tap-empty.test',
+       it is already listed in `$(tap_with_common_setup_tests)'.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: one more use of TAP in our own tests
+       * tests/tap-bad-prog.test, tests/tap-bad-prog2.test: Merged
+       into ...
+       * tests/tap-bad-prog.tap: ... this TAP-generating test.
+       * tests/Makefile.am (tap_other_tests): Remove plan-bad-prog.test
+       and plan-bad-prog2.test.
+       (XFAIL_TESTS): Remove plan-bad-prog2.test.
+       (plan-bad-prog2.log): Remove.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: scaffolding to allow use of TAP in our own tests
+       Now that Automake has initial support for the TAP test protocol,
+       we can start "eating our own dog food" and rewrite some tests to
+       use TAP; this should allow for better granularity, especially in
+       the control of skips and expected failures.  With this change, we
+       set up the initial scaffolding required by the planned TAP tests,
+       and convert few older tests to use TAP, mostly in order to verify
+       that there are no obvious errors.  The tests in our testsuite that
+       use the TAP protocol will be marked by the new `.tap' extension.
+       * tests/plain-functions.sh: New file containing definition of
+       helper shell functions used by the "protocol-less" tests of the
+       Automake testsuite.
+       * tests/tap-functions.sh:  New file containing definition of
+       helper shell functions used by the TAP-producing tests of the
+       Automake testsuite.
+       * tests/defs: Remove definitions of some functions that are
+       now defined in `plain-functions.sh'.  Instead, source one of
+       `plain-functions.sh' or `tap-functions.sh', depending on whether
+       `$use_tap' is set to "no" or "yes".
+       (exit trap): Call `late_plan_' if `$use_tap' is true.  Also,
+       unset shell traces before issuing the latest commands, to avoid
+       confusing the tap driver with spurious output.
+       * tests/defs-static.in ($use_tap): New variable, by default set
+       to "yes" if the calling test script has a `.tap' suffix, and to
+       "no" otherwise.  The individual scripts can override it though.
+       In code sanity-checking the environment, verify that `$use_tap'
+       is not exported.
+       * tests/self-check-env-sanitize.test: Update, and small related
+       reformatting.
+       * tests/self-check-tap.test: New very minimal self test.
+       * tests/acoutbs.test, tests/acoutbs2.test, tests/acoutnoq.test,
+       tests/acoutpt.test, tests/acoutpt2.test, tests/acoutqnl.test:
+       Removed, merged into ...
+       * tests/ac-output-old.tap: ... this new test, that uses TAP.
+       * tests/Makefile.am (TAP_LOG_DRIVER): Define to invoke our own
+       `tap-driver' script.
+       (TAP_LOG_DRIVER_FLAGS): Define to `--merge', so that the stdout
+       and stderr of the test scripts remains synced.
+       (TEST_EXTENSIONS): Define, to add the `.tap' suffix; also list
+       the `.test' suffix explicitly.
+       (EXTRA_DIST): Distribute the new files `plain-functions.sh' and
+       `tap-functions.sh'.
+       ($(TEST_LOGS)): Depends on them.
+       (AM_TESTS_ENVIRONMENT): Ensure that `use_tap' is not exported in
+       the environment of the tests.
+       (TESTS): Update.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       * NEWS: Fix typo, and related reformatting.
+
+2011-08-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       * NEWS: add mention of new experimental TAP support
+
+2011-08-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: rename some test scripts
+       * tests/parallel-tests-am_tests_environment.test: Renamed ...
+       * tests/am-tests-environment.test: ... to this.
+       * tests/check-tests_environment.test: Renamed ...
+       * tests/tests-environment.test: ... to this.
+       * tests/parallel-test-driver-install.test: Renamed ...
+       * tests/parallel-tests-driver-install.test: ... to this.
+       * tests/parallel-tests-make-n.test: Renamed ...
+       * tests/parallel-tests-dry-run.test: ... to this.
+       * tests/Makefile.am (TESTS): Updated.
+
+2011-08-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: parallel-tests and lazy dependencies on EXTRA_PROGRAMS
+       * tests/parallel-tests-extra-programs.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * doc/automake.texi (Parallel Test Harness): Add a comment
+       pointing to the new test.
+
+2011-08-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: improve, extend and fix documentation on TAP support
+       * doc/automake.texi ("Using the TAP test protocol"): Divide this
+       section into ...
+       ("Introduction to TAP", "Use TAP with the Automake test harness",
+       "Incompatibilities with other TAP parsers and drivers", "Links
+       and external resources"): ... these subsections, extend them by
+       adding more information and examples, and improve them by removing
+       incomplete and/or temporary wordings and TODO items.
+       ("Script-based Testsuites", "Parallel Test Harness"): Add a couple
+       of anchors to improve the granularity of cross-references.
+       * tests/tap-doc2.test: New test, verifying the correctness of the
+       new examples given in the manual.
+       * tests/Makefile.am (tap_other_tests): Add the new test.
+
+2011-08-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: separate the only failing check of an xfailing test
+       * tests/plan-bad-prog.test: Move the only failing check of this
+       test (i.e., the one about the total number of "ERROR" outcomes)
+       into ...
+       * tests/plan-bad-prog2.test: ... this new test.
+       * tests/Makefile.am (XFAIL_TESTS): Remove `plan-bad-prog.test',
+       add `plan-bad-prog2.test'.
+       (tap_other_tests): Add `plan-bad-prog2.test'.
+       (plan-bad-prog2.log): Depend on `plan-bad-prog.test'.
+
+2011-08-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix spurious errors in an xfailing test on TAP support
+       * tests/plan-bad-prog.test: Fix typo in the name of the test
+       being made unreadable.  Correct the wording of the potential
+       skip message, and simplify the condition under which the test
+       is to be skipped.  Escape literal dots in grep regexps.
+
+2011-08-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: better granularity in a couple of tests on TAP support
+       * tests/tap-summary-aux.sh: New auxiliary script, filled with code
+       moved out from ...
+       * tests/tap-summary.test: ... this test, from which the checks on
+       colored testsuite have further been moved into ...
+       * tests/tap-summary-color.test: ... this new test, which in turn
+       * tests/Makefile.am (tap_other_tests): Add `tap-summary-color.test'.
+       (EXTRA_DIST): Distribute `tap-summary-aux.sh'
+       (tap-summary.log): Depend on `tap-summary-aux.sh'.
+       (tap-summary-color.log): Likewise.
+
+2011-08-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: optimize tests on TAP for speed and against duplication
+       The creation and configuration of common files and data used by
+       many tests on TAP is, with this change, factored out into a new
+       dedicated auxiliary test, from which those tests will depend upon.
+       This reduces code duplication in tests and, more importantly,
+       offers a noticeable speedup in the involved tests (30-40%).
+       * tests/tap-common-setup.test: New test, setting up the common
+       files and data used by various tests on TAP support.
+       * tests/tap-setup.sh: New file, to be sourced by tests wanting to
+       bring in data generated by `tap-common-setup.test'.
+       * tests/tap-autonumber.test: Update to use the pre-computed data
+       files.
+       * tests/tap-bailout.test: Likewise.
+       * tests/tap-color.test: Likewise.
+       * tests/tap-deps.test: Likewise.
+       * tests/tap-diagnostic.test: Likewise.
+       * tests/tap-empty-diagnostic.test: Likewise.
+       * tests/tap-empty.test: Likewise.
+       * tests/tap-escape-directive.test: Likewise.
+       * tests/tap-exit.test: Likewise.
+       * tests/tap-signal.test: Likewise.
+       * tests/tap-fancy.test: Likewise.
+       * tests/tap-fancy2.test: Likewise.
+       * tests/tap-global-log.test: Likewise.
+       * tests/tap-global-result.test: Likewise.
+       * tests/tap-html.test: Likewise.
+       * tests/tap-log.test: Likewise.
+       * tests/tap-merge-stdout-stderr.test: Likewise.
+       * tests/tap-no-merge-stdout-stderr.test: Likewise.
+       * tests/tap-message-0.test: Likewise.
+       * tests/tap-no-disable-hard-error.test: Likewise.
+       * tests/tap-no-spurious-summary.test: Likewise.
+       * tests/tap-no-spurious.test: Likewise.
+       * tests/tap-not-ok-skip.test: Likewise.
+       * tests/tap-numeric-description.test: Likewise.
+       * tests/tap-out-of-order.test: Likewise.
+       * tests/tap-passthrough.test: Likewise.
+       * tests/tap-passthrough-exit.test: Likewise.
+       * tests/tap-plan.test: Likewise.
+       * tests/tap-plan-corner.test: Likewise.
+       * tests/tap-plan-corner2.test: Likewise.
+       * tests/tap-plan-errors.test: Likewise.
+       * tests/tap-realtime.test: Likewise.
+       * tests/tap-recheck-logs.test: Likewise.
+       * tests/tap-skip-whole.test: Likewise.
+       * tests/tap-todo-skip-together.test: Likewise.
+       * tests/tap-todo-skip-whitespace.test: Likewise.
+       * tests/tap-todo-skip.test: Likewise.
+       * tests/tap-unplanned.test: Likewise.
+       * tests/tap-with-and-without-number.test: Likewise.
+       * tests/tap-xfail-tests.test: Likewise.
+       * tests/tap-skip-whole-whitespace.test: Likewise, and remove
+       redundant definitions of `$sp' and `$tab' (they are already
+       defined in `tests/defs').
+       * tests/tap-whitespace-normalization.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       (EXTRA_DIST): Distribute `tap-setup.sh'.
+       (tap_with_common_setup_tests, tap_with_common_setup_logs)): New
+       variables, holding respectively the list of tests using the files
+       pre-computed by `tap-common-setup.test', and the list of their
+       corresponding log files.
+       (tap_other_tests): New variable, holding the list of other tests
+       on TAP support.
+       ($(tap_with_common_setup_logs)): Depend on `tap-common-setup.log'
+       and `tap-setup.sh'.
+
+2011-08-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: use new `.trs' files to hold test metadata
+       With this change, the test harness will keep test metadata in
+       dedicated `.trs' files, instead of having them embedded into the
+       `.log' files.  This allows for easier forward-compatibility and
+       extension of test metadata, and for more flexibility in the
+       format of the `.log' files.  Note that this change makes the
+       `:end-metadata:' field obsolete.
+       * doc/automake.texi (Parallel Test Harness, Log files generation
+       and test results recording): Document the new APIs and behaviour;
+       some related minor rewordings and fixlets.
+       * NEWS: Update.
+       * automake.in (handle_tests): When bringing in the content of
+       `check2.am', substitute %BASE% with the basename of the `.log'
+       file being created by a rule.  Add the generated `.trs' files
+       to the list of files to be cleaned by "make mostlyclean".
+       * lib/am/check.am (am__test_driver_flags): Rename ...
+       (am__common_driver_flags): ... to this, and remove the flags
+       `--test-name' and `--log-file' from it: they are now define in
+       the proper rules in `check2.am'.
+       (am__TEST_BASES): New internal variable, holding the names of
+       the tests, with any registered extension removed.
+       (am__stealth_MAKE): New internal variable, can be used instead of
+       $(MAKE) in recipes requiring a recursive call to make, but which
+       are not intended to be executed by "make -n".
+       (.log.trs): New suffix rule, to recover from deletion of `.trs'
+       files.
+       ($(TEST_SUITE_LOG)): Almost completely rewritten to follow the
+       new API of "test logs in `.log' files, test metadata in `.trs'
+       files".  It goes to some length to work correctly in face of
+       unreadable or missing `.log' and `.trs' files, and to error out
+       with proper error messages when this is not possible.
+       [%?PARALLEL_TESTS%] (check-TESTS): Also remove relevant "stale"
+       `.trs' files (in addition to `.log files) before remaking the
+       $(TEST_SUITE_LOG).
+       (recheck, recheck-html): Look for the `:recheck:' field in the
+       `.trs' files, not in the `.log' files.
+       * lib/am/check2.am (?GENERIC?%EXT%.log, ?!GENERIC?%OBJ%): Adjust
+       the call to the test driver, in particularly passing the new
+       option `--trs-file'.
+       [%am__EXEEXT%] (?GENERIC?%EXT%$(EXEEXT).log): Likewise.
+       * lib/tap-driver ($USAGE): Adjust the help screen.
+       (Getopt::Long::GetOptions): Handle the `--trs-file' option,
+       through the use of ...
+       ($trs_file): ... this new global variable.
+       (finish): Write metadata for the test run to `$trs_file' rather
+       then to `$log_file', through the use of ...
+       (write_test_results): ... this new function.
+       * lib/test-driver (print_usage): Update the help screen.
+       (Option parsing): Handle the `--trs-file' option, through the
+       use of ...
+       ($resfile): ... this new global variable.
+       (Main code): Write metadata for the test run to `$trsfile' rather
+       than to `$logfile'.
+       Minor related adjustments to comments.
+       * tests/.gitignore: Ignore `*.trs' files.
+       * tests/parallel-tests-unreadable-log.test: Moved ...
+       * tests/parallel-tests-unreadable.test: ... to this, and extended
+       to also check the semantics for unreadable `.trs' files.
+       * tests/test-driver-end-metadata.test: Deleted as obsolete.
+       * tests/test-driver-metadata-no-leading-space.test: Likewise.
+       * tests/test-driver-global-log.test: Renamed ...
+       * tests/test-metadata-global-log.test: ... to this, and modified
+       as to verify the new APIs and semantics.
+       * tests/test-driver-recheck: Renamed ...
+       * tests/test-metadata-recheck.test: ... to this, and modified
+       likewise.
+       * tests/parallel-tests-once.test: New test.
+       * tests/parallel-tests-make-n.test: Likewise.
+       * test-metadata-results.test: Likewise.
+       * test-missing.test: Likewise.
+       * test-missing2.test: Likewise.
+       * test-trs-basic.test: Likewise.
+       * test-trs-recover.test: Likewise.
+       * test-trs-recover2.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-07-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test harness: allow more metadata in log files
+       This change reworks and improves the parallel test harness to use
+       more specialized reStructuredText fields in the log files (instead
+       of relying on specially-placed of "magic lines" and more indirect
+       semantical formatting); the new fields are the following:
+        - ":recheck:": tell whether the associated test will have to be
+          re-run by "make recheck";
+        - ":copy-in-global-log:": tell whether the content of the log
+          file should be copied in the "global log" `test-suite.log';
+        - ":end-metadata:", which inhibits the scanning of the rest of
+          the log file (for what concerns test metadata).
+       Also, the special `:test-result:' value "END" has been removed,
+       superseded by the new `:end-metadata:' field.
+       * doc/automake.texi (Log files generation and test results
+       recording): Document the new API and semantics.  Remove or fix
+       some obsolete comments.
+       * lib/am/check.am ($(TEST_SUITE_LOG), recheck, recheck-html):
+       Adjust comments and code.
+       * lib/tap-driver (finish): Adjust, with the help of ...
+       (must_recheck, copy_in_global_log): ... these new functions.
+       * lib/test-driver (Main code): Adjust, with the help of ...
+       ($recheck, $gcopy): ... these new variables.
+       * tests/trivial-test-driver: Update to obey the new APIs.
+       * tests/test-driver-recheck.test: Likewise.
+       * tests/test-driver-global-log.test: Likewise.
+       * tests/tap-passthrough.test: Relax the test, avoiding to check
+       what is written in `test-suite.log'; such check has been moved ...
+       * tests/tap-global-log.test: ... in this new test, and extended.
+       * tests/test-driver-metadata-no-leading-space.test: New test.
+       * tests/test-driver-end-test-results.test: Removed, it checked
+       the old APIs; superseded by ...
+       * tests/test-driver-end-metadata.test: ... this new test.
+       * tests/tap-log.test: Improve syncing with ...
+       * tests/test-log.test: ... this new test.
+       * tests/parallel-tests.test: Remove some duplication w.r.t. this
+       last new test.  Updated heading comments.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-07-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix a spurious failure with non-bash shells
+       * tests/tap-fancy2.test: Remove an unportable use of backslashes
+       with the `echo' builtin, which was causing some shells (among them
+       bash and Debian /bin/ksh) to print a `\\' string, while other
+       shells (among them zsh, dash, and Solaris /bin/sh and /bin/ksh)
+       were unexpectedly printing a single `\' character.  Since we are
+       at it, add a sanity check to ensure that this issue does not
+       resurface.
+
+2011-07-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: fix spurious failures with Solaris /bin/sh
+       * tests/tap-more.test: Use `echo > file', not `: > file', to
+       create empty files in the "for" loops; this is required since,
+       as documented in the autoconf manual, Solaris 10 /bin/sh
+       "optimizes" away the `:' command after the first iteration,
+       even if it is redirected.
+       * tests/test-driver-custom-multitest-recheck2.test: Likewise.
+       * tests/tap-numeric-description.test: Partial rewrite to avoid
+       using positional parameters from the 10th onward, which are
+       unportable to Solaris /bin/sh (using `${10}' causes the shell
+       to die with "bad substitution").
+
+2011-07-31  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       simple tests: support developer-defined fd redirections
+       Motivated by coreutils bug#8846, and related discussions:
+        <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846>
+        <http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00002.html>
+       In those threads it has been shown how problematic it can be to do
+       portable file descriptor redirections in the testsuite when using
+       the Automake testsuite harness.  This change should remedy to that
+       situation.
+       * lib/am/check2.am (?GENERIC?%EXT%$(EXEEXT).log,
+       ?GENERIC?%EXT%.log, ?!GENERIC?%OBJ%): Append redirection defined
+       in $(AM_TESTS_FD_REDIRECT) to the command-line invocations of the
+       test scripts.
+       * lib/am/check.am [!%?PARALLEL_TESTS%] $(check-TESTS): Likewise.
+       * NEWS: Update.
+       * doc/automake.texi (Script-based Testsuites): Document the new
+       feature.
+       * tests/check-fd-redirect.test: New test.
+       * tests/parallel-tests-fd-redirect.test: Likewise.
+       * tests/parallel-tests-am_tests_environment.test: Remove checks
+       about the use of redirections in AM_TESTS_ENVIRONMENT: they would
+       check deprecated (if not undefined) behaviour now.  Strengthen a
+       couple of still valid checks, to keep the test more in sync with
+       the documentation.  Improve debugging information.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-07-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: rework and extend documentation on testsuites support
+       * doc/automake.texi (Generalities about Testing): New section.
+       (Simple Tests using parallel-tests): Section removed, merged
+       into ...
+       (Simple Tests): ... this one, which on the other hand has been
+       subdivided into ...
+       (Script-based Testsuites, Serial Test Harness, Parallel Test
+       Harness): ... these new subsection.
+       (DejaGnu Tests): Minor adjustments.
+       Other related typofixes and rewordings throughout the manual;
+       in particular, avoid to use the term "test driver" for three
+       different concepts (and use instead "test harness" and "test
+       runner" where appropriate).
+       * tests/tap-doc.test: New test.
+       * tests/tap-no-disable-hard-error.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-07-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: support colorization of testsuite progress output
+       * lib/tap-driver (%COLORS): New variable (definition extracted
+       from `lib/am/check.am:$(am__tty_colors)', with some obvious
+       adjustments.
+       (report): Adjust to colorize console output when required,
+       using ...
+       (decorate_result): ... this new function.
+       (colored): New function, used by the one above.
+       * tests/tap-summary.test: Also run the checks when `color-tests'
+       is in use.
+       * tests/Makefile.am (XFAIL_TESTS): Remove `tap-color.test'.
+
+2011-07-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: some preparatory refactoring (2)
+       This is a follow-up simplification.
+       * lib/tap-driver (console_output): Renamed ...
+       (report): ... to this, and extended to appropriately register
+       the test results when needed.
+       (testsuite_error, handle_tap_comment, handle_tap_test,
+       handle_tap_plan): Adjusted accordingly.
+
+2011-07-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: some preparatory refactoring (1)
+       This refactoring is aimed at simplifying the introduction of
+       colored console output for the TAP driver.
+       * lib/tap-driver (console_output): Now accept two arguments, the
+       first one indicating which kind of thing is to be displayed (for
+       now only a test result or a diagnostic comment), and the second
+       one (if present) the message associated to it.
+       (handle_tap_test, handle_tap_comment, handle_tap_plan,
+       testsuite_error): Adapt to the new `console_output' interface.
+
+2011-07-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tap: add experimental TAP-aware driver
+       * doc/automake.texi (Using the TAP test protocol): New section.
+       (Overview of Custom Test Drivers Support): Minor updates.
+       * lib/tap-driver: New script, TAP-aware test driver for Automake;
+       implemented in perl and based on TAP::Parser.
+       * lib/Makefile.am (dist_script_DATA): Add it.
+       * tests/tap-autonumber.test: New test.
+       * tests/tap-bailout.test: Likewise.
+       * tests/tap-basic.test: Likewise.
+       * tests/tap-deps.test: Likewise.
+       * tests/tap-diagnostic.test: Likewise.
+       * tests/tap-empty.test: Likewise.
+       * tests/tap-empty-diagnostic.test: Likewise.
+       * tests/tap-escape-directive.test: Likewise.
+       * tests/tap-exit.test: Likewise.
+       * tests/tap-fancy.test: Likewise.
+       * tests/tap-fancy2.test: Likewise.
+       * tests/tap-global-result.test: Likewise.
+       * tests/tap-html.test: Likewise.
+       * tests/tap-log.test: Likewise.
+       * tests/tap-merge-stdout-stderr.test: Likewise.
+       * tests/tap-more.test: Likewise.
+       * tests/tap-more2.test: Likewise.
+       * tests/tap-no-merge-stdout-stderr.test: Likewise.
+       * tests/tap-no-spurious-summary.test: Likewise.
+       * tests/tap-no-spurious.test: Likewise.
+       * tests/tap-not-ok-skip.test: Likewise.
+       * tests/tap-numeric-description.test: Likewise.
+       * tests/tap-out-of-order.test: Likewise.
+       * tests/tap-passthrough.test: Likewise.
+       * tests/tap-plan.test: Likewise.
+       * tests/tap-plan-errors.test: Likewise.
+       * tests/tap-plan-corner.test: Likewise.
+       * tests/tap-realtime.test: Likewise.
+       * tests/tap-recheck-logs.test: Likewise.
+       * tests/tap-recheck.test: Likewise.
+       * tests/tap-skip-whole.test: Likewise.
+       * tests/tap-summary.test: Likewise.
+       * tests/tap-todo-skip.test: Likewise.
+       * tests/tap-todo-skip-together.test: Likewise.
+       * tests/tap-todo-skip-whitespace.test: Likewise.
+       * tests/tap-skipall-whitespace.test: Likewise.
+       * tests/tap-unplanned.test: Likewise.
+       * tests/tap-whitespace-normalization.test: Likewise.
+       * tests/tap-with-and-without-number.test: Likewise.
+       * tests/tap-xfail-tests.test: Likewise.
+       * tests/tap-bad-prog.test: New xfailing test.
+       * tests/tap-color.test: Likewise.
+       * tests/tap-plan-corner2.test: Likewise.
+       * tests/tap-message-0.test: Likewise.
+       * tests/tap-signal.test: Likewise.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
+2011-07-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: new auxiliary function 'count_test_results'
+       * tests/defs (count_test_results): New function.
+       * tests/check11.test: Use it.
+       * tests/test-driver-custom-multitest.test: Likewise.
+       * tests/test-driver-custom-multitest-recheck.test: Likewise.
+       * tests/test-driver-custom-multitest-recheck2.test: Likewise.
+       * tests/parallel-tests-log-override-recheck.test: Likewise.
+       * tests/parallel-tests-log-override-recheck.test: Likewise.
+       * tests/parallel-tests-no-spurious-summary.test: Likewise, and
+       slightly improve debugging output.
+       * tests/parallel-tests.test: Make use of `count_test_results'.
+       Also, make grepping of "make check" output slightly stricter
+       * tests/parallel-tests9.test: Likewise.
+       * tests/parallel-tests-log-override-2.test: Likewise, and throw
+       in a small optimization.
+
+2011-07-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: simplify testsuite summary
+       Prefer a more deterministic, "tabular" format for the testsuite
+       summary, always listing the numbers of passed, failed, xfailed,
+       xpassed, skipped and errored tests, even when these numbers are
+       zero.  This simplify the logic of testsuite summary creation,
+       makes it more easily machine-parseable, and will probably allow
+       for easier addition of new kinds of test results in the future.
+       * lib/am/check.am (am__tty_colors_dummy): New make variable, to
+       reduce code duplication.  Extracted from previous versions of
+       $(am__tty_colors), and extended by defining two new variables
+       `$mgn' and `$brg'.
+       [%?COLOR%, %!?COLOR%] (am__tty_colors): Use that new variable.
+       (am__text_box): Delete, is not needed anymore.
+       ($(TEST_SUITE_LOG)): Rewrite associated rules to implement the
+       new testsuite summary format.
+       * NEWS: Update.
+       * tests/check10.test: Don't run with the parallel-tests harness
+       too, that makes no sense anymore.
+       * tests/color.test: Update and adjust.
+       * tests/color2.test: Likewise.
+       * tests/parallel-tests.test: Likewise.
+       * tests/parallel-tests3.test: Likewise.
+       * tests/parallel-tests6.test: Likewise.
+       * tests/parallel-tests9.test: Likewise.
+       * tests/parallel-tests-unreadable-log.test: Likewise.
+       * tests/parallel-tests-empty-testlogs.test: Likewise.
+       * tests/parallel-tests-log-override-recheck.test: Likewise.
+       * tests/parallel-tests-no-spurious-summary.test: Likewise.
+       * tests/test-driver-custom-multitest.test: Likewise.
+       * tests/test-driver-end-test-results.test: Likewise.
+       * tests/parallel-tests-no-color-in-log.test: New test.
+       * tests/testsuite-summary-color.test: Likewise.
+       * tests/testsuite-summary-count.test: Likewise.
+       * tests/testsuite-summary-count-many.test: Likewise.
+       * tests/testsuite-summary-reference-log.test: Likewise.
+       * tests/testsuite-summary-checks.sh: New auxiliary script, used
+       by the new tests above.
+       * tests/extract-testsuite-summary: Likewise.
+       * tests/trivial-test-driver: Optimize for speed when there are
+       lots of of tests.
+       * tests/Makefile.am (EXTRA_DIST): Distribute them.
+       (testsuite-summary-color.log, testsuite-summary-count.log): Depend
+       on them.
+       (testsuite-summary-count-many.log): Depend on the auxiliary scripts
+       'trivial-test-driver' and 'extract-testsuite-summary'.
+       (TESTS): Update.
+
+2011-07-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: new recognized test result 'ERROR'
+       * lib/am/check.am ($(TEST_SUITE_LOG)): Recognize a new test result
+       `ERROR'.  Use it when encountering unreadable test logs (previously
+       a simple `FAIL' was used in this situations).
+       * lib/test-driver: Set the global test result to `ERROR' when the
+       test exit status is 99.  When doing colorized output, color `ERROR'
+       results in magenta.
+       * doc/automake.texi (Log files generation and test results
+       recording): Update by listing `ERROR' too among the list of valid
+       `:test-results:' arguments.
+       * NEWS: Update.
+       * tests/trivial-test-driver: Update.
+       * tests/parallel-tests.test: Likewise.
+       * tests/parallel-tests-harderror.test: Likewise.
+       * tests/parallel-tests-no-spurious-summary.test: Likewise.
+       * tests/test-driver-global-log.test: Likewise.
+       * tests/test-driver-recheck.test: Likewise.
+       * tests/test-driver-custom-multitest-recheck.test: Likewise.
+       * tests/test-driver-custom-multitest-recheck2.test: Likewise.
+       * tests/test-driver-custom-multitest.test: Likewise.
+       * tests/test-driver-custom-no-html.test: Likewise.
+       * tests/test-driver-end-test-results.test: Likewise.
+       * tests/color.test: Likewise.  Also, make stricter, and also test
+       from VPATH.
+       * tests/color2.test: Likewise, and improve syncing with color.test.
+       * tests/parallel-tests-exit-statuses.test: New test.
+       * tests/parallel-tests-console-output.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-07-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: make parsing of test results safer
+       The new code for parsing the testsuite-generated `.log' files,
+       as introduced in commit `v1.11-872-gc96b881', considers each
+       `:test-result:' field anywhere in a `.log' file as a declaration
+       of a test result, and accounts for it as such in the testsuite
+       summary.  Unfortunately this could easily cause spurious test
+       failures being reported in the testsuite summary.  This happened
+       in practice with the Automake's own testsuite; for example:
+         $ make check TESTS='check12-p.test'; echo exit: $?
+         ...
+         PASS: check12-p.test
+         =====================================
+         4 of 5 tests failed
+         See tests/test-suite.log
+         Please report to bug-automake@gnu.org
+         =====================================
+         make[2]: *** [test-suite.log] Error 1
+         make: *** [check-am] Error 2
+         exit: 2
+       This change introduces a new special `:test-result:' "END", that,
+       when seen, prevents the rest of the log file from being parsed.
+       For more information, refer to the thread:
+       <http://lists.gnu.org/archive/html/automake-patches/2011-06/msg00199.html>
+       * lib/am/check.am ($(TEST_SUITE_LOG)): Stop the parsing of a log
+       file as soon as the special ":test-result:END" directive is seen.
+       Related changes and enhancements.
+       * lib/test-driver: Protect the rest of the log after the result
+       lined with a ":test-result:END" directive.
+       * doc/automake.texi (Log files generation and test results
+       recording): Update, and related improvements.
+       * tests/parallel-tests-no-spurious-summary.test: New test.
+       * tests/test-driver-end-test-results.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-06-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: document custom test drivers and protocols
+       * doc/automake.texi (Simple Tests): Note that the TESTS_ENVIRONMENT
+       use suggested here is not portable to 'parallel-tests'.
+       (Simple Tests using parallel-tests): Document new restrictions on
+       the uses of TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT.
+       (Custom Test Drivers): New section and node.
+       (Overview of Custom Test Drivers Support): New subsection.
+       (Declaring Custom Test Drivers in @file{Makefile.am}): Likewise.
+       (APIs for Custom Test Drivers): Likewise.
+       (Options): Update description of color-tests.
+       * lib/am/check ($(TEST_SUITE_LOG)): Remove comments that have been
+       moved into the manual.
+       (recheck, recheck-html): Minor adjustments to better conform to the
+       documentation (this should cause no semantic changes w.r.t. the
+       former behaviour); minor improvements and extensions to existing
+       comments.
+       * tests/test-driver-create-log-dir.test: New test.
+       * tests/test-driver-strip-vpath.test: Likewise.
+       * tests/test-driver-global-log.test: Likewise.
+       * tests/test-driver-recheck.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-07-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: small enhancement to 'primary3.test'
+       * tests/primary3.test: Also test that the program named `foo.la'
+       has been effectively created.
+
+2011-07-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: a small simplification in 'pr8365-remake-timing.test'
+       * tests/pr8365-remake-timing.test: Avoid redundant definition
+       and use of `$save_AUTOCONF' variable.
+
+2011-07-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove an extra leading blank line
+       * tests/override-conditional-1.test: Remove extra blank line
+       placed before the shebang line.
+
+2011-07-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix typos, grammaros and other blunders in comments
+       All affected files changed.
+
+2011-07-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: new subroutine 'seq_', simulating GNU seq(1)
+       * tests/defs (seq_): New subroutine.
+       * tests/instmany.test: Use it.
+       * tests/instmany-mans.test: Likewise.
+       * tests/instmany-python.test: Likewise.
+       * tests/self-check-seq.test: New self test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-07-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove duplication about testing of config.* aux files
+       * tests/add-missing.test: Also check that the `AC_CANONICAL_SYSTEM'
+       autoconf macro causes the `config.sub' and `config.guess' scripts
+       to be installed by `automake --add-missing'.  Since we are at it,
+       fix minor buglets and cosmetic issues in the `check_' function.
+       * tests/hosts.test: Removed, completely subsumed by the previous
+       test now.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-07-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more uses of the 'unindent' subroutine
+       * tests/backcompat.test: Prefer `unindent' over plain `cat' for
+       here documents created from within a loop of if/else body.
+       * tests/backcompat2.test: Likewise.
+       * tests/backcompat4.test: Likewise.
+       * tests/init.test: Likewise.
+       * tests/instmany.test: Likewise.
+       * tests/instmany-mans.test: Likewise.
+       * tests/instmany-python.test: Likewise.
+       * tests/missing5.test: Likewise.
+       * tests/parallel-am2.test : Likewise.
+       * tests/parallel-am3.test : Likewise.
+       * tests/pr307.test: Likewise.
+       * tests/depend4.test: Likewise.  Since we are at it, normalize
+       other code formatting.
+       * tests/instfail-java.test: Prefer `echo' over `cat' + here-doc
+       inside a for loop.
+
+2011-07-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid '##'-style comments inside recipe commands
+       * tests/autodist.test: Do not whitespace-indent `##' comments when
+       they are embedded in a makefile rule: having them indented is not
+       part of the Automake API, and might cause failures with e.g., Tru64
+       make.
+       * tests/autodist-subdir.test: Likewise.
+       * tests/backcompat.test: Likewise.
+       * tests/backcompat6.test: Likewise.
+       * tests/colon7.test: Likewise.
+       * tests/posixsubst-scripts.test: Likewise.
+       * tests/posixsubst-sources.test: Likewise.
+
+2011-07-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: tweak, improve and extend tests on lisp support
+       * tests/lisp2.test: Prettify, and improve debugging output.  Make
+       grepping of automake stderr stricter.
+       * tests/lisp7.test: Ensure verbose printing of captured make
+       output.  Add trailing `:' command.
+       * tests/lisp8.test: Likewise.
+       * tests/lisp3.test: Likewise.  Also, check that `.el' files and
+       compiled `.elc' files get installed by "make install", and
+       uninstalled by "make uninstall".
+       * tests/lisp4.test: Ensure installed `.el' files gets removed by
+       "make uninstall".  Related changes.  Add trailing `:' command.
+       * tests/lisp5.test: Likewise.
+       * tests/lisp6.test: Use proper m4 quoting in configure.in.  Fix
+       use of blank lines, to improve clarity and symmetry.  Fix typo in
+       comment.  Add trailing `:' command.
+
+2011-07-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: drop useless requirement in 'license.test'
+       * tests/license.test: Drop  useless requirement "makeinfo".  Add
+       an extra blank line, for clarity.
+
+2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests defs: more uses of $top_testsrcdir
+       * tests/autodist-stamp-vti.test: Use `$top_testsrcdir' instead
+       of `$testsrcdir/..'.
+       * tests/repeated-options.test: Likewise.
+       * tests/suffix5.test: Likewise.
+       * tests/vtexi3.test: Likewise.
+
+2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: fix typo in comment
+       * tests/self-check-exit.test: Fix typo in heading comments.
+
+2011-07-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundant settings of `errexit' shell flag
+       * tests/amhello-binpkg.test: Do not set the `errexit' shell
+       flag, as it is already set by `tests/defs'.
+       * tests/amhello-cflags.test: Likewise.
+       * tests/amhello-cross-compile.test: Likewise.
+       * tests/ansi2knr-deprecation.test: Likewise.
+       * tests/autodist-no-duplicate.test: Likewise.
+       * tests/distcheck-configure-flags-am.test: Likewise.
+       * tests/distcheck-configure-flags-subpkg.test: Likewise.
+       * tests/distcheck-configure-flags.test: Likewise.
+       * tests/distcheck-hook.test: Likewise.
+       * tests/distcheck-hook2.test: Likewise.
+       * tests/parallel-tests-am_tests_environment.test: Likewise.
+       * tests/parallel-tests-harderror.test: Likewise.
+       * tests/parallel-tests-log-compiler-example.test: Likewise.
+       * tests/parallel-tests-log-override-1.test: Likewise.
+       * tests/parallel-tests-log-override-2.test: Likewise.
+       * tests/parallel-tests-log-override-recheck.test: Likewise.
+       * tests/primary-prefix-couples-documented-valid.test: Likewise.
+       * tests/primary-prefix-couples-force-valid.test: Likewise.
+       * tests/primary-prefix-invalid-couples.test: Likewise.
+       * tests/primary-prefix-valid-couples.test: Likewise.
+       * tests/remake-subdir-from-subdir.test: Likewise.
+       * tests/remake-subdir-gnu.test: Likewise.
+       * tests/remake-subdir-long-time.test: Likewise.
+       * tests/remake-subdir.test: Likewise.
+       * tests/remake-subdir2.test: Likewise.
+       * tests/silent-configsite.test: Likewise.
+       * tests/tests-environment-backcompat.test: Likewise.
+
+2011-06-29   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: explain why AM_TESTS_ENVIRONMENT must be semicolon-terminated
+       * doc/automake.texi (Simple Tests using parallel-tests): Ditto, and
+       related adjustments.
+       Suggestion by Ralf Wildenhues.
+
+2011-06-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       docs: fix unportable example of AM_TESTS_ENVIRONMENT usage
+       * doc/automake.texi (Simple Tests using parallel-tests): The
+       old example on AM_TESTS_ENVIRONMENT relied on unportable shell
+       features, and in particular didn't work with various Korn
+       Shells (see also commit `v1.11-925-g29ca903').  Give another
+       example, simpler this time, but still inspired to real-world
+       usage (the GNU coreutils testsuite).
+
+2011-06-28   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc tests: fix bug in 'yacc-cxx.test'
+       * tests/yacc-cxx.test: Enable `errexit' shell flag (the lack of
+       which was masking the bug).
+       (bar.cxx): Rename to ...
+       (bar2.cxx): ... this, otherwise automake will (correctly) complain
+       that object `bar.o' is created by both `bar.cxx' and `bar.c++'.
+       (Makefile.am): Adjust.
+
+2011-06-28   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex tests: fix spurious link errors on Solaris
+       On Solaris 10, linking of lex-generated programs was failing in a
+       couple of lex tests with errors like this:
+         g++ -g -O2 -o joe joe.o -ll
+         Undefined symbol     first referenced in file
+         yywrap()             joe.o
+         ld: fatal: Symbol referencing errors. No output written to joe
+         collect2: ld returned 1 exit status
+       This change fixes it, also fixing at once potential problems for
+       systems that don't have a "lex library" (this happens for example
+       when cross-compiling from GNU/Linux to MinGW).
+       * tests/lex-depend-cxx.test (joe.ll, moe.l++): Define a dummy
+       `yywrap()' function.
+       * tests/lex-clean-cxx.test (mainfoo.cc, mainbar.cpp, mainbaz.c++,
+       mainqux.cxx): Likewise.
+
 2011-06-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        docs: avoid a footnote, some related rewordings and improvements
 
 2011-06-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       parallel-tests: allow each test to have multiple results
+       With this change, we improve the code creating the `test-suite.log'
+       global log and the console testsuite summary to make it able to
+       grasp multiple results per test script.  This is required in order
+       to introduce the planned support for test protocols, like TAP and
+       SubUnit, which can indeed run multiple tests per test script, each
+       with its individual result.
+       The implementation makes use of a custom reStructuredText field
+       `:test-result:'.
+       Note that no new documentation is added by this change; that is
+       be left for follow-up changes.
+       * lib/check.am ($(TEST_SUITE_LOG)): When processing .log files,
+       recognize a report of a test's result only if it is declared with
+       the custom `:test-result:' reStructuredText field placed at the
+       beginning of a line.  Extend and add explanatory comments.
+       (recheck, recheck-html): Add explanatory comments.
+       * lib/test-driver: Write an appropriate reStructuredText field
+       `:test-result:' in the generated log file.  Use a reStructuredText
+       transition to better separate the test outcome report from the
+       test script's registered output.  Improve comments.
+       * tests/test-driver-custom-xfail-tests.test: Adjust.
+       * tests/parallel-tests7.test: Adjust.
+       * tests/parallel-tests-empty-testlogs.test: New test.
+       * tests/parallel-tests-recheck-override.test: Likewise.
+       * tests/parallel-tests2.test: Extend and keep more in-sync with ...
+       * tests/test-driver-custom-html.test: ... this new related test.
+       * tests/test-driver-custom-no-html.test: New test.
+       * tests/test-driver-custom-multitest.test: Likewise.
+       * tests/test-driver-custom-multitest-recheck.test: Likewise.
+       * tests/test-driver-custom-multitest-recheck2.test: Likewise.
+       * tests/trivial-test-driver: New file, used by the last four tests
+       above.
+       * tests/Makefile.am (TESTS): Update.
+       (EXTRA_DIST): Distribute `trivial-test-driver'.
+       (test-driver-custom-multitest.log): Depend on `trivial-test-driver'.
+       (test-driver-custom-multitest-recheck.log): Likewise.
+       (test-driver-custom-multitest-recheck2.log): Likewise.
+       (test-driver-custom-html.log): Likewise.
+
+2011-06-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: allow custom driver scripts
+       Allow suffix-based definition of custom "driver script" for the
+       test scripts.  These driver scripts will be responsible of
+       launching the tests (or their corresponding $(LOG_COMPILER), if
+       they have an associated one), interpreting and displaying the
+       test results, and writing the `.log' files.
+       This new API should allow easy and flexible use of different
+       test protocols in the future; in particular, we plan to use it
+       to implement TAP and SubUnit harnesses.
+       Note that no new documentation is added by this change; that is
+       be left for follow-up changes.
+       * automake.in (handle_tests): Define default for $(LOG_DRIVER),
+       and, for any registered test extension `<ext>', define defaults
+       for $(<ext>_LOG_DRIVER).  Substitute %DRIVER% using these new
+       variables, instead of the old internal $(am__test_driver).  When
+       processing check2.am, also substitute %DRIVER_FLAGS%.
+       Require auxiliary script `test-driver' only if no driver has been
+       explicitly defined for the test script kinds.
+       * am/check2.am (?GENERIC?%EXT%$(EXEEXT).log, ?GENERIC?%EXT%.log,
+       ?!GENERIC?%OBJ%): Pass the %DRIVER_FLAGS% to the %DRIVER% call.
+       * tests/parallel-tests-no-extra-driver.test: New test.
+       * tests/test-driver-custom.test: Likewise.
+       * tests/test-driver-custom-xfail-tests.test: Likewise.
+       * tests/test-driver-fail.test: Likewise.
+       * tests/Makefile.am: Update.
+       * NEWS: Update.
+
+2011-06-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: add auxiliary script 'test-driver', refactor
+       This refactoring should cause no API of functionality change,
+       and is meant only to simplify the future implementation of TAP
+       and SubUnit testsuite drivers.  More precisely, our roadmap is
+       to move most of the "testsuite driving" features out of the
+       Automake-generated Makefiles, and into external scripts with
+       well-defined interfaces.  This will allow the user to define
+       its own personalized testsuite drivers, and will also offer us
+       a framework upon which to implement our new TAP and SubUnit
+       drivers, all in a very unobtrusive way and retaining an high
+       degree of code reuse and backward-compatibility.
+       * lib/test-driver: New auxiliary script.
+       * lib/Makefile.am (dist_SCRIPT_DATA): Add it.
+       * automake.in (handle_tests): Require the new auxiliary script
+       `test-driver', and define a new internal makefile variable
+       `$(am__test_driver)', used to call it.  Perform new substitution
+       on `DRIVER' when processing the `check2.am' file.
+       * lib/check.am (am__tty_colors): Define new shell variable
+       `$am__color_tests'.
+       (am__rst_section): Removed, its role taken over by the new
+       `test-driver' script.
+       (am__test_driver_flags): New variable, contains the command
+       line options passed to `test-driver'.
+       (am__check_pre): Do not deal with temporary files and exit
+       traps anymore, as the `test-driver' script takes care of that
+       now.  Define shell variable `$am__enable_hard_errors', used by
+       `$(am__test_driver_flags)'.  Reorder so that we don't need to
+       save and restore the value of the `TERM' environment variable
+       anymore.
+       Other related adjustments.
+       (am__check_post): Remove, as its role has been completely taken
+       over by the `test-driver' script.
+       * am/check2.am (?GENERIC?%EXT%$(EXEEXT).log, ?GENERIC?%EXT%.log,
+       ?!GENERIC?%OBJ%): Call the test script through the Automake
+       substituted `%DRIVER%', and honor the command-line options
+       in `$(am__test_driver_flags)'.  Do not call the obsoleted
+       `$(am__check_post)' anymore.
+       * doc/automake.texi (Auxiliary Programs): Mention the new
+       `test-driver' script.
+       (Optional): Mention `test-driver' in AC_CONFIG_AUX_DIR.
+       Since we are at it, break the list of auxiliary scripts by
+       placing one per line, to simplify potential future additions
+       of new scripts.
+       * tests/check.test: Adjust.
+       * tests/check2.test : Likewise.
+       * tests/check3.test : Likewise.
+       * tests/check4.test : Likewise.
+       * tests/check10.test: Likewise.
+       * tests/color.test: Likewise.
+       * tests/color2.test: Likewise.
+       * tests/comment9.test: Likewise.
+       * tests/dejagnu.test: Likewise.
+       * tests/exeext4.test: Likewise.
+       * tests/maken3.test: Likewise.
+       * tests/maken4.test: Likewise.
+       * tests/parallel-tests-interrupt.test: Likewise.
+       * tests/posixsubst-tests.test: Likewise.
+       * tests/repeated-options.test: Likewise.
+       * tests/check-no-test-driver.test: New test.
+       * tests/parallel-test-driver-install.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
+2011-06-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        maintcheck: extend 'sc_tests_plain_*' checks
        * Makefile.am (sc_tests_plain_autom4te): New check.
        (sc_tests_plain_autoreconf): Likewise.
        (sc_tests_plain_autoheader): Likewise.
        (syntax_check_rules): Update.
 
+2011-06-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: interactions between TESTS_ENVIRONMENT and LOG_COMPILER
+       * tests/tests-environment-and-log-compiler.test: New test,
+       checking that we can use variables and functions set by
+       TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT in LOG_COMPILER
+       and LOG_FLAGS (for tests both with and without registered
+       extensions).
+       * tests/Makefile.am (TESTS): Update.
+
+2011-06-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: make 'subst-no-trailing-empty-line.test' more robust
+       * tests/subst-no-trailing-empty-line.test: Strengthen existing
+       checks, to try more scenarios and be slightly stricter in some
+       grepping checks.
+
+2011-06-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix an incomplete comment
+       * tests/subst-no-trailing-empty-line.test: Fix an incomplete
+       comment, and move it to a more proper place.  Minor cosmetic
+       fixes to other comments.
+
+2011-06-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: avoid few more spurious failures
+       * tests/depmod-data.test: Use creative quoting to avoid
+       spuriously triggering the `sc_tests_Exit_not_exit' maintainer
+       check.  Commit `v1.11-900-g3453b8e' attempted to fix it, but
+       succeeded only partially.
+       * tests/cond33.test: Fix header comments, not to reference
+       obsolescent make variable `$(mkdir_p)'.
+       * tests/cond4.test: Rewrite "$MAKE exp=..." as "exp=.. $MAKE -e",
+       to please `sc_tests_overriding_macros_on_cmdline'
+       * tests/cond19.test: Likewise.
+       * tests/cond32.test: Likewise.
+       * tests/add-missing.test: Use "AUTOMAKE_fails" instead of
+       "$AUTOMAKE ... && Exit 1", to please `sc_tests_automake_fails'.
+
 2011-06-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        maintcheck: avoid few spurious failures
        * doc/automake.texi (Program Sources): Do not index obsolete
        pkglib_PROGRAMS here.  Do index pkglibexec_PROGRAMS.
 
+2011-06-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more checks on portable fd redirection in TESTS_ENVIRONMENT
+       * tests/tests-environment-fd-redirect.test: Extend by also using
+       a perl script among the tests.  Run the test shell script with
+       the `errexit' flag active.  Export `VERBOSE' to yes when running
+       "make check", to give more debugging information in case of
+       failures.  Look for a Korn Shell also in `/usr/bin', not on only
+       in `/bin'.
+
 2011-06-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: optimize tests on primary/prefix mismatch for speed
        * NEWS: Updated.
        From a report by Eric Blake.
 
+2011-06-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: check portable fd redirection in TESTS_ENVIRONMENT
+       * tests/tests-environment-fd-redirect.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       Motivated by coreutils bug#8846:
+        <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846>
+       See also following CC:ed thread on bug-autoconf list:
+        <http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00002.html>
+
+2011-06-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: make test 'self-check-reexec.test' more portable
+       * tests/self-check-reexec.test: Rewrite not to require a Korn
+       Shell able to grok variable expansions such as `${.sh.version}';
+       Solaris 10 /bin/ksh fails on this for example.  Instead, just
+       require bash and a shell that is not bash.
+
+2011-06-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Jim Meyering  <meyering@redhat.com>
+
+       test defs: fix ksh-related portability bug in warning messages
+       Running "make check" normally prints a diagnostic to the outermost
+       stderr (usually a tty) to explain why a test is skipped, thus
+       giving better and faster feedback to the user.  It used to do
+       so by redirecting file descriptor 9 to stderr (via "exec 9>&2")
+       before invoking the test scripts, which then would write any skip
+       explanation to file descriptor 9 via the `skip_' function defined
+       in `tests/defs'.
+       However, various Korn Shells (at least Solaris 10's /bin/ksh and
+       Debian GNU/Linux's /bin/ksh) and the HP-UX's /bin/sh close open
+       file descriptors > 2 upon an `exec' system call; thus the effects
+       of "exec 9>&2" are cancelled upon fork-and-exec, so we would get
+       a "Bad file number" diagnostic and no skip explanation with those
+       shells.
+       The present change remedies this situation.
+       * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Redirect more portably,
+       via a trailing "9>&2", rather than the prior "exec 9>&2; ...".  Add
+       explanatory comments.
+       * tests/defs (stderr_fileno_): Update the advice in comments.
+       Based on commit v8.12-82-g6b68745 "tests: accommodate HP-UX and
+       ksh-derived shells" in GNU coreutils.
+       Further references, with lots of discussion:
+        <http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00002.html>
+        <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488>
+        <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846>
+
+2011-06-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove 'test_prefer_config_shell' from the environment
+       Since commit `v1.11-910-g7df1a9b', the once user-overridable
+       variable `$test_prefer_config_shell' has become an internal
+       detail, and the test scripts now complain and bail out if it is
+       set in the environment.
+       * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Unset the variable
+       `test_prefer_config_shell' if it is set in the environment.
+
+2011-06-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: autogenerate list of wrapped tests for `lib/' shell scripts
+       * tests/gen-config-shell-tests: New script, generates distributed
+       makefile snippet `tests/config-shell-tests.am' to list all tests
+       that use the `get_shell_script' function, with names mangled to
+       use suffix `-w.shtst', in ...
+       * tests/Makefile.am (config_shell_tests): ... this macro, whose
+       definition has been consequently removed from Makefile.am.
+       (EXTRA_DIST): Distribute the new script.
+       ($(srcdir)/config-shell-tests.am): Generate using the new script.
+       (include): Include the `config-shell-tests.am' fragment.
+       * bootstrap: Invoke `tests/gen-config-shell-tests' to generate
+       `tests/config-shell-tests.am'.
+       * tests/.gitignore: Ignore `config-shell-tests.am'.
+       * tests/gen-parallel-tests: Fixlet in heading comments.
+
+2011-06-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: test mdate-sh with /bin/sh too
+       * tests/mdate5.test: Fetch the `mdate-sh' script using the
+       `get_shell_script' function, and run it directly instead of
+       using `$SHELL'.
+       * tests/mdate6.test: Likewise.  Since we are at it, make checks
+       on the `mdate-sh' output stricter, remove now unneeded calls to
+       aclocal and automake and creation/extension of `configure.in',
+       `Makefile.am' and `textutils.tex' files, and add a trailing `:'
+       command.
+       * tests/Makefile.am (config_shell_tests): Add `mdate5-w.shtst'
+       and `mdate6-w.shtst'.
+
+2011-06-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: extend tests on `--add-missing' and `--copy' a bit
+       * tests/add-missing.test: Fix typo in heading comments.  Try with
+       another testcase that install many (but not all) the auxiliary
+       scripts at once, and uses non-standard (but valid and documented)
+       setups (e.g., defining YACC in Makefile.am instead of calling
+       AC_PROG_YACC from configure.in).
+       * tests/copy.test: Reference `add-missing.test' in heading
+       comments.  Try few more test scenarios.
+
+2011-06-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: few fixlets and improvements
+       * tests/cond31.test ($required): Remove `cc', it's not really
+       needed.
+       * tests/confh.test: Call autoheader too.  The lack of this call
+       wasn't causing spurious failures because the automatic remake
+       rules were somehow invoking it on our behalf (at make time).
+       * tests/fn99subdir.test: Use $subdirname throughout, instead of
+       ${subdirname}, for consistency with the rest of the testsuite.
+       Avoid an unnecessary subshell, which could also cause spurious
+       passes, being guarded by a trailing `|| Exit 1', which neutralize
+       the `errexit' flag.  Remove an unnecessary `|| Exit 1' guard.
+       * tests/insh2.test: Rewrite to avoid hackish Makefile.in munging,
+       and to also run configure and make.
+
+2011-06-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: don't hard-code test name in txinfo21.test
+       * tests/txinfo21.test: Use `$me' instead of hard-coding the
+       current testcase name "txinfo21".  Add a trailing `:' command
+       since we are at it.
+
+2011-06-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: new test dedicated to `--add-missing' and `--copy'
+       * tests/add-missing.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       Suggested by Peter Rosin.
+
+2011-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use 'fatal_' and 'framework_failure_' for hard errors
+       * tests/defs (require_xsi): Use `fatal_', not `framework_failure',
+       to report an invalid usage.
+       * tests/remake-gnulib-remove-header.test: Prefer using `fatal_'
+       with a proper error message over a direct call to `Exit 99'.
+       * tests/pr8365-remake-timing.test: Likewise.
+       * tests/cygnus-imply-foreign.test: Likewise.
+       * tests/missing6.test: Likewise.
+       * tests/cond8.test: Likewise.
+       * tests/cond33.test: Likewise.
+       * tests/python-virtualenv.test: Prefer using `framework_failure_'
+       with a proper error message over a direct call to `Exit 99'.
+       * tests/instspc-tests.sh: Prefer using `framework_failure_' and
+       `fatal_' over direct calls to `Exit 99'.
+       (fatal_): Define this (which is a simplified version of the one
+       in `tests/defs') for early uses (i.e., before `tests/defs'
+       gets sourced).
+       * tests/depmode-tests.sh: Likewise.  Also, simplify the
+       'get_depmodes' function and calls to it accordingly.
+
+2011-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: check new 'fatal_' function
+       * tests/self-check-exit.test: Also check the new 'fatal_'
+       function.
+
 2011-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        test defs: new function 'fatal_', for hard errors
        other reasons.  The best way to fix this inconsistency is to
        introduce a new function with a more general error message.
        Inspired by a recent similar change to Gnulib's tests/init.sh.
-       * tests/defs.in (fatal_): New function.
+       * tests/defs (fatal_): New function.
        * tests/README (Section "Writing test cases" subsection "Do"):
        Suggest the use of `fatal_', not of `framework_failure_', for
        generic hard errors.  The latter should be reserved for "real"
        long lines.
        (am__py_compile): New variable, to reduce code duplication.
 
+
+2011-06-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: `lib/' shell scripts transparently tested also with $SHELL
+       With the previous commit, the user could prefer the use of $SHELL
+       over /bin/sh in some tests checking the Automake-provided shell
+       scripts by manually exporting `test_prefer_config_shell' to "yes"
+       in the environment.  With this commit, we ensure that such tests
+       *always* and *transparently* run using both $SHELL and /bin/sh
+       to execute the checked scripts.  The `test_prefer_config_shell'
+       variable becomes an internal detail, and is no more meant to be
+       manually defined or overridden.
+       * tests/defs-static.in: Check that `test_prefer_config_shell' is
+       not exported in the environment.  Error out if this is the case.
+       * tests/config-shell-tests.sh: New file, driver script to run
+       checks on the shell scripts in `lib/' using the $SHELL determined
+       at configure time instead of the default system shell /bin/sh.
+       * Makefile.am (TESTS_EXTENSIONS): Add `.shtst'.
+       (SHTST_LOG_COMPILER): Define, it calls `config-shell-tests.sh'.
+       (config_shell_tests): Define to a list of tests that wraps other
+       `*.test' tests using `config-shell-tests.sh'.
+       ($(config_shell_tests)): Dummy dependency declaration required
+       in order to have make actually produce expected log files from
+       the `.shtst.log' suffix rule.
+       (EXTRA_DIST): Distribute `config-shell-tests.sh'.
+       (TESTS): Add `$(config_shell_tests)'.
+       * tests/self-check-env-sanitize.test: Update, by checking that
+       `test_prefer_config_shell' isn't exported in the environment.
+
+2011-06-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: can use also $SHELL to check shell scripts from `lib/'
+       * tests/ar-lib.test: If the variable `$test_prefer_config_shell'
+       is set to "yes", run the script under test with configure-time
+       determined $SHELL, rather than with /bin/sh.
+       The `$test_prefer_config_shell' variable defaults to empty, but
+       can be overridden at runtime by the user, thus allowing more
+       coverage.
+       * tests/compile.test: Likewise.
+       * tests/compile2.test: Likewise.
+       * tests/compile3.test: Likewise.
+       * tests/compile4.test: Likewise.
+       * tests/compile5.test: Likewise.
+       * tests/compile6.test: Likewise.
+       * tests/instsh2.test: Likewise.
+       * tests/instsh3.test: Likewise.
+       * tests/mkinst3.test: Likewise.
+       * tests/missing.test: Likewise.
+       * tests/missing2.test: Likewise.
+       * tests/missing3.test: Likewise.
+       * tests/missing5.test: Likewise.
+       * tests/defs (get_shell_script): New subroutine, factoring out
+       code common to the tests above.
+       (xsi-lib-shell): If `$test_prefer_config_shell' is set to "yes",
+       check that $SHELL, not /bin/sh, supports XSI constructs, as we
+       expect the test will use $SHELL and not /bin/sh to run the
+       script being tested.
+
+2011-06-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests defs: better requirements for XSI shells
+       This change avoids potential spurious failures with tests using
+       the requirement 'xsi-shell' to mean that they want */bin/sh* (not
+       $SHELL) to be XSI-conforming.  This idiom used to work before
+       commit `v1.11-874-g1321be7' (as back then the test scripts were
+       unconditionally run with /bin/sh), but has become inconsistent
+       now that the test scripts re-execute themselves with configure
+       determined $SHELL.
+       The described spurious failures have already occurred in practice,
+       for examples on Solaris systems which also had GNU Bash installed.
+       From a suggestion by Peter Rosin.  See discussion at:
+       <http://lists.gnu.org/archive/html/automake-patches/2011-06/msg00016.html>
+       * tests/defs (xsi-shell): Now check that $SHELL, rather than the
+       shell currently running the test script, is an XSI shell.
+       (xsi-bin-sh): New requirement, checking that /bin/sh (which can
+       differ from $SHELL) is an XSI shell.
+       (xsi-lib-shell): New requirement, checking that the shell that
+       should be used to test the Automake-provided scripts from `lib/'
+       is an XSI shell.  For the moment, this is just an alias for
+       `xsi-bin-sh'.
+       (require_xsi): New subroutine, used to factor out code common to
+       the requirements above.
+       ($xsi_shell_code): New variable, contains shell code supposed to
+       work only with XSI shells.  Used by the new subroutine above.
+       * tests/ar-lib.test ($required): Require 'xsi-lib-shell' instead
+       of 'xsi-shell', since the script we test here is run with /bin/sh,
+       not with $SHELL.
+       * tests/compile3.test: Likewise.
+       * tests/compile6.test: Likewise.
+
+2011-06-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix typo-related error in auxdir2.test
+       * tests/auxdir2.test (configure.in):  Close m4 quoting in the
+       argument to AC_CONFIG_AUX_DIR.  Without this, aclocal fails with
+       "ERROR: end of file in string".  This problem hasn't been exposed
+       by the testsuite before because this test is in XFAIL_TESTS, so
+       its failure went unnoticed, even if it was due to a wrong cause.
+       Bug introduced in commit v1.11-249-g49ac3de.
+
+2011-06-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: check that `$me' can be overridden
+       * tests/self-check-me.test: Check that `$me' can be overridden
+       before sourcing ./defs, with or without sourcing ./defs-static
+       beforehand, and that this override is honored.  Update heading
+       comments.
+
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       self tests: fix another spurious failure
+       Our ad-hoc usage of `tests/defs' in the testsuite's self tests
+       stopped working properly when we made the test scripts re-execute
+       themselves with the configure-time $SHELL.  Fix this.
+       Fixes a regression introduced by commit 'v1.11-874-g1321be7'.
+       * tests/self-check-exit.test: Export `AM_TESTS_REEXEC' to "no"
+       before running the self tests.  This fixes a spurious failure
+       present only when the test was run by hand.
+
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       silent-rules tests: fix spurious failures with Sun Studio C++
+       * tests/silentcxx.test: The C++ compiler from Sun Studio is named
+       `CC'.  Account for this in our grepping checks on the make output.
+       Since we are at it, throw in a couple of improvements to comments
+       and formatting.
+       * tests/silent-many-generic.test: The C++ compiler from Sun Studio
+       is named `CC', and this can cause spurious failures in our grepping
+       of the make output.  Work around this by using a wrapper script
+       around the C++ compiler (generated on the fly), since filtering the
+       make output proved to be too fragile.
+
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in backcompat2.test on NetBSD
+       * tests/backcompat2.test: Add trailing `:' in the body of a `for'
+       loop, in case the last command there might have an exit status
+       different 0.  This work around `set -e' issues in some BSD shells,
+       e.g., NetBSD /bin/ksh.
+
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in autohdr3.test
+       * tests/autohder3.test (Makefile.am): Let `test' depend on `all',
+       so that config.h header is truly remade.
+       Remove now useless call to `$MAKE' when non-GNU make is in use.
+       Failure introduced by commit `v1.11-895-g5e62b96'.
+
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure of cond29.test on NetBSD
+       * tests/cond29.test: Skip if we cannot safely limit the maximal
+       size of used virtual memory to 20K.  This fixes a spurious failure
+       on NetBSD.
+       Bug introduced in commit `v1.11-885-g908d335'.
+
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: fix again few more failures
+       * tests/cond29.test: To please the `sc_tests_Exit_not_exit'
+       maintainer check, avoid using `sh -c "exit 0"' where a simple
+       `sh -c :' will do.
+       * tests/depmod-data.test: Use creative quoting to avoid
+       spuriously triggering the `sc_tests_Exit_not_exit' maintainer
+       check.
+
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: fix some more failures
+       * tests/instdir-ltlib.test: Use creative quoting to avoid
+       spuriously triggering the `sc_rm_minus_f' maintainer check.
+       * tests/instdir-prog.test: Likewise.
+       * tests/instspc-data.test: Use creative quoting to avoid
+       spuriously triggering the `sc_tests_Exit_not_exit' maintainer
+       check.
+
 2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        maintcheck: fix some failures, extend some checks
        check.
        * tests/depcomp8b.test: Likewise.
 
+2011-06-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: don't require GNU make where it's not strictly needed
+       * tests/autohdr3.test: Rewrite to be stricter when make is GNU
+       make.  Drop the requirement of GNU make.
+       * tests/aclocal5.test: Drop GNU make requirement, it's not truly
+       needed.  Add reference to similar tests `remake-subdir*.test'.
+       * remake-subdir-gnu.test, remake-subdir-from-subdir.test,
+       remake-subdir.test, remake-subdir2.test: Add reference to
+       each other, and to related test `aclocal5.test'.
+       * tests/aclocal6.test: Drop GNU make requirement, it's not
+       truly needed.
+       * tests/confh6.test: Likewise.
+       * tests/lex3.test: Likewise.
+       * tests/remake11.test: Likewise.
+       * tests/subdir5.test: Likewise.
+       * tests/subdir8.test: Likewise.
+       * tests/werror2.test: Likewise.
+       * tests/conff.test: Likewise, and ensure verbose printing of
+       captured make output.
+       * tests/lex5.test: Tweak so that GNU make is no more required.
+       * tests/version7.test: Likewise.
+       * tests/maken2.test: Add explicative comment for why this test
+       requires GNU make.
+       * tests/maken4.test: Let it run also with BSD makes supporting
+       the `.MAKE' special target.
+       * tests/output6.test: Use proper m4 quoting in configure.in.
+       Expand make macros with one-character name using `$(x)', not
+       `$x', for portability.  Move checks in the makefiles, rather
+       than relying on grepping the output from make.  Drop the now
+       unneeded GNU make requirement.
+
 2011-05-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        remake: behave better with non-GNU make in subdirectories
        make implementations, the command must be issued from the
        top-level directory.  This patch removes such limitation.
        * lib/am/configure.am (am--refresh): Depend on `%MAKEFILE%'.
-       * tests/defs.in (using_gmake): New function, backported from the
-       `master' branch (and simplified).
        * tests/remake-subdir.test: New test.
        * tests/remake-subdir2.test: Likewise.
        * tests/remake-subdir-gnu.test: Likewise.
        * tests/remake-subdir-from-subdir.test: Likewise.
        * tests/Makefile.am (TESTS): Update.
 
+2011-06-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex tests: fix spurious failures with Solaris lex
+       * tests/lex-lib.test (foo.l): Avoid empty "rules section", which
+       can confuse Solaris lex.
+       * tests/lex-libobj.test (foo.l): Likewise.
+
+2011-06-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex tests: do not force the use of flex unconditionally
+       * tests/defs (lex): Act more similarly to what the `yacc'
+       requirement does, i.e., only force the use of flex if the
+       $LEX variable is left unset by the user.
+       (flex): Use `skip_' to skip the test if flex is not found.
+
+2011-06-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex tests: avoid possible hang; fix and extend
+       * tests/lex3.test (foo.l:yywrap): Return 1, not 0, to avoid hangs.
+       Bug introduced in commit 'v1.11-871-geb147a1'.
+       (Makefile.am): Do not add `@LEXLIB@' to `$(LDADD)', as we define
+       our own `yywrap' function.
+       * tests/lex.test (tscan.l): In `yywrap', return 1, not 0, for
+       consistency with the default flex implementation.
+       * tests/lex-libobj.test (yywrap.c): Likewise.
+       * tests/lex-subobj-nodep.test (s1.l): Likewise.
+       * tests/lexvpath.test (foo.c): Likewise.
+       * tests/silent-lex-gcc (foo.l): Likewise.
+       * tests/silent-lex-generic (foo.l): Likewise.
+       * tests/silent-many-gcc (foo5.l): Likewise.
+       * tests/silent-many-generic (foo5.l): Likewise.
+       * tests/lex-lib.test (mu.c): Likewise.
+       Update heading comments, to refer to ...
+       * tests/lex-lib-external.test: ... this new test, which checks
+       that we can get use the `yywrap' function from a system-wide
+       library, if that's available.
+
+2011-06-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: prefer `skip_' over `echo ...; Exit 77'
+       * tests/self-check-cleanup.test: When the test must be skipped,
+       use `skip_ REASON' instead of `echo REASON; Exit 77'.  Also,
+       make the skip message shorter and clearer.
+
+2011-06-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failures in self tests
+       Our ad-hoc usage of `tests/defs' in the testsuite's self tests
+       stopped working properly when we made the test scripts re-execute
+       themselves with the configure-time $SHELL.  Fix this.
+       Fixes a bug introduced by commit 'v1.11-874-g1321be7'.
+       * tests/defs: Only check that we can find the client test script
+       when we must re-execute it.
+       * tests/self-check-cleanup.test: Export `AM_TESTS_REEXEC' to "no"
+       before running the self tests.
+       * tests/self-check-dir.test: Likewise.
+       * tests/self-check-explicit-skips.test: Likewise.
+       * tests/self-check-me.test: Likewise.
+       * tests/self-check-sanity.test: Likewise.
+       * tests/self-check-reexec.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-06-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: prefer ulimit over timeout in test on a memory-hogging bug
+       * tests/cond29.test: Use 'ulimit' instead of 'timeout' to ensure
+       that automake does not uses up too much resources.  This is really
+       and improvement because the bug tested by this script wasn't just
+       a "it hangs" or "it runs too slow" bug, but rather a memory-hogging
+       bug (due to combinatorial explosion when many Automake conditionals
+       had to be handled) which could easily crash the whole system, which
+       is unacceptable.  The requirement of a proper and working 'ulimit'
+       builtin might cause the test to be skipped on more systems, but
+       that shouldn't be a problem since the bug isn't about a portability
+       issue, but is rather an automake internal implementation problem.
+       I've verified that the test as updated by this patch still passes
+       with automake 1.8.5, automake 1.10.2, and obviously the development
+       version of automake, and that it fails with automake 1.7.9.
+
+2011-06-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: avoid generating `*-p.test' tests, use a wrapper script
+       The generated `*-p.test' tests had already become just thin layers
+       around the corresponding test scripts.  This change makes the final
+       step, converting to the use of a generic wrapper script and thus
+       avoiding the extra test generation (similarly to what is done for
+       the `*.instspc' and `*.depmod' tests).
+       * tests/parallel-tests.sh: New file, driver script to run checks
+       the on the `parallel-tests' semantics by wrapping tests that use
+       the generic "Simple Tests" driver.
+       * tests/gen-parallel-tests: Update, mostly to reflect the new
+       `.ptest' extensions used for tests in $(parallel_tests).
+       * Makefile.am (TESTS_EXTENSIONS): Add `.ptest'.
+       (PTEST_LOG_COMPILER): Define, it calls `parallel-tests.sh'.
+       ($(parallel_tests)): Do not really generate `*-p.test' tests
+       anymore; this is now just a dummy dependency declaration required
+       in order to have make actually produce expected log files from
+       the `.ptest.log' suffix rule.
+       (EXTRA_DIST): Distribute `parallel-tests.sh'.
+       (MAINTAINERCLEANFILES): Don't remove the `$(parallel_tests)', it
+       is not necessary anymore.
+       (generated_tests): Variable definition removed.
+       (TESTS): Update, by listing `$(parallel_tests)' directly instead
+       of `$(generated_tests)'
+       (expected_list_of_tests): Remove `$(generated_tests)'.
+       (maintainer-check-list-of-tests): No need to explicitly depend on
+       `$(expected_list_of_tests)' anymore.
+
 2011-05-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        automake, aclocal: honour configure-time AUTOCONF and AUTOM4TE
        ($AUTORECONF): New variable, defaulting to `@am_AUTORECONF@'.
        * doc/Makefile.am ($(srcdir)/amhello-1.0.tar.gz): Update.
 
+2011-05-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       parallel-tests: stricter checks on DISABLE_HARD_ERRORS support
+       * tests/parallel-tests-harderror.test: New test, doing more
+       in-depth checks on DISABLE_HARD_ERRORS.
+       * tests/parallel-tests.test: Remove tests on DISABLE_HARD_ERRORS,
+       now redundant.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-05-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
            Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        the `DESTDIR' variable, is poorly chosen, if not downright wrong.
        Rewrite it to use `prefix' as the overridden variable instead.
 
-2011-05-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-05-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       parallel-tests: stricter checks on DISABLE_HARD_ERRORS support
-       * tests/parallel-tests-harderror.test: New test, doing more
-       in-depth checks on DISABLE_HARD_ERRORS.
-       * tests/parallel-tests.test: Remove tests on DISABLE_HARD_ERRORS,
-       now redundant.
+       tests: don't require gfortran if any fortran compiler is enough
+       * tests/silentf90.test ($required): Require `fortran', not
+       `gfortran'.
+       * tests/silentf77.test ($required): Require `fortran77', not
+       `gfortran'.
+       * tests/silent-many-generic.test ($required): Require `fortran'
+       and `fortran77' rather than `gfortran'.
+
+2011-05-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: improve `ccnoco*.test', better cross-compiling support
+       * tests/ccnoco3.test (Mycomp): Use the `$CC' chosen by `tests/defs'
+       instead of forcing `gcc' unconditionally.  This ensures better
+       coverage in case of cross-compiling, when GCC can be named e.g.,
+       `i586-mingw32msvc-gcc', instead of simply `gcc'.
+       * tests/ccnoco.test: Likewise.  Remove redundant checks.  Modernize
+       the created `configure.in'.  Run tests both in-tree and in VPATH.
+       Export `CC' to the overridden value only once.
+       * tests/ccnoco2.test: Slightly stricter grepping of automake
+       stderr.  Add trailing `:' command.
+
+2011-05-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: each test case depends on `defs-static'
+       * tests/Makefile.am ($(TEST_LOGS)): Depends on `defs-static' too.
+       Simplify comments.
+
+2011-05-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use $SHELL to run tests which are shell scripts
+       * tests/Makefile.am (TEST_LOG_COMPILER): Define so that the
+       configure-time $SHELL is used to run the tests.
+       * tests/defs: Add code to re-execute by default the running
+       test script with configure-time $SHELL.  Updated comments.
+       * configure.ac: Check that `set -e' is working for $SHELL,
+       not for /bin/sh.
+       * tests/defs-static.in: Update comments.
+       * tests/README (Supported shells): Updated.
+       (Getting details from failures): Don't tell that tests are
+       run by /bin/sh by default.
+
+2011-05-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: split 'subst2.test' to improve modularity and coverage
+       * tests/subst2.test: Test removed, split into ...
+       * tests/programs-primary-rewritten.test: ... this test ...
+       * tests/subst-no-trailing-empty-line.test: ... and this one ...
+       * tests/extra-programs-empty.test: ... and this one.
+       * tests/Makefile.am (TESTS): Update.
+
+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
+       The AC_PROG_LEX Autoconf macro does not diagnose a failure to find
+       the "lex library" expected to provide a `yywrap' function (function
+       which is required to link most lex-generated programs).  On the
+       contrary, when all the link attempts (i.e., with `-ll' and `-lfl')
+       fail, configure declares that no lex library is needed, and simply
+       proceeds with the configuration process -- only for the build to
+       possibly fail later, at make time.
+       This behaviour might be (partly) intended; the Autoconf manual
+       reads:
+        ``You are encouraged to use Flex in your sources, since it is
+          both more pleasant to use than plain Lex and the C source
+          it produces is portable.  In order to ensure portability,
+          however, you must either provide a function `yywrap' or, if
+          you don't use it (e.g., your scanner has no `#include'-like
+          feature), simply include a `%noyywrap' statement in the
+          scanner's source.''
+       This AC_PROG_LEX behaviour is causing some spurious failures of the
+       Automake testsuite in environments which lack a proper library
+       providing `yywrap' (this happens for example in Linux->MinGW cross
+       compilations).  But at this point is clear that a proper workaround
+       is to simply provide a fall-back implementation of `yywrap' in our
+       lexers.
+       * tests/cond35.test: Provide a dummy `yywrap' function.
+       * tests/lex3.test: Likewise.
+       * tests/lexvpath.test: Likewise.
+       * tests/silent-many-gcc.test: Likewise.
+       * tests/silent-many-generic.test: Likewise.
+       * tests/silent-lex-gcc.test: Likewise, and a dummy `main' too.
+       * tests/silent-lex-generic.test: Likewise.
+       * tests/lex-lib.test: New test.
+       * tests/lex-libobj.test: New test.
+       * tests/lex-nowrap.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * THANKS: Update.
+       Thanks to Russ Allbery for the suggestion.
+
+2011-05-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: require C++ compiler explicitly in tests needing it
+       The list of the test scripts which needed a C++ compiler but
+       failed to require it explicitly has been found by running:
+         $ tests=`grep -lE 'CXX|\.c(c|\+\+|xx|pp)' *.test | tr '\n' ' '`
+         $ am_explicit_skips=yes CXX=false make check TESTS="$tests"
+       and looking for tests that reported FAIL instead of SKIP.
+       After the present change, all those previously failing tests
+       either pass or get correctly skipped.
+       * tests/subobj9.test: Require `c++', instead of explicitly
+       skipping on configure failure.  Add excerpts and/or details from
+       the original bug report that prompted this tests to be written.
+       * tests/silentcxx-gcc.test: Require g++.
+       * tests/silentcxx.test: Require c++.
+       * tests/suffix3.test: Likewise.
+
+2011-05-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: don't require g++ where any C++ compiler is enough
+       * tests/specflg10.test ($required): Use `c++', not g++.
+       * tests/silent-many-generic.test: Likewise.
+
+2011-05-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: require C compiler explicitly in tests needing it
+       The list of the test scripts which needed a C compiler but
+       failed to require it explicitly has been found by running:
+         $ am_explicit_skips=yes CC=false make check
+       and looking for tests that reported FAIL instead of SKIP.
+       After the present change, all those previously failing tests
+       either pass or get correctly skipped.
+       * tests/aclocal4.test ($required): Add `cc'.
+       * tests/ansi.test: Likewise.
+       * tests/ansi10.test: Likewise.
+       * tests/ansi3.test: Likewise.
+       * tests/ansi3b.test: Likewise.
+       * tests/ansi5.test: Likewise.
+       * tests/ansi6.test: Likewise.
+       * tests/ansi7.test: Likewise.
+       * tests/ansi9.test: Likewise.
+       * tests/backcompat6.test: Likewise.
+       * tests/canon7.test: Likewise.
+       * tests/check5.test: Likewise.
+       * tests/check7.test: Likewise.
+       * tests/check8.test: Likewise.
+       * tests/cond4.test: Likewise.
+       * tests/cond11.test: Likewise.
+       * tests/cond16.test: Likewise.
+       * tests/cond18.test: Likewise.
+       * tests/cond19.test: Likewise.
+       * tests/cond22.test: Likewise.
+       * tests/cond30.test: Likewise.
+       * tests/cond31.test: Likewise.
+       * tests/cond32.test: Likewise.
+       * tests/cond34.test: Likewise.
+       * tests/cond35.test: Likewise.
+       * tests/cond39.test: Likewise.
+       * tests/condd.test: Likewise.
+       * tests/cygnus-dependency-tracking.test: Likewise.
+       * tests/depcomp2.test: Likewise.
+       * tests/depcomp6.test: Likewise.
+       * tests/depcomp7.test: Likewise.
+       * tests/depcomp8a.test: Likewise.
+       * tests/depcomp8b.test: Likewise.
+       * tests/depdist.test: Likewise.
+       * tests/depend2.test: Likewise.
+       * tests/depend5.test: Likewise.
+       * tests/distcleancheck.test: Likewise.
+       * tests/distname.test: Likewise.
+       * tests/exeext.test: Likewise.
+       * tests/exeext4.test: Likewise.
+       * tests/extradep.test: Likewise.
+       * tests/extradep2.test: Likewise.
+       * tests/gnits2.test: Likewise.
+       * tests/gnits3.test: Likewise.
+       * tests/instdir-ltlib.test: Likewise.
+       * tests/instdir-prog.test: Likewise.
+       * tests/instfail.test: Likewise.
+       * tests/instfail-libtool.test: Likewise.
+       * tests/lex3.test: Likewise.
+       * tests/lex5.test: Likewise.
+       * tests/lexvpath.test: Likewise.
+       * tests/lex-subobj-nodep.test: Likewise.
+       * tests/lflags.test: Likewise.
+       * tests/libobj-basic.test: Likewise.
+       * tests/libobj2.test: Likewise.
+       * tests/libobj7.test: Likewise.
+       * tests/libobj10.test: Likewise.
+       * tests/libobj16a.test: Likewise.
+       * tests/libobj16b.test: Likewise.
+       * tests/libobj17.test: Likewise.
+       * tests/libobj19.test: Likewise.
+       * tests/libtool2.test: Likewise.
+       * tests/libtool3.test: Likewise.
+       * tests/libtool7.test: Likewise.
+       * tests/libtool9.test: Likewise.
+       * tests/libtoo10.test: Likewise.
+       * tests/libtoo11.test: Likewise.
+       * tests/ltcond.test: Likewise.
+       * tests/ltcond2.test: Likewise.
+       * tests/ltconv.test: Likewise.
+       * tests/ltinit.test: Likewise.
+       * tests/ltlibsrc.test: Likewise.
+       * tests/ltorder.test: Likewise.
+       * tests/nobase.test: Likewise.
+       * tests/nobase-libtool.test: Likewise.
+       * tests/mmodely.test: Likewise.
+       * tests/parallel-tests5.test: Likewise.
+       * tests/parallel-tests-suffix-prog.test: Likewise.
+       * tests/parallel-tests-ext-driver-prog.test: Likewise.
+       * tests/posixsubst-ldadd.test: Likewise.
+       * tests/posixsubst-libraries.test: Likewise.
+       * tests/posixsubst-ltlibraries.test: Likewise.
+       * tests/posixsubst-programs.test: Likewise.
+       * tests/posixsubst-sources.test: Likewise.
+       * tests/pr87.test: Likewise.
+       * tests/pr204.test: Likewise.
+       * tests/pr224.test: Likewise.
+       * tests/pr300-lib.test: Likewise.
+       * tests/pr300-ltlib.test: Likewise.
+       * tests/pr300-prog.test: Likewise.
+       * tests/pr401.test: Likewise.
+       * tests/pr401b.test: Likewise.
+       * tests/pr401c.test: Likewise.
+       * tests/remake-gnulib-add-acsubst.test: Likewise.
+       * tests/remake-gnulib-add-header.test: Likewise.
+       * tests/regex.test: Likewise.
+       * tests/repeated-options.test: Likewise.
+       * tests/silent.test: Likewise.
+       * tests/silent3.test: Likewise.
+       * tests/silent9.test: Likewise.
+       * tests/silent-lex-generic.test: Likewise.
+       * tests/silent-many-generic.test: Likewise.
+       * tests/silent-yacc-generic.test: Likewise.
+       * tests/specflg7.test: Likewise.
+       * tests/specflg9.test: Likewise.
+       * tests/specflg10.test: Likewise.
+       * tests/stdinc.test: Likewise.
+       * tests/strip.test: Likewise.
+       * tests/strip2.test: Likewise.
+       * tests/strip3.test: Likewise.
+       * tests/subdirbuiltsources.test: Likewise.
+       * tests/subobj3.test: Likewise.
+       * tests/subobj6.test: Likewise.
+       * tests/subobj11a.test: Likewise.
+       * tests/subpkg.test: Likewise.
+       * tests/subst2.test: Likewise.
+       * tests/subst3.test: Likewise.
+       * tests/substref.test: Likewise.
+       * tests/substre2.test: Likewise.
+       * tests/suffix5.test: Likewise.
+       * tests/suffix8.test: Likewise.
+       * tests/suffix10.test: Likewise.
+       * tests/suffix11.test: Likewise.
+       * tests/suffix12.test: Likewise.
+       * tests/suffix13.test: Likewise.
+       * tests/target-cflags.test: Likewise.
+       * tests/transform.test: Likewise.
+       * tests/transform2.test: Likewise.
+       * tests/yacc-basic.test: Likewise.
+       * tests/yacc-d-basic.test: Likewise.
+       * tests/yacc-clean.test: Likewise.
+       * tests/yacc-dist-nobuild.test: Likewise.
+       * tests/yacc-nodist.test: Likewise.
+       * tests/yaccvpath.test: Likewise.
+       * tests/yacc-d-vpath.test: Likewise.
+       * tests/yacc4.test: Likewise.
+       * tests/yacc7.test: Likewise.
+       * tests/yacc8.test: Likewise.
+       * tests/yaccdry.test: Likewise.
+       * tests/yflags-cmdline-override.test: Likewise.
+       * tests/yflags-force-override.test: Likewise.
+       * tests/python-virtualenv.test: Likewise.  Also, improve skip
+       messages.
+       * tests/subobj5.test ($required): Add `cc'.
+       (Makefile.am): Set `AUTOMAKE_OPTIONS' to `subdir-objects', and
+       add new checking rules `test-build' and `test-distdir'.
+       Extend the test by building and examining the distdir, the
+       program, and the object files.
+       * tests/postproc.test ($required): Add `cc'.
+       Avoid the explicit `|| Exit $?' after call to configure, which
+       is now either redundant (e.g., when `am_explicit_skips' is
+       unset), or counter-productive (e.g., when `am_explicit_skips'
+       is set to "yes").
+       * tests/pr243.test: Likewise.
+       * tests/pr266.test: Likewise.
+       * tests/pr220.test: Simplify so that it doesn't require a
+       C compiler anymore.
+       * tests/subdir5.test: Likewise.
+       * tests/subdir8.test: Likewise.
+       * tests/lflags.test: Likewise.
+       * tests/yflags.test: Likewise.
+       * tests/yflags-force-conditional.test: Likewise.
+       * tests/lflags2.test: Simplify so that it doesn't require a
+       C++ compiler anymore.
+       * tests/yflags2.test: Likewise.
+       * tests/autohdrdry.test (configure.in): Remove unneeded call
+       to `AC_PROG_CC'.
+       * tests/pr287.test: Likewise.
+       * tests/check6.test: Likewise.
+       * tests/cond21.test: Likewise, plus some cosmetic adjustments.
+       * tests/upc.test: Skip if configure fails with status `77'.
+       * tests/upc3.test: Likewise.
+       * tests/vala4.test: Likewise.
+       * tests/nostdinc.test: Likewise.  Also, make grepping checks
+       on `Makefile.in'.  Update heading comments.
+       * tests/compile5.test: When we must skip, skip explicitly,
+       and with a meaningful message.
+       * tests/instspc-tests.sh: When running in "test-build" or
+       "test-install" mode (as determined by the value of variable
+       `$instspc_action'), require `cc'.  Adjust comments.
+       * tests/depmod-tests.sh: Likewise.
+
+2011-05-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: allow user to ask for stricter skip semantics
+       Given how the Automake testsuite is currently structured, if a
+       command in a test script fails with status `77', the global test
+       outcome is considered a SKIP, because the value of `77' for `$?'
+       is passed to the exit trap.  Indeed, this happens in practice, as
+       an autoconf-generated configure script can exit with status `77'
+       if it fails to find, e.g., a required compiler.
+       While this behaviour is quite useful for avoiding spurious test
+       failures in the wild, it can also sometimes prevent the Automake
+       developers to easily see and declare the requirements of their
+       tests.
+       This change introduces a new variable `am_explicit_skips', meant to
+       be user-overridable, and which, when set to a "true" value (i.e.,
+       `yes' or `1'), require a direct call to `Exit 77' in order to make
+       the test outcome be considered a SKIP.
+       * tests/defs.in ($am__test_skipped): New variable, initialized
+       to `no'.
+       (Exit): Set `$am__test_skipped' to `yes' if passed an exit status
+       of 77.
+       (trap '...' 0): When `$am_explicit_skips' is set to a "true" value,
+       reset an exit status of `77' to `78' if $am__test_skipped is not
+       set to `yes'.
+       * tests/self-check-exit.test: Adjust: unset `am_explicit_skips'.
+       * tests/self-check-explicit-skips.test: New test.
        * tests/Makefile.am (TESTS): Update.
 
+2011-05-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: user can force skipping of compiler-requiring tests
+       * tests/defs (cc, c++, fortran, fortran77): Skip the test if
+       the relevant compiler is disabled by having the corresponding
+       variable (CC, CXX, FC and F77, respectively) set to "false".
+       (yacc): For consistency, skip the test when the YACC variable
+       is set to "false", not when it's set to "no".  Since we are at
+       it, fix the skip message to be shorter and more consistent.
+
+2011-05-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: tweak and improve tests on "Simple Tests" driver
+       * tests/check.test: Make grepping of generated Makefile.in
+       slightly stricter.  Add trailing `:' command.
+       * tests/check2.test: Ensure verbose printing of captured make
+       output.  Make grepping of generated Makefile.in and of make
+       output stricter.  Add trailing `:' command.
+       * tests/check3.test: Likewise.  Also, fix minor error in a
+       comment.
+       * tests/check4.test: Stricter grepping of make output.  Use
+       `using_gmake' subroutine instead of copy&paste from defs.in
+       to determine whether $MAKE is GNU make.  Add a trailing `:'
+       command.
+       * tests/check6.test: Add trailing `:' command.
+       * tests/check10.test: Prefer redirection `>' over `>>' when
+       creating new files.  Ensure verbose printing of captured make
+       output.
+       * tests/check11.test: Likewise.
+       * tests/check7.test: Likewise.  Make grepping of make output
+       stricter.  Prefer "make distcheck" over a simple "make check"
+       in a VPATH build. Add trailing `:' command.
+       (a.c): Format following GNU coding standards.
+       (Makefile.am): Explicitly declare target `print-xfail-tests'
+       as PHONY.  Distribute $(check_SCRIPTS), for distcheck.
+       * tests/parallel-tests.test: Prefer redirection `>' over `>>'
+       when creating new files.
+       * tests/parallel-tests2.test: Likewise.
+       * tests/parallel-tests9.test: Likewise.
+       * tests/parallel-tests8.test: Likewise.  Make grepping of
+       automake stderr stricter.
+       * tests/check8.test: Likewise.  Make formatting of created
+       *.c files more consistent with GNU Coding Standards.
+       * tests/check-subst-prog.test (configure.in): Break overly
+       long lines.
+       (pass-prog.c, xfail-prog.c): Format them more consistently
+       with GNU Coding Standards.
+       * tests/parallel-tests3.test: Use a shorter and clearer skip
+       message.  Use the `unindent' subroutine to improve readability
+       of indented loop bodies.  Simplify the hack used to please
+       maintainer-check.
+       * tests/parallel-tests5.test: Make formatting of created *.c
+       files more consistent with GNU Coding Standards.  Use the
+       `unindent' subroutine to improve readability of indented loop
+       bodies.
+       * tests/parallel-tests10.test: Add blank line, for clarity.
+       Prefer trailing `:' over trailing `Exit 0', for consistency
+       with other tests.
+
+2011-05-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests/README: small consistency improvement
+       * tests/README (Section "User interface" subsection "Running the
+       tests"): In examples, be more consistent w.r.t. the differences
+       between GNU and non-GNU make.
+
+2011-05-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests/README: suggest how to run tests in cross-compile mode
+       * tests/README (Section "User interface" subsection "Running the
+       tests"): Briefly explain how to override 'host_alias' at runtime
+       to force the use of cross-compilers by the testsuite.  Give an
+       example.
+
+2011-05-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: better detection of cross-compile mode
+       * configure.ac (AC_CANONICAL_HOST): New, probably not strictly
+       necessary, but useful to complements AC_CANONICAL_BUILD.
+       * tests/defs-static.in ($host_alias, $build_alias): New variables,
+       exported, user-overridable, defaults AC_SUBST'd by configure.
+       * tests/defs (cross_compiling): Consider cross-compilation mode
+       active only if `$host_alias' is not empty *and* it differs from
+       `$build_alias'.  This is more faithful to the way configure
+       determines whether it is cross-compiling, but still allows the
+       user to easily force cross-compilation by overriding `host_alias'
+       and `build_alias' at runtime.
+       From a report by Ralf Wildenhues.
+
 2011-05-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        testsuite: avoid re-running few tests with 'parallel-tests' option
        driver.
        * tests/pr401b.test: Likewise.
        * tests/pr401c.test: Likewise.
+       * tests/java-flat.test: Likewise, and properly update heading
+       comments.
+       * tests/java-nested.test: Likewise, but defining `parallel_tests'
+       to "yes" instead, for improved coverage in conjunction with the
+       sister test `java-flat.test'.
 
 2011-05-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        and 'ANSI2KNR' in the example; instead, use the more common
        and typical `DESTDIR'.
 
+2011-05-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid spurious failures in cross-compile mode
+       * tests/depcomp2.test: Ensure verbose printing of captured stderr
+       from configure.
+       * tests/ansi3.test ($required): Add 'native', as the ansi2knr
+       functionality is not meant to work with a cross-compiler.
+       * tests/ansi3b.test: Likewise.
+       * tests/ansi5.test: Likewise.
+       * tests/ansi6.test: Likewise.
+       * tests/ansi7.test: Likewise.
+       * tests/ansi8.test: Likewise.
+       * tests/ansi10.test: Likewise.
+       * tests/subobj3.test: Likewise.
+       * tests/check8.test ($required): Add 'native', as this test is
+       not meant to work with a cross-compiler.
+       * tests/gnits2.test: Likewise.
+       * tests/ltconv.test: Likewise.
+       * tests/ltcond2.test: Likewise.
+       * tests/parallel-tests5.test: Likewise.
+       * tests/specflg7.test: Likewise.
+       * tests/specflg8.test: Likewise.
+       * tests/check5.test: Likewise.  Also, ensure verbose printing of
+       captured make output, and thrown in few cosmetic and consistency
+       improvements.
+       * tests/ltinit.test: Be laxer in grepping configure output, to
+       avoid spurious failures on systems which lack POSIX dynamic
+       linking (e.g., MinGW), or when cross-compiling for such systems.
+       * tests/ansi9.test: Skip parts of the test that would require a
+       native compiler.
+       * tests/backcompat6.test: Likewise.
+       * tests/depcomp8a.test: Likewise.
+       * tests/pr401.test: Likewise.
+       * tests/pr401b.test: Likewise.
+       * tests/pr401c.test: Likewise.
+       * tests/target-cflags.test: Likewise.
+       * tests/lex3.test: Likewise.
+       * tests/yacc-basic.test: Likewise.
+       * tests/autohdr4.test: Likewise.  Also, extend the test to ensure
+       more coverage in cross-compile mode.
+       * tests/canon7.test: Likewise.
+       * tests/check9.test: Removed, split into two new tests ...
+       * tests/check-subst-prog.test: ... this one, which requires a
+       native C compiler ...
+       * tests/check-subst.test: ... and this one, which doesn't require
+       any compiler.
+       * tests/parallel-tests4.test: Removed, split into two new tests ...
+       * tests/parallel-tests-suffix-prog.test: ... this one, which
+       requires a native C compiler ...
+       * tests/parallel-tests-suffix.test: ... and this one, which
+       doesn't require any compiler.
+       * tests/parallel-tests7.test: Removed, split into two new tests ...
+       * tests/parallel-tests-ext-driver-prog.test: ... this one, which
+       requires a native C compiler ...
+       * tests/parallel-tests-ext-driver.test: ... and this one, which
+       doesn't require any compiler.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-05-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        test defs: rename requirement 'non-cross' -> 'native'
        when cross compiling.
        (gfortran, g77, non-cross): New requirements.
 
-2011-05-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-05-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix portability issues in 'repeated-options.test'
+       * tests/repeated-options.test: Do not assume that object files
+       have `.o' suffix and executables have no default suffix; instead,
+       use `$(OBJEXT)' and `$(EXEEXT)'.
+
+2011-05-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       check: document and test $(TEST_SUITE_LOG) overriding
+       * doc/automake.texi (Simple Tests using parallel-tests): Explain
+       how and why TEST_SUITE_LOG can be overridden at runtime.
+       * tests/parallel-tests-log-override-1.test: New test, check that
+       the newly documented idiom and similar usages are truly supported.
+       * tests/parallel-tests-log-override-2.test: Likewise.
+       * tests/parallel-tests-log-override-recheck.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-05-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure of extradep.test on FreeBSD
+       * tests/extradep.test: When using `ls -t' to determine whether a
+       file has been updated, make sure to use as reference a file whose
+       timestamp is expected to be *strictly* older that that of the file
+       being checked.  This is required because at least FreeBSD `ls' do
+       not sort files with the same timestamp in alphabetical order when
+       using the `-t' option.
+       * tests/extradep2.test: Likewise.
+
+2011-05-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure of txinfo21.test on FreeBSD
+       * tests/txinfo21.test: Use the `is_newest' subroutine instead of
+       the `ls -t' hack to to determine whether a file has been updated.
+       This is required because at least FreeBSD `ls' do not sort files
+       with the same timestamp in alphabetical order when using the `-t'
+       option.
+
+2011-05-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix syntax error in 'silentcxx-gcc.test'
+       * tests/silentcxx-gcc.test (for config_args in ...): Remove extra
+       trailing backslash from the list of looped-on items.
+
+2011-05-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       depmod tests: fix bug in depmodes list extraction
+       * tests/depmod-tests.sh (get_depmodes): Use `echo $all_depmodes'
+       instead of `... | tr "$nl" "$sp"' to strip extra whitespaces and
+       newlines from `$all_depmodes'.  The latter idiom with `tr' is
+       wrong since it gets run before `./defs' is sourced, and thus `$nl'
+       and `$sp' are undefined.
+       Bug revealad by FreeBSD tr(1) implementation, which doesn't accept
+       empty strings as arguments.
+
+2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests defs: use `skip_' for skipping java-related tests
+       * tests/defs.in (java, javac): Use `skip_' to signal test
+       skipping.
+
+2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: add excerpts from few original bug reports, for clarity.
+       * tests/comment6.test: Add excerpts and/or details from the
+       original bug report that prompted this tests to be added and/or
+       extended.
+       * tests/dejagnu4.test: Likewise.
+       * tests/installdir.test: Likewise.
+
+2011-05-13   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex: "make clean" removes .c files from non-distributed .l
+       Previously, while automake did *not* distribute C source and header
+       files derived from non-distributed Lex sources, it still caused
+       them to be removed only by "make maintainer-clean" only, and not by
+       simply "make clean" or "make distclean".
+       This caused "make distcheck" to fail, unless the developer put
+       those generated .c files in CLEANFILES or in DISTCLEANFILES by
+       hand.
+       This change fixes this issue, by making non-distributed `.c' files
+       generated by non-distributed Lex sources cleaned by "make clean".
+       A similar problem for Yacc support had been fixed with the commit
+       v1.11-263-ged2c8bc.
+       * tests/automake.in (lang_lex_target_hook): Make C source files
+       derived from non-distributed Lex files cleaned by "make clean",
+       not only by "make maintainer-clean".
+       * tests/lex-clean.test: New test.
+       * tests/lex-clean-cxx.test: Likewise.
+       * tests/lex-nodist.test: Likewise.
+       * tests/lex-pr204.test: Likewise.
+       * tests/pr204.test: For consistency, renamed ...
+       * tests/yacc-pr204.test: ... to this, and updated to keep it
+       more in sync with 'lex-pr204.test'.
+       * tests/yacc-nodist.test: Updated to keep it more in sync with
+       'lex-nodist.test'.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
+2011-05-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex tests: make test on Lex dependency tracking more "semantic"
+       * tests/lex4.test: Renamed ...
+       * tests/lex-depend-grep.test: ... to this, and extended.
+       * tests/lex-depend.test, tests/lex-depend-cxx.test: ... these
+       new tests.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-05-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex tests: remove erroneous check about ylwrap distribution
+       * tests/lex5.test: Do not check that the ylwrap script is *not*
+       distributed when there is only one lexer, as ylwrap is in fact
+       expected to distributed unconditionally (at least starting from
+       commit `Release-1-9-323-gc5881cc' of 19-08-2006).  Note that this
+       bogus check wasn't triggering any failure because it was done at
+       the wrong time (i.e. from the VPATH build directory), so that it
+       could never fail anyway.
+       Instead, check that ylwrap is distributed even when there is only
+       one lexer.
+       Since we are at it, add a couple of `ls -l' calls, to get better
+       debugging info.
+
+2011-05-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc tests: "make clean" removes C++ files from non-distributed .y
+       * tests/yacc-clean-cxx.test: New test, sister of `yacc-clean.test'.
+       * tests/yacc-clean.test: Update heading comment to reference the
+       new sister test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-05-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: add a workaround for automake bug#8485
+       * tests/yacc-d-cxx.test (Makefile.am): Add temporary workaround
+       for automake bug#8485.  The bug is still exposed by the testcase
+       'yacc-dist-nobuild-subdir.test'.
+
+2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: add a couple of inter-tests reference
+       * tests/yacc-nodist.test, tests/pr204.test: These tests are
+       related, so add references to each other in heading comments.
+
+2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex tests: require just `lex' instead of `flex'
+       * tests/lex-subobj-nodep.test ($required): Require `lex',
+       not `flex', as this test is expected to work with any lex
+       implementation.
+       * tests/silent-lex.test: Likewise.
 
-       check: document and test $(TEST_SUITE_LOG) overriding
-       * doc/automake.texi (Simple Tests using parallel-tests): Explain
-       how and why TEST_SUITE_LOG can be overridden at runtime.
-       * tests/parallel-tests-log-override-1.test: New test, check that
-       the newly documented idiom and similar usages are truly supported.
-       * tests/parallel-tests-log-override-2.test: Likewise.
-       * tests/parallel-tests-log-override-recheck.test: Likewise.
-       * tests/Makefile.am (TESTS): Update.
+2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-2011-05-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+       tests defs: use `skip_' for skipping yacc/lex related tests
+       * tests/defs.in (lex, bison): Use `skip_' to signal test skipping.
 
-       tests: fix spurious failure of txinfo21.test on FreeBSD
-       * tests/txinfo21.test: Use the `is_newest' subroutine instead of
-       the `ls -t' hack to to determine whether a file has been updated.
-       This is required because at least FreeBSD `ls' do not sort files
-       with the same timestamp in alphabetical order when using the `-t'
-       option.
+2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests defs: merge cleanup
+       * tests/defs.in (flex, bison): Requirements removed, we have real
+       `lex' and `yacc' requirements now.
 
 2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        (lex): New requirement, alias for `flex'.  A more appropriate
        implementation, looking for a generic `lex' program, will follow
        in the future.
-       (yacc): New requirement, alias for `bison'.  A more appropriate
-       implementation, looking for a generic `yacc' program, will follow
-       in the future.
+
+2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: 'silent-many-gcc.test' improved and made more robust
+       * tests/silent-many-gcc.test:  Also force "fast" gcc depmode
+       for C++ compilations.  Add sanity checks verifying that the
+       cache variables we force are really used by configure.  Fix
+       typo in comments.
+
+2011-05-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: drop useless requirements of 'g++'
+       * tests/lflags2.test ($required): Remove 'g++', as any working
+       C++ compiler should be enough, and ./configure will cause the
+       test to skip if no working C++ compiler is found.
+       * tests/yflags2.test: Likewise.
+       * tests/subobj9.test: Likewise.
+       * tests/silentcxx.test: Likewise.  Also, do not force depmodes
+       that could cause non-GNU C++ compilers to fail.
+       * tests/silentcxx-gcc.test: New test, like `silentcxx.test',
+       but forcing "fast" gcc depmode (and thus requiring the GNU C++
+       compiler).
+       * tests/specflg10.test: Add proper "fixme" comment telling that
+       we should make this test work with a generic C++ compiler.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests defs: one more environment sanitization (corner case)
+       * tests/defs (am__using_gmake): Initialize.  The `using_gmake'
+       subroutine was using this variable for caching, but wasn't
+       initializing it, which could cause problems in the (admittedly
+       very unlikely) case in which it was pre-existent in the
+       environment.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: add forgotten test scripts to $(TESTS)
+       * tests/Makefile.am (TESTS): Added test scripts  man[678].test,
+       which have been present on the filesystem and in the repository,
+       but which had erroneously been left out from $(TESTS).
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: ensure verbose printing of captured make output
+       * tests/libtool7.test: Ensure verbose printing of captured
+       make output.
+       * tests/libtool9.test: Likewise.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintcheck: consistency of list of test scripts
+       * CheckListOfTests.am: New file.
+       (maintainer-check-list-of-tests): New target,
+       check for consistency between list of tests defined in the
+       including Makefile and list of tests on the filesystem.
+       (clean-maintcheck-testslist-tmp): New rule, to clean up the
+       temporary files that might be left around by the rules associated
+       with the previous target.
+       (clean-local): Depend on it.
+       * lib/Automake/tests/Makefile.am: Include `CheckListOfTests.am'.
+       (maintainer-check): Added dependency from the new target
+       `maintainer-check-list-of-tests'.
+       * tests/Makefile.am: Likewise.  Also ...
+       (checked_test_extensions): Define to `.test'.
+       (expected_test_list): Define properly.
+       * Makefile.am (maintainer-check-list-of-test): New target,
+       calling recursively into `tests/' and `lib/Automake/tests/',
+       using ...
+       (TEST_SUBDIRS): ... this new variable.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: drop useless requirements of gcc (plus testsuite tweakings)
+       * tests/libobj14.test ($required): Remove 'gcc', as we never run
+       the C compiler.
+       * tests/targetclash.test: Likewise.
+       * tests/ansi6.test ($required): Remove 'gcc', as any working
+       C compiler should be enough.
+       * tests/ansi7.test: Likewise.
+       * tests/ansi9.test: Likewise.
+       * tests/ansi10.test: Likewise.
+       * tests/lex5.test: Likewise.
+       * tests/lexvpath.test: Likewise.
+       * tests/mmodely.test: Likewise.
+       * tests/pr204.test: Likewise.
+       * tests/pr300-lib.test: Likewise.
+       * tests/pr300-prog.test: Likewise.
+       * tests/primary3.test: Likewise.
+       * tests/specflg7.test: Likewise.
+       * tests/specflg8.test: Likewise.
+       * tests/subdir5.test: Likewise.
+       * tests/subdir8.test: Likewise.
+       * tests/subobj6.test: Likewise.
+       * tests/subst3.test: Likewise.
+       * tests/substre2.test: Likewise.
+       * tests/yacc6.test: Likewise.
+       * tests/yacc8.test: Likewise.
+       * tests/depcomp2.test: Likewise.  Also, avoid clobbering user-set
+       CFLAGS.
+       * tests/lex3.test: Likewise.
+       * tests/ansi3.test: Likewise.  Also, avoid 'CC=gcc' in configure.
+       * tests/ansi3b.test: Likewise.
+       * tests/ansi5.test: Likewise.
+       * tests/autohdr4.test ($required): Remove 'gcc', as any working
+       C compiler should be enough.
+       Also, do not reject slow dependency extractors (which we might
+       be forced to use now that $CC is not necessarily gcc anymore).
+       * tests/cond16.test ($required): Remove 'gcc', as any working
+       C compiler should be enough.
+       Since we are at it, throw in few minor tweakings (mostly cosmetic,
+       stylistic, or consistency-related).
+       * tests/cond18.test: Likewise.
+       * tests/cond35.test: Likewise.
+       * tests/gnits2.test: Likewise.
+       * tests/libtool3.test: Likewise.
+       * tests/libtool7.test: Likewise.
+       * tests/libtool9.test: Likewise.
+       * tests/ltcond.test: Likewise.
+       * tests/ltcond2.test: Likewise.
+       * tests/ltconv.test: Likewise.
+       * tests/ltlibsrc.test: Likewise.
+       * tests/nobase.test: Likewise.
+       * tests/nobase-libtool.test: Likewise.
+       * tests/pr220.test: Likewise.
+       * tests/pr224.test: Likewise.
+       * tests/pr300-ltlib.test: Likewise.
+       * tests/pr401.test: Likewise.
+       * tests/pr401b.test: Likewise.
+       * tests/pr401c.test: Likewise.
+       * tests/subpkg.test: Likewise.
+       * tests/target-cflags.test: Likewise.
+       * tests/transform.test: Likewise.
+       * tests/yacc4.test: Likewise.
+       * tests/cond19.test: Likewise.  Also, avoid clobbering user-set
+       CFLAGS.
+       * tests/cond4.test: Likewise.
+       * tests/depend2.test: Likewise.
+       * tests/pr87.test: Likewise.
+       * tests/subobj3.test: Likewise.
+       * tests/substref.test: Likewise.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: increase coverage w.r.t. GNU make
+       * tests/defs (GNUmake): Instead of just skipping the tests
+       requiring GNU make if $MAKE is not GNU make, try to look for
+       it and, if found, redefine $MAKE accordingly.  This will help
+       to transparently increase coverage on non-GNU systems which
+       have GNU make available in PATH.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: improve few inter-tests references
+       * tests/acloca22.test: Improve and extend the heading comments.
+       Add reference to related tests 'remake-deleted-m4-file.test' and
+       'remake-renamed-m4-macro-and-file.test'.  Since we are at it,
+       add trailing `:' command, and few blank lines for readability.
+       * tests/remake-renamed-m4-macro-and-file.test: In the heading
+       comments, add reference to the related test 'acloca22.test'.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in 'color2.test'
+       * tests/color2.test: If $MAKE contains command-line arguments (as
+       in e.g., "make -j2"), expect's directive "spawn $env(MAKE)" fails
+       spuriously, because it tries to run "$MAKE" as a single command.
+       Fix this with proper uses of the TCL `eval' builtin.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: few more checks on automatic remake support
+       * tests/remake-all-1.test: New test, check that the "all" target
+       triggers rebuilt of outdated Makefiles.
+       * tests/remake-all-2.test: Likewise, but for when the makefiles
+       are not named `Makefile'.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: check some remake features with non-GNU make too
+       * tests/acloca14.test ($required): Drop "GNUmake".  This test
+       works as-is with non-GNU make implementations.
+       * tests/remake1a.test: Likewise.
+       * tests/aclocal4.test ($required): Drop "GNUmake".
+       Modify the test to have it work also with non-GNU make.
+       * tests/remake5.test: Likewise.
+       * tests/remake8a.test: Likewise.
+       * tests/remake8b.test: Likewise.
+       * tests/remake9a.test: Likewise.
+       * tests/remake9b.test: Likewise.
+       * tests/remake9c.test: Likewise.
+       * tests/remake9d.test: Likewise.
+       * tests/remake10a.test: Likewise.
+       * tests/remake10b.test: Likewise.
+       * tests/remake10c.test: Likewise.
+       * tests/remake12.test: ($required): Drop "GNUmake".
+       Adapt the test to make it work also with non-GNU make (if
+       it supports an "include" directive).
+
+2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: extend tests on dependency tracking with VPATH
+       * tests/depmod-tests.sh: New script, fulfilling a threefold role:
+       1. it is called to generate a Makefile.am snippet, containing the
+          definition of proper lists of tests;
+       2. it is called to set up a directory containing some common data
+          files and autotools-generated files used by the aforementioned
+          tests (this is done for speed reasons only); and
+       3. it is called to properly run those tests, one at a time.
+       * tests/depcomp9.test: Delete, it's obsolete now.
+       * tests/depcomp10.test: Likewise.
+       * tests/Makefile.am ($(srcdir)/depmod-tests.am): Include this
+       snippet, which defines ...
+       (depmode_tests): ... this new macro, containing the list of the
+       newly generated `*.depmod' tests.
+       (TESTS_EXTENSIONS): Add `.depmod'.
+       (DEPMOD_LOG_COMPILER): Define.  It calls `depmod-tests.sh', so that
+       the "depmode tests" will be executed by passing that driver script
+       a proper parameter.
+       ($(depmod_tests)): New dependency declaration (dummy, but required
+       in order to have make actually produce expected log files from the
+       `.depmod.log' suffix rule).
+       (TESTS): Add $(depmod_tests).
+       (EXTRA_DIST): Distribute depmod-tests.sh.
+       Other minor cosmetic changes and reorderings.
+       * bootstrap: Generate depmod-tests.am.
+       * tests/.gitignore: Updated.
+
+2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: avoid extra test generation (for `instspc' tests)
+       We don't really need to generate tons and tons of wrapper test
+       scripts (presently, ~ 90) just to run what is basically a single
+       test (specifically, `instspc-tests.sh') with different parameters.
+       In fact, the possibility of running a single driver script with
+       multiple files/configurations/parameters is one of the major
+       selling points of the 'parallel-tests' testsuite driver of
+       automake.  So why not use ourselves more extensively the best
+       features we provide?
+       * tests/instspc-tests.sh: Update heading comments.  Expect
+       to be executed, not sourced.  Update handling of command-line
+       arguments.  Adjust to reflect the renaming of "instspc tests"
+       from `instspc-*.test' to `*.instspc'.
+       * tests/instspc-data.test: Update heading comments.  Execute
+       driver script `instspc-tests.sh', instead of sourcing it.
+       Give more informative messages in case of internal errors.
+       * tests/Makefile.am (TESTS_EXTENSIONS): Define explicitly (to
+       `.test' and `.instspc').
+       (TESTS): Add `$(instspc_tests)'.
+       (generated_tests): Remove `$(instspc_tests)'.
+       (INSTSPC_LOG_COMPILER): Define.  Calls `instspc-tests.sh', so
+       that the "instspc tests" will be now executed by passing that
+       driver script a proper parameter.
+       ($(instspc_tests)): Remove, we don't need anymore to generate
+       this tests.
+       ($(instspc_tests:.test=.log)): Remove, substituted by ...
+       ($(instspc_tests:.instspc=.log)): ... this.
+       ($(instspc_tests)): New dependency declaration (dummy, but
+       required in order to have make actually produce expected log
+       files from the `.instspc.log' suffix rule).
+       (MAINTAINERCLEANFILES, generated_tests): Don't extend with
+       $(instspc_tests) anymore.
+       Update comments.
+
+2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       build: improve the definition of the list of testcases
+       * tests/Makefile.am (handwritten_tests): New variable.
+       (generated_tests): Likewise.
+       (TESTS): Redefine as the union of the above.
+       (EXTRA_DIST): Extend using $(handwritten_tests) and
+       $(generated_tests) rather than $(TESTS).
+       * tests/gen-parallel-tests: Update accordingly, and
+       make more robust.
+
+2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests skips: shorter and clearer messages
+       * tests/defs: Use shorter messages when giving reasons for test
+       skipping; it turns out these shorter messages are also clearer.
+       If more info might be useful, send them to the log file only.
+
+2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix self check spurious failure with older bash versions
+       * tests/self-check-cleanup.test: Add trailing `:' to the test code
+       passed to $SHELL, otherwise older versions of bash (at least 2.05
+       and 3.2.39) fail to correctly remove the temporary directory in
+       the exit trap.
+
+2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: add sanity check to 'self-check-cleanup.test'
+       * tests/self-check-cleanup.test: Check that the "hacked" file
+       `defs-static' used by the test differs from the "vanilla" one
+       in builddir.  This also offers a little more debugging output.
+
+2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: display reasons for skips to the console
+       * tests/Makefile.am (AM_TESTS_ENVIRONMENT): Open file descriptor
+       `9' to the original stderr; define `stderr_fileno_' to `9', and
+       export it.
+       * tests/self-check-report.test: Prevent new spurious failures by
+       removing from the environment any definition of `stderr_fileno_'.
+
+2011-05-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: use `skip_' for skipping of tests
+       * tests/defs: Use the `skip_' subroutine for test skipping.  Also
+       give sometimes more detailed messages about the reasons for the
+       skipping.
+       * tests/canon7.test: Likewise.
+       * tests/color.test: Likewise.
+       * tests/color2.test: Likewise.
+       * tests/compile2.test: Likewise.
+       * tests/dejagnu7.test: Likewise.
+       * tests/depcomp6.test: Likewise.
+       * tests/depcomp9.test: Likewise.
+       * tests/depcomp10.test: Likewise.
+       * tests/distlinks.test: Likewise.
+       * tests/distlinksbrk.test: Likewise.
+       * tests/fn99.test: Likewise.
+       * tests/fn99subdir.test: Likewise.
+       * tests/forcemiss2.test: Likewise.
+       * tests/fort5.test: Likewise.
+       * tests/gettext3.test: Likewise.
+       * tests/install2.test: Likewise.
+       * tests/instfail-info.test: Likewise.
+       * tests/instfail-java.test: Likewise.
+       * tests/instfail-libtool.test: Likewise.
+       * tests/instfail.test: Likewise.
+       * tests/instmany-mans.test: Likewise.
+       * tests/instmany-python.test: Likewise.
+       * tests/instmany.test: Likewise.
+       * tests/instsh3.test: Likewise.
+       * tests/ltinit.test: Likewise.
+       * tests/makej2.test: Likewise.
+       * tests/mdate6.test: Likewise.
+       * tests/mkinst3.test: Likewise.
+       * tests/parallel-tests3.test: Likewise.
+       * tests/parallel-tests-reset-term.test: Likewise.
+       * tests/parallel-tests-unreadable-log.test: Likewise,
+       * tests/python-virtualenv.test: Likewise.
+       * tests/remake-gnulib-remove-header.test: Likewise.
+       * tests/subobj9.test: Likewise.
+       * tests/symlink2.test: Likewise.
+       * tests/tar.test: Likewise.
+       * tests/tar2.test: Likewise.
+       * tests/txinfo26.test: Likewise.
+       * tests/vala2.test: Likewise.
+       * tests/vala3.test: Likewise.
+       * tests/vala5.test: Likewise.
+       * tests/vtexi4.test: Likewise.
+       * tests/instdir-texi.test: Likewise.
+       * tests/txinfo21.test: Likewise.
+
+2011-04-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       testsuite: more environment sanitization
+       * tests/defs: Move the checks verifying that the variables `me',
+       `parallel_tests' and `required' aren't set in the environment ...
+       * tests/defs-static.in: ... in here, with some optimizations to
+       avoid useless forks.  Also, do the same checks for the variables
+       `original_AUTOMAKE' and `original_ACLOCAL' too.
+       * tests/self-check-env-sanitize.test: Update.
+       * tests/Makefile.am (TESTS_ENVIRONMENT): Unset also variables
+       `original_AUTOMAKE' and `original_ACLOCAL'.
+
+2011-04-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure (non-renamed AM_TESTS_SETUP usage)
+       * tests/parallel-tests-reset-term.test: Use AM_TESTS_ENVIRONMENT
+       instead of AM_TESTS_SETUP (which has been removed in commit
+       v1.11-349-g12f48fa).
+       Fix spurious failure introduced by merge `v1.11-781-gfeed175'.
 
 2011-04-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        not present in the displayed test name, since the simple-tests
        driver do not try to strip them.
 
+2011-04-24  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in self-check-env-sanitize.test
+       * tests/self-check-env-sanitize.test: Open file descriptor `5'
+       to stdout.
+       Fix spurious failure introduced by merge `v1.11-788-g3b0c8d5'.
+
 2011-04-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        test: self check subroutines for skipping/failing of tests
        superseded by the much more complete `maintclean.test'.
        * tests/Makefile.am (TESTS): Update.
 
+2011-05-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java tests: use $PATH_SEPARATOR where appropriate
+       * tests/java-compile-run-nested.test: Use `$PATH_SEPARATOR', not
+       `:', to separate entries of extended PATH and CLASSPATH variables.
+       * tests/java-compile-run-flat.test: Likewise.
+
+2011-04-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java coverage: test JAVACFLAGS and AM_JAVACFLAGS
+       * tests/javaflags.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java coverage: test rebuild rules for java
+       * tests/java-rebuild.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java coverage: try to build and run a java program
+       * tests/java-compile-run-flat.test: New test, try to build and run
+       a "UNIX-style" java program (complete with wrapper shell script
+       and the like) with a "flat" source-tree setup (i.e., everything in
+       the top-level directory).
+       * tests/java-compile-nested.test: Likewise, but using a more
+       typical "nested" source-tree setup.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: new requirement for the default java interpreter
+       * tests/defs.in (for tool in $required): New requirement 'java'.
+
+2011-04-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java tests: tweak and make stricter a couple of tests
+       * tests/javasubst.test: Use proper m4 quoting.  Add trailing `:'
+       command.  Enable `errexit' shell flag, and related changes.
+       Prefer cat + here-doc over echo to append to configure.in.
+       Make grepping of Makefile.in stricter.  Add debugging output.
+       Improve heading comments.
+       * tests/javaprim.test: Likewise.
+
+2011-04-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java coverage: add test on uninstall with JAVA primary
+       * tests/java-uninstall.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java tests: require java compiler more properly
+       * tests/java-extra.test: Use "required=javac" instead of ad-hoc
+       configure check.
+       * tests/java-noinst.test: Likewise.
+
+2011-04-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java: allow both JAVA and nobase_JAVA in the same Makefile.am
+       * automake.in (handle_java): Also strip `nobase_' from the given
+       prefix, when needed.
+       * tests/java-clean.test: Update and extend.
+       * tests/java-compile-install.test: Likewise.
+       * tests/java-no-duplicate.test: Likewise.
+       * tests/java-sources.test: Likewise.
+       * tests/java-noinst.test: Likewise.
+       * tests/java-mix-dist-nodist.test: Renamed to ...
+       * tests/java-mix.test: ... this, and extended.
+       * tests/java-nobase.test: New test, still xfailing due to
+       unrelated issues.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
 2011-04-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        testsuite: more environment sanitization
        (TESTS_ENVIRONMENT): Unset variables `parallel_tests' and
        `required'.  Adjust comments.
 
+2011-04-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: in self-checks, use $SHELL, not /bin/sh
+       * tests/self-check-me-in-env.test: Include `./defs-static' to get
+       the definition of `$SHELL'.  Use `$SHELL' instead of `/bin/sh' to
+       execute the tests.
+
+2011-04-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: prefer AM_TESTS_ENVIRONMENT to TESTS_ENVIRONMENT
+       * tests/Makefile.am (TESTS_ENVIRONMENT): Renamed to ...
+       (AM_TESTS_ENVIRONMENT): ... this.
+
 2011-04-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: don't allow `$me' to be overridden from the environment
        (TESTS): Update.
        Suggestion by Ralf Wildenhues.
 
+2011-04-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       check: rename AM_TESTS_SETUP -> AM_TESTS_ENVIRONMENT
+       The AM_TESTS_SETUP naming was not a good one after all.  It may
+       be technically more correct than AM_TESTS_ENVIRONMENT, but the
+       latter is a better one simply because it is easier to remember,
+       and even if you've never heard of it and only know the semantics
+       of TESTS_ENVIRONMENT, you can have a straightforward way to
+       figure out how AM_TESTS_ENVIRONMENT would work.
+       * tests/check.am (am__check_pre): Update.
+       * doc/automake.in (Simple Tests using parallel-tests): Update.
+       * tests/parallel-tests-am_tests_setup.test: Renamed ...
+       * tests/parallel-tests-am_tests_environment.test: ... to this,
+       and updated.
+       * tests/Makefile.am (TESTS): Update.
+       Suggestion and motivation by Ralf Wildenhues.
+
 2011-04-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        test defs: allow overriding of `$me'
 
 2011-04-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       coverage: more tests on the parallel-tests driver
+       * tests/parallel-tests-interrupt.test: New test.
+       * tests/parallel-tests-reset-term.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       check: new developer-reserved AM_TESTS_SETUP variable
+       For reference, see the discussion at:
+       <http://lists.gnu.org/archive/html/automake-patches/2011-01/msg00213.html>
+       * lib/am/check.am [%?PARALLEL_TESTS%] (am__check_pre): Pass also
+       $(AM_TESTS_SETUP).  Comments updated, and some typos fixed.
+       * doc/automake.texi (Simple Tests using parallel-tests): Document
+       AM_TESTS_SETUP.  Reorder some of the existing documentation a bit.
+       * tests/parallel-tests-am_tests_setup.test: New test.
+       From a suggestion by Ralf Wildenhues.
+
+2011-04-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        depcomp tests: don't reject slower dependency extractors
        * tests/depcomp8b.test: Add the `--enable-dependency-tracking'
        option to `configure' invocations, so that slower dependency
 2011-04-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        m4: add missing serial numbers to a few files
-       Related to automake bug#8483.
+       Fixes automake bug#8483.
        * m4/amversion.in: Add serial number.
        * m4/auxdir.m4: Likewise.
        * m4/gcj.m4: Likewise.
        * m4/strip.m4: Likewise.
        * m4/upc.m4: Likewise.
 
-2011-04-16  Jim Meyering  <meyering@redhat.com>
+2011-04-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix few bugs in self checks
+       Related to automake bug#8508.
+       * tests/self-check-cleanup.test: Be laxer when grepping output
+       from `ls -l', to account for ACLs and SELinux-only files.
+       * tests/self-check-dir.test: Source `defs-static' to read in the
+       correct definition for $SHELL.
+       * tests/self-check-me.test: Likewise, and extend a bit.
+       Report from Jim Meyering.
+
+2011-04-16  Jim Meyering  <meyering@redhat.com>
+
+       depcomp: correct invalid sed invocation
+       * lib/depcomp: Insert missing -e before '/:$/d'.
+       Otherwise, that use of sed would treat '/:$/d' as a file name.
+
+2011-04-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       maintainer check: quote literal `$' in Makefile rule
+       * Makefile.am (sc_tests_PATH_SEPARATOR): Escape literal `$'
+       character in double-quoted string.  Fix a bug in which the rule
+       emitted an erroneously empty substring in its error message.
+
+2011-04-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix typo in python5b.test
+       * tests/python5b.test: Remove extra `:' from $PATH redefinition.
+
+2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       lex/yacc tests: remove redundant $distdir definition
+       * tests/lex3.test ($distdir): Remove definition, that's already
+       done in `tests/defs'.
+       * tests/lexvpath.test: Likewise.
+       * tests/yacc-basic.test: Likewise.
+       * tests/yacc-cxx.test: Likewise.
+       * tests/yacc-d-basic.test: Likewise.
+       * tests/yacc-d-cxx.test: Likewise.
+       * tests/yacc-d-vpath.test: Likewise.
+       * tests/yacc-dist-nobuild-subdir.test: Likewise.
+       * tests/yacc-dist-nobuild.test: Likewise.
+       * tests/yacc-mix-c-cxx.test: Likewise.
+       * tests/yaccvpath.test: Likewise.
+
+2011-04-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundant settings of `errexit' shell flag
+       * tests/autodist-acconfig.test: Do not set the `errexit'
+       shell flag, as it is already set by `tests/defs'.
+       * tests/autodist-acconfig-no-subdir.test: Likewise.
+       * tests/autodist-aclocal-m4.test: Likewise.
+       * tests/autodist-config-headers.test: Likewise.
+       * tests/autodist-configure-no-subdir.test: Likewise.
+       * tests/autodist-stamp-vti.test: Likewise.
+       * tests/autodist-subdir.test: Likewise.
+       * tests/autodist.test: Likewise.
+       * tests/check-exported-srcdir.test: Likewise.
+       * tests/check-tests-in-builddir.test: Likewise.
+       * tests/check-tests_environment.test: Likewise.
+       * tests/help-python.test: Likewise.
+       * tests/java-check.test: Likewise.
+       * tests/java-extra.test: Likewise.
+       * tests/java-noinst.test: Likewise.
+       * tests/lex-subobj-nodep.test: Likewise.
+       * tests/ltinit.test: Likewise.
+       * tests/m4-inclusion.test: Likewise.
+       * tests/maintclean-vpath.test: Likewise.
+       * tests/parallel-tests-subdir.test: Likewise.
+       * tests/pr8365-remake-timing.test: Likewise.
+       * tests/python-dist.test: Likewise.
+       * tests/python-vars.test: Likewise.
+       * tests/python-virtualenv.test: Likewise.
+       * tests/python5b.test: Likewise.
+       * tests/specflg-dummy.test: Likewise.
+       * tests/yacc-dist-nobuild-subdir.test: Likewise.
+
+2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: define default $distdir (help reducing duplication)
+       * tests/defs ($distdir): New variable, might be used in
+       testcases checking distribution-related features.
+       * tests/pr9.test: Use it.
+       * tests/subdir9.test: Likewise.
+       * tests/lex3.test: Likewise.
+       * tests/lexvpath.test: Likewise.
+       * tests/remake-moved-m4-file.test: Likewise.
+       * tests/remake-renamed-m4-file.test: Likewise.
+       * tests/remake-renamed-m4-macro-and-file.test: Likewise.
+       * tests/yacc-basic.test: Likewise.
+       * tests/yacc-d-basic.test: Likewise.
+       * tests/yacc-d-vpath.test: Likewise.
+       * tests/yacc-dist-nobuild.test: Likewise.
+       * tests/vtexi3.test: Add comment explaining why we redefine
+       $distdir in this test.
+
+2011-04-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: test lex-generated "#line" directives postprocessing
+       * tests/yacc-line.test: In heading comments, add reference to new
+       sister test `lex-line.test'.
+       * tests/lex-line.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: minor improvements to a couple of yacc tests
+       * tests/yacc-auxdir.test: Avoid running autoconf, it's not
+       needed.
+       * tests/yacc-line.test: Also check that the yacc-generated C
+       and header files do not contain "#line" directives referencing
+       `y.tab.c' or `y.tab.h'.  Add a couple of explicative comments.
+
+2011-04-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: split yacc6.test, for better separation and coverage
+       * tests/yacc6.test: Test removed, its content extended and split
+       into ...
+       * tests/yacc-auxdir.test, tests/yacc-depend.test,
+       tests/yacc-line.test: ... these new tests.
+       * tests/yacc-depend2.test: New test, exposes the failure that
+       FreeBSD used to encounter in yacc6.test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: do not uselessly require GNU make or gcc in a few tests
+       * tests/lex3.test: Remove gcc from requirements, as any working C
+       compiler should be ok.  Consequently, do not clobber user CFLAGS.
+       Also, remove GNUmake from requirements; it was added (see commit
+       `Release-1-8-103-g0d2f592') because this test fails with FreeBSD
+       make due to VPATH issues -- but so do many other yacc-related and
+       lex-related tests currently, and requiring GNU make in all of
+       them would unacceptably reduce coverage.
+       * tests/lexvpath.test: Remove gcc from requirements, as any
+       working C compiler should be ok.
+       * tests/yacc4.test: Likewise.
+       * tests/yacc8.test: Likewise.
+       * tests/lex5.test: Likewise.  Also, do not require anymore GNU
+       make; to compensate, explicitly call "$MAKE Makefile" to update
+       the out-of-date Makefile if $MAKE is not GNU make.
+
+2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failure in test 'yacc-d-cxx.test'
+       * tests/yacc-d-cxx.test: Create ylwrap script before calling
+       automake for the first time, so that the script gets correctly
+       distributed.  Add checks verifying it indeed is.
+
+2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests cosmetics: remove redundant definitions of variable $tab
+       * tests/yacc-d-basic.test ($tab): Remove definition: it's already
+       defined in `tests/defs'.
+       * tests/yacc-d-cxx.test: Likewise.
+
+2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: add some tests on bison support (still xfailing)
+       Related to automake bug#7648 and PR automake/491.
+       * tests/bison-skeleton-cxx.test: New test.
+       * tests/bison-skeleton.test: New test.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Updated.
+
+2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: test for automake bug#8485 (known regression)
+       * tests/yacc-dist-nobuild-subdir.test: New test.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
+2011-04-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: test mixed C/C++ yacc-generated parsers in the same dir
+       * tests/yacc-mix-c-cxx.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetics: fix typos and wording in some yacc tests
+       * tests/yacc-cxx.test (foo.cc): Clarify comment about the content
+       of this file being valid C++ but invalid C.
+       (parse1.yy): Likewise.  Also, remove redundant parentheses in a
+       `return' statement.
+       * tests/yacc-d-cxx.test (write_parse): Clarify comment about the
+       content of the generated files being valid C++ but invalid C.
+       (write_main): Likewise.
+       * tests/yacc-basic.test: Remove redundant parentheses in a
+       `return' statement.
+       * tests/yacc-d-vpath.test: Adjust spacing around curly brackets.
+       * tests/yaccvpath.test: Likewise.
+       * tests/yaccdry.test: Likewise.
+       * tests/yacc8.test: Likewise.
+       * tests/yacc4.test: Likewise.
+       Suggested by Ralf Wildenhues.
+
+2011-04-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: update NEWS and docs about yacc-generated headers extensions
+       * doc/automake.texi (Yacc and Lex): Document explicitly that
+       extensions of yacc-generated headers are modelled after the
+       extension of the corresponding sources.
+       * NEWS: Update.
+
+2011-01-28   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: extension of headers modelled after extension of sources
+       With this change, if '-d' is in *YFLAGS, a yacc input file named
+       foo.y++ will cause a foo.h++ header to be generated, instead of a
+       foo.h header.  Similarly for foo.ypp, foo.yxx and foo.yy.
+       This way, the name of the files generated by an automake-created
+       `ylwrap' invocation should be consistent with those generated by
+       a `bison -o' call.
+       Related to automake bug#7648 and PR automake/491.
+       * lib/am/yacc.am (am__yacc_c2h): New internal variable.
+       (?GENERIC?%EXT%%DERIVED-EXT%, ?!GENERIC?%OBJ%): Get the name of
+       the header dynamically at make runtime, so that its extension is
+       modelled after the extension of the source.
+       * automake.in (lang_yacc_target_hook): Adjust the calculation of
+       `$header' accordingly.
+       * tests/yacc-cxx.test: New test.
+       * tests/yacc-d-cxx.test: Likewise.
+       * tests/yacc-weirdnames.test: Likewise.
+       * tests/yacc-basic.test: Update comments.
+       * tests/yacc-d-basic.test: Likewise.
+       * tests/yaccpp.test: Updated and extended.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-01-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: don't define YACC and LEX in the Makefiles
+       We don't want YACC and LEX defined as make variables, otherwise
+       the values determined at configure time will override those from
+       the environment, even in the make-spawned testcases.  For example,
+       before this change, with the following usage:
+         $ ./configure YACC=yacc
+         $ export YACC='bison -y'
+         $ make check
+       the testsuite would have ended up, very counterintuitively, with
+       YACC defined to 'yacc' in the testcases' environment.
+       * configure.ac: Call `AM_SUBST_NOTMAKE' on YACC and LEX.
+
+2011-01-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failures in lflags*.test
+       * tests/lflags.test: Remove 'LEX' from the environment, so
+       that it won't be erroneously picked up by `make -e'.
+       * tests/lflags2.test: Likewise.
+
+2011-01-29   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: more on 'yacc -d' and recovery from deleted headers
+       * tests/yacc-deleted-headers.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-01-29   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: remove redundancy from silent lex/yacc tests
+       * tests/silent-yacc-gcc.test, tests/silent-yacc-generic.test: Merge
+       these two testcases into ...
+       * tests/silent-yacc.test: ... this new one, which doesn't fiddle
+       which dependency tracking, as that shouldn't impact on generation
+       of yacc-derived C source and header files (and, for what concerns
+       compilation of C files, is already tested in other testcases).
+       * tests/silent-lex-gcc.test, tests/silent-lex-generic.test: Merge
+       these two testcases into ...
+       * tests/silent-lex.test: ... this new test, for similar reasons.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-01-29  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       tests init: better messages for 'yacc' and 'lex' requirements
+       * tests/defs.in: Give better diagnostic messages when a test must
+       be skipped to the unavailability of yacc or lex program.  Also,
+       improve syncing between code for requiring yacc and lex.
+
+2011-01-28  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       configure: look for a lex program to be used by the testsuite
+       This will allow the testcases requiring a 'lex' program to run also
+       with vendor/legacy lex implementations, not only with 'flex'.
+       * configure.ac: Look for a lex program, using AC_CHECK_PROGS.
+       * tests/defs.in: New required entry 'lex'.
+       ($LEX): Let the user override the lex program to be used by the
+       testsuite.
+       * tests/cond35.test ($required): Require 'lex', not 'flex'.
+       * tests/cond36.test: Likewise.
+       * tests/lexv3.test: Likewise.
+       * tests/lexv3.test: Likewise.
+       * tests/silent-lex-gcc.test: Likewise.
+       * tests/silent-lex-generic.test: Likewise.
+       * tests/silent-many-gcc.test: Likewise.
+       * tests/silent-many-generic.test:likewise.
+       * tests/lexvpath.test: Likewise, and fix typo in comments.
+
+2011-01-22   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       configure: look for a yacc program to be used by the testsuite
+       Instead of forcing the user to manually export 'YACC' in the
+       testsuite to use a non-bison yacc, we now look for a yacc program
+       at configure time, and use that as the default in the testsuite.
+       * configure.ac: Look for a yacc program, using AC_CHECK_PROGS.
+       * tests/defs.in: Updated to use the value of $YACC precomputed by
+       configure, unless the user overrides that in the environment.
+
+2011-01-22   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more coverage on yacc/lex silent-rules, plus minor cleanups
+       * tests/silent-yacc-gcc.test: Add sanity checks verifying that the
+       generated Makefile.in files really contains the non-generic rules
+       we expect.  Do not redundantly manually remove files we know to be
+       already removed "make maintainer-clean".
+       (Makefile.am): Ensure we cover also non-generic yacc rules, by
+       setting target-specific YFLAGS.
+       (sub/Makefile.am): Likewise.
+       * tests/silent-yacc-generic.test: Likewise.
+       * tests/silent-lex-gcc.test: Likewise, but with LFLAGS instead of
+       YFLAGS.
+       * tests/silent-lex-generic.test: Likewise.
+       * tests/silent-many-gcc.test: Likewise, but with both LFLAGS and
+       YFLAGS.  Also ...
+       (do_and_check_verbose_build): Remove redundant blank line.
+       * tests/silent-many-generic.test: Likewise.
+       * tests/silent-yacc-headers.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-01-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: fix spurious failures in yflags*.test
+       * tests/yflags.test: Remove 'YACC' from the environment, so
+       that it won't be erroneously picked up by `make -e'.
+       * tests/yflags2.test: Likewise.
+
+2011-01-22   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: cover yacc target-specific flags, and `-v' flag handling
+       * tests/yacc-basic.test: Also try to build a parser having `-v'
+       as target-specific flags.  Add a couple of `ls -l' commands, for
+       debugging.  Update and extend comments.  Escape literal dots in
+       grep regular expressions.
+
+2011-01-12   Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       depcomp: correct invalid sed invocation
-       * lib/depcomp: Insert missing -e before '/:$/d'.
-       Otherwise, that use of sed would treat '/:$/d' as a file name.
+       docs: clustered '-d' not recognized in YFLAGS
+       This change fixes automake bug#7828.
+       * doc/automake.texi (Yacc and Lex): Document that automake
+       recognizes '-d' in AM_YFLAGS only if it's not clustered with
+       other options.
+       From a report by Юрий Пухальский.
 
-2011-04-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-01-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       maintainer check: quote literal `$' in Makefile rule
-       * Makefile.am (sc_tests_PATH_SEPARATOR): Escape literal `$'
-       character in double-quoted string.  Fix a bug in which the rule
-       emitted an erroneously empty substring in its error message.
+       tests: do not force yacc-requiring tests to use bison
+       * tests/defs.in: New required entry 'yacc'.  Remove old
+       required entry 'bison'.
+       * tests/cond35.test ($required): Require yacc, not bison.
+       * tests/cond36.test: Likewise.
+       * tests/pr204.test: Likewise.
+       * tests/silent-many-gcc.test: Likewise.
+       * tests/silent-many-generic.test: Likewise.
+       * tests/silent-yacc-gcc.test: Likewise.
+       * tests/silent-yacc-generic.test: Likewise.
+       * tests/subpkg.test: Likewise.
+       * tests/suffix10.test: Likewise.
+       * tests/yacc-basic.test: Likewise.
+       * tests/yacc-clean.test: Likewise.
+       * tests/yacc-d-basic.test: Likewise.
+       * tests/yacc-d-vpath.test: Likewise.
+       * tests/yacc-dist-nobuild.test: Likewise.
+       * tests/yacc-nodist.test: Likewise.
+       * tests/yacc4.test: Likewise.
+       * tests/yacc6.test: Likewise.
+       * tests/yacc7.test: Likewise.
+       * tests/yacc8.test: Likewise.
+       * tests/yaccdry.test: Likewise.
+       * tests/yaccvpath.test: Likewise.
+
+2011-01-10   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: warn about conditional content in *YFLAGS variables
+       This change fixes automake bug#7804.
+       * automake.in (lang_yacc_target_hook): Warn if any of the relevant
+       *YFLAGS variables has conditional contents (not only a conditional
+       definition).  Related refactoring.
+       * NEWS: Updated.
+       * tests/yflags-conditional.test: Updated and extended.
+       * tests/yflags-conditional-force.test: New test.
+       * tests/Makefile.am (TESTS): Updated.
 
-2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-01-08   Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       coverage: test for automake bug#8485 (known regression)
-       * tests/yacc-dist-nobuild-subdir.test: New test.
+       yacc: support variable expansions in *YFLAGS definition.
+       This change fixes automake bug#7800.
+       * automake.in (lang_yacc_target_hook): Use 'value_as_list_recursive'
+       instead of 'variable_value' to get the value of *YFLAGS variables.
+       Related changes.
+       ($DASH_D_PATTERN): Removed.
+       * tests/Makefile.am (XFAIL_TESTS): Remove yflags-var-expand.test.
+       * tests/yacc-clean.test: Remove workaround for now-fixed bug.
+       * NEWS: Update.
+
+2011-01-08   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: more tests on *YFLAGS support
+       * tests/yflags-var-expand.test: New test, still xfailing.  It
+       exposes automake bug#7800 -- "automake fails to honor `-d' in
+       AM_YFLAGS when variable expansions are involved".
+       * tests/yflags-d-false-positive.test: New test, checking that
+       automake do not spuriously see `-d' in *YFLAGS when that isn't
+       really there.
+       * tests/yflags-force-override.test: New test, checking that
+       automake can cope with definition of the YFLAGS variable in
+       Makefile.am (even if that is an extremely bad practice, as that
+       variable is user-reserved).
+       * tests/yflags-cmdline-override.test: New test, checking that
+       automake can cope with user-redefinition of YFLAGS at configure
+       time and/or at make time.
+       * tests/yflags-conditional.test: New test, checks that automake
+       warns on conditionally-defined *YFLAGS variables.
        * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
 
-2011-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2011-01-08   Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       test defs: define default $distdir (help reducing duplication)
-       * tests/defs.in ($distdir): New variable, might be used in
-       testcases checking distribution-related features.
-       * tests/pr9.test: Use it.
-       * tests/subdir9.test: Likewise.
-       * tests/vtexi3.test: Add comment explaining why we redefine
-       $distdir in this test.
+       yacc: extend and improve tests
+       * tests/yacc-basic.test: Also check that the intermediate C file
+       is mentioned in the generated Makefile.in, and that it is created
+       by the first make invocation.
+       * tests/yacc3.test: Test removed, superseded by ...
+       * tests/yacc-d-basic.test: ... this new test.
+       * tests/yacc2.test: Add reference to that new test in the heading
+       comments.
+       * tests/yacc-d-vpath.test: New test.
+       * tests/yaccvpath.test: Updated heading comments.  Do not require
+       gcc anymore, as any working C compiler should be enough.  Remove
+       redundant comments.
+       * tests/yacc-nodist.test: New test.
+       * tests/yacc-dist-nobuild.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2010-12-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Extend, fix and improve tests on Lex and Yacc support.
+       * tests/lexcpp.test: New test script, on support for Lex + C++.
+       * tests/lexvpath.test: New test script, test build and rebuild
+       rules for lexers in VPATH setup.
+       * tests/yacc-basic.test: New test script, run simple "semantic"
+       checks on basic Yacc support (similarly to what lex3.test does
+       for Lex support).
+       * tests/lex.test: Don't create useless dummy source file joe.l.
+       Remove extra blank lines.
+       * tests/lex4.test: Add trailing `:' command.  Do not create dummy
+       useless lex source file.
+       * tests/lex2.test: Likewise.  Call automake with the `-a' option,
+       so that it doesn't fail for the absence of `ylwrap' script.  Make
+       grepping of automake stderr stricter.
+       * tests/yacc7.test: Add trailing `:' command.  Enable `errexit'
+       shell flag earlier (just after having sourced ./defs).
+       * tests/yacc4.test: Likewise.  Also ...
+       (configure.in): Use pre-populated skeleton set up by ./defs,
+       instead of writing one from scratch.
+       Other minor cosmetic changes.
+       * tests/yacc5.test: Likewise.
+       * tests/yaccvpath.test: Likewise. Also ...
+       ($distdir): New variable.
+       Use it throughout.
+       * tests/lex5.test: Likewise.
+       * tests/lex3.test: Likewise.  Check the distdir, rather than
+       grepping the distribution tarball.  Extend the test on the
+       created binary, and be sure to avoid hangs.  Add some comments.
+       * tests/yacc.test: Use stricter grepping.  Add trailing `:'.
+       * tests/yacc6.test: Likewise.
+       * tests/yacc3.test: Likewise.  Do not create the unused file
+       `Makefile.sed'.  Remove useless rules from Makefile.am.  Other
+       minor cosmetic changes.
+       * tests/yacc2.test: Make grepping of generated `Makefile.in' and
+       of automake error messages stricter.  Do not redirect output of
+       grep to /dev/null.  Move call to aclocal earlier.  Reduce the
+       number of empty blank lines.  Fix a typo in comments.
+       * tests/yacc8.test: Fixed bugs that reduced the completeness of
+       the tests.  Added trailing `:' command.
+       (configure.in): Use pre-populated skeleton set up by ./defs,
+       instead of writing one from scratch.
+       * tests/yaccpp.test: Test also extensions `.y++', `.ypp', and
+       `.yxx', rather than only `.yy'.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-01-07   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: "make clean" removes .c and .h files from non-distributed .y
+       Previously, while automake did *not* distribute C source and header
+       files derived from non-distributed Yacc sources, it still caused
+       them to be removed only by "make maintainer-clean" only, and not by
+       simply "make clean" or "make distclean".
+       This caused "make distcheck" to fail, unless the developer put
+       those generated .c and .h files in CLEANFILES or in DISTCLEANFILES
+       by hand.
+       This change fixes this issue, by making non-distributed `.c' and
+       `.h' files generated by non-distributed Yacc sources cleaned by
+       "make clean".
+       * tests/automake.in (lang_yacc_target_hook): Make C source and
+       header files derived from non-distributed Yacc files cleaned by
+       "make clean", not only by "make maintainer-clean".
+       * tests/yacc-clean.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
 
 2011-04-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        * NEWS: Update.
        Report by Bruno Haible.
 
+2011-04-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       java: allow both dist_JAVA and nodist_JAVA in the same Makefile.am
+       Fixes automake bug#8434.
+       * automake.in (handle_java): Strip `dist_' and `nodist_' from
+       the given prefix.  Define a new internal Makefile variable
+       `am__java_sources'.  Related adjustments.
+       * lib/am/java.am (JAVAC, JAVAROOT, CLASSPATH_ENV): Define only the
+       first time this am file is processed.
+       (class%DIR%.stamp): Stamp file renamed ...
+       (class%NDIR%.stamp): ... to this, so that the `dist_' and `nodist_'
+       prefixes are stripped from the name of the stampfile.  Adjust
+       declaration of dependencies by using the new automake-generated
+       internal variable `$(am__java_sources)'.  In the rule, use `$@'
+       as the name of the target, rather than hard-coding it.
+       * tests/java.test: Update and extend.
+       * tests/java-no-duplicate.test: New test.
+       * tests/java-mix-dist-nodist.test: Likewise.
+       * tests/java-compile-and-install.test: Likewise.
+       * tests/java-clean.test: Likewise.
+       * tests/java-sources.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       coverage: more on java support EXTRA_ and noinst_ prefixes
+       * tests/java-extra.test: New test, checking support for the
+       prefix `EXTRA_' with the JAVA primary.
+       * tests/java-noinst.test: New test, checking support for the
+       prefix `noinst_' with the JAVA primary.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-04-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        test defs: fix 'javac' requirement for older JDK versions
        * tests/defs.in (for tool in $required): New requirement 'javac'.
        * tests/java.test: Use it instead of ad-hoc configure check.
        * tests/java-check.test: Likewise.
+       * tests/java-extra.test: Likewise.
+       * tests/java-noinst.test: Likewise.
        * tests/instfail-java.test: Likewise.
        * tests/instdir-java.test: Likewise.
 
        * THANKS: Update.
        Report from Petteri Räty.
 
+2011-04-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Bruno Haible  <bruno@clisp.org>
+
+       coverage: add tests on remake rules in more complex situations
+       * tests/defs (using_gmake): New function.
+       (for tool in $required): Use it when $tool is 'GNUmake'.
+       * tests/remake-moved-m4-file.test: New test.
+       * tests/remake-deleted-m4-file.test: Likewise.
+       * tests/remake-renamed-m4-file.test: Likewise.
+       * tests/remake-renamed-m4-macro-and-file.test: Likewise.
+       * tests/remake-renamed-m4-macro.test: Likewise.
+       * tests/remake-add-acsubst-gnulib.test: Likewise.
+       * tests/remake-add-header-gnulib.test: Likewise.
+       * tests/remake-remove-header-gnulib.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-04-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       typofix in 'tests/defs'
+       * tests/defs: Fix typo (`itslef' instead of `itself') in
+       comments.
+
 2011-04-09  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Clarify regex code in depcomp.
        primary is used").
        From a report by Patrick Welche.
 
+2011-03-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cosmetics: better use of m4 quoting and m4sugar macros
+       * m4/dmalloc.m4: Better use of m4 quoting.  Bump serial number.
+       * m4/gcj.m4: Likewise.
+       * m4/init.m4: Likewise.
+       * m4/install-sh.m4: Likewise.
+       * m4/lex.m4: Likewise.
+       * m4/multi.m4: Likewise.
+       * m4/option.m4: Likewise.
+       * m4/python.m4: Likewise.
+       * m4/sanity.m4: Likewise.
+       * m4/cond.m4: Likewise.  Also, prefer the m4sugar macro 'm4_if'
+       over the plain m4 macro 'ifelse'.
+       * m4/depend.m4: Likewise.
+
+2011-03-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: add test about deprecated use of AC_INIT
+       * tests/deprecated-acinit.test: New test, check that automake
+       and autoconf complain about an old-style AC_INIT call used with
+       a new-style AM_AUTOMAKE_INIT call.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-03-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: fix bug (comments-in-var-defn.test + autoconf 2.62)
        * NEWS: Likewise.
        * TODO: Likewise.
 
+2011-03-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: extend checks on the 'unindent' shell function
+       * tests/self-check-unindent.test: Also check that multiple
+       instances of 'unindent' can run in parallel (this was not
+       the case when that function used temporary files).
+
 2011-03-01  Peter Rosin  <peda@lysator.liu.se>
 
        test defs: unindent without temporary file
        support works with LT_INIT-based interface.
        Thanks to Jack Kelly for the suggestion.
 
+2011-02-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: add testcases sanity-checking the testsuite
+       Helper subroutines, variables and other pieces of code defined
+       in the `tests/defs' and used by many testcases are non-obvious,
+       and tricky to get to work portably; but until now, they weren't
+       tested at all in a clear and self-contained way.
+       This change should remedy to the situation.
+       * tests/self-check-cleanup.test: New test, check removal of
+       temporary test working directory by `./defs'.
+       * tests/self-check-dir.test: New test, check that tests using
+       `./defs' create a proper temporary directory, and run in it.
+       * tests/self-check-exit.test: New test, check that, in case of
+       failing commands, the correct exit status is passed to the exit
+       trap installed by the `./defs' script.
+       * tests/self-check-is_newest.test: New test, checking the
+       `is_newest' subroutine.
+       * tests/self-check-me.test: New test, checking that $me gets
+       defined automatically by `tests/defs' if not set, and that it
+       can be overridden from either the shell or the environment.
+       * tests/self-check-sanity.test: New test, check that the sanity
+       checks performed by the `tests/defs' script works correctly.
+       * tests/self-check-unindent.test: New test, checking the
+       `unindent' subroutine.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-02-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: tempdirs with restrictive permissions are cleaned correctly
 
        test defs: add subroutine for input unindenting
        * tests/defs.in (unindent): New subroutine.
+       * tests/instspc-tests.sh: Use it.
 
 2011-02-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        from environment won't interfere with the testcases.
        Suggestion by Ralf Wildenhues.
 
+2011-02-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: `instspc-*.test': do not create useless source file
+       * tests/instspc-tests.sh (create_input_data): Do not create
+       unused source file `source2.c'.
+
+2011-02-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: optimize `instspc-*.test' for speed
+       After the split of `instspc.test' into various generated tests,
+       the running time of the testsuite has noticeably increased, since
+       all these new generated tests must run aclocal, autoconf and
+       automake, whereas previously they were run only once (at the
+       beginning of `instspc.test').  But luckily, since the new tests
+       share the same input files for the autotools, this situation can
+       be easily worked around (at the expenses of a slight increase of
+       complexity for the testsuite scaffolding).
+       * tests/instspc-data.test: New helper test, properly calling
+       the `instspc-tests.sh' script to generate input data for the
+       others `instspc-*.test' tests.
+       * tests/Makefile.am (TESTS): Add `instspc-data.test'.
+       ($(instspc_tests:.test=.log)): Depend on its log file.
+       (instspc-data.log): Depend on `instspc-tests.sh'.
+       * tests/instspc-tests.sh: Recognize new action `generate-data',
+       and use it to create hand-written and autotools-generated static
+       files shared by all the `instspc-*.test' tests.
+       When sourced by the `instspc-*.test' tests, use those previously
+       created files instead of recreating them from scratch.
+       (unindent, create_input_data): New subroutines.
+       Some other related changes and refactorings.
+       From a suggestion by Ralf Wildenhues.
+
+2011-02-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       python: fix spurious failure in tests
+       * tests/python-vars.test: Ignore cached values from config.site
+       by exporting CONFIG_SITE=/dev/null.  Be laxer in matching the
+       expected values of output variables `pythondir' and `pyexecdir',
+       since they can change quite unpredictably among different python
+       installations.  Also, avoid "hyping" debugging output, thus
+       offering smaller trace output and more informative diff.
+       Report and suggestions by Ralf Wildenhues.
+       * tests/python-virtualenv.test: Require python, since we call it
+       even after the virtualenv has been deactivated.  Ignore cached
+       values from config.site by exporting CONFIG_SITE=/dev/null.
+
 2011-02-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: tweak few tests on simple and parallel test drivers
        environment won't risk to interfere with the test.
        Suggestions by Ralf Wildenhues.
 
+2011-02-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       python: extend and improve tests, fix minor glitches
+       * m4/python.m4 (AM_PATH_PYTHON): Ensure the "checking ..." messages
+       from configure are always complete, even in case of failure.  Tiny
+       cosmetic improvement in info/error messages.
+       * tests/python.test: Also check that automake complains if the
+       PYTHON primary is used but the `py-compile' script is not present.
+       Make grepping of generated Makefile.in laxer w.r.t. whitespace.
+       Add trailing `:' command.
+       * tests/python2.test: Remove repeated calls aclocal: they are
+       useless because configure.in is never modified.  Make grepping
+       of automake stderr more comprehensive.  Remove the pre-existing
+       `py-compile' file before trying to install it with `--add-missing'.
+       Add trailing `:' command.
+       * tests/python3.test: Add trailing `:' command.
+       * tests/python11.test: Likewise.
+       * tests/python4.test: Likewise.  Also, try to pass PYTHON config
+       variable to configure from the environment, rather than only from
+       the command line.
+       * tests/python5.test: Ensure that the "checking ..." messages from
+       configure are always complete.  Use proper m4 quoting.  Add a
+       trailing `:' command.
+       * tests/python6.test: Simplify test logic, by checking for files
+       created by configure rather then grepping its output.
+       * tests/python7.test: Likewise.
+       * tests/python8.test: Also check that `$PYTHON' is meaningfully
+       set in the ACTION-IF-TRUE argument of AM_PATH_PYTHON.
+       * tests/python9.test: Likewise.
+       * tests/python10.test: Add trailing `:' command.
+       (Makefile.am): Declare `disttest' target as `.PHONY', and add
+       an `ls -l' to its recipe, for debugging.
+       * tests/nobase-python.test: In testing "make uninstall" and
+       "make install" results, prefer idioms that make verbose logs
+       more helpful.  Remove a couple of lines of dead code.  Add a
+       trailing `:' command.
+       * tests/python5b.test: New test, checking that configure performs
+       the check on the python version even when the choice of the python
+       interpreter is forced by the user.
+       * tests/python-dist.test: New test, checking the distribution of
+       *_PYTHON files.
+       * tests/python-vars.test: New test, checking that AM_PATH_PYTHON
+       correctly set all the output variables advertised in the manual.
+       * tests/python-virtualenv.test: New test, checking that python
+       support offered by automake works well with "virtual python
+       environments" created by the `virtualenv' program.
+       * tests/instdir-prog.test: Also check `$(pyexecdir)'.  Existing
+       checks made slightly stricter.
+       * tests/instdir-prog.test: Also check `$(pyexecdir)'.  Existing
+       * tests/instdir-ltlib.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
 2011-02-01  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        coverage: more tests on simple and parallel test drivers
        thus causing colored test output not to be automatically
        activated when it should.
 
-2011-01-23  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
-
-       tests: avoid instspc.test failures due to make's whitespace trimming
-       * tests/instspc.test: Prepend './' when passing the test
-       characters, to avoid leading whitespace characters to be trimmed
-       from macros set from environment variables.  Fixes testsuite
-       failures with HP-UX, IRIX, and Tru64/OSF make.
-
 2011-01-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        coverage: test semantics of "dummy" per-target flags
 2011-01-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests defs: sanitize IFS
-       * tests/defs.in ($IFS): Define to <space>, <tab>, <newline>.
+       * tests/defs ($IFS): Define to <space>, <tab>, <newline>.
        ($sp): New variable, holding a single whitespace character.
        ($tab): New variable, holding a tabulation character.
        ($nl): New variable, holding a newline character.
 
+2011-01-23  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       tests: avoid instspc* failures due to make's whitespace trimming
+       * tests/instspc-tests.sh: Prepend './' when passing the test
+       characters, to avoid leading whitespace characters to be trimmed
+       from macros set from environment variables.  Fixes testsuite
+       failures with HP-UX and Tru64/OSF make.
+
 2011-01-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        tests: fix VPATH auto-expansion workarounds.
+       * tests/suffix10.test, tests/suffix11.test, tests/suffix12.test,
+       tests/suffix3.test, tests/suffix5.test, tests/suffix8.test:
+       Ensure $< is not surrounded by white space, to prevent Solaris
+       make from applying automatic VPATH text expansion.
+
+       tests: fix VPATH auto-expansion workarounds.
        * tests/parallel-tests8.test, tests/suffix13.test:
        Ensure $< is not surrounded by white space, to prevent Solaris
        make from applying automatic VPATH text expansion.
        TESTS_ENVIRONMENT for the perl driver.  Instead, point to the
        parallel-tests driver.
 
+2011-01-21  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       tests: check for presence of cscope with redirected input.
+       * tests/defs: Add required test for cscope.
+       Fixes cscope3.test hang with Sun C 5.9 cscope.
+
+       tests: avoid false failure in cygnus-dependency-tracking.test.
+       * tests/cygnus-dependency-tracking.test: Be less restrictive
+       when grepping the compiler error message, GCC 3.4.6 on FreeBSD
+       does not mention an undefined symbol.
+
+2011-01-20  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       tests: revert not turning off errexit in instspc-test.sh
+       * tests/instspc-tests.sh: Turn off errexit while sourcing defs,
+       the scripts might still not be clean.
+
+2011-01-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       tests: work around Tru64 sh -e issues for instspc*.test.
+       Apparently, Tru64 sh does not like turning off errexit mode,
+       and gets confused.
+       * tests/defs: Document 'errexit' cleanliness requirement.
+       * tests/defs-static.in: Likewise.  Avoid error from command
+       substitution to abort instspc*.test with Tru64/OSF 5.1 sh.
+       * tests/instspc-tests.sh: Drop now-unneeded temporary errexit
+       dropping.  Add strategic '|| Exit' to let tests work on Tru64.
+
 2011-01-19  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Allow _AM_DEPENDENCIES to be used later in configure.
        do not want to depend on are strictly older than the target.
        Also test with a target out of date wrt. more than one rule.
 
+2011-01-17  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Avoid local $_ perl variable, for Perl before 5.9.1.
+       * lib/Automake/Options.pm (_process_option_list): Do not
+       lexically localize $_.  Fixes bootstrap on AIX 5.1.
+       Bug introduced in commit `v1.11-622-gf90a06c'.
+
 2011-01-16  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        tests: remove useless requirements from cond36.test
        Since we are at it, add a trailing `:' command.
 
 2011-01-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       tests: avoid failing command substitution in errexit mode.
+       * tests/vartypo2.test, tests/vartypos.test: Rewrite to not use
+       a command substitution with a nonzero exit status, that causes
+       IRIX and Tru64/OSF sh to fail the whole test.
+
+2011-01-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
            Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        parallel-tests: work around Tru64/OSF 5.1 sh read bugs.
 
        * NEWS, README: Update copyright years.
 
+2011-01-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: hard error in case of internal failures or signal caught
+       * tests/defs: Exit with status 99 (hard error) rather than
+       1 (failure) on unexpected/internal errors, or when a signal
+       is caught by the client script.
+
+       Tests defs: don't let useless variables leak in test scripts.
+       * tests/defs ($priv_check_temp, $overwrite_status, $ro_dir_temp,
+       $create_status, $r2h, $libtool_found, $gettext_found, $aclocaldir,
+       $extra_includes): Unset once they've served their purpose.
+
+2011-01-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
        Fix parallel-tests.test failure with HP-UX make.
        * tests/parallel-tests.test: Sleep inside inner tests, so logs
        are newer than logs of tests they depend on, for HP-UX make.
        to build it.
        Found by NixOS Hydra, reported by Ralf Wildenhues.
 
+2011-01-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Update docs w.r.t. warning and strictness options.
+       * doc/automake.texi (Strictness): Document that some warnings are
+       turned off by default in `foreign' strictness.
+       (Options): Divide into new sections "Options generalities" and
+       "List of Automake options".  Fix typo (colon instead of full
+       stop).  Document option precedence (AUTOMAKE_OPTIONS wins over
+       AM_INIT_AUTOMAKE which wins over command line).  Also document
+       interactions between options specifying strictness and those
+       specifying warnings.
+
+       More tests on warnings/strictness precedence.
+       * tests/warning-groups-win-over-strictness.test: New test, similar
+       to `warnings-win-over-strictness.test', but checking the explicit
+       catch-all warning flags (like `-Wall' and `-Wnone').
+       * tests/Makefile.am (TESTS): Update.
+
+       Update NEWS about the warnings-over-strictness precedence.
+       * NEWS: Automake explicit warning levels always take precedence
+       over the implicit warning levels implied by Automake strictness.
+
+       For PR automake/547:
+       Warnings win over strictness in AUTOMAKE_OPTIONS.
+       Ensure that, for what concerns the options specified in
+       AUTOMAKE_OPTIONS, explicitly-defined warnings always take
+       precedence over implicit strictness-implied warnings.
+       This finally fixes Automake bug#7669 a.k.a. PR/547.
+       * automake.in (handle_options): Call 'process_option_list'
+       only once per set of options.
+       * lib/Automake/Options.pm (process_global_option_list,
+       process_option_list): Add sanity checks.
+       ($_options_processed, $_global_options_processed): New
+       internal variables, used by the sanity checks above.
+       * tests/warnings-win-over-strictness.test: Extend.
+
+       For PR automake/547:
+       Change signature of 'Automake::Options::_process_option_list()'.
+       This only modifies internal details in the automake implementation,
+       bearing no externally visible effect, but preparing the way for the
+       final fix of Automake bug#7669 a.k.a. PR/547.
+       * lib/Automake/Options.pm (_process_option_list): Accept as
+       arguments a list of hash references with keys 'option' and 'where',
+       where 'option' is an option as might occur in AUTOMAKE_OPTIONS or
+       AM_INIT_AUTOMAKE, and 'where' is the location where it occurred.
+       (process_option_list, process_global_option_list): Updated.
+       * automake.in (handle_options, scan_autoconf_traces): Update.
+
+       Add more tests about AUTOMAKE_OPTIONS.
+       In view of soon-to-follow refactorings (still in the pursuit of a
+       fix for Automake bug#7669 a.k.a. PR/547), add some more tests on
+       AUTOMAKE_OPTIONS support, to prevent obvious regressions.
+       * tests/amopts-variable-expansion.test: New test.
+       * tests/amopts-location.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+       For PR automake/547:
+       Warnings win over strictness in AM_INIT_AUTOMAKE.
+       This change ensures that, for what concerns the options specified
+       in AM_INIT_AUTOMAKE,  explicitly-defined warnings always take
+       precedence over implicit strictness-implied warnings.  Related to
+       Automake bug#7669 a.k.a. PR/547.
+       * lib/Automake/Options.pm (_process_option_list): Parse explicit
+       warnings only after the strictness level has been set.  Fix POD
+       documentation.
+       * tests/warnings-win-over-strictness.test: Extend.
+
+       For PR automake/547:
+       Warnings win over strictness on command line.
+       Ensure that, on the command line at least, explicitly defined
+       warnings always take precedence over implicit strictness-implied
+       warnings.  Related to Automake bug#7669 a.k.a. PR/547.
+       * automake.in (parse_arguments): Parse warnings only after the
+       strictness level has been processed.
+       * tests/gnuwarn.test: Update, plus miscellaneous improvements.
+       * tests/warnings-win-over-strictness.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+       More tests on warnings and strictness.
+       * tests/warnings-strictness-interactions.test: New test.
+       * tests/warnings-unknown.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+       New test on silent-rules mode and portability warnings.
+       * tests/silent-nowarn.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+       Add new tests on strictness and warnings precedence and overriding.
+       * tests/strictness-override.test: New test.
+       * tests/strictness-precedence.test: New test.
+       * tests/warnings-override.test: New test.
+       * tests/warnings-precedence.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-01-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix remake rule-induced test failures with HP-UX make.
+       * tests/remake1a.test: Require GNU make.
+
+2011-01-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix remake rule-induced test failures with HP-UX make.
+       * tests/colon6.test: Update timestamp of subdir Makefile, so we
+       do not spuriously invoke the nonexistent toplevel am--refresh
+       rule.
+
+       tests: fix typos in colon6.test
+       * tests/colon6.test: Fix typos.
+
+2011-01-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+           Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: explain MSYS setup failure issue, improve test.
+       * tests/defs: Add comment and failure message, improve fail
+       logic.
+
+2011-01-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix libobj2.test failure with non-GNU make: define $(AR).
+       * tests/libobj2.test: Ensure $(AR) is suitably defined.
+
+2011-01-15  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       tests: avoid spurious failures due to fork failure in test setup
+       * tests/defs: Ensure $me is always nonempty, to avoid spurious
+       failures on MinGW/MSYS in case the preceding sed command could
+       not be spawned.
+
+       Avoid configure warnings from wait about reused PIDs.
+       * m4/sanity.m4 (AM_SANITY_CHECK): Hide wait stderr output.
+       Fixes spurious failure of depcomp2.test.
+
 2011-01-13  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Avoid testsuite failures due to Autoconf Fortran change.
 
 2011-01-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       tests: do not force yacc-requiring tests to use bison
+       * tests/defs.in: New required entry 'yacc'.  Remove old
+       required entry 'bison'.
+       * tests/cond35.test ($required): Require yacc, not bison.
+       * tests/cond36.test: Likewise.
+       * tests/pr204.test: Likewise.
+       * tests/silent-many-gcc.test: Likewise.
+       * tests/silent-many-generic.test: Likewise.
+       * tests/silent-yacc-gcc.test: Likewise.
+       * tests/silent-yacc-generic.test: Likewise.
+       * tests/subpkg.test: Likewise.
+       * tests/suffix10.test: Likewise.
+       * tests/yacc-basic.test: Likewise.
+       * tests/yacc-clean.test: Likewise.
+       * tests/yacc-d-basic.test: Likewise.
+       * tests/yacc-d-vpath.test: Likewise.
+       * tests/yacc-dist-nobuild.test: Likewise.
+       * tests/yacc-nodist.test: Likewise.
+       * tests/yacc4.test: Likewise.
+       * tests/yacc6.test: Likewise.
+       * tests/yacc7.test: Likewise.
+       * tests/yacc8.test: Likewise.
+       * tests/yaccdry.test: Likewise.
+       * tests/yaccvpath.test: Likewise.
+
+2011-01-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: more consistent checks about invalid options
+       * tests/aclocal.test: Grepping of automake stderr for messages
+       reporting invalid options made stricter.
+       * tests/no-outdir-option.test: Likewise.  Also, create a dummy
+       `Makefile.am', to ensure that the automake failures are really
+       caused only by unrecognized options.
+       * tests/automake.test: Added trailing `:' command.  Removed
+       redundant checks on `--help' and `--version' option (already
+       performed in the test `help*.test').
+
+2011-01-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       tests: enable 'errexit' shell flag by default.
+       * tests/defs: Enable `errexit' shell flag (near the end).
+       Removed redundant comment about the enabling of shell traces.
+       * tests/README (Writing test cases): Update, and use nicer
+       formatting in a couple of places.
+       * All tests: Adjusted by removing now-redundant calls to
+       'set -e'.
+
+2011-01-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        tests: work around a texi+cygnus bug causing a spurious XFAIL
        * tests/txinfo5b.test: New test, like txinfo5.test but calling
        automake with the `-Wno-override' option to work around a bug
        Fix another typo in Rule.pm comment.
        * lib/Automake/Rule.pm: Fix typo.
 
+2011-01-09  Peter Rosin  <peda@lysator.liu.se>
+
+       Fix another typo in Rule.pm comment.
+       * lib/Automake/Rule.pm: Fix typo.
+
 2011-01-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       tests: texinfo unrecognized extensions
+       * tests/txinfo-unrecognized-extension.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
        Improve, extend and tweak tests on Texinfo support.
        * tests/instdir-texi.test: Add a call to `ls -l' after that to
        `make', for debugging.  When looking for required tools, do not
        * tests/vtexi4.test: Likewise.
        * tests/Makefile.am (TESTS): Updated.
 
-2011-01-09  Peter Rosin  <peda@lysator.liu.se>
+2011-01-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       Fix another typo in Rule.pm comment.
-       * lib/Automake/Rule.pm: Fix typo.
+       tests: fix spurious failure in 'tests/yflags-conditional.test'
+       * tests/yflags-conditional.test: Filter out message "warnings are
+       treated as errors" from automake stderr, to avoid a false positive
+       when grepping for extraneous warning messages.
+
+2011-01-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: warn about conditional content in *YFLAGS variables
+       This change fixes automake bug#7804.
+       * automake.in (lang_yacc_target_hook): Warn if any of the relevant
+       *YFLAGS variables has conditional contents (not only a conditional
+       definition).  Related refactoring.
+       * NEWS: Updated.
+       * tests/yflags-conditional.test: Updated and extended.
+       * tests/yflags-conditional-force.test: New test.
+       * tests/Makefile.am (TESTS): Updated.
+
+2011-01-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: support variable expansions in *YFLAGS definition.
+       This change fixes automake bug#7800.
+       * automake.in (lang_yacc_target_hook): Use 'value_as_list_recursive'
+       instead of 'variable_value' to get the value of *YFLAGS variables.
+       Related changes.
+       ($DASH_D_PATTERN): Removed.
+       * tests/Makefile.am (XFAIL_TESTS): Remove yflags-var-expand.test.
+       * tests/yacc-clean.test: Remove workaround for now-fixed bug.
+       * NEWS: Update.
+
+2011-01-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: more tests on *YFLAGS support
+       * tests/yflags-var-expand.test: New test, still xfailing.  It
+       exposes automake bug#7800 -- "automake fails to honor `-d' in
+       AM_YFLAGS when variable expansions are involved".
+       * tests/yflags-d-false-positive.test: New test, checking that
+       automake do not spuriously see `-d' in *YFLAGS when that isn't
+       really there.
+       * tests/yflags-force-override.test: New test, checking that
+       automake can cope with definition of the YFLAGS variable in
+       Makefile.am (even if that is an extremely bad practice, as that
+       variable is user-reserved).
+       * tests/yflags-cmdline-override.test: New test, checking that
+       automake can cope with user-redefinition of YFLAGS at configure
+       time and/or at make time.
+       * tests/yflags-conditional.test: New test, checks that automake
+       warns on conditionally-defined *YFLAGS variables.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
+2011-01-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: extend and improve tests
+       * tests/yacc-basic.test: Also check that the intermediate C file
+       is mentioned in the generated Makefile.in, and that it is created
+       by the first make invocation.
+       * tests/yacc3.test: Test removed, superseded by ...
+       * tests/yacc-d-basic.test: ... this new test.
+       * tests/yacc2.test: Add reference to that new test in the heading
+       comments.
+       * tests/yacc-d-vpath.test: New test.
+       * tests/yaccvpath.test: Updated heading comments.  Do not require
+       gcc anymore, as any working C compiler should be enough.  Remove
+       redundant comments.
+       * tests/yacc-nodist.test: New test.
+       * tests/yacc-dist-nobuild.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2010-12-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Extend, fix and improve tests on Lex and Yacc support.
+       * tests/lexcpp.test: New test script, on support for Lex + C++.
+       * tests/lexvpath.test: New test script, test build and rebuild
+       rules for lexers in VPATH setup.
+       * tests/yacc-basic.test: New test script, run simple "semantic"
+       checks on basic Yacc support (similarly to what lex3.test does
+       for Lex support).
+       * tests/lex.test: Don't create useless dummy source file joe.l.
+       Remove extra blank lines.
+       * tests/lex4.test: Add trailing `:' command.  Do not create dummy
+       useless lex source file.
+       * tests/lex2.test: Likewise.  Call automake with the `-a' option,
+       so that it doesn't fail for the absence of `ylwrap' script.  Make
+       grepping of automake stderr stricter.
+       * tests/yacc7.test: Add trailing `:' command.  Enable `errexit'
+       shell flag earlier (just after having sourced ./defs).
+       * tests/yacc4.test: Likewise.  Also ...
+       (configure.in): Use pre-populated skeleton set up by ./defs,
+       instead of writing one from scratch.
+       Other minor cosmetic changes.
+       * tests/yacc5.test: Likewise.
+       * tests/yaccvpath.test: Likewise. Also ...
+       ($distdir): New variable.
+       Use it throughout.
+       * tests/lex5.test: Likewise.
+       * tests/lex3.test: Likewise.  Check the distdir, rather than
+       grepping the distribution tarball.  Extend the test on the
+       created binary, and be sure to avoid hangs.  Add some comments.
+       * tests/yacc.test: Use stricter grepping.  Add trailing `:'.
+       * tests/yacc6.test: Likewise.
+       * tests/yacc3.test: Likewise.  Do not create the unused file
+       `Makefile.sed'.  Remove useless rules from Makefile.am.  Other
+       minor cosmetic changes.
+       * tests/yacc2.test: Make grepping of generated `Makefile.in' and
+       of automake error messages stricter.  Do not redirect output of
+       grep to /dev/null.  Move call to aclocal earlier.  Reduce the
+       number of empty blank lines.  Fix a typo in comments.
+       * tests/yacc8.test: Fixed bugs that reduced the completeness of
+       the tests.  Added trailing `:' command.
+       (configure.in): Use pre-populated skeleton set up by ./defs,
+       instead of writing one from scratch.
+       * tests/yaccpp.test: Test also extensions `.y++', `.ypp', and
+       `.yxx', rather than only `.yy'.
+       * tests/Makefile.am (TESTS): Update.
 
 2011-01-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        * tests/cond14.test: Likewise.
        * tests/fort4.test: Likewise.
        * tests/fort5.test: Likewise.
+       * tests/libobj17.test: Likewise.
        * tests/suffix7.test: Likewise.
        * tests/vtexi2.test: Likewise.
 
        manual for how to convert directory values into macros.
        (Optional): Fix grammar nit.
 
+2011-01-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: "make clean" removes .c and .h files from non-distributed .y
+       Previously, while automake did *not* distribute C source and header
+       files derived from non-distributed Yacc sources, it still caused
+       them to be removed only by "make maintainer-clean" only, and not by
+       simply "make clean" or "make distclean".
+       This caused "make distcheck" to fail, unless the developer put
+       those generated .c and .h files in CLEANFILES or in DISTCLEANFILES
+       by hand.
+       This change fixes this issue, by making non-distributed `.c' and
+       `.h' files generated by non-distributed Yacc sources cleaned by
+       "make clean".
+       * tests/automake.in (lang_yacc_target_hook): Make C source and
+       header files derived from non-distributed Yacc files cleaned by
+       "make clean", not only by "make maintainer-clean".
+       * tests/yacc-clean.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
 2011-01-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        * NEWS: Fix typo (forgotten word).
        be used to work around automake checks on invalid primary/directory
        couples (such as `lib_PROGRAMS' or `doc_LIBRARIES').
 
+2010-01-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests: normalize use of the 'errexit' shell flag.
+       * tests/maken3.test (check_targets): Remove redundant call to
+       'set -e'.
+       * tests/maken4.test: Likewise.
+       * tests/ansi5.test: Call 'set -e' just after './defs' has been
+       sourced.
+       * tests/ansi6.test: Likewise.
+       * tests/ansi7.test: Likewise.
+       * tests/cond16.test: Likewise.
+       * tests/cond17.test: Likewise.
+       * tests/cond18.test: Likewise.
+       * tests/cond19.test: Likewise.
+       * tests/cond20.test: Likewise.
+       * tests/cond21.test: Likewise.
+       * tests/instdat2.test: Likewise.
+       * tests/instdir-texi.test: Likewise.
+       * tests/parallel-tests3.test: Likewise.
+       * tests/remake1a.test: Likewise.
+       * tests/ccnoco.test: Likewise, and add trailing `:' command.
+       * tests/comment4.test: Likewise.
+       * tests/gcj4.test: Likewise.
+       * tests/nodist2.test: Likewise.
+       * tests/nodist3.test: Enable 'errexit' shell flag (this should
+       have been done in commit v1.11-248-g317e17b, but the relevant
+       hunk has been forgotten somehow).
+       * tests/output.test: Likewise.
+       * tests/gnits2.test: Likewise, and display captured stderr to
+       script's stderr, not to script's stdout.
+       * tests/gnits3.test: Likewise.  Also, prefer 'cat' over 'echo'
+       to append to Makefile.am, and really check that the exit status
+       of "make installcheck" indicates failure.
+
 2011-01-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Sync auxiliary files from upstream.
        * lib/config.guess, lib/config.sub, lib/texinfo.tex:
        Sync from upstream.
 
+       Avoid caching bug in cygnus mode test.
+       * tests/cygnus-requires-maintainer-mode.test: Remove
+       autom4te.cache directory before rerunning aclocal, to
+       remove trace caches.
+
        Fix maintainer-check regression.
        * tests/subobj11a.test: Pass DISTCHECK_CONFIGURE_FLAGS in the
        environment.
        * automake.in (gen_copyright, version): Likewise.
        * doc/automake.texi: Likewise.
 
+2010-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       * NEWS: Add missing blank line between two entries.
+
+2010-12-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Improve and extend tests `suffix*.test'.
+       * tests/suffix.test: Check that suffix rules for C compilation are
+       only included once.  Try also with a static library.
+       * tests/suffix2.test: Add a new grep to help potential debugging.
+       Do not run automake with the `--add-missing' options, since we
+       already create all the needed auxiliary files.  Try also *without*
+       the `no-dependencies' automake option.
+       * tests/suffix4.test: Make grepping of Makefile.in stricter.
+       * tests/suffix3.test: Rewritten to run also autoconf, ./configure
+       and make.
+       * tests/suffix5.test: Likewise.
+       * tests/suffix6.test: Fix botched recipe indentation (eight spaces
+       were used instead of a tabulation character).  Extend to check
+       that `.obj' is handled like `.$(OBJEXT)' (as is done for `.o').
+       Improved parsing & grepping of generated Makefile.in.  Other minor
+       fixes and improvements.
+       * tests/suffix10.test: Move some checks in Makefile.am.  Also run
+       "make all".
+       * tests/suffix12.test: Likewise, and account for VPATH issues in
+       weaker make implementations.
+       * tests/suffix11.test: Likewise.  Also, run "make distcheck", for
+       completeness, and related changes.
+       * tests/suffix8.test: Likewise.  Also, do not put `gcc' anymore
+       in $required.
+       * tests/suffix13.test: Do not use the `--force-missing' automake
+       option unnecessarily.
+       * tests/suffix6b.test: New test, semantic sister of `suffix6.test'.
+       * tests/suffix6c.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-12-23  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
            Stefano Lattarini  <stefano.lattarini@gmail.com>
 
 
 2010-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       Add some tests on 'cygnus' mode.
+       * tests/clean2.test: Extend.
+       * tests/cygnus-check-without-all.test: New test.
+       * tests/cygnus-dependency-tracking.test: Likewise.
+       * tests/cygnus-distclean.test: Likewise.
+       * tests/cygnus-imply-foreign.test: Likewise.
+       * tests/cygnus-no-dist.test: Likewise.
+       * tests/cygnus-no-installinfo.test: Likewise.
+       * tests/cygnus-requires-maintainer-mode.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2010-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Fix parallel testsuite run with Zsh.
+       This change deals with a Zsh incompatibility in the handling
+       of the special shell variable `$0' in sourced files; this
+       incompatibility used to cause utter breakage when the
+       Automake testsuite was run in parallel mode with Zsh as
+       the $(TEST_LOG_COMPILER).
+       For more information, please refer to the thread "Fix parallel
+       testsuite run with zsh" on automake-patches, dated 2010-12-22:
+        <http://lists.gnu.org/archive/html/automake-patches/2010-12/msg00135.html>
+       This change works around the problems described above for Zsh 4.3
+       or later, and offers better error messages (instead of random
+       failures) for earlier Zsh version.
+       * tests/README (Supported shells): When describing the manual
+       workaround about the Zsh incompatibility in the handling of `$0',
+       tell that it is now needed only with Zsh versions preceding 4.3.
+       Done also some minor rewordings.
+       * tests/defs-static.in ($argv0): New variable, offers a workaround
+       for the Zsh incompatibility in the handling of `$0'.
+       Abort if that variable cannot be correctly set (can happen only
+       in older Zsh version).
+       * tests/defs ($me): Define using `$argv0', not `$0'.
+
+2010-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests defs: keep track of original $AUTOMAKE and $ACLOCAL values.
+       This is especially useful for tests which might want to run
+       automake and aclocal without additional flags and warnings.
+       * tests/defs-static.in ($original_ACLOCAL): New variable.
+       ($original_AUTOMAKE): Likewise.
+       * tests/help.test: Use them.
+       * tests/help2.test: Likewise.
+       * tests/help3.test: Likewise.
+       * tests/help4.test: Likewise.
+       From a suggestion by Ralf Wildenhues.
+
+2010-12-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        distlinksbrk.test: Work around botched "make -k".
        * tests/distlinksbrk.test: Run "make" multiple times and grep
        its output each time for a single error message, rather than
 
 2010-12-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
-       Fix sed-related buglet in test "subdir5.test"
-       * tests/subdir5.test: Always terminate text passed to the
-       `i' sed command with a newline, to work around limitations
-       in e.g. older OpenBSD sed.
+       Minor improvements to test 'amopts.test'.
+       * tests/amopts.test: Remove botched comment.  Make grepping of
+       automake stderr slighty stricter.  Add trailing `:' command.
+
+2010-12-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       backcompat6.test: avoid comments inside recipe commands.
+       * tests/backcompat6.test: Remove shell comments from makefile rule
+       commands, as they are not portable to (at least) Tru64 make.
+
+2010-12-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       man8.test: avoid comments inside recipe commands.
+       * tests/man8.test: Remove shell comments from makefile rule
+       commands, as they are not portable to (at least) Tru64 make.
+
+2010-12-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Fix sed-related buglet in test "subdir5.test"
+       * tests/subdir5.test: Always terminate text passed to the
+       `i' sed command with a newline, to work around limitations
+       in e.g. older OpenBSD sed.
+
+2010-12-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Fix spurious failures in tests on AC_CONFIG_AUX_DIR.
+       * tests/auxdir7.test: Do not try to needlessly overwrite the files
+       `install-sh' and `missing'.  This avoid spurious failures in "make
+       distcheck", when those files might be copied as read-only from the
+       `lib' directory.
+       * tests/auxdir8.test: Likewise.
+
+2010-12-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Make test 'posixsubst-script' portable to MinGW/MSYS.
+       * tests/posixsubst-script.test: Ensure that the generated dummy
+       scripts really start with a shebang line, to work around a
+       limitation of 'test -x' on MinGW/MSYS.
+       Reported by Ralf Wildenhues.
+
+       Improve comments in tests `posixsubst*.test'.
+       * tests/posixsubst-data.test: Improve comment explaining why we
+       try also empty match suffix.
+       * tests/posixsubst-extradist.test: Likewise.
+       * tests/posixsubst-ldadd.test: Likewise.
+       * tests/posixsubst-libraries.test: Likewise.
+       * tests/posixsubst-ltlibraries.test: Likewise.
+       * tests/posixsubst-programs.test: Likewise.
+       * tests/posixsubst-scripts.test: Likewise.
+       * tests/posixsubst-sources.test: Likewise.
+       * tests/posixsubst-tests.test: Likewise.
+       Suggested by Ralf Wildenhues.
 
 2010-12-18  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        * doc/automake.texi (Uniform): List `LTLIBRARIES' among
        the Automake primaries.
 
+2010-12-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Tests defs: requirement 'xsi-shell' must be synced with libtool.
+       * tests/defs (xsi-shell): Add comment telling to keep the
+       XSI-conformance checks in sync with libtool.
+
+2010-12-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Minor cleanups in canon7.test.
+       * tests/canon7.test (_foo_bar_SOURCES): Remove libs.c.
+       (configure.in): Remove AC_PROG_CXX.
+
+2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Avoid false positive in sc_tests_plain_make maintainer-check.
+       * Makefile.am (sc_tests_plain_make): Ensure to only match full
+       `make' words.  Avoid false positive with remake11.test.
+
+2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix canon7.test failure.
+       * tests/canon7.test (_foo_bar_SOURCES): Add foobar.c.
+       (lib.h, libd.c, libs.c): Use const for constant strings.
+
+2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix typos in test comments.
+       * tests/posixsubst-data.test, tests/posixsubst-extradist.test,
+       tests/posixsubst-ldadd.test, tests/posixsubst-libraries.test,
+       tests/posixsubst-ltlibraries.test, tests/posixsubst-programs.test,
+       tests/posixsubst-scripts.test, tests/posixsubst-sources.test,
+       tests/posixsubst-tests.test: Fix typos.
+
+2010-12-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       More uses of AS_HELP_STRING in automake macros.
+       * m4/depend.m4 (AM_DEP_TRACK): Use `AS_HELP_STRING' to format
+       the help message added to the generated configure.
+       * m4/dmalloc.m4 (AM_WITH_DMALLOC): Likewise.
+       * m4/lispdir.m4 (AM_PATH_LISPDIR): Likewise.
+       * m4/maintainer.m4 (AM_MAINTAINER_MODE): Likewise.
+       * m4/multi.m4 (AM_ENABLE_MULTILIB): Likewise.
+       Also, bumped all serial numbers of the modified m4 files.
+
 2010-12-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Improve tests on generated portions of configure help screen.
        * tests/help-init.test: Grepping of configure help screen
        tightened.
 
+2010-12-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Extended tests on AC_CONFIG_AUX_DIR.
+       * tests/auxdir.test: Enable `errexit' shell flag.  Prefer `$me'
+       over hard-coded test name.  Use proper m4 quoting.  Add trailing
+       `:' command.
+       * tests/auxdir2.test: Likewise.  Try to call automake also with
+       the `-a' option, so that it will not fail for spurious reasons.
+       * tests/auxdir3.test: Add an explanatory comment and a trailing
+       `:' command.
+       * tests/auxdir4.test: Prefer `$me' over hard-coded test name.
+       Make grepping of automake stderr slightly stricter.  Also, now
+       this test just checks about Automake's reaction to unportable
+       auxiliary directory names (and it has been extended in this
+       respect).  Moved the checks about non-existent auxiliary
+       directories to ...
+       * tests/auxdir5.test: ... this new test.
+       * tests/auxdir6.test: New test.
+       * tests/auxdir7.test: Likewise.
+       * tests/auxdir8.test: Likewise.
+       * tests/auxdir9.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
+2010-12-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests: extend checks on remake rules.
+       This adds proper semantical tests (i.e. run make to check the
+       rebuild rules are correctly triggered) in addition to tentative
+       grepping of the generated Makefile.in(s).
+       * tests/remake.test: Enable `errexit' shell flag, and related
+       changes.  Modernize `configure.in'.  Add trailing `:' command.
+       Improve heading comments, and add a reference to new sister test
+       remake1a.test.
+       * tests/remake3.test: Likewise (but with sister test being
+       remake3a.test).
+       * tests/remake2.test: Improve heading comments.  Enable `errexit'
+       shell flag, and related changes.  Modernize `configure.in'.  Make
+       grepping of `Makefile.in' slightly stricter.  Add trailing `:'
+       command.
+       * tests/remake5.test: Also run the `distcheck' target.  Add
+       trailing `:' command.  Use proper m4 quoting in configure.in.
+       * tests/remake4.test: Prefer `$me' over hard-coded test name.
+       * tests/remake7.test: Use the `configure.in' stub created by
+       ./defs, rather than writing it from scratch.
+       * tests/remake6.test: Likewise.  Also, add trailing `:' command,
+       and ensure verbose printing of captured make output.
+       * tests/remake1a.test: New test, sister of remake.test.
+       * tests/remake3a.test: New test, sister of remake3.test.
+       * tests/remake8a.test: New test.
+       * tests/remake8b.test: Likewise.
+       * tests/remake9a.test: Likewise.
+       * tests/remake9b.test: Likewise.
+       * tests/remake9c.test: Likewise.
+       * tests/remake9d.test: Likewise.
+       * tests/remake10a.test: Likewise.
+       * tests/remake10b.test: Likewise.
+       * tests/remake10c.test: Likewise.
+       * tests/remake11.test: Likewise.
+       * tests/remake12.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
+2010-12-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Improve and extend tests on canonicalization.
+       * tests/canon-name.test: Add trailing `:' command.  When writing
+       configure.in, prefer to use $me instead of hard-coding the test
+       name.
+       * tests/canon3.test: Prefer trailing `:' over trailing `Exit 0'.
+       * tests/canon4.test: Likewise.  Make grepping of Makefile.in
+       stricter.  Improve heading comment, and add reference to ...
+       * tests/canon6.test: ... this new test (sister test of the
+       previous one).
+       * tests/canon.test: Prefer cat + here-doc over echo to append
+       text to configure.in.  Extend grepping of Automake stderr.  Add
+       trailing `:' command.
+       * tests/canon5.test: Likewise.
+       * tests/canon7.test: New file, stress test on canonicalization.
+       * tests/canon8.test: New test, for better coverage (check that
+       the `@' character is not transliterated in canonicalizations).
+       * tests/Makefile.am: Updated.
+
+2010-12-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Libobj tests: refer to automake bug tracker for limitations.
+       * tests/libobj15b.test (configure.in): In the comment explaining
+       why an apparently redundant AC_OUTPUT is indeed needed, refer
+       to the relevant entry in the Automake bug tracker rather than
+       describing the bug in detail with a FIXME-style comment.
+       * tests/libobj15c.test: Likewise.
+       * tests/libobj20b.test: Likewise.
+
+       Libobj tests: do not use `##' automake comments in-line.
+       * tests/libobj19.test (Makefile.am): Do not use inline `##'
+       comments in the definition of AUTOMAKE_OPTIONS.
+       * tests/libobj20c.test: Likewise.
+       Report by Ralf Wildenhues.
+
+2010-12-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests defs: more uses of $top_testsrcdir.
+       * tests/compile6.test: Use `$top_testsrcdir' instead of
+       `$testsrcdir/..'.
+
+2010-11-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests required tools: also try `-v' option for GNU compilers.
+       * tests/defs.in: In the loop on "$required" tools, for gcc
+       and g++, also run "gcc -v" (resp. "g++ -v"), to get more
+       information, and for consistency with gcj.
+
+2010-11-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Tests defs: avoid some useless subshells.
+       * tests/defs: In the loop on "$required" tools: avoid subshells
+       where not needed.
+
+2010-12-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Extend tests on AC_LIBOBJ and friends.
+       * tests/aclibobj.test: Removed, superseded by ...
+       * tests/libobj-basic.test: ... this new test, which runs autoconf,
+       ./configure and make, to ensure everything really works.
+       * tests/libobj3.test: Add trailing `:' command.  Escape literal
+       dot in grep regexp.
+       * tests/libobj4.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Use proper m4 quoting.
+       * tests/ltlibobjs.test: Likewise.
+       * tests/libobj5.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Make more robust by using
+       longer filenames to be grepped.
+       * tests/libobj8.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Use the configure.in
+       stub provided by ./defs, rather than writing it from scratch.
+       * tests/libobj2.test: Likewise.  Also, add calls to autoconf,
+       ./configure and make, to ensure everything really works.
+       * tests/libobj7.test: Likewise, and ensure that at least one
+       function listed in AC_REPLACE_FUNCTIONS is truly replaced.
+       * tests/libobj13.test: Make grepping of Automake stderr slightly
+       stricter.  Add trailing `:' command.
+       * tests/libobj12.test: Likewise.  Also, prefer "cat + here-doc"
+       over "echo" to append to Makefile.am, and some cosmetic changes
+       in spacing.
+       * tests/libobj14.test: Call `Exit 1' if sourcing of ./defs fails.
+       Slighty improve m4 quoting.  Add trailing `:' command.
+       * tests/libobj10.test: Add calls to autoconf, ./configure and
+       make, to ensure everything really works.  Also, remove tests that
+       nonexistent source for AC_LIBOBJ cause an Automake failure: this
+       is already checked by ...
+       * tests/libobj15a.test: ... this new test.
+       * tests/libobj15b.test: New test, sister test of libobj15a.test,
+       checks AC_LIBSOURCE instead of AC_LIBOBJ.
+       * tests/libobj15c.test: New test, sister test of libobj15a.test,
+       checks AC_LIBSOURCES instead of AC_LIBOBJ.
+       * tests/libobj11.test: Removed, superseded by ...
+       * tests/libobj16a.test: ... this new test.
+       * tests/libobj16b.test: New test, sister test of libobj16a.test,
+       but using oldish/deprecated idioms.
+       * tests/libobj17.test: New test.
+       * tests/libobj18.test: Likewise.
+       * tests/libobj19.test: Likewise.
+       * tests/libobj20a.test: Likewise.
+       * tests/libobj20b.test: Likewise.
+       * tests/libobj20c.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
+2010-12-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Test `$(var:suf=rpl)' expansion in special automake variables.
+       * tests/posixsubst-data.test: New test.
+       * tests/posixsubst-extradist.test: Likewise.
+       * tests/posixsubst-ldadd.test: Likewise.
+       * tests/posixsubst-libraries.test: Likewise.
+       * tests/posixsubst-ltlibraries.test: Likewise.
+       * tests/posixsubst-programs.test: Likewise.
+       * tests/posixsubst-scripts.test: Likewise.
+       * tests/posixsubst-sources.test: Likewise.
+       * tests/posixsubst-tests.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2010-12-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Make tests `colon*.test' more "semantic".
+       Prefer running configure and make over grepping the generated
+       files; this is both more correct and less fragile.
+       * tests/colon.test: Made more "semantic", as described above.
+       * tests/colon5.test: Likewise.
+       * tests/colon6.test: Likewise.
+       * tests/colon7.test: Likewise.
+       * tests/colon2.test: Likewise, and improve syncing with sister
+       test `colon3.test'.
+       * tests/colon3.test: Likewise (but with the sister test being
+       `colon2.test' here).
+
 2010-12-10  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Avoid running installed automake from 'libtool --help'.
        Together with fixed Libtool, this fixes check-coverage to not
        invoke installed automake.
 
+2010-12-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Separate checks on target overriding into multiple test scripts.
+       * tests/overrid.test: Deleted, its contents separated into ...
+       * tests/override-suggest-local.test: ... this new test ...
+       * tests/override-html.test: ... and this new test ...
+       * tests/override-conditional-1.test: ... and this new test ...
+       * tests/override-conditional-2.test: ... and this new test (still
+       xfailing).
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Updated.
+
+       Enable `set -e' in more tests (plus some tweakings).
+       * tests/implicit.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.
+       * tests/insh2.test: Likewise.
+       * tests/instman2.test: Likewise.
+       * tests/interp.test: Likewise.
+       * tests/interp2.test: Likewise.
+       * tests/library.test: Likewise.
+       * tests/mclean.test: Likewise.
+       * tests/info.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Remove useless chaff from
+       generated Makefile.am.  Add a "FIXME" comment.
+       * tests/include.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Prefer cat + here-doc over
+       echo to append to configure.in.  Make tests more robust by using
+       longer and less common names to grep.  Remove an useless call to
+       echo.  Remove an useless subshell.
+       * tests/header.test: Enable `errexit' shell flag, and related
+       changes.  Use proper m4 quoting.  Add excerpts from the original
+       report of the bug tested for by this script.
+       * tests/gcj.test: Enable `errexit' shell flag, and related
+       changes.  Use proper m4 quoting.  Add trailing `:' command.
+       * tests/gcj3.test: Likewise.
+       * tests/ldflags.test: Likewise.
+       * tests/libtool.test: Likewise.
+       * tests/listval.test: Likewise.
+       * tests/javaprim.test: Likewise, and prefer cat + here-doc over
+       echo to append to configure.in.
+       * tests/javasubst.test: Likewise.
+       * tests/discorver.test: Enable `errexit' shell flag.  Prefer
+       trailing `:' over trailing `Exit 0'.
+       * tests/instdat.test: Enable `errexit' shell flag, and related
+       changes.  Use proper m4 quoting.  Avoid useless subshell.  Prefer
+       cat + here-doc over echo to append to configure.in.
+       * tests/libtool2.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Use the configure.in
+       stub provided by ./defs, rather than writing it from scratch.
+
+       Modernize, improve and/or tweak some test scripts.
+       * tests/maintclean.test: Use proper m4 quoting.  Add trailing `:'
+       command.
+       * tests/sinclude.test: Likewise, and add a couple of blank lines,
+       for clarity.
+       * tests/make.test: Move setting of `errexit' shell flag earlier in
+       the script (just after inclusion of ./defs).  Use the configure.in
+       stub created by ./defs, rather than writing it from scratch.  Some
+       cosmetic changes in spacing.  Ensure we wait enough time before
+       touching configure.in to trigger the rebuild rules.
+       * tests/makej.test: Use `$me' instead of hard-coding the test
+       name.  Add trailing `:' command.
+       * tests/version7.test: Likewise.
+       * tests/space.test: Enable `errexit' shell flag, and related
+       changes.
+       * tests/makevars.test: Likewise.  Also, prefer trailing `:' over
+       trailing `Exit 0', and be more tolerant of white spaces when
+       grepping Makefile.in.
+
+2010-12-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       * tests/silent8.test: Use "|| Exit 1" after ". ./defs".
+
+       Enable `set -e' in more tests (plus some tweakings).
+       * tests/mkinstall.test: Enable `errexit' shell flag, and related
+       changes.  Add a trailing `:' command, if needed.
+       * tests/mdate2.test: Likewise.
+       * tests/objc.test: Likewise.
+       * tests/noinst.test: Likewise.
+       * tests/outdir.test: Likewise.
+       * tests/number.test: Likewise.
+       * tests/pluseq.test: Likewise.
+       * tests/req.test: Likewise.
+       * tests/rulepat.test: Likewise.
+       * tests/specflg6.test: Likewise.
+       * tests/spell3.test: Likewise.
+       * tests/parse.test: Likewise, and ...
+       (configure.in): Use the stub created by ./defs, rather than
+       writing it from scratch.  Remove useless calls to AC_PROG_RANLIB
+       and AC_OUTPUT.
+       * tests/mdate4.test: Likewise.
+       * tests/mkinstall.test: Likewise, and ...
+       (configure.in): ... drop useless call to `AC_OUTPUT'.
+       * tests/output.test: Enable `errexit' shell flag, and related
+       changes.  Add a trailing `:' command.
+       (configure.in): Modernize.
+       * tests/output2.test: Likewise.
+       * tests/output3.test: Likewise.
+       * tests/output4.test: Likewise.
+       * tests/mdate3.test: Enable `errexit' shell flag, and related
+       changes.  Prefer `$me' over hard-coded test name.  Do not move
+       non-existent or useless files in the build auxiliary directory.
+       * tests/nodistdir.test: Enable `errexit' shell flag, and related
+       changes.  Prefer trailing `:' over trailing `Exit 0'.
+       * tests/nodist.test: Likewise.  Also, prefer cat + here-doc over
+       echo to create input test files, and do not create useless dummy
+       C source files.
+       * tests/nodist2.test: Likewise.
+       * tests/ppf77.test: Enable `errexit' shell flag, with related
+       changes.  Add a trailing `:' command.  Do not create useless
+       dummy source files.
+       * tests/spelling.test: Enable `errexit' shell flag, with related
+       changes.  Add a trailing `:' command.  Also, grep Automake error
+       message.
+       * tests/specflg3.test: Enable `errexit' shell flag, with related
+       changes.  Avoid unportable use of `-e' option of fgrep.  Prefer
+       trailing `:' over trailing `Exit 0'.  Remove extra empty lines,
+       and cosmetic changes to whitespaces.
+       * tests/obsolete.test: Enable `errexit' shell flag, with related
+       changes.  Improve verbosity.  Other miscellaneous changes.
+
+2010-11-30  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Improve and extend tests on `:=' variable assignments.
+       * tests/colneq.test: Avoid redundant use of variable assignments
+       in Makefile.am.  Use command-line automake options instead of
+       editing AUTOMAKE_OPTIONS in Makefile.am.  Make grepping of the
+       generated Makefile.in slightly stricter.  Add a trailing `:'
+       command.
+       * tests/colneq2.test: Do not create unneeded dummy files.  Run
+       also autoconf, ./configure and make.  Add trailing `:' command.
+       * tests/colneq3.test: New test, similar to colneq.test, but
+       running also autoconf, ./configure and make.
+       * tests/Makefile.am (TESTS): Update.
+
+2010-11-26  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Remove long-deprecated options --Werror and --Wno-error.
+       These options has been deprecated at least since commit
+       "Release-1-6-1b-35-gc037f20", dated 2002-07-06.
+       * automake.in (parse_arguments): Do not recognize anymore options
+       `--Werror' and `--Wno-error' as synonyms of respectively `-Werror'
+       and `-Wno-error'.
+       * tests/werror.test: Update: use `-Werror' instead of `--Werror'.
+       * NEWS: Update.
+
 2010-11-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Fix spurious failures in `silent*.test' for $CC != gcc
        * config-ml.in: Add Go support: treat GOC and GOCFLAGS like other
        compiler/flag environment variables.
 
+2010-11-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       release-stats: account for more generated tests.
+       * Makefile.am (release-stats): Be sure to take into account all
+       the generated tests, by grepping the test scripts to decide which
+       ones of them are automatically generated.
+
+2010-11-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Code cleanup after removal of option `--output-directory'.
+       * automake.in ($output_directory): Remove, it's unconditionally
+       defined to `.' and used only ...
+       (generate_makefile): ... in this subroutine, which now has been
+       edited and simplified accordingly.
+
+       Remove obsolete automake option `--output-directory'.
+       This option has been deprecated since version 1.7 (2002/2003).
+       * automake.in ($output_directory): Define to `.' unconditionally.
+       (parse_arguments): Remove handling of equivalent options `-o' and
+       `--output-directory'.
+       * tests/outdir.test: Removed.
+       * tests/no-outdir-option.test: New test.
+       * tests/Makefile.am (TESTS): Updated.
+       * NEWS: Updated.
+
 2010-11-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Automake::Config: remove extra trailing semicolon.
        `aclocal --help' work with configure.in and acinclude.m4 both
        broken.
 
+2010-11-19  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       New test on repeated automake options.
+       * tests/repeated-options.test: New test, check that automake
+       does not complain on repeated options, nor generate broken or
+       incorrect makefiles.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-11-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Fix spurious failures of silent-rules tests with Sun Fortran.
 
 2010-11-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       backcompat5.test: avoid '##'-style comments inside recipe commands.
+       * tests/backcompat5.test: Remove double-hash comments
+       from makefile rule commands, they are not part of the
+       Automake API.  Fixes testsuite failure with Tru64 make.
+
        tests: avoid '##'-style comments inside recipe commands.
        * tests/confh.test, tests/confh8.test: Remove
        double-hash comments from makefile rule commands, they
        * tests/color.test, tests/color2.test: Quote variable in case
        pattern, to avoid skipping tests with dash 0.5.5.1.
 
+2010-11-16  Peter Rosin  <peda@lysator.liu.se>
+
+       Skip MSVC oriented tests if the shell is not capable.
+       * tests/defs: New required entry 'xsi-shell'.
+       * tests/ar-lib.test, tests/compile3.test, tests/compile6.test:
+       Require a XSI capable shell.
+       Reported by Ralf Wildenhues.
+
+2010-11-15  Peter Rosin  <peda@lysator.liu.se>
+
+       compile: clear the `eat' variable earlier.
+       * lib/compile: Clear the `eat' variable earlier.
+       ($scriptversion): Update.
+       * tests/compile3.test: Prevent regressions.
+
+2010-11-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       More stable configure output from sanity check.
+       * m4/sanity.m4 (AM_SANITY_CHECK): Always print check line
+       about ensuring newer files, even if we don't actually need
+       to wait any more.
+
 2010-11-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Rebuild menus in the manual.
        * tests/yaccdry.test: Require bison.
        Found by NixOS Hydra.
 
+2010-11-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Fix bug in test `backcompat6.test' (MSYS portability).
+       * tests/backcompat6.test (Makefile.am): Grep the output from the
+       test program, rather than diffing it, to avoid spurious failures
+       on MinGW/MSYS due to LF vs. CRLF line endings.
+       Reported by Ralf Wildenhues.
+
+2010-11-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Deprecate obsolete macro AM_WITH_REGEX.
+       * m4/regex.m4: Document the `AM_WITH_REGEX' macro as obsolete,
+       and state that it should be removed two years from now.
+       (AM_WITH_REGEX): Raise an m4-time warning of the "obsolete"
+       category when this macro is used.
+       * doc/automake.texi (Public Macros): Move description of
+       `AM_WITH_REGEX' from here ...
+       (Obsolete Macros): ... to here, and declare it as obsolete
+       and "to be removed in a future version".
+       * tests/regex-obsolete.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2010-11-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Improve and extend tests on man pages support.
+       * tests/man.test: Enable `errexit' shell flag, and related changes.
+       Make grepping of generated Makefile.in slightly stricter.
+       * tests/man3.test:  Add trailing `:' command.
+       * tests/man5.test: Prefer cat + here-doc over echo to append to
+       configure.in.
+       * tests/man2.test: Likewise, and add trailing `:' command.
+       * tests/man4.test: More thorough and consistent checking of make
+       error messages.  Place fake `help2man' program in a new `bin'
+       directory rather than in `.'.  Move the checks using the real
+       `help2man' program to ...
+       * tests/man6.test: ... this new test, and extend them.  This test
+       passes with GNU make and Solaris make, still fails with BSD make.
+       * tests/man7.test: New test, extracted from old man4.test, which
+       checks for a bug in maintainer-clean w.r.t. generated manpages.
+       * tests/man8.test: New test, extracted from old man4.test, which
+       checks for a bug in distcheck w.r.t. generated manpages.  Passes
+       with GNU make and Solaris make, still fails with BSD make.
+
+2010-11-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Minor improvements and extensions to various tests.
+       * tests/defun.test: Also run autoconf and grep the generated
+       configure to make sure that aclocal truly picks up all the
+       required macros.
+       * tests/compile_f_c_cxx.test: Prefer trailing `:' over trailing
+       `Exit 0'.  Do not create useless dummy source files.  Do not set
+       useless `$(foo_LDADD)' variable in `Makefile.am'.  Do not call
+       useless macro `AC_F77_LIBRARY_LDFLAGS' in `configure.in'.
+       * tests/compile_f90_c_cxx.test: Likewise.
+       * tests/suffix10.test: Slightly stricter grepping of make output.
+       * tests/compile.test: Add trailing `:' command.
+       * tests/defun2.test: Likewise.
+       * tests/vars3.test: Likewise.
+       * tests/vartar.test: Likewise.
+       * tests/vars.test: Likewise.  Also, extend test by checking
+       that the definition of `MY_FLAGS*' variables is preserved in
+       the generated `Makefile.in'.
+       * tests/stamph2.test: Prefer trailing `:' over trailing `Exit 0'.
+       Use proper m4 quoting in `configure.in'.
+
+2010-11-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests defs: improve messages for skipped tests.
+       * tests/defs: Give meaningful messages about the reasons of a
+       test skip; this is especially useful as this file is run without
+       verbose xtraces on.  Related reorderings in the code and new
+       comments.
+
+2010-11-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests defs: move static definitions in a new file `defs-static'.
+       The new file is meant to be idempotent w.r.t. multiple inclusions.
+       * tests/defs.in: Removed, its contents split among ...
+       * tests/defs-static.in: ... this new file ...
+       * tests/defs: ... and this new file, including the former.
+       * configure.ac (AC_CONFIG_FILES): Remove `tests/defs', add
+       `tests/defs-static'.
+       (AC_CONFIG_LINKS): Add `tests/defs'.
+       * tests/Makefile.am ($(parallel_tests)): Update.
+       ($(instspc_tests)): Likewise.
+       * tests/.gitignore: Update.
+
+       Tests defs: $testsbuilddir is now AC_SUBST'ed.
+       * tests/defs.in ($testsbuilddir): Substitute from @abs_builddir@.
+       Add sanity check on $testsbuilddir, similar to those on
+       $testsrcdir and $top_testsrcdir.
+
+       Tests defs: do not print message "Running test $0" anymore.
+       * tests/defs.in: Printing the message "=== Running test $0" at
+       the beginning of each tests made sense when Automake used the old
+       test-driver, which sent all the output directly to stdout/stderr.
+       Now that the parallel test-driver is used, which saves output of
+       each test in its corresponding log file, that old message is just
+       useless noise.
+
+       Tests defs: rename $curdir -> $testbuilddir
+       * tests/defs.in: Rename $curdir to $testbuildir, for clarity and
+       consistency with $testsrcdir and $top_testsrcdir.
+
+       Tests defs: prefer "$curdir" over "`pwd`".
+       * tests/defs.in: We already save the value of `pwd` in $curdir
+       early in the file, so there no need to recalculate it later, when
+       the current working directory is not changed.
+
+       Tests defs: use `$me' in more error messages.
+       * tests/defs.in: Also use `$me' in error messages referring to
+       missing `defs' or `defs.in', since that variable is now defined
+       before those checks.
+
+       Tests defs: do not use `Exit' where plain `exit' suffices.
+       * tests/defs.in: Use "exit 77" rather than "Exit 77" to skip the
+       test when required libtool/gettext macros are not found, since
+       such skips would take place before the exit trap is installed.
+
+       Tests defs: improve and extends comments.
+       * tests/defs.in: Improve and extends some comments, especially in
+       relation with the changes introduced by the previous reordering.
+
+       Tests defs: various reorderings.
+       * tests/defs.in: Reordered various snippets of code in a
+       clearer way.
+
+2010-11-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Fix bug in test `backcompat4.test' (stale autom4te cache).
+       * tests/backcompat4.test: Remove stale autom4te cache directory
+       before re-running aclocal and automake.  Also, since we are at
+       it, be more verbose in displaying contents of generated files,
+       to ease debuggability.
+       Reported by Ralf Wildenhues.
+
 2010-11-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Fix a bug in variable concatenation with `+='.
        * tests/Makefile.am (TESTS): Update.
        Reported by Andy Wingo.
 
+2010-11-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Modernize, improve and/or tweak various test scripts.
+       * tests/stamph2.test: Improve m4 quoting in `configure.in', and
+       prefer trailing `:' over trailing `Exit 0'.
+       * tests/syntax.test: Escape literal dots in grep regexps.
+       * tests/copy.test: Enable `errexit' shell flag.  Extend test by
+       checking with `test' utility that the script `install-sh' is
+       copied, but not symlinked.
+       * tests/depdist.test: Move setting of `errexit' shell flag earlier
+       in the script (just after inclusion of ./defs).  Avoid obsoleted
+       constructs in generated `configure.in'.  Prefer to do our checks
+       by running configure and make over grepping Makefile.in.
+       * tests/target-cflags: Move setting of `errexit' shell flag
+       earlier in the script (just after inclusion of ./defs). Use the
+       `configure.in' stub created by `./defs', rather than writing it
+       from scratch.
+       * tests/target-clash: Do not uselessly run autoconf.
+       * tests/ctarget1.test: Renamed ...
+       * tests/cond-basic.test: ... to this.  Use the `configure.in' stub
+       created by `./defs', rather than writing it from scratch.
+       Move setting of `errexit' shell flag earlier in the script (just
+       after inclusion of ./defs).  Other minor cosmetic changes.
+       * tests/Makefile.am (TESTS): Updated.
+
+2010-11-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       New tests on obsoleted usages of automake/autoconf macros (such
+       as AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT).
+       * tests/backcompat.test: New test script.
+       * tests/backcompat2.test: Likewise.
+       * tests/backcompat3.test: Likewise.
+       * tests/backcompat4.test: Likewise.
+       * tests/backcompat5.test: Likewise.
+       * tests/backcompat6.test: Likewise.
+       * tests/init.test: Extended and improved, esp. by trying more
+       combinations of calls to AC_INIT and AM_INIT_AUTOMAKE with few
+       arguments.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-11-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Fix bug in rules for creating vala vapi/header files.
        New tests.
        * tests/Makefile.am (TESTS): Update.
 
+2010-11-05  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Fix potential bug in generated tests `instpc-*.test'.
+       This bug is due to the changes introduced by the recently-merged
+       "tests-init" branch.  In that branch, `tests/defs' didn't define
+       anymore `$srcdir', instead defining directly `$testsrcdir'; but
+       the generated tests were using `$srcdir', hence the bug.
+       Luckily, since the Automake parallel test driver automatically
+       exports `srcdir' to a proper value, that prevented the bug from
+       manifesting itself.
+       * tests/Makefile.am ($(instspc_tests)): In the generated test
+       scripts, use `$testsrcdir', not `$srcdir'.
+
+2010-11-03  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Overhauled and modularized tests in `instspc.test'.
+       The test `instspc.test' was way too big and fragile.  Its running
+       time was very long.  It also produced a log that was nearly
+       unreadable due to its length, making it very difficult to find
+       out the reason for failures.
+       Also, it was too much monolithic, with a single (maybe spurious)
+       failure in a corner case causing the whole test to fail (even if
+       everything worked as expected in the other 99% of cases).
+       The present change should solve these problems, by separating
+       `instspc.test' into many smaller, self-contained, auto-generated
+       tests.
+       * tests/instspc.test: Removed.
+       * tests/instspc-tests.sh: New script, fulfilling a double role:
+       1. it generates a Makefile.am snippet `tests/instspc-tests.am',
+       containing the definition of a list of new tests which will take
+       over the older `instspc.test', and
+       2. it is sourced by said generated tests with proper parameters
+       pre-set, to run the "meat" of the checks.
+       This apparent abuse is indeed required because the test generation
+       code and test execution code are inevitably intertwined.
+       * tests/Makefile.am ($(srcdir)/instspc-tests.am): Include this
+       snippet, which (among the other things) defines ...
+       (instspc_tests): ... this new macro, containing the list of the
+       newly generated `instspc*.test' tests, and ...
+       (instspc_xfail_tests): ... this new macro, containing the list
+       of the `instspc*.test' tests expected to fail.
+       ($(instspc_tests)): New rule, generates the `instspc*.test' tests.
+       ($(instspc_tests:.test=.log)): New rule, registers the dependency
+       of all `instspc*.test' tests on the `instspc-tests.sh' script.
+       (TESTS): Add `$(instspc_tests)', remove `instspc.test'.
+       (XFAIL_TESTS): Add `$(xfail_instspc_tests)'.
+       (EXTRA_DIST): Distribute instspc-tests.sh.
+       (MAINTAINERCLEANFILES): Added $(instspc_tests).
+       Other minor cosmetic changes.
+       * bootstrap: Generate instspc-tests.am.
+       * tests/.gitignore: Updated.
+
 2010-11-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Add FAQ entry for bug reporting instructions.
        * doc/automake.texi (Reporting Bugs): New section.
        (Introduction): Refer to it.
 
+2010-10-07  Peter Rosin  <peda@lysator.liu.se>
+
+       depcomp: add new one-pass depmode for MSVC 7 and later.
+       * lib/depcomp: Add new depmodes 'msvc7' and 'msvc7msys' which
+       make use of the -showIncludes option added in MSVC 7.
+       * m4/depend.m4 (_AM_DEPENDENCIES): Handle the new depmodes
+       similarly to 'msvisualcpp' and 'msvcmsys' as MSVC does not
+       support the -o option.
+
 2010-10-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Add support for newer python versions.
 
 2010-10-03  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       tests: fix ar-lib.test for echo that interprets backslashes.
+       * tests/ar-lib.test: Use printf instead of echo.  Avoid test -a.
+       More robust quoting.
+
+2010-10-03  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       maintainer-check coverage for variables before rules.
+       * Makefile.am (sc_ensure_testsuite_has_run): Suggest keeping
+       around the test directories.
+       (sc_tests_makefile_variable_order): New rule with a heuristic to
+       catch ordering violations.
+
        Document and fix expansion of variables before rules.
        * doc/automake.texi (General Operation): Document that variables
        are expanded before rules.
 
 2010-10-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Coverage and minor fixes for variable typo detection.
+       * automake.in (check_typos): Remove `EXTRA_' prefix when
+       computing canonical name.
+       * tests/vartypo2.test, tests/vartypos.test: New tests.
+       * tests/Makefile.am (TESTS): Update.
+
+       Implement EXTRA_maude_DEPENDENCIES for programs and libraries.
+       * automake.in (handle_programs, handle_libraries)
+       (handle_ltlibraries): Mark EXTRA_*_DEPENDENCIES as recognized.
+       * doc/automake.texi (Linking, Program and Library Variables)
+       (LIBOBJS): Document EXTRA_*_DEPENDENCIES.
+       * lib/am/library.am (%LIBRARY%): Also depend on
+       $(EXTRA_%XLIBRARY%_DEPENDENCIES).
+       * lib/am/ltlibrary.am (%LTLIBRARY%): Also depend on
+       (%XLTLIBRARY%_DEPENDENCIES).
+       * lib/am/program.am (%PROGRAM%%EXEEXT%): Also depend on
+       $(EXTRA_%XPROGRAM%_DEPENDENCIES).
+       * tests/extradep.test, tests/extradep2.test: New tests.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+       Suggested by Eric Blake.
+
+       tests: avoid running into timing issues due to sanity change.
+       * tests/acloca10.test, tests/acloca18.test, tests/aclocal9.test:
+       Insert strategic sleep before aclocal reruns, to ensure files
+       are newer.
+       * tests/python11.test: Use --force for repeated autotools runs.
+       Reports from the NixOS Hydra build daemon via Ludovic Courtès.
+
+       Fix timestamp issues by ensuring configure takes at least a second.
+       * m4/sanity.m4 (AM_SANITY_CHECK): If we didn't sleep here,
+       start a sleep in the background and wait for it to finish
+       before creating config.status, hopefully fixing all spurious
+       testsuite failures involving botched time stamps.
+       * NEWS: Update.
+       Reports by Ludovic Courtès, Peter Breitenlohner, and others.
+
+2010-10-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
        Revert "parallel-tests: avoid command-line length limit issue."
        This reverts commit 24e3b4ee2f8cb9f72dd94a05a893f3d4e88b7835,
        because it re-opened the bug fixed by v1.11-10-g218e678.
        seems to have been removed, substituted by multiple release
        tarballs now).
 
+2010-09-21  Peter Rosin  <peda@lysator.liu.se>
+
+       compile: implement library search to support MSVC static linking
+       * lib/compile (func_cl_wrapper): Implement library search and
+       -static option so that the user can select whether to prefer
+       dll import libraries or static libraries.  This enables MSVC to
+       link against dlls generated by libtool without requiring libtool
+       or workarounds such as -lfoo.dll etc.  Makes the tests/static.at
+       test case in libtool pass.
+       * tests/compile3.test: Don't trip up if there happens to exist
+       a "foo" library in the library search path.
+       * tests/compile6.test: New test, verifying the library search.
+       * tests/Makefile.am (TESTS): Update.
+
 2010-09-17  Eric Blake  <eblake@redhat.com>
 
        Avoid triple-space after period.
 
        * HACKING: Hint at old commits with `git describe' output.
 
+2010-09-14  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Prefer `$(am__cd)' to plain `cd' in our Makefiles.
+       * Makefile.am (recheck, dist-hook, git-dist, path-check, fetch)
+       (release-stats): Use `$(am__cd)' rather than plain `cd'.
+       * tests/Makefile.am ($(srcdir)/parallel-tests.am): Likewise.
+
 2010-09-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Fix regression in test `colon4.test'.
        * tests/pr9.test: Likewise.
        From a suggestion by Ralf Wildenhues.
 
+2010-09-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Use AS_HELP_STRING in AM_SILENT_RULES.
+       * m4/silent.m4 (AM_SILENT_RULES): Use `AS_HELP_STRING' to format
+       help message regarding configure options `--enable-silent-rules'
+       and `--disable-silent-rules'.  Also throw in a couple of cosmetic
+       changes in the related `case' statement (indentation, balancing
+       of parentheses).
+       * THANKS: Update.
+       From a report by Jeff A. Daily.
+
+2010-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        Make some `confh*.test' tests more "semantic" (plus tweakings).
        * tests/confh.test: Run "autoconf", "configure" and "make check",
        instead of munging/grepping the generated `Makefile.in'.
        * tests/Makefile.am (TESTS): Updated.
        Prompted by a report from Ralf Wildenhues.
 
+2010-09-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        Remove useless whitespace padding in XFAIL_TESTS definition.
        * tests/Makefile.am (XFAIL_TESTS): Remove whitespace padding.
 
        Posix 2008 requires make to set errexit.
        * lib/am/check.am: Update comment.
 
+2010-09-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests defs: remove variable $testaclocaldir.
+       * tests/defs.in ($testaclocaldir): Removed.
+       * tests/aclocal.test: Use `$top_testsrcdir/m4' directly, not
+       `$testaclocaldir'.
+
+       Tests defs: $srcdir and $top_srcdir renaming.
+       * tests/defs.in ($srcdir): Remove, define $testsrcdir directly.
+       * tests/Makefile.am ($(parallel_tests)): Generation of derived
+       tests updated.
+
+       Tests defs: new variable $top_testsrcdir.
+       * tests/defs.in ($top_testsrcdir): Define unconditionally
+       to @abs_top_srcdir@.  Use it throughout.
+       * tests/ar-lib.test: Use `$top_testsrcdir' instead of
+       `$testsrcdir/..'.
+       * tests/auxdir.test: Likewise.
+       * tests/compile.test: Likewise.
+       * tests/compile2.test: Likewise.
+       * tests/compile3.test: Likewise.
+       * tests/compile5.test: Likewise.
+       * tests/mdate6.test: Likewise.
+       * tests/mkinst3.test: Likewise.
+       * tests/multlib.test: Likewise.
+       * tests/txinfo22.test: Likewise.
+
+       Tests defs: $srcdir is unconditionally substituted.
+       * tests/defs.in ($srcdir): Define unconditionally to @abs_srcdir@.
+       Remove code for $srcdir normalization, which is now useless.
+
+2010-09-02  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Tests defs: make spacing more consistent.
+       * tests/defs.in: Make spacing more consistent in indentation.
+       Especially, indent using only spaces, not tabs.  Also, move
+       a comment to a better position.
+
+       Improve code for requiring libtool and gettext in tests.
+       * tests/defs.in: Stricter (and more correct) detection of wheter
+       libtool, libtoolize and/or gettext are in $required.
+
+
 2010-08-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Fix bug in test missing6.test.
        that do not support $LINENO.  Also throw in a couple of cosmetic
        changes.
 
+2010-09-02  Peter Rosin  <peda@lysator.liu.se>
+
+       Make ar-lib support backslashed files in archives.
+       * lib/ar-lib: If an archive member contains a backslash, make sure
+       it is escaped when the archive member is extracted.
+       * tests/ar-lib.test: Test the above.
+
+2010-08-31  Peter Rosin  <peda@lysator.liu.se>
+
+       Do file name conversion for object files in the compile wrapper.
+       * lib/compile (func_cl_wrapper): Do file name conversion for object
+       files (i.e. extensions .obj, .OBJ, .o and .O) if needed.
+       * tests/compile4.test: Test the above.
+
 2010-08-21  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Speed up removal of auxiliary linker output files for ltlibraries.
+       * lib/am/ltlib.am (clean-%DIR%LTLIBRARIES): Rewrite using just
+       one `rm' invocation.
+       Report by Bob Friesenhahn.
+
        Improve robustness of mdate-sh script.
        * lib/mdate-sh: Sanitize zsh behavior on startup, to ensure
        $ls_command is word-split properly upon invocation.
        Don't hide the table of contents.
        * doc/automake.texi: Move the table of contents to the beginning.
 
+2010-08-16  Peter Rosin  <peda@lysator.liu.se>
+
+       Optimize compile script on MSYS.
+       * lib/compile (func_file_conv): Add new argument 'lazy' which
+       takes an optional list of conversion types where the requested
+       conversion isn't needed.
+       (func_cl_wrapper): Take advantage of the above for cases where
+       MSYS is doing the conversion for us.
+       Suggested by Ralf Wildenhues.
+
+2010-08-16  Peter Rosin  <peda@lysator.liu.se>
+
+       Support more C++ file extensions for MSVC in the compile script.
+       * lib/compile (func_cl_wrapper): MSVC only recognizes the .cpp
+       file extension as C++, unless it's given a hint. So hint about
+       .cc, .CC, .cxx, .CXX, c++ and C++. Also do path conversion on
+       .c, .cpp, .CPP, .lib, .LIB and .Lib files.
+       * tests/compile3.test: Test the C++ hinting.
+
+2010-08-12  Peter Rosin  <peda@lysator.liu.se>
+
+       Enable the use of "link -lib" as the wrapped archiver.
+       * lib/ar-lib: Enable the use of "link -lib" as the wrapped
+       archiver, as well as allowing some other options to be passed
+       through to the wrapped archiver.
+       * tests/ar-lib.test: Test the above.
+
 2010-08-10  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Tweak and/or extend some `acloca*.test' tests.
        changes.  Cosmetic changes to spacing, add trailing `:' command,
        and add a "FIXME" comment.
        * tests/pr266.test: Likewise, and add explicit command line switch
-       `--enable-dependecy-tracking' to the ./configure call.
+       `--enable-dependency-tracking' to the ./configure call.
        * tests/pr279.test: Avoid obsolescent constructs in the generated
        `configure.in'; also, use the `configure.in' stub created by
        ./defs, rather than writing it from scratch.  Enable `errexit'
        Minor improvements and fixes in tests `depcomp*.test'.
        * tests/depcomp.test: Do not create useless dummy source files.
        Add a trailing `:' command.
-       * tests/depcomp2.test: Use `unset' on the CFLAG variable to ensure
+       * tests/depcomp2.test: Use `unset' on the CFLAGS variable to ensure
        it's not in in the environment, rather than exporting it with an
        empty value.  Do not pass CC=gcc to configure, as that's already
        done in ./defs since we have gcc in $required.  Ensure verbose
        * tests/ar2.test: Likewise, and make grepping of generated
        Makefile.in stricter.
 
+2010-08-06  Peter Rosin  <peda@lysator.liu.se>
+
+       Add new auxiliary 'ar-lib' script, wrapping Microsoft lib.
+       * lib/ar-lib: New auxiliary script.
+       * lib/Makefile.am: Add above.
+       * tests/ar-lib.test: New test.
+       * tests/Makefile.am: Add above.
+       * automake.in (@common_files): Distribute the 'ar-lib' script.
+       * doc/automake.texi (Auxiliary Programs): Mention the new
+       'ar-lib' script.
+       (Optional): Mention 'ar-lib' in AC_CONFIG_AUX_DIR.
+       * NEWS: Update.
+
+2010-08-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix shell pattern negation in compile script.
+       * lib/compile (func_file_conv): Use `!' not `^' for pattern
+       negation.
+
 2010-08-08  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Fix maintainer-check failure.
        * tests/cond5.test: Add delay before the first kill attempt to
        cater for problems with MSYS bash.
 
+2010-08-01  Peter Rosin  <peda@lysator.liu.se>
+
+       Wrap some MSVC options in the compile script.
+       * lib/compile: MSVC supports naming the output file, the option
+       is just not called -o, so transform -o into the appropriate form
+       for MSVC. Also wrap some other options while at it (-L, -l, -Wl,
+       -Xlinker and -I) and convert file names to windows form where
+       needed for those options to make MSVC more usable in an
+       autotooled environment.
+       * doc/automake.texi (Auxiliary Programs): Document the above
+       extension of the compile script.
+       * NEWS: Updated.
+       * tests/defs.in: New required entry 'cl'.
+       * tests/compile3.test: New test.
+       * tests/compile4.test: New test.
+       * tests/compile5.test: New test.
+       * tests/Makefile.am: Update.
+
 2010-07-31  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Add example git work flow; discuss merge --log in HACKING.
        * tests/ext.test: Add a comment explaining why an apparently
        useless `if' statement is indeed required.
 
+2010-06-13  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        Add useful comment in test script obsolete.test.
        * tests/obsolete.test: Add a comment explaining why we need
        an indirection in adding $AUTOUPDATE to $required.
        * tests/Makefile.am (TESTS): Use only spaces, not tabs, in the
        definition of this variable.
 
+       Parallel tests generation: improve comments (tiny change).
+       * tests/Makefile.am ($(parallel_tests)): Added useful comment to
+       generated tests.
+
+       Tests defs: truly get rid of `$am_defs_included' (unused variable)
+        * tests/defs.in ($am_defs_included): Remove, its now unused.  It
+       should have been removed in a previous changeset, but the removal
+       was done only partially (oversight).
+
 2010-06-12  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Remove a couple of unneeded conditionals from tests.
        * tests/pluseq9.test: Slightly extended w.r.t. the grepping of
        Automake stderr.  Some unrelated cosmetic changes.
 
+2010-06-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       cscope.test: ensure verbose printing of captured stderr.
+       * tests/cscope.test: Print captured stderr before failing.
+
+2010-06-12  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        Testsuite: ensure verbose printing of captured stderr.
        * tests/acloca18.test: Print captured stderr before either failing
        or grepping it.  Be sure to send captured stderr to stderr, not to
        Enable `errexit' shell flag.
 
 2010-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix error in generation of parallel tests.
+       * tests/defs.in ($am_skip_defs): New variable, to be used when
+       ./defs must be sourced multiple times.  If set, unset it and
+       only define $srcdir; otherwise, also go through the rest of
+       the script.
+       ($am_defs_included): Remove, no more needed.
+       * tests/Makefile.am ($(parallel_tests)): Update accordingly,
+       using only $srcdir from defs.
+       Fixes potential test failures of tests that use $required.
+
+2010-06-08  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Enable `errexit' shell flag in some test scripts.
        * tests/subcond.test: Enabled `errexit' shell flag, and related
        * tests/version2.test: Likewise, and avoid deprecated constructs
        in the generated `configure.in'.
 
+2010-06-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Improve declaration of dependencies in the testsuite.
+       * tests/Makefile.am (check_SCRIPTS): Remove.  Instead, let ...
+       ($(TEST_LOGS)): ... all test logs depend on the scripts.
+       * test/gen-parallel-tests: For each parallel test foo-p.test,
+       let `foo-p.log' also depend on `foo.test', since it is sourced.
+
+2010-06-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Coverage for TAGS_DEPENDENCIES warning.
+       * tests/tags2.test: New test.
+       * tests/Makefile.am: Update.
+
+       Coverage for use of anachronistic variables.
+       * tests/oldvars.test: New test.
+       * tests/Makefile.am: Update.
+
+       Testsuite coverage for bogus macro file serial numbers.
+       * tests/acloca18.test: Also test ill-formed serial numbers
+       and serial numbers after macro definitions.
+
+       Coverage for aclocal diagnosing underquoted macros.
+       * tests/acloca23.test: New test.
+       * tests/Makefile.am: Update.
+
 2010-06-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Prefer AUTOMAKE_fails over `$AUTOMAKE | grep' in tests.
        * tests/mdate.test: Likewise.
        Prompted by Stefano Lattarini's change to discover.test.
 
+2010-06-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       More minor message fixes.
+       * aclocal.in (scan_file): Fix recommended info command line.
+       * automake.in (handle_lib_objects): No need to prepend function
+       name to prog_error message.
+       (handle_tags): Add missing word and missing space in error
+       message.
+       (handle_dist): Add missing closing single quote in message.
+       Line-wrap one long message for readability.
+
+2010-06-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix distcheck failure with distributed generated parallel tests.
+       * tests/Makefile.am ($(parallel_tests)): Cope with $(srcdir)
+       being different from the value at developer `make dist' time.
+       * tests/defs.in: Protect against multiple inclusion, by using ...
+       ($am_defs_included): ... this new variable.
+       ($srcdir): Do not compute, but simply define to `@abs_srcdir@'
+       as substituted by configure.
+       Report, suggestions and first fix by Ralf Wildenhues, final
+       patch by Stefano Lattarini.
+
 2010-06-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Improve tests link*.test (enable `errexit' shell flag).
 
 2010-06-06  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       Tiny fix in silent8.test (display output of `make' command).
+       * tests/silent8.test: Make sure that the captured output of `make'
+       command is always displayed.
+
        Make tests on user extensibility of silent-rules mode stricter.
        * tests/silent6.test: Made stricter w.r.t. the grepping of the
        output produced by `make'.
        * tests/silent5.test: Likewise.
        * tests/silent9.test: Likewise.
 
-2010-01-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
-
-       Fix silent-rules output for disabled dependency tracking.
-       * lib/am/depend2.am [!%FASTDEP%]: Rework silent-rules variable
-       expansion code to also work in the case where %AMDEP% expands
-       to FALSE at config.status time, using new substitution string
-       %VERBOSE-NODEP%.
-       * automake.in (verbose_nodep_flag): New function, appending
-       `@am__nodep@' to the verbose-variable name.
-       (handle_languages): If dependencies are not disabled, use it to
-       set %VERBOSE-NODEP%.
-       * m4/depend.m4: Substitute am__nodep as '_no', so the second
-       verbose-variable will always expand to an empty string, if
-       dependencies are enabled.
-       * tests/silent5.test: Also test --disable-dependency-tracking;
-       also test per-target flags for non-C language files.
-       * tests/silent9.test: New test, like silent4.test but disable
-       dependency tracking.
-       * tests/Makefile.am: Adjust.
-       * NEWS, THANKS: Update.
-       Report by Dmitry V. Levin <ldv@altlinux.org>.
-
 2010-05-23  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Extend test on `nostdinc' automake option.
 
 2010-05-23  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Fix truncated comment in Makefile.am.
+       * Makefile.am (sc_tests_logs_duplicate_prefixes): Fix unfinished
+       sentence in comment.
+       Report by Stefano Lattarini.
+
+       Relax silent8.test for NetBSD make.
+       * tests/silent8.test: Accept ./foo.info in output as well.
+
        Fix unportable sed script in maintainer-check test.
        * Makefile.am (sc_tests_Exit_not_exit): Rewrite sed script to
        not contain semicolon after 'b' or brace commands, for NetBSD.
 
 2010-04-25  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Warning and error message formatting cleanups.
+       * aclocal.in (parse_arguments, main): Remove trailing period or
+       newline in error or warning messages, avoid capitalization of
+       the first word of a message.
+       * automake.in (check_user_variables, handle_languages)
+       (handle_ltlibraries, scan_aclocal_m4, scan_autoconf_config_files)
+       (scan_autoconf_files, cond_stack_if, require_file_internal)
+       (usage, generate_makefile, parse_arguments): Likewise.
+       * lib/Automake/ChannelDefs.pm (set_strictness): Likewise.
+       * lib/Automake/Configure_ac.pm (find_configure_ac): Likewise.
+       * lib/Automake/Options.pm (set_strictness): Likewise.
+       * lib/Automake/Rule.pm (define): Likewise.
+       * lib/Automake/Variable.pm (define, variables_dump): Likewise.
+       * tests/ltinstloc.test, tests/suffix11.test: Adjust expected
+       error message.
+       * lib/Automake/Channels.pm (setup_channel): Reword error message
+       to be the same as in msg.
+
+       Fix placing of ellipses in English text and synopses.
+       * Makefile.am: Be sure to add a space before `...' in natural
+       language text.
+       * automake.in (scan_autoconf_traces): Likewise.
+       * lib/Automake/Rule.pm (define): Likewise.
+       * lib/Automake/Variable.pm (define): Likewise.
+       * lib/am/dejagnu.am: Likewise.
+       * lib/am/progs.am: Likewise.
+       * lib/gnupload (dprint, upload): Likewise.
+       * tests/confdeps.test: Likewise.
+       * tests/location.test: Adjust expected output.
+       * automake.in (usage): In synopsis, use singular for OPTION,
+       * remove space before ellipsis.
+       * aclocal.in (usage): Likewise.  Also, fix indentation.
+
+       Fix more duplicate message prefixes.
+       * lib/Automake/XFile.pm (seek): Do not prepend $me.
+       ($me): Remove now-unused package-global.
+       * aclocal.in (check_acinclude): Remove duplicate 'warning: '
+       prefix.
+
        Fix typo in manual.
        * doc/automake.texi (Simple Tests using parallel-tests): Add
        missing closing parenthesis.
        * automake.in (read_main_am_file): Call variables_dump, not
        macros_dump.  Print actual error before list of variables.
 
-2010-04-25  Stefano Lattarini  <stefano.lattarini@gmail.com>
+2010-04-22  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Minor improvements in comments of test `silent3.test'.
        * tests/silent3.test: Tell to keep it in sync with `silent9.test'
 
 2010-04-11  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       Print 'warnings are treated as errors' note if needed.
+       * lib/Automake/Channels.pm: Fix typo in comment.
+       (_print_message): If -Werror is enabled, print a 'warnings are
+       treated as errors' note before the first such warning.
+       * tests/warnopts.test: Adjust comment to mention expected warning.
+       Adjust code to ignore 'warnings are treated as errors' note.
+       * tests/location.test: Adjust expected output with -Werror.
+       * tests/werror4.test: New test.
+       * tests/Makefile.am: Update.
+       * NEWS: Update.
+
+       Ensure we don't print 'warning:' or 'error:' twice.
+       * Makefile.am (sc_ensure_testsuite_has_run): New helper rule.
+       (sc_tests_logs_duplicate_prefixes): New rule, to check for
+       wrong-looking warning and error messages in the test suite logs.
+       * aclocal.in (scan_configure_dep, scan_file): Remove duplicate
+       `warning: ' prefix.
+       * tests/vars3.test: Rename variable to avoid false positive.
+
+       Prepend type to warning, error, and fatal messages.
+       For the first part of messages of types `error' or `fatal',
+       prepend `error: ' to the message.  Prepend `warning: ' to
+       warning messages, whatever the setting of -Werror.
+       * lib/Automake/Channels.pm (partial): Move up definition.
+       (_format_message): Emit `header' and `footer' strings only with
+       the first resp. last part of a set of partial messages.
+       * lib/Automake/ChannelDefs.pm: Add missing '1;' statement at the
+       end of the module.
+       (Automake::ChannelDefs): Setup warning channels with header
+       `warning: ', error and fatal messages with header `error: '.
+       * tests/condinc2.test, tests/ltinstloc.test: Adjust expected
+       error messages.
+       * tests/comment5.test: Likewise.  Also, include stack notes
+       should not start with `error:'.
+       * tests/location.test: Likewise.  Also, try both -Werror and
+       -Wno-error.
+       * NEWS: Update.
+       Report by Bruno Haible.
+
+       Fix capitalization of error messages, reword one message.
+       * lib/Automake/Variable.pm (define): Do not capitalize the first
+       word in the error message.
+       * automake.in (require_file_internal): Likewise.  Also, reword
+       and line-wrap for better readability.
+       * tests/distcom7.test, tests/pluseq5.test, tests/pluseq9.test:
+       Adjust tests.
+
+       Fix connected warnings about obsolete exeext override.
+       * lib/Automake/Rule.pm (define): Merge two warnings that belong
+       together, by setting the 'partial' flag for the first one.
+
        Fix per-Makefile.am setting of -Werror.
        Before this patch, 'AUTOMAKE_OPTIONS = -Werror' in one
        Makefile.am would carry over to other Makefile.am files
        * NEWS, THANKS: Update.
        Report by Pavel Sanda.
 
+2010-04-11  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Avoid possible false negatives in cond46.test.
+       * tests/cond46.test: Enable shell `errexit' flag (and bumped
+       copyright years).  Due to this change, the testcase should now
+       fail on unexpected failures in calls to $ACLOCAL/$AUTOMAKE (whose
+       outcomes were previously unchecked), and on failures in grepping
+       the expected diagnostic in Automake stderr.
+
+2010-04-04  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       Generated tests are now just a thin layer around other tests.
+       * tests/Makefile.am: Rewrite the rule to generate the `*-p.test'
+       test scripts so that any of them simply includes the corresponding
+       `*.test' script (after setting `$parallel_tests' to `yes').
+       * tests/.gitignore: Add wildcard for temporary files used in the
+       generation of `*-p.test' tests.
+
 2010-03-30  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Avoid an unportable use of `$status' shell variable.
        * tests/parallel-tests6.test: Likewise.
        * tests/parallel-tests7.test: Likewise.
 
+2010-03-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix cscope test on systems without working Fortran compiler.
+       * tests/cscope.test: Skip remainder of test if `$MAKE all' fails.
+       * THANKS: Update.
+       Report by Peter Johansson.
+
+2010-02-24  Antonio Diaz Diaz  <ant_diaz@teleline.es>  (tiny change)
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Add lzip compression support.
+       * automake.in (handle_dist): Recognize dist-lzip.
+       (make_paragraphs): Map LZIP to dist-lzip.
+       * doc/automake.texi (Dist): Add dist-lzip.
+       (Options): Likewise.
+       * lib/Automake/Options.pm (_process_option_list): Add dist-lzip.
+       * lib/am/distdir.am
+       (dist dist-all): Add command to create an lzip-compressed tarball.
+       (distcheck): Handle lzip-compressed tarballs just like the others.
+       * tests/defs.in: Test for lzip, too.
+       * tests/lzip.test: New file, based on nogzip.test.
+       * tests/Makefile.am (TESTS): Add lzip.test.
+       * NEWS: Update.
+
 2010-02-22  Karl Berry  <karl@gnu.org>
 
        Improve help message of mdate-sh.
        Fix some typos in the manual
        * doc/automake.texi (Nested Packages, Rebuilding): Fix typos.
 
+2010-01-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix silent-rules output for disabled dependency tracking.
+       * lib/am/depend2.am [!%FASTDEP%]: Rework silent-rules variable
+       expansion code to also work in the case where %AMDEP% expands
+       to FALSE at config.status time, using new substitution string
+       %VERBOSE-NODEP%.
+       * automake.in (verbose_nodep_flag): New function, appending
+       `@am__nodep@' to the verbose-variable name.
+       (handle_languages): If dependencies are not disabled, use it to
+       set %VERBOSE-NODEP%.
+       * m4/depend.m4: Substitute am__nodep as '_no', so the second
+       verbose-variable will always expand to an empty string, if
+       dependencies are enabled.
+       * tests/silent5.test: Also test --disable-dependency-tracking;
+       also test per-target flags for non-C language files.
+       * tests/silent9.test: New test, like silent4.test but disable
+       dependency tracking.
+       * tests/Makefile.am: Adjust.
+       * NEWS, THANKS: Update.
+       Report by Dmitry V. Levin <ldv@altlinux.org>.
+
 2010-01-17  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        Slighty improve tests acoutbs.test and acoutbs2.test.
index 07f71c2..c721146 100644 (file)
@@ -172,7 +172,7 @@ Tue Dec  3 11:29:01 1996  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
        * compile-kr.am: Quote arguments to echo.
 
        * progs.am: Fix up problems when LIBTOOL is not defined (by
-       setting shell variable instprog to the installation program).
+       setting shell variable instprog to the installation program).
 
        * aclocal.in (scan_file): Allow the acinclude.m4 file to override
        any other macro files (but still prevent multiple definitions
@@ -194,7 +194,7 @@ Tue Dec  3 10:40:48 1996  Tom Tromey  <tromey@cygnus.com>
 Mon Dec  2 13:51:11 1996  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
 
        * automake.in (get_object_extension): Unshift ansi2knr onto the
-       all target, so that it builds before any other targets.
+       all target, so that it builds before any other targets.
        [de_ansi_objects]: Delete, since unshifting ansi2knr is an easier
        solution.
 
@@ -306,7 +306,7 @@ Fri Nov 15 18:58:04 1996  Tom Tromey  <tromey@cygnus.com>
        * tags.am (tags-recursive): Removed.
        (TAGS): Depend on @DIRS@, @CONFIG@.  Use @CONFIG@ in rule.
        (ID): From tags-subd.am.
-       
+
        * aclocal.in (obsolete_macros): Include AM_FUNC_FNMATCH.
        * automake.in (scan_configure): Recognize AC_FUNC_FNMATCH.
        * m4/fnmatch.m4: Removed (now in autoconf).
@@ -1311,7 +1311,7 @@ Tue Jun 18 10:53:54 1996  Tom Tromey  <tromey@creche.cygnus.com>
        * automake.in (handle_tests): Don't directly generate site.exp.
 
 Sun Jun 16 22:21:16 1996  Harlan Stenn  <harlan@brown.pfcs.com>
-       
+
        * automake.in:  Treat an initial `#' on a word in AUTOMAKE_OPTIONS
        as a comment start.  Add support for a dist-tarZ target.
 
@@ -1572,8 +1572,8 @@ Thu Apr 25 18:40:06 1996  Tom Tromey  <tromey@creche.cygnus.com>
 Tue Apr 23 17:57:13 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
        * doc/mdate-sh: Extract the last field from the date output, not
-       the sixth, which will fail when the timezone name has more than
-       one word or is missing.
+       the sixth, which will fail when the timezone name has more than
+       one word or is missing.
 
 Wed Apr 24 20:29:26 1996  Tom Tromey  <tromey@creche.cygnus.com>
 
@@ -2125,9 +2125,9 @@ Wed Feb  7 18:00:29 1996  Tom Tromey  <tromey@creche.cygnus.com>
        Give error if appropriate install macro not seen.
        (handle_subdirs): Ensure $seen_gettext before requiring
        gettext-specific files.
-       (handle_configure): Automatically rebuild 
+       (handle_configure): Automatically rebuild
 
-        From Jim Meyering:
+       From Jim Meyering:
        * automake.in (handle_source_transform): Use \W when quoting
        regexp.  When blah_SOURCES not explicitly defined, still create
        entry in %deps.
index 1fcc56c..717b7f5 100644 (file)
@@ -122,7 +122,7 @@ Fri Dec 11 10:23:17 1998  Matthew D. Langston  <langston@SLAC.Stanford.EDU>
 1998-12-20  Thomas Tanner  <tanner@gmx.de>
 
        * automake.in (handle_libraries, handle_ltlibraries): relax the
-       name checking to not enforce `^lib.*' for the sake of building libtool 
+       name checking to not enforce `^lib.*' for the sake of building libtool
        modules.
 
 1998-12-21  Tom Tromey  <tromey@cygnus.com>
@@ -301,7 +301,7 @@ Thu Oct  8 15:00:57 1998  Matthew D. Langston  <langston@SLAC.Stanford.EDU>
 
        * automake.in: Registered the ppf77 language (`.F' extension) for
        preprocessed Fortran 77.
-       
+
        * automake.in: Registered the ratfor language (`.r' extension).
 
        * automake.in: Registered Fortran 77 header files with the "header
@@ -525,7 +525,7 @@ Tue Sep 29 00:10:22 1998  Tom Tromey  <tromey@cygnus.com>
 
        * automake.in: New pattern: INCLUDE_PATTERN.
        (read_am_file):  Make AM_FILE a local filehandle.
-       For INCLUDE_PATTERN, store included paths on @include_stack and call 
+       For INCLUDE_PATTERN, store included paths on @include_stack and call
        read_am_file with argument.
        (handle_configure): When printing the dependencies for
        Makefile.in, print the items on include_stack (if any) as
@@ -533,7 +533,7 @@ Tue Sep 29 00:10:22 1998  Tom Tromey  <tromey@cygnus.com>
 
        * automake.texi: Make a command index `cm' that goes into the
        concept index.  Put if, endif, else, and include in the command index.
-       (Include): Show usage of include directive.  
+       (Include): Show usage of include directive.
 
 Mon Sep 28 00:03:45 1998  Tom Tromey  <tromey@cygnus.com>
 
@@ -663,8 +663,8 @@ Mon Sep 14 00:55:12 1998  Per Cederqvist  <ceder@lysator.liu.se>
 
        Fix for Dynix 3.1.1.
        * automake.in (handle_yacc_lex_cxx): Transform "# " to "#line";
-       some compilers (such as /bin/cc on Dynix 3.1.1) don't accept the
-       output from the preprocessor.
+       some compilers (such as /bin/cc on Dynix 3.1.1) don't accept the
+       output from the preprocessor.
 
 Tue Aug 25 18:40:51 1998  Tom Tromey  <tromey@cygnus.com>
 
@@ -744,7 +744,7 @@ Fri Jul 17 07:37:20 1998  H.J. Lu  (hjl@gnu.org)
 Fri Jul 17 11:58:27 1998  Ian Lance Taylor  <ian@cygnus.com>
 
        * automake.in: Use $(AM_MAKEFLAGS) in every invocation of $(MAKE).
-       * subdirs.am: Likewise.
+       * subdirs.am: Likewise.
 
 Thu Jul 16 18:09:03 1998  Ian Lance Taylor  <ian@cygnus.com>
 
@@ -825,7 +825,7 @@ Sun Apr  5 13:58:24 1998  Tom Tromey  <tromey@cygnus.com>
        * Released 1.3.
 
        * automake.in (handle_options): Correctly handle trailing alpha
-       version letter or lack thereof.  Test version3.test.
+       version letter or lack thereof.  Test version3.test.
 
        * automake.in (am_conf_line_warning): Perl 4 fixlet; typo fix.
 
@@ -846,7 +846,7 @@ Fri Apr  3 15:43:46 1998  Doug Evans  <devans@seba.cygnus.com>
        * automake.in (handle_configure): Fix setting of colon_infile
        in case where multiple files are used to build Makefile.
        [ Test colon5.test ]
-       
+
 Fri Apr  3 13:07:58 1998  Tom Tromey  <tromey@cygnus.com>
 
        * ansi2knr.c, texinfo.tex: New versions from respective
@@ -1424,7 +1424,7 @@ Tue Aug  5 14:44:10 1997  Ian Lance Taylor  <ian@cygnus.com>
 Mon Aug  4 14:52:08 1997  Ian Lance Taylor  <ian@cygnus.com>
 
        * automake.in ($RULE_PATTERN): Accept $ in body of rule name.
-       (handle_programs): Don't append $(EXEEXT) if the
+       (handle_programs): Don't append $(EXEEXT) if the
        program name contains '.'.
        (am_install_var): When rewriting _PROGRAMS, don't append $(EXEEXT)
        if the program names contains '.'.  Also, handle conditionals.
@@ -1529,7 +1529,7 @@ Sat Feb 22 16:05:24 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
        need compile-kr.am.  Delete it.
 
        * automake.in (handle_yacc_lex_cxx, get_object_extension): Use
-       _.c, _.o, _.lo instead of ._c, ._o, .l_o for de-ansification.
+       _.c, _.o, _.lo instead of ._c, ._o, .l_o for de-ansification.
 
        * ansi2knr.c (main): Parse our arguments a little differently so
        that we don't create null output files when we can't read the
@@ -2058,7 +2058,7 @@ Wed Feb 26 08:41:11 1997  Gordon Matzigkeit  <gord@gnu.ai.mit.edu>
        to do to upgrade the support.
 
        * automake.in, ltlib-clean.am, ltlib.am, ltlibrary.am: Revamped
-       libtool support to use the _LTLIBRARIES primary.
+       libtool support to use the _LTLIBRARIES primary.
 
 Wed Feb 26 00:20:39 1997  Tom Tromey  <tromey@cygnus.com>
 
diff --git a/GNUmakefile b/GNUmakefile
new file mode 100644 (file)
index 0000000..134e743
--- /dev/null
@@ -0,0 +1,19 @@
+# Maintainer makefile for Automake.  Requires GNU make.
+
+# Copyright (C) 2012 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/>.
+
+include ./Makefile
+include $(srcdir)/syntax-checks.mk
diff --git a/HACKING b/HACKING
index 26f1d91..1c98795 100644 (file)
--- a/HACKING
+++ b/HACKING
 * Use `keep_testdirs=yes' to keep test directories for successful
   tests also.
 
+* Use perl coverage information to ensure your new code is thoroughly
+  tested by your new tests.
+
 * See file `tests/README' for more information.
 
 ================================================================
 * Run this:
   ./bootstrap && ./configure && make && make check && make distcheck
 
-* Run `make release-stats' if release statistics in doc/automake.texi
-  have not been updated yet.
-
 * Run `make git-release'.
   This will run "make dist" to create the tarballs, commit the last
   changes to NEWS, configure.ac and m4/amversion.m4, tag the repository,
diff --git a/INSTALL b/INSTALL
index 81fd332..a1e89e1 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,8 +1,8 @@
 Installation Instructions
 *************************
 
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Inc.
 
    Copying and distribution of this file, with or without modification,
 are permitted in any medium without royalty provided the copyright
@@ -226,6 +226,11 @@ order to use an ANSI C compiler:
 
 and if that doesn't work, install pre-built binaries of GCC for HP-UX.
 
+   HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved.  Use GNU `make'
+instead.
+
    On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
 parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
 a workaround.  If GNU CC is not installed, it is therefore recommended
index 76c3e69..e87bd24 100644 (file)
@@ -33,6 +33,8 @@ AUTOMAKESOURCES = automake.in aclocal.in
 TAGS_FILES = $(AUTOMAKESOURCES)
 
 EXTRA_DIST = \
+  GNUmakefile \
+  syntax-checks.mk \
   HACKING \
   ChangeLog.96 \
   ChangeLog.98 \
@@ -54,16 +56,16 @@ install-exec-hook:
        @for p in $(bin_SCRIPTS); do \
          f="`echo $$p|sed '$(transform)'`"; \
          fv="$$f-$(APIVERSION)"; \
-         rm -f $(DESTDIR)$(bindir)/$$fv; \
-         echo " $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv"; \
-         $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv; \
+         rm -f "$(DESTDIR)$(bindir)/$$fv"; \
+         echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \
+         $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \
        done
 
 uninstall-hook:
        @for p in $(bin_SCRIPTS); do \
          f="`echo $$p|sed '$(transform)'`"; \
          fv="$$f-$(APIVERSION)"; \
-         rm -f $(DESTDIR)$(bindir)/$$fv; \
+         rm -f "$(DESTDIR)$(bindir)/$$fv"; \
        done
 
 
@@ -101,6 +103,15 @@ automake aclocal: Makefile
 INSTALL: lib/INSTALL
        $(AM_V_GEN)cp $(srcdir)/lib/INSTALL $@
 
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local:
+       am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
+# Convenience proxy target for the test suites.
+recheck:
+       $(am__cd) tests && $(MAKE) $(AM_MAKEFLAGS) $@
+.PHONY: recheck
+
 ################################################################
 ##
 ## Everything past here is useful to the maintainer, but probably not
@@ -147,465 +158,42 @@ ChangeLog: am--changelog-regen-hook
 
 # Ensure tests are world-executable
 dist-hook:
-       cd $(distdir)/tests && chmod a+rx *.test
-
-# Some simple checks, and then ordinary check.  These are only really
-# guaranteed to work on my machine.
-syntax_check_rules = \
-sc_test_names \
-sc_diff_automake_in_automake \
-sc_diff_aclocal_in_automake \
-sc_perl_syntax \
-sc_no_brace_variable_expansions \
-sc_rm_minus_f \
-sc_no_for_variable_in_macro \
-sc_mkinstalldirs \
-sc_pre_normal_post_install_uninstall \
-sc_perl_no_undef \
-sc_perl_no_split_regex_space \
-sc_cd_in_backquotes \
-sc_cd_relative_dir \
-sc_perl_at_uscore_in_scalar_context \
-sc_perl_local_no_parens \
-sc_perl_local \
-sc_AMDEP_TRUE_in_automake_in \
-sc_tests_make_without_am_makeflags \
-sc_tests_plain_make \
-sc_tests_plain_autoconf \
-sc_tests_plain_autoupdate \
-sc_tests_plain_automake \
-sc_tests_plain_autom4te \
-sc_tests_plain_autoheader \
-sc_tests_plain_autoreconf \
-sc_tests_here_document_format \
-sc_tests_Exit_not_exit \
-sc_tests_automake_fails \
-sc_tests_plain_aclocal \
-sc_tests_plain_perl \
-sc_tests_required_after_defs \
-sc_tests_overriding_macros_on_cmdline \
-sc_tests_plain_sleep \
-sc_tests_plain_egrep_fgrep \
-sc_tests_PATH_SEPARATOR \
-sc_mkdir_p \
-sc_perl_at_substs \
-sc_unquoted_DESTDIR \
-sc_tabs_in_texi \
-sc_at_in_texi
-
-$(syntax_check_rules): automake aclocal
-maintainer-check: $(syntax_check_rules)
-.PHONY: maintainer-check $(syntax_check_rules)
-
-## Check that the list of tests given in the Makefile is equal to the
-## list of all test scripts in the Automake testsuite.
-.PHONY: maintainer-check-list-of-tests
-maintainer-check-list-of-tests:
-       $(am__cd) tests && $(MAKE) $(AM_MAKEFLAGS) $@
-maintainer-check: maintainer-check-list-of-tests
-
-## Look for test whose names can cause spurious failures when used as
-## first argument to AC_INIT (chiefly because they might contain an
-## m4/m4sugar builtin or macro name).
-m4_builtins = \
-  __gnu__ \
-  __unix__ \
-  bpatsubst \
-  bregexp \
-  builtin \
-  changecom \
-  changequote \
-  changeword \
-  debugfile \
-  debugmode \
-  decr \
-  define \
-  defn \
-  divert \
-  divnum \
-  dnl \
-  dumpdef \
-  errprint \
-  esyscmd \
-  eval \
-  format \
-  ifdef \
-  ifelse \
-  include \
-  incr \
-  index \
-  indir \
-  len \
-  m4exit \
-  m4wrap \
-  maketemp \
-  mkstemp \
-  patsubst \
-  popdef \
-  pushdef \
-  regexp \
-  shift \
-  sinclude \
-  substr \
-  symbols \
-  syscmd \
-  sysval \
-  traceoff \
-  traceon \
-  translit \
-  undefine \
-  undivert
-sc_test_names:
-       @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \
-        m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \
-        if ls tests/*.test | LC_ALL=C grep -E "$$m4_macro_rx"; then \
-          echo "the names of the tests above can be problematic" 1>&2; \
-          echo "Avoid test names that contain names of m4 macros" 1>&2; \
-          exit 1; \
-        fi
-
-## These check avoids accidental configure substitutions in the source.
-## There are exactly 9 lines that should be modified from automake.in to
-## automake, and 10 lines that should be modified from aclocal.in to
-## aclocal; these wors out to 32 and 34 lines of diffs, respectively.
-sc_diff_automake_in_automake:
-       @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 32; then \
-         echo "found too many diffs between automake.in and automake" 1>&2; \
-         diff -c $(srcdir)/automake.in automake; \
-         exit 1; \
-       fi
-sc_diff_aclocal_in_aclocal:
-       @if test `diff $(srcdir)/aclocal.in aclocal | wc -l` -ne 34; then \
-         echo "found too many diffs between aclocal.in and aclocal" 1>&2; \
-         diff -c $(srcdir)/aclocal.in aclocal; \
-         exit 1; \
-       fi
-
-## Syntax check with default Perl (on my machine, Perl 5).
-sc_perl_syntax:
-       @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w automake
-       @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w aclocal
-
-## expect no instances of '${...}'.  However, $${...} is ok, since that
-## is a shell construct, not a Makefile construct.
-sc_no_brace_variable_expansions:
-       @if grep -F '$${' $(srcdir)/lib/am/[a-z]*.am | \
-              grep -F -v '$$$$'; then \
-         echo "Found too many uses of '\$${' in the lines above." 1>&2; \
-         exit 1;                               \
-       else :; fi
-
-## Make sure `rm' is called with `-f'.
-sc_rm_minus_f:
-       @if grep -v '^#' $(srcdir)/lib/am/[a-z]*.am $(srcdir)/tests/*.test | \
-           grep -E '\<rm ([^-]|\-[^f ]*\>)'; then \
-         echo "Suspicious 'rm' invocation." 1>&2; \
-         exit 1;                               \
-       else :; fi
-
-## Never use something like `for file in $(FILES)', this doesn't work
-## if FILES is empty or if it contains shell meta characters (e.g. $ is
-## commonly used in Java filenames).
-sc_no_for_variable_in_macro:
-       @if grep 'for .* in \$$(' $(srcdir)/lib/am/[a-z]*.am; then \
-         echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
-         exit 1; \
-       else :; fi
-
-## Make sure all invocations of mkinstalldirs are correct.
-sc_mkinstalldirs:
-       @if grep -n 'mkinstalldirs' $(srcdir)/lib/am/[a-z]*.am | \
-             grep -F -v '$$(mkinstalldirs)'; then \
-         echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
-         exit 1; \
-       else :; fi
-
-## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
-sc_pre_normal_post_install_uninstall:
-       @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' \
-                 $(srcdir)/lib/am/[a-z]*.am | \
-             grep -v ':##' | grep -v ':        @\$$('; then \
-         echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
-         exit 1; \
-       else :; fi
-
-## We never want to use "undef", only "delete", but for $/.
-sc_perl_no_undef:
-       @if grep -n -w 'undef ' $(srcdir)/automake.in | \
-             grep -F -v 'undef $$/'; then \
-         echo "Found undef in automake.in; use delete instead" 1>&2; \
-         exit 1; \
-       fi
-
-## We never want split (/ /,...), only split (' ', ...).
-sc_perl_no_split_regex_space:
-       @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
-         echo "Found bad split in the lines above." 1>&2; \
-         exit 1; \
-       fi
-
-## Look for cd within backquotes
-sc_cd_in_backquotes:
-       @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in \
-             $(srcdir)/lib/am/*.am; then \
-         echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
-         exit 1; \
-       fi
-
-## Look for cd to a relative directory (may be influenced by CDPATH).
-## Skip some known directories that are OK.
-sc_cd_relative_dir:
-       @if grep -n '^[^#]*cd ' $(srcdir)/automake.in \
-             $(srcdir)/lib/am/*.am | \
-             grep -v 'echo.*cd ' | \
-             grep -v 'am__cd =' | \
-             grep -v '^[^#]*cd [./]' | \
-             grep -v '^[^#]*cd \$$(top_builddir)' | \
-             grep -v '^[^#]*cd "\$$\$$am__cwd' | \
-             grep -v '^[^#]*cd \$$(abs' | \
-             grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
-         echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
-         exit 1; \
-       fi
-
-## Using @_ in a scalar context is most probably a programming error.
-sc_perl_at_uscore_in_scalar_context:
-       @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
-         echo "Using @_ in a scalar context in the lines above." 1>&2; \
-         exit 1; \
-       fi
-
-## Forbid using parens with `local' to ease counting.
-sc_perl_local_no_parens:
-       @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
-         echo "Don't use \`local' with parens: use several \`local' above." >&2; \
-         exit 1; \
-       fi
-
-## Allow only few variables to be localized in Automake.
-sc_perl_local:
-       @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
-               grep '^[ \t]*local [^*]'; then \
-         echo "Please avoid \`local'." 1>&2; \
-         exit 1; \
-       fi
-
-## Don't let AMDEP_TRUE substitution appear in automake.in.
-sc_AMDEP_TRUE_in_automake_in:
-       @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
-         echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
-         exit 1; \
-       fi
-
-## Recursive make invocations should always pass $(AM_MAKEFLAGS)
-## to $(MAKE), for portability to non-GNU make.
-sc_tests_make_without_am_makeflags:
-       @if grep '^[^#].*(MAKE) ' $(srcdir)/lib/am/*.am $(srcdir)/automake.in |\
-               grep -v 'AM_MAKEFLAGS'; then \
-         echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
-         exit 1; \
-       fi
-
-## Tests should never call make directly.
-sc_tests_plain_make:
-       @if grep -v '^#' $(srcdir)/tests/*.test | $(EGREP) ':[  ]*make( |$$)'; then \
-         echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
-         exit 1; \
-       fi
-
-## Tests should never call autoconf directly.
-sc_tests_plain_autoconf:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoconf\>'; then \
-         echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
-         exit 1; \
-       fi
-
-## Tests should never call autoupdate directly.
-sc_tests_plain_autoupdate:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoupdate\>'; then \
-         echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
-         exit 1; \
-       fi
-
-## Tests should never call automake directly.
-sc_tests_plain_automake:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep -E ':[   ]*automake\>([^:]|$$)'; then \
-         echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call autoheader directly.
-sc_tests_plain_autoheader:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoheader\>'; then \
-         echo 'Do not run "automake" in the above tests.  Use "$$AUTOHEADER" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call autoreconf directly.
-sc_tests_plain_autoreconf:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autoreconf\>'; then \
-         echo 'Do not run "automake" in the above tests.  Use "$$AUTORECONF" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call autom4te directly.
-sc_tests_plain_autom4te:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*autom4te\>'; then \
-         echo 'Do not run "automake" in the above tests.  Use "$$AUTOM4TE" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should only use END and EOF for here documents
-## (so that the next test is effective).
-sc_tests_here_document_format:
-       @if grep '<<' $(srcdir)/tests/*.test | grep -v 'END' | grep -v 'EOF'; then \
-         echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
-         exit 1; \
-       fi
-
-## Tests should never call exit directly, but use Exit.
-## This is so that the exit status is transported correctly across the 0 trap.
-## Ignore comments, testsuite self tests, and one perl line in ext2.test.
-sc_tests_Exit_not_exit:
-       @found=false; for file in $(srcdir)/tests/*.test; do \
-         case $$file in */self-check-*.test) continue;; esac; \
-         res=`sed -n -e '/^#/d; /^\$$PERL/d' -e '/<<.*END/,/^END/b' \
-                     -e '/<<.*EOF/,/^EOF/b' -e '/exit [$$0-9]/p' $$file`; \
-         if test -n "$$res"; then \
-           echo "$$file:$$res"; \
-           found=true; \
-         fi; \
-       done; \
-       if $$found; then \
-         echo 'Do not call plain "exit", use "Exit" instead, in above tests.' 1>&2; \
-         exit 1; \
-       fi
-
-## Use AUTOMAKE_fails when appropriate
-sc_tests_automake_fails:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep '\$$AUTOMAKE.*&&.*[eE]xit'; then \
-         echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call aclocal directly.
-sc_tests_plain_aclocal:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*aclocal\>'; then \
-         echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call perl directly.
-sc_tests_plain_perl:
-       @if grep -v '^#' $(srcdir)/tests/*.test | grep ':[      ]*perl\>'; then \
-         echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
-         exit 1; \
-       fi
-
-## Setting `required' after sourcing `./defs' is a bug.
-sc_tests_required_after_defs:
-       @for file in $(srcdir)/tests/*.test; do \
-         if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
-           echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
-           exit 1; \
-         fi; \
-       done
+       $(am__cd) $(distdir)/tests && chmod a+rx *.test
 
-## Overriding a Makefile macro on the command line is not portable when
-## recursive targets are used.  Better use an envvar.  SHELL is an
-## exception, POSIX says it can't come from the environment.  V, DESTDIR,
-## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
-## as package authors are urged not to initialize them anywhere.
-sc_tests_overriding_macros_on_cmdline:
-       @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(srcdir)/tests/*.test; then \
-         echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
-         echo ' in the above lines, it is more portable.' 1>&2; \
-         exit 1; \
-       fi
-## Also try to account for usages like "$MAKE || st=$?".
-       @if sed -e 's/ || .*//' -e 's/ && .*//' \
-               -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
-               -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
-## DISTCHECK_CONFIGURE_FLAGS is allowed to contain whitespace in its
-## definition, so the more complex substitutions below.
-               -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
-               -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
-               -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
-             $(srcdir)/tests/*.test | grep '\$$MAKE .*='; then \
-         echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
-         echo 'it is more portable.' 1>&2; \
-         exit 1; \
-       fi
-       @if grep 'SHELL=.*\$$MAKE' $(srcdir)/tests/*.test; then \
-         echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
-         echo 'the above lines.' 1>&2; \
-         exit 1; \
-       fi
 
-## Never use `sleep 1' to create files with different timestamps.
-## Use `$sleep' instead.  Some filesystems (e.g., Windows') have only
-## a 2sec resolution.
-sc_tests_plain_sleep:
-       @if grep -E '\bsleep +[12345]\b' $(srcdir)/tests/*.test; then \
-         echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
-         exit 1; \
-       fi
+# Perl coverage statistics.
+PERL_COVERAGE_DB = $(abs_top_builddir)/cover_db
+PERL_COVERAGE_FLAGS = -MDevel::Cover=-db,$(PERL_COVERAGE_DB),-silent,on,-summary,off
+PERL_COVER = cover
 
-## fgrep and egrep are not required by POSIX.
-sc_tests_plain_egrep_fgrep:
-       @if grep -E '\b[ef]grep\b' $(srcdir)/tests/*.test ; then \
-         echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
-         exit 1; \
-       fi
-       @if grep -E '\b[ef]grep\b' $(srcdir)/lib/am/*.am $(srcdir)/m4/*.m4; then \
-         echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
-         exit 1; \
-       fi
+check-coverage-run recheck-coverage-run: all
+       $(mkinstalldirs) $(PERL_COVERAGE_DB)
+       PERL5OPT="$$PERL5OPT $(PERL_COVERAGE_FLAGS)"; export PERL5OPT; \
+       WANT_NO_THREADS=yes; export WANT_NO_THREADS; unset AUTOMAKE_JOBS; \
+       $(MAKE) $(AM_MAKEFLAGS) `echo $@ | sed 's/-coverage-run//'`
 
-## Using `:' as a PATH separator is not portable.
-sc_tests_PATH_SEPARATOR:
-       @if grep -E '\bPATH=.*:.*' $(srcdir)/tests/*.test ; then \
-         echo "Use \`\$$PATH_SEPARATOR', not \`:', in PATH definitions above." 1>&2; \
+check-coverage-report:
+       @if test ! -d "$(PERL_COVERAGE_DB)"; then \
+         echo "No coverage database found in \`$(PERL_COVERAGE_DB)'." >&2; \
+         echo "Please run \`make check-coverage' first" >&2; \
          exit 1; \
        fi
+       $(PERL_COVER) $(PERL_COVER_FLAGS) "$(PERL_COVERAGE_DB)"
 
-sc_mkdir_p:
-       @if grep 'mkdir_p' $(srcdir)/automake.in \
-             $(srcdir)/lib/am/*.am $(srcdir)/tests/*.test; then \
-         echo 'Do not use mkdir_p in the above files, use MKDIR_P.' 1>&2; \
-         exit 1; \
-       fi
+# We don't use direct dependencies here because we'd like to be able
+# to invoke the report even after interrupted check-coverage.
+check-coverage: check-coverage-run
+       $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
 
-## Try to make sure all @...@ substitutions are covered by our
-## substitution rule.
-sc_perl_at_substs:
-       @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
-         echo "Unresolved @...@ substitution in aclocal" 1>&2; \
-         exit 1; \
-       fi
-       @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
-         echo "Unresolved @...@ substitution in automake" 1>&2; \
-         exit 1; \
-       fi
+recheck-coverage: recheck-coverage-run
+       $(MAKE) $(AM_MAKEFLAGS) check-coverage-report
 
-sc_unquoted_DESTDIR:
-       @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(srcdir)/lib/am/*.am; then \
-         echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
-         exit 1; \
-       fi
+clean-coverage:
+       rm -rf "$(PERL_COVERAGE_DB)"
+clean-local: clean-coverage
 
-sc_tabs_in_texi:
-       @if grep '      ' $(srcdir)/doc/automake.texi; then \
-         echo 'Do not use tabs in the manual.' 1>&2; \
-         exit 1; \
-       fi
-
-sc_at_in_texi:
-       @if grep -E '([^@]|^)@([         ][^@]|$$)' $(srcdir)/doc/automake.texi; \
-       then \
-         echo 'Unescaped @.' 1>&2; \
-         exit 1; \
-       fi
+.PHONY: check-coverage recheck-coverage check-coverage-run \
+       recheck-coverage-run check-coverage-report clean-coverage
 
 ## Tagging and/or uploading stable and beta releases.
 
@@ -681,25 +269,25 @@ autodiffs:
         { \
             rev=$$1 dir=$$2 \
               && echo "$@: will get files from revision $$rev" \
-              && git clone -q --depth 1 "$$am_gitdir" tmp \
-              && cd tmp \
-              && git checkout -q "$$rev" \
+              && $(GIT) clone -q --depth 1 "$$am_gitdir" tmp \
+              && $(am__cd) tmp \
+              && $(GIT) checkout -q "$$rev" \
               && echo "$@: bootstrapping $$rev" \
               && $(SHELL) ./bootstrap \
               && echo "$@: copying files from $$rev" \
               && makefile_ins=`find . -name Makefile.in` \
               && (tar cf - configure aclocal.m4 $$makefile_ins) | \
-                 (cd .. && cd "$$dir" && tar xf -) \
+                 (cd .. && $(am__cd) "$$dir" && tar xf -) \
               && cd .. \
               && rm -rf tmp; \
         }; \
         outdir=$@.dir \
 ## Before proceeding, ensure the specified revisions truly exist.
-          && git --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
-          && git --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
+          && $(GIT) --git-dir="$$am_gitdir" describe $$OLD_COMMIT >/dev/null \
+          && $(GIT) --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \
           && rm -rf $$outdir \
           && mkdir $$outdir \
-          && cd $$outdir \
+          && $(am__cd) $$outdir \
           && mkdir new old \
           && get_autofiles_from_rev $$OLD_COMMIT old \
           && get_autofiles_from_rev $$NEW_COMMIT new \
@@ -760,7 +348,7 @@ fetch:
        rm -rf Fetchdir > /dev/null 2>&1
        mkdir Fetchdir
 ## If a get fails then that is a problem.
-       (cd Fetchdir && \
+       ($(am__cd) Fetchdir && \
        $(WGET_SV_GIT_CF)config.guess -O config.guess && \
        $(WGET_SV_GIT_CF)config.sub -O config.sub && \
        $(WGET_SV_CVS)texinfo/texinfo/doc/texinfo.tex -O texinfo.tex && \
@@ -775,7 +363,7 @@ fetch:
                  >>Fetchdir/update.patch 2>/dev/null; then :; \
          else \
            stat=1; \
-           echo "Updating $(srcdir)/lib/$$file..."; \
+           echo "Updating $(srcdir)/lib/$$file ..."; \
            cp Fetchdir/$$file $(srcdir)/lib/$$file; \
          fi; \
        done; \
@@ -784,42 +372,11 @@ fetch:
        exit $$stat
 .PHONY: fetch
 
-## Generate release statistics, for the table in automake.texi.
-## This has to be run in an up to date build tree, but there must
-## be no temp files nor unused other files lying around!
-release-stats: ps
-       $(AM_V_GEN): && \
-       am=`wc -l < automake` && \
-       acl=`wc -l < aclocal` && \
-       pmfiles="lib/Automake/*.pm" && \
-       if test . != '$(srcdir)'; then pmfiles="$$pmfiles $(srcdir)/lib/Automake/*.pm"; \
-       else :; fi && \
-       pm=`cat $$pmfiles | wc -l` && \
-       dot_am_files=`ls -1 $(srcdir)/lib/am/*.am | grep -v Makefile.am` && \
-       amf=`echo "$$dot_am_files" | wc -l` && \
-       aml=`cat $$dot_am_files | wc -l` && \
-       m4f=`ls -1 $(srcdir)/m4/*.m4 | wc -l` && \
-       m4l=`cat $(srcdir)/m4/*.m4 | wc -l` && \
-       doc_text=`cd doc && LC_ALL=C pstops 0 automake.ps unused.ps 2>&1` && \
-       echo "$$doc_text" && \
-       rm -f doc/unused.ps && \
-       doc=`echo "$$doc_text" | sed -n 's/.*Wrote \([1-9][0-9]*\) pages.*/\1/p'` && \
-       tests="tests/*.test"; \
-       if test . != '$(srcdir)'; then tests="$$tests $(srcdir)/tests/*.test"; \
-       else :; fi && \
-       t=`ls -1 $$tests | wc -l` && \
-       tgen=`ls -1 $$tests | grep '.-p\.test' | wc -l` && \
-       today=`date +%Y-%m-%d` && \
-       echo "add this to the table in doc/automake.texi after verification:" && \
-       printf '@item %s @tab %-6s @tab %4d @tab %4d @tab %4d @tab %4d %-4s @tab %4d %-4s @tab %3d @tab %d %-4s\n' \
-                     $$today $(VERSION) $$am    $$acl    $$pm   $$aml "($$amf)" $$m4l "($$m4f)" $$doc $$t "($$tgen)"
-.PHONY: release-stats
-
 update_copyright_env = \
   UPDATE_COPYRIGHT_FORCE=1 \
   UPDATE_COPYRIGHT_USE_INTERVALS=2
 
 .PHONY: update-copyright
 update-copyright:
-       git ls-files | grep -Ev 'COPYING|INSTALL' \
+       $(GIT) ls-files | grep -Ev 'COPYING|INSTALL' \
          | $(update_copyright_env) xargs $(srcdir)/lib/$@
diff --git a/NEWS b/NEWS
index eb9af22..856e965 100644 (file)
--- a/NEWS
+++ b/NEWS
-New in 1.11.0a:
+New in 1.11a:
+
+* Obsolete features removed:
+
+  - Support for automatic de-ANSI-fication has been removed.
+
+  - The support for the "obscure" multilib feature has been removed
+    from Automake core (but remains available in the 'contrib/'
+    directory of the Automake distribution).
+
+  - Support for ".log -> .html" conversion and the check-html and
+    recheck-html targets has been removed from Automake core (but
+    remains available in the 'contrib/' directory of the Automake
+    distribution).
+
+  - The deprecated `lzma' compression format for distribution archives
+    has been removed, in favor of `xz' and `lzip'.
+
+  - The obsolete AM_WITH_REGEX macro has been removed.
+
+  - The deprecated options `--output-dir', `--Werror' and `--Wno-error'
+    have been removed.
+
+  - The chapter on the history of Automake has been moved out of the
+    reference manual, into a new dedicated Texinfo file.
+
+* New targets:
+
+  - New `cscope' target to build a cscope database for the source tree.
+
+* Changes to Automake-generated testsuite harnesses:
+
+  - Test scripts that exit with status 99 to signal an "hard error" (e.g.,
+    and unexpected or internal error, or a failure to set up the test case
+    scenario) have their outcome reported as an 'ERROR' now.  Previous
+    versions of automake reported such an outcome as a 'FAIL' (the only
+    difference with normal failures being that hard errors were counted
+    as failures even when the test originating them was listed in
+    XFAIL_TESTS).
+
+  - The testsuite summary displayed by the parallel-test harness has a
+    completely new format, that always list the numbers of passed, failed,
+    xfailed, xpassed, skipped and errored tests, even when these numbers
+    are zero (but using smart coloring when the color-tests option is in
+    effect).
+
+  - The default testsuite driver offered by the 'parallel-tests' option is
+    now implemented (partly at least) with the help of automake-provided
+    auxiliary scripts (e.g., `test-driver'), instead of relying entirely
+    on code in the generated Makefile.in.
+    This has two noteworthy implications.  The first one is that projects
+    using the `parallel-tests' option should now either run automake with
+    the `--add-missing' option, or manually copy the `test-driver' script
+    into their tree.  The second, and more important, implication is that
+    now, when the `parallel-tests' option is in use, TESTS_ENVIRONMENT can
+    not be used anymore to define a test runner, and the command specified
+    in LOG_COMPILER (and <ext>_LOG_COMPILER) must be a *real* executable
+    program or script.  For example, this is still a valid usage (albeit
+    a little contorted):
+
+      TESTS_ENVIRONMENT = \
+        if test -n '$(STRICT_TESTS)'; then \
+          maybe_errexit='-e'; \
+        else \
+          maybe_errexit=''; \
+        fi;
+      LOG_COMPILER = $(SHELL) $$maybe_errexit
+
+    while this is not anymore:
+
+      TESTS_ENVIRONMENT = \
+        $(SHELL) `test -n '$(STRICT_TESTS_CHECKING)' && echo ' -e'`
+
+    neither is this:
+
+      TESTS_ENVIRONMENT = \
+        run_with_perl_or_shell () \
+        { \
+          if grep -q '^#!.*perl' $$1; then
+            $(PERL) $$1; \
+          else \
+            $(SHELL) $$1; \
+          fi; \
+        }
+      LOG_COMPILER = run_with_per_or_shell
+
+  - The package authors can now use customary testsuite drivers within
+    the framework provided by the 'parallel-tests' testsuite harness.
+    Consistently with the existing syntax, this can be done by defining
+    special makefile variables `LOG_DRIVER' and `<ext>_LOG_DRIVER'.
+
+  - A new developer-reserved variable `AM_TESTS_FD_REDIRECT' can be used
+    to redirect/define file descriptors used by the test scripts.
+
+  - The parallel-tests harness generates now, in addition the `.log' files
+    holding the output produced by the test scripts, a new set of `.trs'
+    files, holding "metadata" derived by the execution of the test scripts;
+    among such metadata are the outcomes of the test cases run by a script.
+
+  - Initial and still experimental support for the TAP test protocol is
+    now provided.
+
+* Changes to Yacc and Lex support:
+
+  - C source and header files derived from non-distributed Yacc and/or
+    Lex sources are now removed by a simple "make clean" (while they were
+    previously removed only by "make maintainer-clean").
+
+  - Slightly backward-incompatible change, relevant only for use of Yacc
+    with C++: the extensions of the header files produced by the Yacc
+    rules are now modelled after the extension of the corresponding
+    sources.  For example, yacc files named "foo.y++" and "bar.yy" will
+    produce header files named "foo.h++" and "bar.hh" respectively, where
+    they would have previously produced header files named simply "foo.h"
+    and "bar.h".  This change offers better compatibility with `bison -o'.
 
-* WARNING: Future backward-incompatibilities!
+* Miscellaneous changes:
 
-  - The support for the "obscure" multilib feature has been deprecated,
-    and will be moved out of the automake core in the next major Automake
-    release (1.12).
+  - The `dist' and `dist-all' targets now can run compressors in parallel.
 
-  - The support for ".log -> .html" conversion and the check-html and
-    recheck-html targets will be removed in the next major Automake
-    release (1.12).
+  - Automake can now generate silenced rules for texinfo outputs.
 
-  - The `lzma' compression format for distribution archives has been
-    deprecated in favor of `xz' and `lzip', and will be removed in the
-    next major Automake release (1.12).
+  - Some auxiliary files that are automatically distributed by Automake
+    (e.g., `install-sh', or the `depcomp' script for packages compiling
+    C sources) might now be listed in the DIST_COMMON variable in many
+    Makefile.in files, rather than in the top-level one.
 
-  - The Automake support for automatic de-ANSI-fication will be removed in
-    the next major Automake release (1.12).
+  - Messages of types warning or error from `automake' and `aclocal'
+    are now prefixed with the respective type, and presence of -Werror
+    is noted.
 
-  - The `--acdir' option of aclocal is deprecated, and will probably be
-    removed in the next major Automake release (1.12).
+  - Automake's early configure-time sanity check now tries to avoid
+    sleeping for a second, which slowed down cached configure runs
+    noticeably.  In that case, it will check back at the end of the
+    configure script to ensure that at least one second has passed, to
+    avoid time stamp issues with makefile rules rerunning autotools
+    programs.
 
-  - The exact order in which the directories in the aclocal macro
-    search path are looked up is probably going to be changed in the
-    next Automake release (1.12).
+  - For programs and libraries, automake now detect EXTRA_foo_DEPENDENCIES
+    and adds them to the normal list of dependencies, but without
+    overwriting the foo_DEPENDENCIES variable, which is normally computed
+    by automake.
 
-  - The obsolescent AM_WITH_REGEX  macro has been deprecated (since the
-    GNU rx library has been decommissioned), and will be removed in the
-    next major Automake release (1.12).
+  - The warnings in the category `extra-portability' are now enabled by
+    `-Wall'.  In previous versions, one has to use `-Wextra-portability'
+    to enable them.
 
-* Changes to aclocal:
+Bugs fixed in 1.11a:
 
-  - The `--acdir' option is deprecated.  Now you should use the new options
-    `--automake-acdir' and `--system-acdir' instead.
+  - Various minor bugfixes.
 
-  - The `ACLOCAL_PATH' environment variable is now interpreted as a
-    colon-separated list of additional directories to search after the
-    automake internal acdir (by default ${prefix}/share/aclocal-APIVERSION)
-    and before the system acdir (by default ${prefix}/share/aclocal).
+* Bugs introduced by 1.11:
+
+  - The AM_COND_IF macro also works if the shell expression for the
+    conditional is no longer valid for the condition.
+
+* Long-standing bugs:
+
+  - Automake's own build system finally have a real "installcheck" target.
+
+  - Files listed with the AC_REQUIRE_AUX_FILE macro in configure.ac are
+    now automatically distributed also if the directory of the auxiliary
+    files coincides with the top-level directory.
+
+  - Automake now detects the presence of the `-d' flag in the various
+    `*YFLAGS' variables even when their definitions involve indirections
+    through other variables, such as in:
+      foo_opts = -d
+      AM_YFLAGS = $(foo_opts)
+
+  - Automake now complains if a `*YFLAGS' variable has any conditional
+    content, not only a conditional definition.
+
+  - Explicit enabling and/or disabling of Automake warning categories
+    through the `-W...' options now always takes precedence over the
+    implicit warning level implied by Automake strictness (foreign, gnu
+    or gnits), regardless of the order in which such strictness and
+    warning flags appear.  For example, a setting like:
+      AUTOMAKE_OPTIONS = -Wall --foreign
+    will cause the warnings in category `portability' to be enabled, even
+    if those warnings are by default disabled in `foreign' strictness.
+
+\f
+New in 1.11.2a:
+
+* WARNING: Future backward-incompatibilities!
+
+  - The obsolescent AM_WITH_REGEX  macro has been deprecated, since the
+    GNU rx library has been decommissioned.
+
+  - The `lzma' compression format for distribution archives has been
+    deprecated in favor of `xz' and `lzip'.
+
+  - The `--acdir' option of aclocal is deprecated, and will probably be
+    removed in the next major Automake release (1.12). [FIXME]
+
+  - The exact order in which the directories in the aclocal macro
+    search path are looked up is probably going to be changed in the
+    next Automake release (1.12). [FIXME]
 
 * Miscellaneous changes:
 
@@ -67,6 +227,41 @@ New in 1.11.0a:
   - The last relics of Python 1.5 support have been removed from the
     AM_PATH_PYTHON macro.
 
+Bugs fixed in 1.11.2a:
+
+* Long-standing bugs:
+
+  - The "deleted header file problem" for *.am files is avoided by stub
+    rules.  This allows `make' to trigger a rerun of `automake' also if
+    some previously needed `.am' file has been removed.
+
+  - The `silent-rules' option now generates working makefiles even
+    for the uncommon `make' implementations that do not support the
+    nested-variables extension to POSIX 2008.  For such `make'
+    implementations, whether a build is silent is determined at
+    configure time, and cannot be overridden at make time with
+    `make V=0' or `make V=1'.
+
+  - Vala support now works better in VPATH setups.
+
+\f
+New in 1.11.2:
+
+* Changes to aclocal:
+
+  - The `--acdir' option is deprecated.  Now you should use the new options
+    `--automake-acdir' and `--system-acdir' instead.
+
+  - The `ACLOCAL_PATH' environment variable is now interpreted as a
+    colon-separated list of additional directories to search after the
+    automake internal acdir (by default ${prefix}/share/aclocal-APIVERSION)
+    and before the system acdir (by default ${prefix}/share/aclocal).
+
+* Miscellaneous changes:
+
+  - The Automake support for automatic de-ANSI-fication has been
+    deprecated.
+
   - The `lzma' compression scheme and associated automake option `dist-lzma'
     is obsoleted by `xz' and `dist-xz' due to upstream changes.
 
@@ -75,6 +270,9 @@ New in 1.11.0a:
     specify a different level via the XZ_OPT and BZIP2 envvars respectively.
     E.g., "make dist-xz XZ_OPT=-7" or "make dist-bzip2 BZIP2=-5"
 
+  - The `compile' script now converts some options for MSVC for a better
+    user experience.  Similarly, the new `ar-lib' script wraps Microsoft lib.
+
   - The py-compile script now accepts empty arguments passed to the options
     `--destdir' and `--basedir', and complains about unrecognized options.
     Moreover, a non-option argument or a special `--' argument terminates
@@ -88,6 +286,11 @@ New in 1.11.0a:
     user; still, the old Makefile.am files that used to define it will
     still continue to work as before.
 
+  - New macro AM_PROG_AR that looks for an archiver and wraps it in the new
+    'ar-lib' auxiliary script if the selected archiver is Microsoft lib.
+    This new macro is required for LIBRARIES and LTLIBRARIES when automake
+    is run with -Wextra-portability and -Werror.
+
   - When using DejaGnu-based testsuites, the user can extend the `site.exp'
     file generated by automake-provided rules by defining the special make
     variable `$(EXTRA_DEJAGNU_SITE_CONFIG)'.
@@ -96,12 +299,7 @@ New in 1.11.0a:
     the `${infodir}/dir' file, by exporting the new environment variable
     `AM_UPDATE_INFO_DIR' to the value "no".
 
-  - For programs and libraries, automake now detects EXTRA_foo_DEPENDENCIES
-    and adds them to the normal list of dependencies, but without
-    overwriting the foo_DEPENDENCIES variable, which is normally computed
-    by automake.
-
-Bugs fixed in 1.11.0a:
+Bugs fixed in 1.11.2:
 
 * Bugs introduced by 1.11.2:
 
@@ -110,14 +308,11 @@ Bugs fixed in 1.11.0a:
 
 * Bugs introduced by 1.11:
 
-  - The parallel-tests harness doesn't trip anymore on sed implementations
-    with stricter limits on the length of input lines (problem seen at
-    least on Solaris 8).
+  - The parallel-tests driver no longer produces erroneous results with
+    Tru64/OSF 5.1 sh upon unreadable log files.
 
-  - The `parallel-tests' test driver works around a GNU make 3.80 bug with
-    trailing white space in the test list (`TESTS = foo $(EMPTY)'), and
-    does not report spurious successes when used with concurrent FreeBSD
-    make (e.g., "make check -j3").
+  - The `parallel-tests' test driver does not report spurious successes
+    when used with concurrent FreeBSD make (e.g., "make check -j3").
 
   - When the parallel-tests driver is in use, automake now explicitly
     rejects invalid entries and conditional contents in TEST_EXTENSIONS,
@@ -131,23 +326,14 @@ Bugs fixed in 1.11.0a:
     not used, `make' output no longer contains spurious backslash-only
     lines, thus once again matching what Automake did before 1.11.
 
-  - The `silent-rules' option now generates working makefiles even for
-    the uncommon `make' implementations that do not support the
-    nested-variables extension to POSIX 2008.  For such `make'
-    implementations, whether a build is silent is determined at
-    configure time, and cannot be overridden at make time with
-    `make V=0' or `make V=1'.
-
-  - The AM_COND_IF macro also works if the shell expression for the conditional
-    is no longer valid for the condition.
+  - The AM_COND_IF macro also works if the shell expression for the
+    conditional is no longer valid for the condition.
 
 * Long-standing bugs:
 
-  - Vala support now works better in VPATH setups.
-
-  - The "deleted header file problem" for *.am files is avoided by stub
-    rules.  This allows `make' to trigger a rerun of `automake' also if
-    some previously needed `.am' file has been removed.
+  - The order of Yacc and Lex flags is fixed to be consistent with other
+    languages: $(AM_YFLAGS) comes before $(YFLAGS), and $(AM_LFLAGS) before
+    $(LFLAGS), so that the user variables override the developer variables.
 
   - "make distcheck" now correctly complains also when "make uninstall"
     leaves one and only one file installed in $(prefix).
@@ -159,17 +345,9 @@ Bugs fixed in 1.11.0a:
   - Automake now warns about more primary/directory invalid combinations,
     such as "doc_LIBRARIES" or "pkglib_PROGRAMS".
 
-  - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python'
-    even if the `--prefix' argument pointed outside of a system directory.
-    AM_PATH_PYTHON has been fixed to ignore the value returned from python's
-    `get_python_lib' function if it points outside the configured prefix,
-    unless the `--prefix' argument was either `/usr' or below `/System'.
-
-  - The testsuite does not try to change the mode of `ltmain.sh' files from
-    a Libtool installation (symlinked to test directories) any more.
-
-  - AM_PROG_GCJ uses AC_CHECK_TOOLS to look for `gcj' now, so that prefixed
-    tools are preferred in a cross-compile setup.
+  - Rules generated by Automake now try harder to not change any files when
+    `make -n' is invoked.  Fixes include compilation of Emacs Lisp, Vala, or
+    Yacc source files and the rule to update config.h.
 
   - Several scripts and the parallel-tests testsuite driver now exit with
     the right exit status upon receiving a signal.
@@ -177,21 +355,10 @@ Bugs fixed in 1.11.0a:
   - A per-Makefile.am setting of -Werror does not erroneously carry over
     to the handling of other Makefile.am files.
 
-  - The order of Yacc and Lex flags is now consistent with that of other
-    languages: $(AM_YFLAGS) comes before $(YFLAGS), and $(AM_LFLAGS) before
-    $(LFLAGS), so that the user variables override the developer variables.
-
-  - Rules generated by Automake now try harder not to change any files when
-    `make -n' is invoked.  Fixes include compilation of Emacs Lisp, Vala, or
-    Yacc source files and the rule to update config.h.
-
   - The code for automatic dependency tracking works around a Solaris
     make bug triggered by sources containing repeated slashes when the
     `subdir-objects' option was used.
 
-  - The parallel-tests driver no longer produces erroneous results with
-    Tru64/OSF 5.1 sh upon unreadable log files.
-
   - The makedepend and hp depmodes now work better with VPATH builds.
 
   - Java sources specified with check_JAVA are no longer compiled for
@@ -209,6 +376,34 @@ Bugs fixed in 1.11.0a:
     change its behaviour; this has proven to be frail and easy to
     regress.
 \f
+Bugs fixed in 1.11.1:
+
+  - Lots of minor bugfixes.
+
+* Bugs introduced by 1.11:
+
+  - The `parallel-tests' test driver works around a GNU make 3.80 bug with
+    trailing white space in the test list (`TESTS = foo $(EMPTY)').
+
+* Long standing bugs:
+
+  - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python'
+    even if the `--prefix' argument pointed outside of a system directory.
+    AM_PATH_PYTHON has been fixed to ignore the value returned from python's
+    `get_python_lib' function if it points outside the configured prefix,
+    unless the `--prefix' argument was either `/usr' or below `/System'.
+
+  - The testsuite does not try to change the mode of `ltmain.sh' files from
+    a Libtool installation (symlinked to test directories) any more.
+
+  - AM_PROG_GCJ uses AC_CHECK_TOOLS to look for `gcj' now, so that prefixed
+    tools are preferred in a cross-compile setup.
+
+  - The distribution is tarred up with mode 755 now by the `dist*' targets.
+    This fixes a race condition where untrusted users could modify files
+    in the $(PACKAGE)-$(VERSION) distdir before packing if the toplevel
+    build directory was world-searchable.  This is CVE-2009-4029.
+\f
 New in 1.11:
 
 * Version requirements:
diff --git a/THANKS b/THANKS
index b512b6b..3d1f75a 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -69,7 +69,9 @@ danbp                 danpb@nospam.postmaster.co.uk
 Daniel Jacobowitz      drow@false.org
 Daniel Kahn Gillmor    dkg@fifthhorseman.net
 Daniel Richard G.      skunk@iskunk.org
+Debarshi Ray           rishi@gnu.org
 Dave Brolley           brolley@redhat.com
+Dave Hart              davehart@gmail.com
 Dave Korn              dave.korn.cygwin@googlemail.com
 Dave Morrison          dave@bnl.gov
 David A. Swierczek     swiercze@mr.med.ge.com
@@ -150,6 +152,7 @@ Jared Davis         abiword@aiksaurus.com
 Jason Duell            jcduell@lbl.gov
 Jason Molenda          crash@cygnus.co.jp
 Jeff Bailey            Jbailey@phn.ca
+Jeff A. Daily          jeff.daily@pnl.gov
 Jeff Garzik            jgarzik@pobox.com
 Jeff Squyres           jsquyres@lam-mpi.org
 Jens Elkner            elkner@imsgroup.de
@@ -316,6 +319,7 @@ Roberto Bagnara             bagnara@cs.unipr.it
 Roman Fietze           roman.fietze@telemotive.de
 Ronald Landheer                ronald@landheer.com
 Roumen Petrov          bugtrack@roumenpetrov.info
+Russ Allbery           rra@stanford.edu
 Rusty Ballinger                rusty@rlyeh.engr.sgi.com
 Ryan Lortie            desrt@desrt.ca
 Ryan T. Sammartino     ryants@shaw.ca
index ed1d8d9..8cffe71 100644 (file)
@@ -187,8 +187,7 @@ sub check_acinclude ()
   foreach my $key (keys %map)
     {
       # FIXME: should print line number of acinclude.m4.
-      msg ('syntax', "warning: macro `$key' defined in "
-          . "acinclude.m4 but never used")
+      msg ('syntax', "macro `$key' defined in acinclude.m4 but never used")
        if $map{$key} eq 'acinclude.m4' && ! exists $macro_seen{$key};
     }
 }
@@ -439,7 +438,7 @@ sub scan_configure_dep ($)
          # Make this just a warning, because we do not know whether
          # the macro is actually used (it could be called conditionally).
          msg ('unsupported', "$file:$line",
-              "warning: macro `$2' not found in library");
+              "macro `$2' not found in library");
        }
     }
 
@@ -511,7 +510,7 @@ sub scan_file ($$$)
          if ($number !~ /$serial_number_rx/go)
            {
              msg ('syntax', "$file:$.",
-                  "warning: ill-formed serial number `$number', "
+                  "ill-formed serial number `$number', "
                   . "expecting a version string with only digits and dots");
            }
          elsif ($defun_seen)
@@ -563,8 +562,8 @@ sub scan_file ($$$)
          $defun_seen = 1;
          if (! defined $1)
            {
-             msg ('syntax', "$file:$.", "warning: underquoted definition of $2"
-                  . "\n  run info '(automake)Extending aclocal'\n"
+             msg ('syntax', "$file:$.", "underquoted definition of $2"
+                  . "\n  run info Automake 'Extending aclocal'\n"
                   . "  or see http://www.gnu.org/software/automake/manual/"
                   . "automake.html#Extending-aclocal")
                unless $underquoted_manual_once;
@@ -875,7 +874,7 @@ sub usage ($)
 {
   my ($status) = @_;
 
-  print "Usage: aclocal [OPTIONS] ...
+  print "Usage: aclocal [OPTION]...
 
 Generate `aclocal.m4' by scanning `configure.ac' or `configure.in'
 
@@ -883,7 +882,7 @@ Options:
       --automake-acdir=DIR  directory holding automake-provided m4 files
       --system-acdir=DIR    directory holding third-party system-wide files
       --diff[=COMMAND]      run COMMAND [diff -u] on M4 files that would be
-                              changed (implies --install and --dry-run)
+                            changed (implies --install and --dry-run)
       --dry-run             pretend to, but do not actually update any file
       --force               always update output file
       --help                print this help, then exit
@@ -981,7 +980,7 @@ sub parse_arguments ()
   if ($install && !@user_includes)
     {
       fatal ("--install should copy macros in the directory indicated by the"
-            . "\nfirst -I option, but no -I was supplied.");
+            . "\nfirst -I option, but no -I was supplied");
     }
 
   # Finally, adds any directory listed in the `dirlist' file.
@@ -1036,7 +1035,7 @@ my $loop = 0;
 while (1)
   {
     ++$loop;
-    prog_error "Too many loops." if $loop > 2;
+    prog_error "too many loops" if $loop > 2;
 
     reset_maps;
     scan_m4_files;
index cdbb820..98ec2bb 100644 (file)
@@ -53,7 +53,6 @@ struct (# Short name of the language (c, f77...).
        # List of configure variables which must be defined.
        'config_vars' => '@',
 
-       'ansi'    => "\$",
        # `pure' is `1' or `'.  A `pure' language is one where, if
        # all the files in a directory are of that language, then we
        # do not require the C compiler or any code to call it.
@@ -208,8 +207,6 @@ my $INCLUDE_PATTERN = ('^include\s+'
                       . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')'
                       . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$");
 
-# Match `-d' as a command-line argument in a string.
-my $DASH_D_PATTERN = "(^|\\s)-d(\\s|\$)";
 # Directories installed during 'install-exec' phase.
 my $EXEC_DIR_PATTERN =
   '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$";
@@ -235,9 +232,9 @@ my @libtool_sometimes = qw(ltconfig ltcf-c.sh ltcf-cxx.sh ltcf-gcj.sh);
 my @common_files =
     (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB
        COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO
-       ansi2knr.1 ansi2knr.c compile config.guess config.rpath config.sub
-       depcomp elisp-comp install-sh libversion.in mdate-sh missing
-       mkinstalldirs py-compile texinfo.tex ylwrap),
+       ar-lib compile config.guess config.rpath
+       config.sub depcomp elisp-comp install-sh libversion.in mdate-sh
+       missing mkinstalldirs py-compile texinfo.tex ylwrap),
      @libtool_files, @libtool_sometimes);
 
 # Commonly used files we auto-include, but only sometimes.  This list
@@ -330,10 +327,6 @@ my @config_headers = ();
 # Names used in AC_CONFIG_LINKS call.
 my @config_links = ();
 
-# Directory where output files go.  Actually, output files are
-# relative to this directory.
-my $output_directory;
-
 # List of Makefile.am's to process, and their corresponding outputs.
 my @input_files = ();
 my %output_files = ();
@@ -393,8 +386,8 @@ my $package_version = '';
 # Where version is defined.
 my $package_version_location;
 
-# TRUE if we've seen AM_ENABLE_MULTILIB.
-my $seen_multilib = 0;
+# TRUE if we've seen AM_PROG_AR
+my $seen_ar = 0;
 
 # TRUE if we've seen AM_PROG_CC_C_O
 my $seen_cc_c_o = 0;
@@ -477,9 +470,8 @@ my %required_targets =
    'install-man' => 1,
   );
 
-# Set to 1 if this run will create the Makefile.in that distributes
-# the files in config_aux_dir.
-my $automake_will_process_aux_dir = 0;
+# Queue to push require_conf_file requirements to.
+my $required_conf_file_queue;
 
 # The name of the Makefile currently being processed.
 my $am_file = 'BUG';
@@ -574,12 +566,6 @@ my @dist_targets;
 my %known_programs;
 my %known_libraries;
 
-# Keys in this hash are the basenames of files which must depend on
-# ansi2knr.  Values are either the empty string, or the directory in
-# which the ANSI source file appears; the directory must have a
-# trailing `/'.
-my %de_ansi_files;
-
 # This keeps track of which extensions we've seen (that we care
 # about).
 my %extension_seen;
@@ -603,9 +589,9 @@ my %linkers_used;
 # True if we need `LINK' defined.  This is a hack.
 my $need_link;
 
-# Was get_object_extension run?
-# FIXME: This is a hack. a better switch should be found.
-my $get_object_extension_was_run;
+# Does the generated Makefile have to build some compiled object
+# (for binary programs, or plain or libtool libraries)?
+my $must_handle_compiled_objects;
 
 # Record each file processed by make_paragraphs.
 my %transformed_files;
@@ -705,8 +691,6 @@ sub initialize_per_input ()
     %known_programs = ();
     %known_libraries= ();
 
-    %de_ansi_files = ();
-
     %extension_seen = ();
 
     %language_scratch = ();
@@ -717,7 +701,7 @@ sub initialize_per_input ()
 
     $need_link = 0;
 
-    $get_object_extension_was_run = 0;
+    $must_handle_compiled_objects = 0;
 
     %transformed_files = ();
 }
@@ -731,7 +715,6 @@ sub initialize_per_input ()
 register_language ('name' => 'c',
                   'Name' => 'C',
                   'config_vars' => ['CC'],
-                  'ansi' => 1,
                   'autodep' => '',
                   'flags' => ['CFLAGS', 'CPPFLAGS'],
                   'ccer' => 'CC',
@@ -743,8 +726,7 @@ register_language ('name' => 'c',
                   'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'compile_flag' => '-c',
                   'libtool_tag' => 'CC',
-                  'extensions' => ['.c'],
-                  '_finish' => \&lang_c_finish);
+                  'extensions' => ['.c']);
 
 # C++.
 register_language ('name' => 'cxx',
@@ -901,10 +883,7 @@ register_language ('name' => 'asm',
                   'compiler' => 'CCASCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
-                  'extensions' => ['.s'],
-
-                  # With assembly we still use the C linker.
-                  '_finish' => \&lang_c_finish);
+                  'extensions' => ['.s']);
 
 # Preprocessed Assembler.
 register_language ('name' => 'cppasm',
@@ -918,10 +897,7 @@ register_language ('name' => 'cppasm',
                   'compiler' => 'CPPASCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
-                  'extensions' => ['.S', '.sx'],
-
-                  # With assembly we still use the C linker.
-                  '_finish' => \&lang_c_finish);
+                  'extensions' => ['.S', '.sx']);
 
 # Fortran 77
 register_language ('name' => 'f77',
@@ -1210,11 +1186,25 @@ sub define_verbose_tagvar ($)
     my ($name) = @_;
     if (option 'silent-rules')
       {
-       define_verbose_var ($name, '@echo "  '. $name . ' ' x (6 - length ($name)) . '" $@;');
+       define_verbose_var ($name, '@echo "  '. $name . ' ' x (8 - length ($name)) . '" $@;');
        define_verbose_var ('at', '@');
       }
 }
 
+# define_verbose_texinfo
+# ----------------------
+# Engage the needed `silent-rules' machinery for assorted texinfo commands.
+sub define_verbose_texinfo ()
+{
+  my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF');
+  foreach my $tag (@tagvars)
+    {
+      define_verbose_tagvar($tag);
+    }
+  define_verbose_var('texinfo', '-q');
+  define_verbose_var('texidevnull', '> /dev/null');
+}
+
 # define_verbose_libtool
 # ----------------------
 # Engage the needed `silent-rules' machinery for `libtool --silent'.
@@ -1239,12 +1229,10 @@ sub handle_options
          msg_var ('unsupported', $var,
                   "`AUTOMAKE_OPTIONS' cannot have conditional contents");
        }
-      foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE,
-                                                         location => 1))
-       {
-         my ($loc, $value) = @$locvals;
-         return 1 if (process_option_list ($loc, $value))
-       }
+      my @options = map { { option => $_->[1], where => $_->[0] } }
+                       $var->value_as_list_recursive (cond_filter => TRUE,
+                                                      location => 1);
+      return 1 if process_option_list (@options);
     }
 
   # Override portability-recursive warning.
@@ -1281,22 +1269,6 @@ sub shadow_unconditionally ($$)
   return "\$($varname)"
 }
 
-# get_object_extension ($EXTENSION)
-# ---------------------------------
-# Prefix $EXTENSION with $U if ansi2knr is in use.
-sub get_object_extension ($)
-{
-    my ($extension) = @_;
-
-    # Check for automatic de-ANSI-fication.
-    $extension = '$U' . $extension
-      if option 'ansi2knr';
-
-    $get_object_extension_was_run = 1;
-
-    return $extension;
-}
-
 # check_user_variables (@LIST)
 # ----------------------------
 # Make sure each variable VAR in @LIST does not exist, suggest using AM_VAR
@@ -1316,7 +1288,7 @@ sub check_user_variables (@)
                  msg_cond_var ('gnu', $cond, $flag,
                                "`$flag' is a user variable, "
                                . "you should not override it;\n"
-                               . "use `AM_$flag' instead.");
+                               . "use `AM_$flag' instead");
                }
            }
        }
@@ -1521,97 +1493,6 @@ sub handle_languages
                unless $depbase eq '';
            $depbase .= '$(DEPDIR)/' . basename ($obj);
 
-           # Support for deansified files in subdirectories is ugly
-           # enough to deserve an explanation.
-           #
-           # A Note about normal ansi2knr processing first.  On
-           #
-           #   AUTOMAKE_OPTIONS = ansi2knr
-           #   bin_PROGRAMS = foo
-           #   foo_SOURCES = foo.c
-           #
-           # we generate rules similar to:
-           #
-           #   foo: foo$U.o; link ...
-           #   foo$U.o: foo$U.c; compile ...
-           #   foo_.c: foo.c; ansi2knr ...
-           #
-           # this is fairly compact, and will call ansi2knr depending
-           # on the value of $U (`' or `_').
-           #
-           # It's harder with subdir sources. On
-           #
-           #   AUTOMAKE_OPTIONS = ansi2knr
-           #   bin_PROGRAMS = foo
-           #   foo_SOURCES = sub/foo.c
-           #
-           # we have to create foo_.c in the current directory.
-           # (Unless the user asks 'subdir-objects'.)  This is important
-           # in case the same file (`foo.c') is compiled from other
-           # directories with different cpp options: foo_.c would
-           # be preprocessed for only one set of options if it were
-           # put in the subdirectory.
-           #
-           # Because foo$U.o must be built from either foo_.c or
-           # sub/foo.c we can't be as concise as in the first example.
-           # Instead we output
-           #
-           #   foo: foo$U.o; link ...
-           #   foo_.o: foo_.c; compile ...
-           #   foo.o: sub/foo.c; compile ...
-           #   foo_.c: foo.c; ansi2knr ...
-           #
-           # This is why we'll now transform $rule_file twice
-           # if we detect this case.
-           # A first time we output the compile rule with `$U'
-           # replaced by `_' and the source directory removed,
-           # and another time we simply remove `$U'.
-           #
-           # Note that at this point $source (as computed by
-           # &handle_single_transform) is `sub/foo$U.c'.
-           # This can be confusing: it can be used as-is when
-           # subdir-objects is set, otherwise you have to know
-           # it really means `foo_.c' or `sub/foo.c'.
-           my $objdir = dirname ($obj);
-           my $srcdir = dirname ($source);
-           if ($lang->ansi && $obj =~ /\$U/)
-             {
-               prog_error "`$obj' contains \$U, but `$source' doesn't."
-                 if $source !~ /\$U/;
-
-               (my $source_ = $source) =~ s/\$U/_/g;
-               # Output an additional rule if _.c and .c are not in
-               # the same directory.  (_.c is always in $objdir.)
-               if ($objdir ne $srcdir)
-                 {
-                   (my $obj_ = $obj) =~ s/\$U/_/g;
-                   (my $depbase_ = $depbase) =~ s/\$U/_/g;
-                   $source_ = basename ($source_);
-
-                   $output_rules .=
-                     file_contents ($rule_file,
-                                    new Automake::Location,
-                                    %transform,
-                                    GENERIC   => 0,
-
-                                    DEPBASE   => $depbase_,
-                                    BASE      => $obj_,
-                                    SOURCE    => $source_,
-                                    SOURCEFLAG => $sourceflags{$srcext} || '',
-                                    OBJ       => "$obj_$myext",
-                                    OBJOBJ    => "$obj_.obj",
-                                    LTOBJ     => "$obj_.lo",
-
-                                    COMPILE   => $obj_compile,
-                                    LTCOMPILE => $obj_ltcompile,
-                                    -o        => $output_flag,
-                                    %file_transform);
-                   $obj =~ s/\$U//g;
-                   $depbase =~ s/\$U//g;
-                   $source =~ s/\$U//g;
-                 }
-             }
-
            $output_rules .=
              file_contents ($rule_file,
                             new Automake::Location,
@@ -1767,7 +1648,7 @@ sub check_libobjs_sources
 #   $VAR is the name of the variable that the source filenames come from
 #   $TOPPARENT is the name of the _SOURCES variable which is being processed
 #   $DERIVED is the name of resulting executable or library
-#   $OBJ is the object extension (e.g., `$U.lo')
+#   $OBJ is the object extension (e.g., `.lo')
 #   $FILE the source file to transform
 #   %TRANSFORM contains extras arguments to pass to file_contents
 #     when producing explicit rules
@@ -1778,8 +1659,6 @@ sub handle_single_transform ($$$$$%)
     my ($var, $topparent, $derived, $obj, $_file, %transform) = @_;
     my @files = ($_file);
     my @result = ();
-    my $nonansi_obj = $obj;
-    $nonansi_obj =~ s/\$U//g;
 
     # Turn sources into objects.  We use a while loop like this
     # because we might add to @files in the loop.
@@ -1826,7 +1705,7 @@ sub handle_single_transform ($$$$$%)
        # language function.
        my $aggregate = 'AM';
 
-       $extension = &derive_suffix ($extension, $nonansi_obj);
+       $extension = &derive_suffix ($extension, $obj);
        my $lang;
        if ($extension_map{$extension} &&
            ($lang = $languages{$extension_map{$extension}}))
@@ -1837,7 +1716,7 @@ sub handle_single_transform ($$$$$%)
            # Do we have per-executable flags for this executable?
            my $have_per_exec_flags = 0;
            my @peflags = @{$lang->flags};
-           push @peflags, 'LIBTOOLFLAGS' if $nonansi_obj eq '.lo';
+           push @peflags, 'LIBTOOLFLAGS' if $obj eq '.lo';
            foreach my $flag (@peflags)
              {
                if (set_seen ("${derived}_$flag"))
@@ -1857,7 +1736,7 @@ sub handle_single_transform ($$$$$%)
            my $subr = \&{'lang_' . $lang->name . '_rewrite'};
            my ($r, $source_extension)
                = &$subr ($directory, $base, $extension,
-                         $nonansi_obj, $have_per_exec_flags, $var);
+                         $obj, $have_per_exec_flags, $var);
            # Skip this entry if we were asked not to process it.
            next if $r == LANG_IGNORE;
 
@@ -1870,13 +1749,9 @@ sub handle_single_transform ($$$$$%)
                $this_obj_ext = $source_extension;
                $derived_source = 1;
            }
-           elsif ($lang->ansi)
-           {
-               $this_obj_ext = $obj;
-           }
            else
            {
-               $this_obj_ext = $nonansi_obj;
+               $this_obj_ext = $obj;
            }
            $object = $base . $this_obj_ext;
 
@@ -1965,12 +1840,6 @@ sub handle_single_transform ($$$$$%)
                        $full_ansi = $base . $extension;
                  }
 
-               if ($lang->ansi && option 'ansi2knr')
-                 {
-                   $full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/;
-                   $obj_sans_ext .= '$U';
-                 }
-
                my @specifics = ($full_ansi, $obj_sans_ext,
                                 # Only use $this_obj_ext in the derived
                                 # source case because in the other case we
@@ -2002,7 +1871,7 @@ sub handle_single_transform ($$$$$%)
                      [@specifics, %transform]);
            }
        }
-       elsif ($extension eq $nonansi_obj)
+       elsif ($extension eq $obj)
        {
            # This is probably the result of a direct suffix rule.
            # In this case we just accept the rewrite.
@@ -2316,9 +2185,9 @@ sub handle_lib_objects
   my ($xname, $varname) = @_;
 
   my $var = var ($varname);
-  prog_error "handle_lib_objects: `$varname' undefined"
+  prog_error "`$varname' undefined"
     unless $var;
-  prog_error "handle_lib_objects: unexpected variable name `$varname'"
+  prog_error "unexpected variable name `$varname'"
     unless $varname =~ /^(.*)(?:LIB|LD)ADD$/;
   my $prefix = $1 || 'AM_';
 
@@ -2351,7 +2220,7 @@ sub handle_lib_objects
               # FIXME: should display a stack of nested variables
               # as context when $var != $subvar.
               err_var ($var, "linker flags such as `$val' belong in "
-                       . "`${prefix}LDFLAGS");
+                       . "`${prefix}LDFLAGS'");
             }
           return ();
         }
@@ -2511,8 +2380,7 @@ sub check_canonical_spelling
 # Set up the compile suite.
 sub handle_compile ()
 {
-    return
-      unless $get_object_extension_was_run;
+   return if ! $must_handle_compiled_objects;
 
     # Boilerplate.
     my $default_includes = '';
@@ -2561,38 +2429,6 @@ sub handle_compile ()
                                'DISTRMS' => join ("\n", @dist_rms)));
     $output_vars .= $vars;
     $output_rules .= "$coms$rules";
-
-    # Check for automatic de-ANSI-fication.
-    if (option 'ansi2knr')
-      {
-       my ($ansi2knr_filename, $ansi2knr_where) = @{option 'ansi2knr'};
-       my $ansi2knr_dir = '';
-
-       require_variables ($ansi2knr_where, "option `ansi2knr' is used",
-                          TRUE, "ANSI2KNR", "U");
-
-       # topdir is where ansi2knr should be.
-       if ($ansi2knr_filename eq 'ansi2knr')
-         {
-           # Only require ansi2knr files if they should appear in
-           # this directory.
-           require_file ($ansi2knr_where, FOREIGN,
-                         'ansi2knr.c', 'ansi2knr.1');
-
-           # ansi2knr needs to be built before subdirs, so unshift it
-           # rather then pushing it.
-           unshift (@all, '$(ANSI2KNR)');
-         }
-       else
-         {
-           $ansi2knr_dir = dirname ($ansi2knr_filename);
-         }
-
-       $output_rules .= &file_contents ('ansi2knr',
-                                        new Automake::Location,
-                                        'ANSI2KNR-DIR' => $ansi2knr_dir);
-
-    }
 }
 
 # handle_libtool ()
@@ -2633,6 +2469,7 @@ sub handle_programs
                                  'bin', 'sbin', 'libexec', 'pkglibexec',
                                  'noinst', 'check');
   return if ! @proglist;
+  $must_handle_compiled_objects = 1;
 
   my $seen_global_libobjs =
     var ('LDADD') && &handle_lib_objects ('', 'LDADD');
@@ -2642,7 +2479,7 @@ sub handle_programs
       my ($where, $one_file) = @$pair;
 
       my $seen_libobjs = 0;
-      my $obj = get_object_extension '.$(OBJEXT)';
+      my $obj = '.$(OBJEXT)';
 
       $known_programs{$one_file} = $where;
 
@@ -2723,6 +2560,7 @@ sub handle_libraries
   my @liblist = &am_install_var ('libs', 'LIBRARIES',
                                 'lib', 'pkglib', 'noinst', 'check');
   return if ! @liblist;
+  $must_handle_compiled_objects = 1;
 
   my @prefix = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib',
                                    'noinst', 'check');
@@ -2759,7 +2597,7 @@ sub handle_libraries
       $where->push_context ("while processing library `$onelib'");
       $where->set (INTERNAL->get);
 
-      my $obj = get_object_extension '.$(OBJEXT)';
+      my $obj = '.$(OBJEXT)';
 
       # Canonicalize names and check for misspellings.
       my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
@@ -2816,6 +2654,13 @@ sub handle_libraries
              &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
        }
+
+      if (! $seen_ar)
+       {
+         msg ('extra-portability', $where,
+              "`$onelib': linking libraries using a non-POSIX\n"
+              . "archiver requires `AM_PROG_AR' in `$configure_ac'")
+       }
     }
 }
 
@@ -2828,6 +2673,7 @@ sub handle_ltlibraries
   my @liblist = &am_install_var ('ltlib', 'LTLIBRARIES',
                                 'noinst', 'lib', 'pkglib', 'check');
   return if ! @liblist;
+  $must_handle_compiled_objects = 1;
 
   my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib',
                                    'noinst', 'check');
@@ -2896,7 +2742,7 @@ sub handle_ltlibraries
 
                   my $onlyone = ($dir ne $adir) ?
                     ("\nLibtool libraries can be built for only one "
-                     . "destination.") : "";
+                     . "destination") : "";
 
                   error ($liblocations{$val}{$acond},
                          "... and should also be $adirtxt$adircond.$onlyone");
@@ -2924,7 +2770,7 @@ sub handle_ltlibraries
       my ($where, $onelib) = @$pair;
 
       my $seen_libobjs = 0;
-      my $obj = get_object_extension '.lo';
+      my $obj = '.lo';
 
       # Canonicalize names and check for misspellings.
       my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
@@ -3054,6 +2900,13 @@ sub handle_ltlibraries
              &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
        }
+
+      if (! $seen_ar)
+       {
+         msg ('extra-portability', $where,
+              "`$onelib': linking libtool libraries using a non-POSIX\n"
+              . "archiver requires `AM_PROG_AR' in `$configure_ac'")
+       }
     }
 }
 
@@ -3073,7 +2926,7 @@ sub check_typos ()
 
          for my $cond ($var->conditions->conds)
            {
-             $varname =~ /^(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
+             $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
              msg_var ('syntax', $var, "variable `$varname' is defined but no"
                       . " program or\nlibrary has `$1' as canonical name"
                       . " (possible typo)")
@@ -3262,6 +3115,9 @@ sub output_texinfo_build_rules ($$$@)
 
   $output_rules .= file_contents ('texibuild',
                                  new Automake::Location,
+                                  AM_V_MAKEINFO    => verbose_flag('MAKEINFO'),
+                                  AM_V_TEXI2DVI    => verbose_flag('TEXI2DVI'),
+                                  AM_V_TEXI2PDF    => verbose_flag('TEXI2PDF'),
                                  DEPS             => "@deps",
                                  DEST_PREFIX      => $dpfx,
                                  DEST_INFO_PREFIX => $dipfx,
@@ -3271,12 +3127,15 @@ sub output_texinfo_build_rules ($$$@)
                                  GENERIC_INFO     => $generic_info,
                                  INSRC            => $insrc,
                                  MAKEINFOFLAGS    => $makeinfoflags,
+                                  SILENT           => silent_flag(),
                                  SOURCE           => ($generic
                                                       ? '$<' : $source),
                                  SOURCE_INFO      => ($generic_info
                                                       ? '$<' : $source),
                                  SOURCE_REAL      => $source,
                                  SOURCE_SUFFIX    => $ssfx,
+                                  TEXIQUIET        => verbose_flag('texinfo'),
+                                  TEXIDEVNULL      => verbose_flag('texidevnull'),
                                  );
   return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html");
 }
@@ -3585,6 +3444,7 @@ sub handle_texinfo ()
   my ($mostlyclean, $clean, $maintclean) = ('', '', '');
   if ($info_texinfos)
     {
+      define_verbose_texinfo;
       ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
       chomp $mostlyclean;
       chomp $clean;
@@ -3593,10 +3453,12 @@ sub handle_texinfo ()
 
   $output_rules .=  file_contents ('texinfos',
                                   new Automake::Location,
+                                   AM_V_DVIPS    => verbose_flag('DVIPS'),
                                   MOSTLYCLEAN   => $mostlyclean,
                                   TEXICLEAN     => $clean,
                                   MAINTCLEAN    => $maintclean,
-                                  'LOCAL-TEXIS' => !!$info_texinfos);
+                                  'LOCAL-TEXIS' => !!$info_texinfos,
+                                   TEXIQUIET     => verbose_flag('texinfo'));
 }
 
 
@@ -3753,6 +3615,7 @@ sub handle_tags
 {
     my @tag_deps = ();
     my @ctag_deps = ();
+    my @cscope_deps = ();
     if (var ('SUBDIRS'))
     {
        $output_rules .= ("tags-recursive:\n"
@@ -3776,6 +3639,17 @@ sub handle_tags
        push (@ctag_deps, 'ctags-recursive');
        &depend ('.PHONY', 'ctags-recursive');
        &depend ('.MAKE', 'ctags-recursive');
+
+       $output_rules .= ("cscopelist-recursive:\n"
+                         . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n"
+                         # Never fail here if a subdir fails; it
+                         # isn't important.
+                         . "\t  test \"\$\$subdir\" = . || (\$(am__cd) \$\$subdir"
+                         . " && \$(MAKE) \$(AM_MAKEFLAGS) cscopelist); \\\n"
+                         . "\tdone\n");
+       push (@cscope_deps, 'cscopelist-recursive');
+       &depend ('.PHONY', 'cscopelist-recursive');
+       &depend ('.MAKE', 'cscopelist-recursive');
     }
 
     if (&saw_sources_p (1)
@@ -3798,13 +3672,14 @@ sub handle_tags
                                         new Automake::Location,
                                         CONFIG    => "@config",
                                         TAGSDIRS  => "@tag_deps",
-                                        CTAGSDIRS => "@ctag_deps");
+                                        CTAGSDIRS => "@ctag_deps",
+                                        CSCOPEDIRS => "@cscope_deps");
 
        set_seen 'TAGS_DEPENDENCIES';
     }
     elsif (reject_var ('TAGS_DEPENDENCIES',
-                      "doesn't make sense to define `TAGS_DEPENDENCIES'"
-                      . "without\nsources or `ETAGS_ARGS'"))
+                      "it doesn't make sense to define `TAGS_DEPENDENCIES'"
+                      . " without\nsources or `ETAGS_ARGS'"))
     {
     }
     else
@@ -3813,18 +3688,9 @@ sub handle_tags
        # Otherwise, it would be possible for a top-level "make TAGS"
        # to fail because some subdirectory failed.
        $output_rules .= "tags: TAGS\nTAGS:\n\n";
-       # Ditto ctags.
+       # Ditto ctags and cscope.
        $output_rules .= "ctags: CTAGS\nCTAGS:\n\n";
-    }
-}
-
-# Handle multilib support.
-sub handle_multilib
-{
-  if ($seen_multilib && $relative_dir eq '.')
-    {
-      $output_rules .= &file_contents ('multilib', new Automake::Location);
-      push (@all, 'all-multi');
+       $output_rules .= "cscope cscopelist:\n\n";
     }
 }
 
@@ -3926,7 +3792,7 @@ sub handle_dist ()
       $archive_defined ||=
        grep { option "dist-$_" } qw(shar zip tarZ bzip2 lzip lzma xz);
       error (option 'no-dist-gzip',
-            "no-dist-gzip specified but no dist-* specified, "
+            "no-dist-gzip specified but no dist-* specified,\n"
             . "at least one archive format must be enabled")
        unless $archive_defined;
     }
@@ -3965,12 +3831,19 @@ sub handle_dist ()
   # directory, we would have discovered it already, so we don't
   # check that.  But if the file is in a subdir without a Makefile,
   # we want to distribute it here if we are doing `.'.  Ugly!
+  # Also, in some corner cases, it's possible that the following code
+  # will cause the same file to appear in the $(DIST_COMMON) variables
+  # of two distinct Makefiles; but this is not a problem, since the
+  # `distdir' target in `lib/am/distdir.am' can deal with the same
+  # file being distributed multiple times.
+  # See also automake bug#9651.
   if ($relative_dir eq '.')
     {
       foreach my $file (split (' ' , $configure_dist_common))
        {
+         my $dir = dirname ($file);
          push_dist_common ($file)
-           unless is_make_dir (dirname ($file));
+           if ($dir eq '.' || ! is_make_dir ($dir));
        }
     }
 
@@ -4011,16 +3884,17 @@ sub handle_dist ()
 }
 
 
-# check_directory ($NAME, $WHERE)
-# -------------------------------
-# Ensure $NAME is a directory, and that it uses a sane name.
-# Use $WHERE as a location in the diagnostic, if any.
-sub check_directory ($$)
+# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."])
+# -------------------------------------------------------
+# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane
+# name.  Use $WHERE as a location in the diagnostic, if any.
+sub check_directory ($$;$)
 {
-  my ($dir, $where) = @_;
+  my ($dir, $where, $reldir) = @_;
+  $reldir = '.' unless defined $reldir;
 
-  error $where, "required directory $relative_dir/$dir does not exist"
-    unless -d "$relative_dir/$dir";
+  error $where, "required directory $reldir/$dir does not exist"
+    unless -d "$reldir/$dir";
 
   # If an `obj/' directory exists, BSD make will enter it before
   # reading `Makefile'.  Hence the `Makefile' in the current directory
@@ -4059,7 +3933,7 @@ sub check_directories_in_var ($)
     (sub
      {
        my ($var, $val, $cond, $full_cond) = @_;
-       check_directory ($val, $var->rdef ($cond)->location);
+       check_directory ($val, $var->rdef ($cond)->location, $relative_dir);
        return ();
      },
      undef,
@@ -4113,7 +3987,7 @@ sub scan_aclocal_m4 ()
       push (@ac_deps, '$(ACLOCAL_M4_SOURCES)');
       msg_var ('obsolete', 'ACLOCAL_M4_SOURCES',
               "`ACLOCAL_M4_SOURCES' is obsolete.\n"
-              . "It should be safe to simply remove it.");
+              . "It should be safe to simply remove it");
     }
 
   # Note that it might be possible that aclocal.m4 doesn't exist but
@@ -4925,6 +4799,58 @@ sub handle_tests_dejagnu
     $output_rules .= file_contents ('dejagnu', new Automake::Location);
 }
 
+sub handle_per_suffix_test
+{
+  my ($test_suffix, %transform) = @_;
+  my ($pfx, $generic, $parallel_tests_option, $am_exeext);
+  prog_error ("called with 'parallel-tests' option not set")
+    unless $parallel_tests_option = option 'parallel-tests';
+  if ($test_suffix eq '')
+    {
+      $pfx = '';
+      $generic = 0;
+      $am_exeext = 'FALSE';
+    }
+  else
+    {
+      prog_error ("test suffix `$test_suffix' lacks leading dot")
+        unless $test_suffix =~ m/^\.(.*)/;
+      $pfx = uc ($1) . '_';
+      $generic = 1;
+      $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT'
+                                                    : 'FALSE';
+    }
+  # The "test driver" program, deputed to handle tests protocol used by
+  # test scripts.  By default, it's assumed that no protocol is used,
+  # so we fall back to the old "parallel-tests" behaviour, implemented
+  # by the `test-driver' auxiliary script.
+  if (! var "${pfx}LOG_DRIVER")
+    {
+      require_conf_file ($parallel_tests_option->{position}, FOREIGN,
+                        'test-driver');
+      define_variable ("${pfx}LOG_DRIVER",
+                       "\$(SHELL) $am_config_aux_dir/test-driver",
+                       INTERNAL);
+    }
+  my $driver = '$(' . $pfx . 'LOG_DRIVER)';
+  my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)'
+                       . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)';
+  my $compile = "${pfx}LOG_COMPILE";
+  define_variable ($compile,
+                   '$(' . $pfx . 'LOG_COMPILER)'
+                      . ' $(AM_' .  $pfx . 'LOG_FLAGS)'
+                      . ' $(' . $pfx . 'LOG_FLAGS)',
+                     INTERNAL);
+  $output_rules .= file_contents ('check2', new Automake::Location,
+                                   GENERIC => $generic,
+                                   DRIVER => $driver,
+                                   DRIVER_FLAGS => $driver_flags,
+                                   COMPILE => '$(' . $compile . ')',
+                                   EXT => $test_suffix,
+                                   am__EXEEXT => $am_exeext,
+                                   %transform);
+}
+
 # is_valid_test_extension ($EXT)
 # ------------------------------
 # Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
@@ -4970,7 +4896,7 @@ sub handle_tests
       append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
        if (var ('XFAIL_TESTS'));
 
-      if (option 'parallel-tests')
+      if (my $parallel_tests = option 'parallel-tests')
         {
          define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
          my $suff = '.test';
@@ -5030,17 +4956,12 @@ sub handle_tests
                    return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log'
                      if substr ($obj, - length ($test_suffix)) eq $test_suffix;
                  }
+               my $base = $obj;
                $obj .= '.log';
-               my $compile = 'LOG_COMPILE';
-               define_variable ($compile,
-                                '$(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)', INTERNAL);
-               $output_rules .= file_contents ('check2', new Automake::Location,
-                                               GENERIC => 0,
-                                               OBJ => $obj,
-                                               SOURCE => $val,
-                                               COMPILE =>'$(' . $compile . ')',
-                                               EXT => '',
-                                               am__EXEEXT => 'FALSE');
+                handle_per_suffix_test ('',
+                                        OBJ => $obj,
+                                        BASE => $base,
+                                        SOURCE => $val);
                return $obj;
              });
 
@@ -5066,27 +4987,14 @@ sub handle_tests
              $nhelper++;
              if ($test_suffix ne $at_exeext && $test_suffix ne '')
                {
-                 (my $ext = $test_suffix) =~ s/^\.//;
-                 $ext = uc $ext;
-                 my $compile = $ext . '_LOG_COMPILE';
-                 define_variable ($compile,
-                                  '$(' . $ext . '_LOG_COMPILER) $(AM_' .  $ext . '_LOG_FLAGS)'
-                                  . ' $(' . $ext . '_LOG_FLAGS)', INTERNAL);
-                 my $am_exeext = $handle_exeext ? 'am__EXEEXT' : 'FALSE';
-                 $output_rules .= file_contents ('check2', new Automake::Location,
-                                                 GENERIC => 1,
-                                                 OBJ => '',
-                                                 SOURCE => '$<',
-                                                 COMPILE => '$(' . $compile . ')',
-                                                 EXT => $test_suffix,
-                                                 am__EXEEXT => $am_exeext);
+                  handle_per_suffix_test ($test_suffix,
+                                          OBJ => '',
+                                          BASE => '$*',
+                                          SOURCE => '$<');
                }
            }
-
-         define_variable ('TEST_LOGS_TMP', '$(TEST_LOGS:.log=.log-t)', INTERNAL);
-
-         $clean_files{'$(TEST_LOGS_TMP)'} = MOSTLY_CLEAN;
          $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
+         $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN;
          $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
        }
     }
@@ -5304,11 +5212,11 @@ sub scan_autoconf_traces ($)
                AC_SUBST_TRACE => 1,
                AM_AUTOMAKE_VERSION => 1,
                AM_CONDITIONAL => 2,
-               AM_ENABLE_MULTILIB => 0,
                AM_GNU_GETTEXT => 0,
                AM_GNU_GETTEXT_INTL_SUBDIR => 0,
                AM_INIT_AUTOMAKE => 0,
                AM_MAINTAINER_MODE => 0,
+               AM_PROG_AR => 0,
                AM_PROG_CC_C_O => 0,
                AM_SILENT_RULES => 0,
                _AM_SUBST_NOTMAKE => 1,
@@ -5380,12 +5288,11 @@ sub scan_autoconf_traces ($)
          if ($seen_init_automake)
            {
              error ($where, "AC_CONFIG_AUX_DIR must be called before "
-                    . "AM_INIT_AUTOMAKE...", partial => 1);
+                    . "AM_INIT_AUTOMAKE ...", partial => 1);
              error ($seen_init_automake, "... AM_INIT_AUTOMAKE called here");
            }
          $config_aux_dir = $args[1];
          $config_aux_dir_set_in_configure_ac = 1;
-         $relative_dir = '.';
          check_directory ($config_aux_dir, $where);
        }
       elsif ($macro eq 'AC_CONFIG_FILES')
@@ -5405,7 +5312,6 @@ sub scan_autoconf_traces ($)
       elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR')
        {
          $config_libobj_dir = $args[1];
-         $relative_dir = '.';
          check_directory ($config_libobj_dir, $where);
        }
       elsif ($macro eq 'AC_CONFIG_LINKS')
@@ -5467,10 +5373,6 @@ sub scan_autoconf_traces ($)
        {
          $configure_cond{$args[1]} = $where;
        }
-      elsif ($macro eq 'AM_ENABLE_MULTILIB')
-       {
-         $seen_multilib = $where;
-       }
       elsif ($macro eq 'AM_GNU_GETTEXT')
        {
          $seen_gettext = $where;
@@ -5491,15 +5393,19 @@ sub scan_autoconf_traces ($)
            }
          elsif (defined $args[1])
            {
-             exit $exit_code
-               if (process_global_option_list ($where,
-                                               split (' ', $args[1])));
+             my @opts = split (' ', $args[1]);
+             @opts = map { { option => $_, where => $where } } @opts;
+             exit $exit_code if process_global_option_list (@opts);
            }
        }
       elsif ($macro eq 'AM_MAINTAINER_MODE')
        {
          $seen_maint_mode = $where;
        }
+      elsif ($macro eq 'AM_PROG_AR')
+       {
+         $seen_ar = $where;
+       }
       elsif ($macro eq 'AM_PROG_CC_C_O')
        {
          $seen_cc_c_o = $where;
@@ -5616,7 +5522,7 @@ sub scan_autoconf_files ()
              . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE,"
              . "\nthat aclocal.m4 is present in the top-level directory,\n"
              . "and that aclocal.m4 was recently regenerated "
-             . "(using aclocal).");
+             . "(using aclocal)");
     }
   else
     {
@@ -5627,7 +5533,7 @@ sub scan_autoconf_files ()
              error ($seen_init_automake,
                     "your implementation of AM_INIT_AUTOMAKE comes from " .
                     "an\nold Automake version.  You should recreate " .
-                    "aclocal.m4\nwith aclocal and run automake again.\n",
+                    "aclocal.m4\nwith aclocal and run automake again",
                     # $? = 63 is used to indicate version mismatch to missing.
                     exit_code => 63);
            }
@@ -5635,50 +5541,19 @@ sub scan_autoconf_files ()
            {
              error ($seen_init_automake,
                     "no proper implementation of AM_INIT_AUTOMAKE was " .
-                    "found,\nprobably because aclocal.m4 is missing...\n" .
+                    "found,\nprobably because aclocal.m4 is missing.\n" .
                     "You should run aclocal to create this file, then\n" .
-                    "run automake again.\n");
+                    "run automake again");
            }
        }
     }
 
   locate_aux_dir ();
 
-  # Reorder @input_files so that the Makefile that distributes aux
-  # files is processed last.  This is important because each directory
-  # can require auxiliary scripts and we should wait until they have
-  # been installed before distributing them.
-
-  # The Makefile.in that distribute the aux files is the one in
-  # $config_aux_dir or the top-level Makefile.
-  my $auxdirdist = is_make_dir ($config_aux_dir) ? $config_aux_dir : '.';
-  my @new_input_files = ();
-  while (@input_files)
-    {
-      my $in = pop @input_files;
-      my @ins = split (/:/, $output_files{$in});
-      if (dirname ($ins[0]) eq $auxdirdist)
-       {
-         push @new_input_files, $in;
-         $automake_will_process_aux_dir = 1;
-       }
-      else
-       {
-         unshift @new_input_files, $in;
-       }
-    }
-  @input_files = @new_input_files;
-
-  # If neither the auxdir/Makefile nor the ./Makefile are generated
-  # by Automake, we won't distribute the aux files anyway.  Assume
-  # the user know what (s)he does, and pretend we will distribute
-  # them to disable the error in require_file_internal.
-  $automake_will_process_aux_dir = 1 if ! is_make_dir ($auxdirdist);
-
   # Look for some files we need.  Always check for these.  This
   # check must be done for every run, even those where we are only
   # looking at a subdir Makefile.  We must set relative_dir for
-  # maybe_push_required_file to work.
+  # push_required_file to work.
   # Sort the files for stable verbose output.
   $relative_dir = '.';
   foreach my $file (sort keys %required_aux_file)
@@ -5777,13 +5652,7 @@ sub lang_sub_obj
 # Rewrite a single C source file.
 sub lang_c_rewrite
 {
-  my ($directory, $base, $ext, $nonansi_obj, $have_per_exec_flags, $var) = @_;
-
-  if (option 'ansi2knr' && $base =~ /_$/)
-    {
-      # FIXME: include line number in error.
-      err_am "C source file `$base.c' would be deleted by ansi2knr rules";
-    }
+  my ($directory, $base, $ext, $obj, $have_per_exec_flags, $var) = @_;
 
   my $r = LANG_PROCESS;
   if (option 'subdir-objects')
@@ -5800,24 +5669,14 @@ sub lang_c_rewrite
                   . "`AM_PROG_CC_C_O' in `$configure_ac'",
                   uniq_scope => US_GLOBAL,
                   uniq_part => 'AM_PROG_CC_C_O subdir')
-           unless $seen_cc_c_o || $nonansi_obj eq '.lo';
+           unless $seen_cc_c_o || $obj eq '.lo';
        }
-
-      # In this case we already have the directory information, so
-      # don't add it again.
-      $de_ansi_files{$base} = '';
-    }
-  else
-    {
-      $de_ansi_files{$base} = (($directory eq '.' || $directory eq '')
-                              ? ''
-                              : "$directory/");
     }
 
   if (! $seen_cc_c_o
       && $have_per_exec_flags
       && ! option 'subdir-objects'
-      && $nonansi_obj ne '.lo')
+      && $obj ne '.lo')
     {
       msg_var ('portability',
               $var, "compiling `$base.c' with per-target flags requires "
@@ -5956,59 +5815,6 @@ sub lang_java_rewrite
 # language, etc.  A finish function is only called if a source file of
 # the appropriate type has been seen.
 
-sub lang_c_finish
-{
-    # Push all libobjs files onto de_ansi_files.  We actually only
-    # push files which exist in the current directory, and which are
-    # genuine source files.
-    foreach my $file (keys %libsources)
-    {
-       if ($file =~ /^(.*)\.[cly]$/ && -f "$relative_dir/$file")
-       {
-           $de_ansi_files{$1} = ''
-       }
-    }
-
-    if (option 'ansi2knr' && keys %de_ansi_files)
-    {
-       # Make all _.c files depend on their corresponding .c files.
-       my @objects;
-       foreach my $base (sort keys %de_ansi_files)
-       {
-           # Each _.c file must depend on ansi2knr; otherwise it
-           # might be used in a parallel build before it is built.
-           # We need to support files in the srcdir and in the build
-           # dir (because these files might be auto-generated.  But
-           # we can't use $< -- some makes only define $< during a
-           # suffix rule.
-           my $ansfile = $de_ansi_files{$base} . $base . '.c';
-           $output_rules .= ($base . "_.c: $ansfile \$(ANSI2KNR)\n\t"
-                             . '$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) '
-                             . '`if test -f $(srcdir)/' . $ansfile
-                             . '; then echo $(srcdir)/' . $ansfile
-                             . '; else echo ' . $ansfile . '; fi` '
-                             . "| sed 's/^# \\([0-9]\\)/#line \\1/' "
-                             . '| $(ANSI2KNR) > $@'
-                             # If ansi2knr fails then we shouldn't
-                             # create the _.c file
-                             . " || rm -f \$\@\n");
-           push (@objects, $base . '_.$(OBJEXT)');
-           push (@objects, $base . '_.lo')
-             if var ('LIBTOOL');
-
-           # Explicitly clean the _.c files if they are in a
-           # subdirectory. (In the current directory they get erased
-           # by a `rm -f *_.c' rule.)
-           $clean_files{$base . '_.c'} = MOSTLY_CLEAN
-             if dirname ($base) ne '.';
-       }
-
-       # Make all _.o (and _.lo) files depend on ansi2knr.
-       # Use a sneaky little hack to make it print nicely.
-       &pretty_print_rule ('', '', @objects, ':', '$(ANSI2KNR)');
-    }
-}
-
 sub lang_vala_finish_target ($$)
 {
   my ($self, $name) = @_;
@@ -6127,18 +5933,49 @@ sub lang_yacc_target_hook
 {
     my ($self, $aggregate, $output, $input, %transform) = @_;
 
-    my $flag = $aggregate . "_YFLAGS";
-    my $flagvar = var $flag;
-    my $YFLAGSvar = var 'YFLAGS';
-    if (($flagvar && $flagvar->variable_value =~ /$DASH_D_PATTERN/o)
-       || ($YFLAGSvar && $YFLAGSvar->variable_value =~ /$DASH_D_PATTERN/o))
-    {
-       (my $output_base = $output) =~ s/$KNOWN_EXTENSIONS_PATTERN$//;
-       my $header = $output_base . '.h';
+    # If some relevant *YFLAGS variable contains the `-d' flag, we'll
+    # have to to generate special code.
+    my $yflags_contains_minus_d = 0;
+
+    foreach my $pfx ("", "${aggregate}_")
+      {
+       my $yflagsvar = var ("${pfx}YFLAGS");
+       next unless $yflagsvar;
+       # We cannot work reliably with conditionally-defined YFLAGS.
+       if ($yflagsvar->has_conditional_contents)
+         {
+           msg_var ('unsupported', $yflagsvar,
+                    "`${pfx}YFLAGS' cannot have conditional contents");
+         }
+       else
+         {
+           $yflags_contains_minus_d = 1
+             if grep (/^-d$/, $yflagsvar->value_as_list_recursive);
+         }
+      }
 
+    if ($yflags_contains_minus_d)
+      {
        # Found a `-d' that applies to the compilation of this file.
        # Add a dependency for the generated header file, and arrange
        # for that file to be included in the distribution.
+
+       # The extension of the output file (e.g., `.c' or `.cxx').
+       # We'll need it to compute the name of the generated header file.
+       (my $output_ext = basename ($output)) =~ s/.*(\.[^.]+)$/$1/;
+
+       # We know that a yacc input should be turned into either a C or
+       # C++ output file.  We depend on this fact (here and in yacc.am),
+       # so check that it really holds.
+       my $lang = $languages{$extension_map{$output_ext}};
+       prog_error "invalid output name `$output' for yacc file `$input'"
+         if (!$lang || ($lang->name ne 'c' && $lang->name ne 'cxx'));
+
+       (my $header_ext = $output_ext) =~ s/c/h/g;
+        # Quote $output_ext in the regexp, so that dots in it are taken
+        # as literal dots, not as metacharacters.
+       (my $header = $output) =~ s/\Q$output_ext\E$/$header_ext/;
+
        foreach my $cond (Automake::Rule::define (${header}, 'internal',
                                                  RULE_AUTOMAKE, TRUE,
                                                  INTERNAL))
@@ -6156,30 +5993,26 @@ sub lang_yacc_target_hook
        &push_dist_common ($header)
          if $transform{'DIST_SOURCE'};
 
-       # If the files are built in the build directory, then we want
-       # to remove them with `make clean'.  If they are in srcdir
-       # they shouldn't be touched.  However, we can't determine this
-       # statically, and the GNU rules say that yacc/lex output files
-       # should be removed by maintainer-clean.  So that's what we
-       # do.
-       $clean_files{$header} = MAINTAINER_CLEAN;
-    }
-    # Erase $OUTPUT on `make maintainer-clean' (by GNU standards).
+       # The GNU rules say that yacc/lex output files should be removed
+       # by maintainer-clean.  However, if the files are not distributed,
+       # then we want to remove them with "make clean"; otherwise,
+       # "make distcheck" will fail.
+       $clean_files{$header} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
+      }
     # See the comment above for $HEADER.
-    $clean_files{$output} = MAINTAINER_CLEAN;
+    $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
 }
 
 # This is a lex helper which is called whenever we have decided to
 # compile a lex file.
 sub lang_lex_target_hook
 {
-    my ($self, $aggregate, $output, $input) = @_;
-    # If the files are built in the build directory, then we want to
-    # remove them with `make clean'.  If they are in srcdir they
-    # shouldn't be touched.  However, we can't determine this
-    # statically, and the GNU rules say that yacc/lex output files
-    # should be removed by maintainer-clean.  So that's what we do.
-    $clean_files{$output} = MAINTAINER_CLEAN;
+    my ($self, $aggregate, $output, $input, %transform) = @_;
+    # The GNU rules say that yacc/lex output files should be removed
+    # by maintainer-clean.  However, if the files are not distributed,
+    # then we want to remove them with "make clean"; otherwise,
+    # "make distcheck" will fail.
+    $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
 }
 
 # This is a helper for both lex and yacc.
@@ -6311,8 +6144,6 @@ sub register_language (%)
   my (%option) = @_;
 
   # Set the defaults.
-  $option{'ansi'} = 0
-    unless defined $option{'ansi'};
   $option{'autodep'} = 'no'
     unless defined $option{'autodep'};
   $option{'linker'} = ''
@@ -6437,7 +6268,7 @@ sub cond_stack_if ($$$)
          my $mac = $_am_macro_for_cond{$cond};
          $text .= "\n  The usual way to define `$cond' is to add ";
          $text .= ($mac =~ / /) ? $mac : "`$mac'";
-         $text .= "\n  to `$configure_ac' and run `aclocal' and `autoconf' again.";
+         $text .= "\n  to `$configure_ac' and run `aclocal' and `autoconf' again";
          # These warnings appear in Automake files (depend2.am),
          # so there is no need to display them more than once:
          $scope = US_GLOBAL;
@@ -6569,22 +6400,11 @@ sub define_files_variable ($\@$$)
 sub define_configure_variable ($)
 {
   my ($var) = @_;
-
-  my $pretty = VAR_ASIS;
-  my $owner = VAR_CONFIGURE;
-
   # Some variables we do not want to output.  For instance it
   # would be a bad idea to output `U = @U@` when `@U@` can be
   # substituted as `\`.
-  $pretty = VAR_SILENT if exists $ignored_configure_vars{$var};
-
-  # ANSI2KNR is a variable that Automake wants to redefine, so
-  # it must be owned by Automake.  (It is also used as a proof
-  # that AM_C_PROTOTYPES has been run, that's why we do not simply
-  # omit the AC_SUBST.)
-  $owner = VAR_AUTOMAKE if $var eq 'ANSI2KNR';
-
-  Automake::Variable::define ($var, $owner, '', TRUE, subst $var,
+  my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
+  Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst $var,
                              '', $configure_vars{$var}, $pretty);
 }
 
@@ -7780,18 +7600,42 @@ sub locate_aux_dir ()
 }
 
 
-# &maybe_push_required_file ($DIR, $FILE, $FULLFILE)
+# &push_required_file ($DIR, $FILE, $FULLFILE)
 # --------------------------------------------------
-# See if we want to push this file onto dist_common.  This function
-# encodes the rules for deciding when to do so.
-sub maybe_push_required_file
+# Push the given file onto DIST_COMMON.
+sub push_required_file
 {
   my ($dir, $file, $fullfile) = @_;
 
+  # If the file to be distributed is in the same directory of the
+  # currently processed Makefile.am, then we want to distribute it
+  # from this same Makefile.am.
   if ($dir eq $relative_dir)
     {
       push_dist_common ($file);
-      return 1;
+    }
+  # This is needed to allow a construct in a non-top-level Makefile.am
+  # to require a file in the build-aux directory (see at least the test
+  # script `test-driver-is-distributed.test').  This is related to the
+  # automake bug#9546.  Note that the use of $config_aux_dir instead
+  # of $am_config_aux_dir here is deliberate and necessary.
+  elsif ($dir eq $config_aux_dir)
+    {
+      push_dist_common ("$am_config_aux_dir/$file");
+    }
+  # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support.
+  # We probably need some refactoring of this function and its callers,
+  # to have a more explicit and systematic handling of all the special
+  # cases; but, since there are only two of them, this is low-priority
+  # ATM.
+  elsif ($config_libobj_dir && $dir eq $config_libobj_dir)
+    {
+      # Avoid unsightly '/.'s.
+      my $am_config_libobj_dir =
+        '$(top_srcdir)' .
+        ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir");
+      $am_config_libobj_dir =~ s|/*$||;
+      push_dist_common ("$am_config_libobj_dir/$file");
     }
   elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
     {
@@ -7829,9 +7673,12 @@ sub maybe_push_required_file
        if $dir =~ m,^\.\.(?:$|/),;
 
       push_dist_common ($fullfile);
-      return 1;
     }
-  return 0;
+  else
+    {
+      prog_error "a Makefile in relative directory $relative_dir " .
+                 "can't add files in directory $dir to DIST_COMMON";
+    }
 }
 
 
@@ -7840,140 +7687,141 @@ sub maybe_push_required_file
 # than once.
 my %required_file_not_found = ();
 
-# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES)
-# --------------------------------------------------------------
+# &required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
+# --------------------------------------------------------
 # Verify that the file must exist in $DIRECTORY, or install it.
-# $MYSTRICT is the strictness level at which this file becomes required.
-sub require_file_internal ($$$@)
+sub required_file_check_or_copy ($$$)
 {
-  my ($where, $mystrict, $dir, @files) = @_;
+  my ($where, $dir, $file) = @_;
 
-  foreach my $file (@files)
+  my $fullfile = "$dir/$file";
+  my $found_it = 0;
+  my $dangling_sym = 0;
+
+  if (-l $fullfile && ! -f $fullfile)
+    {
+      $dangling_sym = 1;
+    }
+  elsif (dir_has_case_matching_file ($dir, $file))
     {
-      my $fullfile = "$dir/$file";
-      my $found_it = 0;
-      my $dangling_sym = 0;
+      $found_it = 1;
+    }
 
-      if (-l $fullfile && ! -f $fullfile)
-       {
-         $dangling_sym = 1;
-       }
-      elsif (dir_has_case_matching_file ($dir, $file))
-       {
-         $found_it = 1;
-         maybe_push_required_file ($dir, $file, $fullfile);
-       }
+  # `--force-missing' only has an effect if `--add-missing' is
+  # specified.
+  return
+    if $found_it && (! $add_missing || ! $force_missing);
 
-      # `--force-missing' only has an effect if `--add-missing' is
-      # specified.
-      if ($found_it && (! $add_missing || ! $force_missing))
-       {
-         next;
-       }
-      else
-       {
-         # If we've already looked for it, we're done.  You might
-         # wonder why we don't do this before searching for the
-         # file.  If we do that, then something like
-         # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into
-         # DIST_COMMON.
-         if (! $found_it)
-           {
-             next if defined $required_file_not_found{$fullfile};
-             $required_file_not_found{$fullfile} = 1;
-           }
+  # If we've already looked for it, we're done.  You might
+  # wonder why we don't do this before searching for the
+  # file.  If we do that, then something like
+  # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into
+  # DIST_COMMON.
+  if (! $found_it)
+    {
+      return if defined $required_file_not_found{$fullfile};
+      $required_file_not_found{$fullfile} = 1;
+    }
+  if ($dangling_sym && $add_missing)
+    {
+      unlink ($fullfile);
+    }
 
-         if ($strictness >= $mystrict)
-           {
-             if ($dangling_sym && $add_missing)
-               {
-                 unlink ($fullfile);
-               }
+  my $trailer = '';
+  my $trailer2 = '';
+  my $suppress = 0;
 
-             my $trailer = '';
-             my $trailer2 = '';
-             my $suppress = 0;
+  # Only install missing files according to our desired
+  # strictness level.
+  my $message = "required file `$fullfile' not found";
+  if ($add_missing)
+    {
+      if (-f "$libdir/$file")
+        {
+          $suppress = 1;
 
-             # Only install missing files according to our desired
-             # strictness level.
-             my $message = "required file `$fullfile' not found";
-             if ($add_missing)
-               {
-                 if (-f "$libdir/$file")
-                   {
-                     $suppress = 1;
-
-                     # Install the missing file.  Symlink if we
-                     # can, copy if we must.  Note: delete the file
-                     # first, in case it is a dangling symlink.
-                     $message = "installing `$fullfile'";
-
-                     # The license file should not be volatile.
-                     if ($file eq "COPYING")
-                       {
-                         $message .= " using GNU General Public License v3 file";
-                         $trailer2 = "\n    Consider adding the COPYING file"
-                                   . " to the version control system"
-                                   . "\n    for your code, to avoid questions"
-                                   . " about which license your project uses.";
-                       }
+          # Install the missing file.  Symlink if we
+          # can, copy if we must.  Note: delete the file
+          # first, in case it is a dangling symlink.
+          $message = "installing `$fullfile'";
 
-                     # Windows Perl will hang if we try to delete a
-                     # file that doesn't exist.
-                     unlink ($fullfile) if -f $fullfile;
-                     if ($symlink_exists && ! $copy_missing)
-                       {
-                         if (! symlink ("$libdir/$file", $fullfile)
-                             || ! -e $fullfile)
-                           {
-                             $suppress = 0;
-                             $trailer = "; error while making link: $!";
-                           }
-                       }
-                     elsif (system ('cp', "$libdir/$file", $fullfile))
-                       {
-                         $suppress = 0;
-                         $trailer = "\n    error while copying";
-                       }
-                     set_dir_cache_file ($dir, $file);
-                   }
+          # The license file should not be volatile.
+          if ($file eq "COPYING")
+            {
+              $message .= " using GNU General Public License v3 file";
+              $trailer2 = "\n    Consider adding the COPYING file"
+                        . " to the version control system"
+                        . "\n    for your code, to avoid questions"
+                        . " about which license your project uses";
+            }
 
-                 if (! maybe_push_required_file (dirname ($fullfile),
-                                                 $file, $fullfile))
-                   {
-                     if (! $found_it && ! $automake_will_process_aux_dir)
-                       {
-                         # We have added the file but could not push it
-                         # into DIST_COMMON, probably because this is
-                         # an auxiliary file and we are not processing
-                         # the top level Makefile.  Furthermore Automake
-                         # hasn't been asked to create the Makefile.in
-                         # that distributes the aux dir files.
-                         error ($where, 'Please make a full run of automake'
-                                . " so $fullfile gets distributed.");
-                       }
-                   }
-               }
-             else
-               {
-                 $trailer = "\n  `automake --add-missing' can install `$file'"
-                   if -f "$libdir/$file";
-               }
+          # Windows Perl will hang if we try to delete a
+          # file that doesn't exist.
+          unlink ($fullfile) if -f $fullfile;
+          if ($symlink_exists && ! $copy_missing)
+            {
+              if (! symlink ("$libdir/$file", $fullfile)
+                  || ! -e $fullfile)
+                {
+                  $suppress = 0;
+                  $trailer = "; error while making link: $!";
+                }
+            }
+          elsif (system ('cp', "$libdir/$file", $fullfile))
+            {
+              $suppress = 0;
+              $trailer = "\n    error while copying";
+            }
+          set_dir_cache_file ($dir, $file);
+        }
+    }
+  else
+    {
+      $trailer = "\n  `automake --add-missing' can install `$file'"
+        if -f "$libdir/$file";
+    }
 
-             # If --force-missing was specified, and we have
-             # actually found the file, then do nothing.
-             next
-               if $found_it && $force_missing;
+  # If --force-missing was specified, and we have
+  # actually found the file, then do nothing.
+  return
+    if $found_it && $force_missing;
 
-             # If we couldn't install the file, but it is a target in
-             # the Makefile, don't print anything.  This allows files
-             # like README, AUTHORS, or THANKS to be generated.
-             next
-               if !$suppress && rule $file;
+  # If we couldn't install the file, but it is a target in
+  # the Makefile, don't print anything.  This allows files
+  # like README, AUTHORS, or THANKS to be generated.
+  return
+    if !$suppress && rule $file;
 
-             msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
-           }
-       }
+  msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
+}
+
+
+# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
+# ----------------------------------------------------------------------
+# Verify that the file must exist in $DIRECTORY, or install it.
+# $MYSTRICT is the strictness level at which this file becomes required.
+# Worker threads may queue up the action to be serialized by the master,
+# if $QUEUE is true
+sub require_file_internal ($$$@)
+{
+  my ($where, $mystrict, $dir, $queue, @files) = @_;
+
+  return
+    unless $strictness >= $mystrict;
+
+  foreach my $file (@files)
+    {
+      push_required_file ($dir, $file, "$dir/$file");
+      if ($queue)
+        {
+          queue_required_file_check_or_copy ($required_conf_file_queue,
+                                             QUEUE_CONF_FILE, $relative_dir,
+                                             $where, $mystrict, @files);
+        }
+      else
+        {
+          required_file_check_or_copy ($where, $dir, $file);
+        }
     }
 }
 
@@ -7982,7 +7830,7 @@ sub require_file_internal ($$$@)
 sub require_file ($$@)
 {
     my ($where, $mystrict, @files) = @_;
-    require_file_internal ($where, $mystrict, $relative_dir, @files);
+    require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
 }
 
 # &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
@@ -8005,7 +7853,7 @@ sub require_libsource_with_macro ($$$@)
     if ($config_libobj_dir)
       {
        require_file_internal ($macro->rdef ($cond)->location, $mystrict,
-                              $config_libobj_dir, @files);
+                              $config_libobj_dir, 0, @files);
       }
     else
       {
@@ -8013,12 +7861,10 @@ sub require_libsource_with_macro ($$$@)
       }
 }
 
-# Queue to push require_conf_file requirements to.
-my $required_conf_file_queue;
-
-# &queue_required_conf_file ($QUEUE, $KEY, $DIR, $WHERE, $MYSTRICT, @FILES)
-# -------------------------------------------------------------------------
-sub queue_required_conf_file ($$$$@)
+# &queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
+#                                     $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
+sub queue_required_file_check_or_copy ($$$$@)
 {
     my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
     my @serial_loc;
@@ -8033,9 +7879,9 @@ sub queue_required_conf_file ($$$$@)
     $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
 }
 
-# &require_queued_conf_file ($QUEUE)
-# ----------------------------------
-sub require_queued_conf_file ($)
+# &require_queued_file_check_or_copy ($QUEUE)
+# -------------------------------------------
+sub require_queued_file_check_or_copy ($)
 {
     my ($queue) = @_;
     my $where;
@@ -8058,35 +7904,23 @@ sub require_queued_conf_file ($)
     my @files;
     push @files, $queue->dequeue ()
       foreach (1 .. $nfiles);
-
-    # Dequeuing happens outside of per-makefile context, so we have to
-    # set the variables used by require_file_internal and the functions
-    # it calls.  Gross!
-    $relative_dir = $dir;
-    require_file_internal ($where, $mystrict, $config_aux_dir, @files);
+    return
+      unless $strictness >= $mystrict;
+    foreach my $file (@files)
+      {
+        required_file_check_or_copy ($where, $config_aux_dir, $file);
+      }
 }
 
 # &require_conf_file ($WHERE, $MYSTRICT, @FILES)
 # ----------------------------------------------
-# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR;
-# worker threads may queue up the action to be serialized by the master.
-#
-# FIXME: this seriously relies on the semantics of require_file_internal
-# and maybe_push_required_file, in that we exploit the fact that only the
-# contents of the last handled output file may be impacted (which in turn
-# is dealt with by the master thread).
+# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
 sub require_conf_file ($$@)
 {
     my ($where, $mystrict, @files) = @_;
-    if (defined $required_conf_file_queue)
-      {
-       queue_required_conf_file ($required_conf_file_queue, QUEUE_CONF_FILE,
-                                 $relative_dir, $where, $mystrict, @files);
-      }
-    else
-      {
-       require_file_internal ($where, $mystrict, $config_aux_dir, @files);
-      }
+    my $queue = defined $required_conf_file_queue ? 1 : 0;
+    require_file_internal ($where, $mystrict, $config_aux_dir,
+                           $queue, @files);
 }
 
 
@@ -8272,7 +8106,6 @@ sub generate_makefile ($$)
       define_pretty_variable ('DIST_SOURCES', TRUE, INTERNAL, @dist_sources);
     }
 
-  handle_multilib;
   handle_texinfo;
   handle_emacs_lisp;
   handle_python;
@@ -8313,18 +8146,13 @@ sub generate_makefile ($$)
 
   check_typos;
 
-  my ($out_file) = $output_directory . '/' . $makefile_in;
-
   if ($exit_code != 0)
     {
-      verb "not writing $out_file because of earlier errors";
+      verb "not writing $makefile_in because of earlier errors";
       return;
     }
 
-  if (! -d ($output_directory . '/' . $am_relative_dir))
-    {
-      mkdir ($output_directory . '/' . $am_relative_dir, 0755);
-    }
+  mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir;
 
   # We make sure that `all:' is the first target.
   my $output =
@@ -8343,25 +8171,25 @@ sub generate_makefile ($$)
   #  * other dependencies, specific to the Makefile.am being processed
   #    (such as the Makefile.am itself, or any Makefile fragment
   #    it includes).
-  my $timestamp = mtime $out_file;
+  my $timestamp = mtime $makefile_in;
   if (! $force_generation
       && $configure_deps_greatest_timestamp < $timestamp
       && $output_deps_greatest_timestamp < $timestamp
-      && $output eq contents ($out_file))
+      && $output eq contents ($makefile_in))
     {
-      verb "$out_file unchanged";
+      verb "$makefile_in unchanged";
       # No need to update.
       return;
     }
 
-  if (-e $out_file)
+  if (-e $makefile_in)
     {
-      unlink ($out_file)
-       or fatal "cannot remove $out_file: $!\n";
+      unlink ($makefile_in)
+       or fatal "cannot remove $makefile_in: $!";
     }
 
-  my $gm_file = new Automake::XFile "> $out_file";
-  verb "creating $out_file";
+  my $gm_file = new Automake::XFile "> $makefile_in";
+  verb "creating $makefile_in";
   print $gm_file $output;
 }
 
@@ -8419,7 +8247,7 @@ sub print_autodist_files (@)
 # Print usage information.
 sub usage ()
 {
-    print "Usage: $0 [OPTION] ... [Makefile]...
+    print "Usage: $0 [OPTION]... [Makefile]...
 
 Generate Makefile.in for configure from Makefile.am.
 
@@ -8491,46 +8319,40 @@ EOF
 # Parse command line.
 sub parse_arguments ()
 {
-  # Start off as gnu.
-  set_strictness ('gnu');
+  my $strict = 'gnu';
+  my $cygnus = 0;
+  my $ignore_deps = 0;
+  my @warnings = ();
 
-  my $cli_where = new Automake::Location;
   my %cli_options =
     (
      'version' => \&version,
      'help'    => \&usage,
      'libdir=s'        => \$libdir,
-     'gnu'             => sub { set_strictness ('gnu'); },
-     'gnits'           => sub { set_strictness ('gnits'); },
-     'cygnus'          => sub { set_global_option ('cygnus', $cli_where); },
-     'foreign'          => sub { set_strictness ('foreign'); },
-     'include-deps'    => sub { unset_global_option ('no-dependencies'); },
-     'i|ignore-deps'   => sub { set_global_option ('no-dependencies',
-                                                   $cli_where); },
+     'gnu'             => sub { $strict = 'gnu'; },
+     'gnits'           => sub { $strict = 'gnits'; },
+     'foreign'         => sub { $strict = 'foreign'; },
+     'cygnus'          => \$cygnus,
+     'include-deps'    => sub { $ignore_deps = 0; },
+     'i|ignore-deps'   => sub { $ignore_deps = 1; },
      'no-force'        => sub { $force_generation = 0; },
      'f|force-missing'  => \$force_missing,
-     'o|output-dir=s'  => \$output_directory,
      'a|add-missing'   => \$add_missing,
      'c|copy'          => \$copy_missing,
      'v|verbose'       => sub { setup_channel 'verb', silent => 0; },
-     'W|warnings=s'     => \&parse_warnings,
-     # These long options (--Werror and --Wno-error) for backward
-     # compatibility.  Use -Werror and -Wno-error today.
-     'Werror'           => sub { parse_warnings 'W', 'error'; },
-     'Wno-error'        => sub { parse_warnings 'W', 'no-error'; },
+     'W|warnings=s'     => \@warnings,
      );
 
   use Automake::Getopt ();
   Automake::Getopt::parse_options %cli_options;
 
-  if (defined $output_directory)
-    {
-      msg 'obsolete', "`--output-dir' is deprecated\n";
-    }
-  else
+  set_strictness ($strict);
+  my $cli_where = new Automake::Location;
+  set_global_option ('cygnus', $cli_where) if $cygnus;
+  set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
+  for my $warning (@warnings)
     {
-      # In the next release we'll remove this entirely.
-      $output_directory = '.';
+      &parse_warnings ('-W', $warning);
     }
 
   return unless @ARGV;
@@ -8538,7 +8360,7 @@ sub parse_arguments ()
   my $errspec = 0;
   foreach my $arg (@ARGV)
     {
-      fatal ("empty argument\nTry `$0 --help' for more information.")
+      fatal ("empty argument\nTry `$0 --help' for more information")
        if ($arg eq '');
 
       # Handle $local:$input syntax.
@@ -8608,11 +8430,6 @@ sub get_number_of_threads
   # It doesn't make sense to use more threads than makefiles,
   my $max_threads = @input_files;
 
-  # but a single worker thread is helpful for exposing bugs.
-  if ($automake_will_process_aux_dir && $max_threads > 1)
-    {
-      $max_threads--;
-    }
   if ($nthreads > $max_threads)
     {
       $nthreads = $max_threads;
@@ -8636,18 +8453,11 @@ sub handle_makefiles_threaded ($)
 {
   my ($nthreads) = @_;
 
-  my @queued_input_files = @input_files;
-  my $last_input_file = undef;
-  if ($automake_will_process_aux_dir)
-    {
-      $last_input_file = pop @queued_input_files;
-    }
-
   # The file queue distributes all makefiles, the message queues
   # collect all serializations needed for respective files.
   my $file_queue = Thread::Queue->new;
   my %msg_queues;
-  foreach my $file (@queued_input_files)
+  foreach my $file (@input_files)
     {
       $msg_queues{$file} = Thread::Queue->new;
     }
@@ -8673,12 +8483,12 @@ sub handle_makefiles_threaded ($)
        });
     }
 
-  # Queue all normal makefiles.
-  verb "queuing " . @queued_input_files . " input files";
-  $file_queue->enqueue (@queued_input_files, (undef) x @threads);
+  # Queue all makefiles.
+  verb "queuing " . @input_files . " input files";
+  $file_queue->enqueue (@input_files, (undef) x @threads);
 
   # Collect and process serializations.
-  foreach my $file (@queued_input_files)
+  foreach my $file (@input_files)
     {
       verb "dequeuing messages for " . $file;
       reset_local_duplicates ();
@@ -8691,7 +8501,7 @@ sub handle_makefiles_threaded ($)
            }
          elsif ($key eq QUEUE_CONF_FILE)
            {
-             require_queued_conf_file ($queue);
+             require_queued_file_check_or_copy ($queue);
            }
          else
            {
@@ -8706,13 +8516,6 @@ sub handle_makefiles_threaded ($)
       $exit_code = $exit_thread[0]
        if ($exit_thread[0] > $exit_code);
     }
-
-  # The master processes the last file.
-  if ($automake_will_process_aux_dir)
-    {
-      verb "processing last input file";
-      handle_makefile ($last_input_file);
-    }
 }
 
 ################################################################
index c0043a3..fa0bf88 100755 (executable)
--- a/bootstrap
+++ b/bootstrap
@@ -103,9 +103,11 @@ dosubst m4/amversion.in m4/amversion.m4
 # Create temporary replacement for automake.
 dosubst automake.in automake.tmp
 
-# Create tests/parallel-tests.am.
+# Create required makefile snippets.
 cd tests
-$BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
+$PERL ./gen-testsuite-part > testsuite-part.tmp
+chmod a-w testsuite-part.tmp
+mv -f testsuite-part.tmp testsuite-part.am
 cd ..
 
 # Run the autotools.
index 18dbd8a..badf9bb 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 AC_PREREQ([2.68])
-AC_INIT([GNU Automake], [1.11.0a], [bug-automake@gnu.org])
+AC_INIT([GNU Automake], [1.11a], [bug-automake@gnu.org])
 
 AC_CONFIG_SRCDIR([automake.in])
 AC_CONFIG_AUX_DIR([lib])
 
 AM_SILENT_RULES([yes])
 
+AC_CANONICAL_HOST
 AC_CANONICAL_BUILD
 
 # Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
@@ -37,7 +38,11 @@ AC_SUBST([am_AUTORECONF], ["${AUTORECONF-autoreconf}"])
 AC_SUBST([am_AUTOHEADER], ["${AUTOHEADER-autoheader}"])
 AC_SUBST([am_AUTOUPDATE], ["${AUTOUPDATE-autoupdate}"])
 
-AM_INIT_AUTOMAKE([1.10a dist-xz filename-length-max=99 color-tests parallel-tests])
+dnl We call AC_PROG_CC in an unusual way, and only for use in our
+dnl testsuite, so also use `no-dependencies' and `no-define' among
+dnl the automake options to avoid bloating and potential problems.
+AM_INIT_AUTOMAKE([1.10a dist-xz filename-length-max=99 color-tests
+                 parallel-tests silent-rules no-define no-dependencies])
 
 # The API version is the base version.  We must guarantee
 # compatibility for all releases with the same API version.
@@ -49,8 +54,11 @@ AM_INIT_AUTOMAKE([1.10a dist-xz filename-length-max=99 color-tests parallel-test
 APIVERSION=`echo "$VERSION" | sed -e 's/^\([[0-9]]*\.[[0-9]]*[[a-z]]*\).*$/\1/'`
 AC_SUBST([APIVERSION])
 
-# A versioned directory, defined here for convenience.
 AC_SUBST([pkgvdatadir], ["\${datadir}/$PACKAGE-$APIVERSION"])
+AC_SUBST([scriptdir], ["\${pkgvdatadir}"])
+AC_SUBST([amdir], ["\${pkgvdatadir}/am"])
+AC_SUBST([automake_acdir], ["\${datadir}/aclocal-$APIVERSION"])
+AC_SUBST([system_acdir], ["\${datadir}/aclocal"])
 
 # $AUTOMAKE and $ACLOCAL are always run after a `cd $top_srcdir',
 # hence `.' is really what we want for perllibdir, libdir, and acdir.
@@ -104,6 +112,20 @@ AC_CHECK_PROG([TEX], [tex], [tex])
 # for input from the terminal.
 AM_RUN_LOG([$TEX --version </dev/null])
 
+# The test suite will skip some tests if no lex or yacc program is
+# available.
+# We don't use AC_PROG_LEX nor AC_PROG_YACC here because:
+#  1. we don't want flex (resp. bison) to be preferred to system lex
+#     (resp. system yacc);
+#  2. we don't want $LEX (resp. $YACC) to be defined to ':' (resp. 'yacc')
+#     by default;
+#  3. we prefer not to have the variables YFLAGS, LEX_OUTPUT_ROOT and
+#     LEXLIB to be calculated and/or AC_SUBST'd;
+#  4. we prefer that the YACC and LEX variables are not reported in the
+#     configure help screen.
+AC_CHECK_PROGS([YACC], [yacc byacc 'bison -y'], [false])
+AC_CHECK_PROGS([LEX], [lex flex], [false])
+
 # Generate man pages.
 AM_MISSING_PROG([HELP2MAN], [help2man])
 
@@ -187,9 +209,9 @@ AC_SUBST([MODIFICATION_DELAY])
 AC_PROG_EGREP
 AC_PROG_FGREP
 
-AC_CACHE_CHECK([whether /bin/sh has working 'set -e' with exit trap],
+AC_CACHE_CHECK([whether $SHELL has working 'set -e' with exit trap],
 [am_cv_sh_errexit_works],
-[if /bin/sh -ec "trap 'exit \$?' 0; (exit 77); exit 77"; test $? = 77
+[if $SHELL -ec "trap 'exit \$?' 0; (exit 77); exit 77"; test $? = 77
 then
   am_cv_sh_errexit_works=yes
 else
@@ -204,6 +226,112 @@ if test $am_cv_sh_errexit_works = no; then
 fi
 AC_SUBST([sh_errexit_works], [$am_cv_sh_errexit_works])
 
+
+###########################################################################
+
+# Look for C, C++ and fortran compilers to be used in the testsuite.
+
+dnl We don't want to abort our configuration script if no C compiler is
+dnl available, as such a compiler is only required to run part of the
+dnl testsuite, not to build or install Automake.  Ditto for C++, Fortran
+dnl and Fortran 77 compilers.  Unfortunately, autoconf does not offer an
+dnl easy way to obtain this behaviour, so we'll need a few hacks.
+
+dnl We want the body of this macro to expand as a single shell statement,
+dnl thus we wrap it into { ... } brackets.
+AC_DEFUN([_AM_WRAP_MSG_ERROR], [ {
+  AC_MSG_WARN([$1])
+  am__failed=yes
+  break
+} ])
+
+AC_DEFUN([_AM_COMPILER_CAN_FAIL], [
+  m4_pushdef([AC_MSG_FAILURE], m4_defn([_AM_WRAP_MSG_ERROR]))
+  m4_pushdef([AC_MSG_ERROR],   m4_defn([_AM_WRAP_MSG_ERROR]))
+  am__failed=no
+  while :; do
+     $1
+     break
+  done
+  AS_IF([test $am__failed = yes], [$2])
+  # We have to clear these cache variables, so that future checks on
+  # compilers for different languages won't be confused.
+  unset ac_cv_objext ac_cv_exeext
+  # We also need to meddle with the autoconf internals to ensure that
+  # checks to find object and executable extensions will be run anew.
+  # FIXME: In the long run, the better thing to do would be to fix
+  # FIXME: autoconf instead ...
+  m4_undefine([m4_provide(_AC_COMPILER_OBJEXT)])
+  m4_undefine([m4_provide(_AC_COMPILER_EXEEXT)])
+  m4_popdef([AC_MSG_FAILURE])
+  m4_popdef([AC_MSG_ERROR])
+])
+
+# Prefer generic compilers to GNU ones when possible.  This will ensure
+# more testsuite coverage "in the wild".
+# Note that we don't look for the MSVC C/C++ compiler here.  This is
+# deliberate; for more discussion an rationale, see:
+# <http://lists.gnu.org/archive/html/automake-patches/2012-01/msg00130.html>
+
+# C compiler.
+_AM_COMPILER_CAN_FAIL([AC_PROG_CC([cc gcc])], [CC=false])
+AS_IF([test x"$GCC" = x"yes"], [am_CC_is_GNU=yes], [am_CC_is_GNU=no])
+
+# The list of C++ compilers here has been copied, pasted and edited
+# from `lib/autoconf/c.m4:AC_PROG_CXX' in the Autoconf distribution.
+# Keep it in sync, or better again, find out a way to avoid this code
+# duplication.
+_AM_COMPILER_CAN_FAIL([AC_PROG_CXX(dnl
+  [aCC CC FCC KCC RCC xlC_r xlC c++ cxx cc++ gpp g++])],
+  [CXX=false])
+AS_IF([test x"$GXX" = x"yes"], [am_CXX_is_GNU=yes], [am_CXX_is_GNU=no])
+
+# The lists of Fortran compilers here has been copied, pasted and edited
+# from file `lib/autoconf/fortran.m4' in the Autoconf distribution.
+# Keep it in sync, or better again, find out a way to avoid this code
+# duplication.
+
+_AM_COMPILER_CAN_FAIL([AC_PROG_FC(dnl
+  [xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor] dnl
+  [xlf90 f90 pgf90 pghpf epcf90 g95 gfortran])],
+  [FC=false])
+# FIXME this won't work as expected until we can assume autoconf 2.69 :-(
+AS_IF([test x"$GFC" = x"yes"], [am_FC_is_GNU=yes], [am_FC_is_GNU=no])
+
+_AM_COMPILER_CAN_FAIL([AC_PROG_F77(dnl
+  [xlf f77 frt pgf77 cf77 fort77 fl32 af77 g77 gfortran])],
+  [F77=false])
+AS_IF([test x"$G77" = x"yes"], [am_F77_is_GNU=yes], [am_F77_is_GNU=no])
+
+# Some tests will need the GNU compilers.  Searching for them here would
+# be overkill, since our testsuite already handles their search and setup
+# pretty well.  However, in case the compilers detected above at configure
+# time are not the GNU ones, we cannot use the values of CFLAGS, CXXFLAGS,
+# FCFLAGS and FFLAGS detected for them with the GNU compilers too, since
+# it's likely they won't be compatible.  So we allow the user to define
+# variants of this variables for the GNU compilers separately.
+
+test $am_CC_is_GNU = yes && GNU_CFLAGS=${GNU_CFLAGS-$CFLAGS}
+AC_ARG_VAR([GNU_CFLAGS], [GNU C compiler flags])
+
+test $am_CXX_is_GNU = yes && GNU_CXXFLAGS=${GNU_CXXFLAGS-$CXXFLAGS}
+AC_ARG_VAR([GNU_CXXFLAGS], [GNU C++ compiler flags])
+
+test $am_F77_is_GNU = yes && GNU_FCFLAGS=${GNU_FCFLAGS-$FCFLAGS}
+AC_ARG_VAR([GNU_FCFLAGS], [GNU Fortran compiler flags])
+
+test $am_FC_is_GNU = yes && GNU_FFLAGS=${GNU_FFLAGS-$FFLAGS}
+AC_ARG_VAR([GNU_FFLAGS], [GNU Fortran 77 compiler flags])
+
+# If we have been able to find at least a working compiler above, we
+# know what the object and executable extensions for this platform are.
+OBJEXT=${ac_cv_objext-UNKNOWN}
+EXEEXT=${ac_cv_exeext-UNKNOWN}
+AC_SUBST([OBJEXT])
+AC_SUBST([EXEEXT])
+
+###########################################################################
+
 AC_CONFIG_FILES([
   Makefile
   contrib/Makefile
@@ -213,8 +341,9 @@ AC_CONFIG_FILES([
   lib/am/Makefile
   m4/Makefile
   tests/Makefile
-  tests/defs
 ])
+AC_CONFIG_LINKS([GNUmakefile:GNUmakefile])
+AC_CONFIG_LINKS([tests/defs:tests/defs])
 AC_CONFIG_FILES([tests/aclocal-${APIVERSION}:tests/aclocal.in],
                 [chmod +x tests/aclocal-${APIVERSION}],
                [APIVERSION=$APIVERSION])
index 820b547..91c1cab 100644 (file)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 EXTRA_DIST = \
+  check-html.am \
+  multilib/README \
+  multilib/config-ml.in \
+  multilib/symlink-tree \
+  multilib/multilib.am \
   multilib/multi.m4 \
   README
index bbef72f..a4d7eeb 100644 (file)
@@ -14,7 +14,7 @@ There are several reasons for which a feature can be kept in contrib:
      core (as doing so too early would later force us to continue the
      support for backward-compatibility, even if the features proves
      flawed or fails to attract widespread use).
-  
+
   2. The APIs or overall design of the feature are still unstable, and
      need on-field testing to iron warts and usability bugs, or uncover
      potential flaws.
@@ -24,4 +24,3 @@ There are several reasons for which a feature can be kept in contrib:
      remove it from the Automake core, but cannot remove it altogether,
      for the sake of those still-existing usage.  So it gets moved in
      contrib.
-
similarity index 91%
rename from lib/am/check-html.am
rename to contrib/check-html.am
index 13f0a47..1526976 100644 (file)
 ## Makefile.am fragment to produce HTML output from RST-formatted
 ## log files produced by the parallel-tests output.
 ## This fragment was part of the automake core in the 1.11.x release
-## series, but is to be moved out in the 1.12 release.
+## series, but has been then moved to contrib.
 
 TEST_SUITE_HTML = $(TEST_SUITE_LOG:.log=.html)
 
-mostlyclean-am: am--mostlyclean-test-html
-.PHONY: am--mostlyclean-test-html
-am--mostlyclean-test-html:
+mostlyclean-local: mostlyclean-check-html
+.PHONY: mostlyclean-check-html
+mostlyclean-check-html:
 ## Expand $(TEST_LOGS) only once, to avoid exceeding line length limits.
        list='$(TEST_LOGS:.log=.html)'; test -z "$$list" || rm -f $$list
        rm -f $(TEST_SUITE_HTML)
@@ -55,7 +55,5 @@ check-html recheck-html:
        $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_HTML) TEST_LOGS= || exit 4; \
        exit $$rv
 
-AM_RECURSIVE_TARGETS += check-html recheck-html
-
 .PHONY: check-html recheck-html
 .MAKE: check-html recheck-html
diff --git a/contrib/multilib/README b/contrib/multilib/README
new file mode 100644 (file)
index 0000000..35c726f
--- /dev/null
@@ -0,0 +1,9 @@
+Minimal support for multilib builds.
+
+For a little more information, see:
+<http://airs.com/ian/configure/configure_8.html>
+
+The master (and probably more up-to-date) copies of the 'config-ml.in'
+and 'symlink-tree' files are maintained in the GCC development tree
+at <http://gcc.gnu.org/svn.html>.  The same is probably true also for
+the 'multi.m4' file.
diff --git a/contrib/multilib/multilib.am b/contrib/multilib/multilib.am
new file mode 100644 (file)
index 0000000..f38921c
--- /dev/null
@@ -0,0 +1,47 @@
+## automake - create Makefile.in from Makefile.am
+
+## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+## 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+## Foundation, Inc.
+## This Makefile.in is free software; the Free Software Foundation
+## gives unlimited permission to copy and/or distribute it,
+## with or without modifications, as long as this notice is preserved.
+
+## 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.
+
+MULTISRCTOP =
+MULTIBUILDTOP =
+MULTIDIRS =
+MULTISUBDIR =
+MULTIDO = true
+MULTICLEAN = true
+
+# GNU Make needs to see an explicit $(MAKE) variable in the command it
+# runs to enable its job server during parallel builds.  Hence the
+# comments below.
+all-multi:
+       $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
+install-multi:
+       $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
+mostlyclean-multi:
+       $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
+clean-multi:
+       $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
+distclean-multi:
+       $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
+maintainer-clean-multi:
+       $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
+
+.MAKE .PHONY: all-multi clean-multi distclean-multi install-am \
+             install-multi maintainer-clean-multi mostlyclean-multi
+
+install-exec-local: install-multi
+
+all-local: all-multi
+mostlyclean-local: mostlyclean-multi
+clean-local: clean-multi
+distclean-local: distclean-multi
+maintainer-clean-local: maintainer-clean-multi
index 655673b..07c2867 100644 (file)
@@ -18,8 +18,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-info_TEXINFOS = automake.texi
+info_TEXINFOS = automake.texi automake-history.texi
 automake_TEXINFOS = fdl.texi
+history_TEXINFOS = fdl.texi
 
 dist_man1_MANS = \
   $(srcdir)/aclocal.1 \
@@ -28,12 +29,12 @@ dist_man1_MANS = \
   $(srcdir)/automake-$(APIVERSION).1
 MAINTAINERCLEANFILES = $(dist_man1_MANS)
 update_mans = \
-  PATH="`pwd`/../tests$(PATH_SEPARATOR)$$PATH" && \
+  $(AM_V_GEN)PATH="`pwd`/../tests$(PATH_SEPARATOR)$$PATH" && \
   export PATH && \
   $(HELP2MAN) --output=$@
 $(dist_man1_MANS): $(top_srcdir)/configure.ac
 $(srcdir)/aclocal.1 $(srcdir)/automake.1:
-       f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'`; \
+       $(AM_V_GEN)f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'`; \
        echo ".so man1/$$f-$(APIVERSION).1" > $@
 $(srcdir)/aclocal-$(APIVERSION).1: $(srcdir)/../aclocal.in
        $(update_mans) aclocal-$(APIVERSION)
@@ -71,10 +72,10 @@ dist_doc_DATA = $(srcdir)/amhello-1.0.tar.gz
 # aclocal-$(APIVERSION) and automake-$(APIVERSION) are generated by
 # configure in tests/.
 $(srcdir)/amhello-1.0.tar.gz: $(amhello_sources) $(top_srcdir)/configure.ac
-       $(AM_V_GEN)abs_top_builddir=`cd '$(top_builddir)' && pwd` && \
-       PATH="$$abs_top_builddir/tests$(PATH_SEPARATOR)$$PATH" && \
+       $(AM_V_GEN): && \
+       PATH="$(abs_top_builddir)/tests$(PATH_SEPARATOR)$$PATH" && \
        export PATH && \
-       cd $(srcdir)/amhello && \
+       $(am__cd) $(srcdir)/amhello && \
        ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL && \
        AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE && \
        AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF && \
diff --git a/doc/automake-history.texi b/doc/automake-history.texi
new file mode 100644 (file)
index 0000000..d26ba0e
--- /dev/null
@@ -0,0 +1,1216 @@
+\input texinfo   @c -*-texinfo-*-
+@c %**start of header
+@setfilename automake-history.info
+@settitle automake-history
+@setchapternewpage on
+@c %**end of header
+
+@copying
+
+This manual describes (part of) the history of GNU Automake, a program
+that creates GNU standards-compliant Makefiles from template files.
+
+Copyright @copyright{} 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
+Foundation, Inc.
+
+@quotation
+Permission is granted to copy, distribute and/or modify this document
+under the terms of the GNU Free Documentation License,
+Version 1.3 or any later version published by the Free Software
+Foundation; with no Invariant Sections, with no Front-Cover texts,
+and with no Back-Cover Texts.  A copy of the license is included in the
+section entitled ``GNU Free Documentation License.''
+
+@end quotation
+@end copying
+
+@titlepage
+@title Brief History of Automake
+@author David MacKenzie
+@author Tom Tromey
+@author Alexandre Duret-Lutz
+@page
+@vskip 0pt plus 1filll
+@insertcopying
+@end titlepage
+
+@contents
+
+@ifnottex
+@node Top
+@comment  node-name,  next,  previous,  up
+@top Brief History of Automake
+
+@insertcopying
+
+@menu
+* Timeline::                      The Automake story.
+* Dependency Tracking Evolution:: Evolution of Automatic Dependency Tracking
+* Releases::                      Release statistics
+* Copying This Manual::           How to make copies of this manual
+
+@detailmenu
+ --- The Detailed Node Listing ---
+
+Evolution of Automatic Dependency Tracking
+
+* First Take on Dependencies::    Precomputed dependency tracking
+* Dependencies As Side Effects::  Update at developer compile time
+* Dependencies for the User::     Update at user compile time
+* Techniques for Dependencies::   Alternative approaches
+
+Techniques for Computing Dependencies
+
+* Recommendations for Tool Writers::
+* Future Directions for Dependencies::
+
+Copying This Manual
+
+* GNU Free Documentation License::  License for copying this manual
+
+@end detailmenu
+@end menu
+
+@end ifnottex
+
+@node Timeline
+@chapter Timeline
+
+@table @asis
+@item 1994-09-19 First CVS commit.
+
+If we can trust the CVS repository, David J.@tie{}MacKenzie (djm) started
+working on Automake (or AutoMake, as it was spelt then) this Monday.
+
+The first version of the @command{automake} script looks as follows.
+
+@example
+#!/bin/sh
+
+status=0
+
+for makefile
+do
+  if test ! -f $@{makefile@}.am; then
+    echo "automake: $@{makefile@}.am: No such honkin' file"
+    status=1
+    continue
+  fi
+
+  exec 4> $@{makefile@}.in
+
+done
+@end example
+
+From this you can already see that Automake will be about reading
+@file{*.am} file and producing @file{*.in} files.  You cannot see
+anything else, but if you also know that David is the one who created
+Autoconf two years before you can guess the rest.
+
+Several commits follow, and by the end of the day Automake is
+reported to work for GNU fileutils and GNU m4.
+
+The modus operandi is the one that is still used today: variable
+assignments in @file{Makefile.am} files trigger injections of
+precanned @file{Makefile} fragments into the generated
+@file{Makefile.in}.  The use of @file{Makefile} fragments was inspired
+by the 4.4BSD @command{make} and include files, however Automake aims
+to be portable and to conform to the GNU standards for @file{Makefile}
+variables and targets.
+
+At this point, the most recent release of Autoconf is version 1.11,
+and David is preparing to release Autoconf 2.0 in late October.  As a
+matter of fact, he will barely touch Automake after September.
+
+@item 1994-11-05 David MacKenzie's last commit.
+
+At this point Automake is a 200 line portable shell script, plus 332
+lines of @file{Makefile} fragments.  In the @file{README}, David
+states his ambivalence between ``portable shell'' and ``more
+appropriate language'':
+
+@quotation
+I wrote it keeping in mind the possibility of it becoming an Autoconf
+macro, so it would run at configure-time.  That would slow
+configuration down a bit, but allow users to modify the Makefile.am
+without needing to fetch the AutoMake package.  And, the Makefile.in
+files wouldn't need to be distributed.  But all of AutoMake would.  So
+I might reimplement AutoMake in Perl, m4, or some other more
+appropriate language.
+@end quotation
+
+Automake is described as ``an experimental Makefile generator''.
+There is no documentation.  Adventurous users are referred to the
+examples and patches needed to use Automake with GNU m4 1.3, fileutils
+3.9, time 1.6, and development versions of find and indent.
+
+These examples seem to have been lost.  However at the time of writing
+(10 years later in September, 2004) the FSF still distributes a
+package that uses this version of Automake: check out GNU termutils
+2.0.
+
+@item 1995-11-12 Tom Tromey's first commit.
+
+After one year of inactivity, Tom Tromey takes over the package.
+Tom was working on GNU cpio back then, and doing this just for fun,
+having trouble finding a project to contribute to.  So while hacking
+he wanted to bring the @file{Makefile.in} up to GNU standards.  This
+was hard, and one day he saw Automake on @url{ftp://alpha.gnu.org/},
+grabbed it and tried it out.
+
+Tom didn't talk to djm about it until later, just to make sure he
+didn't mind if he made a release.  He did a bunch of early releases to
+the Gnits folks.
+
+Gnits was (and still is) totally informal, just a few GNU friends who
+Fran@,cois Pinard knew, who were all interested in making a common
+infrastructure for GNU projects, and shared a similar outlook on how
+to do it.  So they were able to make some progress.  It came along
+with Autoconf and extensions thereof, and then Automake from David and
+Tom (who were both gnitsians).  One of their ideas was to write a
+document paralleling the GNU standards, that was more strict in some
+ways and more detailed.  They never finished the GNITS standards, but
+the ideas mostly made their way into Automake.
+
+@item 1995-11-23 Automake 0.20
+
+Besides introducing automatic dependency tracking (@pxref{Dependency
+Tracking Evolution}), this version also supplies a 9-page manual.
+
+At this time @command{aclocal} and @code{AM_INIT_AUTOMAKE} did not
+exist, so many things had to be done by hand.  For instance, here is
+what a configure.in (this is the former name of the
+@file{configure.ac} we use today) must contain in order to use
+Automake 0.20:
+
+@example
+PACKAGE=cpio
+VERSION=2.3.911
+AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
+AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
+AC_SUBST(PACKAGE)
+AC_SUBST(VERSION)
+AC_ARG_PROGRAM
+AC_PROG_INSTALL
+@end example
+
+(Today all of the above is achieved by @code{AC_INIT} and
+@code{AM_INIT_AUTOMAKE}.)
+
+Here is how programs are specified in @file{Makefile.am}:
+
+@example
+PROGRAMS = hello
+hello_SOURCES = hello.c
+@end example
+
+This looks pretty much like what we do today, except the
+@code{PROGRAMS} variable has no directory prefix specifying where
+@file{hello} should be installed: all programs are installed in
+@samp{$(bindir)}.  @code{LIBPROGRAMS} can be used to specify programs
+that must be built but not installed (it is called
+@code{noinst_PROGRAMS} nowadays).
+
+Programs can be built conditionally using @code{AC_SUBST}itutions:
+
+@example
+PROGRAMS = @@progs@@
+AM_PROGRAMS = foo bar baz
+@end example
+
+(@code{AM_PROGRAMS} has since then been renamed to
+@code{EXTRA_PROGRAMS}.)
+
+Similarly scripts, static libraries, and data can be built and installed
+using the @code{LIBRARIES}, @code{SCRIPTS}, and @code{DATA} variables.
+However @code{LIBRARIES} were treated a bit specially in that Automake
+did automatically supply the @file{lib} and @file{.a} prefixes.
+Therefore to build @file{libcpio.a}, one had to write
+
+@example
+LIBRARIES = cpio
+cpio_SOURCES = ...
+@end example
+
+Extra files to distribute must be listed in @code{DIST_OTHER} (the
+ancestor of @code{EXTRA_DIST}).  Also extra directories that are to be
+distributed should appear in @code{DIST_SUBDIRS}, but the manual
+describes this as a temporary ugly hack (today extra directories should
+also be listed in @code{EXTRA_DIST}, and @code{DIST_SUBDIRS} is used
+for another purpose, @pxref{Conditional Subdirectories, , Conditional
+Subdirectories, automake, GNU Automake}).
+
+@item 1995-11-26 Automake 0.21
+
+In less time than it takes to cook a frozen pizza, Tom rewrites
+Automake using Perl.  At this time Perl 5 is only one year old, and
+Perl 4.036 is in use at many sites.  Supporting several Perl versions
+has been a source of problems through the whole history of Automake.
+
+If you never used Perl 4, imagine Perl 5 without objects, without
+@samp{my} variables (only dynamically scoped @samp{local} variables),
+without function prototypes, with function calls that needs to be
+prefixed with @samp{&}, etc.  Traces of this old style can still be
+found in today's @command{automake}.
+
+@item 1995-11-28 Automake 0.22
+@itemx 1995-11-29 Automake 0.23
+
+Bug fixes.
+
+@item 1995-12-08 Automake 0.24
+@itemx 1995-12-10 Automake 0.25
+
+Releases are raining.  0.24 introduces the uniform naming scheme we
+use today, i.e., @code{bin_PROGRAMS} instead of @code{PROGRAMS},
+@code{noinst_LIBRARIES} instead of @code{LIBLIBRARIES}, etc.  (However
+@code{EXTRA_PROGRAMS} does not exist yet, @code{AM_PROGRAMS} is still
+in use; and @code{TEXINFOS} and @code{MANS} still have no directory
+prefixes.)  Adding support for prefixes like that was one of the major
+ideas in @command{automake}; it has lasted pretty well.
+
+AutoMake is renamed to Automake (Tom seems to recall it was Fran@,cois
+Pinard's doing).
+
+0.25 fixes a Perl 4 portability bug.
+
+@item 1995-12-18 Jim Meyering starts using Automake in GNU Textutils.
+@item 1995-12-31 Fran@,cois Pinard starts using Automake in GNU tar.
+
+@item 1996-01-03 Automake 0.26
+@itemx 1996-01-03 Automake 0.27
+
+Of the many changes and suggestions sent by Fran@,cois Pinard and
+included in 0.26, perhaps the most important is the advice that to
+ease customization a user rule or variable definition should always
+override an Automake rule or definition.
+
+Gordon Matzigkeit and Jim Meyering are two other early contributors
+that have been sending fixes.
+
+0.27 fixes yet another Perl 4 portability bug.
+
+@item 1996-01-13 Automake 0.28
+
+Automake starts scanning @file{configure.in} for @code{LIBOBJS}
+support.  This is an important step because until this version
+Automake only knew about the @file{Makefile.am}s it processed.
+@file{configure.in} was Autoconf's world and the link between Autoconf
+and Automake had to be done by the @file{Makefile.am} author.  For
+instance, if @file{config.h} was generated by @file{configure}, it was the
+package maintainer's responsibility to define the @code{CONFIG_HEADER}
+variable in each @file{Makefile.am}.
+
+Succeeding releases will rely more and more on scanning
+@file{configure.in} to better automate the Autoconf integration.
+
+0.28 also introduces the @code{AUTOMAKE_OPTIONS} variable and the
+@option{--gnu} and @option{--gnits} options, the latter being stricter.
+
+@item 1996-02-07 Automake 0.29
+
+Thanks to @file{configure.in} scanning, @code{CONFIG_HEADER} is gone,
+and rebuild rules for @file{configure}-generated file are
+automatically output.
+
+@code{TEXINFOS} and @code{MANS} converted to the uniform naming
+scheme.
+
+@item 1996-02-24 Automake 0.30
+
+The test suite is born.  It contains 9 tests.  From now on test cases
+will be added pretty regularly (@pxref{Releases}), and this proved to
+be really helpful later on.
+
+@code{EXTRA_PROGRAMS} finally replaces @code{AM_PROGRAMS}.
+
+All the third-party Autoconf macros, written mostly by Fran@,cois
+Pinard (and later Jim Meyering), are distributed in Automake's
+hand-written @file{aclocal.m4} file.  Package maintainers are expected
+to extract the necessary macros from this file.  (In previous versions
+you had to copy and paste them from the manual...)
+
+@item 1996-03-11 Automake 0.31
+
+The test suite in 0.30 was run via a long @code{check-local} rule.  Upon
+Ulrich Drepper's suggestion, 0.31 makes it an Automake rule output
+whenever the @code{TESTS} variable is defined.
+
+@code{DIST_OTHER} is renamed to @code{EXTRA_DIST}, and the @code{check_}
+prefix is introduced.  The syntax is now the same as today.
+
+@item 1996-03-15 Gordon Matzigkeit starts writing libtool.
+
+@item 1996-04-27 Automake 0.32
+
+@code{-hook} targets are introduced; an idea from Dieter Baron.
+
+@file{*.info} files, which were output in the build directory are
+now built in the source directory, because they are distributed.  It
+seems these files like to move back and forth as that will happen
+again in future versions.
+
+@item 1996-05-18 Automake 0.33
+
+Gord Matzigkeit's main two contributions:
+
+@itemize
+@item very preliminary libtool support
+@item the distcheck rule
+@end itemize
+
+Although they were very basic at this point, these are probably
+among the top features for Automake today.
+
+Jim Meyering also provides the infamous @code{jm_MAINTAINER_MODE}, since
+then renamed to @code{AM_MAINTAINER_MODE} and abandoned by its author
+(@pxref{maintainer-mode, , maintainer-mode, automake, GNU Automake}).
+
+@item 1996-05-28 Automake 1.0
+
+After only six months of heavy development, the @command{automake} script is
+3134 lines long, plus 973 lines of @file{Makefile} fragments.  The
+package has 30 pages of documentation, and 38 test cases.
+@file{aclocal.m4} contains 4 macros.
+
+From now on and until version 1.4, new releases will occur at a rate
+of about one a year.  1.1 did not exist, actually 1.1b to 1.1p have
+been the name of beta releases for 1.2.  This is the first time
+Automake uses suffix letters to designate beta releases, a habit that
+lasts.
+
+@item 1996-10-10 Kevin Dalley packages Automake 1.0 for Debian GNU/Linux.
+
+@item 1996-11-26 David J.@tie{}MacKenzie releases Autoconf 2.12.
+
+Between June and October, the Autoconf development is almost stalled.
+Roland McGrath has been working at the beginning of the year.  David
+comes back in November to release 2.12, but he won't touch Autoconf
+anymore after this year, and Autoconf then really stagnates.  The
+desolate Autoconf @file{ChangeLog} for 1997 lists only 7 commits.
+
+@item 1997-02-28 @email{automake@@gnu.ai.mit.edu} list alive
+
+The mailing list is announced as follows:
+@smallexample
+I've created the "automake" mailing list.  It is
+"automake@@gnu.ai.mit.edu".  Administrivia, as always, to
+automake-request@@gnu.ai.mit.edu.
+
+The charter of this list is discussion of automake, autoconf, and
+other configuration/portability tools (e.g., libtool).  It is expected
+that discussion will range from pleas for help all the way up to
+patches.
+
+This list is archived on the FSF machines.  Offhand I don't know if
+you can get the archive without an account there.
+
+This list is open to anybody who wants to join.  Tell all your
+friends!
+-- Tom Tromey
+@end smallexample
+
+Before that people were discussing Automake privately, on the Gnits
+mailing list (which is not public either), and less frequently on
+@code{gnu.misc.discuss}.
+
+@code{gnu.ai.mit.edu} is now @code{gnu.org}, in case you never
+noticed.  The archives of the early years of the
+@code{automake@@gnu.org} list have been lost, so today it is almost
+impossible to find traces of discussions that occurred before 1999.
+This has been annoying more than once, as such discussions can be
+useful to understand the rationale behind a piece of uncommented code
+that was introduced back then.
+
+@item 1997-06-22 Automake 1.2
+
+Automake developments continues, and more and more new Autoconf macros
+are required.  Distributing them in @file{aclocal.m4} and requiring
+people to browse this file to extract the relevant macros becomes
+uncomfortable.  Ideally, some of them should be contributed to
+Autoconf so that they can be used directly, however Autoconf is
+currently inactive.  Automake 1.2 consequently introduces
+@command{aclocal} (@command{aclocal} was actually started on
+1996-07-28), a tool that automatically constructs an @file{aclocal.m4}
+file from a repository of third-party macros.  Because Autoconf has
+stalled, Automake also becomes a kind of repository for such
+third-party macros, even macros completely unrelated to Automake (for
+instance macros that fix broken Autoconf macros).
+
+The 1.2 release contains 20 macros, including the
+@code{AM_INIT_AUTOMAKE} macro that simplifies the creation of
+@file{configure.in}.
+
+Libtool is fully supported using @code{*_LTLIBRARIES}.
+
+The missing script is introduced by Fran@,cois Pinard; it is meant
+to be a better solution than @code{AM_MAINTAINER_MODE}
+(@pxref{maintainer-mode, , maintainer-mode, automake, GNU Automake}).
+
+Conditionals support was implemented by Ian Lance Taylor.  At the
+time, Tom and Ian were working on an internal project at Cygnus.  They
+were using ILU, which is pretty similar to CORBA@.  They wanted to
+integrate ILU into their build, which was all @file{configure}-based,
+and Ian thought that adding conditionals to @command{automake} was
+simpler than doing all the work in @file{configure} (which was the
+standard at the time).  So this was actually funded by Cygnus.
+
+This very useful but tricky feature will take a lot of time to
+stabilize.  (At the time this text is written, there are still
+primaries that have not been updated to support conditional
+definitions in Automake 1.9.)
+
+The @command{automake} script has almost doubled: 6089 lines of Perl,
+plus 1294 lines of @file{Makefile} fragments.
+
+@item 1997-07-08 Gordon Matzigkeit releases Libtool 1.0.
+
+@item 1998-04-05 Automake 1.3
+
+This is a small advance compared to 1.2.
+It adds support for assembly, and preliminary support for Java.
+
+Perl 5.004_04 is out, but fixes to support Perl 4 are still
+regularly submitted whenever Automake breaks it.
+
+@item 1998-09-06 @code{sourceware.cygnus.com} is on-line.
+
+Sourceware was setup by Jason Molenda to host open source projects.
+
+@item 1998-09-19  Automake CVS repository moved to @code{sourceware.cygnus.com}
+@itemx 1998-10-26  @code{sourceware.cygnus.com} announces it hosts Automake:
+Automake is now hosted on @code{sourceware.cygnus.com}.  It has a
+publicly accessible CVS repository.  This CVS repository is a copy of
+the one Tom was using on his machine, which in turn is based on
+a copy of the CVS repository of David MacKenzie.  This is why we still
+have to full source history.  (Automake was on Sourceware until 2007-10-29,
+when it moved to a git repository on @code{savannah.gnu.org},
+but the Sourceware host had been renamed to @code{sources.redhat.com}.)
+
+The oldest file in the administrative directory of the CVS repository
+that was created on Sourceware is dated 1998-09-19, while the
+announcement that @command{automake} and @command{autoconf} had joined
+@command{sourceware} was made on 1998-10-26.  They were among the
+first projects to be hosted there.
+
+The heedful reader will have noticed Automake was exactly 4 years old
+on 1998-09-19.
+
+@item 1999-01-05 Ben Elliston releases Autoconf 2.13.
+
+@item 1999-01-14 Automake 1.4
+
+This release adds support for Fortran 77 and for the @code{include}
+statement.  Also, @samp{+=} assignments are introduced, but it is
+still quite easy to fool Automake when mixing this with conditionals.
+
+These two releases, Automake 1.4 and Autoconf 2.13 make a duo that
+will be used together for years.
+
+@command{automake} is 7228 lines, plus 1591 lines of Makefile
+fragment, 20 macros (some 1.3 macros were finally contributed back to
+Autoconf), 197 test cases, and 51 pages of documentation.
+
+@item 1999-03-27 The @code{user-dep-branch} is created on the CVS repository.
+
+This implements a new dependency tracking schemed that should be
+able to handle automatic dependency tracking using any compiler (not
+just gcc) and any make (not just GNU @command{make}).  In addition,
+the new scheme should be more reliable than the old one, as
+dependencies are generated on the end user's machine.  Alexandre Oliva
+creates depcomp for this purpose.
+
+@xref{Dependency Tracking Evolution}, for more details about the
+evolution of automatic dependency tracking in Automake.
+
+@item 1999-11-21 The @code{user-dep-branch} is merged into the main trunk.
+
+This was a huge problem since we also had patches going in on the
+trunk.  The merge took a long time and was very painful.
+
+@item 2000-05-10
+
+Since September 1999 and until 2003, Akim Demaille will be zealously
+revamping Autoconf.
+
+@quotation
+I think the next release should be called "3.0".@*
+Let's face it: you've basically rewritten autoconf.@*
+Every weekend there are 30 new patches.@*
+I don't see how we could call this "2.15" with a straight face.@*
+-- Tom Tromey on @email{autoconf@@gnu.org}
+@end quotation
+
+Actually Akim works like a submarine: he will pile up patches while he
+works off-line during the weekend, and flush them in batch when he
+resurfaces on Monday.
+
+@item 2001-01-24
+
+On this Wednesday, Autoconf 2.49c, the last beta before Autoconf 2.50
+is out, and Akim has to find something to do during his week-end :)
+
+@item 2001-01-28
+
+Akim sends a batch of 14 patches to @email{automake@@gnu.org}.
+
+@quotation
+Aiieeee!  I was dreading the day that the Demaillator turned his
+sights on automake@dots{} and now it has arrived! -- Tom Tromey
+@end quotation
+
+It's only the beginning: in two months he will send 192 patches.  Then
+he would slow down so Tom can catch up and review all this.  Initially
+Tom actually read all these patches, then he probably trustingly
+answered OK to most of them, and finally gave up and let Akim apply
+whatever he wanted.  There was no way to keep up with that patch rate.
+
+@quotation
+Anyway the patch below won't apply since it predates Akim's
+sourcequake; I have yet to figure where the relevant passage has
+been moved :) -- Alexandre Duret-Lutz
+@end quotation
+
+All these patches were sent to and discussed on
+@email{automake@@gnu.org}, so subscribed users were literally drowning in
+technical mails.  Eventually, the @email{automake-patches@@gnu.org}
+mailing list was created in May.
+
+Year after year, Automake had drifted away from its initial design:
+construct @file{Makefile.in} by assembling various @file{Makefile}
+fragments.  In 1.4, lots of @file{Makefile} rules are being emitted at
+various places in the @command{automake} script itself; this does not
+help ensuring a consistent treatment of these rules (for instance
+making sure that user-defined rules override Automake's own rules).
+One of Akim's goal was moving all these hard-coded rules to separate
+@file{Makefile} fragments, so the logic could be centralized in a
+@file{Makefile} fragment processor.
+
+Another significant contribution of Akim is the interface with the
+``trace'' feature of Autoconf.  The way to scan @file{configure.in} at
+this time was to read the file and grep the various macro of interest
+to Automake.  Doing so could break in many unexpected ways; @command{automake}
+could miss some definition (for instance @samp{AC_SUBST([$1], [$2])}
+where the arguments are known only when M4 is run), or conversely it
+could detect some macro that was not expanded (because it is called
+conditionally).  In the CVS version of Autoconf, Akim had implemented
+the @option{--trace} option, which provides accurate information about
+where macros are actually called and with what arguments.  Akim will
+equip Automake with a second @file{configure.in} scanner that uses
+this @option{--trace} interface.  Since it was not sensible to drop the
+Autoconf 2.13 compatibility yet, this experimental scanner was only
+used when an environment variable was set, the traditional
+grep-scanner being still the default.
+
+@item 2001-04-25 Gary V.@tie{}Vaughan releases Libtool 1.4
+
+It has been more than two years since Automake 1.4, CVS Automake has
+suffered lot's of heavy changes and still is not ready for release.
+Libtool 1.4 had to be distributed with a patch against Automake 1.4.
+
+@item 2001-05-08 Automake 1.4-p1
+@itemx 2001-05-24 Automake 1.4-p2
+
+Gary V.@tie{}Vaughan, the principal Libtool maintainer, makes a ``patch
+release'' of Automake:
+
+@quotation
+The main purpose of this release is to have a stable automake
+which is compatible with the latest stable libtool.
+@end quotation
+
+The release also contains obvious fixes for bugs in Automake 1.4,
+some of which were reported almost monthly.
+
+@item 2001-05-21 Akim Demaille releases Autoconf 2.50
+
+@item 2001-06-07 Automake 1.4-p3
+@itemx 2001-06-10 Automake 1.4-p4
+@itemx 2001-07-15 Automake 1.4-p5
+
+Gary continues his patch-release series.  These also add support for
+some new Autoconf 2.50 idioms.  Essentially, Autoconf now advocates
+@file{configure.ac} over @file{configure.in}, and it introduces a new
+syntax for @code{AC_OUTPUT}ing files.
+
+@item 2001-08-23 Automake 1.5
+
+A major and long-awaited release, that comes more than two years after
+1.4.  It brings many changes, among which:
+@itemize
+@item The new dependency tracking scheme that uses @command{depcomp}.
+Aside from the improvement on the dependency tracking itself
+(@pxref{Dependency Tracking Evolution}), this also streamlines the use
+of @command{automake}-generated @file{Makefile.in}s as the @file{Makefile.in}s
+used during development are now the same as those used in
+distributions.  Before that the @file{Makefile.in}s generated for
+maintainers required GNU @command{make} and GCC, they were different
+from the portable @file{Makefile} generated for distribution; this was
+causing some confusion.
+
+@item Support for per-target compilation flags.
+
+@item Support for reference to files in subdirectories in most
+@file{Makefile.am} variables.
+
+@item Introduction of the @code{dist_}, @code{nodist_}, and @code{nobase_}
+prefixes.
+@item Perl 4 support is finally dropped.
+@end itemize
+
+1.5 did break several packages that worked with 1.4.  Enough so that
+Linux distributions could not easily install the new Automake version
+without breaking many of the packages for which they had to run
+@command{automake}.
+
+Some of these breakages were effectively bugs that would eventually be
+fixed in the next release.  However, a lot of damage was caused by
+some changes made deliberately to render Automake stricter on some
+setup we did consider bogus.  For instance, @samp{make distcheck} was
+improved to check that @samp{make uninstall} did remove all the files
+@samp{make install} installed, that @samp{make distclean} did not omit
+some file, and that a VPATH build would work even if the source
+directory was read-only.  Similarly, Automake now rejects multiple
+definitions of the same variable (because that would mix very badly
+with conditionals), and @samp{+=} assignments with no previous
+definition.  Because these changes all occurred suddenly after 1.4 had
+been established for more than two years, it hurt users.
+
+To make matter worse, meanwhile Autoconf (now at version 2.52) was
+facing similar troubles, for similar reasons.
+
+@item 2002-03-05 Automake 1.6
+
+This release introduced versioned installation (@pxref{API Versioning, ,
+API Versioning, automake, GNU Automake}). This was mainly pushed by
+Havoc Pennington, taking the GNOME source tree as motive: due to
+incompatibilities between the autotools it's impossible for the GNOME
+packages to switch to Autoconf 2.53 and Automake 1.5 all at once, so
+they are currently stuck with Autoconf 2.13 and Automake 1.4.
+
+The idea was to call this version @file{automake-1.6}, call all its
+bug-fix versions identically, and switch to @file{automake-1.7} for
+the next release that adds new features or changes some rules.  This
+scheme implies maintaining a bug-fix branch in addition to the
+development trunk, which means more work from the maintainer, but
+providing regular bug-fix releases proved to be really worthwhile.
+
+Like 1.5, 1.6 also introduced a bunch of incompatibilities, intentional or
+not.  Perhaps the more annoying was the dependence on the newly
+released Autoconf 2.53.  Autoconf seemed to have stabilized enough
+since its explosive 2.50 release and included changes required to fix
+some bugs in Automake.  In order to upgrade to Automake 1.6, people
+now had to upgrade Autoconf too; for some packages it was no picnic.
+
+While versioned installation helped people to upgrade, it also
+unfortunately allowed people not to upgrade.  At the time of writing,
+some Linux distributions are shipping packages for Automake 1.4, 1.5,
+1.6, 1.7, 1.8, and 1.9.  Most of these still install 1.4 by default.
+Some distribution also call 1.4 the ``stable'' version, and present
+``1.9'' as the development version; this does not really makes sense
+since 1.9 is way more solid than 1.4.  All this does not help the
+newcomer.
+
+@item 2002-04-11 Automake 1.6.1
+
+1.6, and the upcoming 1.4-p6 release were the last release by Tom.
+This one and those following will be handled by Alexandre
+Duret-Lutz.  Tom is still around, and will be there until about 1.7,
+but his interest into Automake is drifting away towards projects like
+@command{gcj}.
+
+Alexandre has been using Automake since 2000, and started to
+contribute mostly on Akim's incitement (Akim and Alexandre have been
+working in the same room from 1999 to 2002).  In 2001 and 2002 he had
+a lot of free time to enjoy hacking Automake.
+
+@item 2002-06-14 Automake 1.6.2
+
+@item 2002-07-28 Automake 1.6.3
+@itemx 2002-07-28 Automake 1.4-p6
+
+Two releases on the same day.  1.6.3 is a bug-fix release.
+
+Tom Tromey backported the versioned installation mechanism on the 1.4
+branch, so that Automake 1.6.x and Automake 1.4-p6 could be installed
+side by side.  Another request from the GNOME folks.
+
+@item 2002-09-25 Automake 1.7
+
+This release switches to the new @file{configure.ac} scanner Akim
+was experimenting in 1.5.
+
+@item 2002-10-16 Automake 1.7.1
+@itemx 2002-12-06 Automake 1.7.2
+@itemx 2003-02-20 Automake 1.7.3
+@itemx 2003-04-23 Automake 1.7.4
+@itemx 2003-05-18 Automake 1.7.5
+@itemx 2003-07-10 Automake 1.7.6
+@itemx 2003-09-07 Automake 1.7.7
+@itemx 2003-10-07 Automake 1.7.8
+
+Many bug-fix releases.  1.7 lasted because the development version
+(upcoming 1.8) was suffering some major internal revamping.
+
+@item 2003-10-26 Automake on screen
+
+Episode 49, `Repercussions', in the third season of the `Alias' TV
+show is first aired.
+
+Marshall, one of the characters, is working on a computer virus that he
+has to modify before it gets into the wrong hands or something like
+that.  The screenshots you see do not show any program code, they show
+a @file{Makefile.in} generated by automake...
+
+@item 2003-11-09 Automake 1.7.9
+
+@item 2003-12-10 Automake 1.8
+
+The most striking update is probably that of @command{aclocal}.
+
+@command{aclocal} now uses @code{m4_include} in the produced
+@file{aclocal.m4} when the included macros are already distributed
+with the package (an idiom used in many packages), which reduces code
+duplication.  Many people liked that, but in fact this change was
+really introduced to fix a bug in rebuild rules: @file{Makefile.in}
+must be rebuilt whenever a dependency of @file{configure} changes, but
+all the @file{m4} files included in @file{aclocal.m4} where unknown
+from @command{automake}.  Now @command{automake} can just trace the
+@code{m4_include}s to discover the dependencies.
+
+@command{aclocal} also starts using the @option{--trace} Autoconf option
+in order to discover used macros more accurately.  This will turn out
+to be very tricky (later releases will improve this) as people had
+devised many ways to cope with the limitation of previous
+@command{aclocal} versions, notably using handwritten
+@code{m4_include}s: @command{aclocal} must make sure not to redefine a
+rule that is already included by such statement.
+
+Automake also has seen its guts rewritten.  Although this rewriting
+took a lot of efforts, it is only apparent to the users in that some
+constructions previously disallowed by the implementation now work
+nicely.  Conditionals, Locations, Variable and Rule definitions,
+Options: these items on which Automake works have been rewritten as
+separate Perl modules, and documented.
+
+@itemx 2004-01-11 Automake 1.8.1
+@itemx 2004-01-12 Automake 1.8.2
+@itemx 2004-03-07 Automake 1.8.3
+@itemx 2004-04-25 Automake 1.8.4
+@itemx 2004-05-16 Automake 1.8.5
+
+@item 2004-07-28 Automake 1.9
+
+This release tries to simplify the compilation rules it outputs to
+reduce the size of the Makefile.  The complaint initially come from
+the libgcj developers.  Their @file{Makefile.in} generated with
+Automake 1.4 and custom build rules (1.4 did not support compiled
+Java) is 250KB@.  The one generated by 1.8 was over 9MB@!  1.9 gets it
+down to 1.2MB@.
+
+Aside from this it contains mainly minor changes and bug-fixes.
+
+@itemx 2004-08-11 Automake 1.9.1
+@itemx 2004-09-19 Automake 1.9.2
+
+Automake has ten years.  This chapter of the manual was initially
+written for this occasion.
+
+@itemx 2007-10-29 Automake repository moves to @code{savannah.gnu.org}
+and uses git as primary repository.
+
+@end table
+
+@node Dependency Tracking Evolution
+@chapter Evolution of Automatic Dependency Tracking
+
+Over the years Automake has deployed three different dependency
+tracking methods.  Each method, including the current one, has had
+flaws of various sorts.  Here we lay out the different dependency
+tracking methods, their flaws, and their fixes.  We conclude with
+recommendations for tool writers, and by indicating future directions
+for dependency tracking work in Automake.
+
+@menu
+* First Take on Dependencies::    Precomputed dependency tracking
+* Dependencies As Side Effects::  Update at developer compile time
+* Dependencies for the User::     Update at user compile time
+* Techniques for Dependencies::   Alternative approaches
+@end menu
+
+@node First Take on Dependencies
+@section First Take on Dependency Tracking
+@unnumberedsubsec Description
+
+Our first attempt at automatic dependency tracking was based on the
+method recommended by GNU @command{make}.  (@pxref{Automatic
+Prerequisites, , Generating Prerequisites Automatically, make, The GNU
+make Manual})
+
+This version worked by precomputing dependencies ahead of time.  For
+each source file, it had a special @file{.P} file that held the
+dependencies.  There was a rule to generate a @file{.P} file by
+invoking the compiler appropriately.  All such @file{.P} files were
+included by the @file{Makefile}, thus implicitly becoming dependencies
+of @file{Makefile}.
+
+@unnumberedsubsec Bugs
+
+This approach had several critical bugs.
+
+@itemize
+@item
+The code to generate the @file{.P} file relied on @command{gcc}.
+(A limitation, not technically a bug.)
+@item
+The dependency tracking mechanism itself relied on GNU @command{make}.
+(A limitation, not technically a bug.)
+@item
+Because each @file{.P} file was a dependency of @file{Makefile}, this
+meant that dependency tracking was done eagerly by @command{make}.
+For instance, @samp{make clean} would cause all the dependency files
+to be updated, and then immediately removed.  This eagerness also
+caused problems with some configurations; if a certain source file
+could not be compiled on a given architecture for some reason,
+dependency tracking would fail, aborting the entire build.
+@item
+As dependency tracking was done as a pre-pass, compile times were
+doubled--the compiler had to be run twice per source file.
+@item
+@samp{make dist} re-ran @command{automake} to generate a
+@file{Makefile} that did not have automatic dependency tracking (and
+that was thus portable to any version of @command{make}).  In order to
+do this portably, Automake had to scan the dependency files and remove
+any reference that was to a source file not in the distribution.
+This process was error-prone.  Also, if @samp{make dist} was run in an
+environment where some object file had a dependency on a source file
+that was only conditionally created, Automake would generate a
+@file{Makefile} that referred to a file that might not appear in the
+end user's build.  A special, hacky mechanism was required to work
+around this.
+@end itemize
+
+@unnumberedsubsec Historical Note
+
+The code generated by Automake is often inspired by the
+@file{Makefile} style of a particular author.  In the case of the first
+implementation of dependency tracking, I believe the impetus and
+inspiration was Jim Meyering.  (I could be mistaken.  If you know
+otherwise feel free to correct me.)
+
+@node Dependencies As Side Effects
+@section Dependencies As Side Effects
+@unnumberedsubsec Description
+
+The next refinement of Automake's automatic dependency tracking scheme
+was to implement dependencies as side effects of the compilation.
+This was aimed at solving the most commonly reported problems with the
+first approach.  In particular we were most concerned with eliminating
+the weird rebuilding effect associated with make clean.
+
+In this approach, the @file{.P} files were included using the
+@code{-include} command, which let us create these files lazily.  This
+avoided the @samp{make clean} problem.
+
+We only computed dependencies when a file was actually compiled.  This
+avoided the performance penalty associated with scanning each file
+twice.  It also let us avoid the other problems associated with the
+first, eager, implementation.  For instance, dependencies would never
+be generated for a source file that was not compilable on a given
+architecture (because it in fact would never be compiled).
+
+@unnumberedsubsec Bugs
+
+@itemize
+@item
+This approach also relied on the existence of @command{gcc} and GNU
+@command{make}.  (A limitation, not technically a bug.)
+@item
+Dependency tracking was still done by the developer, so the problems
+from the first implementation relating to massaging of dependencies by
+@samp{make dist} were still in effect.
+@item
+This implementation suffered from the ``deleted header file'' problem.
+Suppose a lazily-created @file{.P} file includes a dependency on a
+given header file, like this:
+
+@example
+maude.o: maude.c something.h
+@end example
+
+Now suppose that you remove @file{something.h} and update @file{maude.c}
+so that this include is no longer needed.  If you run @command{make},
+you will get an error because there is no way to create
+@file{something.h}.
+
+We fixed this problem in a later release by further massaging the
+output of @command{gcc} to include a dummy dependency for each header
+file.
+@end itemize
+
+@node Dependencies for the User
+@section Dependencies for the User
+@unnumberedsubsec Description
+
+The bugs associated with @samp{make dist}, over time, became a real
+problem.  Packages using Automake were being built on a large number
+of platforms, and were becoming increasingly complex.  Broken
+dependencies were distributed in ``portable'' @file{Makefile.in}s,
+leading to user complaints.  Also, the requirement for @command{gcc}
+and GNU @command{make} was a constant source of bug reports.  The next
+implementation of dependency tracking aimed to remove these problems.
+
+We realized that the only truly reliable way to automatically track
+dependencies was to do it when the package itself was built.  This
+meant discovering a method portable to any version of make and any
+compiler.  Also, we wanted to preserve what we saw as the best point
+of the second implementation: dependency computation as a side effect
+of compilation.
+
+In the end we found that most modern make implementations support some
+form of include directive.  Also, we wrote a wrapper script that let
+us abstract away differences between dependency tracking methods for
+compilers.  For instance, some compilers cannot generate dependencies
+as a side effect of compilation.  In this case we simply have the
+script run the compiler twice.  Currently our wrapper script
+(@command{depcomp}) knows about twelve different compilers (including
+a "compiler" that simply invokes @command{makedepend} and then the
+real compiler, which is assumed to be a standard Unix-like C compiler
+with no way to do dependency tracking).
+
+@unnumberedsubsec Bugs
+
+@itemize
+@item
+Running a wrapper script for each compilation slows down the build.
+@item
+Many users don't really care about precise dependencies.
+@item
+This implementation, like every other automatic dependency tracking
+scheme in common use today (indeed, every one we've ever heard of),
+suffers from the ``duplicated new header'' bug.
+
+This bug occurs because dependency tracking tools, such as the
+compiler, only generate dependencies on the successful opening of a
+file, and not on every probe.
+
+Suppose for instance that the compiler searches three directories for
+a given header, and that the header is found in the third directory.
+If the programmer erroneously adds a header file with the same name to
+the first directory, then a clean rebuild from scratch could fail
+(suppose the new header file is buggy), whereas an incremental rebuild
+will succeed.
+
+What has happened here is that people have a misunderstanding of what
+a dependency is.  Tool writers think a dependency encodes information
+about which files were read by the compiler.  However, a dependency
+must actually encode information about what the compiler tried to do.
+
+This problem is not serious in practice.  Programmers typically do not
+use the same name for a header file twice in a given project.  (At
+least, not in C or C++.  This problem may be more troublesome in
+Java.)  This problem is easy to fix, by modifying dependency
+generators to record every probe, instead of every successful open.
+
+@item
+Since Automake generates dependencies as a side effect of compilation,
+there is a bootstrapping problem when header files are generated by
+running a program.  The problem is that, the first time the build is
+done, there is no way by default to know that the headers are
+required, so make might try to run a compilation for which the headers
+have not yet been built.
+
+This was also a problem in the previous dependency tracking implementation.
+
+The current fix is to use @code{BUILT_SOURCES} to list built headers
+(@pxref{Sources, , Sources, automake, GNU Automake}).  This causes them
+to be built before any other build rules are run.  This is unsatisfactory
+as a general solution, however in practice it seems sufficient for most
+actual programs.
+@end itemize
+
+This code is used since Automake 1.5.
+
+In GCC 3.0, we managed to convince the maintainers to add special
+command-line options to help Automake more efficiently do its job.  We
+hoped this would let us avoid the use of a wrapper script when
+Automake's automatic dependency tracking was used with @command{gcc}.
+
+Unfortunately, this code doesn't quite do what we want.  In
+particular, it removes the dependency file if the compilation fails;
+we'd prefer that it instead only touch the file in any way if the
+compilation succeeds.
+
+Nevertheless, since Automake 1.7, when a recent @command{gcc} is
+detected at @command{configure} time, we inline the
+dependency-generation code and do not use the @command{depcomp}
+wrapper script.  This makes compilations faster for those using this
+compiler (probably our primary user base).  The counterpart is that
+because we have to encode two compilation rules in @file{Makefile}
+(with or without @command{depcomp}), the produced @file{Makefile}s are
+larger.
+
+@node Techniques for Dependencies
+@section Techniques for Computing Dependencies
+
+There are actually several ways for a build tool like Automake to
+cause tools to generate dependencies.
+
+@table @asis
+@item @command{makedepend}
+This was a commonly-used method in the past.  The idea is to run a
+special program over the source and have it generate dependency
+information.  Traditional implementations of @command{makedepend} are
+not completely precise; ordinarily they were conservative and
+discovered too many dependencies.
+@item The tool
+An obvious way to generate dependencies is to simply write the tool so
+that it can generate the information needed by the build tool.  This is
+also the most portable method.  Many compilers have an option to
+generate dependencies.  Unfortunately, not all tools provide such an
+option.
+@item The file system
+It is possible to write a special file system that tracks opens,
+reads, writes, etc, and then feed this information back to the build
+tool.  @command{clearmake} does this.  This is a very powerful
+technique, as it doesn't require cooperation from the
+tool.  Unfortunately it is also very difficult to implement and also
+not practical in the general case.
+@item @code{LD_PRELOAD}
+Rather than use the file system, one could write a special library to
+intercept @code{open} and other syscalls.  This technique is also quite
+powerful, but unfortunately it is not portable enough for use in
+@command{automake}.
+@end table
+
+@menu
+* Recommendations for Tool Writers::
+* Future Directions for Dependencies::
+@end menu
+
+@node Recommendations for Tool Writers
+@subsection Recommendations for Tool Writers
+
+We think that every compilation tool ought to be able to generate
+dependencies as a side effect of compilation.  Furthermore, at least
+while @command{make}-based tools are nearly universally in use (at
+least in the free software community), the tool itself should generate
+dummy dependencies for header files, to avoid the deleted header file
+bug.  Finally, the tool should generate a dependency for each probe,
+instead of each successful file open, in order to avoid the duplicated
+new header bug.
+
+@node Future Directions for Dependencies
+@subsection Future Directions for Dependencies
+
+Currently, only languages and compilers understood by Automake can
+have dependency tracking enabled.  We would like to see if it is
+practical (and worthwhile) to let this support be extended by the user
+to languages unknown to Automake.
+
+@node Releases
+@chapter Release Statistics
+
+The following table (inspired by @samp{perlhist(1)}) quantifies the
+evolution of Automake using these metrics:
+
+@table @asis
+@item Date, Rel
+The date and version of the release.
+@item am
+The number of lines of the @command{automake} script.
+@item acl
+The number of lines of the @command{aclocal} script.
+@item pm
+The number of lines of the @command{Perl} supporting modules.
+@item @file{*.am}
+The number of lines of the @file{Makefile} fragments.  The number in
+parentheses is the number of files.
+@item m4
+The number of lines (and files) of Autoconf macros.
+@item doc
+The number of pages of the documentation (the Postscript version).
+@item t
+The number of test cases in the test suite.  Of those, the number in
+parentheses is the number of generated test cases.
+@end table
+
+@multitable {8888-88-88} {8.8-p8} {8888} {8888} {8888} {8888 (88)} {8888 (88)} {888} {888 (88)}
+@headitem Date   @tab Rel    @tab   am @tab acl @tab   pm @tab @file{*.am} @tab m4 @tab doc @tab t
+@item 1994-09-19 @tab CVS    @tab  141 @tab     @tab      @tab  299 (24) @tab           @tab     @tab
+@item 1994-11-05 @tab CVS    @tab  208 @tab     @tab      @tab  332 (28) @tab           @tab     @tab
+@item 1995-11-23 @tab 0.20   @tab  533 @tab     @tab      @tab  458 (35) @tab           @tab   9 @tab
+@item 1995-11-26 @tab 0.21   @tab  613 @tab     @tab      @tab  480 (36) @tab           @tab  11 @tab
+@item 1995-11-28 @tab 0.22   @tab 1116 @tab     @tab      @tab  539 (38) @tab           @tab  12 @tab
+@item 1995-11-29 @tab 0.23   @tab 1240 @tab     @tab      @tab  541 (38) @tab           @tab  12 @tab
+@item 1995-12-08 @tab 0.24   @tab 1462 @tab     @tab      @tab  504 (33) @tab           @tab  14 @tab
+@item 1995-12-10 @tab 0.25   @tab 1513 @tab     @tab      @tab  511 (37) @tab           @tab  15 @tab
+@item 1996-01-03 @tab 0.26   @tab 1706 @tab     @tab      @tab  438 (36) @tab           @tab  16 @tab
+@item 1996-01-03 @tab 0.27   @tab 1706 @tab     @tab      @tab  438 (36) @tab           @tab  16 @tab
+@item 1996-01-13 @tab 0.28   @tab 1964 @tab     @tab      @tab  934 (33) @tab           @tab  16 @tab
+@item 1996-02-07 @tab 0.29   @tab 2299 @tab     @tab      @tab  936 (33) @tab           @tab  17 @tab
+@item 1996-02-24 @tab 0.30   @tab 2544 @tab     @tab      @tab  919 (32) @tab   85 (1)  @tab  20 @tab 9
+@item 1996-03-11 @tab 0.31   @tab 2877 @tab     @tab      @tab  919 (32) @tab   85 (1)  @tab  29 @tab 17
+@item 1996-04-27 @tab 0.32   @tab 3058 @tab     @tab      @tab  921 (31) @tab   85 (1)  @tab  30 @tab 26
+@item 1996-05-18 @tab 0.33   @tab 3110 @tab     @tab      @tab  926 (31) @tab  105 (1)  @tab  30 @tab 35
+@item 1996-05-28 @tab 1.0    @tab 3134 @tab     @tab      @tab  973 (32) @tab  105 (1)  @tab  30 @tab 38
+@item 1997-06-22 @tab 1.2    @tab 6089 @tab 385 @tab      @tab 1294 (36) @tab  592 (20) @tab  37 @tab 126
+@item 1998-04-05 @tab 1.3    @tab 6415 @tab 422 @tab      @tab 1470 (39) @tab  741 (23) @tab  39 @tab 156
+@item 1999-01-14 @tab 1.4    @tab 7240 @tab 426 @tab      @tab 1591 (40) @tab  734 (20) @tab  51 @tab 197
+@item 2001-05-08 @tab 1.4-p1 @tab 7251 @tab 426 @tab      @tab 1591 (40) @tab  734 (20) @tab  51 @tab 197
+@item 2001-05-24 @tab 1.4-p2 @tab 7268 @tab 439 @tab      @tab 1591 (40) @tab  734 (20) @tab  49 @tab 197
+@item 2001-06-07 @tab 1.4-p3 @tab 7312 @tab 439 @tab      @tab 1591 (40) @tab  734 (20) @tab  49 @tab 197
+@item 2001-06-10 @tab 1.4-p4 @tab 7321 @tab 439 @tab      @tab 1591 (40) @tab  734 (20) @tab  49 @tab 198
+@item 2001-07-15 @tab 1.4-p5 @tab 7228 @tab 426 @tab      @tab 1596 (40) @tab  734 (20) @tab  51 @tab 198
+@item 2001-08-23 @tab 1.5    @tab 8016 @tab 475 @tab  600 @tab 2654 (39) @tab 1166 (29) @tab  63 @tab 327
+@item 2002-03-05 @tab 1.6    @tab 8465 @tab 475 @tab 1136 @tab 2732 (39) @tab 1603 (27) @tab  66 @tab 365
+@item 2002-04-11 @tab 1.6.1  @tab 8544 @tab 475 @tab 1136 @tab 2741 (39) @tab 1603 (27) @tab  66 @tab 372
+@item 2002-06-14 @tab 1.6.2  @tab 8575 @tab 475 @tab 1136 @tab 2800 (39) @tab 1609 (27) @tab  67 @tab 386
+@item 2002-07-28 @tab 1.6.3  @tab 8600 @tab 475 @tab 1153 @tab 2809 (39) @tab 1609 (27) @tab  67 @tab 391
+@item 2002-07-28 @tab 1.4-p6 @tab 7332 @tab 455 @tab      @tab 1596 (40) @tab  735 (20) @tab  49 @tab 197
+@item 2002-09-25 @tab 1.7    @tab 9189 @tab 471 @tab 1790 @tab 2965 (39) @tab 1606 (28) @tab  73 @tab 430
+@item 2002-10-16 @tab 1.7.1  @tab 9229 @tab 475 @tab 1790 @tab 2977 (39) @tab 1606 (28) @tab  73 @tab 437
+@item 2002-12-06 @tab 1.7.2  @tab 9334 @tab 475 @tab 1790 @tab 2988 (39) @tab 1606 (28) @tab  77 @tab 445
+@item 2003-02-20 @tab 1.7.3  @tab 9389 @tab 475 @tab 1790 @tab 3023 (39) @tab 1651 (29) @tab  84 @tab 448
+@item 2003-04-23 @tab 1.7.4  @tab 9429 @tab 475 @tab 1790 @tab 3031 (39) @tab 1644 (29) @tab  85 @tab 458
+@item 2003-05-18 @tab 1.7.5  @tab 9429 @tab 475 @tab 1790 @tab 3033 (39) @tab 1645 (29) @tab  85 @tab 459
+@item 2003-07-10 @tab 1.7.6  @tab 9442 @tab 475 @tab 1790 @tab 3033 (39) @tab 1660 (29) @tab  85 @tab 461
+@item 2003-09-07 @tab 1.7.7  @tab 9443 @tab 475 @tab 1790 @tab 3041 (39) @tab 1660 (29) @tab  90 @tab 467
+@item 2003-10-07 @tab 1.7.8  @tab 9444 @tab 475 @tab 1790 @tab 3041 (39) @tab 1660 (29) @tab  90 @tab 468
+@item 2003-11-09 @tab 1.7.9  @tab 9444 @tab 475 @tab 1790 @tab 3048 (39) @tab 1660 (29) @tab  90 @tab 468
+@item 2003-12-10 @tab 1.8    @tab 7171 @tab 585 @tab 7730 @tab 3236 (39) @tab 1666 (31) @tab 104 @tab 521
+@item 2004-01-11 @tab 1.8.1  @tab 7217 @tab 663 @tab 7726 @tab 3287 (39) @tab 1686 (31) @tab 104 @tab 525
+@item 2004-01-12 @tab 1.8.2  @tab 7217 @tab 663 @tab 7726 @tab 3288 (39) @tab 1686 (31) @tab 104 @tab 526
+@item 2004-03-07 @tab 1.8.3  @tab 7214 @tab 686 @tab 7735 @tab 3303 (39) @tab 1695 (31) @tab 111 @tab 530
+@item 2004-04-25 @tab 1.8.4  @tab 7214 @tab 686 @tab 7736 @tab 3310 (39) @tab 1701 (31) @tab 112 @tab 531
+@item 2004-05-16 @tab 1.8.5  @tab 7240 @tab 686 @tab 7736 @tab 3299 (39) @tab 1701 (31) @tab 112 @tab 533
+@item 2004-07-28 @tab 1.9    @tab 7508 @tab 715 @tab 7794 @tab 3352 (40) @tab 1812 (32) @tab 115 @tab 551
+@item 2004-08-11 @tab 1.9.1  @tab 7512 @tab 715 @tab 7794 @tab 3354 (40) @tab 1812 (32) @tab 115 @tab 552
+@item 2004-09-19 @tab 1.9.2  @tab 7512 @tab 715 @tab 7794 @tab 3354 (40) @tab 1812 (32) @tab 132 @tab 554
+@item 2004-11-01 @tab 1.9.3  @tab 7507 @tab 718 @tab 7804 @tab 3354 (40) @tab 1812 (32) @tab 134 @tab 556
+@item 2004-12-18 @tab 1.9.4  @tab 7508 @tab 718 @tab 7856 @tab 3361 (40) @tab 1811 (32) @tab 140 @tab 560
+@item 2005-02-13 @tab 1.9.5  @tab 7523 @tab 719 @tab 7859 @tab 3373 (40) @tab 1453 (32) @tab 142 @tab 562
+@item 2005-07-10 @tab 1.9.6  @tab 7539 @tab 699 @tab 7867 @tab 3400 (40) @tab 1453 (32) @tab 144 @tab 570
+@item 2006-10-15 @tab 1.10   @tab 7859 @tab 1072 @tab 8024 @tab 3512 (40) @tab 1496 (34) @tab 172 @tab 604
+@item 2008-01-19 @tab 1.10.1 @tab 7870 @tab 1089 @tab 8025 @tab 3520 (40) @tab 1499 (34) @tab 173 @tab 617
+@item 2008-11-23 @tab 1.10.2 @tab 7882 @tab 1089 @tab 8027 @tab 3540 (40) @tab 1509 (34) @tab 176 @tab 628
+@item 2009-05-17 @tab 1.11   @tab 8721 @tab 1092 @tab 8289 @tab 4164 (42) @tab 1714 (37) @tab 181 @tab 732 (20)
+@end multitable
+
+
+@c ========================================================== Appendices
+
+@page
+@node Copying This Manual
+@appendix Copying This Manual
+
+@menu
+* GNU Free Documentation License::  License for copying this manual
+@end menu
+
+@node GNU Free Documentation License
+@appendixsec GNU Free Documentation License
+@include fdl.texi
+
+@bye
index fb0e5e7..0679ee2 100644 (file)
@@ -123,7 +123,6 @@ section entitled ``GNU Free Documentation License.''
 * API Versioning::              About compatibility between Automake versions
 * Upgrading::                   Upgrading to a Newer Automake Version
 * FAQ::                         Frequently Asked Questions
-* History::                     Notes about the history of Automake
 * Copying This Manual::         How to make copies of this manual
 * Indices::                     Indices of variables, macros, and concepts
 
@@ -230,7 +229,6 @@ Building Programs and Libraries
 * Java Support with gcj::       Compiling Java sources using gcj
 * Vala Support::                Compiling Vala sources
 * Support for Other Languages::  Compiling other languages
-* ANSI::                        Automatic de-ANSI-fication (deprecated, soon to be removed)
 * Dependencies::                Automatic dependency tracking
 * EXEEXT::                      Support for executable extensions
 
@@ -314,16 +312,47 @@ What Goes in a Distribution
 
 Support for test suites
 
-* Simple Tests::                Listing programs and scripts in @code{TESTS}
-* Simple Tests using parallel-tests::  More powerful test driver
-* DejaGnu Tests::               Interfacing with the external testing framework
+* Generalities about Testing::  Generic concepts and terminology about testing
+* Simple Tests::                Listing test scripts in @code{TESTS}
+* Custom Test Drivers::         Writing and using custom test drivers
+* Using the TAP test protocol:: Integrating test scripts that use the TAP protocol
+* DejaGnu Tests::               Interfacing with the @command{dejagnu} testing framework
 * Install Tests::               Running tests on installed packages
 
+Simple Tests
+
+* Scripts-based Testsuites::    Automake-specific concepts and terminology
+* Serial Test Harness::         Older (and obsolescent) serial test harness
+* Parallel Test Harness::       Generic concurrent test harness
+
+Using the TAP test protocol
+
+* Introduction to TAP::
+* Use TAP with the Automake test harness::
+* Incompatibilities with other TAP parsers and drivers::
+* Links and external resources on TAP::
+
+Custom Test Drivers
+
+* Overview of Custom Test Drivers Support::
+* Declaring Custom Test Drivers::
+* API for Custom Test Drivers::
+
+API for Custom Test Drivers
+
+* Command-line arguments for test drivers::
+* Log files generation and test results recording::
+* Testsuite progress output::
+
+Changing Automake's Behavior
+
+* Options generalities::        Semantics of Automake option
+* List of Automake options::    A comprehensive list of Automake options
+
 Miscellaneous Rules
 
-* Tags::                        Interfacing to etags and mkid
+* Tags::                        Interfacing to cscope, etags and mkid
 * Suffixes::                    Handling new file extensions
-* Multilibs::                   Support for multilibs (deprecated, soon to be removed).
 
 Conditionals
 
@@ -356,21 +385,6 @@ Frequently Asked Questions about Automake
 * Debugging Make Rules::        Strategies when things don't work as expected
 * Reporting Bugs::              Feedback on bugs and feature requests
 
-History of Automake
-
-* Timeline::                    The Automake story.
-* Dependency Tracking Evolution::  Evolution of Automatic Dependency Tracking
-* Releases::                    Statistics about Automake Releases
-
-Dependency Tracking in Automake
-
-* First Take on Dependencies::  Precomputed dependency tracking
-* Dependencies As Side Effects::  Update at developer compile time
-* Dependencies for the User::   Update at user compile time
-* Techniques for Dependencies::  Alternative approaches
-* Recommendations for Tool Writers::  What tool writers can do to help
-* Future Directions for Dependencies::  Languages Automake does not know
-
 Copying This Manual
 
 * GNU Free Documentation License::  License for copying this manual
@@ -1302,8 +1316,9 @@ must be passed to @command{configure} to activate them.
 Do not reject slow dependency extractors.
 @end table
 
-@xref{Dependency Tracking Evolution}, for some discussion about the
-different dependency tracking schemes used by Automake over the years.
+@xref{Dependency Tracking Evolution, , Dependency Tracking Evolution,
+automake-history, Brief History of Automake}, for some discussion about
+the different dependency tracking schemes used by Automake over the years.
 
 @node Nested Packages
 @subsection Nested Packages
@@ -1924,7 +1939,9 @@ The valid strictness levels are:
 Automake will check for only those things that are absolutely
 required for proper operations.  For instance, whereas GNU standards
 dictate the existence of a @file{NEWS} file, it will not be required in
-this mode.  The name comes from the fact that Automake is intended to be
+this mode.  This strictness will also turn off some warnings by default
+(among them, portability warnings).
+The name comes from the fact that Automake is intended to be
 used for GNU programs; these relaxed rules are not the standard mode of
 operation.
 
@@ -2246,16 +2263,18 @@ copies are updated before each release, but we mention the original
 source in case you need more recent versions.
 
 @table @code
-@item ansi2knr.c
-@itemx ansi2knr.1
-These two files are used for de-ANSI-fication support (they are
-deprecated now, and @emph{will be removed} in the next major Automake
-release; @pxref{ANSI}).
+@item ar-lib
+This is a wrapper primarily for the Microsoft lib archiver, to make
+it more POSIX-like.
 
 @item compile
 This is a wrapper for compilers that do not accept options @option{-c}
 and @option{-o} at the same time.  It is only used when absolutely
-required.  Such compilers are rare.
+required.  Such compilers are rare, with the Microsoft C/C++ Compiler
+as the most notable exception. This wrapper also makes the following
+common options available for that compiler, while performing file name
+translation where needed: @option{-I}, @option{-L}, @option{-l},
+@option{-Wl,} and @option{-Xlinker}.
 
 @item config.guess
 @itemx config.sub
@@ -2268,14 +2287,6 @@ you are encouraged to fetch the latest versions of these files from
 @url{http://savannah.gnu.org/git/?group=config} before making a
 release.
 
-@item config-ml.in
-This file is not a program, it is a @file{configure} fragment used for
-multilib support (@pxref{Multilibs}).  Since the Automake multilib
-support has been @emph{deprecated} and targeted for removal, this
-file is going to be @emph{removed from the Automake core} in the next
-major release.  The master copy of this file is maintained in the GCC
-tree at @url{http://gcc.gnu.org/svn.html}.
-
 @item depcomp
 This program understands how to run a compiler so that it will
 generate not only the desired output but also dependency information
@@ -2312,14 +2323,9 @@ longer installed automatically, and it should be safe to remove it.
 @item py-compile
 This is used to byte-compile Python scripts.
 
-@item symlink-tree
-This program duplicates a tree of directories, using symbolic links
-instead of copying files.  Such an operation is performed when building
-multilibs (@pxref{Multilibs}).  Since the Automake multilib support has
-been @emph{deprecated} and targeted for removal, this file is going to
-be @emph{removed from the Automake core} in the next major release.
-The master copy of this file is maintained in the GCC tree at
-@url{http://gcc.gnu.org/svn.html}.
+@item test-driver
+This implements the default test driver offered by the parallel
+testsuite harness.
 
 @item texinfo.tex
 Not a program, this file is required for @samp{make dvi}, @samp{make
@@ -2679,6 +2685,9 @@ user redefinitions of Automake rules or variables
 @item portability
 portability issues (e.g., use of @command{make} features that are
 known to be not portable)
+@item extra-portability
+extra portability issues related to obscure tools.  One example of such
+a tool is the Microsoft @command{lib} archiver.
 @item syntax
 weird syntax, unused variables, typos
 @item unsupported
@@ -2701,6 +2710,12 @@ are enabled in @option{--gnu} and @option{--gnits} strictness.
 On the other hand, the @option{silent-rules} options (@pxref{Options})
 turns off portability warnings about recursive variable expansions.
 
+@c Checked by extra-portability.test
+Turning off @samp{portability} will also turn off @samp{extra-portability},
+and similarly turning on @samp{extra-portability} will also turn on
+@samp{portability}.  However, turning on @samp{portability} or turning
+off @samp{extra-portability} will not affect the other category.
+
 @vindex WARNINGS
 The environment variable @env{WARNINGS} can contain a comma separated
 list of categories to enable.  It will be taken into account before the
@@ -2921,13 +2936,25 @@ The Autoconf Manual}.
 @item AC_CONFIG_AUX_DIR
 Automake will look for various helper scripts, such as
 @file{install-sh}, in the directory named in this macro invocation.
-@c This list is accurate relative to version 1.8
-(The full list of scripts is: @file{config.guess}, @file{config.sub},
-@file{depcomp}, @file{elisp-comp}, @file{compile}, @file{install-sh},
-@file{ltmain.sh}, @file{mdate-sh}, @file{missing}, @file{mkinstalldirs},
-@file{py-compile}, @file{texinfo.tex}, and @file{ylwrap}.)  Not all
-scripts are always searched for; some scripts will only be sought if the
-generated @file{Makefile.in} requires them.
+@c This list is accurate relative to version 1.11
+(The full list of scripts is:
+@file{ar-lib},
+@file{config.guess},
+@file{config.sub},
+@file{depcomp},
+@file{elisp-comp},
+@file{compile},
+@file{install-sh},
+@file{ltmain.sh},
+@file{mdate-sh},
+@file{missing},
+@file{mkinstalldirs},
+@file{py-compile},
+@file{test-driver},
+@file{texinfo.tex},
+@file{ylwrap}.)
+Not all scripts are always searched for; some scripts
+will only be sought if the generated @file{Makefile.in} requires them.
 
 If @code{AC_CONFIG_AUX_DIR} is not given, the scripts are looked for in
 their standard locations.  For @file{mdate-sh},
@@ -3055,11 +3082,6 @@ this way, e.g., @code{AC_PATH_XTRA} defines @code{X_CFLAGS} and
 @code{$(X_CFLAGS)} and @code{$(X_LIBS)} in any @file{Makefile.am}
 if @code{AC_PATH_XTRA} is called.
 
-@item AM_C_PROTOTYPES
-This is required when using the deprecated de-ANSI-fication feature;
-@pxref{ANSI}.  @emph{It will be removed} in the next major Automake
-release.
-
 @item AM_CONDITIONAL
 This introduces an Automake conditional (@pxref{Conditionals}).
 
@@ -3207,11 +3229,6 @@ Look for the system-wide third-party macro files (and the special
 @file{dirlist} file) in @var{dir} instead of in the installation
 directory.  This is typically used for debugging.
 
-@item --acdir=@var{dir}
-@opindex --acdir
-@emph{Deprecated} shorthand for ``@option{--automake-acdir=@var{dir}
---system-acdir=@var{dir}}''.  Will be removed in future aclocal versions.
-
 @item --diff[=@var{command}]
 @opindex --diff
 Run @var{command} on M4 file that would be installed or overwritten
@@ -3908,21 +3925,6 @@ Automake ships with several Autoconf macros that you can use from your
 
 @table @code
 
-@item AM_ENABLE_MULTILIB
-@acindex AM_ENABLE_MULTILIB
-
-This is used when a ``multilib'' library is being built.  Please be
-aware that multilib support @emph{will be removed} from the Automake
-core in the next major release, and then @emph{this macro will go away
-as well} (even if a ``frozen'' version of will remain available in the
-@file{contrib/} directory of the Automake distribution).
-
-The first optional argument is the name of the @file{Makefile} being
-generated; it defaults to @samp{Makefile}.  The second optional argument
-is used to find the top source directory; it defaults to the empty
-string (generally this should not be used unless you are familiar with
-the internals).  @xref{Multilibs}.
-
 @item AM_INIT_AUTOMAKE([OPTIONS])
 @itemx AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 @acindex AM_INIT_AUTOMAKE
@@ -4000,6 +4002,15 @@ environment, or use the @option{--with-lispdir} option to
 @command{configure} to explicitly set the correct path (if you're sure
 you have an @command{emacs} that supports Emacs Lisp).
 
+@item AM_PROG_AR(@ovar{act-if-fail})
+@acindex AM_PROG_AR
+@vindex AR
+You must use this macro when you use the archiver in your project, if
+you want support for unusual archivers such as Microsoft @command{lib}.
+The content of the optional argument is executed if the archiver
+interface is not recognized; the default action is to abort configure
+with an error message.
+
 @item AM_PROG_AS
 @acindex AM_PROG_AS
 @vindex CCAS
@@ -4071,17 +4082,6 @@ automatically (@pxref{autoupdate Invocation, , Using
 Autoconf Manual}).
 
 @table @code
-@item AM_C_PROTOTYPES
-@acindex AM_C_PROTOTYPES
-@vindex ANSI2KNR
-@vindex U
-Check to see if function prototypes are understood by the compiler.  If
-so, define @samp{PROTOTYPES} and set the output variables @code{U} and
-@code{ANSI2KNR} to the empty string.  Otherwise, set @code{U} to
-@samp{_} and @code{ANSI2KNR} to @samp{./ansi2knr}.  Automake used these
-values to implement the deprecated de-ANSI-fication feature; however,
-support for @emph{that feature will be removed} in the next major Automake
-release, and then @emph{these macros and variables will go away as well}.
 
 @item AM_CONFIG_HEADER
 @acindex AM_CONFIG_HEADER
@@ -4132,21 +4132,6 @@ system.  If so, set the shell variable @code{am_cv_sys_posix_termios} to
 @samp{yes}.  If not, set the variable to @samp{no}.  This macro is obsolete,
 you should use Autoconf's @code{AC_SYS_POSIX_TERMIOS} instead.
 
-@item AM_WITH_REGEX
-@acindex AM_WITH_REGEX
-@vindex WITH_REGEX
-@opindex --with-regex
-@cindex regex package
-@cindex rx package
-Adds @option{--with-regex} to the @command{configure} command line.  If
-specified (the default), then the @samp{regex} regular expression
-library is used, @file{regex.o} is put into @code{LIBOBJS}, and
-@code{WITH_REGEX} is defined.  If @option{--without-regex} is given, then
-the @samp{rx} regular expression library is used, and @file{rx.o} is put
-into @code{LIBOBJS}.  This macro is obsolete now (since @samp{rx} doesn't
-seem to be maintained), and @emph{will be removed the next major version
-of Automake}.  Consider using gnulib if you need regex functionality.
-
 @end table
 
 
@@ -4625,6 +4610,7 @@ AC_INIT([hand], [1.2])
 AC_CONFIG_AUX_DIR([.])
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
@@ -4693,7 +4679,6 @@ to build programs and libraries.
 * Java Support with gcj::       Compiling Java sources using gcj
 * Vala Support::                Compiling Vala sources
 * Support for Other Languages::  Compiling other languages
-* ANSI::                        Automatic de-ANSI-fication (deprecated, soon to be removed)
 * Dependencies::                Automatic dependency tracking
 * EXEEXT::                      Support for executable extensions
 @end menu
@@ -5070,12 +5055,14 @@ by invoking @samp{$(AR) $(ARFLAGS)} followed by the name of the
 library and the list of objects, and finally by calling
 @samp{$(RANLIB)} on that library.  You should call
 @code{AC_PROG_RANLIB} from your @file{configure.ac} to define
-@code{RANLIB} (Automake will complain otherwise).  @code{AR} and
-@code{ARFLAGS} default to @code{ar} and @code{cru} respectively; you
-can override these two variables my setting them in your
-@file{Makefile.am}, by @code{AC_SUBST}ing them from your
-@file{configure.ac}, or by defining a per-library @code{maude_AR}
-variable (@pxref{Program and Library Variables}).
+@code{RANLIB} (Automake will complain otherwise).  You should also
+call @code{AM_PROG_AR} to define @code{AR}, in order to support unusual
+archivers such as Microsoft lib.  @code{ARFLAGS} will default to
+@code{cru}; you can override this variable by setting it in your
+@file{Makefile.am} or by @code{AC_SUBST}ing it from your
+@file{configure.ac}.  You can override the @code{AR} variable by
+defining a per-library @code{maude_AR} variable (@pxref{Program and
+Library Variables}).
 
 @cindex Empty libraries
 Be careful when selecting library components conditionally.  Because
@@ -6186,12 +6173,16 @@ cause the intermediate file to be named @file{foo.c} (as opposed to
 @file{y.tab.c}, which is more traditional).
 
 The extension of a yacc source file is used to determine the extension
-of the resulting C or C++ file.  Files with the extension @file{.y}
-will be turned into @file{.c} files; likewise, @file{.yy} will become
-@file{.cc}; @file{.y++}, @file{c++}; @file{.yxx}, @file{.cxx}; and
-@file{.ypp}, @file{.cpp}.
-
-Likewise, lex source files can be used to generate C or C++; the
+of the resulting C or C++ source and header files.  Note that header
+files are generated only when the @option{-d} Yacc option is used; see
+below for more information about this flag, and how to specify it.
+Files with the extension @file{.y} will thus be turned into @file{.c}
+sources and @file{.h} headers; likewise, @file{.yy} will become
+@file{.cc} and @file{.hh}, @file{.y++} will become @file{c++} and
+@file{h++}, @file{.yxx} will become @file{.cxx} and @file{.hxx},
+and @file{.ypp} will become @file{.cpp} and @file{.hpp}.
+
+Similarly, lex source files can be used to generate C or C++; the
 extensions @file{.l}, @file{.ll}, @file{.l++}, @file{.lxx}, and
 @file{.lpp} are recognized.
 
@@ -6875,85 +6866,6 @@ on user demand.
 Some limited support for adding your own languages is available via the
 suffix rule handling (@pxref{Suffixes}).
 
-
-@node ANSI
-@section Automatic de-ANSI-fication (deprecated, soon to be removed)
-
-@cindex de-ANSI-fication, defined
-
-@emph{The features described in this section are deprecated; you must
-not use any of them in new code, and remove their use from older but
-still maintained code: they will be withdrawn in the next major
-Automake release.}
-
-When the C language was standardized in 1989, there was a long
-transition period where package developers needed to worry about
-porting to older systems that did not support ANSI C by default.
-These older systems are no longer in practical use and are no longer
-supported by their original suppliers, so developers need not worry
-about this problem any more.
-
-Automake allows you to write packages that are portable to K&R C by
-@dfn{de-ANSI-fying} each source file before the actual compilation takes
-place.
-
-@vindex AUTOMAKE_OPTIONS
-@opindex ansi2knr
-
-If the @file{Makefile.am} variable @code{AUTOMAKE_OPTIONS}
-(@pxref{Options}) contains the option @option{ansi2knr} then code to
-handle de-ANSI-fication is inserted into the generated
-@file{Makefile.in}.
-
-This causes each C source file in the directory to be treated as ANSI C@.
-If an ANSI C compiler is available, it is used.  If no ANSI C compiler
-is available, the @command{ansi2knr} program is used to convert the source
-files into K&R C, which is then compiled.
-
-The @command{ansi2knr} program is simple-minded.  It assumes the source
-code will be formatted in a particular way; see the @command{ansi2knr} man
-page for details.
-
-@acindex AM_C_PROTOTYPES
-Support for the obsolete de-ANSI-fication feature
-requires the source files @file{ansi2knr.c}
-and @file{ansi2knr.1} to be in the same package as the ANSI C source;
-these files are distributed with Automake.  Also, the package
-@file{configure.ac} must call the macro @code{AM_C_PROTOTYPES}
-(@pxref{Macros}).
-
-Automake also handles finding the @command{ansi2knr} support files in some
-other directory in the current package.  This is done by prepending the
-relative path to the appropriate directory to the @command{ansi2knr}
-option.  For instance, suppose the package has ANSI C code in the
-@file{src} and @file{lib} subdirectories.  The files @file{ansi2knr.c} and
-@file{ansi2knr.1} appear in @file{lib}.  Then this could appear in
-@file{src/Makefile.am}:
-
-@example
-AUTOMAKE_OPTIONS = ../lib/ansi2knr
-@end example
-
-If no directory prefix is given, the files are assumed to be in the
-current directory.
-
-Note that automatic de-ANSI-fication will not work when the package is
-being built for a different host architecture.  That is because
-@command{automake} currently has no way to build @command{ansi2knr}
-for the build machine.
-
-@c FIXME: this paragraph might be better moved to an `upgrading' section.
-@cindex @code{LTLIBOBJS} and @code{ansi2knr}
-@cindex @code{LIBOBJS} and @code{ansi2knr}
-@cindex @code{ansi2knr} and @code{LTLIBOBJS}
-@cindex @code{ansi2knr} and @code{LIBOBJS}
-Using @code{LIBOBJS} with source de-ANSI-fication used to require
-hand-crafted code in @file{configure} to append @samp{$U} to basenames
-in @code{LIBOBJS}.  This is no longer true today.  Starting with version
-2.54, Autoconf takes care of rewriting @code{LIBOBJS} and
-@code{LTLIBOBJS}.  (@pxref{AC_LIBOBJ vs LIBOBJS, , @code{AC_LIBOBJ}
-vs.@: @code{LIBOBJS}, autoconf, The Autoconf Manual})
-
 @node Dependencies
 @section Automatic dependency tracking
 
@@ -6979,11 +6891,11 @@ your build.
 
 @cindex @command{depcomp}
 
-Experience with earlier versions of Automake (@pxref{Dependency
-Tracking Evolution}) taught us that it is not reliable to generate
-dependencies only on the maintainer's system, as configurations vary
-too much.  So instead Automake implements dependency tracking at build
-time.
+Experience with earlier versions of Automake (@pxref{Dependency Tracking
+Evolution, , Dependency Tracking Evolution, automake-history, Brief History
+of Automake}) taught us that it is not reliable to generate dependencies
+only on the maintainer's system, as configurations vary too much.  So
+instead Automake implements dependency tracking at build time.
 
 Automatic dependency tracking can be suppressed by putting
 @option{no-dependencies} in the variable @code{AUTOMAKE_OPTIONS}, or
@@ -8681,9 +8593,9 @@ distributions in various formats.  Their targets are:
 @item @code{dist-bzip2}
 Generate a bzip2 tar archive of the distribution.  bzip2 archives are
 frequently smaller than gzipped archives.
-By default, this rule makes @samp{bzip2} use a compression option of
-@option{-9}.  To make it use a different one, set the @env{BZIP2}
-environment variable.  For example, @samp{make dist-bzip2 BZIP2=-7}.
+By default, this rule makes @samp{bzip2} use a compression option of @option{-9}.
+To make it use a different one, set the @env{BZIP2} environment variable.
+For example, @samp{make dist-bzip2 BZIP2=-7}.
 @trindex dist-bzip2
 
 @item @code{dist-gzip}
@@ -8691,7 +8603,7 @@ Generate a gzip tar archive of the distribution.
 @trindex dist-gzip
 
 @item @code{dist-lzip}
-Generate a @samp{lzip} tar archive of the distribution.  @command{lzip}
+Generate an @samp{lzip} tar archive of the distribution.  @command{lzip}
 archives are frequently smaller than @command{bzip2}-compressed archives.
 @trindex dist-lzip
 
@@ -8740,92 +8652,265 @@ default, only the @code{dist-gzip} target is hooked to @code{dist}.
 @cindex @code{make check}
 @trindex check
 
-Automake supports three forms of test suites, the first two of which
-are very similar.
+Automake can generate code to handle two kinds of test suites.  One is
+based on integration with the @command{dejagnu} framework.  The other
+(and most used) form is based on the use of generic test scripts, and
+its activation is triggered by the definition of the special @code{TESTS}
+variable.  This second form allows for various degrees of sophistication
+and customization; in particular, it allows for concurrent execution
+of test scripts, use of established test protocols such as TAP, and
+definition of custom test drivers and test runners.
+
+@noindent
+In either case, the testsuite is invoked via @samp{make check}.
 
 @menu
-* Simple Tests::                Listing programs and scripts in @code{TESTS}
-* Simple Tests using parallel-tests::  More powerful test driver
-* DejaGnu Tests::               Interfacing with the external testing framework
+* Generalities about Testing::  Concepts and terminology about testing
+* Simple Tests::                Listing test scripts in @code{TESTS}
+* Custom Test Drivers::         Writing and using custom test drivers
+* Using the TAP test protocol:: Integrating test scripts that use the TAP protocol
+* DejaGnu Tests::               Interfacing with the @command{dejagnu} testing framework
 * Install Tests::               Running tests on installed packages
 @end menu
 
+@node Generalities about Testing
+@section Generalities about Testing
+
+The purpose of testing is to determine whether a program or system behaves
+as expected (e.g., known inputs produce the expected outputs, error
+conditions are correctly handled or reported, and older bugs do not
+resurface).
+
+@cindex test case
+The minimal unit of testing is usually called @emph{test case}, or simply
+@emph{test}.  How a test case is defined or delimited, and even what
+exactly @emph{constitutes} a test case, depends heavily on the testing
+paradigm and/or framework in use, so we won't attempt any more precise
+definition.  The set of the test cases for a given program or system
+constitutes its @emph{testsuite}.
+
+@cindex test harness
+@cindex testsuite harness
+A @emph{test harness} (also @emph{testsuite harness}) is a program or
+software component that executes all (or part of) the defined test cases,
+analyzes their outcomes, and report or register these outcomes
+appropriately.  Again, the details of how this is accomplished (and how
+the developer and user can influence it or interface with it) varies
+wildly, and we'll attempt no precise definition.
+
+@cindex test pass
+@cindex test failure
+A test is said to @emph{pass} when it can determine that the condition or
+behaviour it means to verify holds, and is said to @emph{fail} when it can
+determine that such condition of behaviour does @emph{not} hold.
+
+@cindex test skip
+Sometimes, tests can rely on non-portable tools or prerequisites, or
+simply make no sense on a given system (for example, a test checking a
+Windows-specific feature makes no sense on a GNU/Linux system).  In this
+case, accordingly to the definition above, the tests can neither be
+considered passed nor failed; instead, they are @emph{skipped} -- i.e.,
+they are not run, or their result is anyway ignored for what concerns
+the count of failures an successes.  Skips are usually explicitly
+reported though, so that the user will be aware that not all of the
+testsuite has really run.
+
+@cindex xfail
+@cindex expected failure
+@cindex expected test failure
+@cindex xpass
+@cindex unexpected pass
+@cindex unexpected test pass
+It's not uncommon, especially during early development stages, that some
+tests fail for known reasons, and that the developer doesn't want to
+tackle these failures immediately (this is especially true when the
+failing tests deal with corner cases).  In this situation, the better
+policy is to declare that each of those failures is an @emph{expected
+failure} (or @emph{xfail}).  In case a test that is expected to fail ends
+up passing instead, many testing environments will flag the result as a
+special kind of failure called @emph{unexpected pass} (or @emph{xpass}).
+
+@cindex hard error
+@cindex Distinction between errors and failures in testsuites
+Many testing environments and frameworks distinguish between test failures
+and hard errors.  As we've seen, a test failure happens when some invariant
+or expected behaviour of the software under test is not met.  An @emph{hard
+error} happens when e.g., the set-up of a test case scenario fails, or when
+some other unexpected or highly undesirable condition is encountered (for
+example, the program under test experiences a segmentation fault).
+
+@emph{TODO}: Links to other test harnesses (esp. those sharing our
+terminology)?
+
 @node Simple Tests
 @section Simple Tests
 
-If the variable @code{TESTS} is defined, its value is taken to be a
-list of programs or scripts to run in order to do the testing.
-Programs needing data files should look for them in @code{srcdir}
-(which is both an environment variable and a make variable) so they
-work when building in a separate directory (@pxref{Build Directories,
-, Build Directories , autoconf, The Autoconf Manual}), and in
-particular for the @code{distcheck} rule (@pxref{Checking the
-Distribution}).
-
-For each of the @code{TESTS}, the result of execution is printed along
-with the test name, where @code{PASS} denotes a successful test,
-@code{FAIL} denotes a failed test, @code{XFAIL} an expected failure,
-@code{XPASS} an unexpected pass for a test that is supposed to fail,
-and @code{SKIP} denotes a skipped test.
+@menu
+* Scripts-based Testsuites::    Automake-specific concepts and terminology
+* Serial Test Harness::         Older (and obsolescent) serial test harness
+* Parallel Test Harness::       Generic concurrent test harness
+@end menu
+
+@node Scripts-based Testsuites
+@subsection Scripts-based Testsuites
+
+If the special variable @code{TESTS} is defined, its value is taken to be
+a list of programs or scripts to run in order to do the testing.  Under
+the appropriate circumstances, it's possible for @code{TESTS} to list
+also data files to be passed to one or more test scripts defined by
+different means (the so-called ``log compilers'', @pxref{Parallel Test
+Harness}).
+
+Test scripts can be executed serially or concurrently.  Automake
+supports both these kinds of test execution, with the serial test harness
+being the default (for backward-compatibility reasons only, as its use
+is nowadays discouraged).  The concurrent test harness relies on the
+concurrence capabilities (if any) offered by the underlying @command{make}
+implementation, and can thus only be as good as those are.
+
+By default, only the exit statuses of the test scripts are considered when
+determining the testsuite outcome.  But Automake allows also the use of
+more complex test protocols, either standard (@pxref{Using the TAP test
+protocol}) or custom (@pxref{Custom Test Drivers}).  Note that you can
+enable such protocols only when the parallel harness is used: they won't
+work with the serial test harness.  In the rest of this section we are
+going to concentrate mostly on protocol-less tests, since  we'll have later
+a whole section devoted to the use of test protocols (again, @pxref{Custom
+Test Drivers}).
 
 @cindex Exit status 77, special interpretation
+@cindex Exit status 99, special interpretation
+When no test protocol is in use, an exit status of 0 from a test script will
+denote a success, an exit status of 77 a skipped test, an exit status of 99
+an hard error, and any other exit status will denote a failure.
+
+@cindex Tests, expected failure
+@cindex Expected test failure
+@vindex XFAIL_TESTS
+@vindex DISABLE_HARD_ERRORS
+@cindex Disabling hard errors
+You may define the variable @code{XFAIL_TESTS} to a list of tests
+(usually a subset of @code{TESTS}) that are expected to fail; this will
+effectively reverse the result of those tests (with the provision that
+skips and hard errors remain untouched).  You may also instruct the
+testsuite harness to treat hard errors like simple failures, by defining
+the @code{DISABLE_HARD_ERRORS} make variable to a nonempty value.
+
+Note however that, for tests based on more complex test protocols,
+the exact effects of @code{XFAIL_TESTS} and @code{DISABLE_HARD_ERRORS}
+might change, or they might even have no effect at all (for example,
+@c Keep this in sync with tap-no-disable-hard-errors.test.
+in tests using TAP, there is not way to disable hard errors, and the
+@code{DISABLE_HARD_ERRORS} variable has no effect on them).
+
+@anchor{Testsuite progress on console}
+@cindex Testsuite progress on console
+The result of each test case run by the scripts in @code{TESTS} will be
+printed on standard output, along with the test name.  For test protocols
+that allow more test cases per test script (such as TAP), a number,
+identifier and/or brief description specific for the single test case is
+expected to be printed in addition to the name of the test script.  The
+possible results (whose meanings should be clear from the previous
+@ref{Generalities about Testing}) are @code{PASS}, @code{FAIL},
+@code{SKIP}, @code{XFAIL}, @code{XPASS} and @code{ERROR}.  Here is an
+example of output from an hypothetical testsuite that uses both plain
+and TAP tests:
+@c Keep in sync with tap-doc.test.
+@example
+PASS: foo.sh
+PASS: zardoz.tap 1 - Daemon started
+PASS: zardoz.tap 2 - Daemon responding
+SKIP: zardoz.tap 3 - Daemon uses /proc # SKIP /proc is not mounted
+PASS: zardoz.tap 4 - Daemon stopped
+SKIP: bar.sh
+PASS: mu.tap 1
+XFAIL: mu.tap 2 # TODO frobnication not yet implemented
+@end example
 
-The number of failures will be printed at the end of the run.  If a
-given test program exits with a status of 77, then its result is ignored
-in the final count.  This feature allows non-portable tests to be
-ignored in environments where they don't make sense.
+@noindent
+A testsuite summary (expected to report at least the number of run,
+skipped and failed tests) will be printed at the end of the testsuite
+run.
 
+@anchor{Simple tests and color-tests}
 @vindex AM_COLOR_TESTS
+@cindex Colorized testsuite output
 If the Automake option @code{color-tests} is used (@pxref{Options})
 and standard output is connected to a capable terminal, then the test
 results and the summary are colored appropriately.  The user can disable
 colored output by setting the @command{make} variable
 @samp{AM_COLOR_TESTS=no}, or force colored output even without a connecting
-terminal with @samp{AM_COLOR_TESTS=always}.
-
-Note that the semantics of some @command{make} implementations when used
-in parallel mode (@pxref{Parallel make,,, autoconf, The Autoconf Manual})
-can cause the automatic detection of a connection to a capable terminal
-to fail.  In that case, you can still resort to the use of
-@samp{AM_COLOR_TESTS=always}.
+terminal with @samp{AM_COLOR_TESTS=always}.  It's also worth noting that
+some @command{make} implementations, when used in parallel mode, have
+slightly different semantics (@pxref{Parallel make,,, autoconf,
+The Autoconf Manual}), which can break the automatic detection of a
+connection to a capable terminal.  If this is the case, you'll have to
+resort to the use of @samp{AM_COLOR_TESTS=always} in order to have the
+testsuite output colorized.
+
+Test programs that need data files should look for them in @code{srcdir}
+(which is both a make variable and an environment variable made available
+to the tests), so that they work when building in a separate directory
+(@pxref{Build Directories, , Build Directories , autoconf,
+The Autoconf Manual}), and in particular for the @code{distcheck} rule
+(@pxref{Checking the Distribution}).
 
 @vindex TESTS
 @vindex TESTS_ENVIRONMENT
-The variable @code{TESTS_ENVIRONMENT} can be used to set environment
-variables for the test run; the environment variable @env{srcdir} is
-set in the rule.  If all your test programs are scripts, you can also
-set @code{TESTS_ENVIRONMENT} to an invocation of the shell (e.g.
-@samp{$(SHELL) -x} can be useful for debugging the tests), or any other
-interpreter.  For instance, the following setup may be used to run tests
-with Perl:
+@vindex AM_TESTS_ENVIRONMENT
+The @code{AM_TESTS_ENVIRONMENT} and @code{TESTS_ENVIRONMENT} variables can
+be used to run initialization code and set environment variables for the
+test scripts.  The former variable is developer-reserved, and can be
+defined in the @file{Makefile.am}, while the latter is reserved for the
+user, which can employ it to extend or override the settings in the
+former; for this to work portably, however, the contents of a non-empty
+@code{AM_TESTS_ENVIRONMENT} @emph{must} be terminated by a semicolon.
+
+@vindex AM_TESTS_FD_REDIRECT
+The @code{AM_TESTS_FD_REDIRECT} variable can be used to define file
+descriptor redirections for the test scripts.  One might think that
+@code{AM_TESTS_ENVIRONMENT} could be used for this purpose, but experience
+has shown that doing so portably is practically impossible.  The main
+hurdle is constituted by Korn shells, which usually set the close-on-exec
+flag on file descriptors opened with the @command{exec} builtin, thus
+rendering an idiom like @code{AM_TESTS_ENVIRONMENT = exec 9>&2;}
+ineffectual.  This issue also affects some Bourne shells, such as the
+HP-UX's @command{/bin/sh},
+@c FIXME: should we offer a link to the relevant discussions on the
+@c bug-autoconf list?
 
 @c Keep in sync with tests-environment-backcompat.test.
 @example
-TESTS_ENVIRONMENT = $(PERL) -Mstrict -w
-TESTS = foo.pl bar.pl baz.pl
+AM_TESTS_ENVIRONMENT = \
+## Some environment initializations are kept in a separate shell
+## file `tests-env.sh', which can make it easier to also run tests
+## from the command line.
+  . $(srcdir)/tests-env.sh; \
+## On Solaris, prefer more POSIX-compliant versions of the standard
+## tools by default.
+  if test -d /usr/xpg4/bin; then \
+    PATH=/usr/xpg4/bin:$$PATH; export PATH; \
+  fi;
+@c $$ restore font-lock
+## With this, the test scripts will be able to print diagnostic
+## messages to the original standard error stream, even if the test
+## driver redirects the stderr of the test scripts to a log file
+## before executing them.
+AM_TESTS_FD_REDIRECT = 9>&2
 @end example
 
-Note that the @option{parallel-tests} driver provides a more elegant
-way to achieve the same effect, freeing the @code{TESTS_ENVIRONMENT}
-variable for the user to override (@pxref{Simple Tests using
-parallel-tests}).
-
-
-@cindex Tests, expected failure
-@cindex Expected test failure
-
-@vindex XFAIL_TESTS
-You may define the variable @code{XFAIL_TESTS} to a list of tests
-(usually a subset of @code{TESTS}) that are expected to fail.  This will
-reverse the result of those tests.
+@noindent
+Note however that @code{AM_TESTS_ENVIRONMENT} is, for historical and
+implementation reasons, @emph{not} supported by the serial harness
+(@pxref{Serial Test Harness}).
 
 Automake ensures that each file listed in @code{TESTS} is built before
-any tests are run; you can list both source and derived programs (or
-scripts) in @code{TESTS}; the generated rule will look both in
-@code{srcdir} and @file{.}.  For instance, you might want to run a C
-program as a test.  To do this you would list its name in @code{TESTS}
-and also in @code{check_PROGRAMS}, and then specify it as you would
-any other program.
+it is run; you can list both source and derived programs (or scripts)
+in @code{TESTS}; the generated rule will look both in @code{srcdir} and
+@file{.}.  For instance, you might want to run a C program as a test.
+To do this you would list its name in @code{TESTS} and also in
+@code{check_PROGRAMS}, and then specify it as you would any other
+program.
 
 Programs listed in @code{check_PROGRAMS} (and @code{check_LIBRARIES},
 @code{check_LTLIBRARIES}...) are only built during @code{make check},
@@ -8836,47 +8921,106 @@ that @code{check_PROGRAMS} are @emph{not} automatically added to
 by the tests, not the tests themselves.  Of course you can set
 @code{TESTS = $(check_PROGRAMS)} if all your programs are test cases.
 
+@node Serial Test Harness
+@subsection Serial Test Harness
+
+@emph{NOTE:} This harness, while still being the default one, is
+obsolescent, and kept mostly for backward-compatibility reasons.
+The user is advised to use the parallel test harness instead
+(@pxref{Parallel Test Harness}).
+
+The serial harness operates by simply running the tests serially, one at
+the time, without any I/O redirection.  It's up to the user to implement
+logging of tests' output, if that's requited or desired.
+@c TODO: give an example of how this can be done.
 
-@node Simple Tests using parallel-tests
-@section Simple Tests using @samp{parallel-tests}
+For historical and implementation reasons, the @code{AM_TESTS_ENVIRONMENT}
+variable is @emph{not} supported by this harness (it will be silently
+ignored if defined); only @code{TESTS_ENVIRONMENT} is, and it is to be
+considered a developer-reserved variable.  This is done so that, when
+using the serial harness, @code{TESTS_ENVIRONMENT} can be defined to an
+invocation of an interpreter through which the tests are to be run.
+For instance, the following setup may be used to run tests with Perl:
+
+@example
+TESTS_ENVIRONMENT = $(PERL) -Mstrict -w
+TESTS = foo.pl bar.pl baz.pl
+@end example
+
+@noindent
+It's important to note that the use of @code{TESTS_ENVIRONMENT} endorsed
+here would be @emph{invalid} with the parallel harness.  That harness
+provides a more elegant way to achieve the same effect, with the further
+benefit of freeing the @code{TESTS_ENVIRONMENT} variable for the user
+(@pxref{Parallel Test Harness}).
+
+Another, less serious limit of the serial harness is that it doesn't
+really distinguish between simple failures and hard errors; this is
+due to historical reasons only, and might be fixed in future Automake
+versions.
+
+@node Parallel Test Harness
+@subsection Parallel Test Harness
 @cindex @option{parallel-tests}, Using
 
-The option @option{parallel-tests} (@pxref{Options}) enables a test suite
-driver that is mostly compatible to the simple test driver described in
-the previous section, but provides a few more features and slightly
-different semantics.  It features concurrent execution of tests with
-@code{make -j} and automatic collection of the test scripts output and
-summary thereof in @file{.log} files, and allows to specify inter-test
-dependencies, lazy reruns of tests that have not completed in a prior
-run, and hard errors for exceptional failures.  Similar to the simple
-test driver, @code{TESTS_ENVIRONMENT}, @code{AM_COLOR_TESTS},
-@code{XFAIL_TESTS}, and the @code{check_*} variables are honored,
-and the environment variable @env{srcdir} is set during test execution.
-
-This test driver is still experimental and may undergo changes in order
-to satisfy additional portability requirements.
+The parallel (or concurrent) test harness is enabled by the Automake option
+@option{parallel-tests}.  It features automatic collection of the test
+scripts output in @file{.log} files, concurrent execution of tests with
+@code{make -j}, specification of inter-test dependencies, lazy reruns of
+tests that have not completed in a prior run, and hard errors for exceptional
+failures.
+
+This harness is still somewhat experimental and may undergo changes in
+order to satisfy additional portability requirements.
 
+@anchor{Basics of test metadata}
 @vindex TEST_SUITE_LOG
 @vindex TESTS
-The driver operates by defining a set of @command{make} rules to create
-a summary log file, @code{TEST_SUITE_LOG}, which defaults to
-@file{test-suite.log} and requires a @file{.log} suffix.  This file
-depends upon log files created for each single test program listed in
-@code{TESTS}, which in turn contain all output produced by the
-corresponding tests.
+@cindex @file{.log} files
+@cindex @file{.trs} files
+@cindex test metadata
+The parallel test harness operates by defining a set of @command{make}
+rules that run the test scripts listed in @code{TESTS}, and, for each
+such script, save its output in a corresponding @file{.log} file and
+its results (and other ``metadata'', @pxref{API for Custom Test Drivers})
+in a corresponding @file{.trs} (as in @b{T}est @b{R}e@b{S}ults) file.
+@c We choose the `.trs' extension also because, at the time of writing,
+@c it isn't already used for other significant purposes; see e.g.:
+@c   - http://filext.com/file-extension/trs
+@c   - http://www.file-extensions.org/search/?searchstring=trs
+The @file{.log} file will contain all the output emitted by the test on
+its standard output and its standard error.  The @file{.trs} file will
+contain, among the other things, the results of the test cases run by
+the script.
+
+The parallel test harness will also create a summary log file,
+@code{TEST_SUITE_LOG}, which defaults to @file{test-suite.log} and requires
+a @file{.log} suffix.  This file depends upon all the @file{.log} and
+@file{.trs} files created for the test scripts listed in @code{TESTS}.
+
+@vindex VERBOSE
+As with the serial harness above, by default one status line is printed
+per completed test, and a short summary after the suite has completed.
+However, standard output and standard error of the test are redirected
+to a per-test log file, so that parallel execution does not produce
+intermingled output.  The output from failed tests is collected in the
+@file{test-suite.log} file.  If the variable @samp{VERBOSE} is set, this
+file is output after the summary.
+@c FIXME: we should be clearer about what we mean exactly here ...
+For best results, the tests should be verbose by default now.
 
 @vindex TEST_EXTENSIONS
 @vindex TEST_LOGS
-Each log file is created when the corresponding test has completed.
-The set of log files is listed in the read-only variable
-@code{TEST_LOGS}, and defaults to @code{TESTS}, with the executable
-extension if any (@pxref{EXEEXT}), as well as any suffix listed in
-@code{TEST_EXTENSIONS} removed, and @file{.log} appended.  Results
-are undefined if a test file name ends in several concatenated suffixes.
-@code{TEST_EXTENSIONS} defaults to @file{.test}; it can be overridden by
-the user, in which case any extension listed in it must be constituted
-by a dot, followed by a non-digit alphabetic character, followed by any
-number of alphabetic characters.
+Each couple of @file{.log} and @file{.trs} files is created when the
+corresponding test has completed.  The set of log files is listed in
+the read-only variable @code{TEST_LOGS}, and defaults to @code{TESTS},
+with the executable extension if any (@pxref{EXEEXT}), as well as any
+suffix listed in @code{TEST_EXTENSIONS} removed, and @file{.log} appended.
+Results are undefined if a test file name ends in several concatenated
+suffixes.  @code{TEST_EXTENSIONS} defaults to @file{.test}; it can be
+overridden by the user, in which case any extension listed in it must be
+constituted by a dot, followed by a non-digit alphabetic character,
+followed by any number of alphabetic characters.
 @c Keep in sync with test-extensions.test.
 For example, @samp{.sh}, @samp{.T} and @samp{.t1} are valid extensions,
 while @samp{.x-y}, @samp{.6c} and @samp{.t.1} are not.
@@ -8893,12 +9037,12 @@ while @samp{.x-y}, @samp{.6c} and @samp{.t.1} are not.
 @vindex AM_@var{ext}_LOG_FLAGS
 @vindex AM_LOG_FLAGS
 For tests that match an extension @code{.@var{ext}} listed in
-@code{TEST_EXTENSIONS}, you can provide a test driver using the variable
-@code{@var{ext}_LOG_COMPILER} (note the upper-case extension) and pass
-options in @code{AM_@var{ext}_LOG_FLAGS} and allow the user to pass
-options in @code{@var{ext}_LOG_FLAGS}.  It will cause all tests with
-this extension to be called with this driver.  For all tests without a
-registered extension, the variables @code{LOG_COMPILER},
+@code{TEST_EXTENSIONS}, you can provide a custom ``test runner'' using
+the variable @code{@var{ext}_LOG_COMPILER} (note the upper-case
+extension) and pass options in @code{AM_@var{ext}_LOG_FLAGS} and allow
+the user to pass options in @code{@var{ext}_LOG_FLAGS}.  It will cause
+all tests with this extension to be called with this runner.  For all
+tests without a registered extension, the variables @code{LOG_COMPILER},
 @code{AM_LOG_FLAGS}, and @code{LOG_FLAGS} may be used.  For example,
 
 @c Keep in sync with parallel-tests-log-compiler-example.test.
@@ -8916,50 +9060,36 @@ AM_LOG_FLAGS = -d
 @noindent
 will invoke @samp{$(PERL) -w foo.pl}, @samp{$(PYTHON) -v bar.py},
 and @samp{./wrapper-script -d baz} to produce @file{foo.log},
-@file{bar.log}, and @file{baz.log}, respectively.  The
-@samp{TESTS_ENVIRONMENT} variable is still expanded before the driver,
-but should be reserved for the user.
+@file{bar.log}, and @file{baz.log}, respectively.  The @file{foo.trs},
+@file{bar.trs} and @file{baz.trs} files will be automatically produced
+as a side-effect.
 
-@vindex VERBOSE
-As with the simple driver above, by default one status line is printed
-per completed test, and a short summary after the suite has completed.
-However, standard output and standard error of the test are redirected
-to a per-test log file, so that parallel execution does not produce
-intermingled output.  The output from failed tests is collected in the
-@file{test-suite.log} file.  If the variable @samp{VERBOSE} is set, this
-file is output after the summary.  For best results, the tests should be
-verbose by default now.
+It's important to note that, differently from what we've seen for the
+serial test harness (@pxref{Parallel Test Harness}), the
+@code{AM_TESTS_ENVIRONMENT} and @code{TESTS_ENVIRONMENT} variables
+@emph{cannot} be use to define a custom test runner; the
+@code{LOG_COMPILER} and @code{LOG_FLAGS} (or their extension-specific
+counterparts) should be used instead:
 
-@trindex check-html
-@vindex RST2HTML
-@vindex TEST_SUITE_HTML
-Previous versions of automake used to provide a @code{check-html} target
-to convert the log files to HTML.  This feature is now deprecated, and
-@emph{will be removed} in the next major Automake release, so don't rely
-on it anymore.
+@example
+## This is WRONG!
+AM_TESTS_ENVIRONMENT = PERL5LIB='$(srcdir)/lib' $(PERL) -Mstrict -w
+@end example
 
-@vindex DISABLE_HARD_ERRORS
-@cindex Exit status 99, special interpretation
-@cindex hard error
-Even in the presence of expected failures (see @code{XFAIL_TESTS}), there
-may be conditions under which a test outcome needs attention.  For
-example, with test-driven development, you may write tests for features
-that you have not implemented yet, and thus mark these tests as expected
-to fail.  However, you may still be interested in exceptional conditions,
-for example, tests that fail due to a segmentation violation or another
-error that is independent of the feature awaiting implementation.
-Tests can exit with an exit status of 99 to signal such a @emph{hard
-error}.  Unless the variable @code{DISABLE_HARD_ERRORS} is set to a
-nonempty value, such tests will be counted as failed.
-
-By default, the test suite driver will run all tests, but there are
+@example
+## Do this instead.
+AM_TESTS_ENVIRONMENT = PERL5LIB='$(srcdir)/lib'; export PERL5LIB;
+LOG_COMPILER = $(PERL)
+AM_LOG_FLAGS = -Mstrict -w
+@end example
+
+By default, the test suite harness will run all tests, but there are
 several ways to limit the set of tests that are run:
 
 @itemize @bullet
 @item
-You can set the @code{TESTS} variable, similarly to how you can with
-the simple test driver from the previous section.  For example, you can
-use a command like this to run only a subset of the tests:
+You can set the @code{TESTS} variable.  For example, you can use a
+command like this to run only a subset of the tests:
 
 @example
 env TESTS="foo.test bar.test" make -e check
@@ -8996,14 +9126,15 @@ here too.
 @item
 @vindex RECHECK_LOGS
 @cindex lazy test execution
-By default, the test driver removes all old per-test log files before it
-starts running tests to regenerate them.  The variable
-@code{RECHECK_LOGS} contains the set of log files which are removed.
-@code{RECHECK_LOGS} defaults to @code{TEST_LOGS}, which means all tests
-need to be rechecked.  By overriding this variable, you can choose which
-tests need to be reconsidered.  For example, you can lazily rerun only
-those tests which are outdated, i.e., older than their prerequisite test
-files, by setting this variable to the empty value:
+By default, the test harness removes all old per-test @file{.log} and
+@file{.trs} files before it starts running tests to regenerate them.  The
+variable @code{RECHECK_LOGS} contains the set of @file{.log} (and, by
+implication, @file{.trs}) files which are removed.  @code{RECHECK_LOGS}
+defaults to @code{TEST_LOGS}, which means all tests need to be rechecked.
+By overriding this variable, you can choose which tests need to be
+reconsidered.  For example, you can lazily rerun only those tests which
+are outdated, i.e., older than their prerequisite test files, by setting
+this variable to the empty value:
 
 @example
 env RECHECK_LOGS= make -e check
@@ -9014,13 +9145,14 @@ env RECHECK_LOGS= make -e check
 You can ensure that all tests are rerun which have failed or passed
 unexpectedly, by running @code{make recheck} in the test directory.
 This convenience target will set @code{RECHECK_LOGS} appropriately
-before invoking the main test driver.
+before invoking the main test harness.
 @end itemize
 
+@noindent
 In order to guarantee an ordering between tests even with @code{make
--j@var{N}}, dependencies between the corresponding log files may be
-specified through usual @command{make} dependencies.  For example, the
-following snippet lets the test named @file{foo-execute.test} depend
+-j@var{N}}, dependencies between the corresponding @file{.log} files
+may be specified through usual @command{make} dependencies.  For example,
+the following snippet lets the test named @file{foo-execute.test} depend
 upon completion of the test @file{foo-compile.test}:
 
 @example
@@ -9040,6 +9172,7 @@ parallel @command{make -j@var{N}}, so be sure they are prepared for
 concurrent execution.
 
 @cindex Unit tests
+@c Keep in sync with 'parallel-tests-extra-programs.test'.
 The combination of lazy test execution and correct dependencies between
 tests and their sources may be exploited for efficient unit testing
 during development.  To further speed up the edit-compile-test cycle, it
@@ -9067,6 +9200,562 @@ semantics of FreeBSD and OpenBSD @command{make} conflict with this).
 In case of doubt you may want to require to use GNU @command{make},
 or work around the issue with inference rules to generate the tests.
 
+@node Custom Test Drivers
+@section Custom Test Drivers
+
+@menu
+* Overview of Custom Test Drivers Support::
+* Declaring Custom Test Drivers::
+* API for Custom Test Drivers::
+@end menu
+
+@node Overview of Custom Test Drivers Support
+@subsection Overview of Custom Test Drivers Support
+
+Starting from Automake version 1.12, the parallel test harness allows
+the package authors to use third-party custom test drivers, in case the
+default ones are inadequate for their purposes, or do not support their
+testing protocol of choice.
+
+A custom test driver is expected to properly run the test programs passed
+to it (including the command-line arguments passed to those programs, if
+any), to analyze their execution and outcome, to create the @file{.log}
+and @file{.trs} files associated to these test runs, and to display the test
+results on the console. It is responsibility of the author of the test
+driver to ensure that it implements all the above steps meaningfully and
+correctly; Automake isn't and can't be of any help here.  On the other
+hand, the Automake-provided code for testsuite summary generation offers
+support for test drivers allowing several test results per test script,
+if they take care to register such results properly (@pxref{Log files
+generation and test results recording}).
+
+The exact details of how test scripts' results are to be determined and
+analyzed is left to the individual drivers.  Some drivers might only
+consider the test script exit status (this is done for example by the
+default test driver used by the parallel test harness, described
+in the previous section).  Other drivers might implement more complex and
+advanced test protocols, which might require them to parse and interpreter
+the output emitted by the test script they're running (examples of such
+protocols are TAP and SubUnit).
+
+It's very important to note that, even when using custom test drivers,
+most of the infrastructure described in the previous section about the
+parallel harness remains in place; this includes:
+
+@itemize
+@item
+list of test scripts defined in @code{TESTS}, and overridable at
+runtime through the redefinition of @code{TESTS} or @code{TEST_LOGS};
+@item
+concurrency through the use of @command{make}'s option @option{-j};
+@item
+per-test @file{.log} and @file{.trs} files, and generation of a summary
+@file{.log} file from them;
+@item
+@code{recheck} target, @code{RECHECK_LOGS} variable, and lazy reruns
+of tests;
+@item
+inter-test dependencies;
+@item
+support for @code{check_*} variables (@code{check_PROGRAMS},
+@code{check_LIBRARIES}, ...);
+@item
+use of @code{VERBOSE} environment variable to get verbose output on
+testsuite failures;
+@item
+definition and honoring of @code{TESTS_ENVIRONMENT},
+@code{AM_TESTS_ENVIRONMENT} and @code{AM_TESTS_FD_REDIRECT}
+variables;
+@item
+definition of generic and extension-specific @code{LOG_COMPILER} and
+@code{LOG_FLAGS} variables.
+@end itemize
+
+@noindent
+On the other hand, the exact semantics of how (and if)
+@option{color-tests}, @code{XFAIL_TESTS}, and hard errors are supported
+and handled is left to the individual test drivers.
+
+@c TODO: We should really add a working example in the doc/ directory,
+@c TODO: and reference if from here.
+
+@node Declaring Custom Test Drivers
+@subsection Declaring Custom Test Drivers
+
+@vindex _LOG_DRIVER
+@vindex _LOG_DRIVER_FLAGS
+@vindex LOG_DRIVER
+@vindex LOG_DRIVER_FLAGS
+@vindex @var{ext}_LOG_DRIVER
+@vindex @var{ext}_LOG_DRIVER_FLAGS
+@vindex AM_@var{ext}_LOG_DRIVER_FLAGS
+@vindex AM_LOG_DRIVER_FLAGS
+Custom testsuite drivers are declared by defining the make variables
+@code{LOG_DRIVER} or @code{@var{ext}_LOG_DRIVER} (where @var{ext} must
+be declared in @code{TEST_EXTENSIONS}).  They must be defined to
+programs or scripts that will be used to drive the execution, logging,
+and outcome report of the tests with corresponding extensions (or of
+those with no registered extension in the case of @code{LOG_DRIVER}).
+Clearly, multiple distinct test drivers can be declared in the same
+@file{Makefile.am}.  Note moreover that the @code{LOG_DRIVER} variables
+are @emph{not} a substitute for the @code{LOG_COMPILER} variables: the
+two sets of variables can, and often do, usefully and legitimately
+coexist.
+
+@c TODO: We should really be able to point to a clarifying example here!
+
+The developer-reserved variable @code{AM_LOG_DRIVER_FLAGS} and the
+user-reserved variable @code{LOG_DRIVER_FLAGS} can be used to define
+flags that will be passed to each invocation of @code{LOG_DRIVER},
+with the user-defined flags obviously taking precedence over the
+developer-reserved ones.  Similarly, for each extension @var{ext}
+declared in @code{TEST_EXTENSIONS}, flags listed in
+@code{AM_@var{ext}_LOG_DRIVER_FLAGS} and
+@code{@var{ext}_LOG_DRIVER_FLAGS} will be passed to
+invocations of @code{@var{ext}_LOG_DRIVER}.
+
+@node API for Custom Test Drivers
+@subsection API for Custom Test Drivers
+
+Note that @emph{the APIs described here are still highly experimental},
+and will very likely undergo tightenings and likely also extensive changes
+in the future, to accommodate for new features or to satisfy additional
+portability requirements.
+
+The main characteristic of these APIs is that they are designed to share
+as much infrastructure, semantics, and implementation details as possible
+with the parallel test harness and its default driver.
+
+@menu
+* Command-line arguments for test drivers::
+* Log files generation and test results recording::
+* Testsuite progress output::
+@end menu
+
+@node Command-line arguments for test drivers
+@subsubsection Command-line arguments for test drivers
+
+A custom driver can rely on various command-line options and arguments
+being passed to it automatically by the Automake's @option{parallel-tests}
+harness.  It is @emph{mandatory} that it understands all of them (even
+if the exact interpretation of the associated semantics can legitimately
+change between a test driver and another, and even be a no-op in some
+drivers).
+
+@noindent
+Here is the list of options:
+
+@table @option
+@item --test-name=@var{NAME}
+The name of the test, with VPATH prefix (if any) removed.  This can have a
+suffix and a directory component (as in e.g., @file{sub/foo.test}), and is
+mostly meant to be used in console reports about testsuite advancements and
+results (@pxref{Testsuite progress output}).
+@item --log-file=@file{@var{PATH}.log}
+The @file{.log} file the test driver must create (@pxref{Basics of
+test metadata}).  If it has a directory component (as in e.g.,
+@file{sub/foo.log}), the test harness will ensure that such directory
+exists @emph{before} the test driver is called.
+@item --trs-file=@file{@var{PATH}.trs}
+The @file{.trs} file the test driver must create (@pxref{Basics of
+test metadata}).  If it has a directory component (as in e.g.,
+@file{sub/foo.trs}), the test harness will ensure that such directory
+exists @emph{before} the test driver is called.
+@item --color-tests=@{yes|no@}
+Whether the console output should be colorized or not (@pxref{Simple
+tests and color-tests}, to learn when this option gets activated and
+when it doesn't).
+@item --expect-failure=@{yes|no@}
+Whether the tested program is expected to fail.
+@item --enable-hard-errors=@{yes|no@}
+Whether ``hard errors'' in the tested program should be treated differently
+from normal failures or not (the default should be @code{yes}).  The exact
+meaning of ``hard error'' is highly dependent from the test protocols or
+conventions in use.
+@item --
+Explicitly terminate the list of options.
+@end table
+
+@noindent
+The first non-option argument passed to the test driver is the program to
+be run, and all the following ones are command-line options and arguments
+for this program.
+
+Note that the exact semantics attached to the @option{--color-tests},
+@option{--expect-failure} and @option{--enable-hard-errors} options are
+left up to the individual test drivers.  Still, having a behaviour
+compatible or at least similar to that provided by the default
+@option{parallel-tests} driver is advised, as that would offer a better
+consistency and a more pleasant user experience.
+
+@node Log files generation and test results recording
+@subsubsection Log files generation and test results recording
+
+The test driver must correctly generate the files specified by the
+@option{--log-file} and @option{--trs-file} option (even when the tested
+program fails or crashes).
+
+The @file{.log} file should ideally contain all the output produced by the
+tested program, plus optionally other information that might facilitate
+debugging or analysis of bug reports.  Apart from that, its format is
+basically free.
+
+The @file{.trs} file is used to register some metadata through the use
+of custom reStructuredText fields.  This metadata is expected to be
+employed in various ways by the parallel test harness; for example, to
+count the test results when printing the testsuite summary, or to decide
+which tests to re-run upon @command{make reheck}.  Unrecognized metadata
+in a @file{.trs} file is currently ignored by the harness, but this might
+change in the future. The list of currently recognized metadata follows.
+
+@table @code
+
+@item :test-result:
+@cindex Register test result
+@cindex Register test case result
+@cindex Test result, registering
+@cindex Test case result, registering
+@cindex @code{:test-result:}
+@cindex reStructuredText field, @code{:test-result:}
+The test driver must use this field to register the results of @emph{each}
+test case run by a test script file.  Several @code{:test-result:} fields
+can be present in the same @file{.trs} file; this is done in order to
+support test protocols that allow a single test script to run more test
+cases.
+
+@c Keep this in sync with lib/am/check-am:$(TEST_SUITE_LOG).
+The only recognized test results are currently @code{PASS}, @code{XFAIL},
+@code{SKIP}, @code{FAIL}, @code{XPASS} and @code{ERROR}.  These results,
+when declared with @code{:test-result:}, can be optionally followed by
+text holding the name and/or a brief description of the corresponding
+test; the @option{parallel-tests} harness will ignore such extra text when
+generating @file{test-suite.log} and preparing the testsuite summary.
+
+@c Keep in sync with 'test-metadata-recheck.test'.
+@item @code{:recheck:}
+@cindex :recheck:
+@cindex reStructuredText field, @code{:recheck:}
+If this field is present and defined to @code{no}, then the corresponding
+test script will @emph{not} be run upon a @command{make recheck}.  What
+happens when two or more @code{:recheck:} fields are present in the same
+@file{.trs} file is undefined behaviour.
+
+@c Keep in sync with 'test-metadata-global-log.test'.
+@item @code{:copy-in-global-log:}
+@cindex :copy-in-global-log:
+@cindex reStructuredText field, @code{:copy-in-global-log:}
+If this field is present and defined to @code{no}, then the content
+of the @file{.log} file will @emph{not} be copied into the global
+@file{test-suite.log}.  We allow to forsake such copying because, while
+it can be useful in debugging and analysis of bug report, it can also be
+just a waste of space in normal situations, e.g., when a test script is
+successful.  What happens when two or more @code{:copy-in-global-log:}
+fields are present in the same @file{.trs} file is undefined behaviour.
+
+@c Keep in sync with 'test-metadata-global-result.test'.
+@item @code{:test-global-result:}
+@cindex :test-global-result:
+@cindex reStructuredText field, @code{:test-global-result:}
+This is used to declare the "global result" of the script.  Currently,
+the value of this field is needed only to be reported (more or less
+verbatim) in the generated global log file @code{$(TEST_SUITE_LOG)},
+so it's quite free-form.  For example, a test script which run 10 test
+cases, 6 of which pass and 4 of which are skipped, could reasonably have
+a @code{PASS/SKIP} value for this field, while a test script which run
+19 successful tests and one failed test could have an @code{ALMOST
+PASSED} value.  What happens when two or more @code{:test-global-result:}
+fields are present in the same @file{.trs} file is undefined behaviour.
+@end table
+
+@noindent
+Let's see a small example.  Assume a @file{.trs} file contains the
+following lines:
+
+@example
+:test-result: PASS server starts
+:global-log-copy: no
+:test-result: PASS HTTP/1.1 request
+:test-result: FAIL HTTP/1.0 request
+:recheck: yes
+:test-result: SKIP HTTPS request (TLS library wasn't available)
+:test-result: PASS server stops
+@end example
+
+@noindent
+Then the corresponding test script will be re-run by @command{make check},
+will contribute with @emph{five} test results to the testsuite summary
+(three of these tests being successful, one failed, and one skipped), and
+the content of the corresponding @file{.log} file will @emph{not} be
+copied in the global log file @file{test-suite.log}.
+
+@node Testsuite progress output
+@subsubsection Testsuite progress output
+
+A custom test driver also has the task of displaying, on the standard
+output, the test results as soon as they become available.  Depending on
+the protocol in use, it can also display the reasons for failures and
+skips, and, more generally, any useful diagnostic output (but remember
+that each line on the screen is precious, so that cluttering the screen
+with overly verbose information is bad idea).  The exact format of this
+progress output is left up to the test driver; in fact, a custom test
+driver might @emph{theoretically} even decide not to do any such report,
+leaving it all to the testsuite summary (that would be a very lousy idea,
+of course, and serves only to illustrate the flexibility that is
+granted here).
+
+Remember that consistency is good; so, if possible, try to be consistent
+with the output of the built-in Automake test drivers, providing a similar
+``look & feel''.  In particular, the testsuite progress output should be
+colorized when the @option{--color-tests} is passed to the driver.  On the
+other end, if you are using a known and widespread test protocol with
+well-established implementations, being consistent with those
+implementations' output might be a good idea too.
+
+@c TODO: Give an example, maybe inspired to py.test-style output.
+@c TODO: That is a good idea because it shows a test driver that allows
+@c TODO: for different levels of verbosity in the progress output (could
+@c TODO: be implemented either using a driver cmdline flag, or an
+@c TODO: environment variable, or both).
+
+@node Using the TAP test protocol
+@section Using the TAP test protocol
+
+@menu
+* Introduction to TAP::
+* Use TAP with the Automake test harness::
+* Incompatibilities with other TAP parsers and drivers::
+* Links and external resources on TAP::
+@end menu
+
+@node Introduction to TAP
+@subsection Introduction to TAP
+
+TAP, the Test Anything Protocol, is a simple text-based interface between
+testing modules or programs and a test harness.  The tests (also called
+``TAP producers'' in this context) write test results in a simple format
+on standard output; a test harness (also called ``TAP consumer'') will
+parse and interpret these results, and properly present them to the user,
+and/or register them for later analysis.  The exact details of how this
+is accomplished can vary among different test harnesses.  The Automake
+parallel harness will present the results on the console in the usual
+fashion (@pxref{Testsuite progress on console}), and will use the
+@file{.trs} files (@pxref{Basics of test metadata}) to store the test
+results and related metadata.  Apart from that, it will try to remain
+as much compatible as possible with pre-existing and widespread utilities,
+such as the @uref{http://search.cpan.org/~andya/Test-Harness/bin/prove,
+@command{prove} utility}, at least for the simpler usages.
+
+TAP started its life as part of the test harness for Perl, but today
+it has been (mostly) standardized, and has various independent
+implementations in different languages; among them, C, C++, Perl,
+Python, PHP, and Java.  For a semi-official specification of the
+TAP protocol, please refer to the documentation of
+@uref{http://search.cpan.org/~petdance/Test-Harness/lib/Test/Harness/TAP.pod,
+      @samp{Test::Harness::TAP}}.
+
+The most relevant real-world usages of TAP are obviously in the testsuites
+of @command{perl} and of many perl modules.  Still, also other important
+third-party packages, such as @uref{http://git-scm.com/, @command{git}},
+use TAP in their testsuite.
+
+@node Use TAP with the Automake test harness
+@subsection Use TAP with the Automake test harness
+
+Currently, the TAP driver that comes with Automake requires a perl
+interpreter to work, and requires various by-hand steps on the
+developer's part (this should be fixed in future Automake versions).
+You'll have grab the @file{tap-driver.pl} script from the Automake
+distribution by hand, copy it in your source tree, add code to
+@file{configure.ac} to search a perl interpreter and to define the
+@code{$(PERL)} variable accordingly, and use the Automake support
+for third-party test drivers to instruct the harness to use the
+@file{tap-driver.pl} to run your TAP-producing tests.  See the example
+below for clarification.
+
+Apart from the options common to all the Automake test drivers
+(@pxref{Command-line arguments for test drivers}), the @file{tap-driver.pl}
+supports the following options, whose names are chosen for enhanced
+compatibility with the @command{prove} utility.
+
+@table @option
+@c Keep in sync with 'tap-exit.test' and 'tap-signal.test'.
+@item --ignore-exit
+Causes the test driver to ignore the exit status of the test scripts;
+by default, the driver will report an error if the script exit with a
+non-zero status.  This option has effect also
+@item --comments
+Instruct the test driver to display TAP diagnostic (i.e., lines beginning
+with the @samp{#} character) in the testsuite progress output too; by
+default, TAP diagnostic is only copied in the @file{.log} file.
+@item --no-comments
+Revert the effects of @option{--comments}.
+@item --merge
+Instruct the test driver to merge the test scripts' standard error into
+their standard output.  This is necessary if you want to ensure that
+diagnostics from the test scripts are displayed in the correct order
+relative to test results; this can be of great help in debugging
+(especially if your test scripts are shell scripts run with shell
+tracing active).  As a downside, this option might cause the test
+harness to get confused if anything that appears on standard error
+looks like a test result.
+@item --no-merge
+Revert the effects of @option{--merge}.
+@item --diagnostic-string=@var{STRING}
+Change the string that introduces TAP diagnostic from the default value
+of ``@code{#}'' to @code{@var{STRING}}.  This can be useful if your
+TAP-based test scripts produce verbose output on which they have limited
+control (because, say, the output comes by other tools invoked in the
+scripts), and it might contain text that gets spuriously interpreted as
+TAP diagnostic: such an issue can be solved by redefining the string that
+activates TAP diagnostic to a value you know won't appear by chance in
+the tests' output.  Note however that this feature is non-standard, as
+the ``official'' TAP protocol does not allow for such a customization; so
+don't use it if you can avoid it.
+@end table
+
+@noindent
+Here is an example of how the TAP driver can be set up and used.
+
+@c Keep in sync with tap-doc2.test.
+@example
+% @kbd{cat configure.ac}
+AC_INIT([GNU Try Tap], [1.0], [bug-automake@@gnu.org])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([foreign parallel-tests -Wall -Werror])
+AC_CONFIG_FILES([Makefile])
+AC_REQUIRE_AUX_FILE([tap-driver.pl])
+AC_PATH_PROG([PERL], [perl])
+test -n "$PERL" || AC_MSG_ERROR([perl not found])
+$PERL -MTAP::Parser -e 1 || AC_MSG_ERROR([TAP::Parser not found])
+AC_OUTPUT
+
+% @kbd{cat Makefile.am}
+TEST_LOG_DRIVER = $(PERL) $(srcdir)/build-aux/tap-driver.pl
+TESTS = foo.test bar.test baz.test
+EXTRA_DIST = $(TESTS)
+
+% @kbd{cat foo.test}
+#!/bin/sh
+echo 1..4 # Number of tests to be executed.
+echo 'ok 1 - Swallows fly'
+echo 'not ok 2 - Caterpillars fly # TODO metamorphosis in progress'
+echo 'ok 3 - Pigs fly # SKIP not enough acid'
+echo '# I just love word plays ...'
+echo 'ok 4 - Flies fly too :-)'
+
+% @kbd{cat bar.test}
+#!/bin/sh
+echo 1..3
+echo 'not ok 1 - Bummer, this test has failed.'
+echo 'ok 2 - This passed though.'
+echo 'Bail out! Ennui kicking in, sorry...'
+echo 'ok 3 - This will not be seen.'
+
+% @kbd{cat baz.test}
+#!/bin/sh
+echo 1..1
+echo ok 1
+# Exit with error, even if all the test case has been successful.
+exit 7
+
+% @kbd{cp @var{PREFIX}/share/automake-@var{APIVERSION}/tap-driver.pl .}
+% @kbd{autoreconf -vi && ./configure && make check}
+...
+PASS: foo.test 1 - Swallows fly
+XFAIL: foo.test 2 - Caterpillars fly # TODO metamorphosis in progress
+SKIP: foo.test 3 - Pigs fly # SKIP not enough acid
+PASS: foo.test 4 - Flies fly too :-)
+FAIL: bar.test 1 - Bummer, this test has failed.
+PASS: bar.test 2 - This passed though.
+ERROR: bar.test - Bail out! Ennui kicking in, sorry...
+PASS: baz.test 1
+ERROR: baz.test - exited with status 7
+...
+Please report to bug-automake@@gnu.org
+...
+% @kbd{echo exit status: $?}
+exit status: 1
+
+@c Keep the "skewed" indentation below, it produces pretty PDF output.
+% @kbd{env TEST_LOG_DRIVER_FLAGS='--comments --ignore-exit' \
+      TESTS='foo.test baz.test' make -e check}
+...
+PASS: foo.test 1 - Swallows fly
+XFAIL: foo.test 2 - Caterpillars fly # TODO metamorphosis in progress
+SKIP: foo.test 3 - Pigs fly # SKIP not enough acid
+# foo.test: I just love word plays...
+PASS: foo.test 4 - Flies fly too :-)
+PASS: baz.test 1
+...
+% @kbd{echo exit status: $?}
+exit status: 0
+@end example
+
+@node Incompatibilities with other TAP parsers and drivers
+@subsection Incompatibilities with other TAP parsers and drivers
+
+For implementation or historical reasons, the TAP driver and harness as
+implemented by Automake have some minors incompatibilities with the
+mainstream versions, which you should be aware of.
+
+@itemize @bullet
+@item
+A @code{Bail out!} directive doesn't stop the whole testsuite, but only
+the test script it occurs into.  This doesn't follows TAP specifications,
+but on the other hand it maximizes compatibility (and code sharing) with
+the ``hard error'' concept of the default @option{parallel-tests} driver.
+@item
+The @code{version} and @code{pragma} directives are not supported.
+@item
+The @option{--diagnostic-string} option of out driver allows to modify
+the string that introduces TAP diagnostic from the default value
+of ``@code{#}''.  The standard TAP protocol has currently no way to
+allow this, so if you use it your diagnostic will be lost to more
+compliant tools like @command{prove} and @code{Test::Harness}
+@item
+And there are probably some other small and yet undiscovered
+incompatibilities, especially in corner cases or with rare usages.
+@end itemize
+
+@node Links and external resources on TAP
+@subsection Links and external resources on TAP
+
+@noindent
+Here are some links to more extensive official or third-party
+documentation and resources about the TAP protocol and related
+tools and libraries.
+@itemize @bullet
+@item
+@uref{http://search.cpan.org/~petdance/Test-Harness/lib/Test/Harness/TAP.pod,
+      @samp{Test::Harness::TAP}},
+the (mostly) official documentation about the TAP format and protocol.
+@item
+@uref{http://search.cpan.org/~andya/Test-Harness/bin/prove,
+      @command{prove}},
+the most famous command-line TAP test driver, included in the distribution
+of @command{perl} and
+@uref{http://search.cpan.org/~andya/Test-Harness/lib/Test/Harness.pm,
+      @samp{Test::Harness}}.
+@item
+The @uref{http://testanything.org/wiki/index.php/Main_Page,TAP wiki}.
+@item
+A ``gentle introduction'' to testing for perl coders:
+@uref{http://search.cpan.org/dist/Test-Simple/lib/Test/Tutorial.pod,
+      @samp{Test::Tutorial}}.
+@item
+@uref{http://search.cpan.org/~mschwern/Test-Simple/lib/Test/Simple.pm,
+      @samp{Test::Simple}}
+and
+@uref{http://search.cpan.org/~mschwern/Test-Simple/lib/Test/More.pm,
+      @samp{Test::More}},
+the standard perl testing libraries, which are based on TAP.
+@item
+@uref{http://www.eyrie.org/~eagle/software/c-tap-harness/,C TAP Harness},
+a C-based project implementing both a TAP producer and a TAP consumer.
+@item
+@uref{http://www.tap4j.org/,tap4j},
+a Java-based project implementing both a TAP producer and a TAP consumer.
+@end itemize
 
 @node DejaGnu Tests
 @section DejaGnu Tests
@@ -9119,8 +9808,6 @@ appear in @code{EXTRA_DEJAGNU_SITE_CONFIG}).  Note that files are
 For more information regarding DejaGnu test suites, see @ref{Top, , ,
 dejagnu, The DejaGnu Manual}.
 
-In either case, the testing is done via @samp{make check}.
-
 @node Install Tests
 @section Install Tests
 
@@ -9233,8 +9920,16 @@ will now be rerun each time the version number is bumped, when only
 @node Options
 @chapter Changing Automake's Behavior
 
+@menu
+* Options generalities::        Semantics of Automake option
+* List of Automake options::    A comprehensive list of Automake options
+@end menu
+
+@node Options generalities
+@section Options generalities
+
 Various features of Automake can be controlled by options.  Except where
-noted otherwise, options can be specified in one of several ways: Most
+noted otherwise, options can be specified in one of several ways Most
 options can be applied on a per-@file{Makefile} basis when listed in a
 special @file{Makefile} variable named @code{AUTOMAKE_OPTIONS}.  Some
 of these options only make sense when specified in the toplevel
@@ -9244,7 +9939,43 @@ of these options only make sense when specified in the toplevel
 require changes to the @command{configure} script can only be specified
 there.  These are annotated below.
 
-Currently understood options are:
+As a general rule, options specified in @code{AUTOMAKE_OPTIONS} take
+precedence over those specified in @code{AM_INIT_AUTOMAKE}, which in
+turn take precedence over those specified on the command line.
+
+Also, some care must be taken about the interactions among strictness
+level and warning categories.  As a general rule, strictness-implied
+warnings are overridden by those specified by explicit options.  For
+example, even if @samp{portability} warnings are disabled by default
+in @option{foreign} strictness, an usage like this will end up enabling
+them:
+
+@example
+AUTOMAKE_OPTIONS = -Wportability foreign
+@end example
+
+However, a strictness level specified in a higher-priority context
+will override all the explicit warnings specified in a lower-priority
+context.  For example, if @file{configure.ac} contains:
+
+@example
+AM_INIT_AUTOMAKE([-Wportability])
+@end example
+
+@noindent
+and @file{Makefile.am} contains:
+
+@example
+AUTOMAKE_OPTIONS = foreign
+@end example
+
+@noindent
+then @samp{portability} warnings will be @emph{disabled} in
+@file{Makefile.am}.
+
+@node List of Automake options
+@section List of Automake options
+
 @vindex AUTOMAKE_OPTIONS
 
 @table @asis
@@ -9264,20 +9995,6 @@ Currently understood options are:
 Set the strictness as appropriate.  The @option{gnits} option also
 implies options @option{readme-alpha} and @option{check-news}.
 
-@item @option{ansi2knr}
-@itemx @option{@var{path}/ansi2knr}
-@cindex Option, @option{ansi2knr}
-@opindex ansi2knr
-Turn on the deprecated de-ANSI-fication feature (@pxref{ANSI}).  Note
-that that feature and this option @emph{will be removed} in the next
-major Automake release.
-
-If preceded by a
-path, the generated @file{Makefile.in} will look in the specified
-directory to find the @file{ansi2knr} program.  The path should be a
-relative path to another directory in the same distribution (Automake
-does not check this).
-
 @item @option{check-news}
 @cindex Option, @option{check-news}
 @opindex check-news
@@ -9287,8 +10004,9 @@ in the first few lines of the @file{NEWS} file.
 @item @option{color-tests}
 @cindex Option, @option{color-tests}
 @opindex color-tests
-Cause output of the simple test suite (@pxref{Simple Tests}) to be
-colorized on capable terminals.
+Cause output of the serial and parallel test harnesses (see @ref{Simple
+Tests}) and of properly-written custom test drivers (@pxref{Custom Test
+Drivers}) to be colorized on capable terminals.
 
 @item @option{dejagnu}
 @cindex Option, @option{dejagnu}
@@ -9416,8 +10134,8 @@ this directory.
 @item @option{parallel-tests}
 @cindex Option, @option{parallel-tests}
 @opindex parallel-tests
-Enable test suite driver for @code{TESTS} that can run tests in parallel
-(@pxref{Simple Tests using parallel-tests}, for more information).
+Enable test suite harness for @code{TESTS} that can run tests in parallel
+(@pxref{Parallel Test Harness}, for more information).
 
 @item @option{readme-alpha}
 @cindex Option, @option{readme-alpha}
@@ -9466,7 +10184,7 @@ test.  For instance, @command{false} (from GNU coreutils) is never
 successful, even for @option{--help} or @option{--version}.  You can list
 such programs in the variable @code{AM_INSTALLCHECK_STD_OPTIONS_EXEMPT}.
 Programs (not scripts) listed in this variable should be suffixed by
-@samp{$(EXEEXT)} for the sake of Win32 or OS/2.  For instance, suppose we
+@samp{$(EXEEXT)} for the sake of Windows or OS/2.  For instance, suppose we
 build @file{false} as a program but @file{true.sh} as a script, and that
 neither of them support @option{--help} or @option{--version}:
 
@@ -9580,9 +10298,8 @@ the @code{AM_INIT_AUTOMAKE} macro in @file{configure.ac}.
 There are a few rules and variables that didn't fit anywhere else.
 
 @menu
-* Tags::        Interfacing to etags and mkid
-* Suffixes::    Handling new file extensions
-* Multilibs::   Support for multilibs (deprecated, soon to be removed).
+* Tags::                        Interfacing to cscope, etags and mkid
+* Suffixes::                    Handling new file extensions
 @end menu
 
 
@@ -9637,10 +10354,22 @@ is the name of the program to invoke (by default @command{ctags});
 @code{CTAGSFLAGS} can be used by the user to pass additional flags,
 and @code{AM_CTAGSFLAGS} can be used by the @file{Makefile.am}.
 
+@trindex id
 Automake will also generate an @code{ID} rule that will run
 @command{mkid} on the source.  This is only supported on a
 directory-by-directory basis.
-@trindex id
+
+Similarly, the @code{cscope} rule will create a list of all the source
+files in the tree and run @command{cscope} to build an inverted index
+database.  The variable @code{CSCOPE} is the name of the program to invoke
+(by default @command{cscope}); @code{CSCOPEFLAGS} and
+@code{CSCOPE_ARGS} can be used by the user to pass additional flags and
+file names respectively, while @code{AM_CSCOPEFLAGS} can be used by the
+@file{Makefile.am}.  Note that, currently, the Automake-provided
+@code{cscope} support, when used in a VPATH build, might not work well
+with non-GNU make implementations (especially with make implementations
+performing @ref{Automatic Rule Rewriting, , VPATH rewrites, autoconf,
+The Autoconf Manual}).
 
 Finally, Automake also emits rules to support the
 @uref{http://www.gnu.org/software/global/, GNU Global Tags program}.
@@ -9702,22 +10431,6 @@ Automake generate the suffix list for @code{.SUFFIXES}.  Any given
 @code{SUFFIXES} go at the start of the generated suffixes list, followed
 by Automake generated suffixes not already in the list.
 
-@node Multilibs
-@section Support for Multilibs (deprecated, soon to be removed).
-
-Automake used to support an obscure feature called multilibs.  @emph{This
-feature is now deprecated, and will be removed in the next major Automake
-version}.  Still, its implementation will remain available in the
-@file{contrib/} directory of the Automake distribution, so it should be
-very easy for motivated users to continue to use it in their projects,
-if they really need to.
-
-A @dfn{multilib} is a library that is built for multiple different ABIs
-at a single time; each time the library is built with a different target
-flag combination.  This is only useful when the library is intended to
-be cross-compiled, and it is almost exclusively used for compiler
-support libraries.
-
 @node Include
 @chapter Include
 
@@ -11654,7 +12367,7 @@ user counterpart.
 has neither @code{AM_} nor per-target cousin.
 
 Finally you should not think that the existence of a per-target
-variable implies the existance of an @code{AM_} variable or of a user
+variable implies the existence of an @code{AM_} variable or of a user
 variable.  For instance, the @code{mumble_LDADD} per-target variable
 overrides the makefile-wide @code{LDADD} variable (which is not a user
 variable), and @code{mumble_LIBADD} exists only as a per-target
@@ -12321,1141 +13034,6 @@ Ideally, post a minimal @file{Makefile.am} and @file{configure.ac} that
 reproduces the problem you encounter.  If you have encountered test
 suite failures, please attach the @file{tests/test-suite.log} file.
 
-
-@node History
-@chapter History of Automake
-
-This chapter presents various aspects of the history of Automake.  The
-exhausted reader can safely skip it; this will be more of interest to
-nostalgic people, or to those curious to learn about the evolution of
-Automake.
-
-@menu
-* Timeline::                    The Automake story.
-* Dependency Tracking Evolution::  Evolution of Automatic Dependency Tracking
-* Releases::                    Statistics about Automake Releases
-@end menu
-
-@node Timeline
-@section Timeline
-
-@table @asis
-@item 1994-09-19 First CVS commit.
-
-If we can trust the CVS repository, David J.@tie{}MacKenzie (djm) started
-working on Automake (or AutoMake, as it was spelt then) this Monday.
-
-The first version of the @command{automake} script looks as follows.
-
-@example
-#!/bin/sh
-
-status=0
-
-for makefile
-do
-  if test ! -f $@{makefile@}.am; then
-    echo "automake: $@{makefile@}.am: No such honkin' file"
-    status=1
-    continue
-  fi
-
-  exec 4> $@{makefile@}.in
-
-done
-@end example
-
-From this you can already see that Automake will be about reading
-@file{*.am} file and producing @file{*.in} files.  You cannot see
-anything else, but if you also know that David is the one who created
-Autoconf two years before you can guess the rest.
-
-Several commits follow, and by the end of the day Automake is
-reported to work for GNU fileutils and GNU m4.
-
-The modus operandi is the one that is still used today: variable
-assignments in @file{Makefile.am} files trigger injections of
-precanned @file{Makefile} fragments into the generated
-@file{Makefile.in}.  The use of @file{Makefile} fragments was inspired
-by the 4.4BSD @command{make} and include files, however Automake aims
-to be portable and to conform to the GNU standards for @file{Makefile}
-variables and targets.
-
-At this point, the most recent release of Autoconf is version 1.11,
-and David is preparing to release Autoconf 2.0 in late October.  As a
-matter of fact, he will barely touch Automake after September.
-
-@item 1994-11-05 David MacKenzie's last commit.
-
-At this point Automake is a 200 line portable shell script, plus 332
-lines of @file{Makefile} fragments.  In the @file{README}, David
-states his ambivalence between ``portable shell'' and ``more
-appropriate language'':
-
-@quotation
-I wrote it keeping in mind the possibility of it becoming an Autoconf
-macro, so it would run at configure-time.  That would slow
-configuration down a bit, but allow users to modify the Makefile.am
-without needing to fetch the AutoMake package.  And, the Makefile.in
-files wouldn't need to be distributed.  But all of AutoMake would.  So
-I might reimplement AutoMake in Perl, m4, or some other more
-appropriate language.
-@end quotation
-
-Automake is described as ``an experimental Makefile generator''.
-There is no documentation.  Adventurous users are referred to the
-examples and patches needed to use Automake with GNU m4 1.3, fileutils
-3.9, time 1.6, and development versions of find and indent.
-
-These examples seem to have been lost.  However at the time of writing
-(10 years later in September, 2004) the FSF still distributes a
-package that uses this version of Automake: check out GNU termutils
-2.0.
-
-@item 1995-11-12 Tom Tromey's first commit.
-
-After one year of inactivity, Tom Tromey takes over the package.
-Tom was working on GNU cpio back then, and doing this just for fun,
-having trouble finding a project to contribute to.  So while hacking
-he wanted to bring the @file{Makefile.in} up to GNU standards.  This
-was hard, and one day he saw Automake on @url{ftp://alpha.gnu.org/},
-grabbed it and tried it out.
-
-Tom didn't talk to djm about it until later, just to make sure he
-didn't mind if he made a release.  He did a bunch of early releases to
-the Gnits folks.
-
-Gnits was (and still is) totally informal, just a few GNU friends who
-Fran@,cois Pinard knew, who were all interested in making a common
-infrastructure for GNU projects, and shared a similar outlook on how
-to do it.  So they were able to make some progress.  It came along
-with Autoconf and extensions thereof, and then Automake from David and
-Tom (who were both gnitsians).  One of their ideas was to write a
-document paralleling the GNU standards, that was more strict in some
-ways and more detailed.  They never finished the GNITS standards, but
-the ideas mostly made their way into Automake.
-
-@item 1995-11-23 Automake 0.20
-
-Besides introducing automatic dependency tracking (@pxref{Dependency
-Tracking Evolution}), this version also supplies a 9-page manual.
-
-At this time @command{aclocal} and @code{AM_INIT_AUTOMAKE} did not
-exist, so many things had to be done by hand.  For instance, here is
-what a configure.in (this is the former name of the
-@file{configure.ac} we use today) must contain in order to use
-Automake 0.20:
-
-@example
-PACKAGE=cpio
-VERSION=2.3.911
-AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION")
-AC_SUBST(PACKAGE)
-AC_SUBST(VERSION)
-AC_ARG_PROGRAM
-AC_PROG_INSTALL
-@end example
-
-(Today all of the above is achieved by @code{AC_INIT} and
-@code{AM_INIT_AUTOMAKE}.)
-
-Here is how programs are specified in @file{Makefile.am}:
-
-@example
-PROGRAMS = hello
-hello_SOURCES = hello.c
-@end example
-
-This looks pretty much like what we do today, except the
-@code{PROGRAMS} variable has no directory prefix specifying where
-@file{hello} should be installed: all programs are installed in
-@samp{$(bindir)}.  @code{LIBPROGRAMS} can be used to specify programs
-that must be built but not installed (it is called
-@code{noinst_PROGRAMS} nowadays).
-
-Programs can be built conditionally using @code{AC_SUBST}itutions:
-
-@example
-PROGRAMS = @@progs@@
-AM_PROGRAMS = foo bar baz
-@end example
-
-(@code{AM_PROGRAMS} has since then been renamed to
-@code{EXTRA_PROGRAMS}.)
-
-Similarly scripts, static libraries, and data can be built and installed
-using the @code{LIBRARIES}, @code{SCRIPTS}, and @code{DATA} variables.
-However @code{LIBRARIES} were treated a bit specially in that Automake
-did automatically supply the @file{lib} and @file{.a} prefixes.
-Therefore to build @file{libcpio.a}, one had to write
-
-@example
-LIBRARIES = cpio
-cpio_SOURCES = ...
-@end example
-
-Extra files to distribute must be listed in @code{DIST_OTHER} (the
-ancestor of @code{EXTRA_DIST}).  Also extra directories that are to be
-distributed should appear in @code{DIST_SUBDIRS}, but the manual
-describes this as a temporary ugly hack (today extra directories should
-also be listed in @code{EXTRA_DIST}, and @code{DIST_SUBDIRS} is used
-for another purpose, @pxref{Conditional Subdirectories}).
-
-@item 1995-11-26 Automake 0.21
-
-In less time than it takes to cook a frozen pizza, Tom rewrites
-Automake using Perl.  At this time Perl 5 is only one year old, and
-Perl 4.036 is in use at many sites.  Supporting several Perl versions
-has been a source of problems through the whole history of Automake.
-
-If you never used Perl 4, imagine Perl 5 without objects, without
-@samp{my} variables (only dynamically scoped @samp{local} variables),
-without function prototypes, with function calls that needs to be
-prefixed with @samp{&}, etc.  Traces of this old style can still be
-found in today's @command{automake}.
-
-@item 1995-11-28 Automake 0.22
-@itemx 1995-11-29 Automake 0.23
-
-Bug fixes.
-
-@item 1995-12-08 Automake 0.24
-@itemx 1995-12-10 Automake 0.25
-
-Releases are raining.  0.24 introduces the uniform naming scheme we
-use today, i.e., @code{bin_PROGRAMS} instead of @code{PROGRAMS},
-@code{noinst_LIBRARIES} instead of @code{LIBLIBRARIES}, etc.  (However
-@code{EXTRA_PROGRAMS} does not exist yet, @code{AM_PROGRAMS} is still
-in use; and @code{TEXINFOS} and @code{MANS} still have no directory
-prefixes.)  Adding support for prefixes like that was one of the major
-ideas in @command{automake}; it has lasted pretty well.
-
-AutoMake is renamed to Automake (Tom seems to recall it was Fran@,cois
-Pinard's doing).
-
-0.25 fixes a Perl 4 portability bug.
-
-@item 1995-12-18 Jim Meyering starts using Automake in GNU Textutils.
-@item 1995-12-31 Fran@,cois Pinard starts using Automake in GNU tar.
-
-@item 1996-01-03 Automake 0.26
-@itemx 1996-01-03 Automake 0.27
-
-Of the many changes and suggestions sent by Fran@,cois Pinard and
-included in 0.26, perhaps the most important is the advice that to
-ease customization a user rule or variable definition should always
-override an Automake rule or definition.
-
-Gordon Matzigkeit and Jim Meyering are two other early contributors
-that have been sending fixes.
-
-0.27 fixes yet another Perl 4 portability bug.
-
-@item 1996-01-13 Automake 0.28
-
-Automake starts scanning @file{configure.in} for @code{LIBOBJS}
-support.  This is an important step because until this version
-Automake only knew about the @file{Makefile.am}s it processed.
-@file{configure.in} was Autoconf's world and the link between Autoconf
-and Automake had to be done by the @file{Makefile.am} author.  For
-instance, if @file{config.h} was generated by @file{configure}, it was the
-package maintainer's responsibility to define the @code{CONFIG_HEADER}
-variable in each @file{Makefile.am}.
-
-Succeeding releases will rely more and more on scanning
-@file{configure.in} to better automate the Autoconf integration.
-
-0.28 also introduces the @code{AUTOMAKE_OPTIONS} variable and the
-@option{--gnu} and @option{--gnits} options, the latter being stricter.
-
-@item 1996-02-07 Automake 0.29
-
-Thanks to @file{configure.in} scanning, @code{CONFIG_HEADER} is gone,
-and rebuild rules for @file{configure}-generated file are
-automatically output.
-
-@code{TEXINFOS} and @code{MANS} converted to the uniform naming
-scheme.
-
-@item 1996-02-24 Automake 0.30
-
-The test suite is born.  It contains 9 tests.  From now on test cases
-will be added pretty regularly (@pxref{Releases}), and this proved to
-be really helpful later on.
-
-@code{EXTRA_PROGRAMS} finally replaces @code{AM_PROGRAMS}.
-
-All the third-party Autoconf macros, written mostly by Fran@,cois
-Pinard (and later Jim Meyering), are distributed in Automake's
-hand-written @file{aclocal.m4} file.  Package maintainers are expected
-to extract the necessary macros from this file.  (In previous versions
-you had to copy and paste them from the manual...)
-
-@item 1996-03-11 Automake 0.31
-
-The test suite in 0.30 was run via a long @code{check-local} rule.  Upon
-Ulrich Drepper's suggestion, 0.31 makes it an Automake rule output
-whenever the @code{TESTS} variable is defined.
-
-@code{DIST_OTHER} is renamed to @code{EXTRA_DIST}, and the @code{check_}
-prefix is introduced.  The syntax is now the same as today.
-
-@item 1996-03-15 Gordon Matzigkeit starts writing libtool.
-
-@item 1996-04-27 Automake 0.32
-
-@code{-hook} targets are introduced; an idea from Dieter Baron.
-
-@file{*.info} files, which were output in the build directory are
-now built in the source directory, because they are distributed.  It
-seems these files like to move back and forth as that will happen
-again in future versions.
-
-@item 1996-05-18 Automake 0.33
-
-Gord Matzigkeit's main two contributions:
-
-@itemize
-@item very preliminary libtool support
-@item the distcheck rule
-@end itemize
-
-Although they were very basic at this point, these are probably
-among the top features for Automake today.
-
-Jim Meyering also provides the infamous @code{jm_MAINTAINER_MODE},
-since then renamed to @code{AM_MAINTAINER_MODE} and abandoned by its
-author (@pxref{maintainer-mode}).
-
-@item 1996-05-28 Automake 1.0
-
-After only six months of heavy development, the @command{automake} script is
-3134 lines long, plus 973 lines of @file{Makefile} fragments.  The
-package has 30 pages of documentation, and 38 test cases.
-@file{aclocal.m4} contains 4 macros.
-
-From now on and until version 1.4, new releases will occur at a rate
-of about one a year.  1.1 did not exist, actually 1.1b to 1.1p have
-been the name of beta releases for 1.2.  This is the first time
-Automake uses suffix letters to designate beta releases, a habit that
-lasts.
-
-@item 1996-10-10 Kevin Dalley packages Automake 1.0 for Debian GNU/Linux.
-
-@item 1996-11-26 David J.@tie{}MacKenzie releases Autoconf 2.12.
-
-Between June and October, the Autoconf development is almost stalled.
-Roland McGrath has been working at the beginning of the year.  David
-comes back in November to release 2.12, but he won't touch Autoconf
-anymore after this year, and Autoconf then really stagnates.  The
-desolate Autoconf @file{ChangeLog} for 1997 lists only 7 commits.
-
-@item 1997-02-28 @email{automake@@gnu.ai.mit.edu} list alive
-
-The mailing list is announced as follows:
-@smallexample
-I've created the "automake" mailing list.  It is
-"automake@@gnu.ai.mit.edu".  Administrivia, as always, to
-automake-request@@gnu.ai.mit.edu.
-
-The charter of this list is discussion of automake, autoconf, and
-other configuration/portability tools (e.g., libtool).  It is expected
-that discussion will range from pleas for help all the way up to
-patches.
-
-This list is archived on the FSF machines.  Offhand I don't know if
-you can get the archive without an account there.
-
-This list is open to anybody who wants to join.  Tell all your
-friends!
--- Tom Tromey
-@end smallexample
-
-Before that people were discussing Automake privately, on the Gnits
-mailing list (which is not public either), and less frequently on
-@code{gnu.misc.discuss}.
-
-@code{gnu.ai.mit.edu} is now @code{gnu.org}, in case you never
-noticed.  The archives of the early years of the
-@code{automake@@gnu.org} list have been lost, so today it is almost
-impossible to find traces of discussions that occurred before 1999.
-This has been annoying more than once, as such discussions can be
-useful to understand the rationale behind a piece of uncommented code
-that was introduced back then.
-
-@item 1997-06-22 Automake 1.2
-
-Automake developments continues, and more and more new Autoconf macros
-are required.  Distributing them in @file{aclocal.m4} and requiring
-people to browse this file to extract the relevant macros becomes
-uncomfortable.  Ideally, some of them should be contributed to
-Autoconf so that they can be used directly, however Autoconf is
-currently inactive.  Automake 1.2 consequently introduces
-@command{aclocal} (@command{aclocal} was actually started on
-1996-07-28), a tool that automatically constructs an @file{aclocal.m4}
-file from a repository of third-party macros.  Because Autoconf has
-stalled, Automake also becomes a kind of repository for such
-third-party macros, even macros completely unrelated to Automake (for
-instance macros that fix broken Autoconf macros).
-
-The 1.2 release contains 20 macros, including the
-@code{AM_INIT_AUTOMAKE} macro that simplifies the creation of
-@file{configure.in}.
-
-Libtool is fully supported using @code{*_LTLIBRARIES}.
-
-The missing script is introduced by Fran@,cois Pinard; it is meant to be
-a better solution than @code{AM_MAINTAINER_MODE}
-(@pxref{maintainer-mode}).
-
-Conditionals support was implemented by Ian Lance Taylor.  At the
-time, Tom and Ian were working on an internal project at Cygnus.  They
-were using ILU, which is pretty similar to CORBA@.  They wanted to
-integrate ILU into their build, which was all @file{configure}-based,
-and Ian thought that adding conditionals to @command{automake} was
-simpler than doing all the work in @file{configure} (which was the
-standard at the time).  So this was actually funded by Cygnus.
-
-This very useful but tricky feature will take a lot of time to
-stabilize.  (At the time this text is written, there are still
-primaries that have not been updated to support conditional
-definitions in Automake 1.9.)
-
-The @command{automake} script has almost doubled: 6089 lines of Perl,
-plus 1294 lines of @file{Makefile} fragments.
-
-@item 1997-07-08 Gordon Matzigkeit releases Libtool 1.0.
-
-@item 1998-04-05 Automake 1.3
-
-This is a small advance compared to 1.2.
-It adds support for assembly, and preliminary support for Java.
-
-Perl 5.004_04 is out, but fixes to support Perl 4 are still
-regularly submitted whenever Automake breaks it.
-
-@item 1998-09-06 @code{sourceware.cygnus.com} is on-line.
-
-Sourceware was setup by Jason Molenda to host open source projects.
-
-@item 1998-09-19  Automake CVS repository moved to @code{sourceware.cygnus.com}
-@itemx 1998-10-26  @code{sourceware.cygnus.com} announces it hosts Automake:
-Automake is now hosted on @code{sourceware.cygnus.com}.  It has a
-publicly accessible CVS repository.  This CVS repository is a copy of
-the one Tom was using on his machine, which in turn is based on
-a copy of the CVS repository of David MacKenzie.  This is why we still
-have to full source history.  (Automake was on Sourceware until 2007-10-29,
-when it moved to a git repository on @code{savannah.gnu.org},
-but the Sourceware host had been renamed to @code{sources.redhat.com}.)
-
-The oldest file in the administrative directory of the CVS repository
-that was created on Sourceware is dated 1998-09-19, while the
-announcement that @command{automake} and @command{autoconf} had joined
-@command{sourceware} was made on 1998-10-26.  They were among the
-first projects to be hosted there.
-
-The heedful reader will have noticed Automake was exactly 4 years old
-on 1998-09-19.
-
-@item 1999-01-05 Ben Elliston releases Autoconf 2.13.
-
-@item 1999-01-14 Automake 1.4
-
-This release adds support for Fortran 77 and for the @code{include}
-statement.  Also, @samp{+=} assignments are introduced, but it is
-still quite easy to fool Automake when mixing this with conditionals.
-
-These two releases, Automake 1.4 and Autoconf 2.13 make a duo that
-will be used together for years.
-
-@command{automake} is 7228 lines, plus 1591 lines of Makefile
-fragment, 20 macros (some 1.3 macros were finally contributed back to
-Autoconf), 197 test cases, and 51 pages of documentation.
-
-@item 1999-03-27 The @code{user-dep-branch} is created on the CVS repository.
-
-This implements a new dependency tracking schemed that should be
-able to handle automatic dependency tracking using any compiler (not
-just gcc) and any make (not just GNU @command{make}).  In addition,
-the new scheme should be more reliable than the old one, as
-dependencies are generated on the end user's machine.  Alexandre Oliva
-creates depcomp for this purpose.
-
-@xref{Dependency Tracking Evolution}, for more details about the
-evolution of automatic dependency tracking in Automake.
-
-@item 1999-11-21 The @code{user-dep-branch} is merged into the main trunk.
-
-This was a huge problem since we also had patches going in on the
-trunk.  The merge took a long time and was very painful.
-
-@item 2000-05-10
-
-Since September 1999 and until 2003, Akim Demaille will be zealously
-revamping Autoconf.
-
-@quotation
-I think the next release should be called "3.0".@*
-Let's face it: you've basically rewritten autoconf.@*
-Every weekend there are 30 new patches.@*
-I don't see how we could call this "2.15" with a straight face.@*
--- Tom Tromey on @email{autoconf@@gnu.org}
-@end quotation
-
-Actually Akim works like a submarine: he will pile up patches while he
-works off-line during the weekend, and flush them in batch when he
-resurfaces on Monday.
-
-@item 2001-01-24
-
-On this Wednesday, Autoconf 2.49c, the last beta before Autoconf 2.50
-is out, and Akim has to find something to do during his week-end :)
-
-@item 2001-01-28
-
-Akim sends a batch of 14 patches to @email{automake@@gnu.org}.
-
-@quotation
-Aiieeee!  I was dreading the day that the Demaillator turned his
-sights on automake@dots{} and now it has arrived! -- Tom Tromey
-@end quotation
-
-It's only the beginning: in two months he will send 192 patches.  Then
-he would slow down so Tom can catch up and review all this.  Initially
-Tom actually read all these patches, then he probably trustingly
-answered OK to most of them, and finally gave up and let Akim apply
-whatever he wanted.  There was no way to keep up with that patch rate.
-
-@quotation
-Anyway the patch below won't apply since it predates Akim's
-sourcequake; I have yet to figure where the relevant passage has
-been moved :) -- Alexandre Duret-Lutz
-@end quotation
-
-All these patches were sent to and discussed on
-@email{automake@@gnu.org}, so subscribed users were literally drowning in
-technical mails.  Eventually, the @email{automake-patches@@gnu.org}
-mailing list was created in May.
-
-Year after year, Automake had drifted away from its initial design:
-construct @file{Makefile.in} by assembling various @file{Makefile}
-fragments.  In 1.4, lots of @file{Makefile} rules are being emitted at
-various places in the @command{automake} script itself; this does not
-help ensuring a consistent treatment of these rules (for instance
-making sure that user-defined rules override Automake's own rules).
-One of Akim's goal was moving all these hard-coded rules to separate
-@file{Makefile} fragments, so the logic could be centralized in a
-@file{Makefile} fragment processor.
-
-Another significant contribution of Akim is the interface with the
-``trace'' feature of Autoconf.  The way to scan @file{configure.in} at
-this time was to read the file and grep the various macro of interest
-to Automake.  Doing so could break in many unexpected ways; @command{automake}
-could miss some definition (for instance @samp{AC_SUBST([$1], [$2])}
-where the arguments are known only when M4 is run), or conversely it
-could detect some macro that was not expanded (because it is called
-conditionally).  In the CVS version of Autoconf, Akim had implemented
-the @option{--trace} option, which provides accurate information about
-where macros are actually called and with what arguments.  Akim will
-equip Automake with a second @file{configure.in} scanner that uses
-this @option{--trace} interface.  Since it was not sensible to drop the
-Autoconf 2.13 compatibility yet, this experimental scanner was only
-used when an environment variable was set, the traditional
-grep-scanner being still the default.
-
-@item 2001-04-25 Gary V.@tie{}Vaughan releases Libtool 1.4
-
-It has been more than two years since Automake 1.4, CVS Automake has
-suffered lot's of heavy changes and still is not ready for release.
-Libtool 1.4 had to be distributed with a patch against Automake 1.4.
-
-@item 2001-05-08 Automake 1.4-p1
-@itemx 2001-05-24 Automake 1.4-p2
-
-Gary V.@tie{}Vaughan, the principal Libtool maintainer, makes a ``patch
-release'' of Automake:
-
-@quotation
-The main purpose of this release is to have a stable automake
-which is compatible with the latest stable libtool.
-@end quotation
-
-The release also contains obvious fixes for bugs in Automake 1.4,
-some of which were reported almost monthly.
-
-@item 2001-05-21 Akim Demaille releases Autoconf 2.50
-
-@item 2001-06-07 Automake 1.4-p3
-@itemx 2001-06-10 Automake 1.4-p4
-@itemx 2001-07-15 Automake 1.4-p5
-
-Gary continues his patch-release series.  These also add support for
-some new Autoconf 2.50 idioms.  Essentially, Autoconf now advocates
-@file{configure.ac} over @file{configure.in}, and it introduces a new
-syntax for @code{AC_OUTPUT}ing files.
-
-@item 2001-08-23 Automake 1.5
-
-A major and long-awaited release, that comes more than two years after
-1.4.  It brings many changes, among which:
-@itemize
-@item The new dependency tracking scheme that uses @command{depcomp}.
-Aside from the improvement on the dependency tracking itself
-(@pxref{Dependency Tracking Evolution}), this also streamlines the use
-of @command{automake}-generated @file{Makefile.in}s as the @file{Makefile.in}s
-used during development are now the same as those used in
-distributions.  Before that the @file{Makefile.in}s generated for
-maintainers required GNU @command{make} and GCC, they were different
-from the portable @file{Makefile} generated for distribution; this was
-causing some confusion.
-
-@item Support for per-target compilation flags.
-
-@item Support for reference to files in subdirectories in most
-@file{Makefile.am} variables.
-
-@item Introduction of the @code{dist_}, @code{nodist_}, and @code{nobase_}
-prefixes.
-@item Perl 4 support is finally dropped.
-@end itemize
-
-1.5 did break several packages that worked with 1.4.  Enough so that
-Linux distributions could not easily install the new Automake version
-without breaking many of the packages for which they had to run
-@command{automake}.
-
-Some of these breakages were effectively bugs that would eventually be
-fixed in the next release.  However, a lot of damage was caused by
-some changes made deliberately to render Automake stricter on some
-setup we did consider bogus.  For instance, @samp{make distcheck} was
-improved to check that @samp{make uninstall} did remove all the files
-@samp{make install} installed, that @samp{make distclean} did not omit
-some file, and that a VPATH build would work even if the source
-directory was read-only.  Similarly, Automake now rejects multiple
-definitions of the same variable (because that would mix very badly
-with conditionals), and @samp{+=} assignments with no previous
-definition.  Because these changes all occurred suddenly after 1.4 had
-been established for more than two years, it hurt users.
-
-To make matter worse, meanwhile Autoconf (now at version 2.52) was
-facing similar troubles, for similar reasons.
-
-@item 2002-03-05 Automake 1.6
-
-This release introduced versioned installation (@pxref{API
-Versioning}).  This was mainly pushed by Havoc Pennington, taking the
-GNOME source tree as motive: due to incompatibilities between the
-autotools it's impossible for the GNOME packages to switch to Autoconf
-2.53 and Automake 1.5 all at once, so they are currently stuck with
-Autoconf 2.13 and Automake 1.4.
-
-The idea was to call this version @file{automake-1.6}, call all its
-bug-fix versions identically, and switch to @file{automake-1.7} for
-the next release that adds new features or changes some rules.  This
-scheme implies maintaining a bug-fix branch in addition to the
-development trunk, which means more work from the maintainer, but
-providing regular bug-fix releases proved to be really worthwhile.
-
-Like 1.5, 1.6 also introduced a bunch of incompatibilities, intentional or
-not.  Perhaps the more annoying was the dependence on the newly
-released Autoconf 2.53.  Autoconf seemed to have stabilized enough
-since its explosive 2.50 release and included changes required to fix
-some bugs in Automake.  In order to upgrade to Automake 1.6, people
-now had to upgrade Autoconf too; for some packages it was no picnic.
-
-While versioned installation helped people to upgrade, it also
-unfortunately allowed people not to upgrade.  At the time of writing,
-some Linux distributions are shipping packages for Automake 1.4, 1.5,
-1.6, 1.7, 1.8, and 1.9.  Most of these still install 1.4 by default.
-Some distribution also call 1.4 the ``stable'' version, and present
-``1.9'' as the development version; this does not really makes sense
-since 1.9 is way more solid than 1.4.  All this does not help the
-newcomer.
-
-@item 2002-04-11 Automake 1.6.1
-
-1.6, and the upcoming 1.4-p6 release were the last release by Tom.
-This one and those following will be handled by Alexandre
-Duret-Lutz.  Tom is still around, and will be there until about 1.7,
-but his interest into Automake is drifting away towards projects like
-@command{gcj}.
-
-Alexandre has been using Automake since 2000, and started to
-contribute mostly on Akim's incitement (Akim and Alexandre have been
-working in the same room from 1999 to 2002).  In 2001 and 2002 he had
-a lot of free time to enjoy hacking Automake.
-
-@item 2002-06-14 Automake 1.6.2
-
-@item 2002-07-28 Automake 1.6.3
-@itemx 2002-07-28 Automake 1.4-p6
-
-Two releases on the same day.  1.6.3 is a bug-fix release.
-
-Tom Tromey backported the versioned installation mechanism on the 1.4
-branch, so that Automake 1.6.x and Automake 1.4-p6 could be installed
-side by side.  Another request from the GNOME folks.
-
-@item 2002-09-25 Automake 1.7
-
-This release switches to the new @file{configure.ac} scanner Akim
-was experimenting in 1.5.
-
-@item 2002-10-16 Automake 1.7.1
-@itemx 2002-12-06 Automake 1.7.2
-@itemx 2003-02-20 Automake 1.7.3
-@itemx 2003-04-23 Automake 1.7.4
-@itemx 2003-05-18 Automake 1.7.5
-@itemx 2003-07-10 Automake 1.7.6
-@itemx 2003-09-07 Automake 1.7.7
-@itemx 2003-10-07 Automake 1.7.8
-
-Many bug-fix releases.  1.7 lasted because the development version
-(upcoming 1.8) was suffering some major internal revamping.
-
-@item 2003-10-26 Automake on screen
-
-Episode 49, `Repercussions', in the third season of the `Alias' TV
-show is first aired.
-
-Marshall, one of the characters, is working on a computer virus that he
-has to modify before it gets into the wrong hands or something like
-that.  The screenshots you see do not show any program code, they show
-a @file{Makefile.in} @code{generated by automake}...
-
-@item 2003-11-09 Automake 1.7.9
-
-@item 2003-12-10 Automake 1.8
-
-The most striking update is probably that of @command{aclocal}.
-
-@command{aclocal} now uses @code{m4_include} in the produced
-@file{aclocal.m4} when the included macros are already distributed
-with the package (an idiom used in many packages), which reduces code
-duplication.  Many people liked that, but in fact this change was
-really introduced to fix a bug in rebuild rules: @file{Makefile.in}
-must be rebuilt whenever a dependency of @file{configure} changes, but
-all the @file{m4} files included in @file{aclocal.m4} where unknown
-from @command{automake}.  Now @command{automake} can just trace the
-@code{m4_include}s to discover the dependencies.
-
-@command{aclocal} also starts using the @option{--trace} Autoconf option
-in order to discover used macros more accurately.  This will turn out
-to be very tricky (later releases will improve this) as people had
-devised many ways to cope with the limitation of previous
-@command{aclocal} versions, notably using handwritten
-@code{m4_include}s: @command{aclocal} must make sure not to redefine a
-rule that is already included by such statement.
-
-Automake also has seen its guts rewritten.  Although this rewriting
-took a lot of efforts, it is only apparent to the users in that some
-constructions previously disallowed by the implementation now work
-nicely.  Conditionals, Locations, Variable and Rule definitions,
-Options: these items on which Automake works have been rewritten as
-separate Perl modules, and documented.
-
-@itemx 2004-01-11 Automake 1.8.1
-@itemx 2004-01-12 Automake 1.8.2
-@itemx 2004-03-07 Automake 1.8.3
-@itemx 2004-04-25 Automake 1.8.4
-@itemx 2004-05-16 Automake 1.8.5
-
-@item 2004-07-28 Automake 1.9
-
-This release tries to simplify the compilation rules it outputs to
-reduce the size of the Makefile.  The complaint initially come from
-the libgcj developers.  Their @file{Makefile.in} generated with
-Automake 1.4 and custom build rules (1.4 did not support compiled
-Java) is 250KB@.  The one generated by 1.8 was over 9MB@!  1.9 gets it
-down to 1.2MB@.
-
-Aside from this it contains mainly minor changes and bug-fixes.
-
-@itemx 2004-08-11 Automake 1.9.1
-@itemx 2004-09-19 Automake 1.9.2
-
-Automake has ten years.  This chapter of the manual was initially
-written for this occasion.
-
-@itemx 2007-10-29 Automake repository moves to @code{savannah.gnu.org} and uses
-git as primary repository.
-
-@end table
-
-@node Dependency Tracking Evolution
-@section Dependency Tracking in Automake
-
-Over the years Automake has deployed three different dependency
-tracking methods.  Each method, including the current one, has had
-flaws of various sorts.  Here we lay out the different dependency
-tracking methods, their flaws, and their fixes.  We conclude with
-recommendations for tool writers, and by indicating future directions
-for dependency tracking work in Automake.
-
-@menu
-* First Take on Dependencies::  Precomputed dependency tracking
-* Dependencies As Side Effects::  Update at developer compile time
-* Dependencies for the User::   Update at user compile time
-* Techniques for Dependencies::  Alternative approaches
-* Recommendations for Tool Writers::  What tool writers can do to help
-* Future Directions for Dependencies::  Languages Automake does not know
-@end menu
-
-@node First Take on Dependencies
-@subsection First Take on Dependency Tracking
-@unnumberedsubsubsec Description
-
-Our first attempt at automatic dependency tracking was based on the
-method recommended by GNU @command{make}.  (@pxref{Automatic
-Prerequisites, , Generating Prerequisites Automatically, make, The GNU
-make Manual})
-
-This version worked by precomputing dependencies ahead of time.  For
-each source file, it had a special @file{.P} file that held the
-dependencies.  There was a rule to generate a @file{.P} file by
-invoking the compiler appropriately.  All such @file{.P} files were
-included by the @file{Makefile}, thus implicitly becoming dependencies
-of @file{Makefile}.
-
-@unnumberedsubsubsec Bugs
-
-This approach had several critical bugs.
-
-@itemize
-@item
-The code to generate the @file{.P} file relied on @command{gcc}.
-(A limitation, not technically a bug.)
-@item
-The dependency tracking mechanism itself relied on GNU @command{make}.
-(A limitation, not technically a bug.)
-@item
-Because each @file{.P} file was a dependency of @file{Makefile}, this
-meant that dependency tracking was done eagerly by @command{make}.
-For instance, @samp{make clean} would cause all the dependency files
-to be updated, and then immediately removed.  This eagerness also
-caused problems with some configurations; if a certain source file
-could not be compiled on a given architecture for some reason,
-dependency tracking would fail, aborting the entire build.
-@item
-As dependency tracking was done as a pre-pass, compile times were
-doubled--the compiler had to be run twice per source file.
-@item
-@samp{make dist} re-ran @command{automake} to generate a
-@file{Makefile} that did not have automatic dependency tracking (and
-that was thus portable to any version of @command{make}).  In order to
-do this portably, Automake had to scan the dependency files and remove
-any reference that was to a source file not in the distribution.
-This process was error-prone.  Also, if @samp{make dist} was run in an
-environment where some object file had a dependency on a source file
-that was only conditionally created, Automake would generate a
-@file{Makefile} that referred to a file that might not appear in the
-end user's build.  A special, hacky mechanism was required to work
-around this.
-@end itemize
-
-@unnumberedsubsubsec Historical Note
-
-The code generated by Automake is often inspired by the
-@file{Makefile} style of a particular author.  In the case of the first
-implementation of dependency tracking, I believe the impetus and
-inspiration was Jim Meyering.  (I could be mistaken.  If you know
-otherwise feel free to correct me.)
-
-@node Dependencies As Side Effects
-@subsection Dependencies As Side Effects
-@unnumberedsubsubsec Description
-
-The next refinement of Automake's automatic dependency tracking scheme
-was to implement dependencies as side effects of the compilation.
-This was aimed at solving the most commonly reported problems with the
-first approach.  In particular we were most concerned with eliminating
-the weird rebuilding effect associated with make clean.
-
-In this approach, the @file{.P} files were included using the
-@code{-include} command, which let us create these files lazily.  This
-avoided the @samp{make clean} problem.
-
-We only computed dependencies when a file was actually compiled.  This
-avoided the performance penalty associated with scanning each file
-twice.  It also let us avoid the other problems associated with the
-first, eager, implementation.  For instance, dependencies would never
-be generated for a source file that was not compilable on a given
-architecture (because it in fact would never be compiled).
-
-@unnumberedsubsubsec Bugs
-
-@itemize
-@item
-This approach also relied on the existence of @command{gcc} and GNU
-@command{make}.  (A limitation, not technically a bug.)
-@item
-Dependency tracking was still done by the developer, so the problems
-from the first implementation relating to massaging of dependencies by
-@samp{make dist} were still in effect.
-@item
-This implementation suffered from the ``deleted header file'' problem.
-Suppose a lazily-created @file{.P} file includes a dependency on a
-given header file, like this:
-
-@example
-maude.o: maude.c something.h
-@end example
-
-Now suppose that you remove @file{something.h} and update @file{maude.c}
-so that this include is no longer needed.  If you run @command{make},
-you will get an error because there is no way to create
-@file{something.h}.
-
-We fixed this problem in a later release by further massaging the
-output of @command{gcc} to include a dummy dependency for each header
-file.
-@end itemize
-
-@node Dependencies for the User
-@subsection Dependencies for the User
-@unnumberedsubsubsec Description
-
-The bugs associated with @samp{make dist}, over time, became a real
-problem.  Packages using Automake were being built on a large number
-of platforms, and were becoming increasingly complex.  Broken
-dependencies were distributed in ``portable'' @file{Makefile.in}s,
-leading to user complaints.  Also, the requirement for @command{gcc}
-and GNU @command{make} was a constant source of bug reports.  The next
-implementation of dependency tracking aimed to remove these problems.
-
-We realized that the only truly reliable way to automatically track
-dependencies was to do it when the package itself was built.  This
-meant discovering a method portable to any version of make and any
-compiler.  Also, we wanted to preserve what we saw as the best point
-of the second implementation: dependency computation as a side effect
-of compilation.
-
-In the end we found that most modern make implementations support some
-form of include directive.  Also, we wrote a wrapper script that let
-us abstract away differences between dependency tracking methods for
-compilers.  For instance, some compilers cannot generate dependencies
-as a side effect of compilation.  In this case we simply have the
-script run the compiler twice.  Currently our wrapper script
-(@command{depcomp}) knows about twelve different compilers (including
-a "compiler" that simply invokes @command{makedepend} and then the
-real compiler, which is assumed to be a standard Unix-like C compiler
-with no way to do dependency tracking).
-
-@unnumberedsubsubsec Bugs
-
-@itemize
-@item
-Running a wrapper script for each compilation slows down the build.
-@item
-Many users don't really care about precise dependencies.
-@item
-This implementation, like every other automatic dependency tracking
-scheme in common use today (indeed, every one we've ever heard of),
-suffers from the ``duplicated new header'' bug.
-
-This bug occurs because dependency tracking tools, such as the
-compiler, only generate dependencies on the successful opening of a
-file, and not on every probe.
-
-Suppose for instance that the compiler searches three directories for
-a given header, and that the header is found in the third directory.
-If the programmer erroneously adds a header file with the same name to
-the first directory, then a clean rebuild from scratch could fail
-(suppose the new header file is buggy), whereas an incremental rebuild
-will succeed.
-
-What has happened here is that people have a misunderstanding of what
-a dependency is.  Tool writers think a dependency encodes information
-about which files were read by the compiler.  However, a dependency
-must actually encode information about what the compiler tried to do.
-
-This problem is not serious in practice.  Programmers typically do not
-use the same name for a header file twice in a given project.  (At
-least, not in C or C++.  This problem may be more troublesome in
-Java.)  This problem is easy to fix, by modifying dependency
-generators to record every probe, instead of every successful open.
-
-@item
-Since Automake generates dependencies as a side effect of compilation,
-there is a bootstrapping problem when header files are generated by
-running a program.  The problem is that, the first time the build is
-done, there is no way by default to know that the headers are
-required, so make might try to run a compilation for which the headers
-have not yet been built.
-
-This was also a problem in the previous dependency tracking implementation.
-
-The current fix is to use @code{BUILT_SOURCES} to list built headers
-(@pxref{Sources}).  This causes them to be built before any other
-build rules are run.  This is unsatisfactory as a general solution,
-however in practice it seems sufficient for most actual programs.
-@end itemize
-
-This code is used since Automake 1.5.
-
-In GCC 3.0, we managed to convince the maintainers to add special
-command-line options to help Automake more efficiently do its job.  We
-hoped this would let us avoid the use of a wrapper script when
-Automake's automatic dependency tracking was used with @command{gcc}.
-
-Unfortunately, this code doesn't quite do what we want.  In
-particular, it removes the dependency file if the compilation fails;
-we'd prefer that it instead only touch the file in any way if the
-compilation succeeds.
-
-Nevertheless, since Automake 1.7, when a recent @command{gcc} is
-detected at @command{configure} time, we inline the
-dependency-generation code and do not use the @command{depcomp}
-wrapper script.  This makes compilations faster for those using this
-compiler (probably our primary user base).  The counterpart is that
-because we have to encode two compilation rules in @file{Makefile}
-(with or without @command{depcomp}), the produced @file{Makefile}s are
-larger.
-
-@node Techniques for Dependencies
-@subsection Techniques for Computing Dependencies
-
-There are actually several ways for a build tool like Automake to
-cause tools to generate dependencies.
-
-@table @asis
-@item @command{makedepend}
-This was a commonly-used method in the past.  The idea is to run a
-special program over the source and have it generate dependency
-information.  Traditional implementations of @command{makedepend} are
-not completely precise; ordinarily they were conservative and
-discovered too many dependencies.
-@item The tool
-An obvious way to generate dependencies is to simply write the tool so
-that it can generate the information needed by the build tool.  This is
-also the most portable method.  Many compilers have an option to
-generate dependencies.  Unfortunately, not all tools provide such an
-option.
-@item The file system
-It is possible to write a special file system that tracks opens,
-reads, writes, etc, and then feed this information back to the build
-tool.  @command{clearmake} does this.  This is a very powerful
-technique, as it doesn't require cooperation from the
-tool.  Unfortunately it is also very difficult to implement and also
-not practical in the general case.
-@item @code{LD_PRELOAD}
-Rather than use the file system, one could write a special library to
-intercept @code{open} and other syscalls.  This technique is also quite
-powerful, but unfortunately it is not portable enough for use in
-@command{automake}.
-@end table
-
-@node Recommendations for Tool Writers
-@subsection Recommendations for Tool Writers
-
-We think that every compilation tool ought to be able to generate
-dependencies as a side effect of compilation.  Furthermore, at least
-while @command{make}-based tools are nearly universally in use (at
-least in the free software community), the tool itself should generate
-dummy dependencies for header files, to avoid the deleted header file
-bug.  Finally, the tool should generate a dependency for each probe,
-instead of each successful file open, in order to avoid the duplicated
-new header bug.
-
-@node Future Directions for Dependencies
-@subsection Future Directions for Dependencies
-
-Currently, only languages and compilers understood by Automake can
-have dependency tracking enabled.  We would like to see if it is
-practical (and worthwhile) to let this support be extended by the user
-to languages unknown to Automake.
-
-@node Releases
-@section Release Statistics
-
-The following table (inspired by @samp{perlhist(1)}) quantifies the
-evolution of Automake using these metrics:
-
-@table @asis
-@item Date, Rel
-The date and version of the release.
-@item am
-The number of lines of the @command{automake} script.
-@item acl
-The number of lines of the @command{aclocal} script.
-@item pm
-The number of lines of the @command{Perl} supporting modules.
-@item @file{*.am}
-The number of lines of the @file{Makefile} fragments.  The number in
-parentheses is the number of files.
-@item m4
-The number of lines (and files) of Autoconf macros.
-@item doc
-The number of pages of the documentation (the Postscript version).
-@item t
-The number of test cases in the test suite.  Of those, the number in
-parentheses is the number of generated test cases.
-@end table
-
-@multitable {8888-88-88} {8.8-p8} {8888} {8888} {8888} {8888 (88)} {8888 (88)} {888} {888 (88)}
-@headitem Date   @tab Rel    @tab   am @tab acl @tab   pm @tab @file{*.am} @tab m4 @tab doc @tab t
-@item 1994-09-19 @tab CVS    @tab  141 @tab     @tab      @tab  299 (24) @tab           @tab     @tab
-@item 1994-11-05 @tab CVS    @tab  208 @tab     @tab      @tab  332 (28) @tab           @tab     @tab
-@item 1995-11-23 @tab 0.20   @tab  533 @tab     @tab      @tab  458 (35) @tab           @tab   9 @tab
-@item 1995-11-26 @tab 0.21   @tab  613 @tab     @tab      @tab  480 (36) @tab           @tab  11 @tab
-@item 1995-11-28 @tab 0.22   @tab 1116 @tab     @tab      @tab  539 (38) @tab           @tab  12 @tab
-@item 1995-11-29 @tab 0.23   @tab 1240 @tab     @tab      @tab  541 (38) @tab           @tab  12 @tab
-@item 1995-12-08 @tab 0.24   @tab 1462 @tab     @tab      @tab  504 (33) @tab           @tab  14 @tab
-@item 1995-12-10 @tab 0.25   @tab 1513 @tab     @tab      @tab  511 (37) @tab           @tab  15 @tab
-@item 1996-01-03 @tab 0.26   @tab 1706 @tab     @tab      @tab  438 (36) @tab           @tab  16 @tab
-@item 1996-01-03 @tab 0.27   @tab 1706 @tab     @tab      @tab  438 (36) @tab           @tab  16 @tab
-@item 1996-01-13 @tab 0.28   @tab 1964 @tab     @tab      @tab  934 (33) @tab           @tab  16 @tab
-@item 1996-02-07 @tab 0.29   @tab 2299 @tab     @tab      @tab  936 (33) @tab           @tab  17 @tab
-@item 1996-02-24 @tab 0.30   @tab 2544 @tab     @tab      @tab  919 (32) @tab   85 (1)  @tab  20 @tab 9
-@item 1996-03-11 @tab 0.31   @tab 2877 @tab     @tab      @tab  919 (32) @tab   85 (1)  @tab  29 @tab 17
-@item 1996-04-27 @tab 0.32   @tab 3058 @tab     @tab      @tab  921 (31) @tab   85 (1)  @tab  30 @tab 26
-@item 1996-05-18 @tab 0.33   @tab 3110 @tab     @tab      @tab  926 (31) @tab  105 (1)  @tab  30 @tab 35
-@item 1996-05-28 @tab 1.0    @tab 3134 @tab     @tab      @tab  973 (32) @tab  105 (1)  @tab  30 @tab 38
-@item 1997-06-22 @tab 1.2    @tab 6089 @tab 385 @tab      @tab 1294 (36) @tab  592 (20) @tab  37 @tab 126
-@item 1998-04-05 @tab 1.3    @tab 6415 @tab 422 @tab      @tab 1470 (39) @tab  741 (23) @tab  39 @tab 156
-@item 1999-01-14 @tab 1.4    @tab 7240 @tab 426 @tab      @tab 1591 (40) @tab  734 (20) @tab  51 @tab 197
-@item 2001-05-08 @tab 1.4-p1 @tab 7251 @tab 426 @tab      @tab 1591 (40) @tab  734 (20) @tab  51 @tab 197
-@item 2001-05-24 @tab 1.4-p2 @tab 7268 @tab 439 @tab      @tab 1591 (40) @tab  734 (20) @tab  49 @tab 197
-@item 2001-06-07 @tab 1.4-p3 @tab 7312 @tab 439 @tab      @tab 1591 (40) @tab  734 (20) @tab  49 @tab 197
-@item 2001-06-10 @tab 1.4-p4 @tab 7321 @tab 439 @tab      @tab 1591 (40) @tab  734 (20) @tab  49 @tab 198
-@item 2001-07-15 @tab 1.4-p5 @tab 7228 @tab 426 @tab      @tab 1596 (40) @tab  734 (20) @tab  51 @tab 198
-@item 2001-08-23 @tab 1.5    @tab 8016 @tab 475 @tab  600 @tab 2654 (39) @tab 1166 (29) @tab  63 @tab 327
-@item 2002-03-05 @tab 1.6    @tab 8465 @tab 475 @tab 1136 @tab 2732 (39) @tab 1603 (27) @tab  66 @tab 365
-@item 2002-04-11 @tab 1.6.1  @tab 8544 @tab 475 @tab 1136 @tab 2741 (39) @tab 1603 (27) @tab  66 @tab 372
-@item 2002-06-14 @tab 1.6.2  @tab 8575 @tab 475 @tab 1136 @tab 2800 (39) @tab 1609 (27) @tab  67 @tab 386
-@item 2002-07-28 @tab 1.6.3  @tab 8600 @tab 475 @tab 1153 @tab 2809 (39) @tab 1609 (27) @tab  67 @tab 391
-@item 2002-07-28 @tab 1.4-p6 @tab 7332 @tab 455 @tab      @tab 1596 (40) @tab  735 (20) @tab  49 @tab 197
-@item 2002-09-25 @tab 1.7    @tab 9189 @tab 471 @tab 1790 @tab 2965 (39) @tab 1606 (28) @tab  73 @tab 430
-@item 2002-10-16 @tab 1.7.1  @tab 9229 @tab 475 @tab 1790 @tab 2977 (39) @tab 1606 (28) @tab  73 @tab 437
-@item 2002-12-06 @tab 1.7.2  @tab 9334 @tab 475 @tab 1790 @tab 2988 (39) @tab 1606 (28) @tab  77 @tab 445
-@item 2003-02-20 @tab 1.7.3  @tab 9389 @tab 475 @tab 1790 @tab 3023 (39) @tab 1651 (29) @tab  84 @tab 448
-@item 2003-04-23 @tab 1.7.4  @tab 9429 @tab 475 @tab 1790 @tab 3031 (39) @tab 1644 (29) @tab  85 @tab 458
-@item 2003-05-18 @tab 1.7.5  @tab 9429 @tab 475 @tab 1790 @tab 3033 (39) @tab 1645 (29) @tab  85 @tab 459
-@item 2003-07-10 @tab 1.7.6  @tab 9442 @tab 475 @tab 1790 @tab 3033 (39) @tab 1660 (29) @tab  85 @tab 461
-@item 2003-09-07 @tab 1.7.7  @tab 9443 @tab 475 @tab 1790 @tab 3041 (39) @tab 1660 (29) @tab  90 @tab 467
-@item 2003-10-07 @tab 1.7.8  @tab 9444 @tab 475 @tab 1790 @tab 3041 (39) @tab 1660 (29) @tab  90 @tab 468
-@item 2003-11-09 @tab 1.7.9  @tab 9444 @tab 475 @tab 1790 @tab 3048 (39) @tab 1660 (29) @tab  90 @tab 468
-@item 2003-12-10 @tab 1.8    @tab 7171 @tab 585 @tab 7730 @tab 3236 (39) @tab 1666 (31) @tab 104 @tab 521
-@item 2004-01-11 @tab 1.8.1  @tab 7217 @tab 663 @tab 7726 @tab 3287 (39) @tab 1686 (31) @tab 104 @tab 525
-@item 2004-01-12 @tab 1.8.2  @tab 7217 @tab 663 @tab 7726 @tab 3288 (39) @tab 1686 (31) @tab 104 @tab 526
-@item 2004-03-07 @tab 1.8.3  @tab 7214 @tab 686 @tab 7735 @tab 3303 (39) @tab 1695 (31) @tab 111 @tab 530
-@item 2004-04-25 @tab 1.8.4  @tab 7214 @tab 686 @tab 7736 @tab 3310 (39) @tab 1701 (31) @tab 112 @tab 531
-@item 2004-05-16 @tab 1.8.5  @tab 7240 @tab 686 @tab 7736 @tab 3299 (39) @tab 1701 (31) @tab 112 @tab 533
-@item 2004-07-28 @tab 1.9    @tab 7508 @tab 715 @tab 7794 @tab 3352 (40) @tab 1812 (32) @tab 115 @tab 551
-@item 2004-08-11 @tab 1.9.1  @tab 7512 @tab 715 @tab 7794 @tab 3354 (40) @tab 1812 (32) @tab 115 @tab 552
-@item 2004-09-19 @tab 1.9.2  @tab 7512 @tab 715 @tab 7794 @tab 3354 (40) @tab 1812 (32) @tab 132 @tab 554
-@item 2004-11-01 @tab 1.9.3  @tab 7507 @tab 718 @tab 7804 @tab 3354 (40) @tab 1812 (32) @tab 134 @tab 556
-@item 2004-12-18 @tab 1.9.4  @tab 7508 @tab 718 @tab 7856 @tab 3361 (40) @tab 1811 (32) @tab 140 @tab 560
-@item 2005-02-13 @tab 1.9.5  @tab 7523 @tab 719 @tab 7859 @tab 3373 (40) @tab 1453 (32) @tab 142 @tab 562
-@item 2005-07-10 @tab 1.9.6  @tab 7539 @tab 699 @tab 7867 @tab 3400 (40) @tab 1453 (32) @tab 144 @tab 570
-@item 2006-10-15 @tab 1.10   @tab 7859 @tab 1072 @tab 8024 @tab 3512 (40) @tab 1496 (34) @tab 172 @tab 604
-@item 2008-01-19 @tab 1.10.1 @tab 7870 @tab 1089 @tab 8025 @tab 3520 (40) @tab 1499 (34) @tab 173 @tab 617
-@item 2008-11-23 @tab 1.10.2 @tab 7882 @tab 1089 @tab 8027 @tab 3540 (40) @tab 1509 (34) @tab 176 @tab 628
-@item 2009-05-17 @tab 1.11   @tab 8721 @tab 1092 @tab 8289 @tab 4164 (42) @tab 1714 (37) @tab 181 @tab 732 (20)
-@end multitable
-
-
 @c ========================================================== Appendices
 
 @page
@@ -13506,7 +13084,7 @@ parentheses is the number of generated test cases.
 @c  LocalWords:  xs emph FIXME ref vindex pkglibdir pkgincludedir pkgdatadir mt
 @c  LocalWords:  pkg libdir cpio bindir sbindir rmt pax sbin zar zardir acindex
 @c  LocalWords:  HTML htmldir html noinst TEXINFOS nodist nobase strudel CFLAGS
-@c  LocalWords:  libmumble CC YFLAGS ansi knr itemx de fication config url comp
+@c  LocalWords:  libmumble CC YFLAGS itemx de fication config url comp
 @c  LocalWords:  depcomp elisp sh mdate mkinstalldirs mkdir py tex dvi ps pdf
 @c  LocalWords:  ylwrap zardoz INIT gettext acinclude mv FUNCS LIBOBJS LDADD fr
 @c  LocalWords:  uref featureful dnl src LINGUAS es ko nl pl sl sv PROG ISC doc
@@ -13516,10 +13094,10 @@ parentheses is the number of generated test cases.
 @c  LocalWords:  AUX var symlink deps Wno Wnone package's aclocal's distclean
 @c  LocalWords:  ltmain xref LIBSOURCE LIBSOURCES LIBOBJ MEMCMP vs RANLIB CXX
 @c  LocalWords:  LDFLAGS LIBTOOL libtool XTRA LIBS gettext's acdir APIVERSION
-@c  LocalWords:  dirlist noindent usr MULTILIB multilib Multilibs TIOCGWINSZ sc
+@c  LocalWords:  dirlist noindent usr TIOCGWINSZ sc
 @c  LocalWords:  GWINSZ termios SRCDIR tarball bzip LISPDIR lispdir XEmacs CCAS
 @c  LocalWords:  emacsen MicroEmacs CCASFLAGS UX GCJ gcj GCJFLAGS posix DMALLOC
-@c  LocalWords:  dmalloc ldmalloc REGEX regex rx DEPDIR DEP DEFUN aclocaldir fi
+@c  LocalWords:  dmalloc ldmalloc REGEX regex DEPDIR DEP DEFUN aclocaldir fi
 @c  LocalWords:  mymacro myothermacro AMFLAGS autopoint autogen libtoolize yum
 @c  LocalWords:  autoheader README MAKEFLAGS subdir Inetutils sync COND endif
 @c  LocalWords:  Miller's installable includedir inc pkgdata EXEEXT libexec bsd
@@ -13548,7 +13126,7 @@ parentheses is the number of generated test cases.
 @c  LocalWords:  distdir distcheck distcleancheck listfiles distuninstallcheck
 @c  LocalWords:  VPATH tarfile stdout XFAIL DejaGnu dejagnu DEJATOOL runtest ln
 @c  LocalWords:  RUNTESTDEFAULTFLAGS toolchain RUNTESTFLAGS asis readme DVIPS
-@c  LocalWords:  installcheck gzipped tarZ std utils etags mkid multilibbing cd
+@c  LocalWords:  installcheck gzipped tarZ std utils etags mkid cd
 @c  LocalWords:  ARGS taggable ETAGSFLAGS lang ctags CTAGSFLAGS GTAGS gtags idl
 @c  LocalWords:  foocc doit idlC multilibs ABIs cmindex defmac ARG enableval FC
 @c  LocalWords:  MSG xtrue DBG pathchk CYGWIN afile proglink versioned CVS's TE
@@ -13574,4 +13152,4 @@ parentheses is the number of generated test cases.
 @c  LocalWords:  LTALLOCA MALLOC malloc memcmp strdup alloca libcompat xyz DFOO
 @c  LocalWords:  unprefixed buildable preprocessed DBAZ DDATADIR WARNINGCFLAGS
 @c  LocalWords:  LIBFOOCFLAGS LIBFOOLDFLAGS ftable testSubDir obj LIBTOOLFLAGS
-@c  LocalWords:  barexec Pinard's automatize initialize lzip lzma xz
+@c  LocalWords:  barexec Pinard's automatize initialize lzip lzma xz cscope
index aaca979..3e9fd1b 100644 (file)
@@ -44,7 +44,7 @@ Automake::ChannelDefs - channel definitions for Automake and helper functions
   verb ($MESSAGE, [%OPTIONS]);
   switch_warning ($CATEGORY);
   parse_WARNINGS ();
-  parse_warning ($OPTION, $ARGUMENT);
+  parse_warnings ($OPTION, $ARGUMENT);
   Automake::ChannelDefs::set_strictness ($STRICTNESS_NAME);
 
 =head1 DESCRIPTION
@@ -115,6 +115,10 @@ variables (silent by default).
 
 Warnings about non-portable constructs.
 
+=item C<extra-portability>
+
+Extra warnings about non-portable constructs covering obscure tools.
+
 =item C<syntax>
 
 Warnings about weird syntax, unused variables, typos...
@@ -151,6 +155,7 @@ register_channel 'automake', type => 'fatal', backtrace => 1,
   footer => "\nPlease contact <$PACKAGE_BUGREPORT>.",
   uniq_part => UP_NONE, ordered => 0;
 
+register_channel 'extra-portability', type => 'warning', silent => 1;
 register_channel 'gnu', type => 'warning';
 register_channel 'obsolete', type => 'warning', silent => 1;
 register_channel 'override', type => 'warning', silent => 1;
@@ -163,6 +168,10 @@ register_channel 'verb', type => 'debug', silent => 1, uniq_part => UP_NONE,
   ordered => 0;
 register_channel 'note', type => 'debug', silent => 0;
 
+setup_channel_type 'warning', header => 'warning: ';
+setup_channel_type 'error', header => 'error: ';
+setup_channel_type 'fatal', header => 'error: ';
+
 =head2 FUNCTIONS
 
 =over 4
@@ -180,6 +189,7 @@ sub usage ()
   `obsolete'      obsolete features or constructions
   `override'      user redefinitions of Automake rules or variables
   `portability'   portability issues (default in gnu and gnits modes)
+  `extra-portability'  extra portability issues related to obscure tools
   `syntax'        dubious syntactic constructs (default)
   `unsupported'   unsupported or incomplete features (default)
   `all'           all the warnings
@@ -282,8 +292,38 @@ sub switch_warning ($)
   elsif (channel_type ($cat) eq 'warning')
     {
       setup_channel $cat, silent => $has_no;
-      setup_channel 'portability-recursive', silent => $has_no
-        if $cat eq 'portability';
+      #
+      # Handling of portability warnings is trickier.  For relevant tests,
+      # see `dollarvar2', `extra-portability' and `extra-portability3'.
+      #
+      # -Wportability-recursive and -Wno-portability-recursive should not
+      # have any effect on other 'portability' or 'extra-portability'
+      # warnings, so there's no need to handle them separately or ad-hoc.
+      #
+      if ($cat eq 'extra-portability' && ! $has_no) # -Wextra-portability
+        {
+          # -Wextra-portability must enable 'portability' and
+          # 'portability-recursive' warnings.
+          setup_channel 'portability', silent => 0;
+          setup_channel 'portability-recursive', silent => 0;
+        }
+      if ($cat eq 'portability') # -Wportability or -Wno-portability
+        {
+          if ($has_no) # -Wno-portability
+            {
+              # -Wno-portability must disable 'extra-portability' and
+              # 'portability-recursive' warnings.
+              setup_channel 'portability-recursive', silent => 1;
+              setup_channel 'extra-portability', silent => 1;
+            }
+          else # -Wportability
+            {
+              # -Wportability must enable 'portability-recursive'
+              # warnings.  But it should have no influence over the
+              # 'extra-portability' warnings.
+              setup_channel 'portability-recursive', silent => 0;
+            }
+        }
     }
   else
     {
@@ -308,7 +348,7 @@ sub parse_WARNINGS ()
     }
 }
 
-=item C<parse_warning ($OPTION, $ARGUMENT)>
+=item C<parse_warnings ($OPTION, $ARGUMENT)>
 
 Parse the argument of C<--warning=CATEGORY> or C<-WCATEGORY>.
 
@@ -345,6 +385,7 @@ sub set_strictness ($)
       setup_channel 'error-gnu/warn', silent => 0, type => 'error';
       setup_channel 'error-gnits', silent => 1;
       setup_channel 'portability', silent => 0;
+      setup_channel 'extra-portability', silent => 1;
       setup_channel 'gnu', silent => 0;
     }
   elsif ($name eq 'gnits')
@@ -353,6 +394,7 @@ sub set_strictness ($)
       setup_channel 'error-gnu/warn', silent => 0, type => 'error';
       setup_channel 'error-gnits', silent => 0;
       setup_channel 'portability', silent => 0;
+      setup_channel 'extra-portability', silent => 1;
       setup_channel 'gnu', silent => 0;
     }
   elsif ($name eq 'foreign')
@@ -361,11 +403,12 @@ sub set_strictness ($)
       setup_channel 'error-gnu/warn', silent => 0, type => 'warning';
       setup_channel 'error-gnits', silent => 1;
       setup_channel 'portability', silent => 1;
+      setup_channel 'extra-portability', silent => 1;
       setup_channel 'gnu', silent => 1;
     }
   else
     {
-      prog_error "level `$name' not recognized\n";
+      prog_error "level `$name' not recognized";
     }
 }
 
@@ -381,6 +424,8 @@ Written by Alexandre Duret-Lutz E<lt>F<adl@gnu.org>E<gt>.
 
 =cut
 
+1;
+
 ### Setup "GNU" style for perl-mode and cperl-mode.
 ## Local Variables:
 ## perl-indent-level: 2
index 9a2732c..06f0443 100644 (file)
@@ -164,7 +164,7 @@ functions.  The possible keys, with their default value are:
 The type of the channel.  One of C<'debug'>, C<'warning'>, C<'error'>, or
 C<'fatal'>.  Fatal messages abort the program when they are output.
 Error messages update the exit status.  Debug and warning messages are
-harmless, except that warnings can be treated as errors of
+harmless, except that warnings are treated as errors if
 C<$warnings_are_errors> is set.
 
 =item C<exit_code =E<gt> 1>
@@ -204,10 +204,14 @@ C<US_LOCAL>, and C<US_GLOBAL> constants above.
 =item C<header =E<gt> ''>
 
 A string to prepend to each message emitted through this channel.
+With partial messages, only the first part will have C<header>
+prepended.
 
 =item C<footer =E<gt> ''>
 
 A string to append to each message emitted through this channel.
+With partial messages, only the final part will have C<footer>
+appended.
 
 =item C<backtrace =E<gt> 0>
 
@@ -399,20 +403,24 @@ sub _format_sub_message ($$)
   return $leader . join ("\n" . $leader, split ("\n", $message)) . "\n";
 }
 
+# Store partial messages here. (See the 'partial' option.)
+use vars qw ($partial);
+$partial = '';
+
 # _format_message ($LOCATION, $MESSAGE, %OPTIONS)
 # -----------------------------------------------
 # Format the message.  Return a string ready to print.
 sub _format_message ($$%)
 {
   my ($location, $message, %opts) = @_;
-  my $msg = '';
+  my $msg = ($partial eq '' ? $opts{'header'} : '') . $message
+           . ($opts{'partial'} ? '' : $opts{'footer'});
   if (ref $location)
     {
       # If $LOCATION is a reference, assume it's an instance of the
       # Automake::Location class and display contexts.
       my $loc = $location->get || $me;
-      $msg = _format_sub_message ("$loc: ", $opts{'header'}
-                                 . $message . $opts{'footer'});
+      $msg = _format_sub_message ("$loc: ", $msg);
       for my $pair ($location->get_contexts)
        {
          $msg .= _format_sub_message ($pair->[0] . ":   ", $pair->[1]);
@@ -421,8 +429,7 @@ sub _format_message ($$%)
   else
     {
       $location ||= $me;
-      $msg = _format_sub_message ("$location: ", $opts{'header'}
-                                 . $message . $opts{'footer'});
+      $msg = _format_sub_message ("$location: ", $msg);
     }
   return $msg;
 }
@@ -484,10 +491,6 @@ sub _dequeue ($)
 }
 
 
-# Store partial messages here. (See the 'partial' option.)
-use vars qw ($partial);
-$partial = '';
-
 # _print_message ($LOCATION, $MESSAGE, %OPTIONS)
 # ----------------------------------------------
 # Format the message, check duplicates, and print it.
@@ -511,6 +514,9 @@ sub _print_message ($$%)
       $partial = '';
     }
 
+  msg ('note', '', 'warnings are treated as errors', uniq_scope => US_GLOBAL)
+    if ($opts{'type'} eq 'warning' && $warnings_are_errors);
+
   # Check for duplicate message if requested.
   my $to_filter;
   if ($opts{'uniq_part'} ne UP_NONE)
@@ -674,7 +680,7 @@ Override the options of C<$channel> with those specified by C<%options>.
 sub setup_channel ($%)
 {
   my ($name, %opts) = @_;
-  confess "channel $name doesn't exist" unless exists $channels{$name};
+  confess "unknown channel $name" unless exists $channels{$name};
   _merge_options %{$channels{$name}}, %opts;
 }
 
index 2d649f6..5c54b8b 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1997, 2001, 2002, 2003, 2006, 2008  Free Software
+# Copyright (C) 1997, 2001, 2002, 2003, 2006, 2008, 2009  Free Software
 # Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
@@ -180,18 +180,21 @@ sub new ($;@)
   };
   bless $self, $class;
 
-  # Accept strings like "FOO BAR" as shorthand for ("FOO", "BAR").
-  @conds = map { split (' ', $_) } @conds;
-
   for my $cond (@conds)
     {
-      next if $cond eq 'TRUE';
-
       # Catch some common programming errors:
       # - A Condition passed to new
       confess "`$cond' is a reference, expected a string" if ref $cond;
       # - A Condition passed as a string to new
       confess "`$cond' does not look like a condition" if $cond =~ /::/;
+    }
+
+  # Accept strings like "FOO BAR" as shorthand for ("FOO", "BAR").
+  @conds = map { split (' ', $_) } @conds;
+
+  for my $cond (@conds)
+    {
+      next if $cond eq 'TRUE';
 
       # Detect cases when @conds can be simplified to FALSE.
       if (($cond eq 'FALSE' && $#conds > 0)
@@ -250,7 +253,7 @@ except those of C<$minuscond>.  This is the opposite of C<merge>.
 sub strip ($$)
 {
   my ($self, $minus) = @_;
-  my @res = grep { not $minus->has ($_) } $self->conds;
+  my @res = grep { not $minus->_has ($_) } $self->conds;
   return new Automake::Condition @res;
 }
 
@@ -274,7 +277,7 @@ sub conds ($ )
 }
 
 # Undocumented, shouldn't be needed outside of this class.
-sub has ($$)
+sub _has ($$)
 {
   my ($self, $cond) = @_;
   return exists $self->{'hash'}{$cond};
@@ -289,7 +292,7 @@ Return 1 iff this condition is always false.
 sub false ($ )
 {
   my ($self) = @_;
-  return $self->has ('FALSE');
+  return $self->_has ('FALSE');
 }
 
 =item C<$cond-E<gt>true>
@@ -426,7 +429,7 @@ sub true_when ($$)
   # exists in $WHEN.
   foreach my $cond ($self->conds)
     {
-      return 0 unless $when->has ($cond);
+      return 0 unless $when->_has ($cond);
     }
   return 1;
 }
@@ -518,6 +521,8 @@ sub multiply ($@)
   return (values %res);
 }
 
+=back
+
 =head2 Other helper functions
 
 =over 4
@@ -615,6 +620,8 @@ sub conditional_negate ($)
   return $cond;
 }
 
+=back
+
 =head1 SEE ALSO
 
 L<Automake::DisjConditions>.
index e2bebef..3574035 100644 (file)
@@ -1,4 +1,5 @@
-# Copyright (C) 2003, 2005, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2006, 2009, 2010 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
@@ -49,6 +50,20 @@ Automake::Configure_ac - Locate configure.ac or configure.in.
   my $file_name = find_configure_ac ($dir);
   my $file_name = require_configure_ac ($dir);
 
+=over 4
+
+=back
+
+=head2 Functions
+
+=over 4
+
+=item C<$configure_ac = find_configure_ac ([$directory])>
+
+Find a F<configure.ac> or F<configure.in> file in C<$directory>,
+defaulting to the current directory.  Complain if both files are present.
+Return the name of the file found, or the former if neither is present.
+
 =cut
 
 sub find_configure_ac (;@)
@@ -66,7 +81,7 @@ sub find_configure_ac (;@)
        {
          msg ('unsupported',
               "`$configure_ac' and `$configure_in' both present.\n"
-              . "proceeding with `$configure_ac'.");
+              . "proceeding with `$configure_ac'");
        }
       return $configure_ac
     }
@@ -78,6 +93,12 @@ sub find_configure_ac (;@)
 }
 
 
+=item C<$configure_ac = require_configure_ac ([$directory])>
+
+Like C<find_configure_ac>, but fail if neither is present.
+
+=cut
+
 sub require_configure_ac (;$)
 {
   my $res = find_configure_ac (@_);
index 613dc80..1dc81dc 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2008, 2009  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
@@ -50,7 +50,7 @@ Automake::Location - a class for location tracking, with a stack of contexts
       ...
     }
 
-  # Pop a context, and reset the location from the previous context.
+  # Pop a context, and reset the location to the previous context.
   $where->pop_context;
 
   # Clone a Location.  Use this when storing the state of a location
@@ -84,6 +84,16 @@ You can pass a C<Location> to C<Automake::Channels::msg>.
 
 =cut
 
+=head2 Methods
+
+=over
+
+=item C<$where = new Automake::Location ([$position])>
+
+Create and return a new Location object.
+
+=cut
+
 sub new ($;$)
 {
   my ($class, $position) = @_;
@@ -95,18 +105,36 @@ sub new ($;$)
   return $self;
 }
 
+=item C<$location-E<gt>set ($position)>
+
+Change the location to be C<$position>.
+
+=cut
+
 sub set ($$)
 {
   my ($self, $position) = @_;
   $self->{'position'} = $position;
 }
 
+=item C<$location-E<gt>get>
+
+Get the location (without context).
+
+=cut
+
 sub get ($)
 {
   my ($self) = @_;
   return $self->{'position'};
 }
 
+=item C<$location-E<gt>push_context ($context)>
+
+Push a context to the location.
+
+=cut
+
 sub push_context ($$)
 {
   my ($self, $context) = @_;
@@ -114,6 +142,12 @@ sub push_context ($$)
   $self->set (undef);
 }
 
+=item C<$where = $location-E<gt>pop_context ($context)>
+
+Pop a context, and reset the location to the previous context.
+
+=cut
+
 sub pop_context ($)
 {
   my ($self) = @_;
@@ -122,12 +156,25 @@ sub pop_context ($)
   return @{$pair};
 }
 
+=item C<@contexts = $location-E<gt>get_contexts>
+
+Return the array of contexts.
+
+=cut
+
 sub get_contexts ($)
 {
   my ($self) = @_;
   return @{$self->{'contexts'}};
 }
 
+=item C<$location = $location-E<gt>clone>
+
+Clone a Location.  Use this when storing the state of a location
+that would otherwise be modified.
+
+=cut
+
 sub clone ($)
 {
   my ($self) = @_;
@@ -140,6 +187,12 @@ sub clone ($)
   return $other;
 }
 
+=item C<$res = $location-E<gt>dump>
+
+Print the location and the stack of context (for debugging).
+
+=cut
+
 sub dump ($)
 {
   my ($self) = @_;
@@ -152,6 +205,13 @@ sub dump ($)
   return $res;
 }
 
+=item C<@array = $location-E<gt>serialize>
+
+Serialize a Location object (for passing through a thread queue,
+for example).
+
+=cut
+
 sub serialize ($)
 {
   my ($self) = @_;
@@ -166,6 +226,12 @@ sub serialize ($)
   return @serial;
 }
 
+=item C<new Automake::Location::deserialize ($queue)>
+
+De-serialize: recreate a Location object from a queue.
+
+=cut
+
 sub deserialize ($)
 {
   my ($queue) = @_;
@@ -179,6 +245,8 @@ sub deserialize ($)
   return $self;
 }
 
+=back
+
 =head1 SEE ALSO
 
 L<Automake::Channels>
index e3d23ae..75a7392 100644 (file)
@@ -71,11 +71,16 @@ F<Makefile.am>s.
 
 =cut
 
-# Values are the Automake::Location of the definition, except
-# for 'ansi2knr' whose value is a pair [filename, Location].
+# Values are the Automake::Location of the definition.
 use vars '%_options';          # From AUTOMAKE_OPTIONS
 use vars '%_global_options';   # from AM_INIT_AUTOMAKE or the command line.
 
+# Whether process_option_list has already been called for the current
+# Makefile.am.
+use vars '$_options_processed';
+# Whether process_global_option_list has already been called.
+use vars '$_global_options_processed';
+
 =head2 Constants
 
 =over 4
@@ -135,6 +140,7 @@ previous F<Makefile.am>.
 
 sub reset ()
 {
+  $_options_processed = 0;
   %_options = %_global_options;
   # The first time we are run,
   # remember the current setting as the default.
@@ -222,29 +228,39 @@ sub unset_global_option ($)
 }
 
 
-=item C<process_option_list ($where, @options)>
+=item C<process_option_list (@list)>
+
+=item C<process_global_option_list (@list)>
 
-=item C<process_global_option_list ($where, @options)>
+Process Automake's option lists.  C<@list> should be a list of hash
+references with keys C<option> and C<where>, where C<option> is an
+option as they occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>,
+and C<where> is the location where that option occurred.
 
-Process Automake's option lists.  C<@options> should be a list of
-words, as they occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>.
+These functions should be called at most once for each set of options
+having the same precedence; i.e., do not call it twice for two options
+from C<AM_INIT_AUTOMAKE>.
 
 Return 1 on error, 0 otherwise.
 
 =cut
 
 # $BOOL
-# _process_option_list (\%OPTIONS, $WHERE, @OPTIONS)
-# --------------------------------------------------
-# Process a list of options.  Return 1 on error, 0 otherwise.
-# \%OPTIONS is the hash to fill with options data, $WHERE is
-# the location where @OPTIONS occurred.
-sub _process_option_list (\%$@)
+# _process_option_list (\%OPTIONS, @LIST)
+# ------------------------------------------
+# Process a list of options.  \%OPTIONS is the hash to fill with options
+# data.  @LIST is a list of options as get passed to public subroutines
+# process_option_list() and process_global_option_list() (see POD
+# documentation above).
+sub _process_option_list (\%@)
 {
-  my ($options, $where, @list) = @_;
+  my ($options, @list) = @_;
+  my @warnings = ();
 
-  foreach (@list)
+  foreach my $h (@list)
     {
+      local $_ = $h->{'option'};
+      my $where = $h->{'where'};
       $options->{$_} = $where;
       if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign')
        {
@@ -252,22 +268,14 @@ sub _process_option_list (\%$@)
        }
       elsif (/^(.*\/)?ansi2knr$/)
        {
-          # This feature is deprecated, will be removed in the next
-          # Automake major release.
-          msg 'obsolete', $where,
-              "automatic de-ANSI-fication support is deprecated\n";
-         # An option like "../lib/ansi2knr" is allowed.  With no
-         # path prefix, we assume the required programs are in this
-         # directory.  We save the actual option for later.
-         $options->{'ansi2knr'} = [$_, $where];
+          # Obsolete (and now removed) de-ANSI-fication support.
+          error ($where,
+                 "automatic de-ANSI-fication support has been removed");
        }
       elsif ($_ eq 'dist-lzma')
         {
-          # Creation of distribution tarball compressed with lzma is
-          # deprecated, will be removed in the next major release.
-          msg 'obsolete', $where,
-              "lzma compression is deprecated; use `dist-xz' " .
-              "or `dist-lzip' instead\n";
+          error ($where, "support for lzma-compressed distribution " .
+                         "archives has been removed");
         }
       elsif ($_ eq 'no-installman' || $_ eq 'no-installinfo'
             || $_ eq 'dist-shar' || $_ eq 'dist-zip'
@@ -325,11 +333,8 @@ sub _process_option_list (\%$@)
        }
       elsif (/^(?:--warnings=|-W)(.*)$/)
        {
-         foreach my $cat (split (',', $1))
-           {
-             msg 'unsupported', $where, "unknown warning category `$cat'"
-               if switch_warning $cat;
-           }
+         my @w = map { { cat => $_, loc => $where} } split (',', $1);
+         push @warnings, @w;
        }
       else
        {
@@ -338,19 +343,32 @@ sub _process_option_list (\%$@)
          return 1;
        }
     }
+  # We process warnings here, so that any explicitly-given warning setting
+  # will take precedence over warning settings defined implicitly by the
+  # strictness.
+  foreach my $w (@warnings)
+    {
+      msg 'unsupported', $w->{'loc'},
+          "unknown warning category `$w->{'cat'}'"
+       if switch_warning $w->{cat};
+    }
   return 0;
 }
 
-sub process_option_list ($@)
+sub process_option_list (@)
 {
-  my ($where, @list) = @_;
-  return _process_option_list (%_options, $where, @list);
+  prog_error "local options already processed"
+    if $_options_processed;
+  return _process_option_list (%_options, @_);
+  $_options_processed = 1;
 }
 
-sub process_global_option_list ($@)
+sub process_global_option_list (@)
 {
-  my ($where, @list) = @_;
-  return _process_option_list (%_global_options, $where, @list);
+  prog_error "global options already processed"
+    if $_global_options_processed;
+  return _process_option_list (%_global_options, @_);
+  $_global_options_processed = 1;
 }
 
 =item C<set_strictness ($name)>
@@ -381,7 +399,7 @@ sub set_strictness ($)
     }
   else
     {
-      prog_error "level `$strictness_name' not recognized\n";
+      prog_error "level `$strictness_name' not recognized";
     }
 }
 
index 3184b24..6d437ed 100644 (file)
@@ -616,7 +616,8 @@ sub define ($$$$$)
          msg ('obsolete', $tdef->location,
               "deprecated feature: target `$noexe' overrides "
               . "`$noexe\$(EXEEXT)'\n"
-              . "change your target to read `$noexe\$(EXEEXT)'");
+              . "change your target to read `$noexe\$(EXEEXT)'",
+              partial => 1);
          msg ('obsolete', $where, "target `$target' was defined here");
        }
       # Don't `return ()' now, as this might hide target clashes
@@ -658,7 +659,7 @@ sub define ($$$$$)
                  ## is legitimate. (This is phony.test.)
 
                  # msg ('syntax', $where,
-                 #      "redefinition of `$target'$condmsg...", partial => 1);
+                 #      "redefinition of `$target'$condmsg ...", partial => 1);
                  # msg_cond_rule ('syntax', $cond, $target,
                  #                "... `$target' previously defined here");
                }
@@ -694,7 +695,7 @@ sub define ($$$$$)
 
              msg_cond_rule ('override', $cond, $target,
                             "user target `$target' defined here"
-                            . "$condmsg...", partial => 1);
+                            . "$condmsg ...", partial => 1);
              msg ('override', $where,
                   "... overrides Automake target `$oldname' defined here",
                   partial => $hint);
@@ -718,7 +719,7 @@ sub define ($$$$$)
              my $oldsource = $tdef->source;
              return () if $source eq $oldsource && $target eq $oldname;
 
-             msg ('syntax', $where, "redefinition of `$target'$condmsg...",
+             msg ('syntax', $where, "redefinition of `$target'$condmsg ...",
                   partial => 1);
              msg_cond_rule ('syntax', $cond, $target,
                             "... `$oldname' previously defined here");
@@ -726,7 +727,7 @@ sub define ($$$$$)
            }
        }
       # Never reached.
-      prog_error ("Unreachable place reached.");
+      prog_error ("unreachable place reached");
     }
 
   # Conditions for which the rule should be defined.
@@ -818,7 +819,7 @@ sub define ($$$$$)
   # definitions of multiple inference rules.  It's also
   # disallowed to mix plain targets with inference rules.
   msg ('portability', $where,
-       "Inference rules can have only one target before the colon (POSIX).")
+       "inference rules can have only one target before the colon (POSIX)")
     if $inference_rule_count > 0 && $target_count > 1;
 
   return @conds;
index 20bc106..3bd506d 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2009  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
@@ -36,6 +36,7 @@ Automake::RuleDef - a class for rule definitions
 =head1 DESCRIPTION
 
 This class gathers data related to one Makefile-rule definition.
+It shouldn't be needed outside of F<Rule.pm>.
 
 =head2 Constants
 
@@ -50,6 +51,20 @@ Possible owners for rules.
 use constant RULE_AUTOMAKE => 0; # Rule defined by Automake.
 use constant RULE_USER => 1;     # Rule defined in the user's Makefile.am.
 
+=back
+
+=head2 Methods
+
+=over 4
+
+=item C<new Automake::RuleDef ($name, $comment, $location, $owner, $source)>
+
+Create a new rule definition with target C<$name>, with associated comment
+C<$comment>, Location C<$location> and owner C<$owner>, defined in file
+C<$source>.
+
+=cut
+
 sub new ($$$$$)
 {
   my ($class, $name, $comment, $location, $owner, $source) = @_;
@@ -60,12 +75,24 @@ sub new ($$$$$)
   return $self;
 }
 
+=item C<$source = $rule-E<gt>source>
+
+Return the source of the rule.
+
+=cut
+
 sub source ($)
 {
   my ($self) = @_;
   return $self->{'source'};
 }
 
+=item C<$name = $rule-E<gt>name>
+
+Return the name of the rule.
+
+=cut
+
 sub name ($)
 {
   my ($self) = @_;
index 568c82a..033aa05 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2004, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2006, 2009  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
@@ -195,6 +195,8 @@ sub append ($$$)
 
 =item C<$def-E<gt>value>
 
+=item C<$def-E<gt>raw_value>
+
 =item C<$def-E<gt>type>
 
 =item C<$def-E<gt>pretty>
index 8f712bd..6835cab 100644 (file)
@@ -156,7 +156,6 @@ my %_gen_varname_n = ();
 # Macros accessible via aclocal.
 my %_am_macro_for_var =
   (
-   ANSI2KNR => 'AM_C_PROTOTYPES',
    CCAS => 'AM_PROG_AS',
    CCASFLAGS => 'AM_PROG_AS',
    EMACS => 'AM_PATH_LISPDIR',
@@ -169,7 +168,6 @@ my %_am_macro_for_var =
    pyexecdir => 'AM_PATH_PYTHON',
    PYTHON => 'AM_PATH_PYTHON',
    pythondir => 'AM_PATH_PYTHON',
-   U => 'AM_C_PROTOTYPES',
    );
 
 # Macros shipped with Autoconf.
@@ -470,7 +468,7 @@ sub _check_ambiguous_condition ($$$)
   # We allow silent variables to be overridden silently,
   # by either silent or non-silent variables.
   my $def = $self->def ($ambig_cond);
-  if ($message && !($def && $def->pretty == VAR_SILENT))
+  if ($message && $def->pretty != VAR_SILENT)
     {
       msg 'syntax', $where, "$message ...", partial => 1;
       msg_var ('syntax', $var, "... `$var' previously defined here");
@@ -881,10 +879,10 @@ sub define ($$$$$$$$)
        {
          error ($def->location,
                 "Automake variable `$var' was set with `"
-                . $def->type . "=' here...", partial => 1);
+                . $def->type . "=' here ...", partial => 1);
          error ($where, "... and is now set with `$type=' here.");
          prog_error ("Automake variable assignments should be consistently\n"
-                     . "defined with the same sign.");
+                     . "defined with the same sign");
        }
 
       # If Automake tries to override a value specified by the user,
@@ -896,7 +894,7 @@ sub define ($$$$$$$$)
              my $condmsg = ($cond == TRUE
                             ? '' : (" in condition `" . $cond->human . "'"));
              msg_cond_var ('override', $cond, $var,
-                           "user variable `$var' defined here$condmsg...",
+                           "user variable `$var' defined here$condmsg ...",
                            partial => 1);
              msg ('override', $where,
                   "... overrides Automake variable `$var' defined here");
@@ -996,10 +994,10 @@ sub define ($$$$$$$$)
          if (! $undef_cond->false)
            {
              error ($where,
-                    "Cannot apply `+=' because `$var' is not defined "
+                    "cannot apply `+=' because `$var' is not defined "
                     . "in\nthe following conditions:\n  "
                     . join ("\n  ", map { $_->human } $undef_cond->conds)
-                    . "\nEither define `$var' in these conditions,"
+                    . "\neither define `$var' in these conditions,"
                     . " or use\n`+=' in the same conditions as"
                     . " the definitions.");
            }
@@ -1078,7 +1076,7 @@ For debugging.
 
 sub variables_dump ()
 {
-  my $text = "All variables:\n{\n";
+  my $text = "all variables:\n{\n";
   foreach my $var (sort { $a->name cmp $b->name } variables)
     {
       $text .= $var->dump;
index 66213d1..59b3e5a 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2009  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
@@ -48,10 +48,10 @@ maximum length allowed.  (Ticket #17141, fixed in Perl 5.8.0.)
 
 =cut
 
-# tab_length ($TXT)
-# -----------------
+# _tab_length ($TXT)
+# ------------------
 # Compute the length of TXT, counting tab characters as 8 characters.
-sub tab_length($)
+sub _tab_length($)
 {
   my ($txt) = @_;
   my $len = length ($txt);
@@ -78,16 +78,16 @@ sub wrap($$$$@)
   my ($head, $fill, $eol, $max_len, @values) = @_;
 
   my $result = $head;
-  my $column = tab_length ($head);
+  my $column = _tab_length ($head);
 
-  my $fill_len = tab_length ($fill);
-  my $eol_len = tab_length ($eol);
+  my $fill_len = _tab_length ($fill);
+  my $eol_len = _tab_length ($eol);
 
   my $not_first_word = 0;
 
   foreach (@values)
     {
-      my $len = tab_length ($_);
+      my $len = _tab_length ($_);
 
       # See if the new variable fits on this line.
       # (The + 1 is for the space we add in front of the value.).
index 46483e6..b80025d 100644 (file)
@@ -1,5 +1,5 @@
-# Copyright (C) 2001, 2003, 2004, 2006, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004, 2006, 2008, 2009, 2010, 2012 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
@@ -68,18 +68,6 @@ methods C<close>, C<lock> (corresponding to C<flock>), C<new>,
 C<open>, C<seek>, and C<truncate>.  It also overrides the C<getline>
 and C<getlines> methods to translate C<\r\n> to C<\n>.
 
-=head1 SEE ALSO
-
-L<perlfunc>,
-L<perlop/"I/O Operators">,
-L<IO::File>
-L<IO::Handle>
-L<IO::Seekable>
-
-=head1 HISTORY
-
-Derived from IO::File.pm by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.
-
 =cut
 
 require 5.000;
@@ -110,12 +98,16 @@ eval {
   push (@EXPORT, @O);
 };
 
-# Used in croak error messages.
-my $me = basename ($0);
+=head2 Methods
+
+=over
+
+=item C<$fh = new Automake::XFile ([$expr, ...]>
 
-################################################
-## Constructor
-##
+Constructor a new XFile object.  Additional arguments
+are passed to C<open>, if any.
+
+=cut
 
 sub new
 {
@@ -129,9 +121,12 @@ sub new
   $fh;
 }
 
-################################################
-## Open
-##
+=item C<$fh-E<gt>open ([$file, ...])>
+
+Open a file, passing C<$file> and further arguments to C<IO::File::open>.
+Die if opening fails.  Store the name of the file.  Use binmode for writing.
+
+=cut
 
 sub open
 {
@@ -156,9 +151,11 @@ sub open
   binmode $fh if $file =~ /^\s*>/;
 }
 
-################################################
-## Close
-##
+=item C<$fh-E<gt>close>
+
+Close the file, handling errors.
+
+=cut
 
 sub close
 {
@@ -172,12 +169,15 @@ sub close
     }
 }
 
-################################################
-## Getline
-##
+=item C<$line = $fh-E<gt>getline>
+
+Read and return a line from the file.  Ensure C<\r\n> is translated to
+C<\n> on input files.
+
+=cut
 
-# Some Win32/perl installations fail to translate \r\n to \n on input
-# so we do that here.
+# Some native Windows/perl installations fail to translate \r\n to \n on
+# input so we do that here.
 sub getline
 {
   local $_ = $_[0]->SUPER::getline;
@@ -187,9 +187,11 @@ sub getline
   return $_;
 }
 
-################################################
-## Getlines
-##
+=item C<@lines = $fh-E<gt>getlines>
+
+Slurp lines from the files.
+
+=cut
 
 sub getlines
 {
@@ -199,9 +201,11 @@ sub getlines
   return @res;
 }
 
-################################################
-## Name
-##
+=item C<$name = $fh-E<gt>name>
+
+Return the name of the file.
+
+=cut
 
 sub name
 {
@@ -209,9 +213,13 @@ sub name
   return ${*$fh}{'autom4te_xfile_file'};
 }
 
-################################################
-## Lock
-##
+=item C<$fh-E<gt>lock>
+
+Lock the file using C<flock>.  If locking fails for reasons other than
+C<flock> being unsupported, then error out if C<$ENV{'MAKEFLAGS'}> indicates
+that we are spawned from a parallel C<make>.
+
+=cut
 
 sub lock
 {
@@ -243,9 +251,11 @@ sub lock
     }
 }
 
-################################################
-## Seek
-##
+=item C<$fh-E<gt>seek ($position, [$whence])>
+
+Seek file to C<$position>.  Die if seeking fails.
+
+=cut
 
 sub seek
 {
@@ -254,13 +264,15 @@ sub seek
   if (!seek ($fh, $_[0], $_[1]))
     {
       my $file = $fh->name;
-      fatal "$me: cannot rewind $file with @_: $!";
+      fatal "cannot rewind $file with @_: $!";
     }
 }
 
-################################################
-## Truncate
-##
+=item C<$fh-E<gt>truncate ($len)>
+
+Truncate the file to length C<$len>.  Die on failure.
+
+=cut
 
 sub truncate
 {
@@ -272,6 +284,22 @@ sub truncate
     }
 }
 
+=back
+
+=head1 SEE ALSO
+
+L<perlfunc>,
+L<perlop/"I/O Operators">,
+L<IO::File>
+L<IO::Handle>
+L<IO::Seekable>
+
+=head1 HISTORY
+
+Derived from IO::File.pm by Akim Demaille E<lt>F<akim@freefriends.org>E<gt>.
+
+=cut
+
 1;
 
 ### Setup "GNU" style for perl-mode and cperl-mode.
index 9ef9cc7..d9197d5 100644 (file)
@@ -2,7 +2,8 @@
 
 ## Makefile for Automake lib.
 
-# Copyright (C) 2001, 2003, 2004, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004, 2009, 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
 
 SUBDIRS = Automake am
 
-dist_pkgvdata_DATA = COPYING INSTALL texinfo.tex ansi2knr.c ansi2knr.1 \
-  config-ml.in
+dist_pkgvdata_DATA = \
+  COPYING \
+  INSTALL \
+  texinfo.tex
 
 ## These must all be executable when installed.  However, if we use
 ## _SCRIPTS, then the program transform will be applied, which is not
 ## what we want.  So we make them executable by hand.
-scriptdir = $(pkgvdatadir)
-dist_script_DATA = config.guess config.sub install-sh mdate-sh missing \
-  mkinstalldirs elisp-comp ylwrap acinstall depcomp compile py-compile \
-  symlink-tree
+dist_script_DATA = \
+  config.guess \
+  config.sub \
+  install-sh \
+  mdate-sh \
+  missing \
+  mkinstalldirs \
+  elisp-comp \
+  ylwrap \
+  acinstall \
+  depcomp \
+  compile \
+  py-compile \
+  ar-lib \
+  test-driver \
+  tap-driver.sh \
+  tap-driver.pl
 
 EXTRA_DIST = gnupload gitlog-to-changelog update-copyright
 
 install-data-hook:
        @$(POST_INSTALL)
        @for prog in $(dist_script_DATA); do \
-         echo " chmod +x $(DESTDIR)$(scriptdir)/$$prog"; \
-         chmod +x $(DESTDIR)$(scriptdir)/$$prog; \
+         echo " chmod +x '$(DESTDIR)$(scriptdir)/$$prog'"; \
+         chmod +x "$(DESTDIR)$(scriptdir)/$$prog"; \
        done
 
 ## `test -x' is not portable.  So we use Perl instead.  If Perl
index 7b37989..251df05 100644 (file)
@@ -3,7 +3,7 @@
 ## Makefile for Automake lib/am.
 
 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004, 2008,
-# 2009, 2012 Free Software Foundation, Inc.
+# 2009, 2011, 2012 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-amdir = $(pkgvdatadir)/am
-
 dist_am_DATA = \
-ansi2knr.am \
 check.am \
-check-html.am \
 check2.am \
 clean-hdr.am \
 clean.am \
@@ -50,7 +46,6 @@ ltlib.am \
 ltlibrary.am \
 mans-vars.am \
 mans.am \
-multilib.am \
 program.am \
 progs.am \
 python.am \
diff --git a/lib/am/ansi2knr.am b/lib/am/ansi2knr.am
deleted file mode 100644 (file)
index c4e1990..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 2001, 2003, 2008, 2009
-## 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/>.
-
-## %ANSI2KNR-DIR% is the directory where ansi2knr is, `' if
-## is the current directory.
-
-
-## ---------- ##
-## ansi2knr.  ##
-## ---------- ##
-
-if %?ANSI2KNR-DIR%
-
-ANSI2KNR = %ANSI2KNR-DIR%/ansi2knr
-%ANSI2KNR-DIR%/ansi2knr:
-       $(am__cd) %ANSI2KNR-DIR% && $(MAKE) $(AM_MAKEFLAGS) ./ansi2knr
-.MAKE: %ANSI2KNR-DIR%/ansi2knr
-
-else !%?ANSI2KNR-DIR%
-
-## Substitution from AM_C_PROTOTYPES.  This makes it be built only when
-## necessary.
-ANSI2KNR = @ANSI2KNR@
-./ansi2knr: ansi2knr.$(OBJEXT)
-       $(LINK) ansi2knr.$(OBJEXT) $(LIBS)
-ansi2knr.$(OBJEXT): $(CONFIG_HEADER)
-
-endif !%?ANSI2KNR-DIR%
-
-
-## ------------------- ##
-## Cleaning ansi2knr.  ##
-## ------------------- ##
-
-
-if !%?ANSI2KNR-DIR%
-.PHONY: clean-krextra
-
-clean-am: clean-krextra
-clean-krextra:
-## Why `clean' and not somewhere else?  Not `mostlyclean' because
-## people usually don't want to recompile this file.  And not
-## `distclean' because of our informal rule: if `make' built it, then
-## `clean' should delete it; if `configure' built it, then `distclean'
-## should remove it (and if the maintainer built it, then
-## maintainer-clean should remove it).
-       -rm -f ansi2knr
-endif !%?ANSI2KNR-DIR%
-
-
-
-## --------------------------------- ##
-## Cleaning the output of ansi2knr.  ##
-## --------------------------------- ##
-
-.PHONY: mostlyclean-kr
-
-mostlyclean-am: mostlyclean-kr
-mostlyclean-kr:
-## Only delete *_.c when ansi2knr is actually in use, so as to avoid
-## deleting sources that happen to end in "_" after being truncated on a DOS
-## 8.3 filesystem with srcdir==builddir.
-       -test "$U" = "" || rm -f *_.c
index 7e2e771..bd9f5c2 100644 (file)
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+am__tty_colors_dummy = \
+  mgn= red= grn= lgn= blu= brg= std=; \
+  am__color_tests=no
 if %?COLOR%
 # If stdout is a non-dumb tty, use colors.  If test -t is not supported,
 # then this fails; a conservative approach.  Of course do not redirect
 # stdout here, just stderr.
 am__tty_colors = \
-red=; grn=; lgn=; blu=; std=; \
+$(am__tty_colors_dummy); \
 test "X$(AM_COLOR_TESTS)" != Xno \
 && test "X$$TERM" != Xdumb \
 && { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
 && { \
+  am__color_tests=yes; \
   red='\e[0;31m'; \
   grn='\e[0;32m'; \
   lgn='\e[1;32m'; \
   blu='\e[1;34m'; \
+  mgn='\e[0;35m'; \
+  brg='\e[1m'; \
   std='\e[m'; \
 }
 else !%?COLOR%
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
+am__tty_colors = $(am__tty_colors_dummy)
 endif !%?COLOR%
 
 .PHONY: check-TESTS
@@ -44,202 +49,275 @@ include inst-vars.am
 
 ## New parallel test driver.
 ##
-## This code is adapted from check.mk which was originally
-## written at EPITA/LRDE, further developed at Gostai, then made
-## its way from GNU coreutils to end up, largely rewritten, in
-## Automake.
-##
-## It provides special support for "unit tests", that is to say,
-## tests that (once run) no longer need to be re-compiled and
-## re-run at each "make check", unless their sources changed.  To
-## enable unit-test supports, set RECHECK_LOGS to empty.  In such a
-## setting, that heavily relies on correct dependencies, its users may
-## prefer to define EXTRA_PROGRAMS instead of check_PROGRAMS, because
-## it allows intertwined compilation and execution of the tests.
-## Sometimes this helps catching errors earlier (you don't have to
-## wait for all the tests to be compiled).
-##
-## Define TEST_SUITE_LOG to be the name of the global log to create.
-## Define TEST_LOGS to the set of logs to include in it.  It defaults
-## to $(TESTS), with `.test' and `@EXEEXT@' removed, and `'.log'
-## appended.
-##
-## In addition to the magic "exit 77 means SKIP" feature (which was
-## imported from automake), there is a magic "exit 99 means FAIL" feature
-## which is useful if you need to issue a hard error no matter whether the
-## test is XFAIL or not.  You can disable this feature by setting the
-## variable DISABLE_HARD_ERRORS to a nonempty value.
+## The first version of the code here was adapted from check.mk, which was
+## originally written at EPITA/LRDE, further developed at Gostai, then made
+## its way from GNU coreutils to end up, largely rewritten, in Automake.
+## The current version is an heavy rewrite of that, to allow for support
+## of more test metadata, and the use of custom test derivers and protocols
+## (among them, TAP).
 
 # Restructured Text title and section.
-am__rst_title   = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
-am__rst_section = sed 'p;s/./=/g;p;g'
-
-# Put stdin (possibly several lines separated by ".  ") in a box.
-# Prefix each line by 'col' and terminate each with 'std', for coloring.
-# Multi line coloring is problematic with "less -R", so we really need
-# to color each line individually.
-am__text_box = $(AWK) '{                       \
-  n = split($$0, lines, "\\.  "); max = 0;     \
-  for (i = 1; i <= n; ++i)                     \
-    if (max < length(lines[i]))                        \
-      max = length(lines[i]);                  \
-  for (i = 0; i < max; ++i)                    \
-    line = line "=";                           \
-  print col line std;                          \
-  for (i = 1; i <= n; ++i)                     \
-    if (lines[i])                              \
-      print col lines[i] std;                  \
-  print col line std;                          \
-}'
+am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+am__rst_section = { sed 'p;s/./=/g;' && echo; }
 
 # Solaris 10 'make', and several other traditional 'make' implementations,
 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
 # by disabling -e (using the XSI extension "set +e") if it's set.
 am__sh_e_setup = case $$- in *e*) set +e;; esac
 
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+  --color-tests "$$am__color_tests" \
+  --enable-hard-errors "$$am__enable_hard_errors" \
+  --expect-failure "$$am__expect_failure"
+
 # To be inserted before the command running the test.  Creates the
 # directory for the log if needed.  Stores in $dir the directory
-# containing $f, in $tst the test, in $log the log, and passes
-# TESTS_ENVIRONMENT.  Save and restore TERM around use of
-# TESTS_ENVIRONMENT, in case that unsets it.
+# containing $f, in $tst the test, in $log the log.  Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT.  Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
 am__check_pre =                                                \
 $(am__sh_e_setup);                                     \
 $(am__vpath_adj_setup) $(am__vpath_adj)                        \
+$(am__tty_colors);                                     \
 srcdir=$(srcdir); export srcdir;                       \
-rm -f $@-t;                                            \
-am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \
-trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2;      \
-trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \
 am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;           \
 test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?;        \
 if test -f "./$$f"; then dir=./;                       \
 elif test -f "$$f"; then dir=;                         \
 else dir="$(srcdir)/"; fi;                             \
-tst=$$dir$$f; log='$@'; __SAVED_TERM=$$TERM;           \
-$(TESTS_ENVIRONMENT)
-
-# To be appended to the command running the test.  Handle the stdout
-# and stderr redirection, and catch the exit status.
-am__check_post =                                       \
->$@-t 2>&1;                                            \
-estatus=$$?;                                           \
-if test -n '$(DISABLE_HARD_ERRORS)'                    \
-   && test $$estatus -eq 99; then                      \
-  estatus=1;                                           \
-fi;                                                    \
-TERM=$$__SAVED_TERM; export TERM;                      \
-$(am__tty_colors);                                     \
-xfailed=PASS;                                          \
+tst=$$dir$$f; log='$@';                                \
+if test -n '$(DISABLE_HARD_ERRORS)'; then              \
+  am__enable_hard_errors=no;                           \
+else                                                   \
+  am__enable_hard_errors=yes;                          \
+fi;                                                    \
+## The use of $dir below is required to account for VPATH
+## rewriting done by Sun make.
 case " $(XFAIL_TESTS) " in                             \
   *[\ \        ]$$f[\ \        ]* | *[\ \      ]$$dir$$f[\ \   ]*) \
-    xfailed=XFAIL;;                                    \
-esac;                                                  \
-case $$estatus.$$xfailed in                            \
-    0.XFAIL) col=$$red; res=XPASS;;                    \
-    0.*)     col=$$grn; res=PASS ;;                    \
-    77.*)    col=$$blu; res=SKIP ;;                    \
-    99.*)    col=$$red; res=FAIL ;;                    \
-    *.XFAIL) col=$$lgn; res=XFAIL;;                    \
-    *.*)     col=$$red; res=FAIL ;;                    \
-esac;                                                  \
-echo "$${col}$$res$${std}: $$f";                       \
-echo "$$res: $$f (exit: $$estatus)" |                  \
-  $(am__rst_section) >$@;                              \
-cat $@-t >>$@;                                         \
-rm -f $@-t
+    am__expect_failure=yes;;                           \
+  *)                                                   \
+    am__expect_failure=no;;                            \
+esac;                                                  \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the `.log' extension removed).  The result is saved in the shell variable
+# `$bases'.  This honors runtime overriding of TESTS and TEST_LOGS.  Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.test' and 'test-trs-basic.test'.
+am__set_TESTS_bases = \
+  bases='$(TEST_LOGS)'; \
+  bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+## Trim away any extra whitespace.  This has already proved useful
+## in avoiding weird bug on lesser make implementations.  It also
+## works around the GNU make 3.80 bug where trailing whitespace in
+## "TESTS = foo.test $(empty)" causes $(TESTS_LOGS)  to erroneously
+## expand to "foo.log .log".
+  bases=`echo $$bases`
+
+# Recover from deleted `.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run `foo.test', and re-create
+# both `foo.log' and `foo.trs'.  Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+       rm -f $< $@
+       $(MAKE) $(AM_MAKEFLAGS) $<
 
 $(TEST_SUITE_LOG): $(TEST_LOGS)
-       @$(am__sh_e_setup);                                             \
-       list='$(TEST_LOGS)';                                            \
-       results=`for f in $$list; do                                    \
-                  test -r $$f && read line < $$f && echo "$$line"      \
-                    || echo FAIL;                                      \
-                done`;                                                 \
-       all=`echo "$$results" | sed '/^$$/d' | wc -l | sed -e 's/^[      ]*//'`; \
-       fail=`echo "$$results" | grep -c '^FAIL'`;                      \
-       pass=`echo "$$results" | grep -c '^PASS'`;                      \
-       skip=`echo "$$results" | grep -c '^SKIP'`;                      \
-       xfail=`echo "$$results" | grep -c '^XFAIL'`;                    \
-       xpass=`echo "$$results" | grep -c '^XPASS'`;                    \
-       failures=`expr $$fail + $$xpass`;                               \
-       all=`expr $$all - $$skip`;                                      \
-       if test "$$all" -eq 1; then tests=test; All=;                   \
-       else tests=tests; All="All "; fi;                               \
-       case fail=$$fail:xpass=$$xpass:xfail=$$xfail in                 \
-         fail=0:xpass=0:xfail=0)                                       \
-           msg="$$All$$all $$tests passed.  ";                         \
-           exit=true;;                                                 \
-         fail=0:xpass=0:xfail=*)                                       \
-           msg="$$All$$all $$tests behaved as expected";               \
-           if test "$$xfail" -eq 1; then xfailures=failure;            \
-           else xfailures=failures; fi;                                \
-           msg="$$msg ($$xfail expected $$xfailures).  ";              \
-           exit=true;;                                                 \
-         fail=*:xpass=0:xfail=*)                                       \
-           msg="$$fail of $$all $$tests failed.  ";                    \
-           exit=false;;                                                \
-         fail=*:xpass=*:xfail=*)                                       \
-           msg="$$failures of $$all $$tests did not behave as expected"; \
-           if test "$$xpass" -eq 1; then xpasses=pass;                 \
-           else xpasses=passes; fi;                                    \
-           msg="$$msg ($$xpass unexpected $$xpasses).  ";              \
-           exit=false;;                                                \
-         *)                                                            \
-           echo >&2 "incorrect case"; exit 4;;                         \
-       esac;                                                           \
-       if test "$$skip" -ne 0; then                                    \
-         if test "$$skip" -eq 1; then                                  \
-           msg="$$msg($$skip test was not run).  ";                    \
-         else                                                          \
-           msg="$$msg($$skip tests were not run).  ";                  \
-         fi;                                                           \
-       fi;                                                             \
+       @$(am__set_TESTS_bases); \
+## Helper shell function, tells whether a path refers to an existing,
+## regular, readable file.
+       am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+## We need to ensures that all the required `.trs' and `.log' files will
+## be present and readable.  The direct dependencies of $(TEST_SUITE_LOG)
+## only ensure that all the `.log' files exists; they don't ensure that
+## the `.log' files are readable, and worse, they don't ensure that the
+## `.trs' files even exist.
+       redo_bases=`for i in $$bases; do \
+                     am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+                   done`; \
+       if test -n "$$redo_bases"; then \
+## Uh-oh, either some `.log' files were unreadable, or some `.trs' files
+## were missing (or unreadable).  We need to re-run the corresponding
+## tests in order to re-create them.
+         redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+         redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+         if $(am__make_dryrun); then :; else \
+## Break "rm -f" into two calls to minimize the possibility of exceeding
+## command line length limits.
+           rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+         fi; \
+       fi; \
+## Use a trick to to ensure that we don't go into an infinite recursion
+## in case a test log in $(TEST_LOGS) is the same as $(TEST_SUITE_LOG).
+## Yes, this has already happened in practice.  Sigh!
+       if test -n "$$am__remaking_logs"; then \
+         echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+              "recursion detected" >&2; \
+       else \
+         am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+       fi; \
+       if $(am__make_dryrun); then :; else \
+## Sanity check: each unreadable or non-existent test result file should
+## has been properly remade at this point, as should the corresponding log
+## file.
+         st=0;  \
+         errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+         for i in $$redo_bases; do \
+           test -f $$i.trs && test -r $$i.trs \
+             || { echo "$$errmsg $$i.trs"; st=1; }; \
+           test -f $$i.log && test -r $$i.log \
+             || { echo "$$errmsg $$i.log"; st=1; }; \
+         done; \
+         test $$st -eq 0 || exit 1; \
+       fi
+## We need a new subshell to work portably with "make -n", since the
+## previous part of the recipe contained a $(MAKE) invocation.
+       @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+       ws='[   ]'; \
+## List of test result files.
+       results=`for b in $$bases; do echo $$b.trs; done`; \
+       test -n "$$results" || results=/dev/null; \
+## Prepare data for the test suite summary.  These do not take into account
+## unreadable test results, but they'll be appropriately updated later if
+## needed.
+       all=`  grep "^$$ws*:test-result:"           $$results | wc -l`; \
+       pass=` grep "^$$ws*:test-result:$$ws*PASS"  $$results | wc -l`; \
+       fail=` grep "^$$ws*:test-result:$$ws*FAIL"  $$results | wc -l`; \
+       skip=` grep "^$$ws*:test-result:$$ws*SKIP"  $$results | wc -l`; \
+       xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+       xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+       error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+## Whether the testsuite was successful or not.
+       if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+         success=true; \
+       else \
+         success=false; \
+       fi; \
+## Make $br a line of exactly 76 `=' characters, that will be used to
+## enclose the testsuite summary report when displayed on the console.
+       br='==================='; br=$$br$$br$$br$$br; \
+## When writing the test summary to the console, we want to color a line
+## reporting the count of some result *only* if at least one test
+## experienced such a result.  This function is handy in this regard.
+       result_count () \
+       { \
+           if test x"$$1" = x"--maybe-color"; then \
+             maybe_colorize=yes; \
+           elif test x"$$1" = x"--no-color"; then \
+             maybe_colorize=no; \
+           else \
+             echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+           fi; \
+           shift; \
+           desc=$$1 count=$$2; \
+           if test $$maybe_colorize = yes && test $$count -gt 0; then \
+             color_start=$$3 color_end=$$std; \
+           else \
+             color_start= color_end=; \
+           fi; \
+           echo "$${color_start}# $$desc $$count$${color_end}"; \
+       }; \
+## A shell function that creates the testsuite summary.  We need it
+## because we have to create *two* summaries, one for test-suite.log,
+## and a possibly-colorized one for console output.
+       create_testsuite_report () \
+       { \
+         result_count $$1 "TOTAL:" $$all   "$$brg"; \
+         result_count $$1 "PASS: " $$pass  "$$grn"; \
+         result_count $$1 "SKIP: " $$skip  "$$blu"; \
+         result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+         result_count $$1 "FAIL: " $$fail  "$$red"; \
+         result_count $$1 "XPASS:" $$xpass "$$red"; \
+         result_count $$1 "ERROR:" $$error "$$mgn"; \
+       }; \
+## Write "global" testsuite log.
        {                                                               \
          echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" |       \
            $(am__rst_title);                                           \
-         echo "$$msg";                                                 \
+         create_testsuite_report --no-color;                           \
          echo;                                                         \
          echo ".. contents:: :depth: 2";                               \
          echo;                                                         \
-         for f in $$list; do                                           \
-           test -r $$f && read line < $$f || line=;                    \
-           case $$line in                                              \
-             PASS:*|XFAIL:*);;                                         \
-             *) echo; cat $$f;;                                        \
-           esac;                                                       \
-         done;                                                         \
+         for i in $$bases; do                                          \
+## FIXME: one fork per test -- this is horrendously inefficient!
+           if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$i.trs \
+                >/dev/null; then continue; \
+           fi; \
+## Get the declared "global result" of the test.
+## FIXME: yet another one fork per test here!
+           glob_res=`sed -n -e "s/$$ws*$$//" \
+                            -e "s/^$$ws*:global-test-result:$$ws*//p" \
+                       $$i.trs`; \
+## If no global result is explicitly declared, we'll merely mark the
+## test as "RUN" in the global test log.
+           test -n "$$glob_res" || glob_res=RUN; \
+## Write the name and result of the test as an RST section title.
+           echo "$$glob_res: $$i" | $(am__rst_section); \
+## If we should have remade any unreadable `.log', above.
+           if test ! -r $$i.log; then \
+             echo "fatal: making $@: $$i.log is unreadable" >&2; \
+             exit 1; \
+           fi; \
+           cat $$i.log; echo; \
+         done; \
        } >$(TEST_SUITE_LOG).tmp;                                       \
        mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                     \
-       if test "$$failures" -ne 0; then                                \
-         msg="$${msg}See $(subdir)/$(TEST_SUITE_LOG).  ";              \
-         if test -n "$(PACKAGE_BUGREPORT)"; then                       \
-           msg="$${msg}Please report to $(PACKAGE_BUGREPORT).  ";      \
-         fi;                                                           \
-       fi;                                                             \
-       test x"$$VERBOSE" = x || $$exit || cat $(TEST_SUITE_LOG);       \
-       $(am__tty_colors);                                              \
-       if $$exit; then                                                 \
+## Emit the test summary on the console.
+       if $$success; then                                              \
          col="$$grn";                                                  \
         else                                                           \
          col="$$red";                                                  \
+         test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG);               \
        fi;                                                             \
-       echo "$$msg" | $(am__text_box) "col=$$col" "std=$$std";         \
-## The use of "exit 1" below is required to work around a FreeBSD make bug
-## (present only when running in concurrent mode).  See automake bug#9245:
+## Multi line coloring is problematic with "less -R", so we really need
+## to color each line individually.
+       echo "$${col}$$br$${std}";                                      \
+       echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}";   \
+       echo "$${col}$$br$${std}";                                      \
+## This is expected to go to the console, so it might have to be colorized.
+       create_testsuite_report --maybe-color;                          \
+       echo "$$col$$br$$std";                                          \
+       if $$success; then :; else                                      \
+         echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}";         \
+         if test -n "$(PACKAGE_BUGREPORT)"; then                       \
+           echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+         fi;                                                           \
+         echo "$$col$$br$$std";                                        \
+       fi;                                                             \
+## Be sure to exit with the proper exit status.  The use of "exit 1" below
+## is required to work around a FreeBSD make bug (present only when running
+## in concurrent mode).  See automake bug#9245:
 ##  <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9245>
 ## and FreeBSD PR bin/159730:
 ##  <http://www.freebsd.org/cgi/query-pr.cgi?pr=159730>.
-       $$exit || exit 1
+       $$success || exit 1
 
 RECHECK_LOGS = $(TEST_LOGS)
 
+## ------------------------------------------ ##
+## Running all tests, or rechecking failures. ##
+## ------------------------------------------ ##
+
 check-TESTS recheck:
 ## If we are running "make recheck", it's not the user which can decide
 ## which tests to consider for re-execution, so we must ignore the value
 ## of $(RECHECK_LOGS).
+## Here and below, we expand $(RECHECK_LOGS) only once, to avoid exceeding
+## line length limits.
        @if test $@ != recheck; then \
-## Expand $(RECHECK_LOGS) only once, to avoid exceeding line length limits.
-          list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list; \
+          list='$(RECHECK_LOGS)'; \
+          test -z "$$list" || rm -f $$list; \
+        fi
+       @if test $@ != recheck; then \
+          list='$(RECHECK_LOGS:.log=.trs)'; \
+          test -z "$$list" || rm -f $$list; \
         fi
 ## We always have to remove TEST_SUITE_LOG, to ensure its rule is run
 ## in any case even in lazy mode: otherwise, if no test needs rerunning,
@@ -249,34 +327,45 @@ check-TESTS recheck:
 ## cannot use `$?' to compute the set of lazily rerun tests, lest
 ## we rely on .PHONY to work portably.
        @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
-       @list='' list2='$(TEST_LOGS)'; for f in $$list2; do \
-## Trailing whitespace in `TESTS = foo.test $(empty)' causes GNU make
-## 3.80 to erroneously expand $(TESTS_LOGS) to `foo.log .log'.
-## Work around this bug.
-         test .log = $$f && continue; \
-## If running a "make recheck", we must only consider tests that had
-## an unexpected outcome (FAIL or XPASS) in the earlier run.
+       @ws='[  ]'; \
+       log_list='' trs_list=''; $(am__set_TESTS_bases); \
+       for i in $$bases; do \
+## If running a "make recheck", we must only consider tests that had an
+## unexpected outcome (FAIL or XPASS) in the earlier run.  In particular,
+## skip tests that haven't been run.  But recover gracefully from deleted
+## `.trs' files.
          if test $@ = recheck; then \
-           test -f $$f || continue; \
-           if test -r $$f && read line < $$f; then \
-             case $$line in FAIL*|XPASS*) : ;; *) continue;; esac; \
-           fi; \
-         fi; \
+           test -f $$i.trs || test -f $$i.log || continue; \
+## FIXME: one fork per test -- this is horrendously inefficient!
+           grep "^$$ws*:recheck:$$ws*no$$ws*$$" $$i.trs \
+             >/dev/null 2>&1 && continue; \
+         else :; fi; \
 ## Be careful to avoid extra whitespace in the definition of $list, since
 ## its value will be passed to the recursive make invocation below through
 ## the TEST_LOGS macro, and leading/trailing white space in a make macro
 ## definition can be problematic.  In this particular case, trailing white
 ## space was known to cause a segmentation fault on Solaris 10 XPG4 make:
 ## <http://lists.gnu.org/archive/html/bug-automake/2010-08/msg00004.html>
-         if test -z "$$list"; then list=$$f; else list="$$list $$f"; fi; \
+         if test -z "$$log_list"; then \
+           log_list="$$i.log"; \
+         else \
+           log_list="$$log_list $$i.log"; \
+         fi; \
+         if test -z "$$trs_list"; then \
+           trs_list="$$i.trs"; \
+         else \
+           trs_list="$$trs_list $$i.trs"; \
+         fi; \
        done; \
-## Under "make recheck", remove the logs of the files to recheck, so that
-## those will be rerun by the "make test-suite.log" recursive invocation
-## below.  But avoid extra files removal when running under "make -n".
-       if test $@ = recheck && test -n "$$list"; then \
-         $(am__make_dryrun) || rm -f $$list || exit 1; \
+## Under "make recheck", remove the .log and .trs files associated
+## with the files to recheck, so that those will be rerun by the
+## "make test-suite.log" recursive invocation below.  But use a proper
+## hack to avoid extra files removal when running under "make -n".
+       if test $@ != recheck || $(am__make_dryrun); then :; else \
+         test -z "$$log_list" || rm -f $$log_list; \
+         test -z "$$trs_list" || rm -f $$trs_list; \
        fi; \
-       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list"
+       $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"
 
 ## Recheck must depend on $(check_SCRIPTS), $(check_PROGRAMS), etc.
 recheck: %CHECK_DEPS%
@@ -285,12 +374,6 @@ AM_RECURSIVE_TARGETS += check recheck
 
 .PHONY: recheck
 
-## ----------------------------------------------- ##
-## Produce HTML.  To be removed in automake 1.12.  ##
-## ----------------------------------------------- ##
-
-include check-html.am
-
 else !%?PARALLEL_TESTS%
 
 check-TESTS: $(TESTS)
@@ -307,7 +390,7 @@ check-TESTS: $(TESTS)
 ## why we also try `dir='
            elif test -f $$tst; then dir=; \
            else dir="$(srcdir)/"; fi; \
-           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+           if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \
 ## Success
              all=`expr $$all + 1`; \
              case " $(XFAIL_TESTS) " in \
index 054c62d..9a0fe9d 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 2008, 2009, 2011, 2012 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
 ## You should have received a copy of the GNU General Public License
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-## From a test file to a log file.
+## From a test file to a .log and .trs file.
 ?GENERIC?%EXT%.log:
 ?!GENERIC?%OBJ%: %SOURCE%
-       @p='%SOURCE%'; $(am__check_pre) %COMPILE% "$$tst" $(am__check_post)
+       @p='%SOURCE%'; $(am__check_pre) %DRIVER% --test-name "$$f" \
+       --log-file '%BASE%.log' --trs-file '%BASE%.trs' \
+       $(am__common_driver_flags) %DRIVER_FLAGS% -- %COMPILE% \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
 
 ## If no programs are built in this package, then this rule is removed
 ## at automake time.  Otherwise, %am__EXEEXT% expands to a configure time
@@ -25,5 +28,8 @@
 ## conflict with the previous one.
 if %am__EXEEXT%
 ?GENERIC?%EXT%$(EXEEXT).log:
-       @p='%SOURCE%'; $(am__check_pre) %COMPILE% "$$tst" $(am__check_post)
+       @p='%SOURCE%'; $(am__check_pre) %DRIVER% --test-name "$$f" \
+       --log-file '%BASE%.log' --trs-file '%BASE%.trs' \
+       $(am__common_driver_flags) %DRIVER_FLAGS% -- %COMPILE% \
+       "$$tst" $(AM_TESTS_FD_REDIRECT)
 endif %am__EXEEXT%
index 660050a..010504f 100644 (file)
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006
+## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006, 2010
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -73,7 +73,7 @@ check-DEJAGNU: site.exp
 ## the possibility of a corrupted site.exp if make is interrupted.
 ## Jim Meyering has some useful text on this topic.
 site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
-       @echo 'Making a new site.exp file...'
+       @echo 'Making a new site.exp file ...'
        @echo '## these variables are automatically generated by make ##' >site.tmp
        @echo '# Do not edit here.  If you wish to override these values' >>site.tmp
        @echo '# edit the last section' >>site.tmp
index da9028b..8a64e5a 100644 (file)
@@ -34,6 +34,7 @@ am__remove_distdir = \
 ## See automake bug#10470.
       || { sleep 5 && rm -rf "$(distdir)"; }; \
   else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
 endif %?TOPDIR_P%
 
 if %?SUBDIRS%
@@ -223,6 +224,7 @@ endif %?TOPDIR_P%
 ## Test for file existence because sometimes a file gets included in
 ## DISTFILES twice.  For example this happens when a single source
 ## file is used in building more than one program.
+## See also test `dist-repeated.test'.
            test -f "$(distdir)/$$file" \
            || cp -p $$d/$$file "$(distdir)/$$file" \
            || exit 1; \
@@ -329,6 +331,10 @@ endif %?TOPDIR_P%
 ## with tar 1.11.2).  We do not do anything specific w.r.t. this
 ## incompatibility since packages where empty directories need to be
 ## present in the archive are really unusual.
+##
+## We order DIST_TARGETS by expected duration of the compressors,
+## slowest first, for better parallelism in `make dist'.  Do not
+## reorder DIST_ARCHIVES, users may expect gzip to be first.
 
 if %?TOPDIR_P%
 
@@ -337,50 +343,52 @@ GZIP_ENV = --best
 .PHONY: dist-gzip
 dist-gzip: distdir
        tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-       $(am__remove_distdir)
+       $(am__post_remove_distdir)
 
 ?BZIP2?DIST_ARCHIVES += $(distdir).tar.bz2
 .PHONY: dist-bzip2
 dist-bzip2: distdir
        tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-       $(am__remove_distdir)
+       $(am__post_remove_distdir)
 
 ?LZIP?DIST_ARCHIVES += $(distdir).tar.lz
 .PHONY: dist-lzip
 dist-lzip: distdir
        tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
-       $(am__remove_distdir)
-
-?LZMA?DIST_ARCHIVES += $(distdir).tar.lzma
-.PHONY: dist-lzma
-dist-lzma: distdir
-       tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
-       $(am__remove_distdir)
+       $(am__post_remove_distdir)
 
 ?XZ?DIST_ARCHIVES += $(distdir).tar.xz
 .PHONY: dist-xz
 dist-xz: distdir
        tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
-       $(am__remove_distdir)
+       $(am__post_remove_distdir)
 
 ?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z
 .PHONY: dist-tarZ
 dist-tarZ: distdir
        tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-       $(am__remove_distdir)
+       $(am__post_remove_distdir)
 
 ?SHAR?DIST_ARCHIVES += $(distdir).shar.gz
 .PHONY: dist-shar
 dist-shar: distdir
        shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-       $(am__remove_distdir)
+       $(am__post_remove_distdir)
 
 ?ZIP?DIST_ARCHIVES += $(distdir).zip
 .PHONY: dist-zip
 dist-zip: distdir
        -rm -f $(distdir).zip
        zip -rq $(distdir).zip $(distdir)
-       $(am__remove_distdir)
+       $(am__post_remove_distdir)
+
+?LZIP?DIST_TARGETS += dist-lzip
+?XZ?DIST_TARGETS += dist-xz
+?SHAR?DIST_TARGETS += dist-shar
+?BZIP2?DIST_TARGETS += dist-bzip2
+?GZIP?DIST_TARGETS += dist-gzip
+?ZIP?DIST_TARGETS += dist-zip
+?COMPRESS?DIST_TARGETS += dist-tarZ
 
 endif %?TOPDIR_P%
 
@@ -400,17 +408,9 @@ if %?SUBDIRS%
 AM_RECURSIVE_TARGETS += dist dist-all
 endif %?SUBDIRS%
 
-dist dist-all: distdir
-?GZIP? tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-?BZIP2?        tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
-?LZIP? tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
-?LZMA? tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
-?XZ?   tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
-?COMPRESS?     tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-?SHAR? shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-?ZIP?  -rm -f $(distdir).zip
-?ZIP?  zip -rq $(distdir).zip $(distdir)
-       $(am__remove_distdir)
+dist dist-all:
+       $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+       $(am__post_remove_distdir)
 
 endif %?TOPDIR_P%
 
@@ -435,8 +435,6 @@ distcheck: dist
          GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
        *.tar.bz2*) \
          bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
-       *.tar.lzma*) \
-         lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
        *.tar.lz*) \
          lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
        *.tar.xz*) \
@@ -517,7 +515,7 @@ distcheck: dist
 ## Cater to parallel BSD make (see above).
          && cd "$$am__cwd" \
          || exit 1
-       $(am__remove_distdir)
+       $(am__post_remove_distdir)
        @(echo "$(distdir) archives ready for distribution: "; \
          list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
          sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
index 29aa00c..55e53e1 100644 (file)
@@ -104,9 +104,11 @@ clean-%DIR%LTLIBRARIES:
 ## `so_locations' files are created by some linkers (IRIX, OSF) when
 ## building a shared object.  Libtool places these files in the
 ## directory where the shared object is created.
-       @list='$(%DIR%_LTLIBRARIES)'; for p in $$list; do \
-         dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
-         test "$$dir" != "$$p" || dir=.; \
-         echo "rm -f \"$${dir}/so_locations\""; \
-         rm -f "$${dir}/so_locations"; \
-       done
+       @list='$(%DIR%_LTLIBRARIES)'; \
+       locs=`for p in $$list; do echo $$p; done | \
+             sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
+             sort -u`; \
+       test -z "$$locs" || { \
+         echo rm -f $${locs}; \
+         rm -f $${locs}; \
+       }
diff --git a/lib/am/multilib.am b/lib/am/multilib.am
deleted file mode 100644 (file)
index 6897b5d..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1998, 2001, 2003, 2004 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/>.
-## Multilib support variables.
-MULTISRCTOP =
-MULTIBUILDTOP =
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-# GNU Make needs to see an explicit $(MAKE) variable in the command it
-# runs to enable its job server during parallel builds.  Hence the
-# comments below.
-
-all-multi:
-       $(MULTIDO) $(AM_MAKEFLAGS) DO=all multi-do # $(MAKE)
-install-multi:
-       $(MULTIDO) $(AM_MAKEFLAGS) DO=install multi-do # $(MAKE)
-
-.MAKE .PHONY: all-multi install-multi
-
-
-mostlyclean-multi:
-       $(MULTICLEAN) $(AM_MAKEFLAGS) DO=mostlyclean multi-clean # $(MAKE)
-clean-multi:
-       $(MULTICLEAN) $(AM_MAKEFLAGS) DO=clean multi-clean # $(MAKE)
-distclean-multi:
-       $(MULTICLEAN) $(AM_MAKEFLAGS) DO=distclean multi-clean # $(MAKE)
-maintainer-clean-multi:
-       $(MULTICLEAN) $(AM_MAKEFLAGS) DO=maintainer-clean multi-clean # $(MAKE)
-
-.MAKE .PHONY: mostlyclean-multi clean-multi distclean-multi maintainer-clean-multi
-
-install-exec-am: install-multi
-## No uninstall rule?
-
-
-## These cleaning rules are recursive.  They should not be
-## registered as dependencies of *-am rules.  For instance
-## otherwise running `make clean' would cause both
-## clean-multi and mostlyclean-multi to be run, while only
-## clean-multi is really expected (since clean-multi recursively
-## call clean, it already do the job of mostlyclean).
-mostlyclean: mostlyclean-multi
-clean: clean-multi
-distclean: distclean-multi
-maintainer-clean: maintainer-clean-multi
index d39b23d..d26968a 100644 (file)
@@ -1,6 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
 ## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004,
-## 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+## 2006, 2007, 2008, 2009, 2010 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
@@ -42,7 +42,7 @@ install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
            -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
        sed 'N;N;N;s,\n, ,g' | \
 ## The following awk script turns that into one line containing directories
-## and then lines of 'type target_name_or_directory sources...', with type
+## and then lines of 'type target_name_or_directory sources ...', with type
 ## 'd' designating directories, and 'f' files.
        $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
          { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
index 7463e2f..7fa75c9 100644 (file)
@@ -134,6 +134,43 @@ GTAGS:
          && gtags -i $(GTAGS_ARGS) "$$here"
 
 
+## ------- ##
+## cscope  ##
+## ------- ##
+
+if %?TOPDIR_P%
+
+CSCOPE = cscope
+.PHONY: cscope clean-cscope
+AM_RECURSIVE_TARGETS += cscope
+
+cscope: cscope.files
+       test ! -s cscope.files \
+         || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+
+clean-cscope:
+       -rm -f cscope.files
+
+cscope.files: clean-cscope %CSCOPEDIRS% cscopelist
+
+endif %?TOPDIR_P%
+
+.PHONY: cscopelist
+cscopelist: %CSCOPEDIRS% $(HEADERS) $(SOURCES) $(LISP)
+       list='$(SOURCES) $(HEADERS) $(LISP)'; \
+       case "$(srcdir)" in \
+         [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+         *) sdir=$(subdir)/$(srcdir) ;; \
+       esac; \
+       for i in $$list; do \
+         if test -f "$$i"; then \
+           echo "$(subdir)/$$i"; \
+         else \
+           echo "$$sdir/$$i"; \
+         fi; \
+       done >> $(top_builddir)/cscope.files
+
+
 ## ---------- ##
 ## Cleaning.  ##
 ## ---------- ##
@@ -142,3 +179,6 @@ GTAGS:
 
 distclean-tags:
        -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+if %?TOPDIR_P%
+       -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+endif %?TOPDIR_P%
index dca9ce1..4b1add7 100644 (file)
@@ -32,7 +32,7 @@
 ##    to fail, the info files are not removed.  (They are needed by the
 ##    developer while he writes documentation.)
 ## *.iNN files are used on DJGPP.  See the comments in install-info-am
-       restore=: && backupdir="$(am__leading_dot)am$$$$" && \
+       %AM_V_MAKEINFO%restore=: && backupdir="$(am__leading_dot)am$$$$" && \
 ?INSRC?        am__cwd=`pwd` && $(am__cd) $(srcdir) && \
        rm -rf $$backupdir && mkdir $$backupdir && \
 ## If makeinfo is not installed we must not backup the files so
@@ -62,23 +62,27 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
 
 ?GENERIC?%SOURCE_SUFFIX%.dvi:
 ?!GENERIC?%DEST_PREFIX%.dvi: %SOURCE% %DEPS% %DIRSTAMP%
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+       %AM_V_TEXI2DVI%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
 ## Must set MAKEINFO like this so that version.texi will be found even
 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
-?GENERIC?      $(TEXI2DVI) %SOURCE%
-?!GENERIC?     $(TEXI2DVI) -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+## texi2dvi doesn't silence everything with -q, redirect to /dev/null instead.
+## We still want -q (%TEXIQUIET%) because it turns on batch mode.
+?GENERIC?      $(TEXI2DVI) %TEXIQUIET% %SOURCE% %TEXIDEVNULL%
+?!GENERIC?     $(TEXI2DVI) %TEXIQUIET% -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% %TEXIDEVNULL%
 
 ?GENERIC?%SOURCE_SUFFIX%.pdf:
 ?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% %DIRSTAMP%
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+       %AM_V_TEXI2PDF%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
 ## Must set MAKEINFO like this so that version.texi will be found even
 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS%' \
 ## Do not use `-o' unless necessary: it is only supported since Texinfo 4.1.
-?GENERIC?      $(TEXI2PDF) %SOURCE%
-?!GENERIC?     $(TEXI2PDF) -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
+## texi2pdf doesn't silence everything with -q, redirect to /dev/null instead.
+## We still want -q (%TEXIQUIET%) because it turns on batch mode.
+?GENERIC?      $(TEXI2PDF) %TEXIQUIET% %SOURCE% %TEXIDEVNULL%
+?!GENERIC?     $(TEXI2PDF) %TEXIQUIET% -o $@ `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% %TEXIDEVNULL%
 
 ?GENERIC?%SOURCE_SUFFIX%.html:
 ?!GENERIC?%DEST_PREFIX%.html: %SOURCE% %DEPS% %DIRSTAMP%
@@ -88,8 +92,8 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
 ## in the manual change, it may leave unused pages.  Our fix
 ## is to build under a temporary name, and replace the target on
 ## success.
-       rm -rf $(@:.html=.htp)
-       if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
+       %AM_V_MAKEINFO%rm -rf $(@:.html=.htp)
+       %SILENT%if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) %MAKEINFOFLAGS% \
 ?GENERIC?       -o $(@:.html=.htp) %SOURCE%; \
 ?!GENERIC?      -o $(@:.html=.htp) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%; \
        then \
index 5314dec..dc51d8d 100644 (file)
@@ -55,8 +55,8 @@ endif %?LOCAL-TEXIS%
 if %?LOCAL-TEXIS%
 DVIPS = dvips
 .dvi.ps:
-       TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
-       $(DVIPS) -o $@ $<
+       %AM_V_DVIPS%TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
+       $(DVIPS) %TEXIQUIET% -o $@ $<
 endif %?LOCAL-TEXIS%
 
 .PHONY: dvi dvi-am html html-am info info-am pdf pdf-am ps ps-am
index 6d35cd4..8ad4074 100644 (file)
 ## distributed or not.  We cannot have a generic rule that works in
 ## both cases, so we ensure in automake that nodist_ parsers always
 ## use non-generic rules.
-if %?MAINTAINER-MODE%
 if %?FIRST%
+if %?MAINTAINER-MODE%
 @MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
-endif %?FIRST%
 endif %?MAINTAINER-MODE%
+## The 's/c$/h/' substitution *must* be the last one.
+am__yacc_c2h = sed -e s/cc$$/hh/ -e s/cpp$$/hpp/ -e s/cxx$$/hxx/ \
+                  -e s/c++$$/h++/ -e s/c$$/h/
+endif %?FIRST%
 
 ?GENERIC?%EXT%%DERIVED-EXT%:
 ?!GENERIC?%OBJ%: %SOURCE%
-?GENERIC?      %VERBOSE%$(am__skipyacc) $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE%
+?GENERIC?      %VERBOSE%$(am__skipyacc) $(SHELL) $(YLWRAP) %SOURCE% y.tab.c %OBJ% y.tab.h `echo %OBJ% | $(am__yacc_c2h)` y.output %BASE%.output -- %COMPILE%
 ?!GENERIC?     %VERBOSE% \
 ?!GENERIC??DIST_SOURCE?        $(am__skipyacc) \
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
-?!GENERIC?     $(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% y.tab.c %OBJ% y.tab.h %BASE%.h y.output %BASE%.output -- %COMPILE%
+?!GENERIC?     $(SHELL) $(YLWRAP) `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE% y.tab.c %OBJ% y.tab.h `echo %OBJ% | $(am__yacc_c2h)` y.output %BASE%.output -- %COMPILE%
diff --git a/lib/ansi2knr.1 b/lib/ansi2knr.1
deleted file mode 100644 (file)
index f9ee5a6..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-.TH ANSI2KNR 1 "19 Jan 1996"
-.SH NAME
-ansi2knr \- convert ANSI C to Kernighan & Ritchie C
-.SH SYNOPSIS
-.I ansi2knr
-[--varargs] input_file [output_file]
-.SH DESCRIPTION
-If no output_file is supplied, output goes to stdout.
-.br
-There are no error messages.
-.sp
-.I ansi2knr
-recognizes function definitions by seeing a non-keyword identifier at the left
-margin, followed by a left parenthesis, with a right parenthesis as the last
-character on the line, and with a left brace as the first token on the
-following line (ignoring possible intervening comments).  It will recognize a
-multi-line header provided that no intervening line ends with a left or right
-brace or a semicolon.  These algorithms ignore whitespace and comments, except
-that the function name must be the first thing on the line.
-.sp
-The following constructs will confuse it:
-.br
-     - Any other construct that starts at the left margin and follows the
-above syntax (such as a macro or function call).
-.br
-     - Some macros that tinker with the syntax of the function header.
-.sp
-The --varargs switch is obsolete, and is recognized only for
-backwards compatibility.  The present version of
-.I ansi2knr
-will always attempt to convert a ... argument to va_alist and va_dcl.
-.SH AUTHOR
-L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
-continues to maintain the current version; most of the code in the current
-version is his work.  ansi2knr also includes contributions by Francois
-Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
diff --git a/lib/ansi2knr.c b/lib/ansi2knr.c
deleted file mode 100644 (file)
index e84c210..0000000
+++ /dev/null
@@ -1,739 +0,0 @@
-/* Copyright (C) 1989, 2000 Aladdin Enterprises.  All rights reserved. */
-
-/*$Id: ansi2knr.c,v 1.14 2003/09/06 05:36:56 eggert Exp $*/
-/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
-
-/*
-ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
-WARRANTY.  No author or distributor accepts responsibility to anyone for the
-consequences of using it or for whether it serves any particular purpose or
-works at all, unless he says so in writing.  Refer to the GNU General Public
-License (the "GPL") for full details.
-
-Everyone is granted permission to copy, modify and redistribute ansi2knr,
-but only under the conditions described in the GPL.  A copy of this license
-is supposed to have been given to you along with ansi2knr so you can know
-your rights and responsibilities.  It should be in a file named COPYLEFT,
-or, if there is no file named COPYLEFT, a file named COPYING.  Among other
-things, the copyright notice and this notice must be preserved on all
-copies.
-
-We explicitly state here what we believe is already implied by the GPL: if
-the ansi2knr program is distributed as a separate set of sources and a
-separate executable file which are aggregated on a storage medium together
-with another program, this in itself does not bring the other program under
-the GPL, nor does the mere fact that such a program or the procedures for
-constructing it invoke the ansi2knr executable bring any other part of the
-program under the GPL.
-*/
-
-/*
- * Usage:
-       ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
- * --filename provides the file name for the #line directive in the output,
- * overriding input_file (if present).
- * If no input_file is supplied, input is read from stdin.
- * If no output_file is supplied, output goes to stdout.
- * There are no error messages.
- *
- * ansi2knr recognizes function definitions by seeing a non-keyword
- * identifier at the left margin, followed by a left parenthesis, with a
- * right parenthesis as the last character on the line, and with a left
- * brace as the first token on the following line (ignoring possible
- * intervening comments and/or preprocessor directives), except that a line
- * consisting of only
- *     identifier1(identifier2)
- * will not be considered a function definition unless identifier2 is
- * the word "void", and a line consisting of
- *     identifier1(identifier2, <<arbitrary>>)
- * will not be considered a function definition.
- * ansi2knr will recognize a multi-line header provided that no intervening
- * line ends with a left or right brace or a semicolon.  These algorithms
- * ignore whitespace, comments, and preprocessor directives, except that
- * the function name must be the first thing on the line.  The following
- * constructs will confuse it:
- *     - Any other construct that starts at the left margin and
- *         follows the above syntax (such as a macro or function call).
- *     - Some macros that tinker with the syntax of function headers.
- */
-
-/*
- * The original and principal author of ansi2knr is L. Peter Deutsch
- * <ghost@aladdin.com>.  Other authors are noted in the change history
- * that follows (in reverse chronological order):
-
-       lpd 2000-04-12 backs out Eggert's changes because of bugs:
-       - concatlits didn't declare the type of its bufend argument;
-       - concatlits didn't recognize when it was inside a comment;
-       - scanstring could scan backward past the beginning of the string; when
-       - the check for \ + newline in scanstring was unnecessary.
-
-       2000-03-05  Paul Eggert  <eggert@twinsun.com>
-
-       Add support for concatenated string literals.
-       * ansi2knr.c (concatlits): New decl.
-       (main): Invoke concatlits to concatenate string literals.
-       (scanstring): Handle backslash-newline correctly.  Work with
-       character constants.  Fix bug when scanning backwards through
-       backslash-quote.  Check for unterminated strings.
-       (convert1): Parse character constants, too.
-       (appendline, concatlits): New functions.
-       * ansi2knr.1: Document this.
-
-       lpd 1999-08-17 added code to allow preprocessor directives
-               wherever comments are allowed
-       lpd 1999-04-12 added minor fixes from Pavel Roskin
-               <pavel_roskin@geocities.com> for clean compilation with
-               gcc -W -Wall
-       lpd 1999-03-22 added hack to recognize lines consisting of
-               identifier1(identifier2, xxx) as *not* being procedures
-       lpd 1999-02-03 made indentation of preprocessor commands consistent
-       lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
-               endless loop; quoted strings within an argument list
-               confused the parser
-       lpd 1999-01-24 added a check for write errors on the output,
-               suggested by Jim Meyering <meyering@ascend.com>
-       lpd 1998-11-09 added further hack to recognize identifier(void)
-               as being a procedure
-       lpd 1998-10-23 added hack to recognize lines consisting of
-               identifier1(identifier2) as *not* being procedures
-       lpd 1997-12-08 made input_file optional; only closes input and/or
-               output file if not stdin or stdout respectively; prints
-               usage message on stderr rather than stdout; adds
-               --filename switch (changes suggested by
-               <ceder@lysator.liu.se>)
-       lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with
-               compilers that don't understand void, as suggested by
-               Tom Lane
-       lpd 1996-01-15 changed to require that the first non-comment token
-               on the line following a function header be a left brace,
-               to reduce sensitivity to macros, as suggested by Tom Lane
-               <tgl@sss.pgh.pa.us>
-       lpd 1995-06-22 removed #ifndefs whose sole purpose was to define
-               undefined preprocessor symbols as 0; changed all #ifdefs
-               for configuration symbols to #ifs
-       lpd 1995-04-05 changed copyright notice to make it clear that
-               including ansi2knr in a program does not bring the entire
-               program under the GPL
-       lpd 1994-12-18 added conditionals for systems where ctype macros
-               don't handle 8-bit characters properly, suggested by
-               Francois Pinard <pinard@iro.umontreal.ca>;
-               removed --varargs switch (this is now the default)
-       lpd 1994-10-10 removed CONFIG_BROKETS conditional
-       lpd 1994-07-16 added some conditionals to help GNU `configure',
-               suggested by Francois Pinard <pinard@iro.umontreal.ca>;
-               properly erase prototype args in function parameters,
-               contributed by Jim Avera <jima@netcom.com>;
-               correct error in writeblanks (it shouldn't erase EOLs)
-       lpd 1989-xx-xx original version
- */
-
-/* Most of the conditionals here are to make ansi2knr work with */
-/* or without the GNU configure machinery. */
-
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
-#include <ctype.h>
-
-#if HAVE_CONFIG_H
-
-/*
-   For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
-   This will define HAVE_CONFIG_H and so, activate the following lines.
- */
-
-# if STDC_HEADERS || HAVE_STRING_H
-#  include <string.h>
-# else
-#  include <strings.h>
-# endif
-
-#else /* not HAVE_CONFIG_H */
-
-/* Otherwise do it the hard way */
-
-# ifdef BSD
-#  include <strings.h>
-# else
-#  ifdef VMS
-    extern int strlen(), strncmp();
-#  else
-#   include <string.h>
-#  endif
-# endif
-
-#endif /* not HAVE_CONFIG_H */
-
-#if STDC_HEADERS
-# include <stdlib.h>
-#else
-/*
-   malloc and free should be declared in stdlib.h,
-   but if you've got a K&R compiler, they probably aren't.
- */
-# ifdef MSDOS
-#  include <malloc.h>
-# else
-#  ifdef VMS
-     extern char *malloc();
-     extern void free();
-#  else
-     extern char *malloc();
-     extern int free();
-#  endif
-# endif
-
-#endif
-
-/* Define NULL (for *very* old compilers). */
-#ifndef NULL
-# define NULL (0)
-#endif
-
-/*
- * The ctype macros don't always handle 8-bit characters correctly.
- * Compensate for this here.
- */
-#ifdef isascii
-# undef HAVE_ISASCII           /* just in case */
-# define HAVE_ISASCII 1
-#else
-#endif
-#if STDC_HEADERS || !HAVE_ISASCII
-# define is_ascii(c) 1
-#else
-# define is_ascii(c) isascii(c)
-#endif
-
-#define is_space(c) (is_ascii(c) && isspace(c))
-#define is_alpha(c) (is_ascii(c) && isalpha(c))
-#define is_alnum(c) (is_ascii(c) && isalnum(c))
-
-/* Scanning macros */
-#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
-#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
-
-/* Forward references */
-char *ppdirforward();
-char *ppdirbackward();
-char *skipspace();
-char *scanstring();
-int writeblanks();
-int test1();
-int convert1();
-
-/* The main program */
-int
-main(argc, argv)
-    int argc;
-    char *argv[];
-{      FILE *in = stdin;
-       FILE *out = stdout;
-       char *filename = 0;
-       char *program_name = argv[0];
-       char *output_name = 0;
-#define bufsize 5000                   /* arbitrary size */
-       char *buf;
-       char *line;
-       char *more;
-       char *usage =
-         "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
-       /*
-        * In previous versions, ansi2knr recognized a --varargs switch.
-        * If this switch was supplied, ansi2knr would attempt to convert
-        * a ... argument to va_alist and va_dcl; if this switch was not
-        * supplied, ansi2knr would simply drop any such arguments.
-        * Now, ansi2knr always does this conversion, and we only
-        * check for this switch for backward compatibility.
-        */
-       int convert_varargs = 1;
-       int output_error;
-
-       while ( argc > 1 && argv[1][0] == '-' ) {
-         if ( !strcmp(argv[1], "--varargs") ) {
-           convert_varargs = 1;
-           argc--;
-           argv++;
-           continue;
-         }
-         if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
-           filename = argv[2];
-           argc -= 2;
-           argv += 2;
-           continue;
-         }
-         fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name,
-                 argv[1]);
-         fprintf(stderr, usage);
-         exit(1);
-       }
-       switch ( argc )
-          {
-       default:
-               fprintf(stderr, usage);
-               exit(0);
-       case 3:
-               output_name = argv[2];
-               out = fopen(output_name, "w");
-               if ( out == NULL ) {
-                 fprintf(stderr, "%s: Cannot open output file %s\n",
-                         program_name, output_name);
-                 exit(1);
-               }
-               /* falls through */
-       case 2:
-               in = fopen(argv[1], "r");
-               if ( in == NULL ) {
-                 fprintf(stderr, "%s: Cannot open input file %s\n",
-                         program_name, argv[1]);
-                 exit(1);
-               }
-               if ( filename == 0 )
-                 filename = argv[1];
-               /* falls through */
-       case 1:
-               break;
-          }
-       if ( filename )
-         fprintf(out, "#line 1 \"%s\"\n", filename);
-       buf = malloc(bufsize);
-       if ( buf == NULL )
-          {
-               fprintf(stderr, "Unable to allocate read buffer!\n");
-               exit(1);
-          }
-       line = buf;
-       while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
-          {
-test:          line += strlen(line);
-               switch ( test1(buf) )
-                  {
-               case 2:                 /* a function header */
-                       convert1(buf, out, 1, convert_varargs);
-                       break;
-               case 1:                 /* a function */
-                       /* Check for a { at the start of the next line. */
-                       more = ++line;
-f:                     if ( line >= buf + (bufsize - 1) ) /* overflow check */
-                         goto wl;
-                       if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
-                         goto wl;
-                       switch ( *skipspace(ppdirforward(more), 1) )
-                         {
-                         case '{':
-                           /* Definitely a function header. */
-                           convert1(buf, out, 0, convert_varargs);
-                           fputs(more, out);
-                           break;
-                         case 0:
-                           /* The next line was blank or a comment: */
-                           /* keep scanning for a non-comment. */
-                           line += strlen(line);
-                           goto f;
-                         default:
-                           /* buf isn't a function header, but */
-                           /* more might be. */
-                           fputs(buf, out);
-                           strcpy(buf, more);
-                           line = buf;
-                           goto test;
-                         }
-                       break;
-               case -1:                /* maybe the start of a function */
-                       if ( line != buf + (bufsize - 1) ) /* overflow check */
-                         continue;
-                       /* falls through */
-               default:                /* not a function */
-wl:                    fputs(buf, out);
-                       break;
-                  }
-               line = buf;
-          }
-       if ( line != buf )
-         fputs(buf, out);
-       free(buf);
-       if ( output_name ) {
-         output_error = ferror(out);
-         output_error |= fclose(out);
-       } else {                /* out == stdout */
-         fflush(out);
-         output_error = ferror(out);
-       }
-       if ( output_error ) {
-         fprintf(stderr, "%s: error writing to %s\n", program_name,
-                 (output_name ? output_name : "stdout"));
-         exit(1);
-       }
-       if ( in != stdin )
-         fclose(in);
-       return 0;
-}
-
-/*
- * Skip forward or backward over one or more preprocessor directives.
- */
-char *
-ppdirforward(p)
-    char *p;
-{
-    for (; *p == '#'; ++p) {
-       for (; *p != '\r' && *p != '\n'; ++p)
-           if (*p == 0)
-               return p;
-       if (*p == '\r' && p[1] == '\n')
-           ++p;
-    }
-    return p;
-}
-char *
-ppdirbackward(p, limit)
-    char *p;
-    char *limit;
-{
-    char *np = p;
-
-    for (;; p = --np) {
-       if (*np == '\n' && np[-1] == '\r')
-           --np;
-       for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np)
-           if (np[-1] == 0)
-               return np;
-       if (*np != '#')
-           return p;
-    }
-}
-
-/*
- * Skip over whitespace, comments, and preprocessor directives,
- * in either direction.
- */
-char *
-skipspace(p, dir)
-    char *p;
-    int dir;                   /* 1 for forward, -1 for backward */
-{
-    for ( ; ; ) {
-       while ( is_space(*p) )
-           p += dir;
-       if ( !(*p == '/' && p[dir] == '*') )
-           break;
-       p += dir;  p += dir;
-       while ( !(*p == '*' && p[dir] == '/') ) {
-           if ( *p == 0 )
-               return p;       /* multi-line comment?? */
-           p += dir;
-       }
-       p += dir;  p += dir;
-    }
-    return p;
-}
-
-/* Scan over a quoted string, in either direction. */
-char *
-scanstring(p, dir)
-    char *p;
-    int dir;
-{
-    for (p += dir; ; p += dir)
-       if (*p == '"' && p[-dir] != '\\')
-           return p + dir;
-}
-
-/*
- * Write blanks over part of a string.
- * Don't overwrite end-of-line characters.
- */
-int
-writeblanks(start, end)
-    char *start;
-    char *end;
-{      char *p;
-       for ( p = start; p < end; p++ )
-         if ( *p != '\r' && *p != '\n' )
-           *p = ' ';
-       return 0;
-}
-
-/*
- * Test whether the string in buf is a function definition.
- * The string may contain and/or end with a newline.
- * Return as follows:
- *     0 - definitely not a function definition;
- *     1 - definitely a function definition;
- *     2 - definitely a function prototype (NOT USED);
- *     -1 - may be the beginning of a function definition,
- *             append another line and look again.
- * The reason we don't attempt to convert function prototypes is that
- * Ghostscript's declaration-generating macros look too much like
- * prototypes, and confuse the algorithms.
- */
-int
-test1(buf)
-    char *buf;
-{      char *p = buf;
-       char *bend;
-       char *endfn;
-       int contin;
-
-       if ( !isidfirstchar(*p) )
-         return 0;             /* no name at left margin */
-       bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -1);
-       switch ( *bend )
-          {
-          case ';': contin = 0 /*2*/; break;
-          case ')': contin = 1; break;
-          case '{': return 0;          /* not a function */
-          case '}': return 0;          /* not a function */
-          default: contin = -1;
-          }
-       while ( isidchar(*p) )
-         p++;
-       endfn = p;
-       p = skipspace(p, 1);
-       if ( *p++ != '(' )
-         return 0;             /* not a function */
-       p = skipspace(p, 1);
-       if ( *p == ')' )
-         return 0;             /* no parameters */
-       /* Check that the apparent function name isn't a keyword. */
-       /* We only need to check for keywords that could be followed */
-       /* by a left parenthesis (which, unfortunately, is most of them). */
-          {    static char *words[] =
-                  {    "asm", "auto", "case", "char", "const", "double",
-                       "extern", "float", "for", "if", "int", "long",
-                       "register", "return", "short", "signed", "sizeof",
-                       "static", "switch", "typedef", "unsigned",
-                       "void", "volatile", "while", 0
-                  };
-               char **key = words;
-               char *kp;
-               unsigned len = endfn - buf;
-
-               while ( (kp = *key) != 0 )
-                  {    if ( strlen(kp) == len && !strncmp(kp, buf, len) )
-                         return 0;     /* name is a keyword */
-                       key++;
-                  }
-          }
-          {
-              char *id = p;
-              int len;
-              /*
-               * Check for identifier1(identifier2) and not
-               * identifier1(void), or identifier1(identifier2, xxxx).
-               */
-
-              while ( isidchar(*p) )
-                  p++;
-              len = p - id;
-              p = skipspace(p, 1);
-              if (*p == ',' ||
-                  (*p == ')' && (len != 4 || strncmp(id, "void", 4)))
-                  )
-                  return 0;    /* not a function */
-          }
-       /*
-        * If the last significant character was a ), we need to count
-        * parentheses, because it might be part of a formal parameter
-        * that is a procedure.
-        */
-       if (contin > 0) {
-           int level = 0;
-
-           for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1))
-               level += (*p == '(' ? 1 : *p == ')' ? -1 : 0);
-           if (level > 0)
-               contin = -1;
-       }
-       return contin;
-}
-
-/* Convert a recognized function definition or header to K&R syntax. */
-int
-convert1(buf, out, header, convert_varargs)
-    char *buf;
-    FILE *out;
-    int header;                        /* Boolean */
-    int convert_varargs;       /* Boolean */
-{      char *endfn;
-       char *p;
-       /*
-        * The breaks table contains pointers to the beginning and end
-        * of each argument.
-        */
-       char **breaks;
-       unsigned num_breaks = 2;        /* for testing */
-       char **btop;
-       char **bp;
-       char **ap;
-       char *vararg = 0;
-
-       /* Pre-ANSI implementations don't agree on whether strchr */
-       /* is called strchr or index, so we open-code it here. */
-       for ( endfn = buf; *(endfn++) != '('; )
-         ;
-top:   p = endfn;
-       breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
-       if ( breaks == NULL )
-          {    /* Couldn't allocate break table, give up */
-               fprintf(stderr, "Unable to allocate break table!\n");
-               fputs(buf, out);
-               return -1;
-          }
-       btop = breaks + num_breaks * 2 - 2;
-       bp = breaks;
-       /* Parse the argument list */
-       do
-          {    int level = 0;
-               char *lp = NULL;
-               char *rp = NULL;
-               char *end = NULL;
-
-               if ( bp >= btop )
-                  {    /* Filled up break table. */
-                       /* Allocate a bigger one and start over. */
-                       free((char *)breaks);
-                       num_breaks <<= 1;
-                       goto top;
-                  }
-               *bp++ = p;
-               /* Find the end of the argument */
-               for ( ; end == NULL; p++ )
-                  {    switch(*p)
-                          {
-                          case ',':
-                               if ( !level ) end = p;
-                               break;
-                          case '(':
-                               if ( !level ) lp = p;
-                               level++;
-                               break;
-                          case ')':
-                               if ( --level < 0 ) end = p;
-                               else rp = p;
-                               break;
-                          case '/':
-                               if (p[1] == '*')
-                                   p = skipspace(p, 1) - 1;
-                               break;
-                          case '"':
-                              p = scanstring(p, 1) - 1;
-                              break;
-                          default:
-                               ;
-                          }
-                  }
-               /* Erase any embedded prototype parameters. */
-               if ( lp && rp )
-                 writeblanks(lp + 1, rp);
-               p--;                    /* back up over terminator */
-               /* Find the name being declared. */
-               /* This is complicated because of procedure and */
-               /* array modifiers. */
-               for ( ; ; )
-                  {    p = skipspace(p - 1, -1);
-                       switch ( *p )
-                          {
-                          case ']':    /* skip array dimension(s) */
-                          case ')':    /* skip procedure args OR name */
-                          {    int level = 1;
-                               while ( level )
-                                switch ( *--p )
-                                  {
-                                  case ']': case ')':
-                                      level++;
-                                      break;
-                                  case '[': case '(':
-                                      level--;
-                                      break;
-                                  case '/':
-                                      if (p > buf && p[-1] == '*')
-                                          p = skipspace(p, -1) + 1;
-                                      break;
-                                  case '"':
-                                      p = scanstring(p, -1) + 1;
-                                      break;
-                                  default: ;
-                                  }
-                          }
-                               if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
-                                  {    /* We found the name being declared */
-                                       while ( !isidfirstchar(*p) )
-                                         p = skipspace(p, 1) + 1;
-                                       goto found;
-                                  }
-                               break;
-                          default:
-                               goto found;
-                          }
-                  }
-found:         if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
-                 {     if ( convert_varargs )
-                         {     *bp++ = "va_alist";
-                               vararg = p-2;
-                         }
-                       else
-                         {     p++;
-                               if ( bp == breaks + 1 ) /* sole argument */
-                                 writeblanks(breaks[0], p);
-                               else
-                                 writeblanks(bp[-1] - 1, p);
-                               bp--;
-                         }
-                  }
-               else
-                  {    while ( isidchar(*p) ) p--;
-                       *bp++ = p+1;
-                  }
-               p = end;
-          }
-       while ( *p++ == ',' );
-       *bp = p;
-       /* Make a special check for 'void' arglist */
-       if ( bp == breaks+2 )
-          {    p = skipspace(breaks[0], 1);
-               if ( !strncmp(p, "void", 4) )
-                  {    p = skipspace(p+4, 1);
-                       if ( p == breaks[2] - 1 )
-                          {    bp = breaks;    /* yup, pretend arglist is empty */
-                               writeblanks(breaks[0], p + 1);
-                          }
-                  }
-          }
-       /* Put out the function name and left parenthesis. */
-       p = buf;
-       while ( p != endfn ) putc(*p, out), p++;
-       /* Put out the declaration. */
-       if ( header )
-         {     fputs(");", out);
-               for ( p = breaks[0]; *p; p++ )
-                 if ( *p == '\r' || *p == '\n' )
-                   putc(*p, out);
-         }
-       else
-         {     for ( ap = breaks+1; ap < bp; ap += 2 )
-                 {     p = *ap;
-                       while ( isidchar(*p) )
-                         putc(*p, out), p++;
-                       if ( ap < bp - 1 )
-                         fputs(", ", out);
-                 }
-               fputs(")  ", out);
-               /* Put out the argument declarations */
-               for ( ap = breaks+2; ap <= bp; ap += 2 )
-                 (*ap)[-1] = ';';
-               if ( vararg != 0 )
-                 {     *vararg = 0;
-                       fputs(breaks[0], out);          /* any prior args */
-                       fputs("va_dcl", out);           /* the final arg */
-                       fputs(bp[0], out);
-                 }
-               else
-                 fputs(breaks[0], out);
-         }
-       free((char *)breaks);
-       return 0;
-}
diff --git a/lib/ar-lib b/lib/ar-lib
new file mode 100755 (executable)
index 0000000..c0286a4
--- /dev/null
@@ -0,0 +1,265 @@
+#! /bin/sh
+# Wrapper for Microsoft lib.exe
+
+me=ar-lib
+scriptversion=2012-01-30.22; # UTC
+
+# Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+# Written by Peter Rosin <peda@lysator.liu.se>.
+#
+# 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/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+
+# func_error message
+func_error ()
+{
+  echo "$me: $1" 1>&2
+  exit 1
+}
+
+file_conv=
+
+# func_file_conv build_file
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[!/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+       # lazily determine how to convert abs files
+       case `uname -s` in
+         MINGW*)
+           file_conv=mingw
+           ;;
+         CYGWIN*)
+           file_conv=cygwin
+           ;;
+         *)
+           file_conv=wine
+           ;;
+       esac
+      fi
+      case $file_conv in
+       mingw)
+         file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+         ;;
+       cygwin)
+         file=`cygpath -m "$file" || echo "$file"`
+         ;;
+       wine)
+         file=`winepath -w "$file" || echo "$file"`
+         ;;
+      esac
+      ;;
+  esac
+}
+
+# func_at_file at_file operation archive
+# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE
+# for each of them.
+# When interpreting the content of the @FILE, do NOT use func_file_conv,
+# since the user would need to supply preconverted file names to
+# binutils ar, at least for MinGW.
+func_at_file ()
+{
+  operation=$2
+  archive=$3
+  at_file_contents=`cat "$1"`
+  eval set x "$at_file_contents"
+  shift
+
+  for member
+  do
+    $AR -NOLOGO $operation:"$member" "$archive" || exit $?
+  done
+}
+
+case $1 in
+  '')
+     func_error "no command.  Try '$0 --help' for more information."
+     ;;
+  -h | --h*)
+    cat <<EOF
+Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...]
+
+Members may be specified in a file named with @FILE.
+EOF
+    exit $?
+    ;;
+  -v | --v*)
+    echo "$me, version $scriptversion"
+    exit $?
+    ;;
+esac
+
+if test $# -lt 3; then
+  func_error "you must specify a program, an action and an archive"
+fi
+
+AR=$1
+shift
+while :
+do
+  if test $# -lt 2; then
+    func_error "you must specify a program, an action and an archive"
+  fi
+  case $1 in
+    -lib | -LIB \
+    | -ltcg | -LTCG \
+    | -machine* | -MACHINE* \
+    | -subsystem* | -SUBSYSTEM* \
+    | -verbose | -VERBOSE \
+    | -wx* | -WX* )
+      AR="$AR $1"
+      shift
+      ;;
+    *)
+      action=$1
+      shift
+      break
+      ;;
+  esac
+done
+orig_archive=$1
+shift
+func_file_conv "$orig_archive"
+archive=$file
+
+# strip leading dash in $action
+action=${action#-}
+
+delete=
+extract=
+list=
+replace=
+create=
+
+while test -n "$action"
+do
+  case $action in
+    d*) delete=yes  ;;
+    x*) extract=yes ;;
+    t*) list=yes    ;;
+    r*) replace=yes ;;
+    c*) create=yes  ;;
+    u*)             ;; # TODO: don't ignore the update modifier
+    v*)             ;; # TODO: don't ignore the verbose modifier
+    *)
+      func_error "unknown action specified"
+      ;;
+  esac
+  action=${action#?}
+done
+
+case $delete$extract$list$replace in
+  yes)
+    ;;
+  yesyes*)
+    func_error "more than one action specified"
+    ;;
+  *)
+    func_error "no action specified"
+    ;;
+esac
+
+if test -n "$delete"; then
+  if test ! -f "$orig_archive"; then
+    func_error "archive not found"
+  fi
+  for member
+  do
+    case $1 in
+      @*)
+        func_at_file "${1#@}" -REMOVE "$archive"
+        ;;
+      *)
+        func_file_conv "$1"
+        $AR -NOLOGO -REMOVE:"$file" "$archive" || exit $?
+        ;;
+    esac
+  done
+
+elif test -n "$extract"; then
+  if test ! -f "$orig_archive"; then
+    func_error "archive not found"
+  fi
+  if test $# -gt 0; then
+    for member
+    do
+      case $1 in
+        @*)
+          func_at_file "${1#@}" -EXTRACT "$archive"
+          ;;
+        *)
+          func_file_conv "$1"
+          $AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $?
+          ;;
+      esac
+    done
+  else
+    $AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member
+    do
+      $AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $?
+    done
+  fi
+
+elif test -n "$replace"; then
+  if test ! -f "$orig_archive"; then
+    if test -z "$create"; then
+      echo "$me: creating $orig_archive"
+    fi
+    orig_archive=
+  else
+    orig_archive=$archive
+  fi
+
+  for member
+  do
+    case $1 in
+    @*)
+      func_file_conv "${1#@}"
+      set x "$@" "@$file"
+      ;;
+    *)
+      func_file_conv "$1"
+      set x "$@" "$file"
+      ;;
+    esac
+    shift
+    shift
+  done
+
+  if test -n "$orig_archive"; then
+    $AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $?
+  else
+    $AR -NOLOGO -OUT:"$archive" "$@" || exit $?
+  fi
+
+elif test -n "$list"; then
+  if test ! -f "$orig_archive"; then
+    func_error "archive not found"
+  fi
+  $AR -NOLOGO -LIST "$archive" || exit $?
+fi
index c0096a7..b1f4749 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
-# Wrapper for compilers which do not understand `-c -o'.
+# Wrapper for compilers which do not understand '-c -o'.
 
-scriptversion=2009-10-06.20; # UTC
+scriptversion=2012-01-04.17; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009  Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009, 2010, 2012 Free
+# Software Foundation, Inc.
 # Written by Tom Tromey <tromey@cygnus.com>.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -29,21 +29,186 @@ scriptversion=2009-10-06.20; # UTC
 # bugs to <bug-automake@gnu.org> or send patches to
 # <automake-patches@gnu.org>.
 
+nl='
+'
+
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent tools from complaining about whitespace usage.
+IFS=" ""       $nl"
+
+file_conv=
+
+# func_file_conv build_file lazy
+# Convert a $build file to $host form and store it in $file
+# Currently only supports Windows hosts. If the determined conversion
+# type is listed in (the comma separated) LAZY, no conversion will
+# take place.
+func_file_conv ()
+{
+  file=$1
+  case $file in
+    / | /[!/]*) # absolute file, and not a UNC file
+      if test -z "$file_conv"; then
+       # lazily determine how to convert abs files
+       case `uname -s` in
+         MINGW*)
+           file_conv=mingw
+           ;;
+         CYGWIN*)
+           file_conv=cygwin
+           ;;
+         *)
+           file_conv=wine
+           ;;
+       esac
+      fi
+      case $file_conv/,$2, in
+       *,$file_conv,*)
+         ;;
+       mingw/*)
+         file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
+         ;;
+       cygwin/*)
+         file=`cygpath -m "$file" || echo "$file"`
+         ;;
+       wine/*)
+         file=`winepath -w "$file" || echo "$file"`
+         ;;
+      esac
+      ;;
+  esac
+}
+
+# func_cl_wrapper cl arg...
+# Adjust compile command to suit cl
+func_cl_wrapper ()
+{
+  # Assume a capable shell
+  lib_path=
+  shared=:
+  linker_opts=
+  for arg
+  do
+    if test -n "$eat"; then
+      eat=
+    else
+      case $1 in
+       -o)
+         # configure might choose to run compile as 'compile cc -o foo foo.c'.
+         eat=1
+         case $2 in
+           *.o | *.[oO][bB][jJ])
+             func_file_conv "$2"
+             set x "$@" -Fo"$file"
+             shift
+             ;;
+           *)
+             func_file_conv "$2"
+             set x "$@" -Fe"$file"
+             shift
+             ;;
+         esac
+         ;;
+       -I*)
+         func_file_conv "${1#-I}" mingw
+         set x "$@" -I"$file"
+         shift
+         ;;
+       -l*)
+         lib=${1#-l}
+         found=no
+         save_IFS=$IFS
+         IFS=';'
+         for dir in $lib_path $LIB
+         do
+           IFS=$save_IFS
+           if $shared && test -f "$dir/$lib.dll.lib"; then
+             found=yes
+             set x "$@" "$dir/$lib.dll.lib"
+             break
+           fi
+           if test -f "$dir/$lib.lib"; then
+             found=yes
+             set x "$@" "$dir/$lib.lib"
+             break
+           fi
+         done
+         IFS=$save_IFS
+
+         test "$found" != yes && set x "$@" "$lib.lib"
+         shift
+         ;;
+       -L*)
+         func_file_conv "${1#-L}"
+         if test -z "$lib_path"; then
+           lib_path=$file
+         else
+           lib_path="$lib_path;$file"
+         fi
+         linker_opts="$linker_opts -LIBPATH:$file"
+         ;;
+       -static)
+         shared=false
+         ;;
+       -Wl,*)
+         arg=${1#-Wl,}
+         save_ifs="$IFS"; IFS=','
+         for flag in $arg; do
+           IFS="$save_ifs"
+           linker_opts="$linker_opts $flag"
+         done
+         IFS="$save_ifs"
+         ;;
+       -Xlinker)
+         eat=1
+         linker_opts="$linker_opts $2"
+         ;;
+       -*)
+         set x "$@" "$1"
+         shift
+         ;;
+       *.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
+         func_file_conv "$1"
+         set x "$@" -Tp"$file"
+         shift
+         ;;
+       *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
+         func_file_conv "$1" mingw
+         set x "$@" "$file"
+         shift
+         ;;
+       *)
+         set x "$@" "$1"
+         shift
+         ;;
+      esac
+    fi
+    shift
+  done
+  if test -n "$linker_opts"; then
+    linker_opts="-link$linker_opts"
+  fi
+  exec "$@" $linker_opts
+  exit 1
+}
+
+eat=
+
 case $1 in
   '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
      exit 1;
      ;;
   -h | --h*)
     cat <<\EOF
 Usage: compile [--help] [--version] PROGRAM [ARGS]
 
-Wrapper for compilers which do not understand `-c -o'.
-Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
+Wrapper for compilers which do not understand '-c -o'.
+Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
 arguments, and rename the output as expected.
 
 If you are trying to build a whole package this is not the
-right script to run: please start by reading the file `INSTALL'.
+right script to run: please start by reading the file 'INSTALL'.
 
 Report bugs to <bug-automake@gnu.org>.
 EOF
@@ -53,11 +218,13 @@ EOF
     echo "compile $scriptversion"
     exit $?
     ;;
+  cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
+    func_cl_wrapper "$@"      # Doesn't return...
+    ;;
 esac
 
 ofile=
 cfile=
-eat=
 
 for arg
 do
@@ -66,8 +233,8 @@ do
   else
     case $1 in
       -o)
-       # configure might choose to run compile as `compile cc -o foo foo.c'.
-       # So we strip `-o arg' only if arg is an object.
+       # configure might choose to run compile as 'compile cc -o foo foo.c'.
+       # So we strip '-o arg' only if arg is an object.
        eat=1
        case $2 in
          *.o | *.obj)
@@ -94,10 +261,10 @@ do
 done
 
 if test -z "$ofile" || test -z "$cfile"; then
-  # If no `-o' option was seen then we might have been invoked from a
+  # If no '-o' option was seen then we might have been invoked from a
   # pattern rule where we don't need one.  That is ok -- this is a
   # normal compilation that the losing compiler can handle.  If no
-  # `.c' file was seen then we are probably linking.  That is also
+  # '.c' file was seen then we are probably linking.  That is also
   # ok.
   exec "$@"
 fi
@@ -106,7 +273,7 @@ fi
 cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
 
 # Create the lock directory.
-# Note: use `[/\\:.-]' here to ensure that we don't use the same name
+# Note: use '[/\\:.-]' here to ensure that we don't use the same name
 # that we are using for the .o file.  Also, base the name on the expected
 # object file name, since that is what matters with a parallel build.
 lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
index 5621fd4..2c30282 100755 (executable)
@@ -1,10 +1,10 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2011-12-04.11; # UTC
+scriptversion=2012-02-03.15; # UTC
 
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2011,
-# Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
+# 2011, 2012 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
@@ -28,7 +28,7 @@ scriptversion=2011-12-04.11; # UTC
 
 case $1 in
   '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
+     echo "$0: No command.  Try '$0 --help' for more information." 1>&2
      exit 1;
      ;;
   -h | --h*)
@@ -40,8 +40,8 @@ as side-effects.
 
 Environment variables:
   depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
+  source      Source file read by 'PROGRAMS ARGS'.
+  object      Object file output by 'PROGRAMS ARGS'.
   DEPDIR      directory where to store dependencies.
   depfile     Dependency file to output.
   tmpdepfile  Temporary file to use when outputting dependencies.
@@ -57,6 +57,12 @@ EOF
     ;;
 esac
 
+# A tabulation character.
+tab='  '
+# A newline character.
+nl='
+'
+
 if test -z "$depmode" || test -z "$source" || test -z "$object"; then
   echo "depcomp: Variables source, object and depmode must be set" 1>&2
   exit 1
@@ -90,10 +96,18 @@ if test "$depmode" = msvcmsys; then
    # This is just like msvisualcpp but w/o cygpath translation.
    # Just convert the backslash-escaped backslashes to single forward
    # slashes to satisfy depend.m4
-   cygpath_u="sed s,\\\\\\\\,/,g"
+   cygpath_u='sed s,\\\\,/,g'
    depmode=msvisualcpp
 fi
 
+if test "$depmode" = msvc7msys; then
+   # This is just like msvc7 but w/o cygpath translation.
+   # Just convert the backslash-escaped backslashes to single forward
+   # slashes to satisfy depend.m4
+   cygpath_u='sed s,\\\\,/,g'
+   depmode=msvc7
+fi
+
 case "$depmode" in
 gcc3)
 ## gcc 3 implements dependency tracking that does exactly what
@@ -148,15 +162,14 @@ gcc)
 ## The second -e expression handles DOS-style file names with drive letters.
   sed -e 's/^[^:]*: / /' \
       -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
+## This next piece of magic avoids the "deleted header file" problem.
 ## The problem is that when a header file which appears in a .P file
 ## is deleted, the dependency causes make to die (because there is
 ## typically no way to rebuild the header).  We avoid this by adding
 ## dummy dependencies for each header file.  Too bad gcc doesn't do
 ## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
+  tr ' ' "$nl" < "$tmpdepfile" |
+## Some versions of gcc put a space before the ':'.  On the theory
 ## that the space means something, we add a space to the output as
 ## well.  hp depmode also adds that space, but also prefixes the VPATH
 ## to the object.  Take care to not repeat it in the output.
@@ -195,18 +208,15 @@ sgi)
     # clever and replace this with sed code, as IRIX sed won't handle
     # lines with more than a fixed number of characters (4096 in
     # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
+    # the IRIX cc adds comments like '#:fec' to the end of the
     # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
+    tr ' ' "$nl" < "$tmpdepfile" \
     | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> "$depfile"
+    tr "$nl" ' ' >> "$depfile"
     echo >> "$depfile"
 
     # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
+    tr ' ' "$nl" < "$tmpdepfile" \
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
    >> "$depfile"
   else
@@ -221,7 +231,7 @@ sgi)
 aix)
   # The C for AIX Compiler uses -M and outputs the dependencies
   # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
+  # current directory.  Also, the AIX compiler puts '$object:' at the
   # start of each line; $object doesn't have directory information.
   # Version 6 uses the directory in both cases.
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
@@ -251,12 +261,11 @@ aix)
     test -f "$tmpdepfile" && break
   done
   if test -f "$tmpdepfile"; then
-    # Each line is of the form `foo.o: dependent.h'.
+    # Each line is of the form 'foo.o: dependent.h'.
     # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
+    # '$object: dependent.h' and one to simply 'dependent.h:'.
     sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-    # That's a tab and a space in the [].
-    sed -e 's,^.*\.[a-z]*:[     ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+    sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
   else
     # The sourcefile does not contain any dependencies, so just
     # store a dummy comment line, to avoid errors with the Makefile
@@ -267,7 +276,7 @@ aix)
   ;;
 
 icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
+  # Intel's C compiler understands '-MD -MF file'.  However on
   #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
   # ICC 7.0 will fill foo.d with something like
   #    foo.o: sub/foo.c
@@ -292,10 +301,10 @@ icc)
     exit $stat
   fi
   rm -f "$depfile"
-  # Each line is of the form `foo.o: dependent.h',
-  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+  # Each line is of the form 'foo.o: dependent.h',
+  # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
   # Do two passes, one to just change these to
-  # `$object: dependent.h' and one to simply `dependent.h:'.
+  # '$object: dependent.h' and one to simply 'dependent.h:'.
   sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
   # Some versions of the HPUX 10.20 sed can't process this invocation
   # correctly.  Breaking it into two sed invocations is a workaround.
@@ -336,7 +345,7 @@ hp2)
   done
   if test -f "$tmpdepfile"; then
     sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
-    # Add `dependent.h:' lines.
+    # Add 'dependent.h:' lines.
     sed -ne '2,${
               s/^ *//
               s/ \\*$//
@@ -351,9 +360,9 @@ hp2)
 
 tru64)
    # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # effect.  'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
    # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
+   # dependencies in 'foo.d' instead, so we check for that too.
    # Subdirectories are respected.
    dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
    test "x$dir" = "x$object" && dir=
@@ -399,14 +408,59 @@ tru64)
    done
    if test -f "$tmpdepfile"; then
       sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+      sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
    else
       echo "#dummy" > "$depfile"
    fi
    rm -f "$tmpdepfile"
    ;;
 
+msvc7)
+  if test "$libtool" = yes; then
+    showIncludes=-Wc,-showIncludes
+  else
+    showIncludes=-showIncludes
+  fi
+  "$@" $showIncludes > "$tmpdepfile"
+  stat=$?
+  grep -v '^Note: including file: ' "$tmpdepfile"
+  if test "$stat" = 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  # The first sed program below extracts the file names and escapes
+  # backslashes for cygpath.  The second sed program outputs the file
+  # name when reading, but also accumulates all include files in the
+  # hold buffer in order to output them again at the end.  This only
+  # works with sed implementations that can handle large buffers.
+  sed < "$tmpdepfile" -n '
+/^Note: including file:  *\(.*\)/ {
+  s//\1/
+  s/\\/\\\\/g
+  p
+}' | $cygpath_u | sort -u | sed -n '
+s/ /\\ /g
+s/\(.*\)/'"$tab"'\1 \\/p
+s/.\(.*\) \\/\1:/
+H
+$ {
+  s/.*/'"$tab"'/
+  G
+  p
+}' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvc7msys)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
 #nosideeffect)
   # This comment above is used by automake to tell side-effect
   # dependency tracking mechanisms from slower ones.
@@ -424,7 +478,7 @@ dashmstdout)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -444,15 +498,14 @@ dashmstdout)
   done
 
   test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
+  # Require at least two characters before searching for ':'
   # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+  # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
   "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
+    sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
   rm -f "$depfile"
   cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
+  tr ' ' "$nl" < "$tmpdepfile" | \
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -508,8 +561,7 @@ makedepend)
   # makedepend may prepend the VPATH from the source file name to the object.
   # No need to regex-escape $object, excess matching of '.' is harmless.
   sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
+  sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
     sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -529,7 +581,7 @@ cpp)
     shift
   fi
 
-  # Remove `-o $object'.
+  # Remove '-o $object'.
   IFS=" "
   for arg
   do
@@ -598,8 +650,8 @@ msvisualcpp)
   sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
   rm -f "$depfile"
   echo "$object : \\" > "$depfile"
-  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::     \1 \\:p' >> "$depfile"
-  echo "       " >> "$depfile"
+  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+  echo "$tab" >> "$depfile"
   sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
index ecc6b15..4e9cccd 100755 (executable)
@@ -30,16 +30,16 @@ scriptversion=2010-02-06.18; # UTC
 
 case $1 in
   '')
-     echo "$0: No files.  Try \`$0 --help' for more information." 1>&2
+     echo "$0: No files.  Try '$0 --help' for more information." 1>&2
      exit 1;
      ;;
   -h | --h*)
     cat <<\EOF
 Usage: elisp-comp [--help] [--version] FILES...
 
-This script byte-compiles all `.el' files listed as FILES using GNU
-Emacs, and put the resulting `.elc' files into the current directory,
-so disregarding the original directories used in `.el' arguments.
+This script byte-compiles all '.el' files listed as FILES using GNU
+Emacs, and put the resulting '.elc' files into the current directory,
+so disregarding the original directories used in '.el' arguments.
 
 This script manages in such a way that all Emacs LISP files to
 be compiled are made visible between themselves, in the event
index a9244eb..377bb86 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # install - install a program, script, or datafile
 
-scriptversion=2011-01-19.21; # UTC
+scriptversion=2011-11-20.07; # UTC
 
 # This originates from X11R5 (mit/util/scripts/install.sh), which was
 # later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,7 +35,7 @@ scriptversion=2011-01-19.21; # UTC
 # FSF changes to this file are in the public domain.
 #
 # Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
+# 'make' implicit rules from creating a file called install from it
 # when there is no Makefile.
 #
 # This script is compatible with the BSD install script, but was written
@@ -156,7 +156,7 @@ while test $# -ne 0; do
     -s) stripcmd=$stripprog;;
 
     -t) dst_arg=$2
-       # Protect names problematic for `test' and other utilities.
+       # Protect names problematic for 'test' and other utilities.
        case $dst_arg in
          -* | [=\(\)!]) dst_arg=./$dst_arg;;
        esac
@@ -190,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
     fi
     shift # arg
     dst_arg=$arg
-    # Protect names problematic for `test' and other utilities.
+    # Protect names problematic for 'test' and other utilities.
     case $dst_arg in
       -* | [=\(\)!]) dst_arg=./$dst_arg;;
     esac
@@ -202,7 +202,7 @@ if test $# -eq 0; then
     echo "$0: no input file specified." >&2
     exit 1
   fi
-  # It's OK to call `install-sh -d' without argument.
+  # It's OK to call 'install-sh -d' without argument.
   # This can happen when creating conditional directories.
   exit 0
 fi
@@ -240,7 +240,7 @@ fi
 
 for src
 do
-  # Protect names problematic for `test' and other utilities.
+  # Protect names problematic for 'test' and other utilities.
   case $src in
     -* | [=\(\)!]) src=./$src;;
   esac
@@ -354,7 +354,7 @@ do
              if test -z "$dir_arg" || {
                   # Check for POSIX incompatibilities with -m.
                   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
-                  # other-writeable bit of parent directory when it shouldn't.
+                  # other-writable bit of parent directory when it shouldn't.
                   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
                   ls_ld_tmpdir=`ls -ld "$tmpdir"`
                   case $ls_ld_tmpdir in
index 60dc485..3e0858e 100755 (executable)
@@ -40,7 +40,7 @@ fi
 
 case $1 in
   '')
-     echo "$0: No file.  Try \`$0 --help' for more information." 1>&2
+     echo "$0: No file.  Try '$0 --help' for more information." 1>&2
      exit 1;
      ;;
   -h | --h*)
@@ -76,7 +76,7 @@ LC_TIME=C
 export LC_TIME
 
 # GNU ls changes its time format in response to the TIME_STYLE
-# variable.  Since we cannot assume `unset' works, revert this
+# variable.  Since we cannot assume 'unset' works, revert this
 # variable to its documented default.
 if test "${TIME_STYLE+set}" = set; then
   TIME_STYLE=posix-long-iso
@@ -96,14 +96,14 @@ if ls -n /dev/null 1>/dev/null 2>&1; then
   ls_command="$ls_command -n"
 fi
 
-# A `ls -l' line looks as follows on OS/2.
+# A 'ls -l' line looks as follows on OS/2.
 #  drwxrwx---        0 Aug 11  2001 foo
 # This differs from Unix, which adds ownership information.
 #  drwxrwx---   2 root  root      4096 Aug 11  2001 foo
 #
 # To find the date, we split the line on spaces and iterate on words
 # until we find a month.  This cannot work with files whose owner is a
-# user named `Jan', or `Feb', etc.  However, it's unlikely that `/'
+# user named "Jan", or "Feb", etc.  However, it's unlikely that '/'
 # will be owned by a user whose name is a month.  So we first look at
 # the extended ls output of the root directory to decide how many
 # words should be skipped to get the date.
@@ -116,7 +116,7 @@ month=
 command=
 until test $month
 do
-  test $# -gt 0 || error "failed parsing \`$ls_command /' output"
+  test $# -gt 0 || error "failed parsing '$ls_command /' output"
   shift
   # Add another shift to the command.
   command="$command shift;"
@@ -136,7 +136,7 @@ do
   esac
 done
 
-test -n "$month" || error "failed parsing \`$ls_command /' output"
+test -n "$month" || error "failed parsing '$ls_command /' output"
 
 # Get the extended ls output of the file or directory.
 set dummy x`eval "$ls_command \"\\\$save_arg1\""`
index 86a8fc3..3f2dfc1 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Common stub for a few missing GNU programs while installing.
 
-scriptversion=2012-01-06.13; # UTC
+scriptversion=2012-01-06.18; # UTC
 
 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
 # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
@@ -26,7 +26,7 @@ scriptversion=2012-01-06.13; # UTC
 # the same distribution terms that you use for the rest of that program.
 
 if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
+  echo 1>&2 "Try '$0 --help' for more information"
   exit 1
 fi
 
@@ -34,7 +34,7 @@ run=:
 sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
 sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
 
-# In the cases where this matters, `missing' is being run in the
+# In the cases where this matters, 'missing' is being run in the
 # srcdir already.
 if test -f configure.ac; then
   configure_ac=configure.ac
@@ -65,7 +65,7 @@ case $1 in
     echo "\
 $0 [OPTION]... PROGRAM [ARGUMENT]...
 
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
 error status if there is no known handling for PROGRAM.
 
 Options:
@@ -74,20 +74,20 @@ Options:
   --run           try to run the given command, and emulate it if it fails
 
 Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
+  aclocal      touch file 'aclocal.m4'
+  autoconf     touch file 'configure'
+  autoheader   touch file 'config.h.in'
   autom4te     touch the output file, or create a stub one
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
+  automake     touch all 'Makefile.in' files
+  bison        create 'y.tab.[ch]', if possible, from existing .[ch]
+  flex         create 'lex.yy.c', if possible, from existing .c
   help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
+  lex          create 'lex.yy.c', if possible, from existing .c
   makeinfo     touch the output file
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
+  yacc         create 'y.tab.[ch]', if possible, from existing .[ch]
 
-Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
-\`g' are ignored when checking the name.
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
 
 Send bug reports to <bug-automake@gnu.org>."
     exit $?
@@ -99,8 +99,8 @@ Send bug reports to <bug-automake@gnu.org>."
     ;;
 
   -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
+    echo 1>&2 "$0: Unknown '$1' option"
+    echo 1>&2 "Try '$0 --help' for more information"
     exit 1
     ;;
 
@@ -127,7 +127,7 @@ case $1 in
        exit 1
     elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
        # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
+       # running '$TOOL --version' or '$TOOL --help' to check whether
        # $TOOL exists and not knowing $TOOL uses missing.
        exit 1
     fi
@@ -139,27 +139,27 @@ esac
 case $program in
   aclocal*)
     echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
+WARNING: '$1' is $msg.  You should only need it if
+         you modified 'acinclude.m4' or '${configure_ac}'.  You might want
+         to install the Automake and Perl packages.  Grab them from
          any GNU archive site."
     touch aclocal.m4
     ;;
 
   autoconf*)
     echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+WARNING: '$1' is $msg.  You should only need it if
+         you modified '${configure_ac}'.  You might want to install the
+         Autoconf and GNU m4 packages.  Grab them from any GNU
          archive site."
     touch configure
     ;;
 
   autoheader*)
     echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+WARNING: '$1' is $msg.  You should only need it if
+         you modified 'acconfig.h' or '${configure_ac}'.  You might want
+         to install the Autoconf and GNU m4 packages.  Grab them
          from any GNU archive site."
     files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
     test -z "$files" && files="config.h"
@@ -176,9 +176,9 @@ WARNING: \`$1' is $msg.  You should only need it if
 
   automake*)
     echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
+WARNING: '$1' is $msg.  You should only need it if
+         you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'.
+         You might want to install the Automake and Perl packages.
          Grab them from any GNU archive site."
     find . -type f -name Makefile.am -print |
           sed 's/\.am$/.in/' |
@@ -187,10 +187,10 @@ WARNING: \`$1' is $msg.  You should only need it if
 
   autom4te*)
     echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
+WARNING: '$1' is needed, but is $msg.
          You might have modified some files without having the
          proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
+         You can get '$1' as part of Autoconf from any GNU
          archive site."
 
     file=`echo "$*" | sed -n "$sed_output"`
@@ -210,10 +210,10 @@ WARNING: \`$1' is needed, but is $msg.
 
   bison*|yacc*)
     echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
+WARNING: '$1' $msg.  You should only need it if
+         you modified a '.y' file.  You may need the Bison package
          in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
+         Bison from any GNU archive site."
     rm -f y.tab.c y.tab.h
     if test $# -ne 1; then
         eval LASTARG=\${$#}
@@ -240,10 +240,10 @@ WARNING: \`$1' $msg.  You should only need it if
 
   lex*|flex*)
     echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
+WARNING: '$1' is $msg.  You should only need it if
+         you modified a '.l' file.  You may need the Flex package
          in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
+         Flex from any GNU archive site."
     rm -f lex.yy.c
     if test $# -ne 1; then
         eval LASTARG=\${$#}
@@ -263,10 +263,10 @@ WARNING: \`$1' is $msg.  You should only need it if
 
   help2man*)
     echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
+WARNING: '$1' is $msg.  You should only need it if
         you modified a dependency of a manual page.  You may need the
-        \`Help2man' package in order for those modifications to take
-        effect.  You can get \`Help2man' from any GNU archive site."
+        Help2man package in order for those modifications to take
+        effect.  You can get Help2man from any GNU archive site."
 
     file=`echo "$*" | sed -n "$sed_output"`
     test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
@@ -281,12 +281,12 @@ WARNING: \`$1' is $msg.  You should only need it if
 
   makeinfo*)
     echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
+WARNING: '$1' is $msg.  You should only need it if
+         you modified a '.texi' or '.texinfo' file, or any other file
          indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
+         call might also be the consequence of using a buggy 'make' (AIX,
+         DU, IRIX).  You might want to install the Texinfo package or
+         the GNU make package.  Grab either from any GNU archive site."
     # The file to touch is that specified with -o ...
     file=`echo "$*" | sed -n "$sed_output"`
     test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
@@ -310,12 +310,12 @@ WARNING: \`$1' is $msg.  You should only need it if
 
   *)
     echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
+WARNING: '$1' is needed, and is $msg.
          You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
+         proper tools for further handling them.  Check the 'README' file,
          it often tells you about the needed prerequisites for installing
          this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
+         some other package would contain this missing '$1' program."
     exit 1
     ;;
 esac
index 4191a45..55d537f 100755 (executable)
@@ -81,9 +81,9 @@ case $dirmode in
       echo "mkdir -p -- $*"
       exec mkdir -p -- "$@"
     else
-      # On NextStep and OpenStep, the `mkdir' command does not
+      # On NextStep and OpenStep, the 'mkdir' command does not
       # recognize any option.  It will interpret all options as
-      # directories to create, and then abort because `.' already
+      # directories to create, and then abort because '.' already
       # exists.
       test -d ./-p && rmdir ./-p
       test -d ./--version && rmdir ./--version
diff --git a/lib/tap-driver.pl b/lib/tap-driver.pl
new file mode 100755 (executable)
index 0000000..ecc2c0c
--- /dev/null
@@ -0,0 +1,564 @@
+#! /usr/bin/env perl
+# Copyright (C) 2011, 2012 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/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# ---------------------------------- #
+#  Imports, static data, and setup.  #
+# ---------------------------------- #
+
+use warnings FATAL => 'all';
+use strict;
+use Getopt::Long ();
+use TAP::Parser;
+
+my $VERSION = '2012-02-01.19'; # UTC
+
+my $ME = "tap-driver.pl";
+
+my $USAGE = <<'END';
+Usage:
+  tap-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+             [--expect-failure={yes|no}] [--color-tests={yes|no}]
+             [--enable-hard-errors={yes|no}] [--ignore-exit]
+             [--diagnostic-string=STRING] [--merge|--no-merge]
+             [--comments|--no-comments] [--] TEST-COMMAND
+The `--test-name', `--log-file' and `--trs-file' options are mandatory.
+END
+
+my $HELP = "$ME: TAP-aware test driver for Automake testsuite harness." .
+           "\n" . $USAGE;
+
+# Keep this in sync with `lib/am/check.am:$(am__tty_colors)'.
+my %COLOR = (
+  red => "\e[0;31m",
+  grn => "\e[0;32m",
+  lgn => "\e[1;32m",
+  blu => "\e[1;34m",
+  mgn => "\e[0;35m",
+  brg => "\e[1m",
+  std => "\e[m",
+);
+
+# It's important that NO_PLAN evaluates "false" as a boolean.
+use constant NO_PLAN => 0;
+use constant EARLY_PLAN => 1;
+use constant LATE_PLAN => 2;
+
+# ------------------- #
+#  Global variables.  #
+# ------------------- #
+
+my $testno = 0;     # Number of test results seen so far.
+my $bailed_out = 0; # Whether a "Bail out!" directive has been seen.
+my $parser;         # TAP parser object (will be initialized later).
+
+# Whether the TAP plan has been seen or not, and if yes, which kind
+# it is ("early" is seen before any test result, "late" otherwise).
+my $plan_seen = NO_PLAN;
+
+# ----------------- #
+#  Option parsing.  #
+# ----------------- #
+
+my %cfg = (
+  "color-tests" => 0,
+  "expect-failure" => 0,
+  "merge" => 0,
+  "comments" => 0,
+  "ignore-exit" => 0,
+);
+
+my $test_script_name = undef;
+my $log_file = undef;
+my $trs_file = undef;
+my $diag_string = "#";
+
+Getopt::Long::GetOptions
+  (
+    'help' => sub { print $HELP; exit 0; },
+    'version' => sub { print "$ME $VERSION\n"; exit 0; },
+    'test-name=s' => \$test_script_name,
+    'log-file=s' => \$log_file,
+    'trs-file=s' => \$trs_file,
+    'color-tests=s'  => \&bool_opt,
+    'expect-failure=s'  => \&bool_opt,
+    'enable-hard-errors=s' => sub {}, # No-op.
+    'diagnostic-string=s' => \$diag_string,
+    'comments' => sub { $cfg{"comments"} = 1; },
+    'no-comments' => sub { $cfg{"comments"} = 0; },
+    'merge' => sub { $cfg{"merge"} = 1; },
+    'no-merge' => sub { $cfg{"merge"} = 0; },
+    'ignore-exit' => sub { $cfg{"ignore-exit"} = 1; },
+  ) or exit 1;
+
+# ------------- #
+#  Prototypes.  #
+# ------------- #
+
+sub add_test_result ($);
+sub bool_opt ($$);
+sub colored ($$);
+sub copy_in_global_log ();
+sub decorate_result ($);
+sub extract_tap_comment ($);
+sub finish ();
+sub get_global_test_result ();
+sub get_test_exit_message ();
+sub get_test_results ();
+sub handle_tap_bailout ($);
+sub handle_tap_plan ($);
+sub handle_tap_result ($);
+sub is_null_string ($);
+sub main (@);
+sub must_recheck ();
+sub report ($;$);
+sub setup_io ();
+sub setup_parser (@);
+sub stringify_result_obj ($);
+sub testsuite_error ($);
+sub trap_perl_warnings_and_errors ();
+sub write_test_results ();
+sub yn ($);
+
+# -------------- #
+#  Subroutines.  #
+# -------------- #
+
+sub bool_opt ($$)
+{
+  my ($opt, $val) = @_;
+  if ($val =~ /^(?:y|yes)\z/i)
+    {
+      $cfg{$opt} = 1;
+    }
+  elsif ($val =~ /^(?:n|no)\z/i)
+    {
+      $cfg{$opt} = 0;
+    }
+  else
+    {
+      die "$ME: invalid argument '$val' for option '$opt'\n";
+    }
+}
+
+# If the given string is undefined or empty, return true, otherwise
+# return false.  This function is useful to avoid pitfalls like:
+#   if ($message) { print "$message\n"; }
+# which wouldn't print anything if $message is the literal "0".
+sub is_null_string ($)
+{
+  my $str = shift;
+  return ! (defined $str and length $str);
+}
+
+# Convert a boolean to a "yes"/"no" string.
+sub yn ($)
+{
+  my $bool = shift;
+  return $bool ? "yes" : "no";
+}
+
+TEST_RESULTS :
+{
+  my (@test_results_list, %test_results_seen);
+
+  sub add_test_result ($)
+  {
+    my $res = shift;
+    push @test_results_list, $res;
+    $test_results_seen{$res} = 1;
+  }
+
+  sub get_test_results ()
+  {
+    return @test_results_list;
+  }
+
+  # Whether the test script should be re-run by "make recheck".
+  sub must_recheck ()
+  {
+    return grep { !/^(?:XFAIL|PASS|SKIP)$/ } (keys %test_results_seen);
+  }
+
+  # Whether the content of the log file associated to this test should
+  # be copied into the "global" test-suite.log.
+  sub copy_in_global_log ()
+  {
+    return grep { not $_ eq "PASS" } (keys %test_results_seen);
+  }
+
+  # FIXME: this can certainly be improved ...
+  sub get_global_test_result ()
+  {
+    return "ERROR"
+      if $test_results_seen{"ERROR"};
+    return "FAIL"
+      if $test_results_seen{"FAIL"} || $test_results_seen{"XPASS"};
+    return "SKIP"
+      if scalar keys %test_results_seen == 1 && $test_results_seen{"SKIP"};
+    return "PASS";
+  }
+
+}
+
+sub write_test_results ()
+{
+  open RES, ">", $trs_file or die "$ME: opening $trs_file: $!\n";
+  print RES ":global-test-result: " . get_global_test_result . "\n";
+  print RES ":recheck: " . yn (must_recheck) . "\n";
+  print RES ":copy-in-global-log: " . yn (copy_in_global_log) . "\n";
+  foreach my $result (get_test_results)
+    {
+      print RES ":test-result: $result\n";
+    }
+  close RES or die "$ME: closing $trs_file: $!\n";
+}
+
+sub trap_perl_warnings_and_errors ()
+{
+  $SIG{__WARN__} = $SIG{__DIE__} = sub
+    {
+      # Be sure to send the warning/error message to the original stderr
+      # (presumably the console), not into the log file.
+      open STDERR, ">&OLDERR";
+      die @_;
+    }
+}
+
+sub setup_io ()
+{
+  # Redirect stderr and stdout to a temporary log file.  Save the
+  # original stdout stream, since we need it to print testsuite
+  # progress output. Save original stderr stream, so that we can
+  # redirect warning and error messages from perl there.
+  open LOG, ">", $log_file or die "$ME: opening $log_file: $!\n";
+  open OLDOUT, ">&STDOUT" or die "$ME: duplicating stdout: $!\n";
+  open OLDERR, ">&STDERR" or die "$ME: duplicating stdout: $!\n";
+  *OLDERR = *OLDERR; # To pacify a "used only once" warning.
+  trap_perl_warnings_and_errors;
+  open STDOUT, ">&LOG" or die "$ME: redirecting stdout: $!\n";
+  open STDERR, ">&LOG" or die "$ME: redirecting stderr: $!\n";
+}
+
+sub setup_parser (@)
+{
+  local $@ = '';
+  eval { $parser = TAP::Parser->new ({exec => \@_, merge => $cfg{merge}}) };
+  if ($@ ne '')
+    {
+      # Don't use the error message in $@ as set by TAP::Parser, since
+      # currently it's both too generic (at the point of being basically
+      # useless) and quite long.
+      report "ERROR", "- couldn't execute test script";
+      finish;
+    }
+}
+
+sub get_test_exit_message ()
+{
+  my $wstatus = $parser->wait;
+  # Watch out for possible internal errors.
+  die "$ME: couldn't get the exit status of the TAP producer"
+    unless defined $wstatus;
+  # Return an undefined value if the producer exited with success.
+  return unless $wstatus;
+  # Otherwise, determine whether it exited with error or was terminated
+  # by a signal.
+  use POSIX qw (WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG);
+  if (WIFEXITED ($wstatus))
+  {
+    return sprintf "exited with status %d", WEXITSTATUS ($wstatus);
+  }
+  elsif (WIFSIGNALED ($wstatus))
+    {
+      return sprintf "terminated by signal %d", WTERMSIG ($wstatus);
+    }
+  else
+    {
+      return "terminated abnormally";
+    }
+}
+
+sub stringify_result_obj ($)
+{
+  my $result_obj = shift;
+  my $COOKED_PASS = $cfg{"expect-failure"} ? "XPASS": "PASS";
+  my $COOKED_FAIL = $cfg{"expect-failure"} ? "XFAIL": "FAIL";
+  if ($result_obj->is_unplanned || $result_obj->number != $testno)
+    {
+      return "ERROR";
+    }
+  elsif ($plan_seen == LATE_PLAN)
+    {
+      return "ERROR";
+    }
+  elsif (!$result_obj->directive)
+    {
+      return $result_obj->is_ok ? $COOKED_PASS: $COOKED_FAIL;
+    }
+  elsif ($result_obj->has_todo)
+    {
+      return $result_obj->is_actual_ok ? "XPASS" : "XFAIL";
+    }
+  elsif ($result_obj->has_skip)
+    {
+      return $result_obj->is_ok ? "SKIP" : $COOKED_FAIL;
+    }
+  die "$ME: INTERNAL ERROR"; # NOTREACHED
+}
+
+sub colored ($$)
+{
+  my ($color_name, $text) = @_;
+  return $COLOR{$color_name} . $text . $COLOR{'std'};
+}
+
+sub decorate_result ($)
+{
+  my $result = shift;
+  return $result unless $cfg{"color-tests"};
+  my %color_for_result =
+    (
+      "ERROR" => 'mgn',
+      "PASS"  => 'grn',
+      "XPASS" => 'red',
+      "FAIL"  => 'red',
+      "XFAIL" => 'lgn',
+      "SKIP"  => 'blu',
+    );
+  if (my $color = $color_for_result{$result})
+    {
+      return colored ($color, $result);
+    }
+  else
+    {
+      return $result; # Don't colorize unknown stuff.
+    }
+}
+
+sub report ($;$)
+{
+  my ($msg, $result, $explanation) = (undef, @_);
+  if ($result =~ /^(?:X?(?:PASS|FAIL)|SKIP|ERROR)/)
+    {
+      $msg = ": $test_script_name";
+      add_test_result $result;
+    }
+  elsif ($result eq "#")
+    {
+      $msg = " $test_script_name:";
+    }
+  else
+    {
+      die "$ME: INTERNAL ERROR"; # NOTREACHED
+    }
+  $msg .= " $explanation" if defined $explanation;
+  $msg .= "\n";
+  # Output on console might be colorized.
+  print OLDOUT decorate_result ($result) . $msg;
+  # Log the result in the log file too, to help debugging (this is
+  # especially true when said result is a TAP error or "Bail out!").
+  print $result . $msg;
+}
+
+sub testsuite_error ($)
+{
+  report "ERROR", "- $_[0]";
+}
+
+sub handle_tap_result ($)
+{
+  $testno++;
+  my $result_obj = shift;
+
+  my $test_result = stringify_result_obj $result_obj;
+  my $string = $result_obj->number;
+
+  my $description = $result_obj->description;
+  $string .= " $description"
+    unless is_null_string $description;
+
+  if ($plan_seen == LATE_PLAN)
+    {
+      $string .= " # AFTER LATE PLAN";
+    }
+  elsif ($result_obj->is_unplanned)
+    {
+      $string .= " # UNPLANNED";
+    }
+  elsif ($result_obj->number != $testno)
+    {
+      $string .= " # OUT-OF-ORDER (expecting $testno)";
+    }
+  elsif (my $directive = $result_obj->directive)
+    {
+      $string .= " # $directive";
+      my $explanation = $result_obj->explanation;
+      $string .= " $explanation"
+        unless is_null_string $explanation;
+    }
+
+  report $test_result, $string;
+}
+
+sub handle_tap_plan ($)
+{
+  my $plan = shift;
+  if ($plan_seen)
+    {
+      # Error, only one plan per stream is acceptable.
+      testsuite_error "multiple test plans";
+      return;
+    }
+  # The TAP plan can come before or after *all* the TAP results; we speak
+  # respectively of an "early" or a "late" plan.  If we see the plan line
+  # after at least one TAP result has been seen, assume we have a late
+  # plan; in this case, any further test result seen after the plan will
+  # be flagged as an error.
+  $plan_seen = ($testno >= 1 ? LATE_PLAN : EARLY_PLAN);
+  # If $testno > 0, we have an error ("too many tests run") that will be
+  # automatically dealt with later, so don't worry about it here.  If
+  # $plan_seen is true, we have an error due to a repeated plan, and that
+  # has already been dealt with above.  Otherwise, we have a valid "plan
+  # with SKIP" specification, and should report it as a particular kind
+  # of SKIP result.
+  if ($plan->directive && $testno == 0)
+    {
+      my $explanation = is_null_string ($plan->explanation) ?
+                        undef : "- " . $plan->explanation;
+      report "SKIP", $explanation;
+    }
+}
+
+sub handle_tap_bailout ($)
+{
+  my ($bailout, $msg) = ($_[0], "Bail out!");
+  $bailed_out = 1;
+  $msg .= " " . $bailout->explanation
+    unless is_null_string $bailout->explanation;
+  testsuite_error $msg;
+}
+
+sub extract_tap_comment ($)
+{
+  my $line = shift;
+  if (index ($line, $diag_string) == 0)
+    {
+      # Strip leading `$diag_string' from `$line'.
+      $line = substr ($line, length ($diag_string));
+      # And strip any leading and trailing whitespace left.
+      $line =~ s/(?:^\s*|\s*$)//g;
+      # Return what is left (if any).
+      return $line;
+    }
+  return "";
+}
+
+sub finish ()
+{
+  write_test_results;
+  close LOG or die "$ME: closing $log_file: $!\n";
+  exit 0;
+}
+
+sub main (@)
+{
+  setup_io;
+  setup_parser @_;
+
+  while (defined (my $cur = $parser->next))
+    {
+      # Verbatim copy any input line into the log file.
+      print $cur->raw . "\n";
+      # Parsing of TAP input should stop after a "Bail out!" directive.
+      next if $bailed_out;
+
+      if ($cur->is_plan)
+        {
+          handle_tap_plan ($cur);
+        }
+      elsif ($cur->is_test)
+        {
+          handle_tap_result ($cur);
+        }
+      elsif ($cur->is_bailout)
+        {
+          handle_tap_bailout ($cur);
+        }
+      elsif ($cfg{comments})
+        {
+          my $comment = extract_tap_comment ($cur->raw);
+          report "#", "$comment" if length $comment;
+       }
+    }
+  # A "Bail out!" directive should cause us to ignore any following TAP
+  # error, as well as a non-zero exit status from the TAP producer.
+  if (!$bailed_out)
+    {
+      if (!$plan_seen)
+        {
+          testsuite_error "missing test plan";
+        }
+      elsif ($parser->tests_planned != $parser->tests_run)
+        {
+          my ($planned, $run) = ($parser->tests_planned, $parser->tests_run);
+          my $bad_amount = $run > $planned ? "many" : "few";
+          testsuite_error (sprintf "too %s tests run (expected %d, got %d)",
+                                   $bad_amount, $planned, $run);
+        }
+      if (!$cfg{"ignore-exit"})
+        {
+          my $msg = get_test_exit_message ();
+          testsuite_error $msg if $msg;
+        }
+    }
+  finish;
+}
+
+# ----------- #
+#  Main code. #
+# ----------- #
+
+main @ARGV;
+
+# Local Variables:
+# perl-indent-level: 2
+# perl-continued-statement-offset: 2
+# perl-continued-brace-offset: 0
+# perl-brace-offset: 0
+# perl-brace-imaginary-offset: 0
+# perl-label-offset: -2
+# cperl-indent-level: 2
+# cperl-brace-offset: 0
+# cperl-continued-brace-offset: 0
+# cperl-label-offset: -2
+# cperl-extra-newline-before-brace: t
+# cperl-merge-trailing-else: nil
+# cperl-continued-statement-offset: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "my $VERSION = "
+# time-stamp-format: "'%:y-%02m-%02d.%02H'"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/lib/tap-driver.sh b/lib/tap-driver.sh
new file mode 100755 (executable)
index 0000000..725e779
--- /dev/null
@@ -0,0 +1,652 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+scriptversion=2011-12-27.17; # UTC
+
+# Make unconditional expansion of undefined variables an error.  This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+me=tap-driver.sh
+
+fatal ()
+{
+  echo "$me: fatal: $*" >&2
+  exit 1
+}
+
+usage_error ()
+{
+  echo "$me: $*" >&2
+  print_usage >&2
+  exit 2
+}
+
+print_usage ()
+{
+  cat <<END
+Usage:
+  tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH
+                [--expect-failure={yes|no}] [--color-tests={yes|no}]
+                [--enable-hard-errors={yes|no}] [--ignore-exit]
+                [--diagnostic-string=STRING] [--merge|--no-merge]
+                [--comments|--no-comments] [--] TEST-COMMAND
+The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
+END
+}
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $log_file, $trs_file and $test_name are defined).
+test_name= # Used for reporting.
+log_file=  # Where to save the result and output of the test script.
+trs_file=  # Where to save the metadata of the test run.
+expect_failure=0
+color_tests=0
+merge=0
+ignore_exit=0
+comments=0
+diag_string='#'
+while test $# -gt 0; do
+  case $1 in
+  --help) print_usage; exit $?;;
+  --version) echo "$me $scriptversion"; exit $?;;
+  --test-name) test_name=$2; shift;;
+  --log-file) log_file=$2; shift;;
+  --trs-file) trs_file=$2; shift;;
+  --color-tests) color_tests=$2; shift;;
+  --expect-failure) expect_failure=$2; shift;;
+  --enable-hard-errors) shift;; # No-op.
+  --merge) merge=1;;
+  --no-merge) merge=0;;
+  --ignore-exit) ignore_exit=1;;
+  --comments) comments=1;;
+  --no-comments) comments=0;;
+  --diagnostic-string) diag_string=$2; shift;;
+  --) shift; break;;
+  -*) usage_error "invalid option: '$1'";;
+  esac
+  shift
+done
+
+test $# -gt 0 || usage_error "missing test command"
+
+case $expect_failure in
+  yes) expect_failure=1;;
+    *) expect_failure=0;;
+esac
+
+if test $color_tests = yes; then
+  init_colors='
+    color_map["red"]="\e[0;31m" # Red.
+    color_map["grn"]="\e[0;32m" # Green.
+    color_map["lgn"]="\e[1;32m" # Light green.
+    color_map["blu"]="\e[1;34m" # Blue.
+    color_map["mgn"]="\e[0;35m" # Magenta.
+    color_map["std"]="\e[m"     # No color.
+    color_for_result["ERROR"] = "mgn"
+    color_for_result["PASS"]  = "grn"
+    color_for_result["XPASS"] = "red"
+    color_for_result["FAIL"]  = "red"
+    color_for_result["XFAIL"] = "lgn"
+    color_for_result["SKIP"]  = "blu"'
+else
+  init_colors=''
+fi
+
+# :; is there to work around a bug in bash 3.2 (and earlier) which
+# does not always set '$?' properly on redirection failure.
+# See the Autoconf manual for more details.
+:;{
+  (
+    # Ignore common signals (in this subshell only!), to avoid potential
+    # problems with Korn shells.  Some Korn shells are known to propagate
+    # to themselves signals that have killed a child process they were
+    # waiting for; this is done at least for SIGINT (and usually only for
+    # it, in truth).  Without the `trap' below, such a behaviour could
+    # cause a premature exit in the current subshell, e.g., in case the
+    # test command it runs gets terminated by a SIGINT.  Thus, the awk
+    # script we are piping into would never seen the exit status it
+    # expects on its last input line (which is displayed below by the
+    # last `echo $?' statement), and would thus die reporting an internal
+    # error.
+    # For more information, see the Autoconf manual and the threads:
+    # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
+    # <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
+    trap : 1 3 2 13 15
+    if test $merge -gt 0; then
+      exec 2>&1
+    else
+      exec 2>&3
+    fi
+    "$@"
+    echo $?
+  ) | LC_ALL=C ${AM_TAP_AWK-awk} \
+        -v me="$me" \
+        -v test_script_name="$test_name" \
+        -v log_file="$log_file" \
+        -v trs_file="$trs_file" \
+        -v expect_failure="$expect_failure" \
+        -v merge="$merge" \
+        -v ignore_exit="$ignore_exit" \
+        -v comments="$comments" \
+        -v diag_string="$diag_string" \
+'
+# FIXME: the usages of "cat >&3" below could be optimized when using
+# FIXME: GNU awk, and/on on systems that supports /dev/fd/.
+
+# Implementation note: in what follows, `result_obj` will be an
+# associative array that (partly) simulates a TAP result object
+# from the `TAP::Parser` perl module.
+
+## ----------- ##
+##  FUNCTIONS  ##
+## ----------- ##
+
+function fatal(msg)
+{
+  print me ": " msg | "cat >&2"
+  exit 1
+}
+
+function abort(where)
+{
+  fatal("internal error " where)
+}
+
+# Convert a boolean to a "yes"/"no" string.
+function yn(bool)
+{
+  return bool ? "yes" : "no";
+}
+
+function add_test_result(result)
+{
+  if (!test_results_index)
+    test_results_index = 0
+  test_results_list[test_results_index] = result
+  test_results_index += 1
+  test_results_seen[result] = 1;
+}
+
+# Whether the test script should be re-run by "make recheck".
+function must_recheck()
+{
+  for (k in test_results_seen)
+    if (k != "XFAIL" && k != "PASS" && k != "SKIP")
+      return 1
+  return 0
+}
+
+# Whether the content of the log file associated to this test should
+# be copied into the "global" test-suite.log.
+function copy_in_global_log()
+{
+  for (k in test_results_seen)
+    if (k != "PASS")
+      return 1
+  return 0
+}
+
+# FIXME: this can certainly be improved ...
+function get_global_test_result()
+{
+    if ("ERROR" in test_results_seen)
+      return "ERROR"
+    if ("FAIL" in test_results_seen || "XPASS" in test_results_seen)
+      return "FAIL"
+    all_skipped = 1
+    for (k in test_results_seen)
+      if (k != "SKIP")
+        all_skipped = 0
+    if (all_skipped)
+      return "SKIP"
+    return "PASS";
+}
+
+function stringify_result_obj(result_obj)
+{
+  if (result_obj["is_unplanned"] || result_obj["number"] != testno)
+    return "ERROR"
+
+  if (plan_seen == LATE_PLAN)
+    return "ERROR"
+
+  if (result_obj["directive"] == "TODO")
+    return result_obj["is_ok"] ? "XPASS" : "XFAIL"
+
+  if (result_obj["directive"] == "SKIP")
+    return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL;
+
+  if (length(result_obj["directive"]))
+      abort("in function stringify_result_obj()")
+
+  return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL
+}
+
+function decorate_result(result)
+{
+  color_name = color_for_result[result]
+  if (color_name)
+    return color_map[color_name] "" result "" color_map["std"]
+  # If we are not using colorized output, or if we do not know how
+  # to colorize the given result, we should return it unchanged.
+  return result
+}
+
+function report(result, details)
+{
+  if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/)
+    {
+      msg = ": " test_script_name
+      add_test_result(result)
+    }
+  else if (result == "#")
+    {
+      msg = " " test_script_name ":"
+    }
+  else
+    {
+      abort("in function report()")
+    }
+  if (length(details))
+    msg = msg " " details
+  # Output on console might be colorized.
+  print decorate_result(result) msg
+  # Log the result in the log file too, to help debugging (this is
+  # especially true when said result is a TAP error or "Bail out!").
+  print result msg | "cat >&3";
+}
+
+function testsuite_error(error_message)
+{
+  report("ERROR", "- " error_message)
+}
+
+function handle_tap_result()
+{
+  details = result_obj["number"];
+  if (length(result_obj["description"]))
+    details = details " " result_obj["description"]
+
+  if (plan_seen == LATE_PLAN)
+    {
+      details = details " # AFTER LATE PLAN";
+    }
+  else if (result_obj["is_unplanned"])
+    {
+       details = details " # UNPLANNED";
+    }
+  else if (result_obj["number"] != testno)
+    {
+       details = sprintf("%s # OUT-OF-ORDER (expecting %d)",
+                         details, testno);
+    }
+  else if (result_obj["directive"])
+    {
+      details = details " # " result_obj["directive"];
+      if (length(result_obj["explanation"]))
+        details = details " " result_obj["explanation"]
+    }
+
+  report(stringify_result_obj(result_obj), details)
+}
+
+# `skip_reason` should be empty whenever planned > 0.
+function handle_tap_plan(planned, skip_reason)
+{
+  planned += 0 # Avoid getting confused if, say, `planned` is "00"
+  if (length(skip_reason) && planned > 0)
+    abort("in function handle_tap_plan()")
+  if (plan_seen)
+    {
+      # Error, only one plan per stream is acceptable.
+      testsuite_error("multiple test plans")
+      return;
+    }
+  planned_tests = planned
+  # The TAP plan can come before or after *all* the TAP results; we speak
+  # respectively of an "early" or a "late" plan.  If we see the plan line
+  # after at least one TAP result has been seen, assume we have a late
+  # plan; in this case, any further test result seen after the plan will
+  # be flagged as an error.
+  plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN)
+  # If testno > 0, we have an error ("too many tests run") that will be
+  # automatically dealt with later, so do not worry about it here.  If
+  # $plan_seen is true, we have an error due to a repeated plan, and that
+  # has already been dealt with above.  Otherwise, we have a valid "plan
+  # with SKIP" specification, and should report it as a particular kind
+  # of SKIP result.
+  if (planned == 0 && testno == 0)
+    {
+      if (length(skip_reason))
+        skip_reason = "- "  skip_reason;
+      report("SKIP", skip_reason);
+    }
+}
+
+function extract_tap_comment(line)
+{
+  if (index(line, diag_string) == 1)
+    {
+      # Strip leading `diag_string` from `line`.
+      line = substr(line, length(diag_string) + 1)
+      # And strip any leading and trailing whitespace left.
+      sub("^[ \t]*", "", line)
+      sub("[ \t]*$", "", line)
+      # Return what is left (if any).
+      return line;
+    }
+  return "";
+}
+
+# When this function is called, we know that line is a TAP result line,
+# so that it matches the (perl) RE "^(not )?ok\b".
+function setup_result_obj(line)
+{
+  # Get the result, and remove it from the line.
+  result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0)
+  sub("^(not )?ok[ \t]*", "", line)
+
+  # If the result has an explicit number, get it and strip it; otherwise,
+  # automatically assing the next progresive number to it.
+  if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/)
+    {
+      match(line, "^[0-9]+")
+      # The final `+ 0` is to normalize numbers with leading zeros.
+      result_obj["number"] = substr(line, 1, RLENGTH) + 0
+      line = substr(line, RLENGTH + 1)
+    }
+  else
+    {
+      result_obj["number"] = testno
+    }
+
+  if (plan_seen == LATE_PLAN)
+    # No further test results are acceptable after a "late" TAP plan
+    # has been seen.
+    result_obj["is_unplanned"] = 1
+  else if (plan_seen && testno > planned_tests)
+    result_obj["is_unplanned"] = 1
+  else
+    result_obj["is_unplanned"] = 0
+
+  # Strip trailing and leading whitespace.
+  sub("^[ \t]*", "", line)
+  sub("[ \t]*$", "", line)
+
+  # This will have to be corrected if we have a "TODO"/"SKIP" directive.
+  result_obj["description"] = line
+  result_obj["directive"] = ""
+  result_obj["explanation"] = ""
+
+  if (index(line, "#") == 0)
+    return # No possible directive, nothing more to do.
+
+  # Directives are case-insensitive.
+  rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*"
+
+  # See whether we have the directive, and if yes, where.
+  pos = match(line, rx "$")
+  if (!pos)
+    pos = match(line, rx "[^a-zA-Z0-9_]")
+
+  # If there was no TAP directive, we have nothing more to do.
+  if (!pos)
+    return
+
+  # Let`s now see if the TAP directive has been escaped.  For example:
+  #  escaped:     ok \# SKIP
+  #  not escaped: ok \\# SKIP
+  #  escaped:     ok \\\\\# SKIP
+  #  not escaped: ok \ # SKIP
+  if (substr(line, pos, 1) == "#")
+    {
+      bslash_count = 0
+      for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--)
+        bslash_count += 1
+      if (bslash_count % 2)
+        return # Directive was escaped.
+    }
+
+  # Strip the directive and its explanation (if any) from the test
+  # description.
+  result_obj["description"] = substr(line, 1, pos - 1)
+  # Now remove the test description from the line, that has been dealt
+  # with already.
+  line = substr(line, pos)
+  # Strip the directive, and save its value (normalized to upper case).
+  sub("^[ \t]*#[ \t]*", "", line)
+  result_obj["directive"] = toupper(substr(line, 1, 4))
+  line = substr(line, 5)
+  # Now get the explanation for the directive (if any), with leading
+  # and trailing whitespace removed.
+  sub("^[ \t]*", "", line)
+  sub("[ \t]*$", "", line)
+  result_obj["explanation"] = line
+}
+
+function get_test_exit_message(status)
+{
+  if (status == 0)
+    return ""
+  if (status !~ /^[1-9][0-9]*$/)
+    abort("getting exit status")
+  if (status < 127)
+    exit_details = ""
+  else if (status == 127)
+    exit_details = " (command not found?)"
+  else if (status >= 128 && status <= 255)
+    exit_details = sprintf(" (terminated by signal %d?)", status - 128)
+  else if (status > 256 && status <= 384)
+    # We used to report an "abnormal termination" here, but some Korn
+    # shells, when a child process die due to signal number n, can leave
+    # in $? an exit status of 256+n instead of the more standard 128+n.
+    # Apparently, both behaviours are allowed by POSIX (2008), so be
+    # prepared to handle them both.  See also Austing Group report ID
+    # 0000051 <http://www.austingroupbugs.net/view.php?id=51>
+    exit_details = sprintf(" (terminated by signal %d?)", status - 256)
+  else
+    # Never seen in practice.
+    exit_details = " (abnormal termination)"
+  return sprintf("exited with status %d%s", status, exit_details)
+}
+
+function write_test_results()
+{
+  print ":global-test-result: " get_global_test_result() > trs_file
+  print ":recheck: "  yn(must_recheck()) > trs_file
+  print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file
+  for (i = 0; i < test_results_index; i += 1)
+    print ":test-result: " test_results_list[i] > trs_file
+  close(trs_file);
+}
+
+BEGIN {
+
+## ------- ##
+##  SETUP  ##
+## ------- ##
+
+'"$init_colors"'
+
+# Properly initialized once the TAP plan is seen.
+planned_tests = 0
+
+COOKED_PASS = expect_failure ? "XPASS": "PASS";
+COOKED_FAIL = expect_failure ? "XFAIL": "FAIL";
+
+# Enumeration-like constants to remember which kind of plan (if any)
+# has been seen.  It is important that NO_PLAN evaluates "false" as
+# a boolean.
+NO_PLAN = 0
+EARLY_PLAN = 1
+LATE_PLAN = 2
+
+testno = 0     # Number of test results seen so far.
+bailed_out = 0 # Whether a "Bail out!" directive has been seen.
+
+# Whether the TAP plan has been seen or not, and if yes, which kind
+# it is ("early" is seen before any test result, "late" otherwise).
+plan_seen = NO_PLAN
+
+## --------- ##
+##  PARSING  ##
+## --------- ##
+
+is_first_read = 1
+
+while (1)
+  {
+    # Involutions required so that we are able to read the exit status
+    # from the last input line.
+    st = getline
+    if (st < 0) # I/O error.
+      fatal("I/O error while reading from input stream")
+    else if (st == 0) # End-of-input
+      {
+        if (is_first_read)
+          abort("in input loop: only one input line")
+        break
+      }
+    if (is_first_read)
+      {
+        is_first_read = 0
+        nextline = $0
+        continue
+      }
+    else
+      {
+        curline = nextline
+        nextline = $0
+        $0 = curline
+      }
+    # Copy any input line verbatim into the log file.
+    print | "cat >&3"
+    # Parsing of TAP input should stop after a "Bail out!" directive.
+    if (bailed_out)
+      continue
+
+    # TAP test result.
+    if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/)
+      {
+        testno += 1
+        setup_result_obj($0)
+        handle_tap_result()
+      }
+    # TAP plan (normal or "SKIP" without explanation).
+    else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/)
+      {
+        # The next two lines will put the number of planned tests in $0.
+        sub("^1\\.\\.", "")
+        sub("[^0-9]*$", "")
+        handle_tap_plan($0, "")
+        continue
+      }
+    # TAP "SKIP" plan, with an explanation.
+    else if ($0 ~ /^1\.\.0+[ \t]*#/)
+      {
+        # The next lines will put the skip explanation in $0, stripping
+        # any leading and trailing whitespace.  This is a little more
+        # tricky in truth, since we want to also strip a potential leading
+        # "SKIP" string from the message.
+        sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "")
+        sub("[ \t]*$", "");
+        handle_tap_plan(0, $0)
+      }
+    # "Bail out!" magic.
+    # Older versions of prove and TAP::Harness (e.g., 3.17) did not
+    # recognize a "Bail out!" directive when preceded by leading
+    # whitespace, but more modern versions (e.g., 3.23) do.  So we
+    # emulate the latter, "more modern" behaviour.
+    else if ($0 ~ /^[ \t]*Bail out!/)
+      {
+        bailed_out = 1
+        # Get the bailout message (if any), with leading and trailing
+        # whitespace stripped.  The message remains stored in `$0`.
+        sub("^[ \t]*Bail out![ \t]*", "");
+        sub("[ \t]*$", "");
+        # Format the error message for the
+        bailout_message = "Bail out!"
+        if (length($0))
+          bailout_message = bailout_message " " $0
+        testsuite_error(bailout_message)
+      }
+    # Maybe we have too look for dianogtic comments too.
+    else if (comments != 0)
+      {
+        comment = extract_tap_comment($0);
+        if (length(comment))
+          report("#", comment);
+      }
+  }
+
+## -------- ##
+##  FINISH  ##
+## -------- ##
+
+# A "Bail out!" directive should cause us to ignore any following TAP
+# error, as well as a non-zero exit status from the TAP producer.
+if (!bailed_out)
+  {
+    if (!plan_seen)
+      {
+        testsuite_error("missing test plan")
+      }
+    else if (planned_tests != testno)
+      {
+        bad_amount = testno > planned_tests ? "many" : "few"
+        testsuite_error(sprintf("too %s tests run (expected %d, got %d)",
+                                bad_amount, planned_tests, testno))
+      }
+    if (!ignore_exit)
+      {
+        # Fetch exit status from the last line.
+        exit_message = get_test_exit_message(nextline)
+        if (exit_message)
+          testsuite_error(exit_message)
+      }
+  }
+
+write_test_results()
+
+exit 0
+
+} # End of "BEGIN" block.
+'
+
+# TODO: document that we consume the file descriptor 3 :-(
+} 3>"$log_file"
+
+test $? -eq 0 || fatal "I/O or internal error"
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/lib/test-driver b/lib/test-driver
new file mode 100755 (executable)
index 0000000..b89107c
--- /dev/null
@@ -0,0 +1,127 @@
+#! /bin/sh
+# test-driver - basic driver script for the `parallel-tests' mode.
+
+scriptversion=2011-08-17.14; # UTC
+
+# Copyright (C) 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/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <bug-automake@gnu.org> or send patches to
+# <automake-patches@gnu.org>.
+
+# Make unconditional expansion of undefined variables an error.  This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+  echo "$0: $*" >&2
+  print_usage >&2
+  exit 2
+}
+
+print_usage ()
+{
+  cat <<END
+Usage:
+  test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+              [--expect-failure={yes|no}] [--color-tests={yes|no}]
+              [--enable-hard-errors={yes|no}] [--] TEST-SCRIPT
+The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
+END
+}
+
+# TODO: better error handling in option parsing (in particular, ensure
+# TODO: $log_file, $trs_file and $test_name are defined).
+test_name= # Used for reporting.
+log_file=  # Where to save the output of the test script.
+trs_file=  # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+  case $1 in
+  --help) print_usage; exit $?;;
+  --version) echo "test-driver $scriptversion"; exit $?;;
+  --test-name) test_name=$2; shift;;
+  --log-file) log_file=$2; shift;;
+  --trs-file) trs_file=$2; shift;;
+  --color-tests) color_tests=$2; shift;;
+  --expect-failure) expect_failure=$2; shift;;
+  --enable-hard-errors) enable_hard_errors=$2; shift;;
+  --) shift; break;;
+  -*) usage_error "invalid option: '$1'";;
+  esac
+  shift
+done
+
+if test $color_tests = yes; then
+  # Keep this in sync with `lib/am/check.am:$(am__tty_colors)'.
+  red='\e[0;31m' # Red.
+  grn='\e[0;32m' # Green.
+  lgn='\e[1;32m' # Light green.
+  blu='\e[1;34m' # Blue.
+  mgn='\e[0;35m' # Magenta.
+  std='\e[m'     # No color.
+else
+  red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+"$@" >$log_file 2>&1
+estatus=$?
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+  estatus=1
+fi
+
+case $estatus:$expect_failure in
+  0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+  0:*)   col=$grn res=PASS  recheck=no  gcopy=no;;
+  77:*)  col=$blu res=SKIP  recheck=no  gcopy=yes;;
+  99:*)  col=$mgn res=ERROR recheck=yes gcopy=yes;;
+  *:yes) col=$lgn res=XFAIL recheck=no  gcopy=yes;;
+  *:*)   col=$red res=FAIL  recheck=yes gcopy=yes;;
+esac
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
index 9253635..a8a08fd 100755 (executable)
@@ -32,7 +32,7 @@ scriptversion=2011-08-25.18; # UTC
 
 case "$1" in
   '')
-    echo "$0: No files given.  Try \`$0 --help' for more information." 1>&2
+    echo "$0: No files given.  Try '$0 --help' for more information." 1>&2
     exit 1
     ;;
   --basedir)
@@ -129,7 +129,7 @@ if test $ret -eq 0; then
   # The directory holding the input.
   input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
   # Quote $INPUT_DIR so we can use it in a regexp.
-  # FIXME: really we should care about more than `.' and `\'.
+  # FIXME: really we should care about more than '.' and '\'.
   input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
 
   while test "$#" -ne 0; do
@@ -146,7 +146,7 @@ if test $ret -eq 0; then
     fi
     if test -f "$from"; then
       # If $2 is an absolute path name, then just use that,
-      # otherwise prepend `../'.
+      # otherwise prepend '../'.
       case "$2" in
         [\\/]* | ?:[\\/]*) target="$2";;
         *) target="../$2";;
@@ -162,7 +162,7 @@ if test $ret -eq 0; then
         realtarget="$target"
         target="tmp-`echo $target | sed s/.*[\\/]//g`"
       fi
-      # Edit out `#line' or `#' directives.
+      # Edit out '#line' or '#' directives.
       #
       # We don't want the resulting debug information to point at
       # an absolute srcdir; it is better for it to just mention the
index b0e0d84..d683a5b 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-automake_acdir = $(datadir)/aclocal-$(APIVERSION)
-system_acdir = $(datadir)/aclocal
-
 dist_automake_ac_DATA = \
 $(top_srcdir)/m4/amversion.m4 \
+ar-lib.m4 \
 as.m4 \
 auxdir.m4 \
 ccstdc.m4 \
@@ -43,14 +41,12 @@ make.m4 \
 minuso.m4 \
 missing.m4 \
 mkdirp.m4 \
-multi.m4 \
 obsol-gt.m4 \
 obsol-lt.m4 \
 obsolete.m4 \
 options.m4 \
 protos.m4 \
 python.m4 \
-regex.m4 \
 runlog.m4 \
 sanity.m4 \
 silent.m4 \
@@ -63,7 +59,7 @@ vala.m4
 # So that $(system_acdir) will be created by "make install".
 dist_system_ac_DATA =
 
-EXTRA_DIST = acdir/dirlist amversion.in
+EXTRA_DIST = acdir/.placeholder amversion.in
 
 # We build amversion.m4 here, instead of from config.status,
 # because config.status is rerun each time one of configure's
diff --git a/m4/acdir/.placeholder b/m4/acdir/.placeholder
new file mode 100644 (file)
index 0000000..8dd7f67
--- /dev/null
@@ -0,0 +1,2 @@
+This file is here only to ensure the directory containing it exists
+in the git repository, and goes in the distribution tarball.
diff --git a/m4/acdir/dirlist b/m4/acdir/dirlist
deleted file mode 100644 (file)
index 82339e4..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# This file is used by the testsuite (dirlist*.test)
-# it should not be installed
-./dirlist-test
-./dirlist2*-test
index 61a86ab..cab5a3e 100644 (file)
@@ -7,7 +7,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
+# serial 8
 
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
index 5f1f2b7..79aefb9 100644 (file)
@@ -7,7 +7,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
+# serial 8
 
 # AM_AUTOMAKE_VERSION(VERSION)
 # ----------------------------
 # generated from the m4 files accompanying Automake X.Y.
 # (This private macro should not be called outside this file.)
 AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
+[am__api_version='1.11a'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.0a], [],
+m4_if([$1], [1.11a], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -34,7 +34,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.0a])dnl
+[AM_AUTOMAKE_VERSION([1.11a])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/m4/ar-lib.m4 b/m4/ar-lib.m4
new file mode 100644 (file)
index 0000000..e45c558
--- /dev/null
@@ -0,0 +1,61 @@
+##                                                          -*- Autoconf -*-
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_AR([ACT-IF-FAIL])
+# -------------------------
+# Try to determine the archiver interface, and trigger the ar-lib wrapper
+# if it is needed.  If the detection of archiver interface fails, run
+# ACT-IF-FAIL (default is to abort configure with a proper error message).
+AC_DEFUN([AM_PROG_AR],
+[AC_BEFORE([$0], [LT_INIT])dnl
+AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([ar-lib])dnl
+AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
+: ${AR=ar}
+
+AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
+  [am_cv_ar_interface=ar
+   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
+     [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([am_ar_try])
+      if test "$ac_status" -eq 0; then
+        am_cv_ar_interface=ar
+      else
+        am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+        AC_TRY_EVAL([am_ar_try])
+        if test "$ac_status" -eq 0; then
+          am_cv_ar_interface=lib
+        else
+          am_cv_ar_interface=unknown
+        fi
+      fi
+      rm -f conftest.lib libconftest.a
+     ])
+   ])
+
+case $am_cv_ar_interface in
+ar)
+  ;;
+lib)
+  # Microsoft lib, so override with the ar-lib wrapper script.
+  # FIXME: It is wrong to rewrite AR.
+  # But if we don't then we get into trouble of one sort or another.
+  # A longer-term fix would be to have automake use am__AR in this case,
+  # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
+  # similar.
+  AR="$am_aux_dir/ar-lib $AR"
+  ;;
+unknown)
+  m4_default([$1],
+             [AC_MSG_ERROR([could not determine $AR interface])])
+  ;;
+esac
+AC_SUBST([AR])dnl
+])
index fd248b2..7fa5dfd 100644 (file)
@@ -1,21 +1,21 @@
 # AM_CONDITIONAL                                            -*- Autoconf -*-
 
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008, 2011
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 9
+# serial 10
 
 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
 # -------------------------------------
 # Define a conditional.
 AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+[AC_PREREQ([2.52])dnl
m4_if([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
 AC_SUBST([$1_TRUE])dnl
 AC_SUBST([$1_FALSE])dnl
 _AM_SUBST_NOTMAKE([$1_TRUE])dnl
index 89d37b2..cf1b3d8 100644 (file)
@@ -6,7 +6,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 12
+# serial 14
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -31,12 +31,12 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
 AC_REQUIRE([AM_DEP_TRACK])dnl
 
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
+m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
+      [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
+      [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
+      [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                    [depcc="$$1"   am_compiler_list=])
 
 AC_CACHE_CHECK([dependency style of $depcc],
                [am_cv_$1_dependencies_compiler_type],
@@ -111,7 +111,7 @@ AC_CACHE_CHECK([dependency style of $depcc],
        break
       fi
       ;;
-    msvisualcpp | msvcmsys)
+    msvc7 | msvc7msys | msvisualcpp | msvcmsys)
       # This compiler won't grok `-c -o', but also, the minuso test has
       # not run yet.  These depmodes are late enough in the game, and
       # so weak that their functioning should not be impacted.
@@ -170,9 +170,13 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
 # AM_DEP_TRACK
 # ------------
 AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+  [--enable-dependency-tracking],
+  [do not reject slow dependency extractors])
+AS_HELP_STRING(
+  [--disable-dependency-tracking],
+  [speeds up one-time build])])
 if test "x$enable_dependency_tracking" != xno; then
   am_depcomp="$ac_aux_dir/depcomp"
   AMDEPBACKSLASH='\'
index 80a3926..3e046cd 100644 (file)
@@ -44,15 +44,13 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
     am__include=`sed -n 's/^am__include = //p' < "$mf"`
     test -z "am__include" && continue
     am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-    # When using ansi2knr, U may be empty or an underscore; expand it
-    U=`sed -n 's/^U = //p' < "$mf"`
     # Find all dependency output files, they are included files with
     # $(DEPDIR) in their names.  We invoke sed twice because it is the
     # simplest approach to changing $(DEPDIR) to its actual value in the
     # expansion.
     for file in `sed -n "
       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
       # Make sure the directory exists.
       test -f "$dirpart/$file" && continue
       fdir=`AS_DIRNAME(["$file"])`
index aea5f9d..82743fd 100644 (file)
@@ -3,28 +3,29 @@
 ## From Franc,ois Pinard               ##
 ## ----------------------------------- ##
 
-# Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2010
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2010,
+# 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 6
 
 AC_DEFUN([AM_WITH_DMALLOC],
 [AC_MSG_CHECKING([if malloc debugging is wanted])
-AC_ARG_WITH(dmalloc,
-[  --with-dmalloc          use dmalloc, as in http://www.dmalloc.com],
+AC_ARG_WITH([dmalloc],
+[AS_HELP_STRING([--with-dmalloc],
+                [use dmalloc, as in http://www.dmalloc.com])],
 [if test "$withval" = yes; then
-  AC_MSG_RESULT(yes)
-  AC_DEFINE(WITH_DMALLOC,1,
+  AC_MSG_RESULT([yes])
+  AC_DEFINE([WITH_DMALLOC], [1],
            [Define if using the dmalloc debugging malloc package])
   LIBS="$LIBS -ldmalloc"
   LDFLAGS="$LDFLAGS -g"
 else
-  AC_MSG_RESULT(no)
-fi], [AC_MSG_RESULT(no)])
+  AC_MSG_RESULT([no])
+fi], [AC_MSG_RESULT([no])])
 ])
 
 AU_DEFUN([fp_WITH_DMALLOC], [AM_WITH_DMALLOC])
index 49dbe1f..76241bc 100644 (file)
--- a/m4/gcj.m4
+++ b/m4/gcj.m4
@@ -8,14 +8,14 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
+# serial 8
 
-AC_DEFUN([AM_PROG_GCJ],[
-AC_CHECK_TOOLS(GCJ, gcj, gcj)
+AC_DEFUN([AM_PROG_GCJ],
+[AC_CHECK_TOOLS([GCJ], [gcj], [gcj])
 test -z "$GCJ" && AC_MSG_ERROR([no acceptable gcj found in \$PATH])
 if test "x${GCJFLAGS-unset}" = xunset; then
    GCJFLAGS="-g -O2"
 fi
-AC_SUBST(GCJFLAGS)
+AC_SUBST([GCJFLAGS])
 _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES(GCJ)])
 ])
index 365c9ac..ccc1965 100644 (file)
@@ -1,13 +1,13 @@
 # Do all the work for Automake.                             -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
+# 2005, 2006, 2008, 2009, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 16
+# serial 17
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -58,23 +58,25 @@ m4_ifval([$2],
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
 dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+m4_if(
+  m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+  [ok:ok],,
   [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
 
 _AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
 AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
 AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
 AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
 AC_REQUIRE([AM_PROG_MKDIR_P])dnl
@@ -88,17 +90,17 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
                             [_AM_PROG_TAR([v7])])])
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
-                 [_AM_DEPENDENCIES(CC)],
+                 [_AM_DEPENDENCIES([CC])],
                  [define([AC_PROG_CC],
-                         defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+                         defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
-                 [_AM_DEPENDENCIES(CXX)],
+                 [_AM_DEPENDENCIES([CXX])],
                  [define([AC_PROG_CXX],
-                         defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+                         defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
-                 [_AM_DEPENDENCIES(OBJC)],
+                 [_AM_DEPENDENCIES([OBJC])],
                  [define([AC_PROG_OBJC],
-                         defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+                         defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
 ])
 _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
 dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
index 20d71c6..60f1732 100644 (file)
@@ -6,7 +6,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 1
+# serial 8
 
 # AM_PROG_INSTALL_SH
 # ------------------
@@ -21,4 +21,4 @@ if test x"${install_sh}" != xset; then
     install_sh="\${SHELL} $am_aux_dir/install-sh"
   esac
 fi
-AC_SUBST(install_sh)])
+AC_SUBST([install_sh])])
index 022f6a8..5012926 100644 (file)
--- a/m4/lex.m4
+++ b/m4/lex.m4
@@ -1,20 +1,20 @@
 ## Replacement for AC_PROG_LEX.                            -*-  Autoconf -*-
 ## by Alexandre Oliva <oliva@dcc.unicamp.br>
-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
-# Free Software Foundation, Inc.
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2011 Free
+# Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# serial 6
 
 # AM_PROG_LEX
 # -----------
 # Autoconf leaves LEX=: if lex or flex can't be found.  Change that to a
 # "missing" invocation, for better error output.
 AC_DEFUN([AM_PROG_LEX],
-[AC_PREREQ(2.50)dnl
+[AC_PREREQ([2.50])dnl
 AC_REQUIRE([AM_MISSING_HAS_RUN])dnl
 AC_REQUIRE([AC_PROG_LEX])dnl
 if test "$LEX" = :; then
index 62c2daf..bc1c831 100644 (file)
@@ -10,7 +10,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 10
+# serial 11
 
 # AM_PATH_LISPDIR
 # ---------------
@@ -23,7 +23,8 @@ AC_DEFUN([AM_PATH_LISPDIR],
  AC_ARG_VAR([EMACS], [the Emacs editor command])
  AC_ARG_VAR([EMACSLOADPATH], [the Emacs library search path])
  AC_ARG_WITH([lispdir],
- [  --with-lispdir          override the default lisp directory],
+ [AS_HELP_STRING([--with-lispdir],
+                 [override the default lisp directory])],
  [ lispdir="$withval"
    AC_MSG_CHECKING([where .elc files should go])
    AC_MSG_RESULT([$lispdir])],
index 085e96c..b8f02bd 100644 (file)
@@ -8,7 +8,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# serial 6
 
 # AM_MAINTAINER_MODE([DEFAULT-MODE])
 # ----------------------------------
@@ -25,10 +25,11 @@ AC_DEFUN([AM_MAINTAINER_MODE],
 AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
   dnl maintainer-mode's default is 'disable' unless 'enable' is passed
   AC_ARG_ENABLE([maintainer-mode],
-[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
-                         (and sometimes confusing) to the casual installer],
-      [USE_MAINTAINER_MODE=$enableval],
-      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+    [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
+      am_maintainer_other[ make rules and dependencies not useful
+      (and sometimes confusing) to the casual installer])],
+    [USE_MAINTAINER_MODE=$enableval],
+    [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
   AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
   MAINT=$MAINTAINER_MODE_TRUE
diff --git a/m4/multi.m4 b/m4/multi.m4
deleted file mode 100644 (file)
index 447591f..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-##                                                          -*- Autoconf -*-
-# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2012
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 6
-
-# AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
-# ---------------------------------------------------
-# Add --enable-multilib to configure.
-AC_DEFUN([AM_ENABLE_MULTILIB],
-[m4_warn([obsolete], [$0 will be removed from Automake core soon.
-Files implementing the "multilib" feature are (and will remain) available
-to the 'contrib/' directory in the Automake distribution.])]dnl
-[# Default to --enable-multilib
-AC_ARG_ENABLE(multilib,
-[  --enable-multilib       build many library versions (default)],
-[case "$enableval" in
-  yes) multilib=yes ;;
-  no)  multilib=no ;;
-  *)   AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
- esac],
-             [multilib=yes])
-
-# We may get other options which we leave undocumented:
-# --with-target-subdir, --with-multisrctop, --with-multisubdir
-# See config-ml.in if you want the gory details.
-
-if test "$srcdir" = "."; then
-  if test "$with_target_subdir" != "."; then
-    multi_basedir="$srcdir/$with_multisrctop../$2"
-  else
-    multi_basedir="$srcdir/$with_multisrctop$2"
-  fi
-else
-  multi_basedir="$srcdir/$2"
-fi
-AC_SUBST(multi_basedir)
-
-# Even if the default multilib is not a cross compilation,
-# it may be that some of the other multilibs are.
-if test $cross_compiling = no && test $multilib = yes \
-   && test "x${with_multisubdir}" != x ; then
-   cross_compiling=maybe
-fi
-
-AC_OUTPUT_COMMANDS([
-# Only add multilib support code if we just rebuilt the top-level
-# Makefile.
-case " $CONFIG_FILES " in
- *" ]m4_default([$1],Makefile)[ "*)
-   ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
-   ;;
-esac],
-                  [
-srcdir="$srcdir"
-host="$host"
-target="$target"
-with_multisubdir="$with_multisubdir"
-with_multisrctop="$with_multisrctop"
-with_target_subdir="$with_target_subdir"
-ac_configure_args="${multilib_arg} ${ac_configure_args}"
-multi_basedir="$multi_basedir"
-CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
-CC="$CC"])])dnl
index 6824d84..efdc49d 100644 (file)
@@ -1,13 +1,13 @@
 # Helper functions for option handling.                     -*- Autoconf -*-
 
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software
+# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# serial 6
 
 # _AM_MANGLE_OPTION(NAME)
 # -----------------------
@@ -18,7 +18,7 @@ AC_DEFUN([_AM_MANGLE_OPTION],
 # --------------------
 # Set option NAME.  Presently that only means defining a flag for this option.
 AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
 
 # _AM_SET_OPTIONS(OPTIONS)
 # ------------------------
index f710293..32a5616 100644 (file)
@@ -1,31 +1,16 @@
-## ------------------------------- ##                       -*- Autoconf -*-
-## Check for function prototypes.  ##
-## From Franc,ois Pinard           ##
-## ------------------------------- ##
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2006
+#  -*- Autoconf -*-
+# Obsolete (and now removed) automatic de-ANSI-fiction support.
+#
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2006, 2011
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 5
+# serial 6
 
 AC_DEFUN([AM_C_PROTOTYPES],
-[AC_REQUIRE([AC_C_PROTOTYPES])
-AC_DIAGNOSE([obsolete],
-            [$0: automatic de-ANSI-fication support is deprecated])
-if test "$ac_cv_prog_cc_stdc" != no; then
-  U= ANSI2KNR=
-else
-  U=_ ANSI2KNR=./ansi2knr
-fi
-# Ensure some checks needed by ansi2knr itself.
-AC_REQUIRE([AC_HEADER_STDC])
-AC_CHECK_HEADERS([string.h])
-AC_SUBST([U])dnl
-AC_SUBST([ANSI2KNR])dnl
-_AM_SUBST_NOTMAKE([ANSI2KNR])dnl
-])
+         [AC_FATAL([automatic de-ANSI-fication support has been removed])])
 
 AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
index ee3eb95..bcdb694 100644 (file)
@@ -10,7 +10,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 2
+# serial 9
 
 # AM_PATH_PYTHON([MINIMUM-VERSION], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 # ---------------------------------------------------------------------------
@@ -55,10 +55,11 @@ AC_DEFUN([AM_PATH_PYTHON],
     dnl A version check is needed.
     if test -n "$PYTHON"; then
       # If the user set $PYTHON, use it and don't search something else.
-      AC_MSG_CHECKING([whether $PYTHON version >= $1])
+      AC_MSG_CHECKING([whether $PYTHON version is >= $1])
       AM_PYTHON_CHECK_VERSION([$PYTHON], [$1],
-                             [AC_MSG_RESULT(yes)],
-                             [AC_MSG_ERROR(too old)])
+                             [AC_MSG_RESULT([yes])],
+                             [AC_MSG_RESULT([no])
+                              AC_MSG_ERROR([Python interpreter is too old])])
       am_display_PYTHON=$PYTHON
     else
       # Otherwise, try each interpreter until we find one that satisfies
diff --git a/m4/regex.m4 b/m4/regex.m4
deleted file mode 100644 (file)
index 9355840..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-## --------------------------------- ##                     -*- Autoconf -*-
-## Check if --with-regex was given.  ##
-## --------------------------------- ##
-# Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-# 2010, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 10
-
-# AM_WITH_REGEX
-# -------------
-#
-# THIS MACRO IS OBSOLETE now, since rx doesn't seem to be maintained,
-# while regex is.  This macro should be removed in the next major
-# automake version (1.12).
-#
-# The idea is to distribute rx.[hc] and regex.[hc] together, for a
-# while.  The WITH_REGEX symbol is used to decide which of regex.h or
-# rx.h should be included in the application.  If `./configure
-# --with-regex' is given (the default), the package will use gawk's
-# regex.  If `./configure --without-regex', a check is made to see if
-# rx is already installed, as with newer Linux'es.  If not found, the
-# package will use the rx from the distribution.  If found, the
-# package will use the system's rx which, on Linux at least, will
-# result in a smaller executable file.
-#
-AC_DEFUN([AM_WITH_REGEX],
-[AC_PREREQ(2.50)dnl
-m4_warn([obsolete], [$0 is obsolete, since GNU rx is unmantained now])dnl
-AC_LIBSOURCES([rx.h, rx.c, regex.c, regex.h])dnl
-AC_MSG_CHECKING([which of GNU rx or gawk's regex is wanted])
-AC_ARG_WITH([regex],
-[  --without-regex         use GNU rx in lieu of gawk's regex for matching],
-           [test "$withval" = yes && am_with_regex=1],
-           [am_with_regex=1])
-if test -n "$am_with_regex"; then
-  AC_MSG_RESULT([regex])
-  AC_DEFINE([WITH_REGEX], 1, [Define if using GNU regex])
-  AC_CACHE_CHECK([for GNU regex in libc], [am_cv_gnu_regex],
-    [AC_TRY_LINK([],
-                [extern int re_max_failures; re_max_failures = 1],
-                [am_cv_gnu_regex=yes],
-                [am_cv_gnu_regex=no])])
-  if test $am_cv_gnu_regex = no; then
-    AC_LIBOBJ([regex])
-  fi
-else
-  AC_MSG_RESULT([rx])
-  AC_CHECK_FUNC([re_rx_search], , [AC_LIBOBJ([rx])])
-fi[]dnl
-])
-
-AU_DEFUN([fp_WITH_REGEX], [AM_WITH_REGEX])
index db87c8b..b718ac4 100644 (file)
@@ -1,13 +1,13 @@
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008, 2009, 2010,
+# 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 6
+# serial 9
 
 # AM_SANITY_CHECK
 # ---------------
@@ -32,14 +32,14 @@ esac
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
+   am_has_slept=no
    for am_try in 1 2; do
-     echo timestamp > conftest.file
+     echo "timestamp, slept: $am_has_slept" > conftest.file
      set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
      if test "$[*]" = "X"; then
        # -L didn't work.
        set X `ls -t "$srcdir/configure" conftest.file`
      fi
-     rm -f conftest.file
      if test "$[*]" != "X $srcdir/configure conftest.file" \
        && test "$[*]" != "X conftest.file $srcdir/configure"; then
 
@@ -55,6 +55,7 @@ if (
      fi
      # Just in case.
      sleep 1
+     am_has_slept=yes
    done
    test "$[2]" = conftest.file
    )
@@ -65,4 +66,20 @@ else
    AC_MSG_ERROR([newly created file is older than distributed files!
 Check your system clock])
 fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+  [AC_MSG_CHECKING([that generated files are newer than configure])
+   if test -n "$am_sleep_pid"; then
+     # Hide warnings about reused PIDs.
+     wait $am_sleep_pid 2>/dev/null
+   fi
+   AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
index 8bd931b..c94fff9 100644 (file)
@@ -1,5 +1,5 @@
 ##                                                          -*- Autoconf -*-
-# Copyright (C) 2009, 201 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # Enable less verbose build rules; with the default set to DEFAULT
 # (`yes' being less verbose, `no' or empty being verbose).
 AC_DEFUN([AM_SILENT_RULES],
-[AC_ARG_ENABLE([silent-rules],
-[  --enable-silent-rules          less verbose build output (undo: `make V=1')
-  --disable-silent-rules         verbose build output (undo: `make V=0')])
-case $enable_silent_rules in
-yes) AM_DEFAULT_VERBOSITY=0;;
-no)  AM_DEFAULT_VERBOSITY=1;;
-*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+[AC_ARG_ENABLE([silent-rules], [dnl
+AS_HELP_STRING(
+  [--enable-silent-rules],
+  [less verbose build output (undo: `make V=1')])
+AS_HELP_STRING(
+  [--disable-silent-rules],
+  [verbose build output (undo: `make V=0')])dnl
+])
+case $enable_silent_rules in @%:@ (((
+  yes) AM_DEFAULT_VERBOSITY=0;;
+   no) AM_DEFAULT_VERBOSITY=1;;
+    *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
 esac
 dnl
 dnl A few `make' implementations (e.g., NonStop OS and NextStep)
diff --git a/syntax-checks.mk b/syntax-checks.mk
new file mode 100644 (file)
index 0000000..0f01114
--- /dev/null
@@ -0,0 +1,590 @@
+# Maintainer checks for Automake.  Requires GNU make.
+
+# Copyright (C) 2012 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/>.
+
+# We also have to take into account VPATH builds (where some generated
+# tests might be in `$(builddir)' rather than in `$(srcdir)'), TAP-based
+# tests script (which have a `.tap' extension) and helper scripts used
+# by other test cases (which have a `.sh' extension).
+xtests := $(shell \
+  if test $(srcdir) = .; then \
+     dirs=.; \
+   else \
+     dirs='$(srcdir) .'; \
+   fi; \
+   for d in $$dirs; do \
+     for s in test tap sh; do \
+       ls $$d/tests/*.$$s 2>/dev/null; \
+     done; \
+   done | sort)
+
+ams := $(shell find $(srcdir) -name '*.am')
+
+# Some simple checks, and then ordinary check.  These are only really
+# guaranteed to work on my machine.
+syntax_check_rules = \
+sc_test_names \
+sc_diff_automake_in_automake \
+sc_diff_aclocal_in_automake \
+sc_perl_syntax \
+sc_no_brace_variable_expansions \
+sc_rm_minus_f \
+sc_no_for_variable_in_macro \
+sc_mkinstalldirs \
+sc_pre_normal_post_install_uninstall \
+sc_perl_no_undef \
+sc_perl_no_split_regex_space \
+sc_cd_in_backquotes \
+sc_cd_relative_dir \
+sc_perl_at_uscore_in_scalar_context \
+sc_perl_local_no_parens \
+sc_perl_local \
+sc_AMDEP_TRUE_in_automake_in \
+sc_tests_make_without_am_makeflags \
+sc_tests_obsolete_variables \
+sc_tests_plain_make \
+sc_tests_plain_autoconf \
+sc_tests_plain_autoupdate \
+sc_tests_plain_automake \
+sc_tests_plain_autom4te \
+sc_tests_plain_autoheader \
+sc_tests_plain_autoreconf \
+sc_tests_here_document_format \
+sc_tests_Exit_not_exit \
+sc_tests_automake_fails \
+sc_tests_plain_aclocal \
+sc_tests_plain_perl \
+sc_tests_required_after_defs \
+sc_tests_tap_plan \
+sc_tests_overriding_macros_on_cmdline \
+sc_tests_plain_sleep \
+sc_tests_plain_egrep_fgrep \
+sc_tests_PATH_SEPARATOR \
+sc_tests_logs_duplicate_prefixes \
+sc_tests_makefile_variable_order \
+sc_mkdir_p \
+sc_perl_at_substs \
+sc_unquoted_DESTDIR \
+sc_tabs_in_texi \
+sc_at_in_texi
+
+$(syntax_check_rules): automake aclocal
+maintainer-check: $(syntax_check_rules)
+.PHONY: maintainer-check $(syntax_check_rules)
+
+## Check that the list of tests given in the Makefile is equal to the
+## list of all test scripts in the Automake testsuite.
+.PHONY: maintainer-check-list-of-tests
+maintainer-check-list-of-tests:
+       $(MAKE) -C tests $@
+maintainer-check: maintainer-check-list-of-tests
+
+## Look for test whose names can cause spurious failures when used as
+## first argument to AC_INIT (chiefly because they might contain an
+## m4/m4sugar builtin or macro name).
+m4_builtins = \
+  __gnu__ \
+  __unix__ \
+  bpatsubst \
+  bregexp \
+  builtin \
+  changecom \
+  changequote \
+  changeword \
+  debugfile \
+  debugmode \
+  decr \
+  define \
+  defn \
+  divert \
+  divnum \
+  dnl \
+  dumpdef \
+  errprint \
+  esyscmd \
+  eval \
+  format \
+  ifdef \
+  ifelse \
+  include \
+  incr \
+  index \
+  indir \
+  len \
+  m4exit \
+  m4wrap \
+  maketemp \
+  mkstemp \
+  patsubst \
+  popdef \
+  pushdef \
+  regexp \
+  shift \
+  sinclude \
+  substr \
+  symbols \
+  syscmd \
+  sysval \
+  traceoff \
+  traceon \
+  translit \
+  undefine \
+  undivert
+sc_test_names:
+       @m4_builtin_rx=`echo $(m4_builtins) | sed 's/ /|/g'`; \
+        m4_macro_rx="\\<($$m4_builtin_rx)\\>|\\<_?(A[CUMHS]|m4)_"; \
+        if { \
+          for t in $(xtests); do echo $$t; done \
+            | LC_ALL=C grep -E "$$m4_macro_rx"; \
+        }; then \
+          echo "the names of the tests above can be problematic" 1>&2; \
+          echo "Avoid test names that contain names of m4 macros" 1>&2; \
+          exit 1; \
+        fi
+
+## These check avoids accidental configure substitutions in the source.
+## There are exactly 9 lines that should be modified from automake.in to
+## automake, and 10 lines that should be modified from aclocal.in to
+## aclocal; these wors out to 32 and 34 lines of diffs, respectively.
+sc_diff_automake_in_automake:
+       @if test `diff $(srcdir)/automake.in automake | wc -l` -ne 32; then \
+         echo "found too many diffs between automake.in and automake" 1>&2; \
+         diff -c $(srcdir)/automake.in automake; \
+         exit 1; \
+       fi
+sc_diff_aclocal_in_aclocal:
+       @if test `diff $(srcdir)/aclocal.in aclocal | wc -l` -ne 34; then \
+         echo "found too many diffs between aclocal.in and aclocal" 1>&2; \
+         diff -c $(srcdir)/aclocal.in aclocal; \
+         exit 1; \
+       fi
+
+## Syntax check with default Perl (on my machine, Perl 5).
+sc_perl_syntax:
+       @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w automake
+       @perllibdir="./lib$(PATH_SEPARATOR)$(srcdir)/lib" $(PERL) -c -w aclocal
+
+## expect no instances of '${...}'.  However, $${...} is ok, since that
+## is a shell construct, not a Makefile construct.
+sc_no_brace_variable_expansions:
+       @if grep -F '$${' $(ams) | grep -F -v '$$$$'; then \
+         echo "Found too many uses of '\$${' in the lines above." 1>&2; \
+         exit 1;                               \
+       else :; fi
+
+## Make sure `rm' is called with `-f'.
+sc_rm_minus_f:
+       @if grep -v '^#' $(ams) $(xtests) \
+          | grep -E '\<rm ([^-]|\-[^f ]*\>)'; \
+       then \
+         echo "Suspicious 'rm' invocation." 1>&2; \
+         exit 1;                               \
+       else :; fi
+
+## Never use something like `for file in $(FILES)', this doesn't work
+## if FILES is empty or if it contains shell meta characters (e.g. $ is
+## commonly used in Java filenames).
+sc_no_for_variable_in_macro:
+       @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \
+         echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
+         exit 1; \
+       else :; fi
+
+## Make sure all invocations of mkinstalldirs are correct.
+sc_mkinstalldirs:
+       @if grep -n 'mkinstalldirs' $(ams) \
+             | grep -F -v '$$(mkinstalldirs)' \
+             | grep -v '^\./lib/Makefile.am:37:  *mkinstalldirs \\$$'; \
+       then \
+         echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
+         exit 1; \
+       else :; fi
+
+## Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
+sc_pre_normal_post_install_uninstall:
+       @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' $(ams) | \
+             grep -v ':##' | grep -v ':        @\$$('; then \
+         echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
+         exit 1; \
+       else :; fi
+
+## We never want to use "undef", only "delete", but for $/.
+sc_perl_no_undef:
+       @if grep -n -w 'undef ' $(srcdir)/automake.in | \
+             grep -F -v 'undef $$/'; then \
+         echo "Found undef in automake.in; use delete instead" 1>&2; \
+         exit 1; \
+       fi
+
+## We never want split (/ /,...), only split (' ', ...).
+sc_perl_no_split_regex_space:
+       @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
+         echo "Found bad split in the lines above." 1>&2; \
+         exit 1; \
+       fi
+
+## Look for cd within backquotes
+sc_cd_in_backquotes:
+       @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \
+         echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
+         exit 1; \
+       fi
+
+## Look for cd to a relative directory (may be influenced by CDPATH).
+## Skip some known directories that are OK.
+sc_cd_relative_dir:
+       @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \
+             grep -v 'echo.*cd ' | \
+             grep -v 'am__cd =' | \
+             grep -v '^[^#]*cd [./]' | \
+             grep -v '^[^#]*cd \$$(top_builddir)' | \
+             grep -v '^[^#]*cd "\$$\$$am__cwd' | \
+             grep -v '^[^#]*cd \$$(abs' | \
+             grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
+         echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
+         exit 1; \
+       fi
+
+## Using @_ in a scalar context is most probably a programming error.
+sc_perl_at_uscore_in_scalar_context:
+       @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
+         echo "Using @_ in a scalar context in the lines above." 1>&2; \
+         exit 1; \
+       fi
+
+## Forbid using parens with `local' to ease counting.
+sc_perl_local_no_parens:
+       @if grep '^[ \t]*local *(' $(srcdir)/automake.in; then \
+         echo "Don't use \`local' with parens: use several \`local' above." >&2; \
+         exit 1; \
+       fi
+
+## Allow only few variables to be localized in Automake.
+sc_perl_local:
+       @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' $(srcdir)/automake.in | \
+               grep '^[ \t]*local [^*]'; then \
+         echo "Please avoid \`local'." 1>&2; \
+         exit 1; \
+       fi
+
+## Don't let AMDEP_TRUE substitution appear in automake.in.
+sc_AMDEP_TRUE_in_automake_in:
+       @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
+         echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
+         exit 1; \
+       fi
+
+## Recursive make invocations should always pass $(AM_MAKEFLAGS)
+## to $(MAKE), for portability to non-GNU make.
+sc_tests_make_without_am_makeflags:
+       @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in | \
+               grep -v 'AM_MAKEFLAGS'; then \
+         echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
+         exit 1; \
+       fi
+
+## Look out for some obsolete variables.
+sc_tests_obsolete_variables:
+       @vars=" \
+         using_tap \
+         parallel_tests \
+         test_prefer_config_shell \
+         original_AUTOMAKE \
+         original_ACLOCAL \
+       "; \
+       seen=""; \
+       for v in $$vars; do \
+         if grep -E "\b$$v\b" \
+           $(xtests) $(srcdir)/tests/defs \
+           $(srcdir)/tests/defs-static.in \
+         ; then \
+           seen="$$seen $$v"; \
+         fi; \
+       done; \
+       if test -n "$$seen"; then \
+         for v in $$seen; do \
+           echo "Variable '$$v' is obsolete, use 'am_$$v' instead." 1>&2; \
+         done; \
+         exit 1; \
+       else :; fi
+
+## Tests should never call make directly.
+sc_tests_plain_make:
+       @if grep -v '^#' $(xtests) | $(EGREP) ':[       ]*make( |$$)'; then \
+         echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
+         exit 1; \
+       fi
+
+## Tests should never call autoconf directly.
+sc_tests_plain_autoconf:
+       @if grep -v '^#' $(xtests) | grep ':[   ]*autoconf\>'; then \
+         echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
+         exit 1; \
+       fi
+
+## Tests should never call autoupdate directly.
+sc_tests_plain_autoupdate:
+       @if grep -v '^#' $(xtests) | grep ':[   ]*autoupdate\>'; then \
+         echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
+         exit 1; \
+       fi
+
+## Tests should never call automake directly.
+sc_tests_plain_automake:
+       @if grep -v '^#' $(xtests) | grep -E ':[        ]*automake\>([^:]|$$)'; then \
+         echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
+         exit 1; \
+       fi
+
+## Tests should never call autoheader directly.
+sc_tests_plain_autoheader:
+       @if grep -v '^#' $(xtests) | grep ':[   ]*autoheader\>'; then \
+         echo 'Do not run "autoheader" in the above tests.  Use "$$AUTOHEADER" instead.' 1>&2;  \
+         exit 1; \
+       fi
+
+## Tests should never call autoreconf directly.
+sc_tests_plain_autoreconf:
+       @if grep -v '^#' $(xtests) | grep ':[   ]*autoreconf\>'; then \
+         echo 'Do not run "autoreconf" in the above tests.  Use "$$AUTORECONF" instead.' 1>&2;  \
+         exit 1; \
+       fi
+
+## Tests should never call autom4te directly.
+sc_tests_plain_autom4te:
+       @if grep -v '^#' $(xtests) | grep ':[   ]*autom4te\>'; then \
+         echo 'Do not run "autom4te" in the above tests.  Use "$$AUTOM4TE" instead.' 1>&2;  \
+         exit 1; \
+       fi
+
+## Tests should only use END and EOF for here documents
+## (so that the next test is effective).
+sc_tests_here_document_format:
+       @if grep '<<' $(xtests) | grep -v 'END' | grep -v 'EOF'; then \
+         echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
+         exit 1; \
+       fi
+
+## Tests should never call exit directly, but use Exit.
+## This is so that the exit status is transported correctly across the 0 trap.
+## Ignore comments, testsuite self tests, and one perl line in ext2.test.
+sc_tests_Exit_not_exit:
+       @found=false; for file in $(xtests); do \
+         case $$file in */self-check-*) continue;; esac; \
+         res=`sed -n -e '/^#/d; /^\$$PERL/d' -e '/<<.*END/,/^END/b' \
+                     -e '/<<.*EOF/,/^EOF/b' -e '/exit [$$0-9]/p' $$file`; \
+         if test -n "$$res"; then \
+           echo "$$file:$$res"; \
+           found=true; \
+         fi; \
+       done; \
+       if $$found; then \
+         echo 'Do not call plain "exit", use "Exit" instead, in above tests.' 1>&2; \
+         exit 1; \
+       fi
+
+## Use AUTOMAKE_fails when appropriate
+sc_tests_automake_fails:
+       @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*[eE]xit'; then \
+         echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2;  \
+         exit 1; \
+       fi
+
+## Tests should never call aclocal directly.
+sc_tests_plain_aclocal:
+       @if grep -v '^#' $(xtests) | grep ':[   ]*aclocal\>'; then \
+         echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
+         exit 1; \
+       fi
+
+## Tests should never call perl directly.
+sc_tests_plain_perl:
+       @if grep -v '^#' $(xtests) | grep ':[   ]*perl\>'; then \
+         echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
+         exit 1; \
+       fi
+
+## Setting `required' after sourcing `./defs' is a bug.
+sc_tests_required_after_defs:
+       @for file in $(xtests); do \
+         if out=`sed -n '/defs/,$${/required=/p;}' $$file`; test -n "$$out"; then \
+           echo 'Do not set "required" after sourcing "defs" in '"$$file: $$out" 1>&2; \
+           exit 1; \
+         fi; \
+       done
+
+## TAP-based test scripts should not forget to declare a TAP plan.  In
+## case it is not known in advance how many tests will be run, a "lazy"
+## plan can be used; but its use should be deliberate, explicitly declared
+## with a "plan_ later" call, rather than the result of an oversight.
+## This check helps to ensure this is indeed the case.
+sc_tests_tap_plan:
+       @with_plan=`grep -l '^ *plan_ ' $(srcdir)/tests/*.tap`; \
+        with_plan=`echo $$with_plan`; \
+        ok=:; \
+        for t in $(srcdir)/tests/*.tap; do \
+          case " $$with_plan " in *" $$t "*) continue;; esac; \
+          case $$t in \
+            *-w.tap) \
+              : it is ok for an *auto-generated* test sourcing an \
+              : hand-written one not to declare a TAP plan: that will \
+              : be done by the sourced test; \
+              t2=`echo $$t | sed -e 's|.*/||' -e 's/-w\.tap$$/.tap/'` \
+                && grep -E "^ *\\.  *[^        ]*/$$t2\\b" $$t >/dev/null \
+                && continue || : ;; \
+          esac; \
+          ok=false; echo $$t; \
+        done; \
+        $$ok || { \
+         echo 'The tests above do not declare a TAP plan.' 1>&2; \
+         exit 1; \
+        }
+
+## Overriding a Makefile macro on the command line is not portable when
+## recursive targets are used.  Better use an envvar.  SHELL is an
+## exception, POSIX says it can't come from the environment.  V, DESTDIR,
+## DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
+## as package authors are urged not to initialize them anywhere.
+sc_tests_overriding_macros_on_cmdline:
+       @if grep -E '\$$MAKE .*(SHELL=.*=|=.*SHELL=)' $(xtests); then \
+         echo 'Rewrite "$$MAKE foo=bar SHELL=$$SHELL" as "foo=bar $$MAKE -e SHELL=$$SHELL"' 1>&2; \
+         echo ' in the above lines, it is more portable.' 1>&2; \
+         exit 1; \
+       fi
+# The first s/// tries to account for usages like "$MAKE || st=$?".
+# DISTCHECK_CONFIGURE_FLAGS is allowed to contain whitespace in its
+# definition, hence the more complex last three substitutions below.
+       @if sed -e 's/ || .*//' -e 's/ && .*//' \
+               -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
+               -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
+               -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
+               -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
+               -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
+             $(xtests) | grep '\$$MAKE .*='; then \
+         echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
+         echo 'it is more portable.' 1>&2; \
+         exit 1; \
+       fi
+       @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
+         echo '$$MAKE ignores the SHELL envvar, use "$$MAKE SHELL=$$SHELL" in' 1>&2; \
+         echo 'the above lines.' 1>&2; \
+         exit 1; \
+       fi
+
+## Never use `sleep 1' to create files with different timestamps.
+## Use `$sleep' instead.  Some filesystems (e.g., Windows') have only
+## a 2sec resolution.
+sc_tests_plain_sleep:
+       @if grep -E '\bsleep +[12345]\b' $(xtests); then \
+         echo 'Do not use "sleep x" in the above tests.  Use "$$sleep" instead.' 1>&2; \
+         exit 1; \
+       fi
+
+## fgrep and egrep are not required by POSIX.
+sc_tests_plain_egrep_fgrep:
+       @if grep -E '\b[ef]grep\b' $(xtests) ; then \
+         echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
+         exit 1; \
+       fi
+       @if grep -E '\b[ef]grep\b' $(ams) $(srcdir)/m4/*.m4; then \
+         echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
+         exit 1; \
+       fi
+
+## Rule to ensure that the testsuite has been run before.  We don't depend on `check'
+## here, because that would be very wasteful in the common case.  We could run
+## `make check RECHECK_LOGS=' and avoid toplevel races with AM_RECURSIVE_TARGETS.
+## Suggest keeping test directories around for greppability of the Makefile.in files.
+sc_ensure_testsuite_has_run:
+       @if test ! -f tests/test-suite.log; then \
+         echo "Run \`env keep_testdirs=yes make check' before \`maintainer-check'" >&2; \
+         exit 1; \
+       fi
+.PHONY: sc_ensure_testsuite_has_run
+
+## Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
+## This test actually depends on the testsuite having been run before.
+sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
+       @if grep -E '(warning|error):.*(warning|error):' tests/*.log; then \
+         echo 'Duplicate warning/error message prefixes seen in above tests.' >&2; \
+         exit 1; \
+       fi
+
+## Ensure variables are listed before rules in Makefile.in files we generate.
+sc_tests_makefile_variable_order: sc_ensure_testsuite_has_run
+       @st=0; \
+       for file in `find tests -name Makefile.in -print`; do \
+         latevars=`sed -n \
+           -e :x -e 's/#.*//' \
+           -e '/\\\\$$/{' -e N -e 'b x' -e '}' \
+           -e '# Literal TAB.' \
+           -e '1,/^    /d' \
+           -e '# Allow @ so we match conditionals.' \
+           -e '/^ *[a-zA-Z_@]\{1,\} *=/p' $$file`; \
+         if test -n "$$latevars"; then \
+           echo "Variables are expanded too late in $$file:" >&2; \
+           echo "$$latevars" | sed 's/^/  /' >&2; \
+           st=1; \
+         fi; \
+       done; \
+       test $$st -eq 0 || { \
+         echo 'Ensure variables are expanded before rules' >&2; \
+         exit 1; \
+       }
+
+## Using `:' as a PATH separator is not portable.
+sc_tests_PATH_SEPARATOR:
+       @if grep -E '\bPATH=.*:.*' $(xtests) ; then \
+         echo "Use \`\$$PATH_SEPARATOR', not \`:', in PATH definitions above." 1>&2; \
+         exit 1; \
+       fi
+
+sc_mkdir_p:
+       @if grep 'mkdir_p' $(srcdir)/automake.in $(ams) $(xtests); then \
+         echo 'Do not use mkdir_p in the above files, use MKDIR_P.' 1>&2; \
+         exit 1; \
+       fi
+
+## Try to make sure all @...@ substitutions are covered by our
+## substitution rule.
+sc_perl_at_substs:
+       @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
+         echo "Unresolved @...@ substitution in aclocal" 1>&2; \
+         exit 1; \
+       fi
+       @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' automake | wc -l` -ne 0; then \
+         echo "Unresolved @...@ substitution in automake" 1>&2; \
+         exit 1; \
+       fi
+
+sc_unquoted_DESTDIR:
+       @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(ams); then \
+         echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
+         exit 1; \
+       fi
+
+sc_tabs_in_texi:
+       @if grep '      ' $(srcdir)/doc/automake.texi; then \
+         echo 'Do not use tabs in the manual.' 1>&2; \
+         exit 1; \
+       fi
+
+sc_at_in_texi:
+       @if grep -E '([^@]|^)@([         ][^@]|$$)' $(srcdir)/doc/automake.texi; \
+       then \
+         echo 'Unescaped @.' 1>&2; \
+         exit 1; \
+       fi
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644 (file)
index 0000000..7b04f17
--- /dev/null
@@ -0,0 +1,9 @@
+/aclocal-*
+/automake-*
+/defs-static
+/testsuite-part.am
+/*-w.tap
+/*-w.test
+/*.dir
+/*.log
+/*.trs
index c71c7fc..3fa51d3 100644 (file)
@@ -41,11 +41,12 @@ maintainer-check-list-of-tests:
         dirs='$(test_subdirs)'; \
         test -n "$$dirs" || dirs=.; \
 ## List of tests on filesystem.  Be careful to cater for VPATH builds too.
-        for ext in $(TEST_EXTENSIONS); do \
+        test_extensions='$(TEST_EXTENSIONS)'; \
+        for ext in $$test_extensions; do \
           for dir in $$dirs; do \
             ls $$dir/*$$ext 2>/dev/null; \
             if test $(srcdir) != $(builddir); then \
-              (cd $(srcdir) && ls $$dir/*$$ext 2>/dev/null); \
+              ($(am__cd) $(srcdir) && ls $$dir/*$$ext 2>/dev/null); \
             fi; \
           done; \
         done | sed 's,^\./,,' | sort | uniq >$(am__tfs); \
index eab45dc..e8da6ce 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# Run the tests with the shell detected at configure time.
+LOG_COMPILER = $(SHELL)
+
+TEST_EXTENSIONS = .pl .test .tap
+TEST_LOG_COMPILER = $(LOG_COMPILER)
+TAP_LOG_COMPILER = $(LOG_COMPILER)
+PL_LOG_COMPILER = $(PERL)
+AM_PL_LOG_FLAGS = -Mstrict -I $(top_builddir)/lib -I $(top_srcdir)/lib -w
+
+TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/lib/tap-driver.sh
+
+AM_TAP_LOG_DRIVER_FLAGS = --merge
+
+EXTRA_DIST = is ChangeLog-old
+
+TESTS = ## Will be updated later.
+
 XFAIL_TESTS = \
 all.test \
-auxdir2.test \
+yacc-bison-skeleton-cxx.test \
+yacc-bison-skeleton.test \
 cond17.test \
-dist-auxfile.test \
-dist-auxfile-2.test \
 gcj6.test \
+override-conditional-2.test \
 java-nobase.test \
 objext-pr10128.test \
 pr8365-remake-timing.test \
 lex-subobj-nodep.test \
 remake-am-pr10111.test \
 remake-m4-pr10111.test \
-txinfo5.test
+txinfo5.test \
+## FIXME: this "expected failures" are in truth an hack used to
+## FIXME: to verify that some incorrect usages of our perl: libraries
+## FIXME: raise an error.  We should find a cleaner way to check that.
+pm/Cond2.pl \
+pm/Cond3.pl \
+pm/DisjCon2.pl \
+pm/DisjCon3.pl \
+pm/Version2.pl \
+pm/Version3.pl
 
-include $(srcdir)/parallel-tests.am
+# Some testsuite-influential variables should be overridable from the
+# test scripts, but not from the environment.
+AM_TESTS_ENVIRONMENT = \
+  for v in \
+    me \
+    required \
+    am_using_tap \
+    am_parallel_tests \
+    am_test_prefer_config_shell \
+    am_original_AUTOMAKE \
+    am_original_ACLOCAL \
+  ; do \
+    eval test x"\$${$$v}" = x || unset $$v; \
+  done;
+# The `AM_TESTS_REEXEC=no' setting tells the tests not to needlessly
+# re-execute themselves with the shell detected at configure time, since
+# we are already running them under it explicitly in our setup (see e.g.
+# the definition of TEST_LOG_COMPILER above).
+AM_TESTS_ENVIRONMENT += AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC;
+# We want warning messages and explanations for skipped tests to go to
+# the console if possible, so set up `stderr_fileno_' properly.
+AM_TESTS_FD_REDIRECT = 9>&2
+AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
 
-$(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
-       $(AM_V_GEN)(cd $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@
+# Hand-written tests.
 
-$(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
-       $(AM_V_GEN)input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'` \
-         && sed 's|^\. \./defs.*|parallel_tests=yes; &|' \
-              < $(srcdir)/$$input >$@ \
-         && chmod a+rx $@
+include $(srcdir)/list-of-tests.mk
 
-MAINTAINERCLEANFILES = $(parallel_tests)
+TESTS += $(handwritten_TESTS)
+EXTRA_DIST += $(handwritten_TESTS)
 
-# Some testsuite-influential variables should be overridable from the
-# test scripts, but not from the environment.
-TESTS_ENVIRONMENT = \
-  test x"$$me" = x || unset me; \
-  test x"$$required" = x || unset required; \
-  test x"$$parallel_tests" = x || unset parallel_tests;
+# Automatically-generated tests wrapping hand-written ones.
+# Also, automatically-computed dependencies for tests.
 
-TEST_EXTENSIONS = .pl .test
+include $(srcdir)/testsuite-part.am
 
-PL_LOG_COMPILER = $(PERL)
-AM_PL_LOG_FLAGS = -Mstrict -I $(top_builddir)/lib -I $(top_srcdir)/lib -w
+TESTS += $(generated_TESTS)
+EXTRA_DIST += $(generated_TESTS)
 
-include $(srcdir)/list-of-tests.mk
+$(srcdir)/testsuite-part.am:
+       $(AM_V_at)rm -f testsuite-part.tmp $@
+       $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
+         --srcdir $(srcdir) > testsuite-part.tmp
+       $(AM_V_at)chmod a-w testsuite-part.tmp
+       $(AM_V_at)mv -f testsuite-part.tmp $@
+EXTRA_DIST += gen-testsuite-part
+
+$(generated_TESTS) $(srcdir)/testsuite-part.am: \
+  gen-testsuite-part list-of-tests.mk Makefile.am $(handwritten_TESTS)
 
-TESTS = $(handwritten_TESTS) $(parallel_tests)
-
-# FIXME: make these automatically computed once we are merged into
-# FIXME: the `testsuite-work' branch.
-depcomp4.log: libtool-macros.log
-depcomp7.log: libtool-macros.log
-depcomp8b.log: libtool-macros.log
-extradep2.log: libtool-macros.log
-fort5.log: libtool-macros.log
-instdir-ltlib.log: libtool-macros.log
-instfail-libtool.log: libtool-macros.log
-ldadd.log: libtool-macros.log
-ldflags.log: libtool-macros.log
-libobj13.log: libtool-macros.log
-libtoo10.log: libtool-macros.log
-libtoo11.log: libtool-macros.log
-libtool.log: libtool-macros.log
-libtool2.log: libtool-macros.log
-libtool3.log: libtool-macros.log
-libtool5.log: libtool-macros.log
-libtool6.log: libtool-macros.log
-libtool7.log: libtool-macros.log
-libtool8.log: libtool-macros.log
-libtool9.log: libtool-macros.log
-listval.log: libtool-macros.log
-ltcond.log: libtool-macros.log
-ltcond2.log: libtool-macros.log
-ltconv.log: libtool-macros.log
-ltdeps.log: libtool-macros.log
-ltinit.log: libtool-macros.log
-ltinstloc.log: libtool-macros.log
-ltlibobjs.log: libtool-macros.log
-ltlibsrc.log: libtool-macros.log
-ltorder.log: libtool-macros.log
-nobase-libtool.log: libtool-macros.log
-pr211.log: libtool-macros.log
-pr300-ltlib.log: libtool-macros.log
-pr307.log: libtool-macros.log
-pr401b.log: libtool-macros.log
-pr72.log: libtool-macros.log
-reqd2.log: libtool-macros.log
-silent3.log: libtool-macros.log
-silent4.log: libtool-macros.log
-silent9.log: libtool-macros.log
-stdlib2.log: libtool-macros.log
-strip3.log: libtool-macros.log
-subobj9.log: libtool-macros.log
-suffix10.log: libtool-macros.log
-suffix2.log: libtool-macros.log
-suffix5.log: libtool-macros.log
-suffix8.log: libtool-macros.log
-vala.log: libtool-macros.log
-vala1.log: libtool-macros.log
-vala2.log: libtool-macros.log
-vala3.log: libtool-macros.log
-vala4.log: libtool-macros.log
-vala5.log: libtool-macros.log
-
-# FIXME: make these automatically computed once we are merged into
-# FIXME: the `testsuite-work' branch.
-gettext.log: gettext-macros.log
-gettext2.log: gettext-macros.log
-gettext3.log: gettext-macros.log
-subcond.log: gettext-macros.log
-
-EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
+# Static dependencies valid for each test case.
+check_SCRIPTS = aclocal-$(APIVERSION) automake-$(APIVERSION)
+check_DATA = defs defs-static plain-functions.sh tap-functions.sh
+EXTRA_DIST += tap-functions.sh plain-functions.sh
 
+# Few more static dependencies.
 distcheck-missing-m4.log distcheck-outdated-m4.log: distcheck-hook-m4.am
 EXTRA_DIST += distcheck-hook-m4.am
 
-# Each test case depends on defs, aclocal, and automake.
-check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
+# Keep in sync with AC_SUBST'd stuff in defs-static.in.
+do_subst = sed \
+  -e 's|@abs_srcdir[@]|$(abs_srcdir)|g' \
+  -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
+  -e 's|@abs_builddir[@]|$(abs_builddir)|g' \
+  -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
+  -e 's|@prefix[@]|$(prefix)|g' \
+  -e 's|@amdir[@]|$(amdir)|g' \
+  -e 's|@bindir[@]|$(bindir)|g' \
+  -e 's|@datadir[@]|$(datadir)|g' \
+  -e 's|@docdir[@]|$(docdir)|g' \
+  -e 's|@automake_acdir[@]|$(automake_acdir)|g' \
+  -e 's|@system_acdir[@]|$(system_acdir)|g' \
+  -e 's|@scriptdir[@]|$(scriptdir)|g' \
+  -e 's|@pkgvdatadir[@]|$(pkgvdatadir)|g' \
+  -e 's|@host_alias[@]|$(host_alias)|g' \
+  -e 's|@build_alias[@]|$(build_alias)|g' \
+  -e 's|@APIVERSION[@]|$(APIVERSION)|g' \
+  -e 's|@PATH_SEPARATOR[@]|$(PATH_SEPARATOR)|g' \
+  -e 's|@SHELL[@]|$(SHELL)|g' \
+  -e 's|@PERL[@]|$(PERL)|g' \
+  -e 's|@EGREP[@]|$(EGREP)|g' \
+  -e 's|@FGREP[@]|$(FGREP)|g' \
+  -e 's|@CPPFLAGS[@]|$(CPPFLAGS)|g' \
+  -e 's|@CC[@]|$(CC)|g' \
+  -e 's|@CFLAGS[@]|$(CFLAGS)|g' \
+  -e 's|@CXX[@]|$(CXX)|g' \
+  -e 's|@CXXFLAGS[@]|$(CXXFLAGS)|g' \
+  -e 's|@F77[@]|$(F77)|g' \
+  -e 's|@FFLAGS[@]|$(FFLAGS)|g' \
+  -e 's|@FC[@]|$(FC)|g' \
+  -e 's|@FCFLAGS[@]|$(FCFLAGS)|g' \
+  -e 's|@GNU_CFLAGS[@]|$(GNU_CFLAGS)|g' \
+  -e 's|@GNU_CXXFLAGS[@]|$(GNU_CXXFLAGS)|g' \
+  -e 's|@GNU_FFLAGS[@]|$(GNU_FFLAGS)|g' \
+  -e 's|@GNU_FCFLAGS[@]|$(GNU_FCFLAGS)|g' \
+  -e 's|@YACC[@]|$(YACC)|g' \
+  -e 's|@LEX[@]|$(LEX)|g' \
+  -e 's|@TEX[@]|$(TEX)|g' \
+  -e 's|@MODIFICATION_DELAY[@]|$(MODIFICATION_DELAY)|g' \
+  -e 's|@am_AUTOCONF[@]|$(am_AUTOCONF)|g' \
+  -e 's|@am_AUTOM4TE[@]|$(am_AUTOM4TE)|g' \
+  -e 's|@am_AUTORECONF[@]|$(am_AUTORECONF)|g' \
+  -e 's|@am_AUTOHEADER[@]|$(am_AUTOHEADER)|g' \
+  -e 's|@am_AUTOUPDATE[@]|$(am_AUTOUPDATE)|g' \
+  -e 's|@sh_errexit_works[@]|$(sh_errexit_works)|g' \
+  -e 's|@configure_input[@]|Generated from $@.in.  DO NOT EDIT BY HAND!|'
+
+defs-static: defs-static.in
+       $(AM_V_at)rm -f $@ $@-t
+       $(AM_V_GEN)$(do_subst) $(srcdir)/defs-static.in >$@-t
+       $(AM_V_at) : Sanity check on the substitutions; \
+       if LC_ALL=C grep '@[a-zA-Z0-9_][a-zA-Z0-9_]*@' $@-t; then \
+         echo "$@ contains unexpanded substitution (see lines above)"; \
+         exit 1; \
+       fi
+       $(AM_V_at)chmod a-w $@-t && mv -f $@-t $@
+EXTRA_DIST += defs-static.in
+CLEANFILES = defs-static
+
+# If two test scripts have the same basename, they will end up sharing
+# the same log file, leading to all sort of undefined and undesired
+# behaviours.
+check-no-repeated-test-name:
+       @LC_ALL=C; export LC_ALL; \
+        lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
+          | sort | uniq -c | awk '($$1 > 1) { print }' \
+          | sed 's/\.log$$//' | grep . >&2 \
+          && { \
+            echo $@: test names listed above are duplicated >&2; \
+            exit 1; \
+          }; :
+check-local: check-no-repeated-test-name
+.PHONY: check-no-repeated-test-name
 
 ## Checking the list of tests.
 test_subdirs = . pm
 include $(srcdir)/CheckListOfTests.am
-maintainer-check-list-of-tests: $(parallel_tests)
+
+# Run the testsuite with the installed aclocal and automake.
+installcheck-local:
+       am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
 
 clean-local: clean-local-check
 .PHONY: clean-local-check
@@ -147,3 +210,86 @@ clean-local-check:
           find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
           rm -rf "$$@"; \
         fi;
+
+## Run the testsuite through the `prove' utility.  Mostly for maintainers,
+## and to find out possible incompatibilities between `prove' and the
+## Automake own TAP driver.
+
+PROVE = prove
+AM_PROVEFLAGS = --timer
+AM_PROVECMD = \
+  test -z "$$tests" || \
+    { \
+      $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) \
+      $(PROVE) $(AM_PROVEFLAGS) -e $(srcdir)/prove-runner $(PROVEFLAGS) \
+      $$tests $(AM_TESTS_FD_REDIRECT); \
+    }
+
+EXTRA_DIST += prove-runner
+
+.PHONY: prove installprove
+prove installprove: $(TESTS) prove-runner defs-static
+       @exit_status=0; \
+## The testsuite can be run either using the automake build tree or
+## the already-installed automake package.
+       case '$@' in \
+         install*) am_running_installcheck=yes;; \
+         *) am_running_installcheck=no;; \
+       esac; \
+       export am_running_installcheck; \
+## XXX Our poor-man way to handle inter-tests dependencies without the
+## XXX help of make.  This is obviously fragile and doesn't scale,
+## XXX but for now it's good enough since we have only one possible
+## XXX inter-tests dependency at the moment.
+       need_tap_common_setup=no; \
+       lst=' $(TESTS) '; for t in $$lst; do \
+         case ' $(on_tap_with_common_setup_TESTS) ' in \
+           *" $$t "*) need_tap_common_setup=yes; break;; \
+         esac; \
+       done; \
+## For VPATH builds.
+       if test $$need_tap_common_setup = yes; then \
+         t=tap-common-setup.test; \
+         if test -f ./$$t; then \
+           tests=./$$t; \
+         else \
+           tests=$(srcdir)/$$t; \
+         fi; \
+## Do not stop if there's a failure here, we want to run the following
+## tests anyway.
+         echo "$@: running pre-requisite tests ..."; \
+         $(AM_PROVECMD) || exits_status=$$?; \
+         echo "$@: done.  We'll shortly run the main testsuite."; \
+       fi; \
+## Handle VPATH builds, and ensure that the tests have a properly
+## qualified path.
+       tests=`\
+         for t in $(TESTS); do \
+## XXX In next line, another hack for inter-tests dependencies: this
+## XXX can't run concurrently to the tests that use the data files it
+## XXX generates.
+           case "$$need_tap_common_setup,/$$t" in \
+             yes,*/tap-common-setup.test) continue;; \
+           esac; \
+           if test -f ./$$t; then \
+             echo ./$$t; \
+           else \
+             echo $(srcdir)/$$t; \
+           fi; \
+         done`; \
+## Extra environment, mostly for use by `prove-runner'.
+## XFAIL_TESTS gets normalized to play nicer with VPATH builds.
+       XFAIL_TESTS=`\
+         for t in $(XFAIL_TESTS); do \
+           echo $$t; echo ./$$t; echo $(srcdir)/$$t; \
+         done | LC_ALL=C sort | uniq`; \
+       XFAIL_TESTS=`echo $$XFAIL_TESTS`; \
+       TAP_RUNNER='$(TAP_LOG_COMPILE)' \
+       TEST_RUNER='$(TEST_LOG_COMPILE)' \
+       export XFAIL_TESTS TAP_RUNNER TEST_RUNNER; \
+## For consistency with the Automake testsuite harness, that exports
+## this unconditionally in the test scripts' environment.
+       srcdir='$(srcdir)'; export srcdir; \
+## Here we go.
+       $(AM_PROVECMD) || exit_status=$$?; \
+       exit $$exit_status;
index 561f426..bfd5562 100644 (file)
@@ -5,15 +5,43 @@ User interface
 ==============
 
 
-Running all tests
+Running the tests
 -----------------
 
-  make check
+  To run all tests:
+
+    make -k check
 
   You can use `-jN' for faster completion (it even helps on a
   uniprocessor system, due to unavoidable sleep delays, as
   noted below).
 
+  To rerun only failed tests:
+
+    make -k recheck
+
+  To run only tests that are newer than their last results:
+
+    make -k check RECHECK_LOGS=
+
+  To run only selected tests:
+
+    make -k check TESTS="foo.test bar.test"             (GNU make)
+    env TESTS="foo.test bar.test" make -e -k check      (non-GNU make)
+
+ To run the tests in cross-compilation mode, you should first configure
+ the automake source tree to a cross-compilation setup.  For example, to
+ run with a Linux-to-MinGW cross compiler, you will need something like
+ this:
+
+   ./configure --host i586-mingw32msvc --build i686-pc-linux-gnu
+
+ To avoid possible spurious error, you really have to *explicitly* specify
+ `--build' in addition to `--host'; the `lib/config.guess' script can help
+ determine the correct value to pass to `--build'.
+ Then you can just run the testsuite in the usual way, and the test cases
+ using a compiler should automatically use a cross-compilation setup.
+
 
 Interpretation
 --------------
@@ -28,15 +56,15 @@ Interpretation
 
   Other:
     SKIP  - skipped tests (third party tools not available)
+    ERROR - some unexpected error condition
 
 
 Getting details from failures
 -----------------------------
 
-  Each test is a shell script, and by default is run by /bin/sh.
-  In a non-VPATH build you can run them directly, they will be verbose.
-  By default, verbose output of a test foo.test is retained in the log
-  file foo.log.  A summary log is created in the file test-suite.log.
+  By default, verbose output of a test `foo.test' or `foo.tap' is
+  retained in the log file `foo.log'.  A summary log is created in
+  the file `test-suite.log'.
 
   You can limit the set of files using the TESTS variable, and enable
   detailed test output at the end of the test run with the VERBOSE
@@ -44,25 +72,66 @@ Getting details from failures
 
     env VERBOSE=x TESTS='first.test second.test ...' make -e check
 
+  You can also run the tests by hand, as explained in the next subsection.
+
+
+About the tests
+---------------
+
+  There are two kinds of tests in the Automake testsuite (both implemented
+  as shell scripts).  The scripts with the `.test' suffix are "simple"
+  tests, their outcome completely determined by their exit status.  Those
+  with the `.tap' suffix use the TAP protocol.  If you want to run a test
+  by hand, you can do so directly if it is a simple test:
+
+    ./nogzip.test
+
+  (it will be verbose by default), while if it is a TAP test you can pass
+  it to your preferred TAP runner, as in e.g.:
+
+    prove --verbose --merge ./add-missing.tap
+
+  The tests can also be run directly in a VPATH build, as with:
+
+    /path/to/srcdir/tests/nogzip.test
+    prove --verbose --merge /path/to/srcdir/tests/add-missing.tap
+
 
 Supported shells
 ----------------
 
+  By default, the tests are run by the $SHELL detected at configure
+  time.  They also take care to re-execute themselves with that shell,
+  unless told not to.  So, to run the tests with a different shell, say
+  `/path/to/another/sh', the user must use:
+
+    AM_TESTS_REEXEC=no /path/to/another/sh ./foo.test
+    AM_TESTS_REEXEC=no prove -v -e /path/to/another/sh ./bar.tap
+
+  to run a test directly, and:
+
+    make check LOG_COMPILER=/path/to/sh         (GNU make)
+    LOG_COMPILER=/path/to/sh make -e check      (non-GNU make)
+
+  to run the test(s) through the makefile test driver.
+
   The test scripts are written with portability in mind, so that they
   should run with any decent Bourne-compatible shell.
 
   However, some care must be used with Zsh, since, when not directly
-  starting in Bourne-compatibility mode, it has some incompatibilities
-  in the handling of `$0' which conflict with our usage, and which have
-  no easy workaround.  Thus, if you want to run a test script, say
-  foo.test, with Zsh, you *can't* simply do `zsh foo.test', but you
-  *must* resort to:
-    zsh -o no_function_argzero foo.test
+  started in Bourne-compatibility mode, it has some incompatibilities
+  in the handling of `$0' which conflict with our usage.  Our testsuite
+  can automatically work around these incompatibilities when a version
+  4.3 or later of Zsh is used, but unfortunately not when an older
+  version of Zsh is used.  Thus, if you want to run a test script, say
+  foo.test, with Zsh 4.2, you *can't* simply do `zsh foo.test', but
+  you *must* resort to:
+    AM_TESTS_REEXEC=no zsh -o no_function_argzero foo.test
 
-  Note that this problem does not occur if zsh is executed through a
-  symlink with a basename of `sh', since in that case it starts
-  in Bourne compatibility mode.  So you should be perfectly safe when
-  /bin/sh is zsh.
+  Note that this problem does not occur if Zsh is executed through
+  a symlink with a basename of `sh', since in that case Zsh starts
+  in Bourne compatibility mode.  So you should be perfectly safe
+  when /bin/sh is Zsh, even a it's version < 4.3.
 
 
 Reporting failures
@@ -115,27 +184,41 @@ Do
   instead.
 
   For tests that use the `parallel-tests' Automake option, set the shell
-  variable `parallel_tests' to "yes" before including ./defs.  Also,
-  do not use for them a name that ends in `-p.test', since that would
-  risk to clash with automatically-generated tests.  For tests that are
-  *not* meant to work with the `parallel-tests' Automake option (these
-  should be very very few), set the shell variable `parallel_tests' to
-  "no" before including ./defs.
-
-  ./defs sets a skeleton configure.in.  If possible, append to this
-  file.  In some cases you'll have to overwrite it, but this should
-  be the exception.  Note that configure.in registers Makefile.in
-  but do not output anything by default.  If you need ./configure
-  to create Makefile, append AC_OUTPUT to configure.in.
-
-  Use `set -e' to catch failures you might not have thought of.
+  variable `am_parallel_tests' to "yes" before including ./defs.  For tests
+  that are *not* meant to work with the `parallel-tests' Automake option
+  (these should be very very few), set the shell variable `am_parallel_tests'
+  to "no" before including ./defs.
+
+  Some tests in the Automake testsuite are auto-generated; those tests
+  might have custom extensions, but their basename (that is, with such
+  extension stripped) is expected to end with "-w" string, optionally
+  followed by decimal digits.  For example, the name of a valid
+  auto-generated test can be `color-w.test' or `tap-signal-w09.tap'.
+  Please don't name hand-written tests in a way that could cause them
+  to be confused with auto-generated tests; for example, `u-v-w.test'
+  or `option-w0.tap' are *not* valid name for hand-written tests.
+
+  ./defs brings in some commonly required files, and sets a skeleton
+  configure.in.  If possible, append to this file.  In some cases
+  you'll have to overwrite it, but this should be the exception.  Note
+  that configure.in registers Makefile.in but do not output anything by
+  default.  If you need ./configure to create Makefile, append AC_OUTPUT
+  to configure.in.  In case you don't want ./defs to pre-populate your
+  test directory (which is a rare occurrence), set `$am_create_destdir'
+  to "empty" before sourcing ./defs.
+
+  By default, the testcases are run with the `errexit' shell flag on,
+  to make it easier to catch failures you might not have thought of.
+  If  this is undesirable in some testcase, you can use `set +e' to
+  disable the `errexit' flag (but please do so only if you have a
+  very good reason).
 
   End the test script with a `:' or `Exit 0'.  Otherwise, when somebody
   changes the test by adding a failing command after the last command,
-  the test will spuriously fail because $? is nonzero at the end.
-  Note that this is relevant also for tests using `set -e', if they
-  contain commands like "grep ... Makefile.in && Exit 1" (and there
-  are indeed a lot of such tests).
+  the test will spuriously fail because $? is nonzero at the end.  Note
+  that this is relevant even if the `errexit' shell flag is on, in case
+  the test contains commands like "grep ... Makefile.in && Exit 1" (and
+  there are indeed a lot of such tests).
 
   Use $ACLOCAL, $AUTOMAKE, $AUTOCONF, $AUTOUPDATE, $AUTOHEADER,
   $PERL, $MAKE, $EGREP, and $FGREP, instead of the corresponding
@@ -144,12 +227,11 @@ Do
   Use $sleep when you have to make sure that some file is newer
   than another.
 
-  Use `cat' or `grep' to display (part of) files that may be
-  interesting for debugging, so that when a user send a verbose
-  output we don't have to ask him for more details.  Display stderr
-  output on the stderr file descriptor.  If some redirected command
-  is likely to fail, and `set -e' is in effect, display its output
-  even in the failure case, before exiting.
+  Use `cat' or `grep' to display (part of) files that may be interesting
+  for debugging, so that when a user send a verbose output we don't have
+  to ask him for more details.  Display stderr output on the stderr file
+  descriptor.  If some redirected command is likely to fail, display its
+  output even in the failure case, before exiting.
 
   Use `Exit' rather than `exit' to abort a test.
 
@@ -172,6 +254,13 @@ Do
   code preserves filenames with spaces.  This will catch errors like
   `echo $filename | ...`.
 
+  Make sure your test script can be used to faithfully check an
+  installed version of automake (as with "make installcheck").  For
+  example, if you need to copy or grep an automake-provided script,
+  do not assume that they can be found in the `$top_srcdir/lib'
+  directory, but use `$am_scriptdir' instead.  The complete list of
+  such `$am_..dir' variables can be found in tests/defs-static.in.
+
   Before commit: make sure the test is executable, add the tests to
   TESTS in Makefile.am, add it to XFAIL_TESTS in addition if needed,
   write a ChangeLog entry, send the diff to <automake-patches@gnu.org>.
diff --git a/tests/ac-output-old.tap b/tests/ac-output-old.tap
new file mode 100755 (executable)
index 0000000..5eeb672
--- /dev/null
@@ -0,0 +1,181 @@
+#!/bin/sh
+# Copyright (C) 1996, 2000, 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/>.
+
+# Test for various older bugs related to quoting, escaping and
+# line breaking in the use of AC_OUTPUT.  Synthesised by a bunch
+# of older tests (referenced below).
+
+. ./defs || Exit 1
+
+plan_ 22
+
+rm -f configure.in depcomp # Not required.
+
+# -----------------------------------------------------------------------
+
+# Test for bug reported by François Pinard.
+# If \ is in AC_OUTPUT, automake barfs.
+# This was the old test `acoutbs.test'.
+
+# Also test for bug reported by David A. Swierczek.
+# Another bug with \ in AC_OUTPUT (this time with whitespace).
+# This was the old test `acoutbs2.test'.
+
+acoutbs_check ()
+{
+  dir=acoutbs$1
+  mkdir $dir
+  cd $dir
+  cat > configure.in
+  touch Makefile.am zot.in
+  command_ok_ "aclocal groks '\\' in AC_OUTPUT ($dir)" $ACLOCAL
+  command_ok_ "automake groks '\\' in AC_OUTPUT ($dir)" $AUTOMAKE
+  command_ok_ "autoconf groks '\\' in AC_OUTPUT ($dir)" $AUTOCONF
+  command_ok_ "can ./configure in $dir" ./configure
+  command_ok_ "zot created in $dir" test -f zot
+  ls -a > lst || bailout_ "cannot get file listing in $dir"
+  command_ok_ "'\\' not leaked in filenames in $dir" not grep '\\' lst
+  cd ..
+}
+
+acoutbs_check 1 << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_OUTPUT(Makefile \
+zot)
+END
+
+acoutbs_check 2 << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_ARG_PROGRAM
+AC_PROG_INSTALL
+AC_PROG_MAKE_SET
+AC_OUTPUT(\
+   Makefile \
+   zot
+)
+END
+
+# -----------------------------------------------------------------------
+
+# Test for bug reported by Jerome Santini.
+# If I put this line in my configure.in:
+#  AC_OUTPUT(Makefile src/Makefile tests/Makefile, echo timestamp > stamp-h)dnl
+# automake is not happy:
+#  [ ... ]
+# This was the old test `acoutnoq.test'.
+
+mkdir acoutnoq
+cd acoutnoq
+
+cat > configure.in << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_OUTPUT(Makefile, [true])
+END
+
+: > Makefile.am
+
+command_ok_ "aclocal and quoted AC_OUTPUT second argument" $ACLOCAL
+command_ok_ "automake and quoted AC_OUTPUT second argument" $AUTOMAKE
+
+cd ..
+
+# -----------------------------------------------------------------------
+
+# Test for bug when AC_OUTPUT has 2 args on the same line, eg:
+#   AC_OUTPUT([Makefile automake tests/Makefile],[chmod +x automake])
+# This was the old test `acoutpt.test'.
+
+mkdir acoutpt
+cd acoutpt
+
+cat > configure.in << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_OUTPUT([Makefile], [true])
+END
+
+: > Makefile.am
+
+command_ok_ "aclocal and two AC_OUTPUT arguments on same line" $ACLOCAL
+command_ok_ "automake and two AC_OUTPUT arguments on same line" $AUTOMAKE
+
+cd ..
+
+# -----------------------------------------------------------------------
+
+# Test for bug reported by Eric Magnien.
+# This was the old test `acoutpt2.test'.
+
+mkdir acoutpt2
+cd acoutpt2
+
+# Name of the current "subtest".
+cur=acoutput2
+
+cat > configure.in <<END
+AC_INIT([$cur], [1.0])
+AM_INIT_AUTOMAKE
+AC_OUTPUT([subdir/Makefile subdir/foo Makefile foo], [true])
+END
+
+mkdir subdir
+
+: > Makefile.am
+: > subdir/Makefile.am
+: > foo.in
+: > subdir/foo.in
+
+command_ok_ "aclocal and AC_OUTPUT ($cur)" $ACLOCAL
+command_ok_ "automake and AC_OUTPUT ($cur)" $AUTOMAKE
+command_ok_ "foo.in mentioned two times in Makefile.in ($cur)" \
+             test `$FGREP foo.in Makefile.in | wc -l` -eq 2
+
+# This ought to work as well.
+command_ok_ "'automake -a -f' and AC_OUTPUT ($cur)" \
+            $AUTOMAKE --add-missing --force-missing
+
+cd ..
+
+# -----------------------------------------------------------------------
+
+# Test for bug reported by François Pinard.
+# This was the old test `acoutqnl.test'.
+
+mkdir acoutqnl
+cd acoutqnl
+
+cat > configure.in << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AC_OUTPUT([Makefile],
+[echo zardoz has spoken])
+END
+
+: > Makefile.am
+
+command_ok_ "aclocal and two AC_OUTPUT arguments on two lines" $ACLOCAL
+command_ok_ "automake and two AC_OUTPUT arguments on two lines" $AUTOMAKE
+
+cd ..
+
+# -----------------------------------------------------------------------
+
+# And we're done.
+Exit 0
index 581fe77..c7cdf78 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2005, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2010, 2011, 2012 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
 #
 # Also check for --install.
 
-. ./defs || Exit 1
+# TODO: write a sister test that doesn't use a `dirlist' file, but
+# TODO: puts third-party macros directly into `acdir'.
 
-set -e
+am_create_testdir=empty
+. ./defs || Exit 1
 
-cat >> configure.in << 'END'
-MACRO2
+cat > configure.in << 'END'
+AC_INIT
 MACRO1
+MACRO2
 MACRO3
 END
 
-mkdir m4_1 m4_2 dirlist-test
+ACLOCAL="$ACLOCAL --system-acdir acdir"
+
+mkdir m4_1 m4_2 acdir acdir2
+echo ./acdir2 > acdir/dirlist
 
 cat >m4_1/somedefs.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro11 >> foo])
-AC_DEFUN([MACRO2], [echo macro21 > foo])
+AC_DEFUN([MACRO1], [:macro11:])
+AC_DEFUN([MACRO2], [:macro21:])
 EOF
 
 cat >m4_2/somedefs.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro12 >> foo])
+AC_DEFUN([MACRO1], [:macro12:])
 EOF
 
-cat >dirlist-test/macro.m4 <<EOF
-AC_DEFUN([MACRO3], [echo macro3 >> foo])
+cat >acdir2/macro.m4 <<EOF
+AC_DEFUN([MACRO3], [:macro33:])
 EOF
 
 $ACLOCAL -I m4_1 -I m4_2
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
-grep macro3 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
 grep MACRO3 aclocal.m4
 test ! -f m4_1/macro.m4
 test ! -f m4_2/macro.m4
@@ -59,10 +65,9 @@ $sleep
 
 $ACLOCAL -I m4_2 -I m4_1
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro21 foo
-grep macro3 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
 grep MACRO3 aclocal.m4
 test ! -f m4_1/macro.m4
 test ! -f m4_2/macro.m4
@@ -71,10 +76,9 @@ $sleep
 
 $ACLOCAL -I m4_1 -I m4_2 --install
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
-grep macro3 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
 grep MACRO3 aclocal.m4 && Exit 1
 test -f m4_1/macro.m4
 test ! -f m4_2/macro.m4
@@ -82,15 +86,16 @@ cp aclocal.m4 copy.m4
 
 $sleep
 
-echo '#GREPME' >>dirlist-test/macro.m4
+echo '#GREPME' >>acdir2/macro.m4
 $ACLOCAL -I m4_1 -I m4_2 --install
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
-grep macro3 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
+$FGREP ':macro33:' configure
 grep MACRO3 aclocal.m4 && Exit 1
 grep GREPME m4_1/macro.m4 && Exit 1
 test -f m4_1/macro.m4
 test ! -f m4_2/macro.m4
 diff aclocal.m4 copy.m4
+
+:
index 61e9e8a..7ce0a4d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # Make sure that when two files define the same macro in the same
 # directory, the macro from the lexically greatest file is used.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT
 MACRO2
 MACRO1
 END
@@ -29,16 +29,17 @@ END
 mkdir m4
 
 cat >m4/version1.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro11 >> foo])
-AC_DEFUN([MACRO2], [echo macro21 > foo])
+AC_DEFUN([MACRO1], [:macro11:])
+AC_DEFUN([MACRO2], [:macro21:])
 EOF
 
 cat >m4/version2.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro12 >> foo])
+AC_DEFUN([MACRO1], [:macro12:])
 EOF
 
 $ACLOCAL -I m4
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro21 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro21:' configure
+
+:
index 14d699a..4e4f30f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # directory, the macro from the lexically greatest file is used.
 # Same as acloca11.test, but without calling MACRO2.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cat >> configure.in << 'END'
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
 MACRO1
 END
 
 mkdir m4
 
 cat >m4/version1.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro11 >> foo])
-AC_DEFUN([MACRO2], [echo macro21 > foo])
+AC_DEFUN([MACRO1], [:macro11:])
+AC_DEFUN([MACRO2], [:macro21:])
 EOF
 
 cat >m4/version2.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro12 >> foo])
+AC_DEFUN([MACRO1], [:macro12:])
 EOF
 
 $ACLOCAL --verbose -I m4
 $AUTOCONF
-./configure
-grep macro11 foo && Exit 1
-grep macro21 foo && Exit 1
-grep macro12 foo
+$FGREP ':macro11:' configure && Exit 1
+$FGREP ':macro21:' configure && Exit 1
+$FGREP ':macro12:' configure
+
+:
index 56a54eb..77b43fe 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 m4_include([somefile.m4])
 AC_OUTPUT
index 1bdf7c7..d919aab 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2008, 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
 # Make sure m4_included files are also scanned for definitions.
 # Report from Phil Edwards.
 
-required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_PROG_LIBTOOL
 AC_OUTPUT
index dd612ec..b1f3723 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
 # Make sure aclocal scans configure.in for macro definitions.
 # PR/319.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 # Start macros with AM_ because that causes aclocal to complain if it
 # cannot find them.
 
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
 m4_include([somedef.m4])
 AC_DEFUN([AM_SOME_MACRO])
 AC_DEFUN([AM_SOME_OTHER_MACRO])
index 93bde8b..1d897ed 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2011, 2012 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
 # Make sure aclocal does not include definitions that are not actually
 # evaluated.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
 AC_SUBST([POM])
 END
 
@@ -33,4 +32,5 @@ EOF
 
 $ACLOCAL -I m4
 grep m4/some.m4 aclocal.m4 && Exit 1
+
 :
index 884f24b..282dc7e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2008, 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
 
 # Make sure aclocal report unused required macros.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT
 SOME_DEFS
 END
 
@@ -36,4 +36,6 @@ EOF
 
 WARNINGS=error $ACLOCAL -I m4 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep 'configure.in:4:.*UNDEFINED_MACRO' stderr
+grep '^configure\.in:2:.*UNDEFINED_MACRO' stderr
+
+:
index 7c97301..a26ef38 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2005, 2006, 2008, 2010, 2012 Free Software Foundation,
-# Inc.
+# Copyright (C) 2005, 2006, 2008, 2010, 2011, 2012 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
 
 # Test for --install with #serial numbers.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT
 AM_MACRO1
 AM_MACRO2
 END
 
-mkdir 1 2 3 4
+mkdir 1 2 3 4 5 6
 
 cat >1/m1.m4 <<EOF
 #serial 1.8.1230.9
-AC_DEFUN([AM_MACRO1], [echo macro11 >> foo])
-AC_DEFUN([AM_MACRO2], [echo macro21 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro11:])
+AC_DEFUN([AM_MACRO2], [:macro21:])
 EOF
 
 cat >2/m1.m4 <<EOF
 #serial 1.8.1231.9
-AC_DEFUN([AM_MACRO1], [echo macro12 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro12:])
 EOF
 
 cat >3/m2.m4 <<EOF
 #serial 13
-AC_DEFUN([AM_MACRO2], [echo macro23 >> foo])
+AC_DEFUN([AM_MACRO2], [:macro23:])
 EOF
 
 cat >3/m1.m4 <<EOF
 #serial 1.8.1230.1
-AC_DEFUN([AM_MACRO1], [echo macro13 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro13:])
 EOF
 
 cat >4/mumble.m4 <<EOF
 #serial 0
-AC_DEFUN([AM_MACRO1], [echo macro14 >> foo])
+AC_DEFUN([AM_MACRO1], [:macro14:])
+EOF
+
+cat >5/ill-formed.m4 <<EOF
+#serial bla
+#serial .2
+#serial
+AC_DEFUN([AM_MACRO1], [:macro15:])
+EOF
+
+cat >6/after-def.m4 <<EOF
+AC_DEFUN([AM_MACRO1], [:macro16:])
+#serial 1
 EOF
 
 clean_stale ()
 {
-  rm -rf aclocal.m4 configure foo autom4te*.cache
+  rm -rf aclocal.m4 configure autom4te*.cache
 }
 
 $ACLOCAL -I 1 -I 2 -I 3 -I 4
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
 
 clean_stale
 $ACLOCAL  -I 1 -I 2 -I 3 -I 4 --install
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro23 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro23:' configure
 
 cp -f aclocal.m4 aclocal-m4.sav
 clean_stale
 mv -f aclocal-m4.sav aclocal.m4
 $ACLOCAL -I 4 -I 1 -I 2 -I 3 --install --dry-run
 $AUTOCONF
-./configure
-grep macro12 foo
-grep macro23 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro23:' configure
 
 clean_stale
 $ACLOCAL -I 4 -I 1 -I 2 -I 3 --install
 $AUTOCONF
-./configure
-grep macro14 foo
-grep macro23 foo
+$FGREP ':macro14:' configure
+$FGREP ':macro23:' configure
 
 clean_stale
 $ACLOCAL -I 4 -I 1 -I 2 --install 2>stderr && { cat stderr >&2; Exit 1; }
@@ -96,15 +104,16 @@ grep 'macro.*AM_MACRO2.*not found' stderr
 clean_stale
 $ACLOCAL -I 4 -I 1 --install
 $AUTOCONF
-./configure
-grep macro14 foo
-grep macro21 foo
+$FGREP ':macro14:' configure
+$FGREP ':macro21:' configure
 
-mkdir dirlist-test
-cat >dirlist-test/m1.m4 <<EOF
+mkdir acdir
+ACLOCAL="$ACLOCAL --system-acdir acdir"
+
+cat >acdir/m1.m4 <<EOF
 #serial 456
-AC_DEFUN([AM_MACRO1], [echo macro1d >> foo])
-AC_DEFUN([AM_MACRO2], [echo macro2d >> foo])
+AC_DEFUN([AM_MACRO1], [:macro1d:])
+AC_DEFUN([AM_MACRO2], [:macro2d:])
 EOF
 clean_stale
 $ACLOCAL -I 4 -I 1 --diff=diff >stdout 2>stderr || {
@@ -118,4 +127,12 @@ grep '#serial 456' stdout
 test ! -f 4/m1.m4
 grep 'installing.*4/m1\.m4' stderr
 
+$ACLOCAL -I 5 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+test `grep -c 'ill-formed serial' stderr` -eq 3
+
+$ACLOCAL -I 6 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'serial.*before any macro definition' stderr
+
 :
index a198d9a..10bae6b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005  Free Software Foundation, Inc.
+# Copyright (C) 2005, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >configure.in <<'END'
 AC_INIT([acloca19], [1.0])
 m4_include([aconfig.ac])
index 6408bef..4516d69 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 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
 
 # Make sure aclocal does not write into symlinked aclocal.m4.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
+echo 'm4_define([FOO], [wrong foo])' > foo.m4
+echo 'm4_define([FOO], [right foo])' > acinclude.m4
+echo 'AC_INIT FOO' > configure.in
 
-cat >foo.m4 <<'END'
-m4_define([FOO], [echo wrong foo])
-END
+chmod a-w foo.m4
 
-cat >doit.in <<'END'
-@LN_S@ foo.m4 aclocal.m4
-END
+# Setup.
+ln -s foo.m4 aclocal.m4 && test -h aclocal.m4 \
+  || skip_ "cannot create symlinks to files"
 
-cat >configure.in <<'END'
-AC_INIT([acloca20], [1.0])
-AC_PROG_LN_S
-dnl FOO
-AC_CONFIG_FILES([doit], [chmod +x doit])
-AC_OUTPUT
-END
-
-$AUTOCONF
-./configure
-./doit
-grep 'wrong foo' aclocal.m4
-
-cat >acinclude.m4 <<'END'
-m4_define([FOO], [echo right foo])
-END
-sed 's/dnl //' <configure.in >configure.int
-mv -f configure.int configure.in
+# Sanity check.
+grep 'wrong foo' aclocal.m4 \
+  || fatal_ "weird error symlinking aclocal.m4 -> foo.m4"
 
 $ACLOCAL
-$AUTOCONF --force
-./configure | grep 'right foo'
+$AUTOCONF
+grep 'right foo' configure
 grep 'wrong foo' foo.m4
+
+:
index 7b66279..716cd80 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
 # Also make sure aclocal does not think 'include' is
 # an Autoconf macro.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 dnl m4_include(__some_really_bogus_nonexistent_file__.m4)
   # m4_include(__some_really_bogus_nonexistent_file__.m4)
index 913e4d9..cf16627 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007, 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
 # 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 the "deleted header file" issue is fixed wrt. aclocal.m4
-# dependencies.
+# Make sure the "deleted header file" issue is fixed w.r.t. aclocal.m4
+# dependencies.  See also related the tests `remake-deleted-m4-file.test'
+# and 'remake-renamed-m4-macro-and-file.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 FOO
 AC_OUTPUT
@@ -34,16 +33,21 @@ EOF
 cat >Makefile.am <<EOF
 ACLOCAL_AMFLAGS = -I .
 EOF
+
 $ACLOCAL -I .
 $AUTOMAKE
 $AUTOCONF
+
 ./configure
 $MAKE
 grep GREPFOO Makefile
 grep GREPBAR Makefile && Exit 1
+
 sed 's/FOO/BAR/' < configure.in > t
 mv -f t configure.in
 rm -f foo.m4
 $MAKE
 grep GREPFOO Makefile && Exit 1
 grep GREPBAR Makefile
+
+:
similarity index 66%
rename from tests/nogzip2.test
rename to tests/acloca23.test
index f6e01ab..f4f8a22 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 diagnostic for no-dist-gzip without dist-*.
+# Ensure we diagnose underquoted AC_DEFUN's.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
-AC_INIT([nogzip], [1.0])
-AM_INIT_AUTOMAKE([no-dist-gzip])
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
+AC_INIT
+FOO
 END
 
-: > Makefile.am
+mkdir m4
+cat >m4/foo.m4 <<EOF
+AC_DEFUN(FOO, [echo foo])
+EOF
 
-$ACLOCAL
-AUTOMAKE_fails
-grep 'configure.in:2:.*no-dist-gzip' stderr
+$ACLOCAL -I m4 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'underquoted definition.*FOO' stderr
+grep 'warning.*warning' stderr && Exit 1
 
-echo 'AUTOMAKE_OPTIONS = dist-bzip2' > Makefile.am
-$AUTOMAKE
+:
index e02db30..42f8b45 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir am sys
 
 cat >> configure.in <<'END'
index 1a642b5..64d9b62 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir loc sys
 
 echo 'AM_DUMMY_MACRO' >> configure.in
index 511ccee..ca01174 100755 (executable)
@@ -20,8 +20,6 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT
 AM_FOO
index 5e46eb6..a07d5ab 100755 (executable)
@@ -19,8 +19,6 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT
 AM_FOO
index e1157a1..0be9938 100755 (executable)
@@ -19,8 +19,6 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT
 AM_FOO
index c02fd3b..a9c864b 100755 (executable)
 am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << END
-AC_INIT([$me], [1.0])
+cat > configure.in << 'END'
+AC_INIT([foo], [1.0])
 AM_INIT_AUTOMAKE([parallel-tests])
 FOO_MACRO
 BAR_MACRO
index 16fd3f9..42c6820 100755 (executable)
@@ -19,8 +19,6 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT
 AM_FOO_MACRO
index 368416c..4094b35 100755 (executable)
 
 # Test on aclocal's `--print-ac-dir' option.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 $ACLOCAL --print-ac-dir
-test "`$ACLOCAL --print-ac-dir`" = "$testaclocaldir/acdir"
+test "`$ACLOCAL --print-ac-dir`" = "$am_system_acdir"
 
 $ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir
 test "`$ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir`" = foo
@@ -30,6 +29,6 @@ $ACLOCAL --system-acdir /bar --print-ac-dir
 test "`$ACLOCAL --system-acdir /bar --print-ac-dir`" = /bar
 
 $ACLOCAL --automake-acdir /bar --print-ac-dir
-test "`$ACLOCAL --automake-acdir /bar --print-ac-dir`" = "$testaclocaldir/acdir"
+test "`$ACLOCAL --automake-acdir /bar --print-ac-dir`" = "$am_system_acdir"
 
 :
index 439faa9..b85250f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2004, 2008, 2010 Free Software
+# Copyright (C) 1998, 2001, 2002, 2004, 2008, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 
 # Test on some aclocal options.  Report from Alexandre Oliva.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
+echo "AC_INIT([$me], [0]) AM_INIT_AUTOMAKE" > configure.in
 
 $ACLOCAL --output=fred
 test -f fred
 
 $ACLOCAL --output 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep 'option.*--output.*an argument' stderr
+grep 'option.*--output.*requires an argument' stderr
 grep '[Tt]ry.*--help.*for more information' stderr
 
 $ACLOCAL --unknown-option 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep 'unrecognized.*--unknown-option' stderr
+grep 'unrecognized option.*--unknown-option' stderr
 grep '[Tt]ry.*--help.*for more information' stderr
 
 $ACLOCAL --ver 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep 'unrecognized.*--ver' stderr
+grep 'unrecognized option.*--ver' stderr
 grep '[Tt]ry.*--help.*for more information' stderr
 
 $ACLOCAL --versi
index a6aee0f..f679239 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2002, 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure include of include detects missing macros
-. ./defs || Exit 1
 
-set -e
+am_create_testdir=empty
+. ./defs || Exit 1
 
-echo GNOME_X_CHECKS >> configure.in
+cat >> configure.in <<END
+AC_INIT([$me], [1.0])
+GNOME_X_CHECKS
+END
 
 mkdir macros
 
 cat > macros/gnome.m4 << 'END'
 AC_DEFUN([GNOME_X_CHECKS], [
-       AM_PATH_GTK(0.99.5,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
+# Use a macro that cannot be installed in a third-party system-wide m4
+# file; otherwise, this test might fail under "make installcheck".
+       AM__PATH__GTK(0.99.5,,AC_MSG_ERROR(GTK not installed, or gtk-config not in path))
 ])
 END
 
 $ACLOCAL -I macros 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr
-grep 'macros/gnome.m4:2:.*AM_PATH_GTK.*not found' stderr
+grep '^macros/gnome\.m4:4:.*AM__PATH__GTK.*not found' stderr
+
+:
index 9fa96ec..c7e4cda 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # Make sure dependencies on aclocal.m4 are set correctly.
 # Report from Jim Meyering.
 
-# We need GNU make for the `rebuild rules' to be triggered.
-required=GNUmake
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_PROG_RANLIB
+AM_PROG_AR
 AC_PROG_CC
 MY_MACRO
 AC_CONFIG_FILES([lib/Makefile])
@@ -60,16 +58,18 @@ EOF
 
 $ACLOCAL -I m4
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --add-missing
 ./configure
 $MAKE check-not-foo
 
 # Update one of the macros.  This should cause ./configure, Makefile.in,
-# Makefile, lib/Makefile.in, and lib/Makfile to be updated.  This assumes
-# GNU make.
+# Makefile, lib/Makefile.in, and lib/Makefile to be updated.
 
 cat >m4/mymacro.m4 <<'EOF'
 AC_DEFUN([MY_MACRO], [AC_LIBOBJ([foo])])
 EOF
 
+using_gmake || $MAKE
 $MAKE check-foo
+
+:
index ec032e4..430b364 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure that aclocal.m4's dependencies are honored
-# in sub-directories.
+# Test to make sure that aclocal.m4's dependencies are honored in
+# sub-directories.  See also related tests `remake-subdir*.test'.
 
-# This test assumes that the `make' utility is able to start
-# over and reload Makefiles which have been remade (a non-POSIX feature).
-required='GNUmake'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_TEST([GREPME])
 AC_CONFIG_FILES([sub/Makefile])
index ddf9401..c631e64 100755 (executable)
 # Make sure aclocal.m4 is rebuilt whenever a configure
 # dependency changes.  Test for acinclude.m4 and VPATH too.
 
-required='GNUmake'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 SOME_DEFS
 AC_CONFIG_FILES([sub/Makefile])
index e123a3f..20b90b9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 SOME_DEFS
 AC_CONFIG_FILES([sub/Makefile])
index d935f4f..86d0e02 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 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
 
 # Make sure aclocal does not require unused macros.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
 SOME_DEFS
 END
 
index 7a786aa..0b9f213 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2010, 2011, 2012 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
 
 # Make sure aclocal define macros in the same order as -I's.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cat >> configure.in << 'END'
+cat > configure.in << 'END'
+AC_INIT
 MACRO1
 MACRO2
 END
@@ -28,22 +28,22 @@ END
 mkdir m4_1 m4_2
 
 cat >m4_1/somedefs.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro11 > foo])
-AC_DEFUN([MACRO2], [echo macro21 >> foo])
+AC_DEFUN([MACRO1], [:macro11:])
+AC_DEFUN([MACRO2], [:macro21:])
 EOF
 
 cat >m4_2/somedefs.m4 <<EOF
-AC_DEFUN([MACRO1], [echo macro12 > foo])
+AC_DEFUN([MACRO1], [:macro12:])
 EOF
 
 $ACLOCAL -I m4_1 -I m4_2
 $AUTOCONF
-./configure
-grep macro11 foo
-grep macro21 foo
+$FGREP ':macro11:' configure
+$FGREP ':macro21:' configure
 
 $ACLOCAL --force -I m4_2 -I m4_1
 $AUTOCONF --force
-./configure
-grep macro12 foo
-grep macro21 foo
+$FGREP ':macro12:' configure
+$FGREP ':macro21:' configure
+
+:
diff --git a/tests/acoutbs2.test b/tests/acoutbs2.test
deleted file mode 100755 (executable)
index 5e03c08..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1996, 2000, 2002, 2010  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/>.
-
-# Test for bug reported by David A. Swierczek.
-# Another bug with \ in AC_OUTPUT (this time with whitespace).
-
-. ./defs || Exit 1
-
-set -e
-
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_ARG_PROGRAM
-AC_PROG_INSTALL
-AC_PROG_MAKE_SET
-AC_OUTPUT(\
-   Makefile \
-   zot
-)
-END
-
-: > Makefile.am
-: > zot.in
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-
-./configure
-
-test -f zot || Exit 1
-ls -a | grep '\\' && Exit 1
-
-:
diff --git a/tests/acoutnoq.test b/tests/acoutnoq.test
deleted file mode 100755 (executable)
index 344905f..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002, 2010 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/>.
-
-# Test for bug reported by Jerome Santini.
-# If I put this line in my configure.in:
-# AC_OUTPUT(Makefile src/Makefile tests/Makefile, echo timestamp > stamp-h)dnl
-# automake is not happy:
-# [ ... ]
-
-. ./defs || Exit 1
-
-set -e
-
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile, [true])
-END
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOMAKE
diff --git a/tests/acoutpt.test b/tests/acoutpt.test
deleted file mode 100755 (executable)
index e18e4e4..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002, 2010 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/>.
-
-# Test for bug when AC_OUTPUT has 2 args on the same line, eg:
-#   AC_OUTPUT([Makefile automake tests/Makefile],[chmod +x automake])
-
-. ./defs || Exit 1
-
-set -e
-
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT([Makefile], [true])
-END
-
-: > Makefile.am
-
-$ACLOCAL
-$AUTOMAKE
index abbfc92..d4a5436 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2008, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2001, 2002, 2008, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >configure.in <<EOF
 AC_INIT
 AM_INIT_GUILE_MODULE
index e8eaace..a02b34c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -16,8 +16,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_SUBST([FOOBAR_LDFLAGS],[blablabla])
index b1c0bce..cbbbfd8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 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
@@ -16,8 +16,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
diff --git a/tests/add-missing.tap b/tests/add-missing.tap
new file mode 100755 (executable)
index 0000000..49dc8bb
--- /dev/null
@@ -0,0 +1,391 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Test that automake complains when required auxiliary files are not
+# found, and that `automake --add-missing' installs the files (and only
+# the files) it's supposed to, and that these files are symlinked by
+# default, but copied if the `--copy' option is used.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+plan_ "later"
+
+build_aux=build-aux
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+
+# Try to improve readability of displayed diffs.
+if diff -u /dev/null /dev/null; then
+  am_diff='diff -u'
+elif diff -c /dev/null /dev/null; then
+  am_diff='diff -c'
+else
+  am_diff=diff
+fi
+
+# MinGW/MSYS lacks real symlinks, so we'll have to skip some checks
+# on that system.  More details below.
+echo dummy > foo
+if ln -s foo bar && test -h bar; then
+  have_true_symlinks=yes
+else
+  have_true_symlinks=no
+fi
+rm -f foo bar
+
+cat > configure.stub << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([$build_aux])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+
+# Pre-compute aclocal.m4, in order to save several aclocal invocations.
+cat configure.stub - > configure.in <<'END'
+AC_PROG_CC
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+AC_CANONICAL_SYSTEM
+AM_PATH_LISPDIR
+AM_PATH_PYTHON
+END
+$ACLOCAL || framework_failure_ "cannot pre-compute aclocal.m4"
+
+rm -rf configure.in autom4te*.cache
+mv aclocal.m4 aclocal.stub
+
+# For debugging.
+cat configure.stub
+cat aclocal.stub
+
+check_count=0
+
+# This is hacky and ugly and complex, but allow us to organize our tests
+# below in a more "declarative fashion".  All in all, a good trade-off.
+check_ ()
+{
+  set +x # Temporary disable shell traces to remove noise from log files.
+  incr_ check_count
+  echo check count: $check_count
+  override=no
+  run_aclocal=no
+  fetch_file=
+  while test $# -gt 0; do
+    case $1 in
+      --override) override=yes;;
+      --run-aclocal) run_aclocal=yes;;
+      --fetch-file) fetch_file=$2; shift;;
+      *) framework_failure_ "check_: invalid argument '$1'";;
+    esac
+    shift
+  done
+  mkdir testdir-$check_count
+  cd testdir-$check_count
+  # Directory for common data files (specific to the current test, but
+  # shared by its "subtests").
+  mkdir generic
+  cd generic
+  # Use `echo > ...', not `: > ...', here and below, as Solaris 10 /bin/sh
+  # might not execute the latter (the Autoconf manual gives more details).
+  echo > Makefile.am
+  if test $override = yes; then
+    echo > configure.in
+  else
+    cp "$ocwd"/configure.stub configure.in
+  fi
+  test -z "$fetch_file" || cp "$ocwd/$fetch_file" .
+  # Read description of "test scenario" from standard input.
+  what= line= name= files=
+  while read line; do
+    case $line in
+      '== Name ==') what=NAME;;
+      '== Makefile.am ==') what=Makefile.am;;
+      '== configure.in ==') what=configure.in;;
+      '== Files ==') what=LIST;;
+      '==*') framework_failure_ "invalid input line: $line";;
+      ''|'#%'*) : Empty line or ad-hoc comment, ignore. ;;
+      *)
+        if test $what = LIST; then
+          files="$files $line"
+        elif test $what = NAME; then
+          name=$line
+        else
+          printf '%s\n' "$line" >> "$what"
+        fi
+        ;;
+    esac
+  done
+  test -n "$name" || fatal_ "name of a test case not specified"
+  if test $run_aclocal = yes; then
+    if $ACLOCAL; then
+      ok_ "[$name] aclocal.m4 rebuilt"
+      echo == aclocal.m4 ==
+      cat aclocal.m4
+    else
+      not_ok_ "[$name] aclocal failure, aclocal.m4 not rebuilt"
+    fi
+  else
+    cp "$ocwd"/aclocal.stub aclocal.m4
+  fi
+  echo == Makefile.am ==
+  cat Makefile.am
+  echo == configure.in ==
+  cat configure.in
+  echo Expected files: $files
+  mkdir "$build_aux"
+  cd ..
+  # End of "test scenario" setup.
+  set -x # Re-enable shell traces.
+  pwd
+  ls -l generic
+  # Test once with `--copy', once without.
+  for action in link copy; do
+    case $action in
+      link) opts='--add-missing';;
+      copy) opts='-a --copy';;
+         *) fatal_ "invalid value '$action' for \$action";;
+    esac
+    pfx="[$action $name]"
+    cp -R generic $action
+    cd $action
+    # If the required auxiliary files are missing, and automake is
+    # not told to install them, it should complain and error out,
+    # and also give a useful suggestion.
+    AUTOMAKE_fails -d "$pfx missing files, automake fails"
+    for f in $files; do
+      command_ok_ \
+        "$pfx warn about missing file $f" \
+        grep "required file ['\`]$build_aux/$f' not found" stderr
+      # Suggest the user to use `--add-missing'.
+      command_ok_ \
+        "$pfx suggest --add-missing for $f" \
+        grep ".*--add-missing.* install .*$f" stderr
+    done
+    # No files should be automatically installed by automake if it
+    # is not told to.
+    if ls "$build_aux" | grep .; then r='not ok'; else r=ok; fi
+    result_ "$r" "$pfx no extra files installed"
+    AUTOMAKE_run -d "$pfx automake run successfully" -- $opts
+    ls -l . $build_aux
+    # The expected files should get installed correctly (e.g., no
+    # broken symlinks).
+    for f in $files; do
+      command_ok_ \
+        "$pfx file $f installed" \
+        test -f $build_aux/$f
+    done
+    # Automake should inform about which files it's installing.
+    for f in $files; do
+      command_ok_ \
+        "$pfx report installation of $f" \
+        grep ": installing ['\`]$build_aux/$f'$" stderr
+    done
+    # Only the expected files should be installed.  But automake always
+    # require `missing' and `install-sh', so account for them.
+    all_files="install-sh missing $files"
+    for f in $all_files; do echo $f; done | sort | uniq > files.exp
+    (cd $build_aux && ls) | sort > files.got
+    cat files.exp
+    cat files.got
+    command_ok_ \
+      "$pfx all and only expected files installed" \
+      $am_diff files.exp files.got
+    # The files should be copied by `--copy' and symlinked otherwise.
+    # But these checks make no sense on systems like MSYS/MinGW where
+    # there are no true symlinks ('ln -s' behaves like 'cp -p'), so be
+    # ready to skip the checks in that case.  See automake bug#10441.
+    for f in $files; do
+      if test $have_true_symlinks = no; then
+        skip_ -r "system lacks true symlinks" "$pfx $f is a symlink or not"
+      else
+        if test -h $build_aux/$f; then
+          is_symlink=yes
+        else
+          is_symlink=no
+        fi
+        case $action,$is_symlink in
+          link,yes)     ok_ "$pfx $f has been symlinked"     ;;
+           link,no) not_ok_ "$pfx $f has not been symlinked" ;;
+          copy,yes) not_ok_ "$pfx $f has been symlinked"     ;;
+           copy,no)     ok_ "$pfx $f has not been symlinked" ;;
+                 *)  fatal_ "invalid condition in case"      ;;
+        esac
+      fi
+    done
+    # Now that the required auxiliary files have been installed, automake
+    # should not complain anymore even if the `--add-missing' option is
+    # not used.
+    AUTOMAKE_run -d "$pfx automake finds all added files"
+    cd ..
+  done # for action in link copy
+  cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
+}
+
+# Automake should always and unconditionally require the `missing'
+# and `install-sh' scripts.
+check_ <<'END'
+== Name ==
+minimal
+== Files ==
+install-sh missing
+END
+
+check_ <<'END'
+== Name ==
+depcomp/C
+== Files ==
+depcomp
+== configure.in ==
+AC_PROG_CC
+== Makefile.am ==
+bin_PROGRAMS = foo
+END
+
+check_ <<'END'
+== Name ==
+depcomp/C++
+== Files ==
+depcomp
+== configure.in ==
+AC_PROG_CXX
+== Makefile.am ==
+bin_PROGRAMS = foo
+foo_SOURCES = foo.cc
+END
+
+check_ --run-aclocal <<'END'
+== Name ==
+compile
+== Files ==
+compile
+== configure.in ==
+# Using AM_PROG_CC_C_O in configure.in should be enough.  No need to
+# use AC_PROG_CC too, nor to define xxx_PROGRAMS in Makefile.am.
+AM_PROG_CC_C_O
+END
+
+# For config.guess and config.sub.
+for mach in build host target system; do
+  MACH=`echo "$mach" | LC_ALL=C tr '[a-z]' '[A-Z]'`
+  check_ <<END
+== Name ==
+cfg-$mach
+== Files ==
+config.sub
+config.guess
+== configure.in ==
+AC_CANONICAL_$MACH
+END
+done
+
+check_ <<'END'
+== Name ==
+ylwrap/Lex
+== Files ==
+ylwrap
+== configure.in ==
+AC_PROG_CC
+AC_PROG_LEX
+== Makefile.am ==
+AUTOMAKE_OPTIONS = no-dependencies
+bin_PROGRAMS = foo
+foo_SOURCES = foo.l
+END
+
+check_ <<'END'
+== Name ==
+ylwrap/Yacc
+== Files ==
+ylwrap
+== configure.in ==
+AC_PROG_CC
+AC_PROG_YACC
+== Makefile.am ==
+AUTOMAKE_OPTIONS = no-dependencies
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+END
+
+echo '@setfilename foo.info' > foo.texi
+check_ --fetch-file foo.texi <<'END'
+== Name ==
+Texinfo
+== Files ==
+texinfo.tex
+== Makefile.am ==
+info_TEXINFOS = foo.texi
+END
+
+echo '@include version.texi' >> foo.texi
+check_ --fetch-file foo.texi <<'END'
+== Name ==
+Texinfo/mdate-sh
+== Files ==
+mdate-sh
+texinfo.tex
+== Makefile.am ==
+info_TEXINFOS = foo.texi
+END
+
+rm -f foo.texi
+
+check_ <<'END'
+== Name ==
+elisp-comp
+== Files ==
+elisp-comp
+== configure.in ==
+AM_PATH_LISPDIR
+== Makefile.am ==
+lisp_LISP = foo.el
+END
+
+check_ <<'END'
+== Name ==
+py-compile
+== Files ==
+py-compile
+== configure.in ==
+AM_PATH_PYTHON
+== Makefile.am ==
+python_PYTHON = foo.py
+END
+
+# Try few unrelated auxiliary scripts together.
+check_ <<'END'
+== Name ==
+misc
+== Files ==
+py-compile
+depcomp
+ylwrap
+config.sub
+config.guess
+== configure.in ==
+AC_CANONICAL_BUILD
+AC_CANONICAL_HOST
+AC_PROG_CXX
+== Makefile.am ==
+PYTHON = python
+pythondir = $(prefix)/py
+YACC = bison -y
+bin_PROGRAMS = foo
+foo_SOURCES = bar.yxx baz.c++
+python_PYTHON = zardoz.py
+END
+
+:
index 791d081..9a13771 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2007, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2007, 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
 
 . ./defs || Exit 1
 
-set -e
-
 targets='all install-exec install-data uninstall'
 echo "$targets:" | sed -e 's/[ :]/-local&/g' > Makefile.am
-cat Makefile.am  # might be useful for debugging
+cat Makefile.am # For debugging.
 
 $ACLOCAL
 $AUTOMAKE
 
 for target in $targets; do
-  grep "${target}-local" Makefile.in  # might be useful for debugging
+  grep "${target}-local" Makefile.in # For debugging.
   grep "${target}-am:.*${target}-local" Makefile.in
 done
 
index 38b6f8c..f38167e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 $ACLOCAL
 
 targets='all install-exec install-data uninstall'
index 8a1e06e..947a5b4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -18,9 +18,8 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
+AM_PROG_AR
 AC_PROG_CC
 END
 
@@ -31,6 +30,7 @@ libtu_a_LIBADD = @ALLOCA@
 END
 
 : > alloca.c
+: > ar-lib
 
 $ACLOCAL
 AUTOMAKE_fails
index caf11a3..0c1ac4d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 END
 
 cat > Makefile.am << 'END'
@@ -31,6 +30,7 @@ libtu_la_LIBADD = @LTALLOCA@
 END
 
 : > alloca.c
+: > ar-lib
 
 $ACLOCAL
 AUTOMAKE_fails
index 1ee8ed6..d907df0 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 2008, 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
@@ -18,8 +19,6 @@
 # Jim Meyering.
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([alpha], [1.0a])
 AM_INIT_AUTOMAKE
@@ -61,7 +60,7 @@ $AUTOCONF
 $AUTOMAKE
 ./configure
 
-# make distdir should fail because NEWS does not mention 1.0a
+# "make distdir" should fail because NEWS does not mention 1.0a
 $MAKE check 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'NEWS not updated' stderr
index e125377..b8ef266 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([alpha], [1.0b])
 AM_INIT_AUTOMAKE([readme-alpha])
diff --git a/tests/am-tests-environment.test b/tests/am-tests-environment.test
new file mode 100755 (executable)
index 0000000..524d8d2
--- /dev/null
@@ -0,0 +1,91 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# parallel-tests: check AM_TESTS_ENVIRONMENT support, and its
+# interactions with TESTS_ENVIRONMENT.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_MKDIR_P
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .sh .test
+TESTS = foo.test bar.sh
+SH_LOG_COMPILER = sh
+AM_TESTS_ENVIRONMENT = \
+  $(MKDIR_P) quux.dir; \
+  if test -f $(srcdir)/test-env.sh; then \
+    . $(srcdir)/test-env.sh; \
+  fi; \
+  FOO=1; export FOO;
+EXTRA_DIST = $(TESTS) test-env.sh
+END
+
+cat > foo.test << 'END'
+#! /bin/sh
+ls -l && test -d quux.dir
+END
+chmod a+x foo.test
+
+cat > bar.sh << 'END'
+echo "FOO='$FOO'"
+echo "BAR='$BAR'"
+test x"$FOO" = x"$BAR"
+END
+
+debug_info ()
+{
+  cat test-suite.log
+  cat foo.log
+  cat bar.log
+}
+
+minicheck ()
+{
+  debug_info
+  test -d quux.dir
+}
+
+miniclean ()
+{
+  rmdir quux.dir
+  rm -f foo.log bar.log test-suite.log
+}
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+TESTS_ENVIRONMENT='BAR=1' $MAKE check || { debug_info; Exit 1; }
+minicheck
+miniclean
+
+TESTS_ENVIRONMENT='BAR=2' $MAKE check && { debug_info; Exit 1; }
+minicheck
+miniclean
+
+echo 'BAR=1 && export BAR' > test-env.sh
+$MAKE check || { debug_info; Exit 1; }
+minicheck
+$MAKE distcheck
+
+:
index af098d2..bfc728e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CFLAGS=foo
 AC_SUBST(AM_BAR)
index 59813cc..c5051e1 100755 (executable)
 # Test an example from the manual about the `amhello' package:
 # using DESTDIR to build simple, no-frills binary packages.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir"/../doc/amhello-1.0.tar.gz . \
+cp "$am_docdir"/amhello-1.0.tar.gz . \
   || fatal_ "cannot get amhello tarball"
 
 gzip -dc amhello-1.0.tar.gz | tar xf -
index 56f7729..a7977f3 100755 (executable)
 # using VPATH builds to configure the same package with different
 # options.
 
+am_create_testdir=empty
 required=gcc
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir"/../doc/amhello-1.0.tar.gz . \
+cp "$am_docdir"/amhello-1.0.tar.gz . \
   || fatal_ "cannot get amhello tarball"
 
 gzip -dc amhello-1.0.tar.gz | tar xf -
index 6db91ba..287462f 100755 (executable)
 # Test an example from the manual about the `amhello' package:
 # cross-compiling a package from Linux/Unix to MinGW.
 
+am_create_testdir=empty
 required=i586-mingw32msvc-gcc
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir"/../doc/amhello-1.0.tar.gz . \
+cp "$am_docdir"/amhello-1.0.tar.gz . \
   || fatal_ "cannot get amhello tarball"
 
 host=i586-mingw32msvc
-build=`"$testsrcdir"/../lib/config.guess` && test -n "$build" \
+build=`"$am_scriptdir"/config.guess` && test -n "$build" \
   || fatal_ "cannot guess build platform"
 case $build in *mingw*) skip_ "build system is MinGW too";; esac
 
index 79d9fc2..97c425e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2002, 2004, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AM_ZARDOZ >> configure.in
 
 $ACLOCAL 2>stderr && { cat stderr >&2; Exit 1; }
index e83b800..568299a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<END
 AM_CONDITIONAL([COND], [true])
 END
 
 mkdir sub
 
-# These two Makefile contain the same errors, but have different
-# warnings disabled.
-
 cat >Makefile.am <<END
 if COND
 AUTOMAKE_OPTIONS = -Wall
@@ -38,4 +33,6 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:2.*AUTOMAKE_OPTIONS.*conditional' stderr
+grep '^Makefile\.am:2.*AUTOMAKE_OPTIONS.*conditional' stderr
+
+:
diff --git a/tests/amopts-location.test b/tests/amopts-location.test
new file mode 100755 (executable)
index 0000000..23b75c0
--- /dev/null
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that errors about AUTOMAKE_OPTIONS refers to correct
+# locations.
+
+. ./defs || Exit 1
+
+cat > Makefile.am <<'END'
+# comment \
+# continued
+include Makefile0.am
+END
+
+cat > Makefile0.am <<'END'
+#1
+#2
+#3
+include Makefile1.am
+END
+
+cat > Makefile1.am <<'END'
+AUTOMAKE_OPTIONS = tar-pax
+# comment
+END
+
+cat > Makefile2.am <<'END'
+## automake comment
+bar:
+       :
+line = \
+continued
+AUTOMAKE_OPTIONS = tar-ustar
+END
+
+cat > Makefile3.am <<'END'
+quux = a
+AUTOMAKE_OPTIONS =
+quux += b
+AUTOMAKE_OPTIONS += tar-v7
+zardoz = 1
+END
+
+cat >>configure.in <<'END'
+AC_CONFIG_FILES([Makefile2 Makefile3])
+END
+
+$ACLOCAL
+# Automake options 'tar-v7', 'tar-ustar' and 'tar-pax' can only be used
+# as argument to AM_INIT_AUTOMAKE, and not in AUTOMAKE_OPTIONS.
+AUTOMAKE_fails
+
+# Check that all the expected line numbers are correctly reported
+# in automake warning/error messages.
+grep '^Makefile1\.am:1:.*tar-pax' stderr
+grep '^Makefile2\.am:6:.*tar-ustar' stderr
+grep '^Makefile3\.am:2:.*tar-v7' stderr
+grep '^Makefile\.am:3:.*Makefile0\.am.*included from here' stderr
+grep '^Makefile0\.am:4:.*Makefile1\.am.*included from here' stderr
+
+# And also check that no botched line number is reported.
+cat stderr \
+  | grep -v '^Makefile\.am:3:'  \
+  | grep -v '^Makefile0\.am:4:' \
+  | grep -v '^Makefile1\.am:1:' \
+  | grep -v '^Makefile2\.am:6:' \
+  | grep -v '^Makefile3\.am:2:' \
+  | grep . && Exit 1
+
+:
diff --git a/tests/amopts-variable-expansion.test b/tests/amopts-variable-expansion.test
new file mode 100755 (executable)
index 0000000..05fe6c8
--- /dev/null
@@ -0,0 +1,52 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that AUTOMAKE_OPTIONS support variable expansion.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$am_original_AUTOMAKE
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([-Wall -Werror gnu])
+AC_CONFIG_FILES([Makefile])
+END
+
+cat > Makefile.am <<'END'
+# The following should expand to `-Wnone -Wno-error foreign -Wportability'.
+AUTOMAKE_OPTIONS = $(foo) foreign
+AUTOMAKE_OPTIONS += ${bar}
+foo = $(foo1)
+foo1 = ${foo2}
+foo2 = -Wnone
+foo2 += $(foo3)
+foo3 = -Wno-error
+bar = -Wportability
+# This will give a warning with `-Wportability'.
+zardoz :=
+# This would give a warning with `-Woverride'.
+install:
+END
+
+$ACLOCAL
+AUTOMAKE_run
+grep '^Makefile\.am:.*:=.*not portable' stderr
+grep README stderr && Exit 1
+$EGREP '(install|override)' stderr && Exit 1
+
+:
index 1fad2ca..9bba8fa 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_SUBST([backslash], "\\")
 _AM_SUBST_NOTMAKE([backslash])
diff --git a/tests/ansi10.test b/tests/ansi10.test
deleted file mode 100755 (executable)
index 4ff2c86..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002, 2006  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 ansi2knr works with $(LIBOBJS).
-
-required=gcc
-. ./defs || Exit 1
-
-set -e
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AC_PROG_CC_STDC
-AM_C_PROTOTYPES
-AC_PROG_RANLIB
-AC_LIBOBJ([hello])
-AC_CONFIG_FILES([dir/Makefile])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-SUBDIRS = dir
-END
-
-mkdir dir
-
-cat > dir/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
-noinst_LIBRARIES = liblib.a
-liblib_a_SOURCES =
-liblib_a_LIBADD = $(LIBOBJS)
-END
-
-cat > dir/hello.c << 'END'
-#include <stdio.h>
-
-int
-main (int argc, char **argv)
-{
-   printf ("hello\n");
-}
-END
-
-$ACLOCAL
-$AUTOCONF -Wno-obsolete
-$AUTOMAKE -Wno-obsolete -a
-
-# Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do.
-test `grep -c ac_cv_prog_cc_stdc configure` -gt 1
-
-./configure ac_cv_prog_cc_stdc=no
-$MAKE
-test -f dir/hello_.c
-$MAKE distclean
-test ! -f dir/hello_.c
-
-# Also run without forcing ansi2knr, so we make sure the
-# rules work with ANSI compilers.
-./configure
-$MAKE
-test ! -f dir/hello_.c
diff --git a/tests/ansi2knr-deprecation.test b/tests/ansi2knr-deprecation.test
deleted file mode 100755 (executable)
index 543d9c6..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#! /bin/sh
-# Copyright (C) 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/>.
-
-# Check that the use of automatic de-ANSI-fication feature is deprecated.
-# That feature will be removed in the next major Automake release.
-
-. ./defs || Exit 1
-
-set -e
-
-warn_rx='automatic de-ANSI-fication.*deprecated'
-
-cat >> configure.in <<'END'
-AC_PROG_CC
-AM_C_PROTOTYPES
-END
-
-$ACLOCAL
-
-$AUTOCONF -Wall -Werror -Wno-obsolete
-$AUTOCONF -Wnone -Wobsolete -Werror 2>stderr && { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep "^configure\\.in:5:.* AM_C_PROTOTYPES:.*$warn_rx" stderr
-
-sed '/AM_C_PROTOTYPES/d' configure.in > config.stub
-diff configure.in config.stub && fatal_ "failed to edit configure.in"
-rm -f configure.in
-
-cat > Makefile.stub <<'END'
-ANSI2KNR = :
-U =
-END
-
-for opt in ansi2knr lib/ansi2knr; do
-  # ansi2knr option in Makefile.am
-  cp config.stub configure.in
-  cp Makefile.stub Makefile.am
-  echo "AUTOMAKE_OPTIONS = $opt" >> Makefile.am
-  cat Makefile.am # For debugging.
-  $AUTOMAKE -Wno-obsolete
-  AUTOMAKE_fails
-  grep "^Makefile\.am:3:.*$warn_rx" stderr
-  AUTOMAKE_fails -Wnone -Wobsolete
-  grep "^Makefile\.am:3:.*$warn_rx" stderr
-  # ansi2knr option in configure.in
-  cp Makefile.stub Makefile.am
-  sed "s|^\\(AM_INIT_AUTOMAKE\\).*|\1([$opt])|" config.stub > configure.in
-  cat configure.in # For debugging.
-  $AUTOMAKE -Wno-obsolete
-  AUTOMAKE_fails
-  grep "^configure\.in:2:.*$warn_rx" stderr
-  AUTOMAKE_fails -Wnone -Wobsolete
-  grep "^configure\.in:2:.*$warn_rx" stderr
-done
-
-:
diff --git a/tests/ansi2knr-no-more.test b/tests/ansi2knr-no-more.test
new file mode 100755 (executable)
index 0000000..a2ac330
--- /dev/null
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that any attempt to use the obsolete de-ANSI-fication support
+# is diagnosed.
+
+. ./defs || Exit 1
+
+warn_rx='automatic de-ANSI-fication.*removed'
+
+echo AC_PROG_CC >> configure.in
+$ACLOCAL
+mv aclocal.m4 aclocal.sav
+cp configure.in configure.sav
+
+echo AM_C_PROTOTYPES >> configure.in
+
+$ACLOCAL -Wnone 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep "^configure\\.in:5:.*$warn_rx" stderr
+
+cat aclocal.sav "$am_automake_acdir"/protos.m4 > aclocal.m4
+$AUTOCONF -Wnone 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep "^configure\\.in:5:.*$warn_rx" stderr
+
+for opt in ansi2knr lib/ansi2knr; do
+  # ansi2knr option in Makefile.am
+  cp configure.sav configure.in
+  echo "AUTOMAKE_OPTIONS = $opt" > Makefile.am
+  rm -rf autom4te*.cache
+  AUTOMAKE_fails -Wnone
+  grep "^Makefile\.am:1:.*$warn_rx" stderr
+  # ansi2knr option in configure.in
+  echo > Makefile.am # `echo', not `:', for Solaris /bin/sh.
+  sed "s|^\\(AM_INIT_AUTOMAKE\\).*|\1([$opt])|" configure.sav >configure.in
+  cat configure.in # For debugging.
+  rm -rf autom4te*.cache
+  AUTOMAKE_fails -Wnone
+  grep "^configure\.in:2:.*$warn_rx" stderr
+done
+
+:
diff --git a/tests/ansi3.test b/tests/ansi3.test
deleted file mode 100755 (executable)
index 22ef485..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2003, 2010 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/>.
-
-# Actual test of ansi2knr functionality.  Relies on existence
-# of working gcc.
-
-required=gcc
-. ./defs || Exit 1
-
-set -e
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AM_C_PROTOTYPES
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr no-dependencies
-bin_PROGRAMS = hello
-END
-
-cat > hello.c << 'END'
-#include <stdio.h>
-int
-main (int argc, char *argv[])
-{
-   printf ("yeah, yeah\n");
-   return 0;
-}
-END
-
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-# We use gcc and not gcc -traditional as the latter fails on some
-# Linux boxes (Red Hat 5.1 in particular).
-$ACLOCAL
-$AUTOCONF -Wno-obsolete
-$AUTOMAKE -Wno-obsolete -a 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep 'Makefile.am:1:.*ansi2knr\.c' stderr
-CC='gcc' ./configure
-ANSI2KNR=./ansi2knr U=_ $MAKE -e
-./hello
diff --git a/tests/ansi3b.test b/tests/ansi3b.test
deleted file mode 100755 (executable)
index 0688781..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2003, 2010 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/>.
-
-# Actual test of ansi2knr functionality.  Relies on existence
-# of working gcc.  Same as ansi3.test, but with AUTOMAKE_OPTIONS
-# defined in configure.in.
-
-required=gcc
-. ./defs || Exit 1
-
-set -e
-
-cat > configure.in << 'END'
-AC_INIT([hello], [0.24])
-AM_INIT_AUTOMAKE([ansi2knr no-dependencies])
-AC_PROG_CC
-AM_C_PROTOTYPES
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
-END
-
-echo 'bin_PROGRAMS = hello' > Makefile.am
-
-cat > hello.c << 'END'
-#include <stdio.h>
-int
-main (int argc, char *argv[])
-{
-   printf ("yeah, yeah\n");
-   return 0;
-}
-END
-
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-# We use gcc and not gcc -traditional as the latter fails on some
-# Linux boxes (Red Hat 5.1 in particular).
-$ACLOCAL
-$AUTOCONF -Wno-obsolete
-$AUTOMAKE -Wno-obsolete -a 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep 'configure.in:2:.*ansi2knr\.1' stderr
-CC='gcc' ./configure
-ANSI2KNR=./ansi2knr U=_ $MAKE -e
-./hello
diff --git a/tests/ansi5.test b/tests/ansi5.test
deleted file mode 100755 (executable)
index d152be0..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001, 2002, 2003  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/>.
-
-# Test for ansi2knr in another directory.
-
-required=gcc
-. ./defs || Exit 1
-
-cat > configure.in << 'END'
-AC_INIT(one/joe.c)
-AM_INIT_AUTOMAKE(liver, 0.23)
-AC_PROG_CC
-AM_C_PROTOTYPES
-AC_OUTPUT(Makefile one/Makefile two/Makefile)
-END
-
-cat > Makefile.am << 'END'
-SUBDIRS = one two
-END
-
-mkdir one two
-
-cat > one/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
-bin_PROGRAMS = joe
-END
-
-cat > two/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ../one/ansi2knr
-bin_PROGRAMS = maude
-END
-
-cat > one/joe.c << 'END'
-#include <stdio.h>
-int
-main (int argc, char *argv[])
-{
-   printf ("joe\n");
-   return 0;
-}
-END
-
-cat > two/maude.c << 'END'
-#include <stdio.h>
-int
-main (int argc, char *argv[])
-{
-   printf ("maude\n");
-   return 0;
-}
-END
-
-set -e
-
-$ACLOCAL
-$AUTOCONF -Wno-obsolete
-$AUTOMAKE -Wno-obsolete -a
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-CC=gcc ./configure
-
-# This is ugly!  If we set U at make time then the "wrong" file gets
-# included.
-find . -name '*.Po' -print \
-| while read file; do
-    base="`echo $file | sed -e 's/\.Po//'`"
-    mv $file ${base}_.Po
-done
-
-# So is this!  If we set ANSI2KNR on the make command line then the
-# wrong value is passed to two's Makefile.
-mv one/Makefile one/Makefile.old
-sed -e 's,ANSI2KNR =,ANSI2KNR = ./ansi2knr,' < one/Makefile.old > one/Makefile
-
-U=_ $MAKE -e
-./one/joe
-./two/maude
diff --git a/tests/ansi6.test b/tests/ansi6.test
deleted file mode 100755 (executable)
index 691614d..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002, 2006, 2008  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/>.
-
-# Check ansi2knr on a source file in subdirectory.
-# From Kevin Ryde.
-
-required=gcc
-. ./defs || Exit 1
-
-cat > configure.in << 'END'
-AC_INIT(ansi6, 1.0)
-AM_INIT_AUTOMAKE
-AC_PROG_CC
-AC_PROG_CC_STDC
-AM_C_PROTOTYPES
-AC_CONFIG_FILES(Makefile)
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
-bin_PROGRAMS = hello
-hello_SOURCES = hello.c sub/dir.c
-END
-
-cat > hello.c << 'END'
-#include <stdio.h>
-
-extern int foo ();
-
-int
-main (int argc, char **argv)
-{
-   printf ("%d\n", foo ());
-}
-END
-
-mkdir sub
-
-cat > sub/dir.c << 'END'
-int
-foo ()
-{
-   return 23;
-}
-END
-
-set -e
-
-$ACLOCAL
-$AUTOCONF -Wno-obsolete
-$AUTOMAKE -Wno-obsolete -a
-
-# Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do.
-test `grep -c ac_cv_prog_cc_stdc configure` -gt 1
-
-./configure ac_cv_prog_cc_stdc=no
-$MAKE
-
-test -f hello_.c
-test -f dir_.c                 # Must be in current directory.
-test ! -f sub/dir_.c
-$MAKE distclean
-test ! -f hello_.c
-test ! -f dir_.c
-
-# Also run without forcing ansi2knr, so we make sure the
-# rules work with ANSI compilers.
-# Report from Andreas Schwab.
-
-./configure
-$MAKE
diff --git a/tests/ansi7.test b/tests/ansi7.test
deleted file mode 100755 (executable)
index 9eae26b..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002, 2008  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/>.
-
-# Check ansi2knr on a source file in subdirectory.
-# ansi6.test is the same test without subdir-objects.
-# From Kevin Ryde.
-
-required=gcc
-. ./defs || Exit 1
-
-cat > configure.in << 'END'
-AC_INIT(ansi6, 1.0)
-AM_INIT_AUTOMAKE
-AC_PROG_CC
-AC_PROG_CC_STDC
-AM_PROG_CC_C_O
-AM_C_PROTOTYPES
-AC_CONFIG_FILES(Makefile)
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr subdir-objects
-bin_PROGRAMS = hello
-hello_SOURCES = hello.c sub/dir.c
-END
-
-cat > hello.c << 'END'
-#include <stdio.h>
-
-extern int foo ();
-
-int
-main (int argc, char **argv)
-{
-   printf ("%d\n", foo ());
-}
-END
-
-mkdir sub
-
-cat > sub/dir.c << 'END'
-int
-foo ()
-{
-   return 23;
-}
-END
-
-set -e
-
-$ACLOCAL
-$AUTOCONF -Wno-obsolete
-$AUTOMAKE -Wno-obsolete -a
-
-# Sanity check: make sure it's ok to set ac_cv_prog_cc_stdc as we do.
-test `grep -c ac_cv_prog_cc_stdc configure` -gt 1
-
-./configure ac_cv_prog_cc_stdc=no
-$MAKE
-
-test -f hello_.c
-test -f sub/dir_.c             # Must be in sub directory, unlike ansi6.test.
-test ! -f dir_.c
-$MAKE distclean
-test ! -f hello_.c
-test ! -f sub/dir_.c
-
-# Also run without forcing ansi2knr, so we make sure the
-# rules work with ANSI compilers.
-# Report from Andreas Schwab.
-
-./configure
-$MAKE
diff --git a/tests/ansi9.test b/tests/ansi9.test
deleted file mode 100755 (executable)
index ab78dda..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002, 2003  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/>.
-
-# Check that subdir sources, and file compiled using per-target flags
-# can still be deansified.
-# Report from Paul D. Smith.
-
-required=gcc
-. ./defs || Exit 1
-
-set -e
-
-cat >>configure.in <<EOF
-AC_PROG_CC
-AM_PROG_CC_C_O
-AM_C_PROTOTYPES
-AC_OUTPUT
-EOF
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr subdir-objects
-noinst_PROGRAMS = loadavg sub/sub
-loadavg_SOURCES = loadavg.c
-loadavg_CFLAGS = -DTEST
-sub_sub_SOURCES = sub/sub.c
-END
-
-cat > loadavg.c << 'END'
-int
-main ()
-{
-   return 0;
-}
-END
-
-mkdir sub
-cp loadavg.c sub/sub.c
-
-$ACLOCAL
-$AUTOCONF -Wno-obsolete
-$AUTOMAKE --add-missing -Wno-override -Wno-obsolete
-
-$FGREP 'loadavg-loadavg$U.o: loadavg$U.c' Makefile.in
-# The following rule should not exist, because the
-# default .o.c: inference rule is enough.
-$FGREP 'sub/sub$U.o: sub/sub$U.c' Makefile.in && Exit 1
-# Force ansi2knr's use, regardless of the compiler.
-./configure ac_cv_prog_cc_stdc=no
-$MAKE sub/sub_.c
diff --git a/tests/ar-lib.test b/tests/ar-lib.test
new file mode 100755 (executable)
index 0000000..116640f
--- /dev/null
@@ -0,0 +1,87 @@
+#! /bin/sh
+# Copyright (C) 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 `ar-lib' wraps the Microsoft Library Manager (lib) correctly.
+
+am_create_testdir=empty
+required=xsi-lib-shell
+. ./defs || Exit 1
+
+get_shell_script ar-lib
+
+# Use a dummy lib, since lib isn't readily available on all systems.
+cat >lib <<'END'
+#! /bin/sh
+if test x"$2" = x-LIST && test x"$3" = xfake.lib; then
+  echo fake.obj
+elif test x"$2" = x-LIST && test x"$3" = xfake2.lib; then
+  printf "%s\n" "dir\\fake2.obj"
+else
+  printf "%s\n" "lib $*"
+fi
+END
+
+chmod +x ./lib
+
+# Check if ar-lib can create an archive with "cr".
+opts=`./ar-lib ./lib cr foo.lib foo.obj`
+test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.obj"
+
+# Check if ar-lib can update an existing archive with "r".
+touch foo.lib
+opts=`./ar-lib ./lib r foo.lib foo.obj`
+test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj"
+
+# Check if ar-lib passes on @FILE with "r"
+opts=`./ar-lib ./lib r foo.lib @list`
+test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib @list"
+
+# Check if ar-lib can delete a member from an archive with "d".
+opts=`./ar-lib ./lib d foo.lib foo.obj`
+test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib"
+
+# Check if ar-lib can delete members in an @FILE.
+echo foo.obj > foolist
+opts=`./ar-lib ./lib d foo.lib @foolist`
+test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib"
+
+# Check if ar-lib can list archive members with "t".
+opts=`./ar-lib ./lib t foo.lib`
+test x"$opts" = x"lib -NOLOGO -LIST foo.lib"
+
+# Check if ar-lib can extract archive members with "x".
+touch fake.lib
+opts=`./ar-lib ./lib x fake.lib`
+test x"$opts" = x"lib -NOLOGO -EXTRACT:fake.obj fake.lib"
+
+# Check if ar-lib can extract specified archive members with "x".
+opts=`./ar-lib ./lib x foo.lib foo.obj`
+test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
+
+# Check if ar-lib can extract members in an @FILE.
+opts=`./ar-lib ./lib x foo.lib @foolist`
+test x"$opts" = x"lib -NOLOGO -EXTRACT:foo.obj foo.lib"
+
+# Check if ar-lib passes -lib and -LTCG through to the wrappee.
+opts=`./ar-lib ./lib -lib -LTCG x foo.lib foo.obj`
+test x"$opts" = x"lib -lib -LTCG -NOLOGO -EXTRACT:foo.obj foo.lib"
+
+# Check if ar-lib can extract backslashed members.
+touch fake2.lib
+opts=`./ar-lib ./lib x fake2.lib`
+test x"$opts" = x"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib"
+
+:
diff --git a/tests/ar-lib2.test b/tests/ar-lib2.test
new file mode 100755 (executable)
index 0000000..5b697fa
--- /dev/null
@@ -0,0 +1,38 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test if AM_PROG_AR installs ar-lib.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = wish
+wish_SOURCES = a.c
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+# Make sure ar-lib is installed, and that Automake says so.
+grep '^configure\.in:.*install.*ar-lib' stderr
+test -f ar-lib
+
+:
similarity index 69%
rename from tests/ansi4.test
rename to tests/ar-lib3.test
index 0c0d339..8be96fa 100755 (executable)
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2008, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Quoting regression.  Test from Thomas Gagne.
+# Test if lib_LIBRARIES requests AM_PROG_AR.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
-AM_C_PROTOTYPES
+AC_PROG_RANLIB
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
-bin_PROGRAMS = hello
-hello_SOURCES = hello.c
+lib_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
 END
 
-: > ansi2knr.1
-: > ansi2knr.c
-: > hello.c
+$ACLOCAL
+AUTOMAKE_fails
+
+grep 'requires.*AM_PROG_AR' stderr
+
+cat >> configure.in << 'END'
+AM_PROG_AR
+END
 
+rm -rf autom4te*.cache
 $ACLOCAL
-$AUTOMAKE -Wno-obsolete
+$AUTOMAKE --add-missing
 
-$FGREP 'ansi2knr.$(' Makefile.in
+:
similarity index 66%
rename from tests/aclibobj.test
rename to tests/ar-lib4.test
index 6ef6f6b..fb0ca5f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 AC_LIBOBJ and friends work.
+# Test if lib_LTLIBRARIES requests AM_PROG_AR.
 
+required=libtoolize
 . ./defs || Exit 1
 
+cp configure.in X
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
+AC_PROG_LIBTOOL
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-noinst_LIBRARIES = libtu.a
-libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+lib_LTLIBRARIES = libfoo.la
+libfoo_la_SOURCES = foo.c
 END
 
-: > maude.c
-: > liver.c
-
+libtoolize
 $ACLOCAL
+AUTOMAKE_fails
 
-set -e
+grep 'requires.*AM_PROG_AR' stderr
 
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
-$AUTOMAKE
+cp X configure.in
 
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
 
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+:
diff --git a/tests/ar-lib5a.test b/tests/ar-lib5a.test
new file mode 100755 (executable)
index 0000000..8f1d227
--- /dev/null
@@ -0,0 +1,71 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test if AM_PROG_AR triggers the use of the ar-lib script.
+# This test requires Microsoft lib.
+# Keep this test in sync with sister test `ar-lib5b.test'.
+
+required=lib
+. ./defs || Exit 1
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+# We want to test the content of am_cv_ar_interface in the Makefile.
+AC_SUBST([am_cv_ar_interface])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LIBRARIES = libwish.a
+libwish_a_SOURCES = wish.c
+
+check-local:
+       test x'$(am_cv_ar_interface)' = x'lib'
+       test -f ar-lib-worked
+       test -f libwish.a
+MOSTLYCLEANFILES = ar-lib-worked
+END
+
+cat > wish.c << 'END'
+int wish(void) { return 0; }
+END
+
+mkdir auxdir
+cat - "$am_scriptdir/ar-lib" > auxdir/ar-lib << 'END'
+#! /bin/sh
+:> ar-lib-worked
+END
+chmod +x auxdir/ar-lib
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Sanity check: test that it is ok to use `am_cv_ar_interface' as we do.
+$FGREP 'am_cv_ar_interface=' configure
+
+./configure AR=lib RANLIB=:
+
+$MAKE check
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='AR=lib RANLIB=:'
+
+:
diff --git a/tests/ar-lib5b.test b/tests/ar-lib5b.test
new file mode 100755 (executable)
index 0000000..f697e3c
--- /dev/null
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Test if AM_PROG_AR triggers the use of the ar-lib script.
+# This test does not require Microsoft lib.
+# Keep this test in sync with sister test `ar-lib5a.test'.
+
+. ./defs || Exit 1
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+# We want to test the content of am_cv_ar_interface in the Makefile.
+AC_SUBST([am_cv_ar_interface])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LIBRARIES = libwish.a
+libwish_a_SOURCES = wish.c
+
+check-local:
+       test x'$(am_cv_ar_interface)' = x'lib'
+       test -f ar-lib-worked
+MOSTLYCLEANFILES = ar-lib-worked
+END
+
+cat > wish.c << 'END'
+int wish(void) { return 0; }
+END
+
+mkdir auxdir
+cat > auxdir/ar-lib << 'END'
+#! /bin/sh
+:> ar-lib-worked
+END
+chmod +x auxdir/ar-lib
+
+# Let's fake microsoft lib.
+mkdir bin
+cat > bin/lib << 'END'
+#! /bin/sh
+echo lib command line: $* >&2 # For debugging.
+case " $* " in
+  # The `-OUT:' option is used by tests in configure.  So don't create
+  # the `ar-lib-worked' file here, as that might cause spurious passes
+  # of this test; but don't fail either, as that would confuse said
+  # configure tests.
+  *' -OUT:'*) exit 0;;
+  # This means that $* looks like a command-line for `ar'.  We have to
+  # exit with failure here, to accommodate the two following ortoghonal
+  # scenarios:
+  #  1. when `lib' is tested by configure, this will tell that it does
+  #     not use the ar(1) interface, so that the `ar-lib' script will
+  #     get involved;
+  #  2. when `lib' is called by the Makefile, an ar-style command line
+  #     passed to it would mean that the `ar-lib' script has failed to
+  #     properly munge the command line, or hasn't been invoked to do so.
+  *\ c*) exit 1;;
+  # Assume everything else is OK.
+  *) : > ar-lib-worked;;
+esac
+END
+chmod +x bin/lib
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Sanity check: test that it is ok to use `am_cv_ar_interface' as we do.
+$FGREP 'am_cv_ar_interface=' configure
+
+./configure AR=lib RANLIB=:
+
+$MAKE check
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="AR=lib RANLIB=:"
+
+:
diff --git a/tests/ar-lib6a.test b/tests/ar-lib6a.test
new file mode 100755 (executable)
index 0000000..0e04e82
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test AM_PROG_AR ordering requirements
+# Keep this test in sync with sister test `ar-lib6b.test'.
+
+required=libtoolize
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+m4_ifdef([LT_INIT], [LT_INIT], [AC_PROG_LIBTOOL])
+AM_PROG_AR
+END
+
+libtoolize
+$ACLOCAL
+$AUTOCONF 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+$EGREP '(AC_PROG_LIBTOOL|LT_INIT).*before.*AM_PROG_AR' stderr
+
+:
similarity index 66%
rename from tests/regex-obsolete.test
rename to tests/ar-lib6b.test
index c283025..789691a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 tha the AM_WITH_REGEX macro is reported as obsolete.
+# Test AM_PROG_AR ordering requirements for older Libtools
+# Keep this test in sync with sister test `ar-lib6a.test'.
 
+required=libtoolize
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AM_WITH_REGEX
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AM_PROG_AR
 END
 
+libtoolize
 $ACLOCAL
-$AUTOCONF -Werror -Wobsolete 2>stderr && { cat stderr >&2; Exit 1; }
+$AUTOCONF 2>stderr || { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep '^configure\.in:.*AM_WITH_REGEX.*obsolete' stderr
+
+$EGREP 'AC_PROG_LIBTOOL.*before.*AM_PROG_AR' stderr
 
 :
similarity index 73%
rename from tests/condman.test
rename to tests/ar-lib7.test
index ee2d41b..89a279a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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.
+# Test if automake warns if ar-lib is missing when AM_PROG_AR is used.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AM_CONDITIONAL([FRED], [true])
+AM_PROG_AR
 END
 
-cat > Makefile.am << 'END'
-if FRED
-man_MANS = foo.1
-else
-man_MANS = joe.1
-endif
-END
+:> Makefile.am
 
 $ACLOCAL
-$AUTOMAKE
+AUTOMAKE_fails
+
+grep '^configure\.in:.*ar-lib.*not found' stderr
+
+$AUTOMAKE --add-missing
 
 :
index dbdf246..b0b02a4 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -18,9 +19,8 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_SUBST([AR], ['echo it works'])
 AC_SUBST([ARFLAGS], ['>'])
 AC_SUBST([RANLIB], ['echo really works >>'])
@@ -32,6 +32,8 @@ lib_LIBRARIES = libfoo.a
 libfoo_a_SOURCES =
 END
 
+:> ar-lib
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
index 329f804..289c469 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
@@ -33,7 +31,7 @@ libfoo_a_SOURCES = foo.c
 END
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 grep '^ARFLAGS =' Makefile.in
 grep '^AR =' Makefile.in
 
similarity index 70%
rename from tests/lex4.test
rename to tests/ar3.test
index fee140d..c8db414 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure dependencies work with .ll files.
-# Test synthesized from PR automake/6.
+# Make sure that AR, ARFLAGS, etc. works also when the macro AM_PROG_AR
+# is used.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_PROG_CXX
-AM_PROG_LEX
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-bin_PROGRAMS = zoo
-zoo_SOURCES = joe.ll
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
 END
 
-: > joe.ll
+: > ar-lib
 
 $ACLOCAL
-$AUTOMAKE -a
+$AUTOMAKE
+$EGREP '^ARFLAGS =' Makefile.in
+$EGREP '^AR =' Makefile.in
 
-$FGREP joe.Po Makefile.in
+:
diff --git a/tests/ar4.test b/tests/ar4.test
new file mode 100755 (executable)
index 0000000..2faeeed
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test if configure bails out if $AR does not work and AM_PROG_AR is used.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AM_PROG_AR
+END
+
+$ACLOCAL
+$AUTOCONF
+
+st=0; ./configure AR=/bin/false >stdout 2>stderr || st=$?
+cat stdout
+cat stderr >&2
+test $st -eq 1
+
+grep '^checking.* archiver .*interface.*\.\.\. unknown' stdout
+grep '^configure: error: could not determine /bin/false interface' stderr
+ls *conftest* && Exit 1
+
+:
diff --git a/tests/ar5.test b/tests/ar5.test
new file mode 100755 (executable)
index 0000000..000daa7
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test the optional argument of AM_PROG_AR.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AM_PROG_AR([
+  echo spy > bad-archiver-interface-detected
+  AC_MSG_CHECKING([for something else])
+  AC_MSG_RESULT([found it])
+  echo Grep This
+])
+END
+
+$ACLOCAL
+$AUTOCONF
+
+./configure AR=/bin/false >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^checking.* archiver .*interface.*\.\.\. unknown$' stdout
+grep '^checking for something else\.\.\. found it$' stdout
+grep '^Grep This$' stdout
+test -f bad-archiver-interface-detected
+
+:
index f1bcb76..ec6dbec 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mv configure.in configure.stub
 
 cat > Makefile.am << 'END'
index ab141e7..e7c0396 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2006, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2002, 2003, 2006, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mv configure.in configure.stub
 
 cat > Makefile.am << 'END'
index 5c42c48..f2f40f2 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2006, 2007  Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2002, 2003, 2006, 2007, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mv configure.in configure.stub
 
 cat > Makefile.am << 'END'
index e6bd5a9..931feaf 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<END
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
index 49ab2f0..5674e27 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<END
 AC_OUTPUT
 END
index 3f53d59..7ebfd43 100755 (executable)
@@ -23,8 +23,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 { echo 'm4_include([defs.m4])'
   cat configure.in
   echo 'AC_OUTPUT'
index 66c9bea..76bd740 100755 (executable)
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<END
 AC_CONFIG_HEADERS([config.h sub/config.h cfg2.h:conf2.hin])
 AC_OUTPUT
index db640c4..d2bd60c 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<END
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
index 81464c0..1109129 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 re='Files .*automatically distributed.*if found'
 
 # The automake manual states that the list of automatically-distributed
index 4f37e14..f7a111b 100755 (executable)
@@ -21,8 +21,6 @@
 required=makeinfo
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << END
 AC_OUTPUT
 END
@@ -48,7 +46,7 @@ END
 
 # Required when using Texinfo.
 : > texinfo.tex
-cp "$testsrcdir/../lib/mdate-sh" .
+cp "$am_scriptdir"/mdate-sh .
 
 $ACLOCAL
 $AUTOCONF
index 83b293e..fd2f283 100755 (executable)
@@ -26,8 +26,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
@@ -75,9 +73,9 @@ check-local:
 ## Now the checks.
        @for f in $(autodist_list); do \
          echo "file: $$f"; \
-         ## Some filenames might contain dots, but this won't cause spurious
-         ## failures, and "spurious successes" are so unlikely that they're
-         ## not worth worrying about.
+## Some filenames might contain dots, but this won't cause spurious
+## failures, and "spurious successes" are so unlikely that they're
+## not worth worrying about.
          echo ' ' $(DIST_COMMON) ' ' | grep "[ /]$$f " >/dev/null \
            || { echo $$f: distcom fail >&2; exit 1; }; \
        done
index 9294bc3..ed8dcc3 100755 (executable)
 # Related to automake bug#7819.
 # Keep this test in sync with sister test `autodist-subdir.test'.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-# Ensure we are run from the right directory.
-# (The last thing we want is to delete some random user files.)
-test -f ../defs
-rm -f *
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([.])
@@ -62,9 +56,9 @@ check-local:
          echo "file: $$f"; \
          test -f $(distdir)/$$f \
            || { echo $$f: distdir fail >&2; exit 1; }; \
-         ## Some filenames might contain dots, but this won't cause spurious
-         ## failures, and "spurious successes" are so unlikely that they're
-         ## not worth worrying about.
+## Some filenames might contain dots, but this won't cause spurious
+## failures, and "spurious successes" are so unlikely that they're
+## not worth worrying about.
          echo ' ' $(DIST_COMMON) ' ' | grep "[ /]$$f " >/dev/null \
            || { echo $$f: distcom fail >&2; exit 1; }; \
        done
index 9293bd1..3e0e231 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_CONFIG_HEADERS([thisfile.h])
 EOF
index e2a71cf..7facb2b 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AM_CONFIG_HEADER([thisfile.h])
 EOF
index f559295..88e3c0f 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 
 # Check rebuild rules for autoheader.
 
-required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 m4_include([foo.m4])
 AC_CONFIG_HEADERS([config.h:config.hin])
 AC_OUTPUT
 EOF
 
-: > Makefile.am
 : > foo.m4
 
+cat > Makefile.am <<'END'
+.PHONY: test
+check-local: test
+test: all
+       cat $(srcdir)/config.hin ;: For debugging.
+       cat config.h             ;: Likewise.
+       grep '#.*GREPME' $(srcdir)/config.hin
+       grep '#.*define.*GREPME' config.h
+END
+
 $ACLOCAL
 $AUTOCONF
 $AUTOHEADER
@@ -41,8 +47,7 @@ $MAKE
 $sleep
 echo 'AC_DEFINE([GREPME], 1, [Doc for GREPME])' > foo.m4
 
-$MAKE
-grep GREPME config.hin
-grep GREPME config.h
-
+$MAKE test
 $MAKE distcheck
+
+:
index 24c57fb..430d75c 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 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
 # Check rebuild rules for AC_CONFIG_HEADERS.
 # (This should also work without GNU Make.)
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AC_PROG_CC
 AC_SUBST([BOT], [bot])
@@ -35,16 +33,25 @@ mkdir sub1 sub2 sub3
 
 : > sub1/config.top
 echo '#define NAME "grepme1"' >sub2/config.bot
-echo SUBDIRS = sub3 >Makefile.am
-echo noinst_PROGRAMS = run >sub3/Makefile.am
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub3
+.PHONY: test-prog-updated
+test-prog-updated:
+       stat older sub3/run$(EXEEXT) || : For debugging.
+       test `ls -t older sub3/run$(EXEEXT) | sed 1q` = sub3/run$(EXEEXT)
+END
+
+cat > sub3/Makefile.am <<'END'
+noinst_PROGRAMS = run
+END
 
 cat >sub3/run.c <<'EOF'
 #include <defs.h>
 #include <config.h>
 #include <stdio.h>
 
-int
-main ()
+int main (void)
 {
   puts (NAME); /* from config.h */
   puts (PACKAGE); /* from defs.h */
@@ -57,13 +64,19 @@ $AUTOCONF
 $AUTOHEADER
 $AUTOMAKE
 
-./configure
+# Do not reject slow dependency extractors: we need dependency tracking.
+./configure --enable-dependency-tracking
 $MAKE
-sub3/run | grep grepme1
+# Sanity check.
+cross_compiling || { sub3/run | grep grepme1; }
 
+: > older
 $sleep
 echo '#define NAME "grepme2"' > sub2/config.bot
 $MAKE
-sub3/run | grep grepme2
+cross_compiling || { sub3/run | grep grepme2; }
+$MAKE test-prog-updated
 
 $MAKE distcheck
+
+:
index b501e76..b6208ff 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
-AC_PROG_CC
 AC_CONFIG_HEADERS([config.h])
 AC_OUTPUT
 EOF
diff --git a/tests/automake-cmdline.tap b/tests/automake-cmdline.tap
new file mode 100755 (executable)
index 0000000..9397900
--- /dev/null
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Copyright (C) 2004, 2006, 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/>.
+
+# Test Automake's command-line options.
+
+. ./defs || Exit 1
+
+plan_ 17
+
+# Usage: bad_cmdline DESCRIPTION REGEX-FOR-STDERR [ARGS-FOR-AUTOMAKE...]
+do_check ()
+{
+  test $# -ge 3 || fatal_ "do_check: invalid usage"
+  desc=$1; shift
+  regex=$1; shift
+  AUTOMAKE_fails -d "$desc (run)" -- "$@"
+  command_ok_ "$desc (stderr)" grep "$regex" stderr
+}
+
+do_check 'invalid long option' 'unrecognized option.*--voo' --voo
+
+# Older perl has a buggy Getopt::Long which makes this fail.
+if $PERL -e 'require 5.8.2;'; then
+  do_check "list of options terminated by '--'" \
+           'input file.*--voo' -- --voo
+else
+  skip_row_ 2 -r "older perl with buggy Getopt::Long"
+fi
+
+do_check "empty argument" \
+         'empty argument' ''
+
+do_check "missing argument for long option" \
+         'option.*-W.*requires an argument' -W
+
+do_check "missing argument for short option" \
+         'option.*--warnings.*requires an argument' --warnings
+
+do_check "'--help' as option argument" \
+         'unknown warning.*--help' --warnings --help
+
+do_check "'--help' as option argument" \
+         'unknown warning.*--help' --warnings --help
+
+do_check "ambiguous incomplete option" \
+         'unrecognized option.*--ver' --ver
+
+command_ok_ "unambiguous incomplete long option" $AUTOMAKE --vers
+
+:
diff --git a/tests/automake.test b/tests/automake.test
deleted file mode 100755 (executable)
index f8b4fef..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2004, 2006  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/>.
-
-# Test Automake's command-line options.
-. ./defs || Exit 1
-
-set -e
-
-$AUTOMAKE --help
-$AUTOMAKE --version
-AUTOMAKE_fails --voo
-grep 'unrecognized option.*--voo' stderr
-# older perl has a buggy Getopt::Long which makes this fail.
-if $PERL -e 'require 5.8.2;'; then
-  AUTOMAKE_fails -- --voo
-  grep 'input file.*--voo' stderr
-fi
-AUTOMAKE_fails ''
-grep 'empty argument' stderr
-AUTOMAKE_fails -W
-grep 'option.*-W.*requires an argument' stderr
-AUTOMAKE_fails --warnings
-grep 'option.*--warning.*requires an argument' stderr
-AUTOMAKE_fails --warnings --help
-grep 'unknown warning.*--help' stderr
-AUTOMAKE_fails --ver
-grep 'unrecognized option.*--ver' stderr
-$AUTOMAKE --vers
diff --git a/tests/auxdir-autodetect.test b/tests/auxdir-autodetect.test
new file mode 100755 (executable)
index 0000000..715b7a8
--- /dev/null
@@ -0,0 +1,130 @@
+#! /bin/sh
+# Copyright (C) 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 that, if AC_CONFIG_AUX_DIR is not specified, Automake tries
+# to use `.', `..' and `../..', in precisely that order.
+
+. ./defs || Exit 1
+
+nil=__no_such_program
+
+unset NONESUCH || :
+
+cat >>configure.in << END
+AM_MISSING_PROG([NONESUCH],[$nil])
+AC_OUTPUT
+END
+
+mkdir d3
+mkdir d3/d2
+mkdir d3/d2/d1
+mkdir d3/d2/d1/d0
+
+echo 'echo %%d3%% $*' > d3/missing
+chmod +x d3/missing
+echo 'echo %%d2%% $*' > d3/d2/missing
+chmod +x d3/d2/missing
+echo 'echo %%d1%% $*' > d3/d2/d1/missing
+chmod +x d3/d2/d1/missing
+echo 'echo %%d0%% $*' > d3/d2/d1/d0/missing
+chmod +x d3/d2/d1/d0/missing
+
+mv configure.in d3/d2/d1/d0/
+
+cd d3/d2/d1/d0
+
+cat > Makefile.am << 'EOF'
+.PHONY: test
+test:
+       $(NONESUCH) >$(out)
+EOF
+
+$ACLOCAL
+$AUTOCONF
+
+# ------------------------------------------- #
+:  We must end up with AC_CONFIG_AUX_DIR = .  #
+# ------------------------------------------- #
+
+: > install-sh
+$AUTOMAKE
+./configure
+out=out0 $MAKE test
+cat out0
+grep "%%d0%%.*$nil" out0
+grep '%%d[123]' out0 && Exit 1
+
+rm -f missing install-sh
+
+# -------------------------------------------- #
+:  We must end up with AC_CONFIG_AUX_DIR = ..  #
+# -------------------------------------------- #
+
+# Automake finds `install-sh' in `.', so it assumes that auxdir is `.';
+# but it won't find `missing' in `.', so it will fail.
+: > install-sh
+AUTOMAKE_fails
+grep 'required file.*[^.]\./missing.*not found' stderr
+rm -f install-sh
+
+# Now things should work.
+: > ../install-sh
+$AUTOMAKE
+./configure
+out=out1 $MAKE test
+cat out1
+grep "%%d1%%.*$nil" out1
+grep '%%d[023]' out1 && Exit 1
+
+rm -f ../missing ../install-sh
+
+# ----------------------------------------------- #
+:  We must end up with AC_CONFIG_AUX_DIR = ../..  #
+# ----------------------------------------------- #
+
+# Automake finds `install-sh' in `.', so it assumes that auxdir is `.';
+# but it won't find `missing' in `.', so it will fail.
+: > install-sh
+AUTOMAKE_fails
+grep 'required file.*[^.]\./missing.*not found' stderr
+rm -f install-sh
+
+# Automake finds `install-sh' in `..', so it assumes that auxdir is `..';
+# but it won't find `missing' in `.', so it will fail.
+: > ../install-sh
+AUTOMAKE_fails
+grep 'required file.*[^.]\.\./missing.*not found' stderr
+rm -f ../install-sh
+
+# Now things should work.
+: > ../../install-sh
+$AUTOMAKE
+./configure
+out=out2 $MAKE test
+cat out2
+grep "%%d2%%.*$nil" out2
+grep '%%d[013]' out2 && Exit 1
+
+rm -f ../../missing ../../install-sh
+
+# --------------------------------------------------------- #
+:  AC_CONFIG_AUX_DIR will not be found: automake must fail  #
+# --------------------------------------------------------- #
+
+AUTOMAKE_fails
+grep 'required file.*missing.*not found' stderr
+
+:
similarity index 66%
rename from tests/auxdir2.test
rename to tests/auxdir-computed.tap
index 590a5df..007eebc 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
 
 . ./defs || Exit 1
 
-# The "./." is here so we don't have to mess with subdirs.
-cat > configure.in << 'END'
-AC_INIT([auxdir2], [1.0])
-AC_CONFIG_AUX_DIR($foo)
+plan_ 3
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([\$foo])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 END
 
 : > Makefile.am
 
-$ACLOCAL || Exit 1
-$AUTOMAKE
+command_ok_ "aclocal" $ACLOCAL
+# Both these two invocations are meant.
+# They exercise both code paths concerning auxiliary files.
+command_ok_ "automake -a" -D TODO -r "long-standing limitation" $AUTOMAKE -a
+command_ok_ "automake"    -D TODO -r "long-standing limitation" $AUTOMAKE
+
+:
similarity index 86%
rename from tests/auxdir3.test
rename to tests/auxdir-misplaced.test
index c828051..eb1a888 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_CONFIG_AUX_DIR(.)
+AC_CONFIG_AUX_DIR([.]) dnl this will appear after AM_INIT_AUTOMAKE
 END
 
 : > Makefile.am
@@ -29,3 +27,5 @@ END
 $ACLOCAL
 AUTOMAKE_fails
 grep 'AC_CONFIG_AUX_DIR.*AM_INIT_AUTOMAKE' stderr
+
+:
similarity index 72%
rename from tests/auxdir4.test
rename to tests/auxdir-nonexistent.test
index 0447809..6c43295 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 we diagnose dangerous AC_CONFIG_AUX_DIR names.
+# Make sure we diagnose non-existent AC_CONFIG_AUX_DIR names.
 
 . ./defs || Exit 1
 
-set -e
-
-cat >configure.in <<'END'
-AC_INIT([auxdir4], [1.0])
-AC_CONFIG_AUX_DIR([aux])
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([nonesuch])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 END
@@ -31,5 +29,6 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'configure.in:2:.*aux.*does not exist' stderr
-grep 'configure.in:2:.*aux.*W32' stderr
+grep '^configure\.in:2:.*nonesuch.* not exist' stderr
+
+:
diff --git a/tests/auxdir-unportable.tap b/tests/auxdir-unportable.tap
new file mode 100755 (executable)
index 0000000..2eba8be
--- /dev/null
@@ -0,0 +1,51 @@
+#! /bin/sh
+# Copyright (C) 2004, 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 we diagnose unportable AC_CONFIG_AUX_DIR names.
+
+. ./defs || Exit 1
+
+plan_ 4
+
+cat >configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([aux])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+
+: > Makefile.am
+
+am_warn_unportable_auxdir ()
+{
+  details=$1
+  AUTOMAKE_fails
+  command_ok_ \
+    "warn about $details unportable auxdir name" \
+    grep '^configure\.in:2:.*aux.*W32' stderr
+}
+
+$ACLOCAL || fatal_ "aclocal failed"
+
+am_warn_unportable_auxdir "non-existent"
+
+if mkdir aux; then
+  am_warn_unportable_auxdir "existent"
+else
+  skip_row_ 2 -r "cannot create directory named 'aux'"
+fi
+
+:
index 95a7a20..2dc548c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003, 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 2004, 2007, 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
@@ -19,9 +20,9 @@
 . ./defs || Exit 1
 
 # The "./." is here so we don't have to mess with subdirs.
-cat > configure.in << 'END'
-AC_INIT([auxdir], [1.0])
-AC_CONFIG_AUX_DIR(./.)
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([./.])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 END
@@ -30,11 +31,13 @@ cat > Makefile.am << 'END'
 pkgdata_DATA =
 END
 
-cp "$testsrcdir/../lib/mkinstalldirs" .
+cp "$am_scriptdir/mkinstalldirs" .
 
 # The "././" prefix confuses Automake into thinking it is doing a
 # subdir build.  Yes, this is hacky.
-$ACLOCAL || Exit 1
-$AUTOMAKE ././Makefile || Exit 1
+$ACLOCAL
+$AUTOMAKE ././Makefile
 
 grep '/\./\./mkinstalldirs' Makefile.in
+
+:
diff --git a/tests/auxdir6.test b/tests/auxdir6.test
new file mode 100755 (executable)
index 0000000..bf63895
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test to make sure AC_CONFIG_AUX_DIR works correctly.
+# This test calls AC_CONFIG_AUX_DIR with an explicit literal argument,
+# thus explicitly making the directory named by that argument the
+# config auxdir.
+# Keep this in sync with sister tests auxdir7.test and auxdir8.test.
+
+. ./defs || Exit 1
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile subdir/Makefile])
+END
+
+mkdir subdir auxdir
+
+cat > Makefile.am << 'END'
+pkgdata_DATA =
+END
+
+cp Makefile.am subdir/Makefile.am
+
+: > auxdir/mkinstalldirs
+: > auxdir/install-sh
+: > auxdir/missing
+
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP '$(top_srcdir)/auxdir/mkinstalldirs' Makefile.in
+$FGREP '$(top_srcdir)/auxdir/mkinstalldirs' subdir/Makefile.in
+
+:
diff --git a/tests/auxdir7.test b/tests/auxdir7.test
new file mode 100755 (executable)
index 0000000..d346ad2
--- /dev/null
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test to make sure AC_CONFIG_AUX_DIR works correctly.
+# This test calls AC_CONFIG_AUX_DIR with a `.' argument, thus explicitly
+# making the top-level directory the config auxdir.
+# Keep this in sync with sister tests auxdir6.test and auxdir8.test.
+
+. ./defs || Exit 1
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile subdir/Makefile])
+END
+
+mkdir subdir
+
+cat > Makefile.am << 'END'
+pkgdata_DATA =
+END
+
+cp Makefile.am subdir/Makefile.am
+
+: > mkinstalldirs
+
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP '$(top_srcdir)/mkinstalldirs' Makefile.in
+$FGREP '$(top_srcdir)/mkinstalldirs' subdir/Makefile.in
+
+:
diff --git a/tests/auxdir8.test b/tests/auxdir8.test
new file mode 100755 (executable)
index 0000000..1a5e5d9
--- /dev/null
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 1996, 2001, 2002, 2003, 2004, 2007, 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/>.
+
+# Test to make sure AC_CONFIG_AUX_DIR works correctly.
+# This test tries without an explicit call to AC_CONFIG_AUX_DIR;
+# the config auxdir should be implicitly defined to `.' since
+# the install-sh, mkinstalldirs, etc., scripts are in the top-level
+# directory.
+# Keep this in sync with sister tests auxdir6.test and auxdir7.test.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
+END
+
+mkdir subdir
+
+cat > Makefile.am << 'END'
+pkgdata_DATA =
+END
+
+cp Makefile.am subdir/Makefile.am
+
+: > mkinstalldirs
+
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP '$(top_srcdir)/mkinstalldirs' Makefile.in
+$FGREP '$(top_srcdir)/mkinstalldirs' subdir/Makefile.in
+
+:
diff --git a/tests/backcompat.test b/tests/backcompat.test
new file mode 100755 (executable)
index 0000000..f76b53b
--- /dev/null
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test usage of AM_INIT_AUTOMAKE with two or three arguments, for
+# backward-compatibility.
+
+. ./defs || Exit 1
+
+cat > Makefile.am <<'END'
+.PHONY: test display
+
+## Might be useful for debugging.
+display:
+## The following should be substituted by AM_INIT_AUTOMAKE.
+       @echo PACKAGE = $(PACKAGE)
+       @echo VERSION = $(VERSION)
+## The following should not be substituted, as we used the
+## old form of AC_INIT.
+       @echo PACKAGE_NAME = $(PACKAGE_NAME)
+       @echo PACKAGE_VERSION = $(PACKAGE_VERSION)
+       @echo PACKAGE_TARNAME = $(PACKAGE_TARNAME)
+       @echo PACKAGE_STRING = $(PACKAGE_STRING)
+
+test: display
+       test x'$(PACKAGE)' = x'FooBar'
+       test x'$(VERSION)' = x'0.7.1'
+       test x'$(PACKAGE_NAME)' = x
+       test x'$(PACKAGE_VERSION)' = x
+       test x'$(PACKAGE_TARNAME)' = x
+       test x'$(PACKAGE_STRING)' = x
+END
+
+for ac_init in 'AC_INIT' 'AC_INIT([Makefile.am])'; do
+  for am_extra_args in '' ', []' ', [:]' ', [false]'; do
+    rm -rf autom4te*.cache config* Makefile.in Makefile
+    unindent > configure.in <<END
+      $ac_init
+      AM_INIT_AUTOMAKE([FooBar], [0.7.1]$am_extra_args)
+      AC_CONFIG_FILES([Makefile])
+      AC_OUTPUT
+END
+    cat configure.in # For debugging.
+    $ACLOCAL
+    $AUTOCONF
+    $AUTOMAKE
+    ./configure
+    $MAKE test
+  done
+done
+
+:
diff --git a/tests/backcompat2.test b/tests/backcompat2.test
new file mode 100755 (executable)
index 0000000..57badf3
--- /dev/null
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Backward-compatibility test: check that AM_INIT_AUTOMAKE with two or
+# three arguments does AC_DEFINE the symbols PACKAGE and VERSION iff the
+# third argument is empty or non-existent.
+
+. ./defs || Exit 1
+
+# A trick to make the test run muuuch faster, by avoiding repeated
+# runs of aclocal (one order of magnitude improvement in speed!).
+echo 'AC_INIT(x,0) AM_INIT_AUTOMAKE' > configure.in
+$ACLOCAL
+rm -rf configure.in autom4te.*
+
+cat > config.h.in <<'END'
+#undef PACKAGE
+#undef VERSION
+END
+
+for am_arg3 in ':' 'false' '#' ' '; do
+  unindent > configure.in <<END
+    AC_INIT
+    AC_CONFIG_HEADERS([config.h])
+    AM_INIT_AUTOMAKE([pkgname], [pkgversion], [$am_arg3])
+    AC_OUTPUT
+END
+  cat configure.in # For debugging.
+  $AUTOCONF
+  ./configure
+  cat config.h # For debugging.
+  # The non-empty third argument should prevent PACKAGE and VERSION
+  # from being AC_DEFINE'd.
+  $EGREP 'pkg(name|version)' config.h && Exit 1
+  # This is required because even relatively-recent versions of the
+  # BSD shell wrongly exit when the `errexit' shell flag is active if
+  # the last command of a compound statement fails, even if it should
+  # be protected by the use of "&&".
+  :
+done
+
+for am_extra_args in '' ',' ', []'; do
+  unindent > configure.in <<END
+    AC_INIT
+    AC_CONFIG_HEADERS([config.h])
+    AM_INIT_AUTOMAKE([pkgname], [pkgversion]$am_extra_args)
+    AC_OUTPUT
+END
+  cat configure.in # For debugging.
+  $AUTOCONF
+  ./configure
+  cat config.h # For debugging.
+  grep '^ *# *define  *PACKAGE  *"pkgname" *$' config.h
+  grep '^ *# *define  *VERSION  *"pkgversion" *$' config.h
+done
+
+:
diff --git a/tests/backcompat3.test b/tests/backcompat3.test
new file mode 100755 (executable)
index 0000000..f0e34ba
--- /dev/null
@@ -0,0 +1,151 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Backward-compatibility test: check what happens when AC_INIT and
+# AM_INIT_AUTOMAKE are both given two or more arguments.
+
+. ./defs || Exit 1
+
+empty=''
+
+cat > Makefile.am <<'END'
+## Leading `:;' here required to work around bugs of (at least) bash 3.2
+got: Makefile
+       @:; { \
+         echo 'PACKAGE = $(PACKAGE)'; \
+         echo 'VERSION = $(VERSION)'; \
+         echo 'PACKAGE_NAME = $(PACKAGE_NAME)'; \
+         echo 'PACKAGE_VERSION = $(PACKAGE_VERSION)'; \
+         echo 'PACKAGE_STRING = $(PACKAGE_STRING)'; \
+         echo 'PACKAGE_TARNAME = $(PACKAGE_TARNAME)'; \
+         echo 'PACKAGE_BUGREPORT = $(PACKAGE_BUGREPORT)'; \
+         echo 'PACKAGE_URL = $(PACKAGE_URL)'; \
+       } >$@
+END
+
+
+### Run 1 ###
+
+cat > configure.in <<END
+AC_INIT([ac_name], [ac_version])
+AM_INIT_AUTOMAKE([am_name], [am_version])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_name
+PACKAGE_BUGREPORT = $empty
+PACKAGE_URL = $empty
+END
+
+$MAKE got
+
+diff exp got
+
+
+### Run 2 ###
+
+cat > configure.in <<'END'
+dnl: `AC_INIT' in Autoconf <= 2.63 doesn't have an URL argument.
+dnl: Luckily, `AC_AUTOCONF_VERSION' and `m4_version_prereq' are
+dnl: both present in autoconf 2.62, which we require; so that we
+dnl: can at least use the following workaround.
+m4_version_prereq([2.64],
+    [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname],
+             [ac_url])],
+    [AC_INIT([ac_name], [ac_version], [ac_bugreport], [ac_tarname])
+     AC_SUBST([PACKAGE_URL], [ac_url])])
+AM_INIT_AUTOMAKE([am_name], [am_version])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_tarname
+PACKAGE_BUGREPORT = ac_bugreport
+PACKAGE_URL = ac_url
+END
+
+$MAKE got
+
+diff exp got
+
+
+### Run 3 ###
+
+cat > configure.in <<END
+AC_INIT([ac_name], [ac_version])
+AM_INIT_AUTOMAKE([am_name], [am_version], [am_foo_quux])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat configure.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat >exp <<END
+PACKAGE = am_name
+VERSION = am_version
+PACKAGE_NAME = ac_name
+PACKAGE_VERSION = ac_version
+PACKAGE_STRING = ac_name ac_version
+PACKAGE_TARNAME = ac_name
+PACKAGE_BUGREPORT = $empty
+PACKAGE_URL = $empty
+END
+
+$MAKE got
+
+diff exp got
+
+$FGREP am_foo_quux Makefile.in Makefile configure config.status && Exit 1
+
+
+### Done ###
+
+:
diff --git a/tests/backcompat4.test b/tests/backcompat4.test
new file mode 100755 (executable)
index 0000000..b95a30b
--- /dev/null
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Backward-compatibility: AC_OUTPUT with arguments.
+
+. ./defs || Exit 1
+
+mkdir sub
+: > Makefile.am
+: > zardoz
+: > foo.in
+: > foo1.in
+: > foo2.in
+: > foo3.in
+: > sub/bar.in
+
+ls -l # For debugging.
+
+for args in \
+  'foo' \
+  'foo:foo1.in' \
+  'foo:zardoz' \
+  'foo:sub/bar.in' \
+  'foo:foo1.in:foo2.in' \
+  'foo:zardoz:zardoz' \
+  'foo:foo1.in:foo2.in:foo3.in' \
+  'foo:foo1.in:foo2.in:sub/bar.in:foo3.in' \
+; do
+  rm -rf autom4te*.cache aclocal.m4
+  unindent >configure.in <<END
+    AC_INIT([$me], [1.0])
+    AM_INIT_AUTOMAKE
+    AC_CONFIG_FILES([$args])
+    AC_OUTPUT
+END
+  cat configure.in # For debugging.
+  $ACLOCAL
+  $AUTOMAKE Makefile
+  mv -f Makefile.in Makefile.acf
+  rm -rf autom4te*.cache aclocal.m4
+  unindent >configure.in <<END
+    AC_INIT([$me], [1.0])
+    AM_INIT_AUTOMAKE
+    AC_OUTPUT([$args])
+END
+  cat configure.in # For debugging.
+  $ACLOCAL
+  $AUTOMAKE Makefile
+  mv -f Makefile.in Makefile.aco
+  diff Makefile.acf Makefile.aco
+done
+
+:
diff --git a/tests/backcompat5.test b/tests/backcompat5.test
new file mode 100755 (executable)
index 0000000..0e57db4
--- /dev/null
@@ -0,0 +1,118 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Backward-compatibility test: try to build and distribute a package
+# using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
+# This script can also serve as mild stress-testing for Automake.
+# See also the similar test `backcompat6.test'.
+
+am_parallel_tests=no
+. ./defs || Exit 1
+
+# Yuck!
+cat > configure.in <<'END'
+dnl: Everything here is *deliberately* underquoted!
+AC_INIT(src/foo.input)
+AM_INIT_AUTOMAKE(foo, 1.0)
+AC_CONFIG_FILES(Makefile:mkfile.in)
+AC_OUTPUT(hacky/Makefile src/Makefile data/Makefile tests/Makefile)
+END
+
+distdir=foo-1.0
+
+cat > mkfile.am <<'END'
+SUBDIRS = src data tests hacky
+installcheck-local:
+       grep DataDataData $(DESTDIR)$(prefix)/data/$(PACKAGE)-$(VERSION)/bar
+END
+
+mkdir hacky src tests data
+
+echo 'This is a dummy package' > README
+
+cat > src/foo.input <<'END'
+#!sh
+echo Zardoz
+END
+
+cat > tests/a.test <<'END'
+#!/bin/sh
+"$srcdir/../src/foo" | grep Zardoz
+END
+chmod a+x tests/a.test
+
+cat > data/bar <<'END'
+line1
+line2
+line3
+END
+
+cat >hacky/Makefile.am <<'END'
+dist-hook:
+       find $(top_distdir) -print
+       chmod a+rx $(top_distdir)/tests/*.test
+END
+
+cat > src/Makefile.am <<'END'
+dist_bin_SCRIPTS = foo
+foo: foo.input
+       sed '1s,^#!.*$$,#!/bin/sh,' $(srcdir)/foo.input >$@
+       chmod a+x $@
+EXTRA_DIST = foo.input
+DISTCLEANFILES = foo
+END
+
+cat > data/Makefile.am <<'END'
+nodist_data_DATA = bar
+datadir = $(prefix)/data/$(PACKAGE)-$(VERSION)
+bar:
+       echo DataDataData >$@
+distclean-local:
+       rm -f bar
+END
+
+cat > tests/Makefile.am <<'END'
+TESTS = a.test
+EXTRA_DIST = $(TESTS)
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+ls -l . hacky src data tests # For debugging.
+test ! -f mkfile
+$MAKE
+$MAKE distdir
+test ! -f $distdir/Makefile.in
+test ! -f $distdir/data/bar
+test -f $distdir/src/foo
+diff README $distdir/README
+diff mkfile.in $distdir/mkfile.in
+diff tests/a.test $distdir/tests/a.test
+diff src/foo.input $distdir/src/foo.input
+
+$MAKE check
+$MAKE distcheck
+
+test -f $distdir.tar.gz
+
+chmod a-x tests/a.test
+# dist-hook should take care of making test files executables.
+$MAKE distcheck
+
+:
diff --git a/tests/backcompat6.test b/tests/backcompat6.test
new file mode 100755 (executable)
index 0000000..468e71d
--- /dev/null
@@ -0,0 +1,103 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Backward-compatibility test: try to build and distribute a package
+# using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT.
+# This script can also serve as mild stress-testing for Automake.
+# See also the similar test `backcompat5.test'.
+
+required=cc
+. ./defs || Exit 1
+
+# Anyone doing something like this in a real-life package probably
+# deserves to be killed.
+cat > configure.in <<'END'
+dnl: Everything here is *deliberately* underquoted!
+AC_INIT(quux.c)
+PACKAGE=nonesuch-zardoz
+VERSION=nonesuch-0.1
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+AC_SUBST(one,1)
+two=2
+AC_SUBST(two, $two)
+three=3
+AC_SUBST(three)
+AC_PROG_CC
+AC_CONFIG_HEADERS(config.h:config.hin)
+AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = yes)
+AC_OUTPUT(Makefile foo.got:foo1.in:foo2.in:foo3.in)
+END
+
+echo @one@ > foo1.in
+echo @two@ > foo2.in
+echo @three@ > foo3.in
+
+cat >config.hin <<'END'
+#undef PACKAGE
+#undef VERSION
+END
+
+cat >> Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = quux.c
+check-local:
+       test x'$(PACKAGE)' = x'nonesuch-zardoz'
+       test x'$(VERSION)' = x'nonesuch-0.1'
+if ! CROSS_COMPILING
+       ./foo
+## Do not anchor the regexps w.r.t. the end of line, because on
+## MinGW/MSYS, grep may assume LF line endings only, while our
+## `foo' program may generate CRLF line endings.
+       ./foo | grep '^PACKAGE = nonesuch-zardoz!'
+       ./foo | echo '^VERSION = nonesuch-0\.1!'
+endif
+END
+
+cat > quux.c <<'END'
+#include <config.h>
+#include <stdio.h>
+int main (void)
+{
+  printf("PACKAGE = %s!\nVERSION = %s!\n", PACKAGE, VERSION);
+  return 0;
+}
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+cat >foo.exp <<'END'
+1
+2
+3
+END
+
+diff foo.exp foo.got
+
+$MAKE
+$MAKE check
+
+distdir=nonesuch-zardoz-nonesuch-0.1
+$MAKE distdir
+test -f $distdir/quux.c
+test ! -f $distdir/foo.got
+
+$MAKE distcheck
+
+:
index 3947cde..4e3943f 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 35e9b9b..f0116e3 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2000, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 SUBDIRS = \
    .
index 76fdd9a..1319c0a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure we diagnose trailing backslash at the end of a file.
-# Report from Akim Demaile <akim@epita.fr>
+# Report from Akim Demaile <akim@epita.fr>.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 foo = \
 END
index 16eab5f..7cfe737 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >>configure.in
 
 # Note: trailing whitespace used during the test should not appear as
index 7c63697..18ad929 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
index 2da53e9..6f6d792 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo 'AUTOMAKE_OPTIONS = zardoz' > Makefile.am
 
 $ACLOCAL
index 7a31b3f..87b7562 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 862389e..f645c09 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2010, 2011, 2012 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure block comments are not double-spaced.
-# Report from François Pinard.
+# Report from François Pinard.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 #START
 #a
index 80066d8..d50c1d5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2011, 2012 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 noinst_SCRIPTS = hostname
 include_HEADERS = gettext-po.h
@@ -30,4 +28,5 @@ END
 $ACLOCAL
 $AUTOMAKE
 grep 'install-recursive' Makefile.in && Exit 1
+
 :
diff --git a/tests/candist.test b/tests/candist.test
new file mode 100755 (executable)
index 0000000..f75f406
--- /dev/null
@@ -0,0 +1,32 @@
+#! /bin/sh
+# Copyright (C) 2009, 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 3 of the License, 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/>.
+
+# Test to make sure things that cannot be dist_'ed are diagnosed.
+
+. ./defs || Exit 1
+
+echo AC_OUTPUT >>configure.in
+
+cat > Makefile.am << 'END'
+dist_bin_PROGRAMS = foo
+dist_lib_LIBRARIES = libfoo.a
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+test 2 -eq `grep -c 'dist.*forbidden' stderr`
+
+Exit 0
index aecda17..2b9cd0a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2007, 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
 
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << 'END'
-AC_INIT([canon-name], [1.0])
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([./gmakefile ./sub/gmakefile])
 AC_OUTPUT
@@ -36,3 +34,5 @@ $ACLOCAL
 AUTOMAKE_fails
 grep 'leading.*\./.*\./gmakefile' stderr
 grep 'leading.*\./.*\./sub/gmakefile' stderr
+
+:
index 2b035d0..51e03b2 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003, 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
@@ -18,9 +19,9 @@
 
 . ./defs || Exit 1
 
-set -e
-
-echo AC_PROG_CC >> configure.in
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = sniff-glue
@@ -29,4 +30,7 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:2:.*sniff_glue_SOURCES' stderr
+grep 'Makefile\.am:2:.* bad .*variable.*sniff-glue_SOURCES' stderr
+grep 'Makefile\.am:2:.* use .*sniff_glue_SOURCES' stderr
+
+:
index ab28617..3085a7c 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 1997, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = zar-doz.texi
 zar_doz_TEXINFOS = frob.texi
index 9d5a172..c93f8ac 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
@@ -34,4 +33,5 @@ $ACLOCAL
 $AUTOMAKE
 
 $FGREP 'perm_number.c' Makefile.in && Exit 1
-Exit 0
+
+:
index 52e968d..c6b7296 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure name canonicalization happens for libraries.
+# Test to make sure name canonicalization happens for static libraries.
+# Keep this in sync with sister test `canon6.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -30,8 +31,11 @@ noinst_LIBRARIES = libx-y.a
 libx_y_a_SOURCES = xy.c
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
-grep '^libx-y.*=' Makefile.in && Exit 1
-Exit 0
+grep '^ *libx-y.*=' Makefile.in && Exit 1
+
+:
index 53cdeb2..43c098b 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 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
@@ -20,9 +20,9 @@
 
 . ./defs || Exit 1
 
-set -e
-
-echo AC_PROG_CC >> configure.in
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
 
 $ACLOCAL
 
@@ -46,7 +46,8 @@ bin_PROGRAMS = ,foo
 END
 
 AUTOMAKE_fails
-grep 'Makefile.am:2:.*_foo_SOURCES' stderr
+grep 'Makefile\.am:2:.* bad .*variable.*,foo_SOURCES' stderr
+grep 'Makefile\.am:2:.* use .*_foo_SOURCES' stderr
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = ,foo
@@ -54,3 +55,5 @@ _foo_SOURCES = foo.c
 END
 
 $AUTOMAKE -Wno-portability
+
+:
diff --git a/tests/canon6.test b/tests/canon6.test
new file mode 100755 (executable)
index 0000000..dd2e44e
--- /dev/null
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 1996, 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/>.
+
+# Test to make sure name canonicalization happens for libtool libraries.
+# Keep this in sync with sister test `canon4.test'.
+
+required='libtoolize'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_LIBTOOL
+END
+
+cat > Makefile.am << 'END'
+noinst_LTLIBRARIES = libx-y.la
+libx_y_la_SOURCES = xy.c
+END
+
+: > ltmain.sh
+: > ar-lib
+
+$ACLOCAL
+$AUTOMAKE -a
+
+grep '^ *libx-y.*=' Makefile.in && Exit 1
+
+:
diff --git a/tests/canon7.test b/tests/canon7.test
new file mode 100755 (executable)
index 0000000..48d1b88
--- /dev/null
@@ -0,0 +1,101 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Stress test on canonicalization.
+
+required='cc libtool libtoolize'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB  dnl: for static libraries
+AC_PROG_LIBTOOL dnl: for libtool libraries
+AM_CONDITIONAL([CROSS_COMPILING], [test "$cross_compiling" = yes])
+AC_OUTPUT
+END
+
+if touch ,foo-bar libb.az+baz lib~zardoz,,; then
+  rm -f ,foo-bar libb.az+baz lib~zardoz,,
+else
+  skip_ "cannot create regular files with \"tricky\" names"
+fi
+
+cat > Makefile.am << 'END'
+noinst_PROGRAMS = dummy_static dummy_dynamic ,foo-bar
+noinst_LIBRARIES = libb.az+baz.a
+noinst_LTLIBRARIES = lib~zardoz,,.la
+
+dummy_static_SOURCES = dummy.c lib.h
+dummy_dynamic_SOURCES = $(dummy_static_SOURCES)
+
+dummy_static_LDADD = $(noinst_LIBRARIES)
+dummy_dynamic_LDADD = $(noinst_LTLIBRARIES)
+
+_foo_bar_SOURCES = foobar.c
+libb_az_baz_a_SOURCES = libs.c
+lib_zardoz___la_SOURCES = libd.c
+
+check-local:
+       ls -l
+if CROSS_COMPILING
+       test -f ./,foo-bar$(EXEEXT)
+       test -f ./dummy_static$(EXEEXT)
+       test -f ./dummy_dynamic$(EXEEXT)
+else !CROSS_COMPILING
+       ./,foo-bar
+       ./dummy_static
+       ./dummy_dynamic
+       ./,foo-bar | grep 'Hello, FooBar!'
+       ./dummy_static | grep 'Hello from Static!'
+       ./dummy_dynamic | grep 'Hello from Dynamic!'
+endif !CROSS_COMPILING
+END
+
+cat > foobar.c << 'END'
+#include <stdio.h>
+int main(void)
+{
+  printf("Hello, FooBar!\n");
+  return 0;
+}
+END
+
+cat > dummy.c << 'END'
+#include <stdio.h>
+#include "lib.h"
+int main(void)
+{
+  printf("Hello from %s!\n", dummy_func());
+  return 0;
+}
+END
+
+echo 'const char *dummy_func(void);' > lib.h
+echo 'const char *dummy_func(void) { return "Dynamic"; }' > libd.c
+echo 'const char *dummy_func(void) { return "Static"; }' > libs.c
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+:
similarity index 70%
rename from tests/ansi2.test
rename to tests/canon8.test
index 504c8c3..5351345 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2010 Free Software
+# Copyright (C) 1996, 1997, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure ansi2knr built at the right time.
+# Check that canonicalization does not transliterate the `@' charactrer.
 
 . ./defs || Exit 1
 
-set -e
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
-bin_PROGRAMS = joe
-END
-
 cat >> configure.in << 'END'
 AC_PROG_CC
-AM_C_PROTOTYPES
 END
 
-: > ansi2knr.c
-: > ansi2knr.1
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foob@rquux
+END
 
 $ACLOCAL
-$AUTOMAKE -Wno-obsolete
+$AUTOMAKE
+
+# The first grep is here mostly for debugging.
+grep foob.rquux Makefile.in
+grep foob@rquux Makefile.in
+grep 'foob[^@]rquux' Makefile.in && Exit 1
 
-grep '^all[-a-z]*:.*ANSI2KNR' Makefile.in
+:
index d6ed136..780ffe6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2008, 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
 required=gcc
 . ./defs || Exit 1
 
-cat > configure.1 << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(nonesuch, 0.23)
+cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
-AC_OUTPUT(Makefile)
-END
-
-# This one makes sure that $CC can be used after AM_PROG_CC_C_O.
-cat > configure.3 << 'END'
-AC_INIT(a.c)
-AM_INIT_AUTOMAKE(nonesuch, 0.23)
-AC_PROG_CC
-AM_PROG_CC_C_O
-$CC -v > Hi 2>&1 || exit 1
-AC_OUTPUT(Makefile)
+# Make sure that $CC can be used after AM_PROG_CC_C_O.
+$CC -v || exit 1
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -54,44 +44,40 @@ int main ()
 }
 END
 
-cat > Mycomp << 'END'
+cat > Mycomp << END
 #!/bin/sh
 
-case " "$* in
+case " \$* " in
  *\ -c*\ -o* | *\ -o*\ -c*)
     exit 1
     ;;
 esac
 
-exec gcc "$@"
+# Use '$CC', not 'gcc', to honour the compiler chosen by 'tests/defs'.
+exec $CC "\$@"
 END
 
 chmod +x Mycomp
 
-set -e
-
-
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-for conf in configure.1 configure.3; do
-   cp $conf configure.in
-
-   $ACLOCAL
-   $AUTOCONF
-   $AUTOMAKE --copy --add-missing
-
-   rm -rf build
-   mkdir build
-   cd build
-
-   # Make sure the compiler doesn't understand `-c -o'
-   CC=`pwd`/../Mycomp
-   export CC
-
-   ../configure
-   $MAKE
-
-   cd ..
+# Make sure the compiler doesn't understand `-c -o'
+CC=`pwd`/Mycomp
+export CC
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --copy --add-missing
+
+for vpath in : false; do
+  if $vpath; then
+    srcdir=..
+    mkdir build
+    cd build
+  else
+    srcdir=.
+  fi
+  $srcdir/configure
+  $MAKE
+  cd $srcdir
 done
+
+:
index 062fe6b..4c6b22b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_PROG_CC
 AC_OUTPUT
@@ -37,7 +35,7 @@ touch a.c
 $ACLOCAL
 $AUTOCONF
 AUTOMAKE_fails --copy --add-missing
-grep 'Makefile.am:2:.*per-target.*AM_PROG_CC_C_O' stderr
+grep '^Makefile\.am:2:.*per-target.*AM_PROG_CC_C_O' stderr
 
 
 cat >Makefile.am <<EOF
@@ -52,4 +50,6 @@ $AUTOMAKE --copy --add-missing
 
 echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
 AUTOMAKE_fails --copy --add-missing
-grep 'Makefile.am:2:.*subdir.*AM_PROG_CC_C_O' stderr
+grep '^Makefile\.am:2:.*subdir.*AM_PROG_CC_C_O' stderr
+
+:
index 2e9cd37..82fb320 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2008, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2008, 2009, 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
 required=gcc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+$CC --version; $CC -v; # For debugging.
 AC_OUTPUT
 END
 
@@ -44,24 +44,21 @@ int main ()
 }
 END
 
-cat > Mycomp << 'END'
+cat > Mycomp << END
 #!/bin/sh
 
-case " "$* in
+case " \$* " in
  *\ -c*\ -o* | *\ -o*\ -c*)
     exit 1
     ;;
 esac
 
-exec gcc "$@"
+# Use '$CC', not 'gcc', to honour the compiler chosen by 'tests/defs'.
+exec $CC "\$@"
 END
 
 chmod +x Mycomp
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --copy --add-missing
@@ -78,4 +75,4 @@ $MAKE 2>stderr || { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'mv.*the same file' stderr && Exit 1
 
-Exit 0
+:
index e5dd153..966b7a6 100755 (executable)
@@ -48,7 +48,7 @@ $MAKE -j1 || Exit 77
 for j in '' -j1 -j2; do
   $MAKE $j check && Exit 1
   TESTS=foo.test $MAKE $j -e check && Exit 1
-  if test x"$parallel_tests" = x"yes"; then
+  if test x"$am_parallel_tests" = x"yes"; then
     $MAKE $j recheck && Exit 1
     TEST_LOGS=foo.log $MAKE $j -e check && Exit 1
     rm -f test-suite.log
index 5cec7fc..7088de4 100755 (executable)
 
 . ./defs || Exit 1
 
-set -e
-
 show_info ()
 {
-  if test x"$parallel_tests" = x"yes"; then
+  if test x"$am_parallel_tests" = x"yes"; then
      cat foo.log
      cat test-suite.log
   else
diff --git a/tests/check-fd-redirect.test b/tests/check-fd-redirect.test
new file mode 100755 (executable)
index 0000000..fb952b4
--- /dev/null
@@ -0,0 +1,110 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Simple Tests support: redirection of file descriptors with
+# AM_TESTS_FD_REDIRECT.
+# See also related test 'parallel-tests-fd-redirect.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+TESTS = foo.test
+AM_TESTS_FD_REDIRECT = 3<three 4>four 5>>five 7<&0 8>&1 9>&2
+END
+
+echo '3333' > three
+chmod a-w three
+
+: > foo.test
+chmod a+x foo.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+
+do_check ()
+{
+  cat foo.test # For debugging.
+  echo 'this line will be removed' > four
+  echo 'this line will not be removed' > five
+  st=0
+  echo 'ok ok ok' | $MAKE check >stdout 2>stderr || st=1
+  cat stdout
+  cat stderr >&2
+  cat four
+  test x"$am_parallel_tests" != x"yes" || cat foo.log
+  test $st -eq 0
+  grep '[ /]foo\.test: foofoofoo$' stdout
+  grep '[ /]foo\.test: barbarbar$' stderr
+  grep 'this line' four && Exit 1
+  grep '^3333$' four
+  grep '^this line will not be removed$' five
+  grep '^ok ok ok$' five
+  $EGREP '(foofoofoo|barbarbar|3333|ok ok ok|this line)' foo.log && Exit 1
+  :
+}
+
+# Try using both shell script and a perl script as the test, for
+# better coverage.
+
+cat > foo.test <<'END'
+#! /bin/sh
+set -e
+
+read FOO <&3
+test 3333 -eq "$FOO"
+echo "$FOO" >&4
+
+grep '^ok ok ok$' <&7 >&5
+
+echo " " $0: foofoofoo >&8
+echo " " $0: barbarbar >&9
+END
+
+do_check
+
+echo "#! $PERL -w" > foo.test
+cat >> foo.test <<'END'
+use warnings FATAL => 'all';
+use strict;
+
+open (FD3, "<&=3") or die "opening FD3: $!";
+open (FD4, ">&=4") or die "opening FD4: $!";
+open (FD5, ">&=5") or die "opening FD5: $!";
+open (FD7, "<&=7") or die "opening FD7: $!";
+open (FD8, ">&=8") or die "opening FD8: $!";
+open (FD9, ">&=9") or die "opening FD9: $!";
+
+chomp (my $FOO = <FD3>);
+die "$FOO != 3333" if not $FOO eq "3333";
+print FD4 "$FOO\n";
+
+chomp ($_ = <FD7>);
+die "$_ != 'ok ok ok'" if not $_ eq 'ok ok ok';
+print FD5 "$_\n";
+
+print FD8 "  $0: foofoofoo\n";
+print FD9 "  $0: barbarbar\n";
+END
+
+do_check
+
+:
similarity index 61%
rename from tests/self-check-env-sanitize.test
rename to tests/check-no-test-driver.test
index 9d18d9e..19ba34c 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/>.
 
-# Sanity check for the automake testsuite.
-# Make sure that the testsuite initialization code complains when
-# some testsuite-influential variables are set in the environment.
+# Check that auxiliary script 'test-driver' doesn't get needlessly
+# installed or referenced when the 'parallel-tests' option is not
+# used.
 
-set -x
+am_parallel_tests=no
+. ./defs || Exit 1
 
-exec 5>&1
-for var in me parallel_tests required; do
-  env "$var=foo" /bin/sh -c '. ./defs' foo.test && exit 1
-  env "$var=foo" /bin/sh -c '. ./defs' foo.test 2>&1 1>&5 \
-    | grep "variable \`$var' is set in the environment.*unsafe" || exit 1
+echo 'TESTS = foo.test' > Makefile.am
+
+$ACLOCAL
+
+for opts in '' '-a' '--add-missing --copy'; do
+  $AUTOMAKE $opts
+  $FGREP 'test-driver' Makefile.in && Exit 1
+  find . | $FGREP 'test-driver' && Exit 1
+  : For shells with busted 'set -e'.
 done
 
 :
similarity index 67%
rename from tests/check9.test
rename to tests/check-subst-prog.test
index c80d780..245a251 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 # 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 @substituted@ TESTS.
-# Note that in this test, we rely on the .test extension for the
-# substituted names: this is necessary for parallel-tests.
+# Check @substituted@ TESTS, some of which are also PROGRAMS.
+# See also sister test `check-subst.test'.
 
+required='cc native'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_SUBST([script_tests], ['subst-pass-script.test subst-xfail-script.test'])
-AC_SUBST([prog_tests], ['subst-pass-prog.test$(EXEEXT) subst-xfail-prog.test$(EXEEXT)'])
-AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.test xfail-prog$(EXEEXT) subst-xfail-prog.test$(EXEEXT)'])
+AC_SUBST([script_tests],
+         ['subst-pass-script.test subst-xfail-script.test'])
+AC_SUBST([prog_tests],
+         ['subst-pass-prog.test$(EXEEXT) subst-xfail-prog.test$(EXEEXT)'])
+AC_SUBST([xfail_tests],
+         ['xfail-script.test subst-xfail-script.test]dnl
+         [ xfail-prog$(EXEEXT) subst-xfail-prog.test$(EXEEXT)'])
 AC_OUTPUT
 END
 
@@ -37,11 +39,11 @@ check_PROGRAMS = pass-prog xfail-prog @prog_tests@
 EXTRA_PROGRAMS = subst-pass-prog.test subst-xfail-prog.test
 END
 
-cat >>pass-script.test <<'END'
+cat > pass-script.test <<'END'
 #! /bin/sh
 exit 0
 END
-cat >>xfail-script.test <<'END'
+cat > xfail-script.test <<'END'
 #! /bin/sh
 exit 1
 END
@@ -49,12 +51,12 @@ chmod a+x pass-script.test xfail-script.test
 cp pass-script.test subst-pass-script.test
 cp xfail-script.test subst-xfail-script.test
 
-cat >>pass-prog.c <<'END'
-int main() { return 0; }
+cat > pass-prog.c <<'END'
+int main (void) { return 0; }
 END
-cat >>xfail-prog.c <<'END'
+cat > xfail-prog.c <<'END'
 #include <stdlib.h>
-int main() { return EXIT_FAILURE; }
+int main (void) { return EXIT_FAILURE; }
 END
 # The .test extension is removed for the default source file name:
 cp pass-prog.c subst-pass-prog.c
@@ -75,4 +77,5 @@ cd build
 $MAKE all
 $MAKE check
 $MAKE distclean
+
 :
diff --git a/tests/check-subst.test b/tests/check-subst.test
new file mode 100755 (executable)
index 0000000..9e31b9a
--- /dev/null
@@ -0,0 +1,87 @@
+#! /bin/sh
+# Copyright (C) 2008, 2009, 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/>.
+
+# Check @substituted@ TESTS.
+# Note that in this test, we rely on the .test extension for the
+# substituted names: this is necessary for parallel-tests.
+# See also sister test `check-subst-prog.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_SUBST([script_tests], ['subst-pass-script.sh subst-xfail-script.sh'])
+AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.sh'])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = pass-script.test xfail-script.test @script_tests@
+XFAIL_TESTS = @xfail_tests@
+END
+
+if test "$am_parallel_tests" = yes; then
+  unindent >> Makefile.am <<'END'
+    TEST_EXTENSIONS = .sh .test
+    SH_LOG_COMPILER = $(SHELL)
+END
+fi
+
+cat > pass-script.test <<'END'
+#! /bin/sh
+exit 0
+END
+cat > xfail-script.test <<'END'
+#! /bin/sh
+exit 1
+END
+cp pass-script.test subst-pass-script.sh
+cp xfail-script.test subst-xfail-script.sh
+chmod a+x pass-script.test xfail-script.test
+
+if test "$am_parallel_tests" != yes; then
+  chmod a+x subst-pass-script.sh subst-xfail-script.sh
+fi
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+for vpath in false : ; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE all
+  $MAKE check
+  if test "$am_parallel_tests" = yes; then
+    ls -l
+    test -f pass-script.log
+    test -f xfail-script.log
+    test -f subst-pass-script.log
+    test -f subst-xfail-script.log
+  fi
+  $MAKE distclean
+  cd $srcdir
+
+done
+
+:
index b588f11..2cf6f0b 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -57,7 +55,7 @@ $MAKE check >out 2>&1 || { cat out; Exit1; }
 cat out
 # The simple-tests driver does not strip VPATH components from
 # the name of the test, but the parallel-tests driver should.
-if test x"$parallel_tests" = x"yes"; then
+if test x"$am_parallel_tests" = x"yes"; then
   grep '\.\./foo' out && Exit 1
   grep '^PASS: foo.test *$' out
 else
@@ -70,7 +68,7 @@ rm -f test-suite.log foo.log bar.log
 FOO_EXIT_STATUS=1 $MAKE check >out 2>&1 && { cat out; Exit1; }
 cat out
 # See comments above.
-if test x"$parallel_tests" = x"yes"; then
+if test x"$am_parallel_tests" = x"yes"; then
   grep '\.\./foo' out && Exit 1
   grep '^FAIL: foo.test *$' out
 else
index 3001228..ae6be67 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 TESTS = frob.test
 END
 
+test x"$am_parallel_tests" != x"yes" || : > test-driver
+
 : > frob.test
 
 $ACLOCAL
@@ -32,9 +32,11 @@ $AUTOMAKE
 grep 'check-TESTS.*:' Makefile.in
 grep 'check-DEJAGNU' Makefile.in && Exit 1
 
-# check-TESTS is phony.
-sed -n '/^\.PHONY:/,/^$/p' Makefile.in | grep check-TESTS
+# 'check-TESTS' is phony.
+sed -n '/^\.PHONY:/,/^$/p' Makefile.in | $EGREP '(^| )check-TESTS($| )'
 
-# check should depend directly on check-am (similar tests are
+# 'check' should depend directly on 'check-am' (similar tests are
 # in check2.test and check3.test).
-grep '^check: check-am' Makefile.in
+$EGREP '^check:.* check-am( |$)' Makefile.in
+
+:
index ab9b529..54f882a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 
 # Check singular and plural in test summaries.
 
+# This test only makes sense for the older serial testsuite driver.
+am_parallel_tests=no
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -29,15 +29,15 @@ TESTS = fail pass skip xfail xpass fail2 pass2 skip2 xfail2 xpass2
 XFAIL_TESTS = xfail xpass xfail2 xpass2
 END
 
-cat >>pass <<'END'
+cat > pass <<'END'
 #! /bin/sh
 exit 0
 END
-cat >>fail <<'END'
+cat > fail <<'END'
 #! /bin/sh
 exit 1
 END
-cat >>skip <<'END'
+cat > skip <<'END'
 #! /bin/sh
 exit 77
 END
@@ -52,7 +52,7 @@ cp skip skip2
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -a
 
 ./configure
 (
@@ -71,7 +71,7 @@ $AUTOMAKE
   env TESTS='pass skip xfail' $MAKE -e check
   $MAKE check
   :
-) >stdout
+) >stdout || { cat stdout; Exit 1; }
 cat stdout
 
 grep '1 [tT]ests' stdout && Exit 1
index 1fe6a4d..f419bfd 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -28,7 +26,7 @@ cat > Makefile.am << 'END'
 TESTS = skip skip2
 END
 
-cat >>skip <<'END'
+cat > skip <<'END'
 #! /bin/sh
 exit 77
 END
@@ -40,12 +38,23 @@ $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-env TESTS=skip $MAKE -e check >stdout
-cat stdout
-grep '1.*passed' stdout && Exit 1
 
-env TESTS="skip skip2" $MAKE -e check >stdout
+env TESTS=skip $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+if test x"$am_parallel_tests" = x"yes"; then
+  count_test_results total=1 pass=0 fail=0 skip=1 xfail=0 xpass=0 error=0
+else
+  grep '1.*passed' stdout && Exit 1
+  : For shells with buggy 'set -e'.
+fi
+
+env TESTS="skip skip2" $MAKE -e check >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep '2.*passed' stdout && Exit 1
+if test x"$am_parallel_tests" = x"yes"; then
+  count_test_results total=2 pass=0 fail=0 skip=2 xfail=0 xpass=0 error=0
+else
+  grep '2.*passed' stdout && Exit 1
+  : For shells with buggy 'set -e'.
+fi
 
 :
index 34c8409..92e4a69 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011, 2012 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
@@ -20,8 +20,6 @@
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -36,10 +34,12 @@ END
 
 cat > a.test << 'END'
 #!/bin/sh
+echo a.test: exit status: ${A_EXIT_STATUS-0}
 exit ${A_EXIT_STATUS-0}
 END
 cat > b.test << 'END'
 #!/bin/sh
+echo b.test: exit status: ${B_EXIT_STATUS-0}
 exit ${B_EXIT_STATUS-0}
 END
 chmod +x a.test b.test
@@ -100,7 +100,7 @@ END
 cat >> Makefile.am <<'END'
 check-local:
        case $$CHECKLOCAL_EXIT_STATUS in \
-         0) echo 'check-local succeded :-)';; \
+         0) echo 'check-local succeeded :-)';; \
          *) echo 'check-local failed :-(';; \
        esac >local.log
        exit $$CHECKLOCAL_EXIT_STATUS
@@ -136,14 +136,12 @@ for vpath in : false; do
   test -f spanner.log
   test -f spanner.sum
   # This checks will be run only by the autogenerated `check12-p.test'.
-  if test x"$parallel_tests" = x"yes"; then
-    cat test-suite.log
-    grep '^PASS: a\.test (exit: 0)' a.log
-    grep '^PASS: b\.test (exit: 0)' b.log
-  else
-    :
-  fi
-  grep 'check-local succeded :-)' local.log
+  if test x"$am_parallel_tests" = x"yes"; then
+    test -f test-suite.log
+    test -f a.log
+    test -f b.log
+  else :; fi
+  grep 'check-local succeeded :-)' local.log
 
   cp -f config.status config-status.sav
 
@@ -170,11 +168,16 @@ for vpath in : false; do
 
   B_EXIT_STATUS=1 $MAKE check && Exit 1
   # This checks will be run only by the autogenerated `check12-p.test'.
-  if test x"$parallel_tests" = x"yes"; then
+  if test x"$am_parallel_tests" = x"yes"; then
     cat test-suite.log
-    grep '^PASS: a\.test (exit: 0)' a.log
-    grep '^FAIL: b\.test (exit: 1)' b.log
-    grep '^FAIL: b\.test (exit: 1)' test-suite.log
+    cat a.log
+    cat b.log
+    grep '^a\.test: exit status: 0$' a.log
+    grep '^b\.test: exit status: 1$' b.log
+    grep '^FAIL: b$' test-suite.log
+    grep '^b\.test: exit status: 1$' test-suite.log
+    grep '^a\.test' test-suite.log && Exit 1
+    : For shells with busted 'set -e'.
   else :; fi
 
   CHECKLOCAL_EXIT_STATUS=1 $MAKE check && Exit 1
@@ -189,11 +192,16 @@ for vpath in : false; do
   grep 'FAIL: test_hammer' hammer.sum
   grep 'FAIL:' spanner.sum && Exit 1
   # This checks will be run only by the autogenerated `check12-p.test'.
-  if test x"$parallel_tests" = x"yes"; then
+  if test x"$am_parallel_tests" = x"yes"; then
     cat test-suite.log
-    grep '^PASS: a\.test (exit: 0)' a.log
-    grep '^FAIL: b\.test (exit: 23)' b.log
-    grep '^FAIL: b\.test (exit: 23)' test-suite.log
+    cat a.log
+    cat b.log
+    grep '^a\.test: exit status: 0$' a.log
+    grep '^b\.test: exit status: 23$' b.log
+    grep '^FAIL: b$' test-suite.log
+    grep '^b\.test: exit status: 23$' test-suite.log
+    grep '^a\.test' test-suite.log && Exit 1
+    : For shells with busted 'set -e'.
   else :; fi
   grep 'check-local failed :-(' local.log
 
index 1db0454..ec6132d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2006, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([dir/Makefile])
 AC_OUTPUT
@@ -45,20 +43,28 @@ echo.sh:
 CLEANFILES = echo.sh
 END
 
+if test x"$am_parallel_tests" = x"yes"; then
+  cp "$am_scriptdir/test-driver" .
+fi
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 ./configure
-$MAKE check >stdout
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep 'PASS: subrun.sh' stdout
+grep '^PASS: subrun\.sh *$' stdout
+grep 'PASS.*echo\.sh' stdout && Exit 1
 
-# check should depend directly on check-am (similar tests are
+# 'check' should depend directly on 'check-am' (similar tests are
 # in check.test and check3.test).
-grep 'check: check-recursive' Makefile.in
-grep 'check: check-am' dir/Makefile.in
+$EGREP '^check:.* check-recursive( |$)' Makefile.in
+$EGREP '^check:.* check-am( |$)' dir/Makefile.in
 
 # Make sure subrun.sh is still on its line as above.  This means Automake
 # hasn't rewritten the TESTS line unnecessarily (we can tell, because all
 # Automake variables are reformatted by VAR_PRETTY).
-grep '  subrun.sh' Makefile.in
+grep '^  subrun\.sh$' Makefile.in
+
+:
index 65705c4..4f32737 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2007, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([dir/Makefile])
 AC_OUTPUT
@@ -56,16 +54,18 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -a
 ./configure --prefix "`pwd`/inst"
-$MAKE check >stdout
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep 'PASS: subrun.sh' stdout
+grep '^PASS: subrun\.sh *$' stdout
+grep 'PASS.*echo\.sh' stdout && Exit 1
 
-# check should depend directly on check-am (similar tests are
-# in check.test and check2.test).
-$FGREP 'check: $(BUILT_SOURCES)' Makefile.in
-$FGREP 'check: $(BUILT_SOURCES)' dir/Makefile.in
+# check should depend directly on $(BUILT_SOURCES) (similar tests
+# are in check.test and check2.test).
+$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' Makefile.in
+$EGREP '^check:.* \$\(BUILT_SOURCES\)( |$)' dir/Makefile.in
 
 $MAKE clean
 # Sanity checks
@@ -75,3 +75,5 @@ test ! -f dir/command2.inc
 $MAKE install
 test -f command1.inc
 test -f dir/command2.inc
+
+:
index 70dc55a..bb9a2b6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2007, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2005, 2007, 2008, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([dir/Makefile])
 AC_OUTPUT
@@ -48,37 +46,38 @@ chmod +x ok.sh dir/fail.sh
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --add-missing
+
 ./configure --prefix "`pwd`/inst"
+
 $MAKE check >stdout && { cat stdout; Exit 1; }
 cat stdout
-grep 'FAIL: fail.sh' stdout
-grep 'PASS: ok.sh' stdout && Exit 1
+grep '^FAIL: fail\.sh *$' stdout
+grep '^PASS: ok\.sh *$' stdout && Exit 1
 
 # The exit status of `make -k' can be anything
 # (depending on the Make implementation)
 $MAKE -k check >stdout || :
 cat stdout
-grep 'FAIL: fail.sh' stdout
-grep 'PASS: ok.sh' stdout
+grep '^FAIL: fail\.sh *$' stdout
+grep '^PASS: ok\.sh *$' stdout
 
-# should also works when -k is not in first position
+# Should also works when -k is not in first position.
 $MAKE -s -k check >stdout || :
 cat stdout
-grep 'FAIL: fail.sh' stdout
-grep 'PASS: ok.sh' stdout
+grep '^FAIL: fail\.sh *' stdout
+grep '^PASS: ok\.sh *' stdout
 
 # The rest of the test is for GNU Make.
 
-# Use --version AND -v, because SGI Make doesn't fail on --version.
-# Also grep for GNU because newer versions of FreeBSD make do
-# not complain about `--version' (they seem to silently ignore it).
-($MAKE --version -v | grep GNU) || Exit 0
+if using_gmake; then
+  # Try with a long-option that do not have a short option equivalent
+  # (here, --no-print-directory).  That should cause all options to
+  # appear verbatim in MAKEFLAGS.
+  $MAKE --no-print-directory -k check >stdout || :
+  cat stdout
+  grep '^FAIL: fail\.sh *$' stdout
+  grep '^PASS: ok\.sh *$' stdout
+fi
 
-# Try with a long-option that do not have a short option equivalent
-# (here, --no-print-directory).  That should cause all options to
-# appear verbatim in MAKEFLAGS.
-$MAKE --no-print-directory -k check >stdout || :
-cat stdout
-grep 'FAIL: fail.sh' stdout
-grep 'PASS: ok.sh' stdout
+:
index 7113e1b..a10989c 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2006, 2007, 2008, 2009, 2010  Free Software Foundation,
-# Inc.
+# Copyright (C) 2006, 2007, 2008, 2009, 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
 
 # Test TESTS = $(check_PROGRAMS)
 
+required='cc native'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_OUTPUT
@@ -33,6 +32,7 @@ check-local:
        test -f one$(EXEEXT)
        test -f two$(EXEEXT)
        touch ok
+.PHONY: print-tests
 print-tests:
        echo BEG: $(TESTS) :END
 END
@@ -41,17 +41,22 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-cat >one.c <<END
-int main() { return 0; }
+cat > one.c << 'END'
+int main (void)
+{
+  return 0;
+}
 END
 cp one.c two.c
 
 ./configure
 $MAKE check
 test -f ok
-EXEEXT=.bin $MAKE -e print-tests >output
-cat output
+EXEEXT=.bin $MAKE -e print-tests >stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP 'BEG: one.bin two.bin :END' stdout
 # No am__EXEEXT_* variable is needed.
 grep '_EXEEXT_[1-9]' Makefile.in && Exit 1
-grep 'BEG: one.bin two.bin :END' output
 $FGREP 'TESTS = $(check_PROGRAMS)' Makefile.in
+
+:
index e32499c..9687008 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_PROG_CC
 AC_OUTPUT
 END
 
@@ -52,3 +49,5 @@ mkdir build
 cd build
 ../configure
 $MAKE check
+
+:
index 1653a8d..e0b37c9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007, 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
 
 # Check EXEEXT extension for XFAIL_TESTS.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_OUTPUT
@@ -30,20 +29,25 @@ TESTS = $(XFAIL_TESTS)
 XFAIL_TESTS = a b c d
 check_PROGRAMS = a c d
 check_SCRIPTS = b
+EXTRA_DIST = $(check_SCRIPTS)
 
+.PHONY: print-xfail-tests
 print-xfail-tests:
        @echo BEG: $(XFAIL_TESTS) :END
 END
 
-cat >>b <<'END'
+cat > b <<'END'
 #! /bin/sh
 exit 1
 END
 chmod a+x b
 
-cat >>a.c <<'END'
+cat > a.c <<'END'
 #include <stdlib.h>
-int main() { return EXIT_FAILURE; }
+int main (void)
+{
+  return EXIT_FAILURE;
+}
 END
 
 cp a.c c.c
@@ -55,12 +59,10 @@ $AUTOMAKE -a
 
 ./configure
 $MAKE check
-EXEEXT=.bin $MAKE -e print-xfail-tests >foo
-cat foo
-grep 'BEG: a.bin b c.bin d.bin :END' foo
+EXEEXT=.bin $MAKE -e print-xfail-tests >stdout || {  cat stdout; Exit 1; }
+cat stdout
+$FGREP 'BEG: a.bin b c.bin d.bin :END' stdout
 
-$MAKE distclean
-mkdir build
-cd build
-../configure
-$MAKE check
+$MAKE distcheck
+
+:
index cbf1052..6906318 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 
 # Check subdir TESTS.
 
+required='cc native'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -35,29 +34,29 @@ END
 
 mkdir sub
 
-cat >>foo <<'END'
+cat > foo <<'END'
 #! /bin/sh
 test -f "$srcdir/Makefile.am"
 END
-cat >>sub/foo <<'END'
+cat > sub/foo <<'END'
 #! /bin/sh
 test -f "$srcdir/Makefile.am"
 END
 chmod a+x foo sub/foo
 
-cat >>bar.c <<'END'
-int main() { return 0; }
+cat > bar.c <<'END'
+int main (void) { return 0; }
 END
-cat >>sub/bar.c <<'END'
-int main() { return 0; }
+cat > sub/bar.c <<'END'
+int main (void) { return 0; }
 END
-cat >>baz.c <<'END'
+cat > baz.c <<'END'
 #include <stdlib.h>
-int main() { return EXIT_FAILURE; }
+int main (void) { return EXIT_FAILURE; }
 END
-cat >>sub/baz.c <<'END'
+cat > sub/baz.c <<'END'
 #include <stdlib.h>
-int main() { return EXIT_FAILURE; }
+int main (void) { return EXIT_FAILURE; }
 END
 
 $ACLOCAL
@@ -75,7 +74,7 @@ grep '^[^X]*PASS.* bar' stdout
 grep '^[^X]*PASS.* sub/bar' stdout
 grep '^[^X]*FAIL.* baz' stdout
 grep 'XFAIL.* sub/baz' stdout
-# parallel-tests should not add circular dependencies.
+# `parallel-tests' should not add circular dependencies.
 # Look for known warnings from a couple of `make' implementations.
 grep -i 'circular.*dependency' stderr && Exit 1
 grep -i 'graph cycles' stderr && Exit 1
index 7dff8fc..1981bc7 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2010 Free Software
+# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 bin_SCRIPTS = derived
 check-local:
index 23ab2ac..b9ffbe0 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 : > Makefile.am
 
 $ACLOCAL
index 99e4c2e..46ab4b7 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure distclean works in cygnus mode.
-# Report from Daniel Jacobowitz
+# Report from Daniel Jacobowitz.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_MAINTAINER_MODE
 AC_CONFIG_FILES([sub/Makefile])
@@ -29,6 +27,13 @@ END
 
 cat > Makefile.am << 'END'
 SUBDIRS = sub
+
+data_DATA = bar
+
+bar:
+       touch $@
+
+DISTCLEANFILES = bar
 END
 
 mkdir sub
@@ -48,6 +53,16 @@ $AUTOMAKE --cygnus
 
 ./configure
 $MAKE
+ls -l
+test -f bar
 test -f sub/foo
 $MAKE distclean
-test ! -f sub/foo
+ls -l
+test ! -r bar
+test ! -r sub/foo
+test ! -r Makefile
+test ! -r config.status
+test -f Makefile.in
+test -f configure
+
+:
index 59d2414..b60d5c0 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 ICONS := $(wildcard *.xbm)
-data_DATA = $(ICONS)
 END
 
 $ACLOCAL
 AUTOMAKE_fails
 grep ':=.*not portable' stderr
 
-echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am
-$AUTOMAKE
-grep 'ICONS :=' Makefile.in
+$AUTOMAKE -Wno-portability
+grep '^ICONS *:= *\$(wildcard \*\.xbm) *$' Makefile.in
+
+:
index e454c46..fe117c9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2010, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 t = a b c
 EXTRA_DIST = $(t:=.test)
+.PHONY: test
+test:
+       is $(EXTRA_DIST) == a.test b.test c.test
 END
 
-: > a.test
-: > b.test
-: > c.test
-
 $ACLOCAL
+$AUTOCONF
 $AUTOMAKE
+
+./configure
+$MAKE test
+
+:
similarity index 69%
rename from tests/xz.test
rename to tests/colneq3.test
index f442711..96c02d7 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 support for no-dist-gzip with xz
+# Test that := definitions work as expected at make time.
 
-required=xz
+required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << 'END'
-AC_INIT([xz], [1.0])
-AM_INIT_AUTOMAKE([no-dist-gzip dist-xz])
-AC_CONFIG_FILES([Makefile])
+cat >> configure.in << 'END'
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-test: distcheck
-       test $(DIST_ARCHIVES) = xz-1.0.tar.xz
-       test -f $(DIST_ARCHIVES)
+BAR := $(FOO)
+BAZ = $(FOO)
+FOO := foo
+.PHONY: test
+test:
+       test x'$(FOO)' = x'foo'
+       test x'$(BAZ)' = x'foo'
+       test x'$(BAR)' = x
 END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-portability
+
 ./configure
 $MAKE test
+
+:
index 22b5ed3..ff44e0b 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2000, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_CONFIG_FILES([foo.h:foo.hin])
 AC_OUTPUT
 END
 
-: > Makefile.am
 : > foo.hin
 
+cat > Makefile.am <<'END'
+.PHONY: test
+test: distdir
+       ls -l . $(distdir)
+       test -f foo.h
+       test -f $(distdir)/foo.hin
+END
+
 $ACLOCAL
 $AUTOMAKE
+$AUTOCONF
+
+./configure
+
+$MAKE test
+$MAKE distcheck
 
 :
index a52dfa8..b583831 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2000, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure ":" works with files automake generates.
+# See also sister test `colon3.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -28,14 +27,54 @@ AC_CONFIG_FILES([Makefile:zardoz.in])
 AC_OUTPUT
 END
 
-echo 'dummy:' > zardoz.am
+cat > zardoz.am <<END
+.PHONY: dummy
+dummy:
+END
 
 $ACLOCAL
 $AUTOMAKE
 
-# We actually check several things here.
+# Automake should have created zardoz.in.
 test -f zardoz.in
-grep '^zardoz:' zardoz.in && Exit 1
-grep '^dummy:' zardoz.in
+
+# The generated file should refer to zardoz.in and zardoz.am, but
+# never just "zardoz".
+$FGREP 'zardoz.am' zardoz.in
+$FGREP 'zardoz.in' zardoz.in
+sed -e 's|zardoz\.am|zrdz.am|g' \
+    -e 's|zardoz\.in|zrdz.in|g' \
+  <zardoz.in | $FGREP 'zardoz' && Exit 1
+
+# The configure-generated Makefile should depend on zardoz.in, two.in and
+# three.in.  The automake-generated zardoz.in should depend on zardoz.am.
+# Let's do this check the right way by running configure and make.
+
+str='%% ZaR DoZ %%'
+
+$AUTOCONF
+./configure
+test -f Makefile # Sanity check.
+
+$MAKE dummy
+# Again, make sure that the generated Makefile do not unduly
+# refer to `zardoz' .
+$MAKE -n zardoz && Exit 1
+
+$sleep
+cat >> zardoz.am <<END
+check-local: testam testin testmk
+.PHONY: testam testin testmk
+testam:
+       grep '$str' \$(srcdir)/zardoz.am
+testin:
+       grep '$str' \$(srcdir)/zardoz.in
+testmk:
+       grep '$str' Makefile
+END
+$MAKE Makefile # For non-GNU make.
+$MAKE testam testin testmk
+
+$MAKE distcheck
 
 :
index 151d015..5183b57 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 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
 
 # Make sure ":" works with files automake generates.
 # This test is for multiple ":"s.
+# See also sister test `colon2.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -29,7 +28,11 @@ AC_CONFIG_FILES([Makefile:zardoz.in:two.in:three.in])
 AC_OUTPUT
 END
 
-: > zardoz.am
+cat > zardoz.am <<END
+.PHONY: dummy
+dummy:
+END
+
 : > two.in
 : > three.in
 
@@ -41,21 +44,49 @@ test -f zardoz.in
 
 # The generated file should refer to zardoz.in and zardoz.am, but
 # never just "zardoz".
+$FGREP 'zardoz.am' zardoz.in
+$FGREP 'zardoz.in' zardoz.in
 sed -e 's|zardoz\.am|zrdz.am|g' \
     -e 's|zardoz\.in|zrdz.in|g' \
   <zardoz.in | $FGREP 'zardoz' && Exit 1
 
-# FIXME: Do something like this after planned enahncements to tests/defs.
-# FIXME: Or even do proper functional testing.
-## Also, Makefile should depend on two.in and three.in.
-# extract_makefile_deps Makefile zardoz.in > deps
-#$FGREP ' $(srcdir)/two.in ' deps
-#$FGREP ' $(srcdir)/three.in ' deps
-#
-# FIXME: for the moment, we content ourselves with these inferior tests.
-# Makefile should depend on two.in.
-grep '^Makefile:.* \$(srcdir)/two.in' zardoz.in
-# Likewise three.in.
-grep '^Makefile:.* \$(srcdir)/three.in' zardoz.in
+# The configure-generated Makefile should depend on zardoz.in, two.in and
+# three.in.  The automake-generated zardoz.in should depend on zardoz.am.
+# Let's do this check the right way by running configure and make.
+
+str='%% ZaR DoZ %%'
+str2='// 2_TwO_2 //'
+str3='== @thr33@ =='
+
+$AUTOCONF
+./configure
+test -f Makefile # Sanity check.
+
+$MAKE dummy
+# Again, make sure that the generated Makefile do not unduly
+# refer to `zardoz' .
+$MAKE -n zardoz && Exit 1
+
+$sleep
+cat >> zardoz.am <<END
+check-local: testam testin testmk test2 test3
+.PHONY: testam testin test2 testmk test3
+testam:
+       grep '$str' \$(srcdir)/zardoz.am
+testin:
+       grep '$str' \$(srcdir)/zardoz.in
+testmk:
+       grep '$str' Makefile
+test2:
+       grep '$str2' \$(srcdir)/two.in
+test3:
+       grep '$str3' \$(srcdir)/three.in
+END
+echo "# $str2" >> two.in
+echo "# $str3" >> three.in
+$MAKE Makefile # For non-GNU make.
+$MAKE testam testin testmk test2 test3
+
+$MAKE distcheck
 
 :
index 9af6b4e..2c26383 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 2000, 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<END
 AC_CONFIG_FILES([zardoz:one:two:three])
 AC_OUTPUT
index 9dae9c8..571d88c 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 2000, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -31,21 +29,44 @@ END
 : > Makefile.dep
 
 cat > Makefile.am <<'END'
-.PHONY: test
-test:
-       case ' $(DIST_COMMON) ' in \
-         *' $(srcdir)/Makefile.dep '*|*' Makefile.dep '*) exit 0;; \
-         *) exit 1;; \
-       esac
+.PHONY: test-fs-layout test-grep test-distcommon test-distdir
+check-local: test-fs-layout test-grep test-distcommon test-distdir
+test-fs-layout:
+       test x'$(srcdir)' = '.' || test ! -r Makefile.dep
+test-grep:
+## The use of $(empty) prevents spurious matches.
+       grep '=GrEp$(empty)Me_am=' $(srcdir)/Makefile.in
+       grep '=GrEp$(empty)Me_dep=' $(srcdir)/Makefile.dep
+       grep '=GrEp$(empty)Me_am=' Makefile
+       grep '=GrEp$(empty)Me_dep=' Makefile
+test-distcommon:
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]Makefile.dep '
+test-distdir: distdir
+       test -f $(distdir)/Makefile.dep
 END
 
 $ACLOCAL
+$AUTOCONF
 $AUTOMAKE
 
-grep 'Makefile:Makefile\.in' Makefile.in
-grep '^Makefile:.* \$(srcdir)/Makefile\.dep' Makefile.in
+./configure
+
+grep '=GrEpMe_am=' Makefile && Exit 1  # Sanity check.
+grep '=GrEpMe_dep=' Makefile && Exit 1 # Likewise.
+
+$MAKE test-distcommon
+$MAKE test-distdir
+
+$sleep
+
+echo '# =GrEpMe_am=' >> Makefile.am
+echo '# =GrEpMe_dep=' >> Makefile.dep
+
+$MAKE Makefile # For non-GNU make.
+$MAKE test-grep
+$MAKE test-distcommon
+$MAKE test-distdir
 
-sed -e '/@SET_MAKE@/d' -e "s!@SHELL@!$SHELL!g" <Makefile.in >Makefile.sed
-$MAKE -f Makefile.sed SHELL=$SHELL test
+$MAKE distcheck
 
 :
index 7c620d6..6aac84a 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 2000, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
+# With this, version.good should depend on version.gin, while
+# Makefile should not depend on either of them.
 AC_CONFIG_FILES([demo/Makefile demo/version.good:demo/version.gin])
 AC_OUTPUT
 END
 
 mkdir demo
-
 : > demo/version.gin
-
-cat > demo/Makefile.am <<'END'
-.PHONY: test
-test:
-       case ' $(DIST_COMMON) ' in \
-         *' $(srcdir)/version.gin '*) exit 0;; \
-         *) exit 1;; \
-       esac
-END
+: > demo/Makefile.am
 
 $ACLOCAL
 $AUTOMAKE
 
+# These are older "grepping checks", kept mostly for backward-compatibility.
+# They might (unlikely, but possibly) require updating when automake
+# internals are changed.  Just relax or remove if they become too fragile.
 $EGREP 'Makefile:.*(demo|version)' demo/Makefile.in && Exit 1
 grep 'version\.good:.*version\.gin' demo/Makefile.in
 
-sed -e '/@SET_MAKE@/d' -e "s!@SHELL@!$SHELL!g" <demo/Makefile.in >Makefile.sed
-$MAKE -f Makefile.sed SHELL=$SHELL test
+$AUTOCONF
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=..
+    mkdir build
+    cd build
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+
+  test -f demo/version.good   # Sanity check.
+  test ! -s demo/version.good # Likewise.
+
+  cd demo
+
+  $sleep
+  # HP-UX make considers targets with exact time stamps as one of their
+  # prerequisites out of date.  Ensure Makefile is newer than config.status to
+  # avoid triggering the am--refresh rule in the (here-nonexistent) toplevel
+  # Makefile.
+  touch Makefile
+
+  # version.good should depend on version.gin.
+  echo "Rebuilt (srcdir=$srcdir)" > ../$srcdir/demo/version.gin
+  $MAKE version.good
+  $FGREP "Rebuilt (srcdir=$srcdir)" version.good
+
+  # Makefile should not depend on version.good.
+  rm -f version.good
+  $MAKE Makefile
+  test ! -r version.good
+
+  # version.good should be rebuilt from version.gin.
+  $MAKE version.good
+  test -f version.good
+
+  # Makefile should not depend on version.gin.
+  rm -f ../$srcdir/demo/version.gin
+  $MAKE Makefile
+  test ! -r ../$srcdir/demo/version.gin # Sanity check.
+
+  # version.good should depend on version.gin.
+  rm -f version.good
+  $MAKE version.good >output 2>&1 && { cat output; Exit 1; }
+  cat output
+  # Try to verify that we errored out for the right reason.
+  $FGREP version.gin output
+
+  cd .. # Back in top builddir.
+  cd $srcdir
+
+  # Re-create it for the next pass (if any).
+  : > demo/version.gin
+
+done
 
 :
index 4195188..f445dac 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 2000, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Another test for a failing ":" in AC_OUTPUT.  Report from Maciej
-# Stachowiak.
+# Another test for a failing ":" in AC_OUTPUT.
+# Report from Maciej Stachowiak.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([colon7], [1.0])
 AM_INIT_AUTOMAKE
@@ -32,19 +30,26 @@ AC_OUTPUT(subdir/bar:subdir/foo \
 )
 END
 
-: > Makefile.am
-
 mkdir subdir
-: > subdir/Makefile.am
+: > Makefile.am
 : > subdir/foo
+cat > subdir/Makefile.am << 'END'
+# DIST_COMMON should contain `foo', not `subdir/foo'.
+test:
+       case '$(DIST_COMMON)' in *subdir/foo*) exit 1;; *) exit 0;; esac
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]foo '
+.PHONY: test
+END
 
 $ACLOCAL
 $AUTOMAKE
 
-# shouldn't have any bar.in
-grep 'bar.in' subdir/Makefile.in && Exit 1
+# Should nowhere refer to `bar.in'.
+$FGREP 'bar.in' Makefile.in subdir/Makefile.in && Exit 1
 
-# DIST_COMMON should have foo, not subdir/foo
-grep 'DIST_COMMON.*subdir/foo' subdir/Makefile.in && Exit 1
+$AUTOCONF
+./configure
+cd subdir
+$MAKE test
 
 :
index c1032fd..1313b7a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 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
 
 . ./defs || Exit 1
 
-set -e
-
 TERM=ansi
 export TERM
 
-red='\e[0;31m'
-grn='\e[0;32m'
-lgn='\e[1;32m'
-blu='\e[1;34m'
-std='\e[m'
+esc='\e'
+# Escape `[' for grep, below.
+red="$esc\[0;31m"
+grn="$esc\[0;32m"
+lgn="$esc\[1;32m"
+blu="$esc\[1;34m"
+mgn="$esc\[0;35m"
+std="$esc\[m"
 
 # Check that grep can parse nonprinting characters.
 # BSD 'grep' works from a pipe, but not a seekable file.
 # GNU or BSD 'grep -a' works on files, but is not portable.
 case `echo "$std" | grep .` in
   "$std") ;;
-  *) echo "$me: grep can't parse nonprinting characters" >&2; Exit 77;;
+  *) skip_ "grep can't parse nonprinting characters";;
 esac
 
 cat >>configure.in <<END
@@ -45,7 +46,7 @@ END
 cat >Makefile.am <<'END'
 AUTOMAKE_OPTIONS = color-tests
 TESTS = $(check_SCRIPTS)
-check_SCRIPTS = pass fail skip xpass xfail
+check_SCRIPTS = pass fail skip xpass xfail error
 XFAIL_TESTS = xpass xfail
 END
 
@@ -64,36 +65,93 @@ cat >skip <<END
 exit 77
 END
 
+cat >error <<END
+#! /bin/sh
+exit 99
+END
+
 cp fail xfail
 cp pass xpass
-chmod +x pass fail skip xpass xfail
+chmod +x pass fail skip xpass xfail error
 
 $ACLOCAL
-$AUTOMAKE
 $AUTOCONF
-./configure
+$AUTOMAKE --add-missing
 
 test_color ()
 {
   # Not a useless use of cat; see above comments about grep.
-  cat stdout | grep ": pass" | $FGREP "$grn"
-  cat stdout | grep ": fail" | $FGREP "$red"
-  cat stdout | grep ": xfail" | $FGREP "$lgn"
-  cat stdout | grep ": xpass" | $FGREP "$red"
-  cat stdout | grep ": skip" | $FGREP "$blu"
+  cat stdout | grep "^${grn}PASS${std}: .*pass"
+  cat stdout | grep "^${red}FAIL${std}: .*fail"
+  cat stdout | grep "^${blu}SKIP${std}: .*skip"
+  cat stdout | grep "^${lgn}XFAIL${std}: .*xfail"
+  cat stdout | grep "^${red}XPASS${std}: .*xpass"
+  # The old serial testsuite driver doesn't distinguish between failures
+  # and hard errors.
+  if test x"$am_parallel_tests" = x"yes"; then
+    cat stdout | grep "^${mgn}ERROR${std}: .*error"
+  else
+    cat stdout | grep "^${red}FAIL${std}: .*error"
+  fi
+  :
 }
 
 test_no_color ()
 {
-  # Not a useless use of cat; see above comments about grep.
-  cat stdout | grep ": pass" | $FGREP "$grn" && Exit 1
-  cat stdout | grep ": fail" | $FGREP "$red" && Exit 1
-  cat stdout | grep ": xfail" | $FGREP "$lgn" && Exit 1
-  cat stdout | grep ": xpass" | $FGREP "$red" && Exit 1
-  cat stdout | grep ": skip" | $FGREP "$blu" && Exit 1
-  :
+  # With make implementations that, like Solaris make, in case of errors
+  # print the whole failing recipe on standard output, we should content
+  # ourselves with a laxer check, to avoid false positives.
+  # Keep this in sync with lib/am/check.am:$(am__color_tests).
+  if $FGREP '= Xalways || test -t 1 ' stdout; then
+    # Extra verbose make, resort to laxer checks.
+    # Note that we also want to check that the testsuite summary is
+    # not unduly colorized.
+    (
+      set +e # In case some grepped regex below isn't matched.
+      # Not a useless use of cat; see above comments about grep.
+      cat stdout | grep "TOTAL.*:"
+      cat stdout | grep "PASS.*:"
+      cat stdout | grep "FAIL.*:"
+      cat stdout | grep "SKIP.*:"
+      cat stdout | grep "XFAIL.*:"
+      cat stdout | grep "XPASS.*:"
+      cat stdout | grep "ERROR.*:"
+      cat stdout | grep 'test.*expected'
+      cat stdout | grep 'test.*not run'
+      cat stdout | grep '===='
+      cat stdout | grep '[Ss]ee .*test-suite\.log'
+      cat stdout | grep '[Tt]estsuite summary'
+    ) | grep "$esc" && Exit 1
+    : For shells with broken 'set -e'
+  else
+    cat stdout | grep "$esc" && Exit 1
+    : For shells with broken 'set -e'
+  fi
 }
 
-AM_COLOR_TESTS=always $MAKE -e check >stdout && { cat stdout; Exit 1; }
-cat stdout
-test_color
+for vpath in false :; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+
+  AM_COLOR_TESTS=always $MAKE -e check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  test_color
+
+  $MAKE -e check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  test_no_color
+
+  $MAKE distclean
+  cd $srcdir
+
+done
+
+:
index bc97313..ab5ab82 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2008, 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
 
 . ./defs || Exit 1
 
-set -e
-
 TERM=ansi
 export TERM
 
-red='\e[0;31m'
-grn='\e[0;32m'
-lgn='\e[1;32m'
-blu='\e[1;34m'
-std='\e[m'
+esc='\e'
+# Escape `[' for grep, below.
+red="$esc\[0;31m"
+grn="$esc\[0;32m"
+lgn="$esc\[1;32m"
+blu="$esc\[1;34m"
+mgn="$esc\[0;35m"
+std="$esc\[m"
 
 # Check that grep can parse nonprinting characters.
 # BSD 'grep' works from a pipe, but not a seekable file.
 # GNU or BSD 'grep -a' works on files, but is not portable.
 case `echo "$std" | grep .` in
   "$std") ;;
-  *) echo "$me: grep can't parse nonprinting characters" >&2; Exit 77;;
+  *) skip_ "grep can't parse nonprinting characters";;
 esac
 
 # This test requires a working a working `expect' program.
@@ -49,12 +50,13 @@ esac
 # in proceeding.
 cat > Makefile <<'END'
 all:
-## Creaive quoting in the `echo' below to avoid risk of spurious output
+## Creative quoting in the `echo' below to avoid risk of spurious output
 ## matches by `expect', below.
        @test -t 1 && echo "stdout" "is" "a" "tty"
 END
+
 cat > expect-check <<'END'
-spawn $env(MAKE)
+eval spawn $env(MAKE)
 expect {
   "stdout is a tty" { exit 0 }
   default { exit 1 }
@@ -63,7 +65,7 @@ exit 1
 END
 MAKE=$MAKE expect -f expect-check \
   || skip_ "make spawned by expect should have a tty stdout"
-rm -f check Makefile
+rm -f expect-check Makefile
 
 # Do the tests.
 
@@ -74,7 +76,7 @@ END
 cat >Makefile.am <<'END'
 AUTOMAKE_OPTIONS = color-tests
 TESTS = $(check_SCRIPTS)
-check_SCRIPTS = pass fail skip xpass xfail
+check_SCRIPTS = pass fail skip xpass xfail error
 XFAIL_TESTS = xpass xfail
 END
 
@@ -93,47 +95,100 @@ cat >skip <<END
 exit 77
 END
 
+cat >error <<END
+#! /bin/sh
+exit 99
+END
+
 cp fail xfail
 cp pass xpass
-chmod +x pass fail skip xpass xfail
+chmod +x pass fail skip xpass xfail error
 
 $ACLOCAL
-$AUTOMAKE
 $AUTOCONF
-./configure
+$AUTOMAKE --add-missing
 
 test_color ()
 {
   # Not a useless use of cat; see above comments about grep.
-  cat stdout | grep ": pass" | $FGREP "$grn"
-  cat stdout | grep ": fail" | $FGREP "$red"
-  cat stdout | grep ": xfail" | $FGREP "$lgn"
-  cat stdout | grep ": xpass" | $FGREP "$red"
-  cat stdout | grep ": skip" | $FGREP "$blu"
+  cat stdout | grep "^${grn}PASS${std}: .*pass"
+  cat stdout | grep "^${red}FAIL${std}: .*fail"
+  cat stdout | grep "^${blu}SKIP${std}: .*skip"
+  cat stdout | grep "^${lgn}XFAIL${std}: .*xfail"
+  cat stdout | grep "^${red}XPASS${std}: .*xpass"
+  # The old serial testsuite driver doesn't distinguish between failures
+  # and hard errors.
+  if test x"$am_parallel_tests" = x"yes"; then
+    cat stdout | grep "^${mgn}ERROR${std}: .*error"
+  else
+    cat stdout | grep "^${red}FAIL${std}: .*error"
+  fi
+  :
 }
 
 test_no_color ()
 {
-  # Not a useless use of cat; see above comments about grep.
-  cat stdout | grep ": pass" | $FGREP "$grn" && Exit 1
-  cat stdout | grep ": fail" | $FGREP "$red" && Exit 1
-  cat stdout | grep ": xfail" | $FGREP "$lgn" && Exit 1
-  cat stdout | grep ": xpass" | $FGREP "$red" && Exit 1
-  cat stdout | grep ": skip" | $FGREP "$blu" && Exit 1
-  :
+  # With make implementations that, like Solaris make, in case of errors
+  # print the whole failing recipe on standard output, we should content
+  # ourselves with a laxer check, to avoid false positives.
+  # Keep this in sync with lib/am/check.am:$(am__color_tests).
+  if $FGREP '= Xalways || test -t 1 ' stdout; then
+    # Extra verbose make, resort to laxer checks.
+    # Note that we also want to check that the testsuite summary is
+    # not unduly colorized.
+    (
+      set +e # In case some grepped regex below isn't matched.
+      # Not a useless use of cat; see above comments about grep.
+      cat stdout | grep "TOTAL.*:"
+      cat stdout | grep "PASS.*:"
+      cat stdout | grep "FAIL.*:"
+      cat stdout | grep "SKIP.*:"
+      cat stdout | grep "XFAIL.*:"
+      cat stdout | grep "XPASS.*:"
+      cat stdout | grep "ERROR.*:"
+      cat stdout | grep 'test.*expected'
+      cat stdout | grep 'test.*not run'
+      cat stdout | grep '===='
+      cat stdout | grep '[Ss]ee .*test-suite\.log'
+      cat stdout | grep '[Tt]estsuite summary'
+    ) | grep "$esc" && Exit 1
+    : For shells with broken 'set -e'
+  else
+    cat stdout | grep "$esc" && Exit 1
+    : For shells with broken 'set -e'
+  fi
 }
 
 cat >expect-make <<'END'
-spawn $env(MAKE) -e check
+eval spawn $env(MAKE) -e check
 expect eof
 END
 
-MAKE=$MAKE expect -f expect-make >stdout \
-  || { cat stdout; Exit 1; }
-cat stdout
-test_color
+for vpath in false :; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+
+  MAKE=$MAKE expect -f $srcdir/expect-make >stdout \
+    || { cat stdout; Exit 1; }
+  cat stdout
+  test_color
+
+  AM_COLOR_TESTS=no MAKE=$MAKE expect -f $srcdir/expect-make >stdout \
+    || { cat stdout; Exit 1; }
+  cat stdout
+  test_no_color
+
+  $MAKE distclean
+  cd $srcdir
+
+done
 
-AM_COLOR_TESTS=no MAKE=$MAKE expect -f expect-make >stdout \
-  || { cat stdout; Exit 1; }
-cat stdout
-test_no_color
+:
index d7148f8..79545e9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005  Free Software Foundation, Inc.
+# Copyright (C) 2005, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 SUBDIRS = foo \
 # bar
index 963f2f8..f355cc3 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2005, 2009, 2011, 2012 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 # initial comment
 variable = value-before-comment \
@@ -37,6 +35,7 @@ mkdir foo
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 3.*backslash stderr
-grep 7.*backslash stderr
+grep '^Makefile\.am:3:.*backslash' stderr
+grep '^Makefile\.am:7:.*backslash' stderr
+
 :
index 761dbf5..6092e74 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = #no such option
 END
index 97e6a26..f8bd62c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 14980c8..8903a97 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 install-data-local:
        # Tru64 Unix must die
index f6e6a3f..7c1f454 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -29,7 +29,6 @@ cat > Makefile.am << 'EOF'
 mumble = UnIqUe_MUMBLE_VALUE
 EOF
 
-set -e
 $ACLOCAL
 $AUTOMAKE
 # UnIqUe_COPYRIGHT_BOILERPLATE should appear near the top of the file
index 21b5e87..8e1d1fe 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AC_OUTPUT
 EOF
@@ -37,7 +35,7 @@ EOF
 
 $ACLOCAL
 AUTOMAKE_fails
-grep '^Makefile.am:5: blank line following trailing backslash' stderr
+grep '^Makefile.am:5: error: blank line following trailing backslash' stderr
 
 
 ## Here is a second test because head comments are
@@ -54,7 +52,7 @@ var = foo
 EOF
 
 AUTOMAKE_fails
-grep '^Makefile.am:2: blank line following trailing backslash' stderr
+grep '^Makefile.am:2: error: blank line following trailing backslash' stderr
 
 
 ## Make sure we print an 'included' stack on errors.
@@ -66,8 +64,9 @@ cat > Makefile.inc << 'EOF'
 EOF
 
 AUTOMAKE_fails
-grep '^Makefile.inc:2: blank line following trailing backslash' stderr
+grep '^Makefile.inc:2: error: blank line following trailing backslash' stderr
 grep '^Makefile.am:1: .*included from here' stderr
+grep -v '^Makefile.am:1: .*error:' stderr
 
 
 ## Make sure backslashes are still allowed within a comment.
index efa8482..1c46c86 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test for PR/322.
+# Automake 1.6.1 seems to have a problem parsing comments that use
+# '\' to span multiple lines.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AC_OUTPUT
 EOF
@@ -64,3 +64,5 @@ $AUTOMAKE
 $MAKE
 grep '# SOME_FILES' Makefile
 grep '# *file3' Makefile
+
+:
index f28b711..26854a1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2006, 2011, 2012 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AM_CONDITIONAL([COND], [true])
 EOF
@@ -44,12 +42,12 @@ test `grep '@COND_FALSE@VAR' Makefile.in | wc -l` = 1
 
 # Make sure the right definition follows each comment.
 sed -n '/^#.*VAR.*COND_TRUE/ {
-         n
-         p
-       }' Makefile.in |
+          n
+          p
+        }' Makefile.in |
   grep '@COND_TRUE@VAR = foo'
 sed -n '/^#.*VAR.*COND_FALSE/ {
-         n
-         p
-       }' Makefile.in |
+          n
+          p
+        }' Makefile.in |
   grep '@COND_FALSE@VAR = bar'
index 58ef56a..b2b12fe 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2011, 2012 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [true])
@@ -38,8 +36,9 @@ if COND2
   VAR += val2 # com2
 endif COND2
 
+.PHONY: test
 test:
-       test "`echo $(VAR)`" = 'valA valB val1 valC val2'
+       is $(VAR) == valA valB val1 valC val2
 EOF
 
 $ACLOCAL
index b106b3a..e20b59f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 TESTS = \
    1.test \
@@ -32,6 +30,8 @@ TESTS = \
    7.test
 EOF
 
+: > test-driver
+
 $ACLOCAL
 $AUTOMAKE
 
index b00ee6b..aaee1d3 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
@@ -48,7 +46,7 @@ mkdir tex
 $ACLOCAL
 $AUTOMAKE
 
-grep TEX Makefile.in # for debugging
+grep TEX Makefile.in # For debugging.
 grep '^TEXINFO_TEX *= *tex/texinfo\.tex  *# some comment w/ a slash *$' Makefile.in
 
 $AUTOCONF
index ef27afe..12fb2be 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2007, 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
 
 # Make sure `compile' preserves spaces in its arguments.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir/../lib/compile" .
+get_shell_script compile
 
 # -o 'a  c' should not be stripped because 'a  c' is not an object
 # (it does not matter whether touch creates ./-- or not)
@@ -42,3 +41,5 @@ test -f a.c
 ./compile touch a.obj -- -o ac.obj a.c
 test ! -f a.obj
 test ac.obj
+
+:
index 334f154..68ab44d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012 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
 # 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 `compile' deals correctly with w32 style paths.
+# Make sure `compile' deals correctly with Windows-style paths.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir/../lib/compile" .
+get_shell_script compile
 
 cat >mycc <<'END'
 source_seen=no
@@ -62,11 +61,15 @@ export amtest_source amtest_object amtest_obj amtest_lock
 ./compile ./mycc -c "$amtest_source" -o "$amtest_object"
 test -f "$amtest_object"
 
-
-# Absolute w32 paths should be accepted.
-# Do not actually run this test on anything that could be w32.
-test -d "C:\\" && Exit 77
-case $PATH_SEPARATOR in ';'|':');; *) Exit 77;; esac
+# Absolute Windows paths should be accepted.
+# Do not actually run this test on anything that could be Windows.
+if test -d 'C:\'; then
+  skip_ "this test shouldn't run on a Windows-like system"
+fi
+case $PATH_SEPARATOR in
+ ';'|':');;
+ *) skip_ "unrecognized PATH separator \`$PATH_SEPARATOR'"
+esac
 
 amtest_source='C:\libltdl\libltdl\slist.c'
 amtest_object='C:\libltdl\libltdl\libltdl_libltdl_la-slist.obj'
diff --git a/tests/compile3.test b/tests/compile3.test
new file mode 100755 (executable)
index 0000000..800db1d
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 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 `compile' wraps the Microsoft C/C++ compiler (cl) correctly
+
+am_create_testdir=empty
+required=xsi-lib-shell
+. ./defs || Exit 1
+
+get_shell_script compile
+
+# Use a dummy cl, since cl isn't readily available on all systems
+cat >cl <<'END'
+#! /bin/sh
+echo "$@"
+END
+
+chmod +x ./cl
+
+# Check if compile handles "-o foo", -I, -l, -L, -Xlinker -Wl,
+opts=`LIB= ./compile ./cl foo.c -o foo -lbar -Lgazonk -Ibaz -Xlinker foobar -Wl,-foo,bar`
+test x"$opts" = x"foo.c -Fefoo bar.lib -Ibaz -link -LIBPATH:gazonk foobar -foo bar"
+
+# Check if compile handles "-o foo.obj"
+opts=`./compile ./cl -c foo.c -o foo.obj -Ibaz`
+test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
+
+# Check if compile handles "-o foo.o"
+opts=`./compile ./cl -c foo.c -o foo.o -Ibaz`
+test x"$opts" = x"-c foo.c -Fofoo.o -Ibaz"
+
+# Check if compile handles "foo.cc" as C++.
+opts=`./compile ./cl -c foo.cc -o foo.o -Ibaz`
+test x"$opts" = x"-c -Tpfoo.cc -Fofoo.o -Ibaz"
+
+# Check if compile clears the "eat" variable properly.
+opts=`eat=1 ./compile ./cl -c foo.c -o foo.obj -Ibaz`
+test x"$opts" = x"-c foo.c -Fofoo.obj -Ibaz"
+
+:
diff --git a/tests/compile4.test b/tests/compile4.test
new file mode 100755 (executable)
index 0000000..4e07418
--- /dev/null
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 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 `compile' wraps the Microsoft C/C++ compiler (cl) correctly
+# with respect to absolute paths.
+
+required='cl'
+. ./defs || Exit 1
+
+get_shell_script compile
+
+mkdir sub
+
+cat >sub/foo.c <<'EOF'
+int
+foo ()
+{
+  return 0;
+}
+EOF
+
+cat >main.c <<'EOF'
+extern int foo ();
+int
+main ()
+{
+  return foo ();
+}
+EOF
+
+absfoodir=`pwd`/sub
+absmainc=`pwd`/main.c
+absmainobj=`pwd`/main.obj
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+END
+
+cat > sub/Makefile.am << 'END'
+lib_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+$MAKE
+
+./compile cl $CPPFLAGS $CFLAGS -c -o "$absmainobj" "$absmainc"
+
+# cl expects archives to be named foo.lib, not libfoo.a so
+# make a simple copy here if needed. This is a severe case
+# of badness, but ignore that since this is not what is
+# being tested here...
+if test -f sub/libfoo.a; then
+  cp sub/libfoo.a sub/foo.lib
+fi
+
+./compile cl $CFLAGS $LDFLAGS -L"$absfoodir" "$absmainobj" -o main -lfoo
+
+./main
+
+:
diff --git a/tests/compile5.test b/tests/compile5.test
new file mode 100755 (executable)
index 0000000..2b4eeb0
--- /dev/null
@@ -0,0 +1,80 @@
+#! /bin/sh
+# Copyright (C) 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 the file name translation in the `compile' script works
+# correctly
+
+. ./defs || Exit 1
+
+get_shell_script compile
+
+# Use a dummy cl, since cl isn't readily available on all systems
+cat >cl <<'END'
+#! /bin/sh
+echo "$@"
+END
+
+chmod +x ./cl
+
+cat >>configure.in << 'END'
+AC_CANONICAL_HOST
+AC_CONFIG_FILES([check_host], [chmod +x check_host])
+AC_OUTPUT
+END
+
+: >Makefile.am
+
+# This will be sourced, nor executed.
+cat >check_host.in << 'END'
+case '@host_os@' in
+  mingw*)
+    ;;
+  *)
+    skip_ "target OS is not MinGW"
+    ;;
+esac
+case @build_os@ in
+  mingw* | cygwin*)
+    ;;
+  *)
+    winepath -w / \
+      || skip_ "not on MinGW or Cygwin, and winepath not available"
+    ;;
+esac
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+. ./check_host
+
+pwd=`pwd`
+
+# Check if "compile cl" transforms absolute file names to
+# host format (e.g /somewhere -> c:/msys/1.0/somewhere).
+
+res=`./compile ./cl -L"$pwd" | sed -e 's/-link -LIBPATH://'`
+
+case $res in
+  ?:[\\/]*)
+    ;;
+  *)
+    Exit 1
+    ;;
+esac
+
+:
diff --git a/tests/compile6.test b/tests/compile6.test
new file mode 100755 (executable)
index 0000000..5a2ac91
--- /dev/null
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright (C) 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 `compile' searches libraries correctly
+
+am_create_testdir=empty
+required=xsi-lib-shell
+. ./defs || Exit 1
+
+get_shell_script compile
+
+# Use a dummy cl, since cl isn't readily available on all systems
+cat >cl <<'END'
+#! /bin/sh
+echo "$@"
+END
+
+chmod +x ./cl
+
+mkdir syslib
+:> syslib/foo.lib
+
+syslib=`pwd`/syslib
+LIB=$syslib
+export LIB
+
+mkdir lib
+:> lib/bar.lib
+:> lib/bar.dll.lib
+
+# Check if compile library search correctly
+opts=`./compile ./cl foo.c -o foo -Llib -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib"
+
+# Check if -static makes compile avoid bar.dll.lib
+opts=`./compile ./cl foo.c -o foo -Llib -static -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib/bar.lib $syslib/foo.lib -link -LIBPATH:lib"
+
+:> syslib/bar.lib
+:> syslib/bar.dll.lib
+
+# Check if compile finds bar.dll.lib in syslib
+opts=`./compile ./cl foo.c -o foo -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo $syslib/bar.dll.lib $syslib/foo.lib"
+
+# Check if compile prefers -L over $LIB
+opts=`./compile ./cl foo.c -o foo -Llib -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib"
+
+mkdir lib2
+:> lib2/bar.dll.lib
+
+# Check if compile avoids bar.dll.lib in lib2 when -static
+opts=`./compile ./cl foo.c -o foo -Llib2 -static -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo $syslib/bar.lib $syslib/foo.lib -link -LIBPATH:lib2"
+
+# Check if compile gets two different bar libraries when -static
+# is added in the middle
+opts=`./compile ./cl foo.c -o foo -Llib2 -Llib -lbar -static -lbar`
+test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib lib/bar.lib -link -LIBPATH:lib2 -LIBPATH:lib"
+
+# Check if compile gets the correct bar.dll.lib
+opts=`./compile ./cl foo.c -o foo -Llib -Llib2 -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib -LIBPATH:lib2"
+
+# Check if compile gets the correct bar.dll.lib
+opts=`./compile ./cl foo.c -o foo -Llib2 -Llib -lbar -lfoo`
+test x"$opts" = x"foo.c -Fefoo lib2/bar.dll.lib $syslib/foo.lib -link -LIBPATH:lib2 -LIBPATH:lib"
+
+mkdir "sys  lib2"
+:> "sys  lib2/foo.dll.lib"
+
+syslib2="`pwd`/sys  lib2"
+LIB="$syslib2;$LIB"
+
+# Check if compile handles spaces in $LIB and that it prefers the order
+# in a multi-component $LIB.
+opts=`./compile ./cl foo.c -o foo -lfoo`
+test x"$opts" = x"foo.c -Fefoo $syslib2/foo.dll.lib"
+
+# Check if compile handles the 2nd directory in a multi-component $LIB.
+opts=`./compile ./cl foo.c -o foo -static -lfoo`
+test x"$opts" = x"foo.c -Fefoo $syslib/foo.lib"
+
+:
index 21ed65d..b38f67d 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 2001, 2002, 2010, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_FC
-AC_FC_LIBRARY_LDFLAGS
 END
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
 foo_SOURCES  = foo.f90 bar.c baz.cc
-foo_LDADD    = @FLIBS@
 END
 
-: > foo.f90
-: > bar.c
-: > baz.cc
-
 $ACLOCAL
 $AUTOMAKE
 
-# Look for the macros at the beginning of rules.  Be careful, as there
-# are literal tabs at the beginning of the search strings.
-$FGREP '       $(COMPILE)'    Makefile.in
-$FGREP '       $(CXXCOMPILE)' Makefile.in
-$FGREP '       $(FCCOMPILE)'  Makefile.in
+# Look for the macros at the beginning of rules.
+tab=
+$FGREP "$tab\$(COMPILE)"    Makefile.in
+$FGREP "$tab\$(CXXCOMPILE)" Makefile.in
+$FGREP "$tab\$(FCCOMPILE)"  Makefile.in
 
-Exit 0
+:
index d1836fb..aaa5abd 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 2001, 2002, 2010, 2011, 2012 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
@@ -33,22 +31,17 @@ END
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
 foo_SOURCES  = foo.f bar.c baz.cc
-foo_LDADD    = @FLIBS@
 END
 
-: > foo.f
-: > bar.c
-: > baz.cc
 : > config.guess
 : > config.sub
 
 $ACLOCAL
 $AUTOMAKE
 
-# Look for the macros at the beginning of rules.  Be careful, as there
-# are literal tabs at the beginning of the search strings.
-$FGREP '       $(COMPILE)'    Makefile.in
-$FGREP '       $(CXXCOMPILE)' Makefile.in
-$FGREP '       $(F77COMPILE)' Makefile.in
+# Look for the macros at the beginning of rules.
+$FGREP "$tab\$(COMPILE)"    Makefile.in
+$FGREP "$tab\$(CXXCOMPILE)" Makefile.in
+$FGREP "$tab\$(F77COMPILE)" Makefile.in
 
-Exit 0
+:
similarity index 77%
rename from tests/ctarget1.test
rename to tests/cond-basic.test
index d2191f6..5a64000 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2010, 2011, 2012 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
 
 . ./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])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -34,11 +33,11 @@ target: false
 endif
 END
 
-set -e
-
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
 grep '^@TEST_TRUE@target: true' Makefile.in
-grep '^@TEST_TRUE@     action' Makefile.in
+grep "^@TEST_TRUE@${tab}action" Makefile.in
 grep '^@TEST_FALSE@target: false' Makefile.in
-Exit 0
+
+:
index 586d80a..6bc1e70 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1997, 2001, 2002, 2006, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AM_CONDITIONAL(TEST, true)
+AM_CONDITIONAL([TEST], [true])
 AC_OUTPUT
 END
 
@@ -40,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 974dfdc..ac2ffe3 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 . ./defs || Exit 1
 
-set -e
-
 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
 
@@ -45,3 +43,5 @@ END
 $ACLOCAL
 $AUTOMAKE -a
 grep 'USE_A_FALSE.*USE_B_FALSE.*output_c\...OBJEXT.' Makefile.in
+
+:
index 15c6c2a..90cbde3 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
 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
@@ -41,8 +39,11 @@ noinst_PROGRAMS = foo
 foo_SOURCES = foo.c
 LDADD = $(SUBSTVAR) $(foolibs)
 
-print:
-       @echo BEG: $(foo_DEPENDENCIES) :END
+.PHONY: test1 test2
+test1:
+       is faz.la == $(foo_DEPENDENCIES)
+test2:
+       is "" == $(foo_DEPENDENCIES)
 END
 
 : > config.guess
@@ -51,14 +52,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 e5f6be9..a63ee63 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
+AM_PROG_AR
 AC_PROG_RANLIB
-AM_CONDITIONAL(COND1, true)
-AM_CONDITIONAL(COND2, true)
+AM_CONDITIONAL([COND1], [true])
+AM_CONDITIONAL([COND2], [true])
 END
 
 cat > Makefile.am << 'END'
@@ -49,7 +48,11 @@ endif
 libtest_a_SOURCES = $(TESTSOURCES)
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
-grep 'am_libtest_a_OBJECTS = .*$' Makefile.in
+grep '^am_libtest_a_OBJECTS =' Makefile.in
+
+:
index 09701f7..c956200 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test for bug in conditionals.
-# Report from Robert Boehne
+# Report from Robert Boehne.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_CONDITIONAL([COND1], [true])
 END
 
 cat > Makefile.am << 'END'
-
 if COND1
 BUILD_helldl = helldl
 helldl_SOURCES = dlmain.c
@@ -48,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 0789074..d5fb0a0 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_CONDITIONAL([COND1], [true])
@@ -27,7 +25,6 @@ AM_CONDITIONAL([COND2], [true])
 END
 
 cat > Makefile.am << 'END'
-
 if COND1
 if COND2
 bin_SCRIPTS = helldl
@@ -55,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 467b718..7c4a264 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2011, 2012 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test for bug in conditionals in SOURCES with variable substitution references.
-# Report from Richard Boulton
+# Test for bug in conditionals in SOURCES with variable substitution
+# references.
+# Report from Richard Boulton.
 
-required=gcc
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT(hello.c)
-AM_INIT_AUTOMAKE(hello,0.23)
-AC_PROG_CC
-AM_CONDITIONAL(COND1, true)
-AC_OUTPUT(Makefile)
+cat >> configure.in << 'END'
+AM_CONDITIONAL([COND1], [true])
+AC_OUTPUT
 END
 
-cat > hello.c << 'END'
-END
+: > hello.c
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+OBJEXT = o
 
 if COND1
 var = foo.c
@@ -42,23 +41,15 @@ endif
 bin_PROGRAMS = hell
 hell_SOURCES = $(var:=)
 
-echorule:
-       @echo $(hell_SOURCES) $(hell_OBJECTS)
-
+.PHONY: test
+test:
+       is $(hell_SOURCES) $(hell_OBJECTS) == foo.c foo.o
 END
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-
 ./configure
+$MAKE test
 
-val=`$MAKE -s echorule`;
-echo $val
-test "x$val" = "xfoo.c foo.o"
+:
index 7368d9a..26a8ebb 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 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
 
 # Test for being able to define an object to be generated in different ways
 # according to a conditional.
-# Report from Richard Boulton
+# Report from Richard Boulton.
 
 . ./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'
@@ -38,7 +36,7 @@ helldl_SOURCES = foo.c
 endif
 END
 
-set -e
-
 $ACLOCAL
 $AUTOMAKE -a
+
+:
index 3119658..fa04d56 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2011, 2012 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Regression test for substitution references to conditional variables.
-# Report from Richard Boulton
+# Report from Richard Boulton.
 
-required='GNUmake gcc'
 . ./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)
+cat >> configure.in << 'END'
+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
 
@@ -47,24 +46,18 @@ endif
 
 helldl_SOURCES = $(var3)
 
-echorule:
-       @echo $(helldl_SOURCES) $(helldl_OBJECTS)
+.PHONY: test
+test:
+       is $(helldl_SOURCES) $(helldl_OBJECTS) == \
+           dlmain.c foo.c dlmain.obj foo.obj
 
 bin_PROGRAMS = helldl
 END
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-
 ./configure
+$MAKE test
 
-val=`$MAKE --no-print-directory echorule`;
-echo $val
-test "x$val" = "xdlmain.c foo.c dlmain.o foo.o"
+:
index 14dfb51..17ead91 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2011, 2012 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Regression test for substitution references to conditional variables.
-# Report from Richard Boulton
+# Report from Richard Boulton.
 
-required='GNUmake gcc'
 . ./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)
+cat >> configure.in << 'END'
+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
 
@@ -49,36 +48,22 @@ endif
 
 helldl_SOURCES = $(var3:.c=1.c) $(var4:.c=2.c)
 
-echorule:
-       @echo $(helldl_SOURCES) $(helldl_OBJECTS)
-
-bin_PROGRAMS = helldl
+.PHONY: test
+test:
+       is $(exp) == $(helldl_SOURCES) $(helldl_OBJECTS)
 END
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-set -e
-
 $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`;
+$MAKE test exp='dlmainb1.c dlmaina2.c dlmainb1.o dlmaina2.o'
 
-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
+:
index a548ef6..0f0235b 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 1997, 2001, 2002, 2003, 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
-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'
@@ -40,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 d0557e5..cd2ec0b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
 
 . ./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
@@ -42,9 +38,9 @@ helldl_SOURCES = $(var2)
 bin_PROGRAMS = helldl
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 AUTOMAKE_fails -a
-grep "recursively defined" stderr
+grep "variable.*var2.*recursively defined" stderr
+
+:
index 160c76f..cf20452 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2005, 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
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
-AM_CONDITIONAL(COND1, true)
-AM_CONDITIONAL(COND2, true)
-AM_CONDITIONAL(COND3, true)
+AM_CONDITIONAL([COND1], [true])
+AM_CONDITIONAL([COND2], [true])
+AM_CONDITIONAL([COND3], [true])
 AC_OUTPUT
 END
 
@@ -61,16 +60,17 @@ if COND3
   BAR += bar3
 endif
 
+.PHONY: test
 test:
        @echo BAR: $(BAR) :BAR
        @echo FOO: $(FOO) :FOO
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 ./configure
 $MAKE test | $FGREP 'BAR: bar12 bar bar3 :BAR'
 $MAKE test | $FGREP 'FOO: foo foo1 foo2 foo1b :FOO'
+
+:
index 4ef1967..cc46745 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
 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
 
@@ -56,14 +55,15 @@ endif
 
 targ_SOURCES = $(SONE) $(STWO) $(STHREE) $(STHREE2)
 
-echo:
-       echo BEG: $(targ_OBJECTS) :END;
+.PHONY: test
+test:
+       is $(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 e2b133c..2e43f89 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check that conditional redefinitions of AC_SUBST'ed variables are detected.
-# Report from Patrik Weiskircher
+# Report from Patrik Weiskircher.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AM_CONDITIONAL([COND], [true])
 AC_OUTPUT
@@ -34,4 +32,6 @@ EOF
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'libdir was already defined' stderr
+grep '^Makefile\.am:2:.* libdir was already defined' stderr
+
+:
index e548211..89424be 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check that conditional redefinitions of AC_SUBST'ed variables are detected.
-# Report from Patrik Weiskircher
+# Report from Patrik Weiskircher.
 
 . ./defs || Exit 1
 
-set -e
-
 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 02614f9..fe03745 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << 'EOF'
 AM_CONDITIONAL([USE_FOO], [true])
 AC_PROG_CC
@@ -37,3 +35,5 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+
+:
index 1d93cc0..3c29b59 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << 'EOF'
 AM_CONDITIONAL([USE_FOO], [true])
 EOF
@@ -36,3 +34,5 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+
+:
index 250b1ef..74f2e48 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << 'EOF'
 AM_CONDITIONAL([USE_FOO], [true])
 EOF
@@ -36,3 +34,5 @@ $ACLOCAL
 AUTOMAKE_fails
 grep ' USE_FOO' stderr && Exit 1
 grep '!USE_FOO' stderr
+
+:
index 006ef57..0c6cd29 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << 'EOF'
 AM_CONDITIONAL([USE_FOO], [true])
 EOF
@@ -36,3 +34,5 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+
+:
index 8310eab..98cbe87 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 
 # Check that many conditions do not lead to combinatorial explosion.
 # (This is related to PR/352.)
-#
-# On this test, Automake 1.7.x would compute all 2**22 = 4194304
-# 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.
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >>configure.in
 
 cat >Makefile.am <<EOF
@@ -36,18 +27,37 @@ a02_LDADD =
 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
+# On this test, Automake 1.7.x would compute all 2**24 = 16777216
+# 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.
+# Limit memory available to spawned processes to ~ 150 MB.  Considering
+# that 70 MB is enough for x86_64 Fedora 16, that gives tools and
+# libraries plenty of room to grow.  Suggested by Jim Meyering in
+# automake bug#10374.
+(ulimit -v 1; sh -c ":") && skip_ "no adequate 'ulimit' builtin found"
+(ulimit -v 150000; sh -c ":") || skip_ "no adequate 'ulimit' builtin found"
+ulimit -v 150000
+
+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 23 24
+do
+  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
+
+:
index e2dbdaf..7e9b3ae 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
-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'
@@ -80,3 +76,5 @@ targ_OBJECTS = $(am_targ_OBJECTS)
 EOF
 
 diff expected produced
+
+:
index d1935f7..fb44bf6 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
 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
@@ -35,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 224d32c..69b8fc1 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
 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
@@ -36,20 +35,22 @@ endif
 if C2
 a_LDADD += c2.o -dlopen c3.la
 endif
-print:
-       @echo BEG: $(a_DEPENDENCIES) :END
+
+.PHONY: test1 test2
+test1:
+       is $(a_DEPENDENCIES) == c0.o c1.o
+test2:
+       is $(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 6ec5a20..738903a 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
 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
@@ -45,8 +49,10 @@ BAR = baz.o
 endif
 a_LDADD = $(BAR)
 endif
-print:
-       @echo BEG: $(a_DEPENDENCIES) :END
+
+test:
+       is $(exp) == $(a_DEPENDENCIES)
+.PHONY: test
 EOF
 
 $ACLOCAL
@@ -54,16 +60,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 f327cb7..2b5f62e 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2007, 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
 # 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.
-# Report from Ralf Corsepius
+# Check that conditionally-defined install directories are handled
+# correctly.
+# Report from Ralf Corsepius.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 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
@@ -37,6 +36,8 @@ endif
 
 foo.h x.sh:
        :>$@
+
+.PHONY: distdircheck
 distdircheck: distdir
        test -f $(distdir)/foo.h
        test -f $(distdir)/x.sh
@@ -46,9 +47,12 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
+cwd=`pwd` || fatal_ "cannot get current directory"
 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
@@ -57,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 ecb1616..2443798 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
 # 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.
-# Report from Elena A. Vengerova
+# Check for _DEPENDENCIES definition with conditional _LDADD.
+# Report from Elena A. Vengerova.
 
 . ./defs || Exit 1
 
-set -e
-
 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
 
@@ -43,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 0e75c79..074d110 100755 (executable)
 # Check rules output for parser defined conditionally.
 # Report from Roman Fietze.
 
-required='flex bison gcc'
+required='cc lex yacc'
 . ./defs || Exit 1
 
-set -e
-
 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
@@ -56,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'
 %%
@@ -78,8 +77,8 @@ void yyerror (char *s) {}
 foobar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
 END
 
-cat >ta.c <<'END'
-int main()
+cat > ta.c << 'END'
+int main (void)
 {
   return 0;
 }
@@ -94,3 +93,5 @@ $MAKE test-ta
 ./configure case_B=yes
 $MAKE
 $MAKE test-tb
+
+:
index 6826cd5..b4a9a31 100755 (executable)
 
 . ./defs || Exit 1
 
-set -e
-
 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
@@ -51,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 a4ae078..e639231 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
 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
@@ -41,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 b1c3036..bc313b8 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2005  Free Software Foundation, Inc.
+# Copyright (C) 2005, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AM_CONDITIONAL([CASE_A], :)
 AM_CONDITIONAL([CASE_B], :)
 AC_OUTPUT
 EOF
 
-cat >>Makefile.am <<'EOF'
+cat > Makefile.am <<'EOF'
 SUBDIRS = a
 if CASE_A
 SUBDIRS += b
@@ -48,8 +46,10 @@ if CASE_B
 SUBDIRS += iXYZ
 SUBDIRS += jZYX
 endif
-print:
-       @echo BEG: $(SUBDIRS) :END
+
+.PHONY: test
+test:
+       is $(SUBDIRS) == a b c d e f g h iXYZ jZYX
 EOF
 
 mkdir a b c d e f g h iXYZ jZYX
@@ -59,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 c75c7b5..ac64be3 100755 (executable)
@@ -1,27 +1,23 @@
 #!/bin/sh
-# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2010, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Build either as CONFIG_FILE or as PROGRAM.
 
+required=cc
 . ./defs || Exit 1
-set -e
 
 mkdir sub
 
index 6efc9ce..40dfa2f 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2010, 2011, 2012 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
 
 # Another sources-in-conditional test.  Report from Tim Goodwin.
 
-required='GNUmake gcc'
 . ./defs || Exit 1
 
-set -e
-
 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
@@ -41,39 +40,27 @@ endif
 
 targ_SOURCES = main.c $(OPT1) $(OPT2)
 
-echo-objects:
-       @echo $(targ_OBJECTS)
+.PHONY: test
+test:
+       is $(exp) == $(targ_OBJECTS)
 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
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
 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 8552cef..1b62bfc 100755 (executable)
@@ -1,27 +1,22 @@
 #! /bin/sh
-# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2010, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test AM_COND_IF.
 
 . ./defs || Exit 1
-set -e
 
 cat >>configure.in <<'END'
 AC_DEFUN([FOO],
@@ -84,4 +79,5 @@ $MAKE file3 && Exit 1
 test ! -f file1
 test -f file2
 test ! -f file3
+
 :
index dd9ffda..b91500f 100755 (executable)
@@ -1,33 +1,31 @@
 #!/bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # AM_COND_IF with an undefined condition should fail.
 
 . ./defs || Exit 1
-set -e
 
 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 428c02b..2f603e8 100755 (executable)
@@ -1,59 +1,59 @@
 #!/bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Ensure an error with inconsistent state of conditionals in configure.ac.
 # This shouldn't happen with user input, as _AM_COND_* are not documented,
 # but better to be safe.
 
 . ./defs || Exit 1
-set -e
 
 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 1fa413d..6a30511 100755 (executable)
@@ -1,45 +1,44 @@
 #!/bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2011, 2012 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Ensure an error with underquoted usage of AM_COND_IF in configure.ac.
 
 . ./defs || Exit 1
-set -e
 
 cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [:])
 AM_CONDITIONAL([COND2], [:])
 AM_COND_IF([COND1],
-          AM_COND_IF([COND2], [:])
+           AM_COND_IF([COND2], [:])
 )
 AC_OUTPUT
 END
+
 : >Makefile.am
 
 $ACLOCAL
 AUTOMAKE_fails
+$EGREP '^configure\.in:7:.* missing m4 quoting.*macro depth 2( |$)' stderr
 
 sed '/.AM_COND_IF/{
-       s/^/[/
-       s/$/]/
+        s/^/[/
+        s/$/]/
      }' < configure.in > configure.int
 mv -f configure.int configure.in
 rm -rf autom4te*.cache
 $AUTOMAKE
+
+:
index 4b5adc2..ea5e87d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2009, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AM_CONDITIONAL([COND], [true])
 AM_SUBST_NOTMAKE([libdir])
@@ -34,7 +32,7 @@ endif
 EOF
 
 $ACLOCAL
-AUTOMAKE_run 0
+AUTOMAKE_run
 grep 'libdir was already defined' stderr && Exit 1
 grep '^libdir = ' Makefile.in && Exit 1
 Exit 0
index c70fecb..05d68dc 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003, 2009 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2009, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_SUBST([foo], [bar])
 AM_SUBST_NOTMAKE([foo])
@@ -35,7 +33,7 @@ endif
 EOF
 
 $ACLOCAL
-AUTOMAKE_run 0
+AUTOMAKE_run
 grep 'foo was already defined' stderr && Exit 1
 grep '^foo =' Makefile.in && Exit 1
 Exit 0
diff --git a/tests/cond46.test b/tests/cond46.test
new file mode 100755 (executable)
index 0000000..5b15979
--- /dev/null
@@ -0,0 +1,112 @@
+#! /bin/sh
+# Copyright (C) 2009, 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 3 of the License, 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/>.
+
+# Ensure the right condition is listed after `else' and `endif'.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+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'
+if USE_A
+endif !USE_A
+END
+
+AUTOMAKE_fails
+grep "^Makefile\\.am:2:.*endif.*!USE_A.*$notcompat.*[^!]USE_A" stderr
+
+cat > Makefile.am << 'END'
+if USE_A
+endif USE_B
+END
+
+AUTOMAKE_fails
+grep "^Makefile\\.am:2:.*endif.*[^!]USE_B.*$notcompat.*[^!]USE_A" stderr
+
+cat > Makefile.am << 'END'
+if USE_A
+else
+endif USE_A
+END
+
+AUTOMAKE_fails
+grep "^Makefile\\.am:3:.*endif.*[^!]USE_A.*$notcompat.*USE_A" stderr
+
+cat > Makefile.am << 'END'
+if USE_A
+else
+endif !USE_A
+END
+
+$AUTOMAKE
+
+cat > Makefile.am << 'END'
+if USE_A
+if USE_B
+else
+endif !USE_A
+endif
+END
+
+AUTOMAKE_fails
+grep "^Makefile\\.am:4:.*endif.*!USE_A.*$notcompat.*USE_B" stderr
+
+cat > Makefile.am << 'END'
+if USE_A
+else USE_A
+endif
+END
+
+AUTOMAKE_fails
+grep "^Makefile\\.am:2:.*else.*[^!]USE_A.*$notcompat.*[^!]USE_A" stderr
+
+cat > Makefile.am << 'END'
+if USE_A
+else !USE_A
+endif
+END
+
+$AUTOMAKE
+
+cat > Makefile.am << 'END'
+if USE_A
+else USE_B
+endif
+END
+
+AUTOMAKE_fails
+grep "^Makefile\\.am:2:.*else.*[^!]USE_B.*$notcompat.*[^!]USE_A" stderr
+
+cat > Makefile.am << 'END'
+if USE_A
+if USE_B
+else USE_A
+endif
+endif
+END
+
+AUTOMAKE_fails
+grep "^Makefile\\.am:3:.*else.*[^!]USE_A.*$notcompat.*[^!]USE_B" stderr
+
+:
index 50101a6..0af13f3 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_CONDITIONAL([ONE], [true])
index ec40032..3080320 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2010, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
-echo 'AM_CONDITIONAL(FOO, true)' >> configure.in
+echo 'AM_CONDITIONAL([FOO], [true])' >> configure.in
 
 cat > Makefile.am << 'END'
-
 if FOO
 
 helpdir = $(prefix)/Help
@@ -37,7 +35,36 @@ helpdir = $(prefix)/help
 help_DATA = foo
 
 endif
+
+a b c d e f g h:
+       touch $@
+
+.PHONY: test
+test:
+       is $(help_DATA) == a b c d e f g h
 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
+touch aclocal.m4 # Avoid unnecessary firing the remake rules.
+$AUTOCONF
+$AUTOMAKE Makefile
+
+./configure --prefix="`pwd`/_inst"
+
+$MAKE test
+
+$MAKE install
+for x in a b c d e f g h; do
+  test -f _inst/Help/$x
+done
+
+:
index b11dddf..d680577 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 compat=yes
 AM_CONDITIONAL([Compatible], [test x$compat = xyes])
index 0a45ad3..07bf2d0 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
-AM_CONDITIONAL(X, false)
+AM_CONDITIONAL([X], [test "$x" = yes])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -32,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 || fatal_ "cannot get current directory"
+
+# 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 e798099..c039871 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AM_CONDITIONAL(WRONG, [test x = y])
+AM_CONDITIONAL([WRONG], [test x = y])
 AC_OUTPUT
 END
 
@@ -32,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 b70d691..4c31f30 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
 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
 endif
 
-# Small example from the manual
+# Small example from the manual.
 bin_PROGRAMS = hello
 hello_SOURCES = hello-common.c
 if COND1
@@ -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
index bf9225b..8763ee6 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2004, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2007, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([TEST], [false])
 AC_OUTPUT
index 45e2d43..109dbb0 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([TEST], [true])
 AC_OUTPUT
index cf9e35f..09315cd 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([TOBE], [false])
 END
index 9001028..a27fe83 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2009, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([TOBE], [false])
 END
@@ -38,6 +37,24 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'adjunct:3: too many conditionals closed' stderr
+grep 'adjunct:3: error: too many conditionals closed' stderr
+
+cat > adjunct << 'END'
+if TOBE
+target: dependency
+       rule
+END
+
+AUTOMAKE_fails
+grep 'unterminated conditionals' stderr
+
+cat > adjunct << 'END'
+if TOBE
+target: dependency
+       rule
+endif
+END
+
+$AUTOMAKE
 
 :
index b6c998d..c46c91f 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2008, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test for bug with conditional library.
-# From Harlan Stenn
+# From Harlan Stenn.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AM_MAINTAINER_MODE
+AM_PROG_AR
 AC_PROG_CC
 END
 
@@ -36,6 +36,8 @@ nodist_librsaref_a_SOURCES = desc.c digit.c
 BUILT_SOURCES = $(nodist_librsaref_a_SOURCES)
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
index c0e7216..ad86370 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 man_MANS = foo.1 foo.2
 man5_MANS = foo.5
index ff93daf..cfba3f8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([COND], [test x"$FOO" = x"true"])
 AC_OUTPUT
@@ -28,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
 
index b09f816..606027d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 . ./defs || Exit 1
 
-set -e
-
 echo "FOO = foo" > Makefile.am
 
 $ACLOCAL
 
-echo "$me: Generated by aclocal..."
+echo "$me: Generated by aclocal ..."
 $AUTOMAKE
 grep '^\$(ACLOCAL_M4):' Makefile.in
 
-echo "$me: Not generated by aclocal..."
+echo "$me: Not generated by aclocal ..."
 # Pretend it is not from aclocal (remove the signature),
 # but keep it correct, i.e., with AM_INIT_AUTOMAKE etc.
 sed -n '3,$p' aclocal.m4 >aclocal.m4t
index dc6677c..2f0214a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # Make sure rebuild rules work even when AC_CONFIG_FILES uses colons.
 # Report from Alexander Turbov.
 
-required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([bar/Makefile:bar/Makefile.in:Makefile.bot])
 AC_OUTPUT
@@ -50,10 +47,10 @@ $AUTOMAKE
 $MAKE
 
 cd bar
-$MAKE top-rule >stdout
+$MAKE top-rule >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'top rule' stdout
-$MAKE bot-rule >stdout
+$MAKE bot-rule >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'bot rule' stdout
 cd ..
@@ -67,10 +64,10 @@ END
 $MAKE
 
 cd bar
-$MAKE top-rule >stdout
+$MAKE top-rule >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'top2 rule' stdout
-$MAKE bot-rule >stdout
+$MAKE bot-rule >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'bot rule' stdout
 cd ..
@@ -84,10 +81,10 @@ END
 $MAKE
 
 cd bar
-$MAKE top-rule >stdout
+$MAKE top-rule >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'top2 rule' stdout
-$MAKE bot-rule >stdout
+$MAKE bot-rule >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'bot2 rule' stdout
 cd ..
index a0101e1..590169d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # We avoid using configure.in stub initialized by ./defs, since we need
 # to keep track of line numbers (to grep for error messages).
 cat > configure.in << END
index 1d3d12f..382124e 100755 (executable)
@@ -21,8 +21,6 @@
 required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
index 93badef..5b1c5a5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2010 Free Software
+# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONFIG_HEADER([include/config.h])
 AC_OUTPUT
@@ -47,6 +45,7 @@ mkdir include
 
 $ACLOCAL
 $AUTOCONF
+$AUTOHEADER
 $AUTOMAKE
 
 ./configure
index 8e36cfa..20b2a99 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2000, 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
@@ -25,8 +25,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([include/Makefile])
 AM_CONFIG_HEADER([include/config.h])
index 9af83dc..d13ff15 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_SUBST([FOO], [NameToBeGrepped])
 AC_CONFIG_FILES([include/config.h.in])
@@ -33,7 +31,7 @@ cat > Makefile.am << 'END'
 test: distdir
        test -f $(distdir)/config.h.in
        test -f $(distdir)/include/config.h.in.in
-       : # Solaris Sh does not support 'test -e'
+       : # Solaris Sh does not support 'test -e'.
        test ! -f $(distdir)/include/config.h.in
        test ! -r $(distdir)/include/config.h.in
 END
@@ -52,7 +50,7 @@ $MAKE
 $sleep
 echo '#undef @FOO@' > include/config.h.in.in
 $MAKE include/config.h
-# Don't try to be too strict in this grepping, since the substutition
+# Don't try to be too strict in this grepping, since the substitution
 # is done by config.status, and we don't have too much control on it.
 grep '/\*.*#undef.*NameToBeGrepped' include/config.h
 $MAKE test
index 532a2fd..c03880b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002, 2003, 2010 Free Software
+# Copyright (C) 1998, 2000, 2001, 2002, 2003, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # idea is that if config.h is in a subdir, and there is no Makefile in
 # that subdir, then we want to build config.h as the top level.
 
-required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONFIG_HEADER([subdir/config.h])
 AC_OUTPUT
index 4e4f7da..2ccb10c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1997, 1998, 2000, 2001, 2002, 2010 Free Software
+# Copyright (C) 1997, 1998, 2000, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONFIG_HEADER([config.h two.h])
 END
index 146d2f0..66b8a54 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONFIG_HEADER([one.h two.h])
 AC_OUTPUT
index 0773a00..f9954af 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >configure.ac <<EOF
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -49,7 +47,7 @@ AUTOMAKE_fails -Werror
 grep 'configure\.ac.*configure\.in.*both present' stderr
 grep 'proceeding.*configure\.ac' stderr
 
-AUTOMAKE_run -Wno-error
+AUTOMAKE_run -Wno-error
 grep 'configure\.ac.*configure\.in.*both present' stderr
 grep 'proceeding.*configure\.ac' stderr
 
index c4f0cde..235d7d6 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -20,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 8dfafbc..4052e24 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo 'SUBDIRS = sdir' > Makefile.am
 : > src
 mkdir sdir
index 8c68c38..1a3aa32 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 SUBDIRS = sdir
 .PHONY: test
index 20f4786..1755170 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 SUBDIRS = sdir
 .PHONY: test
@@ -30,7 +28,7 @@ test: distdir
        test ! -r $(distdir)/dest3
        test ! -r $(distdir)/dest2
        test -f $(distdir)/src2
-## src3 cannot be distributed, Automake knows nothing about it
+## src3 cannot be distributed, Automake knows nothing about it.
        test ! -r $(distdir)/sdir/src3
        test ! -r $(distdir)/src3
 END
@@ -47,7 +45,7 @@ my_src_dir=sdir
 my_dest=dest
 AC_CONFIG_LINKS([sdir/dest2:src2 sdir/dest3:$my_src_dir/src3])
 AC_CONFIG_LINKS([$my_dest:src])
-# the following is a link whose source is itself a link
+# The following is a link whose source is itself a link.
 AC_CONFIG_LINKS([dest4:sdir/dest2])
 # Some package prefer to compute links.
 cmplink='dest5:src';
@@ -76,7 +74,7 @@ $MAKE distclean
 test ! -r sdir/dest2
 test ! -r sdir/dest3
 test -r dest  # Should still exist, Automake knows nothing about it.
-test -r dest5 # ditto
+test -r dest5 # Ditto.
 rm -f dest dest5
 test ! -r dest4
 
index fd96054..eb226ad 100755 (executable)
@@ -1,30 +1,24 @@
 #! /bin/sh
-# Copyright (C) 2003, 2008 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2008, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure links to _identical files_ created by AC_CONFIG_LINKS get
 # removed with `make distclean' only if doing a VPATH build.
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir nonmk-subdir sdir sdir/mk-subdir
 : > src
 : > sdir/Makefile.am
index a0d4fe3..43f0819 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2010 Free
-# Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
index 13cc7dd..cc0bd7e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_SUBST([QBERT])
 END
index 1cfd2d3..ca11568 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_SUBST([OTHER_SCRIPTS])
 END
index 770ae51..d8aa090 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2010, 2011, 2012 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure `-c' works.  Report from Andris Pavenis.
+# See also the much more in-depth test `add-missing'.
 
 . ./defs || Exit 1
 
+# We'll have to cater to systems like MSYS/MinGW where there are no
+# true symlinks ('ln -s' behaves like 'cp -p'); see automake bug#10441.
+
+echo dummy > foo
+if ln -s foo bar && test -h bar; then
+  is_symlink () { test -h "$1"; }
+  is_not_symlink () { test ! -h "$1"; }
+else
+  is_symlink () { return 0; } # Avoid spurious failures.
+  is_not_symlink () { return 0; }
+fi
+rm -f foo bar
+
+# First a simple test, where the auxdir is automatically determined
+# by automake.
+
 : > Makefile.am
 rm -f install-sh
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE -c -a
+ls -l # For debugging.
+
+test -f install-sh
+is_not_symlink install-sh
+
+# Let's do a couple of more elaborated tests, this time with the auxdir
+# explicitly defined in configure.in.
+
+mkdir sub
+cd sub
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<END
+bin_PROGRAMS = foo
+END
+
+$ACLOCAL
+
+# `automake -a' called without `-c' should create symlinks by default,
+# even when there is already a non-symlinked required auxiliary file.
+
+mkdir auxdir
+echo FAKE-DEPCOMP > auxdir/depcomp
+$AUTOMAKE -a
+ls -l auxdir # For debugging.
+test -f auxdir/install-sh
+is_symlink auxdir/install-sh
+test -f auxdir/depcomp
+is_not_symlink auxdir/depcomp
+test FAKE-DEPCOMP = `cat auxdir/depcomp`
+
+# `automake -a -c' should not create symlinks, even when there are
+# already symlinked required auxiliary files.
+
+rm -rf auxdir
+mkdir auxdir
+cd auxdir
+ln -s "$am_scriptdir/missing" "$am_scriptdir/install-sh" .
+cd ..
+
+$AUTOMAKE -a -c
+ls -l auxdir # For debugging.
+test -f auxdir/install-sh
+is_symlink auxdir/install-sh
+test -f auxdir/missing
+is_symlink auxdir/missing
+test -f auxdir/depcomp
+is_not_symlink auxdir/depcomp
+diff "$am_scriptdir"/depcomp auxdir/depcomp
+
+:
diff --git a/tests/cscope.tap b/tests/cscope.tap
new file mode 100755 (executable)
index 0000000..0269dff
--- /dev/null
@@ -0,0 +1,168 @@
+#! /bin/sh
+# Copyright (C) 2009, 2010, 2011, 2012 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/>.
+
+# Test cscope functionality.
+
+. ./defs || Exit 1
+
+plan_ 18
+
+ocwd=`pwd` || fatal_ "getting top-level directory"
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_SUBST([CC],  [who-cares])
+AC_SUBST([CXX], [who-cares])
+AC_SUBST([FC],  [who-cares])
+AC_SUBST([GCJ], [who-cares])
+AM_PATH_LISPDIR
+AC_OUTPUT
+END
+
+mkdir sub sub/subsub
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c bar.cpp baz.f90
+lisp_LISP = foo.el
+EXTRA_DIST = foo.el
+END
+
+cat > sub/Makefile.am <<'END'
+bin_PROGRAMS = bar
+bar_SOURCES = subsub/dist.c
+nodist_bar_SOURCES = subsub/gen.c
+subsub/gen.c:
+       $(MKDIR_P) subsub
+       echo 'int generated_subsub () { return 0; }' > $@
+CLEANFILES = subsub/gen.c
+END
+
+echo 'int foo_func () { return 0; }' > foo.c
+echo 'int main () { return 0; }' > bar.cpp
+cat > baz.f90 <<'END'
+      subroutine baz
+      end
+END
+: > foo.el
+echo 'int main () { return 0; }' > sub/subsub/dist.c
+
+$ACLOCAL || fatal_ "aclocal failed"
+$AUTOCONF || fatal_ "autoconf failed"
+$AUTOMAKE -i -a || fatal_ "automake -i -a failed"
+
+# Sun cscope is interactive without redirection.
+if cscope --version </dev/null; then
+  have_cscope=yes
+else
+  have_cscope=no
+fi
+
+test_cleanup ()
+{
+  r=ok
+  if test -f configure; then
+    # In-tree build.
+    $MAKE distclean
+  else
+    # VPATH build.
+    $MAKE distcleancheck
+  fi \
+    && test ! -f cscope.files \
+    && test ! -f cscope.out \
+    && test ! -f cscope.in.out \
+    && test ! -f cscope.po.out \
+    || r='not ok'
+  result_ "$r" "[$pfx] make distcheck"
+}
+
+test_cscope ()
+{
+  r=ok
+  $MAKE -n cscope || r='not ok'
+  result_ "$r" "[$pfx] make -n cscope"
+
+  if test $have_cscope = no; then
+    # For later tests.
+    touch cscope.files cscope.out cscope.in.out cscope.po.out
+    skip_row_ 3 -r "no cscope program avaiable"
+    return 0
+  fi
+
+  r=ok
+  $MAKE cscope 2>stderr || r='not ok'
+  cat stderr >&2
+  grep 'cannot find file' stderr && r='not ok'
+  rm -f stderr
+  result_ "$r" "[$pfx] make cscope"
+
+  r=ok
+  test -f cscope.files \
+    && $FGREP foo.c cscope.files \
+    && $FGREP bar.cpp cscope.files \
+    && $FGREP sub/subsub/dist.c cscope.files \
+    && $FGREP sub/subsub/gen.c cscope.files \
+    || r='not ok'
+  result_ "$r" "[$pfx] cscope.files looks correct"
+
+  r=ok
+  # cscope.files might not exist of the earlier "make cscope" failed.
+  cp cscope.files cscope.files1 \
+    && $MAKE cscope \
+    && diff cscope.files cscope.files1 \
+    || r='not ok'
+  rm -f cscope.files1
+  result_ "$r" "[$pfx] second \"make cscope\" is consistent"
+}
+
+my_configure ()
+{
+  command_ok_ "[$pfx] configure" \
+              "$1"/configure EMACS=no --with-lispdir=/who/cares
+}
+
+if using_gmake; then
+
+  cd "$ocwd"
+  pfx="relative VPATH"
+  mkdir build
+  cd build
+  my_configure ..
+  test_cscope
+  test_cleanup
+
+  cd "$ocwd"
+  pfx="absolute VPATH"
+  mkdir build2
+  cd build2
+  my_configure "$ocwd"
+  test_cscope
+  test_cleanup
+
+else
+
+  skip_row_ 12 -r "cscope in VPATH required GNU make"
+
+fi
+
+cd "$ocwd"
+pfx="in-tree build"
+my_configure .
+test_cscope
+test_cleanup
+
+:
similarity index 79%
rename from tests/regex.test
rename to tests/cscope2.test
index babd92a..a7fa993 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 200 Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # 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 AM_WITH_REGEX compiles and runs.
+# The `cscope' target should not fail if there are no sources.
 
+required=
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AM_WITH_REGEX
+AC_OUTPUT
 END
+: >Makefile.am
 
 $ACLOCAL
 $AUTOCONF
+$AUTOMAKE
+
 ./configure
-./configure --without-regex
+$MAKE cscope
+
+:
similarity index 65%
rename from tests/nogzip.test
rename to tests/cscope3.test
index 77adcdc..e40c061 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 200 Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # 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 support for no-dist-gzip
+# The `cscope' target should not fail if there are no sources in a subdir.
+# In practice this means `cscope' should not be invoked if cscope.files
+# is empty.
 
-required=bzip2
+required=cscope
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << 'END'
-AC_INIT([nogzip], [1.0])
-AM_INIT_AUTOMAKE([no-dist-gzip dist-bzip2])
-AC_CONFIG_FILES([Makefile])
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 END
-
-cat > Makefile.am << 'END'
-test: distcheck
-       test $(DIST_ARCHIVES) = nogzip-1.0.tar.bz2
-       test -f $(DIST_ARCHIVES)
-END
+mkdir sub
+echo 'SUBDIRS = sub' >Makefile.am
+: >sub/Makefile.am
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
+
 ./configure
-$MAKE test
+$MAKE cscope
+
+:
index aa2f225..5edad16 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXX
 END
index 0b9e880..7606356 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >>configure.in
 
 cat >Makefile.am <<'END'
index 09bb4eb..b5e2bc3 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXXCPP
 END
index 5f5ee30..30e7501 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1997, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXX
 AC_PROG_CC
index 66b3d29..617234a 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
index 9d5fa7b..04a34a1 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2005  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2005, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXX
 END
index a69fb2a..2867218 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -17,8 +18,6 @@
 # Make sure C++ files are rewritten to ".o" and not just "o".
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXX
 END
diff --git a/tests/cygnus-check-without-all.test b/tests/cygnus-check-without-all.test
new file mode 100755 (executable)
index 0000000..9cf7ae7
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that, in cygnus mode, target "check" does not depend target
+# "all".
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AM_MAINTAINER_MODE
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+all-local:
+       : > all-target-has-failed
+       exit 1
+check-local:
+       touch check-target-has-run
+END
+
+$ACLOCAL
+$AUTOMAKE --cygnus
+
+$EGREP '(^| )all.*(:|:.* )check' Makefile.in && Exit 1
+
+$AUTOCONF
+./configure
+
+$MAKE check
+test -f check-target-has-run
+test ! -r all-target-has-failed
+# Sanity checks.
+$MAKE && Exit 1
+test -f all-target-has-failed
+
+:
diff --git a/tests/cygnus-dependency-tracking.test b/tests/cygnus-dependency-tracking.test
new file mode 100755 (executable)
index 0000000..e5df33c
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that cygnus mode disables automatic dependency tracking.
+# And check that this *cannot* be overridden.
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AM_MAINTAINER_MODE
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c
+.PHONY: test-nodeps
+test-nodeps:
+       test ! -d .deps
+       test ! -d _deps
+       test ! -d '$(DEPDIR)'
+END
+
+cat > foo.c <<'END'
+#include "bar.h"
+int main ()
+{
+  GIVE_BACK 0;
+}
+END
+
+cat > bar.sav <<'END'
+#define GIVE_BACK return
+END
+
+cp bar.sav bar.h
+
+$ACLOCAL
+$AUTOMAKE --include-deps --cygnus --include-deps
+$AUTOCONF
+
+# Unknown options should cause just warnings from configure.
+./configure --enable-dependency-tracking
+$MAKE
+$MAKE test-nodeps
+
+: > bar.h
+$MAKE
+$MAKE test-nodeps
+
+# Sanity check.
+$MAKE clean
+$MAKE >out 2>&1 && { cat out; Exit 1; }
+cat out
+# Not all compilers mention the undefined symbol in the error message.
+grep GIVE_BACK out || grep main out
+
+:
diff --git a/tests/cygnus-imply-foreign.test b/tests/cygnus-imply-foreign.test
new file mode 100755 (executable)
index 0000000..51a11f9
--- /dev/null
@@ -0,0 +1,60 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that 'cygnus' mode imply 'foreign' mode.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+# This is *required* in cygnus mode
+AM_MAINTAINER_MODE
+END
+
+$ACLOCAL
+
+: > Makefile.am
+
+# We want complete control automake flags, while honouring the
+# user overrides for $AUTOMAKE.
+AUTOMAKE=$am_original_AUTOMAKE
+
+# Sanity check: gnu mode must complain about missing files and
+# portability problems.
+AUTOMAKE_fails
+grep 'required file.*README' stderr
+
+# But cygnus mode should imply foreign mode, so no complaints.
+# And cygnus mode should by able to override gnu and gnits modes.
+$AUTOMAKE --cygnus -Werror
+$AUTOMAKE --gnu --cygnus -Werror
+$AUTOMAKE --gnits --cygnus -Werror
+
+# Try again, this time enabling cygnus mode from Makefile.am.
+cp Makefile.am Makefile.sav
+echo 'AUTOMAKE_OPTIONS = gnu cygnus' >> Makefile.am
+$AUTOMAKE -Werror
+mv -f Makefile.sav Makefile.am
+
+# Try again, this time enabling cygnus mode from configure.in.
+cp configure.in configure.sav
+sed 's/^AM_INIT_AUTOMAKE$/&([gnits cygnus])/' configure.sav >configure.in
+cmp configure.in configure.sav && fatal_ 'failed to edit configure.in'
+
+$ACLOCAL --force
+$AUTOMAKE -Werror
+mv -f configure.sav configure.in
+
+:
diff --git a/tests/cygnus-no-dist.test b/tests/cygnus-no-dist.test
new file mode 100755 (executable)
index 0000000..47beef6
--- /dev/null
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Copyright (C) 2010, 2011, 2012 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/>.
+
+# Check that cygnus mode forbids creation of distribution tarball.
+
+. ./defs || Exit 1
+
+echo AM_MAINTAINER_MODE >> configure.in
+mv -f configure.in configure.stub
+
+cat configure.stub - > configure.in <<'END'
+AC_OUTPUT
+END
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --cygnus
+
+./configure
+$MAKE
+
+for target in dist distdir distcheck dist-all dist-gzip; do
+  $MAKE -n $target >out 2>&1 && { cat out; Exit 1; }
+  cat out
+  grep $target out
+done
+
+# Now check that cygnus mode in a subdirectory disables
+# distribution-building in that subdirectory.
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub1 sub2
+END
+
+mkdir sub1 sub2
+: > sub1/Makefile.am
+cat > sub2/Makefile.am <<'END'
+# The `-Wall' after `cygnus' should ensure no warning gets
+# unintentionally disabled.  We are particularly interested
+# in override warnings, for when (below) we add the `distdir'
+# target.
+AUTOMAKE_OPTIONS = cygnus -Wall
+END
+
+cat configure.stub - > configure.in <<'END'
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+cd sub2
+$MAKE -n distdir >out 2>&1 && { cat out; Exit 1; }
+grep distdir out
+cd ..
+
+cat >> sub2/Makefile.am <<'END'
+distdir:
+END
+$AUTOMAKE sub2/Makefile
+./config.status sub2/Makefile
+
+$MAKE distdir
+$MAKE dist
+
+:
diff --git a/tests/cygnus-no-installinfo.test b/tests/cygnus-no-installinfo.test
new file mode 100755 (executable)
index 0000000..25a8e7c
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that cygnus mode enables the 'no-installinfo' option.
+
+required=makeinfo
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AM_MAINTAINER_MODE
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+info_TEXINFOS = foo.texi
+END
+
+cat > foo.texi <<'END'
+@setfilename foo.info
+END
+
+$ACLOCAL
+# FIXME: -Wno-override works around a buglet in definition of $(MAKEINFO)
+# in cygnus mode; see also xfailing test `txinfo5.test'.
+$AUTOMAKE --cygnus -Wno-override
+$AUTOCONF
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd"/_inst
+$MAKE
+$MAKE install
+test ! -d _inst
+test ! -r foo.info
+test ! -d _inst/share/info
+$MAKE install-info
+ls -l _inst
+test -f foo.info
+test -f _inst/share/info/foo.info
+
+:
diff --git a/tests/cygnus-requires-maintainer-mode.test b/tests/cygnus-requires-maintainer-mode.test
new file mode 100755 (executable)
index 0000000..86e33a1
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that, in cygnus mode, maintainer mode is required.
+
+. ./defs || Exit 1
+
+: > Makefile.am
+
+$ACLOCAL
+AUTOMAKE_fails --cygnus
+grep '^configure\.in:.*AM_MAINTAINER_MODE.*required.*cygnus' stderr
+
+cat >> configure.in <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+END
+
+mkdir sub
+cat > sub/Makefile.am <<'END'
+AUTOMAKE_OPTIONS = cygnus
+END
+
+rm -rf autom4te.cache
+$ACLOCAL
+AUTOMAKE_fails
+grep '^configure\.in:.*AM_MAINTAINER_MODE.*required.*cygnus' stderr
+
+cat >> configure.in <<'END'
+AM_MAINTAINER_MODE
+END
+
+rm -rf autom4te.cache
+$ACLOCAL
+$AUTOMAKE --cygnus
+
+:
index ec3f43d..ed9fcd1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1997, 1999, 2001, 2002, 2008, 2010 Free Software
+# Copyright (C) 1997, 1999, 2001, 2002, 2008, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 335b891..ef8a176 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 include Make-lang
 END
diff --git a/tests/defs b/tests/defs
new file mode 100644 (file)
index 0000000..819a96a
--- /dev/null
@@ -0,0 +1,1155 @@
+# -*- shell-script -*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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/>.
+
+########################################################
+###  IMPORTANT NOTE: keep this file 'set -e' clean.  ###
+########################################################
+
+# NOTE: This file should execute correctly with any system's /bin/sh
+# shell, and not only with configure-time detected $CONFIG_SHELL,
+# *until differently and explicitly specified*.
+
+## -------------------------------------------------------- ##
+##  Source static setup and definitions for the testsuite.  ##
+## -------------------------------------------------------- ##
+
+# Ensure we are running from the right directory.
+test -f ./defs-static || {
+   echo "$0: ./defs-static: not found in current directory" >&2
+   exit 99
+}
+
+# Source the shell sanitization and variables' definitions.
+. ./defs-static || exit 99
+
+# Enable the errexit shell flag early.
+set -e
+
+# The name of the current test (without the `.test' suffix).
+# Test scripts can override it if they need to (but this should
+# be done carefully, and *before* including ./defs).
+if test -z "$me"; then
+  # Guard against failure to spawn sed (seen on MSYS), or empty $argv0.
+  me=`echo "$argv0" | sed -e 's,.*[\\/],,;s/\.test$//;s/\.tap$//;'` \
+    && test -n "$me" \
+    || { echo "$argv0: failed to define \$me" >&2; exit 99; }
+fi
+
+## ---------------------- ##
+##  Early sanity checks.  ##
+## ---------------------- ##
+
+# A single whitespace character.
+sp=' '
+# A tabulation character.
+tab='  '
+# A newline character.
+nl='
+'
+
+# As autoconf-generated configure scripts do, ensure that IFS
+# is defined initially, so that saving and restoring $IFS works.
+IFS=$sp$tab$nl
+
+# Ensure $testsrcdir is set correctly.
+test -f "$testsrcdir/defs-static.in" || {
+   echo "$me: $testsrcdir/defs-static.in not found, check \$testsrcdir" >&2
+   exit 99
+}
+
+# Ensure $testbuilddir is set correctly.
+test -f "$testbuilddir/defs-static" || {
+   echo "$me: $testbuilddir/defs-static not found, check \$testbuilddir" >&2
+   exit 99
+}
+
+
+## ------------------------------------ ##
+##  Ensure we run with a proper shell.  ##
+## ------------------------------------ ##
+
+# Make sure we run with the shell detected at configure time (unless
+# the user forbids it).
+case ${AM_TESTS_REEXEC-yes} in
+  n|no|false|0)
+    ;;
+  *)
+    # Ensure we can find ourselves.
+    if test ! -f "$0"; then
+      echo "$me: unable to find myself: $0" >&2
+      exit 99
+    fi
+    AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+    # Cannot simply do `opts=$-', since the content of $- is not
+    # portable among different shells.  So try to propagate only
+    # the portable and interesting options.
+    case $- in
+      *x*v*|*v*x) opts=-vx;;
+      *v*) opts=-v;;
+      *x*) opts=-x;;
+      *) opts=;;
+    esac
+    echo $me: exec $SHELL $opts "$0" "$*"
+    exec $SHELL $opts "$0" ${1+"$@"} || {
+      echo "$me: failed to re-execute with $SHELL" >&2
+      exit 99
+    }
+    ;;
+esac
+
+# NOTE: From this point on, we can assume this file is being executed
+# by the configure-time detected $CONFIG_SHELL.
+
+
+## ----------------------- ##
+##  Early debugging info.  ##
+## ----------------------- ##
+
+echo "Running from installcheck: $am_running_installcheck"
+echo "Using TAP: $am_using_tap"
+echo "PATH = $PATH"
+
+
+## ---------------------- ##
+##  Environment cleanup.  ##
+## ---------------------- ##
+
+# Temporarily disable this, since some shells (e.g., older version
+# of Bash) can return a non-zero exit status upon the when a non-set
+# variable is unset.
+set +e
+
+# Unset some make-related variables that may cause $MAKE to act like
+# a recursively invoked sub-make.  Any $MAKE invocation in a test is
+# conceptually an independent invocation, not part of the main
+# 'automake' build.
+unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL
+unset __MKLVL__ MAKE_JOBS_FIFO                     # For BSD make.
+unset DMAKE_CHILD DMAKE_DEF_PRINTED DMAKE_MAX_JOBS # For Solaris dmake.
+# Unset verbosity flag.
+unset V
+# Also unset variables that will let `make -e install' divert
+# files into unwanted directories.
+unset DESTDIR
+unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
+unset htmldir includedir infodir libdir libexecdir localedir mandir
+unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
+# Unset variables that might change the "make distcheck" behaviour.
+unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
+# The tests call `make -e' but we do not want $srcdir from the environment
+# to override the definition from the Makefile.
+unset srcdir
+# Also unset variables that control our test driver.  While not
+# conceptually independent, they cause some changed semantics we
+# need to control (and test for) in some of the tests to ensure
+# backward-compatible behavior.
+unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
+unset DISABLE_HARD_ERRORS
+unset AM_COLOR_TESTS
+unset TESTS
+unset XFAIL_TESTS
+unset TEST_LOGS
+unset TEST_SUITE_LOG
+unset RECHECK_LOGS
+unset VERBOSE
+for pfx in TEST_ TAP_ ''; do
+  unset ${pfx}LOG_COMPILER
+  unset ${pfx}LOG_COMPILE # Not a typo!
+  unset ${pfx}LOG_FLAGS
+  unset AM_${pfx}LOG_FLAGS
+  unset ${pfx}LOG_DRIVER
+  unset ${pfx}LOG_DRIVER_FLAGS
+  unset AM_${pfx}LOG_DRIVER_FLAGS
+done
+unset pfx
+
+# Re-enable, it had been temporarily disabled above.
+set -e
+
+## ---------------------------- ##
+##  Auxiliary shell functions.  ##
+## ---------------------------- ##
+
+# Tell whether we should keep the test directories around, even in
+# case of success.  By default, we don't.
+am_keeping_testdirs ()
+{
+  case $keep_testdirs in
+     ""|n|no|NO) return 1;;
+              *) return 0;;
+  esac
+}
+
+# This is used in `Exit' and in the exit trap.  See comments in the latter
+# for more information,
+am__test_skipped=no
+
+# We use a trap below for cleanup.  This requires us to go through
+# hoops to get the right exit status transported through the signal.
+# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
+# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
+# sh inside this function.
+Exit ()
+{
+  set +e
+  # See comments in the exit trap for the reason we do this.
+  test 77 = $1 && am__test_skipped=yes
+  (exit $1); exit $1
+}
+
+if test $am_using_tap = yes; then
+  am_funcs_file=tap-functions.sh
+else
+  am_funcs_file=plain-functions.sh
+fi
+
+if test -f "$testsrcdir/$am_funcs_file"; then
+  . "$testsrcdir/$am_funcs_file" || {
+    echo "$me: error sourcing $testsrcdir/$am_funcs_file" >&2
+    Exit 99
+  }
+else
+  echo "$me: $testsrcdir/$am_funcs_file not found, check \$testsrcdir" >&2
+  Exit 99
+fi
+unset am_funcs_file
+
+# cross_compiling
+# ---------------
+# Tell whether we are cross-compiling.  This is especially useful to skip
+# tests (or portions of them) that requires a native compiler.
+cross_compiling ()
+{
+  # Quoting from the autoconf manual:
+  #   ... [$host_alias and $build both] default to the result of running
+  #   config.guess, unless you specify either --build or --host.  In
+  #   this case, the default becomes the system type you specified.
+  #   If you specify both, *and they're different*, configure enters
+  #   cross compilation mode (so it doesn't run any tests that require
+  #   execution).
+  test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
+}
+
+# is_newest FILE FILES
+# --------------------
+# Return false if any file in FILES is newer than FILE.
+# Resolve ties in favor of FILE.
+is_newest ()
+{
+  is_newest_files=`find "$@" -prune -newer "$1"`
+  test -z "$is_newest_files"
+}
+
+# is_blocked_signal SIGNAL-NUMBER
+# --------------------------------
+# Return success if the given signal number is blocked in the shell,
+# return a non-zero exit status and print a proper diagnostic otherwise.
+is_blocked_signal ()
+{
+  # Use perl, since trying to do this portably in the shell can be
+  # very tricky, if not downright impossible.  For reference, see:
+  # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
+  if $PERL -w -e '
+    use strict;
+    use warnings FATAL => "all";
+    use POSIX;
+    my %oldsigaction = ();
+    sigaction('"$1"', 0, \%oldsigaction);
+    exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77);
+  '; then
+    return 0
+  elif test $? -eq 77; then
+    return 1
+  else
+    fatal_ "couldn't determine whether signal $1 is blocked"
+  fi
+}
+
+# AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...]
+# -----------------------------------------------------------------
+# Run automake with AUTOMAKE-ARGS, and fail if it doesn't exit with
+# STATUS.  Should be polymorphic for TAP and "plain" tests.  The
+# DESCRIPTION, when provided, is used for console reporting, only if
+# the TAP protocol is in use in the current test script.
+AUTOMAKE_run ()
+{
+  am__desc=
+  am__exp_rc=0
+  while test $# -gt 0; do
+    case $1 in
+      -d) am__desc=$2; shift;;
+      -e) am__exp_rc=$2; shift;;
+      --) shift; break;;
+       # Don't fail on unknown option: assume they (and the rest of the
+       # command line) are to be passed verbatim to automake (so stop our
+       # own option parsing).
+       *) break;;
+    esac
+    shift
+  done
+  am__got_rc=0
+  $AUTOMAKE ${1+"$@"} >stdout 2>stderr || am__got_rc=$?
+  cat stderr >&2
+  cat stdout
+  if test $am_using_tap != yes; then
+    test $am__got_rc -eq $am__exp_rc || Exit 1
+    return
+  fi
+  if test -z "$am__desc"; then
+    if test $am__got_rc -eq $am__exp_rc; then
+      am__desc="automake exited $am__got_rc"
+    else
+      am__desc="automake exited $am__got_rc, expecting $am__exp_rc"
+    fi
+  fi
+  command_ok_ "$am__desc" test $am__got_rc -eq $am__exp_rc
+}
+
+# AUTOMAKE_fails [-d DESCRIPTION] [OPTIONS...]
+# --------------------------------------------
+# Run automake with OPTIONS, and fail if doesn't exit with status `1'.
+# Should be polymorphic for TAP and "plain" tests.  The DESCRIPTION,
+# when provided, is used for console reporting, only if the TAP
+# protocol is in use in the current test script.
+AUTOMAKE_fails ()
+{
+  AUTOMAKE_run -e 1 ${1+"$@"}
+}
+
+# extract_configure_help { --OPTION | VARIABLE-NAME } [FILES]
+# -----------------------------------------------------------
+# Use this to extract from the output of `./configure --help' (or similar)
+# the description or help message associated to the given --OPTION or
+# VARIABLE-NAME.
+extract_configure_help ()
+{
+  am__opt_re='' am__var_re=''
+  case $1 in
+    --*'=')   am__opt_re="^  $1";;
+    --*'[=]') am__opt_re='^  '`printf '%s\n' "$1" | sed 's/...$//'`'\[=';;
+    --*)      am__opt_re="^  $1( .*|$)";;
+      *)      am__var_re="^  $1( .*|$)";;
+  esac
+  shift
+  if test x"$am__opt_re" != x; then
+    LC_ALL=C awk '
+      /'"$am__opt_re"'/        { print; do_print = 1; next; }
+      /^$/                     { do_print = 0; next }
+      /^  --/                  { do_print = 0; next }
+      (do_print == 1)          { print }
+    ' ${1+"$@"}
+  else
+    LC_ALL=C awk '
+      /'"$am__var_re"'/        { print; do_print = 1; next; }
+      /^$/                     { do_print = 0; next }
+      /^  [A-Z][A-Z0-9_]* /    { do_print = 0; next }
+      /^  [A-Z][A-Z0-9_]*$/    { do_print = 0; next }
+      (do_print == 1)          { print }
+    ' ${1+"$@"}
+  fi
+}
+
+# grep_configure_help { --OPTION | VARIABLE-NAME } REGEXP
+# -------------------------------------------------------
+# Grep the section of `./configure --help' output associated with either
+# --OPTION or VARIABLE-NAME for the given *extended* regular expression.
+grep_configure_help ()
+{
+  ./configure --help > am--all-help \
+    || { cat am--all-help; Exit 1; }
+  cat am--all-help
+  extract_configure_help "$1" am--all-help > am--our-help \
+    || { cat am--our-help; Exit 1; }
+  cat am--our-help
+  $EGREP "$2" am--our-help || Exit 1
+}
+
+# using_gmake
+# -----------
+# Return success if $MAKE is GNU make, return failure otherwise.
+# Caches the result for speed reasons.
+using_gmake ()
+{
+  case $am__using_gmake in
+    yes)
+      return 0;;
+    no)
+      return 1;;
+    '')
+      # Use --version AND -v, because SGI Make doesn't fail on --version.
+      # Also grep for GNU because newer versions of FreeBSD make do
+      # not complain about `--version' (they seem to silently ignore it).
+      if $MAKE --version -v | grep GNU; then
+        am__using_gmake=yes
+        return 0
+      else
+        am__using_gmake=no
+        return 1
+      fi;;
+    *)
+      fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
+  esac
+}
+am__using_gmake="" # Avoid interferences from the environment.
+
+# make_can_chain_suffix_rules
+# ---------------------------
+# Return 0 if $MAKE is a make implementation that can chain suffix rules
+# automatically, return 1 otherwise.  Caches the result for speed reasons.
+make_can_chain_suffix_rules ()
+{
+  if test -z "$am__can_chain_suffix_rules"; then
+    if using_gmake; then
+      am__can_chain_suffix_rules=yes
+      return 0
+    else
+      mkdir am__chain.dir$$
+      cd am__chain.dir$$
+      unindent > Makefile << 'END'
+        .SUFFIXES: .u .v .w
+        .u.v: ; cp $< $@
+        .v.w: ; cp $< $@
+END
+      echo make can chain suffix rules > foo.u
+      if $MAKE foo.w && diff foo.u foo.w; then
+        am__can_chain_suffix_rules=yes
+      else
+        am__can_chain_suffix_rules=no
+      fi
+      cd ..
+      rm -rf am__chain.dir$$
+    fi
+  fi
+  case $am__can_chain_suffix_rules in
+    yes) return 0;;
+     no) return 1;;
+      *) fatal_ "make_can_chain_suffix_rules: internal error";;
+  esac
+}
+am__can_chain_suffix_rules="" # Avoid interferences from the environment.
+
+# useless_vpath_rebuild
+# ---------------------
+# Tell whether $MAKE suffers of the bug triggering automake bug#7884.
+# For example, this happens with FreeBSD make, since in a VPATH build
+# it tends to rebuilt files for which there is an explicit or even just
+# a suffix rule, even if said files are already available in the VPATH
+# directory.
+useless_vpath_rebuild ()
+{
+  if test -z "$am__useless_vpath_rebuild"; then
+    if using_gmake; then
+      am__useless_vpath_rebuild=no
+      return 1
+    fi
+    mkdir am__vpath.dir$$
+    cd am__vpath.dir$$
+    touch foo.a foo.b bar baz
+    mkdir build
+    cd build
+    unindent > Makefile << 'END'
+        .SUFFIXES: .a .b
+        VPATH = ..
+        all: foo.b baz
+        .PHONY: all
+        .a.b: ; cp $< $@
+        baz: bar ; cp ../baz bar
+END
+    if $MAKE all && test ! -f foo.b && test ! -f bar; then
+      am__useless_vpath_rebuild=no
+    else
+      am__useless_vpath_rebuild=yes
+    fi
+    cd ../..
+    rm -rf am__vpath.dir$$
+  fi
+  case $am__useless_vpath_rebuild in
+    yes) return 0;;
+     no) return 1;;
+     "") ;;
+      *) fatal_ "no_useless_builddir_remake: internal error";;
+  esac
+}
+am__useless_vpath_rebuild=""
+
+yl_distcheck () { useless_vpath_rebuild || $MAKE distcheck ${1+"$@"}; }
+
+# seq_ - print a sequence of numbers
+# ----------------------------------
+# This function simulates GNU seq(1) portably.  Valid usages:
+#  - seq LAST
+#  - seq FIRST LAST
+#  - seq FIRST INCREMENT LAST
+seq_ ()
+{
+  case $# in
+    0) fatal_ "seq_: missing argument";;
+    1) seq_first=1  seq_incr=1  seq_last=$1;;
+    2) seq_first=$1 seq_incr=1  seq_last=$2;;
+    3) seq_first=$1 seq_incr=$2 seq_last=$3;;
+    *) fatal_ "seq_: too many arguments";;
+  esac
+  # Try to avoid forks if possible.
+  case "$BASH_VERSION" in
+    ""|[12].*)
+      : Not bash, or a too old bash version. ;;
+    *)
+      # Use eval to protect dumber shells from parsing errors.
+      eval 'for ((i = seq_first; i <= seq_last; i += seq_incr)); do
+              echo $i
+            done'
+      return 0;;
+  esac
+  # Else, use GNU seq if available.
+  seq "$@" && return 0
+  # Otherwise revert to a slower loop using expr(1).
+  i=$seq_first
+  while test $i -le $seq_last; do
+    echo $i
+    i=`expr $i + $seq_incr`
+  done
+}
+
+# rm_rf_ [FILES OR DIRECTORIES ...]
+# ---------------------------------
+# Recursively remove the given files or directory, also handling the case
+# of non-writable subdirectories.
+rm_rf_ ()
+{
+  test $# -gt 0 || return 0
+  # Ignore failures in find, we are only interested in failures of the
+  # final rm.
+  find "$@" -type d ! -perm -700 -exec chmod u+rwx {} \; || :
+  rm -rf "$@"
+}
+
+# count_test_results total=N pass=N fail=N xpass=N xfail=N skip=N error=N
+# -----------------------------------------------------------------------
+# Check that a testsuite run driven by the parallel-tests harness has
+# had the specified numbers of test results (specified by kind).
+# This function assumes that the output of "make check" or "make recheck"
+# has been saved in the `stdout' file in the current directory, and its
+# log in the `test-suite.log' file.
+count_test_results ()
+{
+  # Use a subshell so that we won't pollute the script namespace.
+  (
+    # TODO: Do proper checks on the arguments?
+    total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
+    eval "$@"
+    # For debugging.
+    $EGREP -i '(total|x?pass|x?fail|skip|error)' stdout || :
+    rc=0
+    # Avoid spurious failures with shells with "overly sensible"
+    # `errexit' shell flag, such as e.g., Solaris /bin/sh.
+    set +e
+    test `grep -c '^PASS:'  stdout` -eq $pass  || rc=1
+    test `grep -c '^XFAIL:' stdout` -eq $xfail || rc=1
+    test `grep -c '^SKIP:'  stdout` -eq $skip  || rc=1
+    test `grep -c '^FAIL:'  stdout` -eq $fail  || rc=1
+    test `grep -c '^XPASS:' stdout` -eq $xpass || rc=1
+    test `grep -c '^ERROR:' stdout` -eq $error || rc=1
+    grep "^# TOTAL:  *$total$" stdout || rc=1
+    grep "^# PASS:  *$pass$"   stdout || rc=1
+    grep "^# XFAIL:  *$xfail$" stdout || rc=1
+    grep "^# SKIP:  *$skip$"   stdout || rc=1
+    grep "^# FAIL:  *$fail$"   stdout || rc=1
+    grep "^# XPASS:  *$xpass$" stdout || rc=1
+    grep "^# ERROR:  *$error$" stdout || rc=1
+    test $rc -eq 0
+  )
+}
+
+commented_sed_unindent_prog='
+  /^$/b                    # Nothing to do for empty lines.
+  x                        # Get x<indent> into pattern space.
+  /^$/{                    # No prior x<indent>, go prepare it.
+    g                      # Copy this 1st non-blank line into pattern space.
+    s/^\(['"$tab"' ]*\).*/x\1/   # Prepare x<indent> in pattern space.
+  }                        # Now: x<indent> in pattern and <line> in hold.
+  G                        # Build x<indent>\n<line> in pattern space, and
+  h                        # duplicate it into hold space.
+  s/\n.*$//                # Restore x<indent> in pattern space, and
+  x                        # exchange with the above duplicate in hold space.
+  s/^x\(.*\)\n\1//         # Remove leading <indent> from <line>.
+  s/^x.*\n//               # Restore <line> when there is no leading <indent>.
+'
+
+# unindent [input files...]
+# -------------------------
+# Remove the "proper" amount of leading whitespace from the given files,
+# and output the result on stdout.  That amount is determined by looking
+# at the leading whitespace of the first non-blank line in the input
+# files.  If no input file is specified, standard input is implied.
+unindent ()
+{
+  if test x"$sed_unindent_prog" = x; then
+    sed_unindent_prog=`printf '%s\n' "$commented_sed_unindent_prog" | sed -e "s/  *# .*//"`
+  fi
+  sed "$sed_unindent_prog" ${1+"$@"}
+}
+sed_unindent_prog="" # Avoid interferences from the environment.
+
+# get_shell_script SCRIPT-NAME
+# -----------------------------
+# Fetch an Automake-provided shell script from the `lib/' directory into
+# the current directory, and, if the `$am_test_prefer_config_shell'
+# variable is set to "yes", modify its shebang line to use $SHELL instead
+# of /bin/sh.
+get_shell_script ()
+{
+  if test x"$am_test_prefer_config_shell" = x"yes"; then
+    sed "1s|#!.*|#! $SHELL|" "$am_scriptdir/$1" > "$1"
+    chmod a+x "$1"
+  else
+    cp "$am_scriptdir/$1" .
+  fi
+  sed 10q "$1" # For debugging.
+}
+
+# require_xsi SHELL
+# -----------------
+# Skip the test if the given shell fails to support common XSI constructs.
+require_xsi ()
+{
+  test $# -eq 1 || fatal_ "require_xsi needs exactly one argument"
+  echo "$me: trying some XSI constructs with $1"
+  $1 -c "$xsi_shell_code" || skip_all_ "$1 lacks XSI features"
+}
+# Shell code supposed to work only with XSI shells.  Keep this in sync
+# with libtool.m4:_LT_CHECK_SHELL_FEATURES.
+xsi_shell_code='
+  _lt_dummy="a/b/c"
+  test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
+      = c,a/b,b/c, \
+    && eval '\''test $(( 1 + 1 )) -eq 2 \
+    && test "${#_lt_dummy}" -eq 5'\'
+
+# fetch_tap_driver
+# ----------------
+# Fetch the Automake-provided TAP driver from the `lib/' directory into
+# the current directory, and edit its shebang line so that it will be
+# run with the perl interpreter determined at configure time.
+fetch_tap_driver ()
+{
+  # TODO: we should devise a way to make the shell TAP driver tested also
+  # TODO: with /bin/sh, for better coverage.
+  case $am_tap_implementation in
+    perl)
+      $PERL -MTAP::Parser -e 1 \
+        || skip_all_ "cannot import TAP::Parser perl module"
+      sed "1s|#!.*|#! $PERL -w|" "$am_scriptdir"/tap-driver.pl >tap-driver
+      ;;
+    shell)
+      sed "1s|#!.*|#! $SHELL|" "$am_scriptdir"/tap-driver.sh >tap-driver
+      ;;
+    *)
+      fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'" ;;
+  esac \
+    && chmod a+x tap-driver \
+    || framework_failure_ "couldn't fetch $am_tap_implementation TAP driver"
+  sed 10q tap-driver # For debugging.
+}
+# The shell/awk implementation of the TAP driver is still mostly dummy, so
+# use the perl implementation by default for the moment.
+am_tap_implementation=${am_tap_implementation-shell}
+
+# Usage: require_compiler_ {cc|c++|fortran|fortran77}
+require_compiler_ ()
+{
+  case $# in
+    0) fatal_ "require_compiler_: missing argument";;
+    1) ;;
+    *) fatal_ "require_compiler_: too many arguments";;
+  esac
+  case $1 in
+    cc)
+      am__comp_lang="C"
+      am__comp_var=CC
+      am__comp_flag_vars='CFLAGS CPPFLAGS'
+      ;;
+    c++)
+      am__comp_lang="C++"
+      am__comp_var=CXX
+      am__comp_flag_vars='CXXFLAGS CPPFLAGS'
+      ;;
+    fortran)
+      am__comp_lang="Fortran"
+      am__comp_var=FC
+      am__comp_flag_vars='FCFLAGS'
+      ;;
+    fortran77)
+      am__comp_lang="Fortran 77"
+      am__comp_var=F77
+      am__comp_flag_vars='FFLAGS'
+      ;;
+  esac
+  shift
+  eval "am__comp_prog=\${$am__comp_var}" \
+    || fatal_ "expanding \${$am__comp_var} in require_compiler_"
+  case $am__comp_prog in
+    "")
+      fatal_ "botched configuration: \$$am__comp_var is empty";;
+    false)
+      skip_all_ "no $am__comp_lang compiler available";;
+    autodetect|autodetected)
+      # Let the ./configure commands in the test script try to determine
+      # these automatically.
+      unset $am__comp_var $am__comp_flag_vars;;
+    *)
+      # Pre-set these for the ./configure commands in the test script.
+      export $am__comp_var $am__comp_flag_vars;;
+  esac
+  # Delete private variables.
+  unset am__comp_lang am__comp_prog am__comp_var am__comp_flag_vars
+}
+
+## ----------------------------------------------------------- ##
+##  Checks for required tools, and additional setups (if any)  ##
+##  required by them.                                          ##
+## ----------------------------------------------------------- ##
+
+# So that we can force the use of correct gcc, g++ etc., consistently
+# with cross-compilation settings.
+if cross_compiling; then
+  am__tool_prefix="$host_alias-"
+else
+  am__tool_prefix=
+fi
+
+# Look for (and maybe set up) required tools and/or system features; skip
+# the current test if they are not found.
+for tool in : $required
+do
+  # Check that each required tool is present.
+  case $tool in
+    :) ;;
+    cc|c++|fortran|fortran77)
+      require_compiler_ $tool;;
+    xsi-shell)
+      require_xsi "$SHELL";;
+    xsi-bin-sh)
+      require_xsi "/bin/sh";;
+    xsi-lib-shell)
+      if test x"$am_test_prefer_config_shell" = x"yes"; then
+        require_xsi "$SHELL"
+      else
+        require_xsi "/bin/sh"
+      fi
+      ;;
+    bzip2)
+      # Do not use --version, bzip2 still tries to compress stdin.
+      echo "$me: running bzip2 --help"
+      bzip2 --help \
+        || skip_all_ "required program \`bzip2' not available"
+      ;;
+    cl)
+      CC=cl
+      # Don't export CFLAGS, as that could have been initialized to only
+      # work with the C compiler detected at configure time.  If the user
+      # wants CFLAGS to also influence `cl', he can still export CFLAGS
+      # in the environment "by hand" before calling the testsuite.
+      export CC CPPFLAGS
+      echo "$me: running $CC -?"
+      $CC -? || skip_all_ "Microsoft C compiler \`$CC' not available"
+      ;;
+    cscope)
+      # Sun cscope is interactive without redirection.
+      echo "$me: running cscope --version </dev/null"
+      cscope --version </dev/null \
+        || skip_all_ "required program \`cscope' not available"
+      ;;
+    cygpath)
+      echo "$me: running cygpath --version"
+      cygpath --version || skip_all_ "cygpath not available"
+      ;;
+    etags)
+      # Exuberant Ctags will create a TAGS file even
+      # when asked for --help or --version.  (Emacs's etags
+      # does not have such problem.)  Use -o /dev/null
+      # to make sure we do not pollute the tests/ directory.
+      echo "$me: running etags --version -o /dev/null"
+      etags --version -o /dev/null \
+        || skip_all_ "required program \`etags' not available"
+      ;;
+    GNUmake)
+      for make_ in "$MAKE" gmake gnumake :; do
+        MAKE=$make_ am__using_gmake=''
+        test "$MAKE" =  : && break
+        echo "$me: determine whether $MAKE is GNU make"
+        # Don't use "&&" here, or a bug of 'set -e' present in some
+        # versions of the BSD shell will be triggered.  We add the
+        # dummy "else" branch for extra safety.
+        if using_gmake; then break; else :; fi
+      done
+      test "$MAKE" = : && skip_all_ "this test requires GNU make"
+      export MAKE
+      unset make_
+      ;;
+    gcc)
+      # When gcc is required, export `CC=gcc' so that ./configure
+      # always use it.  This is important only when the user
+      # has defined CC in his environment, otherwise ./configure will
+      # prefer gcc to other compilers.
+      CC=${am__tool_prefix}gcc
+      CFLAGS=$GNU_CFLAGS
+      export CC CFLAGS CPPFLAGS
+      echo "$me: running $CC --version"
+      $CC --version || skip_all_ "GNU C compiler not available"
+      echo "$me: running $CC -v"
+      $CC -v || skip_all_ "botched installation for GNU C compiler"
+      ;;
+    gcj)
+      GCJ=${am__tool_prefix}gcj
+      export GCJ
+      echo "$me: running $GCJ --version"
+      $GCJ --version || skip_all_ "GNU Java compiler not available"
+      echo "$me: running $GCJ -v"
+      $GCJ -v || skip_all_ "botched installation for GNU Java compiler"
+      ;;
+    g++)
+      CXX=${am__tool_prefix}g++
+      CXXFLAGS=$GNU_CXXFLAGS
+      export CXX CXXFLAGS CPPFLAGS
+      echo "$me: running $CXX --version"
+      $CXX --version || skip_all_ "GNU C++ compiler not available"
+      echo "$me: running $CXX -v"
+      $CXX -v || skip_all_ "botched installation for GNU C++ compiler"
+      ;;
+    gfortran)
+      FC=${am__tool_prefix}gfortran
+      FCFLAGS=$GNU_FCFLAGS
+      export FC FCFLAGS
+      echo "$me: running $FC --version"
+      $FC --version || skip_all_ "GNU Fortran compiler not available"
+      echo "$me: running $FC -v"
+      $FC -v || skip_all_ "botched installation for GNU Fortran compiler"
+      case " $required " in
+        *\ g77\ *) ;;
+        *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
+      esac
+      ;;
+    g77)
+      F77=${am__tool_prefix}g77
+      FFLAGS=$GNU_FFLAGS
+      export F77 FFLAGS
+      echo "$me: running $F77 --version"
+      $F77 --version || skip_all_ "GNU Fortran 77 compiler not available"
+      echo "$me: running $F77 -v"
+      $F77 -v || skip_all_ "botched installation for GNU Fortran 77 compiler"
+      case " $required " in
+        *\ gfortran\ *) ;;
+        *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
+      esac
+      ;;
+    icc)
+      CC=icc
+      export CC CPPFLAGS # But not CFLAGS (see comments for `cl' above).
+      # There is no way to ask *only* the compiler's version.
+      # This tool always wants to do something (by default
+      # it will try link *nothing* and complain it cannot find
+      # main(); funny).  Use -help so it does not try linking anything.
+      echo "$me: running $CC -V -help"
+      $CC -V -help || skip_all_ "Intel C compiler \`$CC' not available"
+      ;;
+    javac)
+      # The Java compiler from JDK 1.5 (and presumably earlier versions)
+      # cannot handle the `-version' option by itself: it bails out
+      # telling that source files are missing.  Adding also the `-help'
+      # option seems to solve the problem.
+      echo "$me: running javac -version -help"
+      javac -version -help || skip_all_ "Sun Java compiler not available"
+      ;;
+    java)
+      # See the comments above about `javac' for why we use also `-help'.
+      echo "$me: running java -version -help"
+      java -version -help || skip_all_ "Sun Java interpreter not found"
+      ;;
+    lib)
+      AR=lib
+      export AR
+      # Attempting to create an empty archive will actually not
+      # create the archive, but lib will output its version.
+      echo "$me: running $AR -out:defstest.lib"
+      $AR -out:defstest.lib \
+        || skip_all_ "Microsoft \`lib' utility not available"
+      ;;
+    makedepend)
+      echo "$me: running makedepend -f-"
+      makedepend -f- \
+        || skip_all_ "required program \`makedepend' not available"
+      ;;
+    makeinfo-html)
+      # Make sure we have makeinfo, and it understands `--html'.
+      echo "$me: running makeinfo --html --version"
+      makeinfo --html --version \
+        || skip_all_ "cannot find a makeinfo program that groks the" \
+                 "\`--html' option"
+      ;;
+    mingw)
+      uname_s=`uname -s || echo UNKNOWN`
+      echo "$me: system name: $uname_s"
+      case $uname_s in
+        MINGW*) ;;
+        *) skip_all_ "this test requires MSYS in MinGW mode" ;;
+      esac
+      ;;
+    non-root)
+      # Skip this test case if the user is root.
+      # We try to append to a read-only file to detect this.
+      priv_check_temp=priv-check.$$
+      touch $priv_check_temp && chmod a-w $priv_check_temp \
+        || framework_failure_ "creating unwritable file $priv_check_temp"
+      # Not a useless use of subshell: lesser shells like Solaris /bin/sh
+      # can exit if a builtin fails.
+      overwrite_status=0
+      (echo foo >> $priv_check_temp) || overwrite_status=$?
+      rm -f $priv_check_temp
+      if test $overwrite_status -eq 0; then
+        skip_all_ "cannot drop file write permissions"
+      fi
+      unset priv_check_temp overwrite_status
+      ;;
+    perl-threads)
+      if test "$WANT_NO_THREADS" = "yes"; then
+        skip_all_ "Devel::Cover cannot cope with threads"
+      fi
+      ;;
+    native)
+      # Don't use "&&" here, to avoid a bug of 'set -e' present in
+      # some (even relatively recent) versions of the BSD shell.
+      # We add the dummy "else" branch for extra safety.
+      if cross_compiling; then
+        skip_all_ "doesn't work in cross-compile mode"
+      else :; fi
+      ;;
+    python)
+      # Python doesn't support --version, it has -V
+      echo "$me: running python -V"
+      python -V || skip_all_ "python interpreter not available"
+      ;;
+    ro-dir)
+      # Skip this test case if read-only directories aren't supported
+      # (e.g., under DOS.)
+      ro_dir_temp=ro_dir.$$
+      mkdir $ro_dir_temp && chmod a-w $ro_dir_temp \
+        || framework_failure_ "creating unwritable directory $ro_dir_temp"
+      # Not a useless use of subshell: lesser shells like Solaris /bin/sh
+      # can exit if a builtin fails.
+      create_status=0
+      (: > $ro_dir_temp/probe) || create_status=$?
+      rm -rf $ro_dir_temp
+      if test $create_status -eq 0; then
+        skip_all_ "cannot drop directory write permissions"
+      fi
+      unset ro_dir_temp create_status
+      ;;
+    runtest)
+      # DejaGnu's runtest program. We rely on being able to specify
+      # the program on the runtest command-line. This requires
+      # DejaGnu 1.4.3 or later.
+      echo "$me: running runtest SOMEPROGRAM=someprogram --version"
+      runtest SOMEPROGRAM=someprogram --version \
+        || skip_all_ "DejaGnu is not available"
+      ;;
+    tex)
+      # No all versions of Tex support `--version', so we use
+      # a configure check.
+      if test -z "$TEX"; then
+        skip_all_ "TeX is required, but it wasn't found by configure"
+      fi
+      ;;
+    texi2dvi-o)
+      # Texi2dvi supports `-o' since Texinfo 4.1.
+      echo "$me: running texi2dvi -o /dev/null --version"
+      texi2dvi -o /dev/null --version \
+        || skip_all_ "required program \`texi2dvi' not available"
+      ;;
+    lex)
+      test x"$LEX" = x"false" && skip_all_ "lex not found or disabled"
+      export LEX
+      ;;
+    yacc)
+      test x"$YACC" = x"false" && skip_all_ "yacc not found or disabled"
+      export YACC
+      ;;
+    flex)
+      LEX=flex; export LEX
+      echo "$me: running flex --version"
+      flex --version || skip_all_ "required program \`flex' not available"
+      ;;
+    bison)
+      YACC='bison -y'; export YACC
+      echo "$me: running bison --version"
+      bison --version || skip_all_ "required program \`bison' not available"
+      ;;
+    *)
+      # Generic case: the tool must support --version.
+      echo "$me: running $tool --version"
+      # It is not likely but possible that $tool is a special builtin,
+      # in which case the shell is allowed to exit after an error.
+      # So, please leave the subshell here.
+      ($tool --version) || skip_all_ "required program \`$tool' not available"
+      ;;
+  esac
+done
+
+# Using just `$testbuilddir' for the check here is ok, since the
+# further temporary subdirectory where the test will be run is
+# ensured not to contain any whitespace character.
+case $testbuilddir in
+  *\ *|*\      *)
+    case " $required " in
+      *' libtool '* | *' libtoolize '* )
+        skip_all_ "libtool has problems with spaces in builddir name";;
+    esac
+    ;;
+esac
+
+# This test is necessary, although Automake's configure script bails out
+# when $srcdir contains spaces.  This is because $testsrcdir is in not
+# configure-time $srcdir, but is instead configure-time $abs_srcdir, and
+# that is allowed to contain spaces.
+case $testsrcdir in
+  *\ * |*\     *)
+    case " $required " in
+      *' libtool '* | *' libtoolize '* | *' gettext '* )
+        skip_all_ "spaces in srcdir name: libtool/gettext tests won't work";;
+   esac
+   ;;
+esac
+
+# We might need extra macros, e.g., from Libtool or Gettext.
+case " $required " in *\ libtool*) . ./libtool-macros.dir/get.sh;; esac
+case " $required " in *\ gettext*) . ./gettext-macros.dir/get.sh;; esac
+
+
+## ---------------------------------------------------------------- ##
+##  Create and set up of the temporary directory used by the test.  ##
+##  Set up of the exit trap for cleanup of said directory.          ##
+## ---------------------------------------------------------------- ##
+
+# This might be used in testcases checking distribution-related features.
+# Test scripts are free to override this if they need to.
+distdir=$me-1.0
+
+# Set up the exit trap.
+if test "$sh_errexit_works" = yes; then
+  trap 'exit_status=$?
+    set +e
+    cd "$testbuilddir"
+    if test $am_using_tap = yes; then
+      if test $have_tap_plan_ != yes && test $exit_status -eq 0; then
+        plan_ "now"
+      fi
+      test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
+        || keep_testdirs=yes
+    else
+      # This is to ensure that a test script does give a SKIP outcome just
+      # because a command in it happens to exit with status 77.  This
+      # behaviour, while from time to time useful to developers, is not
+      # meant to be enabled by default, as it could cause spurious failures
+      # in the wild.  Thus it will be enabled only when the variable
+      # "am_explicit_skips" is set to a "true" value.
+      case $am_explicit_skips in
+        [yY]|[yY]es|1)
+          if test $exit_status -eq 77 && test $am__test_skipped != yes; then
+            echo "$me: implicit skip turned into failure"
+            exit_status=78
+          fi;;
+      esac
+      test $exit_status -eq 0 || keep_testdirs=yes
+    fi
+    am_keeping_testdirs || rm_rf_ $testSubDir
+    set +x
+    echo "$me: exit $exit_status"
+    exit $exit_status
+  ' 0
+  trap "fatal_ 'caught signal SIGHUP'" 1
+  trap "fatal_ 'caught signal SIGINT'" 2
+  trap "fatal_ 'caught signal SIGTERM'" 15
+  # Various shells seems to just ignore SIGQUIT under some circumstances,
+  # even if the signal is not blocked; however, if the signal it trapped,
+  # the trap gets correctly executed.  So we also trap SIGQUIT.
+  # Here is a list of some shells that have been verified to exhibit the
+  # problematic behavior with SIGQUIT:
+  #  - zsh 4.3.12 on Debian GNU/Linux
+  #  - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
+  #  - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
+  #  - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
+  # OTOH, at least these shells that do *not* exhibit that behaviour:
+  #  - modern version of the Almquist Shell (at least 0.5.5.1), on
+  #    both Solaris and GNU/Linux
+  #  - Solaris 10 /bin/sh
+  #  - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
+  trap "fatal_ 'caught signal SIGQUIT'" 3
+  # Ignore further SIGPIPE in the trap code.  This is required to avoid
+  # a very weird issue with some shells, at least when the execution of
+  # the automake testsuite is driven by the `prove' utility: if prove
+  # (or the make process that has spawned it) gets interrupted with
+  # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
+  # sometimes finally dumping core, other times hanging indefinitely.
+  # See also Test::Harness bug [rt.cpan.org #70855], archived at
+  # <https://rt.cpan.org/Ticket/Display.html?id=70855>
+  trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
+fi
+
+# Create and populate the temporary directory, if and as required.
+if test x"$am_create_testdir" = x"no"; then
+  testSubDir=
+else
+  # The subdirectory where the current test script will run and write its
+  # temporary/data files.  This will be created shortly, and will be removed
+  # by the cleanup trap below if the test passes.  If the test doesn't pass,
+  # this directory will be kept, to facilitate debugging.
+  testSubDir=$me.dir
+  test ! -d $testSubDir || rm_rf_ $testSubDir \
+    || framework_failure_ "removing old test subdirectory"
+  mkdir $testSubDir \
+    || framework_failure_ "creating test subdirectory"
+  cd ./$testSubDir \
+    || framework_failure_ "cannot chdir into test subdirectory"
+  if test x"$am_create_testdir" != x"empty"; then
+    cp "$am_scriptdir"/install-sh "$am_scriptdir"/missing \
+       "$am_scriptdir"/depcomp . \
+      || framework_failure_ "fetching common files from $am_scriptdir"
+    # Build appropriate environment in test directory.  E.g., create
+    # configure.in, touch all necessary files, etc.  Don't use AC_OUTPUT,
+    # but AC_CONFIG_FILES so that appending still produces a valid
+    # configure.in.  But then, tests running config.status really need
+    # to append AC_OUTPUT.
+    {
+      echo "AC_INIT([$me], [1.0])"
+      if test x"$am_parallel_tests" = x"yes"; then
+        echo "AM_INIT_AUTOMAKE([parallel-tests])"
+      else
+        echo "AM_INIT_AUTOMAKE"
+      fi
+      echo "AC_CONFIG_FILES([Makefile])"
+    } >configure.in || framework_failure_ "creating configure.in skeleton"
+  fi
+fi
+
+
+## ---------------- ##
+##  Ready to go...  ##
+## ---------------- ##
+
+set -x
+pwd
diff --git a/tests/defs-static.in b/tests/defs-static.in
new file mode 100644 (file)
index 0000000..826c08a
--- /dev/null
@@ -0,0 +1,243 @@
+# -*- shell-script -*-
+# @configure_input@
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 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/>.
+
+# Defines and minimal setup for Automake testing environment.
+
+# IMPORTANT NOTES AND REQUIREMENTS
+#   - Multiple inclusions of this file should be idempotent.
+#   - This code has to be 'set -e' clean.
+#   - This file should execute correctly with any system's /bin/sh
+#     shell, not only with configure-time detected $CONFIG_SHELL.
+
+# Be more Bourne compatible.
+# (Snippet inspired to configure's initialization in Autoconf 2.64)
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+  # If Zsh is not started directly in Bourne-compatibility mode, it has
+  # some incompatibilities in the handling of `$0' that conflict with
+  # our usage: i.e., `$0' inside a file sourced with the `.' builtin is
+  # temporarily set to the name of the sourced file.
+  # Work around this when possible, otherwise abort the script.
+  # Note that a bug in some versions of Zsh prevents us from resetting $0
+  # in a sourced script, so the use of $argv0.  For more info see:
+  #  <http://www.zsh.org/mla/workers/2009/msg01140.html>
+  # Note: the apparently useless 'eval' below are needed by at least
+  # dash 0.5.2, to prevent it from bailing out with an error like
+  # "Syntax error: Bad substitution"
+  if eval '[[ "$0" = *."test" ]]'; then
+    # Good, FUNCTION_ARGZERO option was already off when this file was
+    # sourced.  Thus we've nothing to do.
+    argv0=$0
+  elif eval 'test -n "${functrace[-1]}"'; then
+    # FUNCTION_ARGZERO option was on, but we have a easy workaround.
+    eval 'argv0=${functrace[-1]%:*}'
+  else
+    # Give up.
+    echo "$0: cannot determine the path of running test script" >&2
+    echo "$0: test was running with Zsh version $ZSH_VERSION" >&2
+    echo "$0: did you enable the NO_FUNCTION_ARGZERO option?" >&2
+    exit 99
+  fi
+else
+  argv0=$0
+  # Avoid command substitution failure, for Tru64 sh -e and instspc*.test.
+  case `(set -o) 2>/dev/null || :` in *posix*) set -o posix;; esac
+fi
+
+# Check that the environment is properly sanitized.
+# Having variables exported to the empty string is OK, since our code
+# treats such variables as if they were unset.
+for var in \
+  me \
+  required \
+  am_using_tap \
+  am_parallel_tests \
+  am_create_testdir \
+  am_tap_implementation \
+  am_test_prefer_config_shell \
+  am_original_AUTOMAKE \
+  am_original_ACLOCAL \
+; do
+  if eval "test x\"\$$var\" != x" && env | grep "^$var=" >/dev/null; then
+    echo "$argv0: variable \`$var' is set in the environment:" \
+         "this is unsafe" >&2
+    exit 99
+  fi
+done
+unset var
+
+# See whether the current test script is expected to use TAP or not.
+# Use a sensible default, while allowing the scripts to override this
+# check.
+if test -z "$am_using_tap"; then
+  case $argv0 in *.tap) am_using_tap=yes;; *) am_using_tap=no;; esac
+fi
+
+testsrcdir='@abs_srcdir@'
+top_testsrcdir='@abs_top_srcdir@'
+testbuilddir='@abs_builddir@'
+top_testbuilddir='@abs_top_builddir@'
+testprefix='@prefix@'
+
+# Support for the "installcheck" target.
+case ${am_running_installcheck:=no} in
+  yes)
+    am_amdir='@amdir@'
+    am_automake_acdir='@automake_acdir@'
+    am_bindir='@bindir@'
+    am_datadir='@datadir@'
+    am_docdir='@docdir@'
+    am_pkgvdatadir='@pkgvdatadir@'
+    am_scriptdir='@scriptdir@'
+    am_system_acdir='@system_acdir@'
+    ;;
+  no)
+    am_amdir=$top_testsrcdir/lib/am
+    am_automake_acdir=$top_testsrcdir/m4
+    am_bindir=$testbuilddir
+    am_datadir=$top_testsrcdir
+    am_docdir=$top_testsrcdir/doc
+    am_pkgvdatadir=$top_testsrcdir/lib
+    am_scriptdir=$top_testsrcdir/lib
+    am_system_acdir=$top_testsrcdir/m4/acdir
+    ;;
+  *)
+    echo "$argv0: variable \`am_running_installcheck' has invalid"
+         "value \`$am_running_installcheck'" >&2
+    exit 99
+    ;;
+esac
+
+APIVERSION='@APIVERSION@'
+PATH_SEPARATOR='@PATH_SEPARATOR@'
+
+host_alias=${host_alias-'@host_alias@'}; export host_alias
+build_alias=${build_alias-'@build_alias@'}; export build_alias
+
+# Make sure we override the user shell.  And do not read the value of
+# $SHELL from the environment (think to the non-uncommon situation where
+# e.g., $SHELL=/bin/tcsh).
+SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL
+
+# User can override various tools used.  Prefer overriding specific for
+# that automake testsuite, if they are available.
+PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}}
+MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}}
+YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}}
+LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}}
+AUTOCONF=${AM_TESTSUITE_AUTOCONF-${AUTOCONF-'@am_AUTOCONF@'}}
+AUTOM4TE=${AM_TESTSUITE_AUTOM4TE-${AUTOM4TE-'@am_AUTOM4TE@'}}
+AUTORECONF=${AM_TESTSUITE_AUTORECONF-${AUTORECONF-'@am_AUTORECONF@'}}
+AUTOHEADER=${AM_TESTSUITE_AUTOHEADER-${AUTOHEADER-'@am_AUTOHEADER@'}}
+AUTOUPDATE=${AM_TESTSUITE_AUTOUPDATE-${AUTOUPDATE-'@am_AUTOUPDATE@'}}
+
+# Tests who want complete control over aclocal or automake command-line
+# options should use $am_original_ACLOCAL or $am_original_AUTOMAKE.  The
+# `test -z' tests take care not to re-initialize them if defs-static
+# is re-sourced, as we want defs-static to remain really idempotent.
+if test -z "$am_original_AUTOMAKE"; then
+  am_original_AUTOMAKE=${AM_TESTSUITE_AUTOMAKE-${AUTOMAKE-"automake-$APIVERSION"}}
+fi
+if test -z "$am_original_ACLOCAL"; then
+  am_original_ACLOCAL=${AM_TESTSUITE_ACLOCAL-${ACLOCAL-"aclocal-$APIVERSION"}}
+fi
+
+# Use -Werror because this also turns some Perl warnings into error.
+# Tests for which this is inappropriate should use -Wno-error.
+# Tests who want complete control over aclocal command-line options
+# should use $am_original_ACLOCAL instead.
+ACLOCAL="$am_original_ACLOCAL -Werror"
+
+# See how Automake should be run.  We put --foreign as the default
+# strictness to avoid having to create lots and lots of files.  A test
+# can override this by specifying a different strictness.  Use -Wall
+# -Werror by default.  Tests for which this is inappropriate (e.g. when
+# testing that a warning is enabled by a specific switch) should use
+# -Wnone or/and -Wno-error.
+# Tests who want complete control over automake command-line options
+# should use $am_original_AUTOMAKE instead.
+AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror -Wall"
+
+# This is a hack to seamlessly support the infamous "autoconf wrappers",
+# that might dispatch different autoconf versions depending on the name
+# of the input files and/or the command-line options used.  See:
+# <http://lists.gnu.org/archive/html/automake/2011-12/msg00039.html>
+# FIXME: in the long run, the better fix will be to convert our testsuite
+# to use `configure.ac' instead of `configure.in' as autoconf input.
+AUTOCONF="$AUTOCONF -B /no/such/dir"
+AUTOM4TE="$AUTOM4TE -B /no/such/dir"
+AUTORECONF="$AUTORECONF -B /no/such/dir"
+
+# POSIX no longer requires 'egrep' and 'fgrep',
+# but some hosts lack 'grep -E' and 'grep -F'.
+EGREP=${AM_TESTSUITE_EGREP-'@EGREP@'}
+FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'}
+
+# Compilers and their flags.  These can point to non-GNU compilers (and
+# on non-Linux and non-BSD systems, they probably will).
+CC=${AM_TESTSUITE_CC-${CC-'@CC@'}}
+CXX=${AM_TESTSUITE_CXX-${CXX-'@CXX@'}}
+F77=${AM_TESTSUITE_F77-${F77-'@F77@'}}
+FC=${AM_TESTSUITE_FC-${FC-'@FC@'}}
+CFLAGS=${AM_TESTSUITE_CFLAGS-${CFLAGS-'@CFLAGS@'}}
+CXXFLAGS=${AM_TESTSUITE_CXXFLAGS-${CXXFLAGS-'@CXXFLAGS@'}}
+FCFLAGS=${AM_TESTSUITE_FCFLAGS-${FCFLAGS-'@FCFLAGS@'}}
+FFLAGS=${AM_TESTSUITE_FFLAGS-${FFLAGS-'@FFLAGS@'}}
+CPPFLAGS=${AM_TESTSUITE_CPPFLAGS-${CPPFLAGS-'@CPPFLAGS@'}}
+
+# Flags for the GNU compilers.
+GNU_FFLAGS=${AM_TESTSUITE_GNU_FFLAGS-${GNU_FFLAGS-'@GNU_FFLAGS@'}}
+GNU_FCFLAGS=${AM_TESTSUITE_GNU_FCFLAGS-${GNU_FCFLAGS-'@GNU_FCFLAGS@'}}
+GNU_CXXFLAGS=${AM_TESTSUITE_GNU_CXXFLAGS-${GNU_CXXFLAGS-'@GNU_CXXFLAGS@'}}
+GNU_CFLAGS=${AM_TESTSUITE_GNU_CFLAGS-${GNU_CFLAGS-'@GNU_CFLAGS@'}}
+
+# No all versions of Tex support `--version', so we use a configure
+# check to decide if tex is available.  This decision is embodied in
+# this variable.
+TEX=${AM_TESTSUITE_TEX-'@TEX@'}
+
+# Whether $SHELL has working 'set -e' with exit trap.
+sh_errexit_works='@sh_errexit_works@'
+
+# The amount we should wait after modifying files depends on the platform.
+# For instance, Windows '95, '98 and ME have 2-second granularity
+# and can be up to 3 seconds in the future w.r.t. the system clock.
+sleep='sleep @MODIFICATION_DELAY@'
+
+# An old timestamp that can be given to a file, in "touch -t" format.
+# The time stamp should be portable to all file systems of interest.
+# Just for fun, choose the exact time of the announcement of the GNU project
+# in UTC; see <http://www.gnu.org/gnu/initial-announcement.html>.
+old_timestamp=198309271735.59
+
+# Make our wrapper script (or installed scripts, if running under
+# "installcheck") accessible by default.  And avoid to uselessly
+# extend $PATH multiple times if this file is sourced multiple times.
+case $PATH in
+  $am_bindir$PATH_SEPARATOR*) ;;
+  *) PATH=$am_bindir$PATH_SEPARATOR$PATH;;
+esac
+export PATH
diff --git a/tests/defs.in b/tests/defs.in
deleted file mode 100644 (file)
index 4990e30..0000000
+++ /dev/null
@@ -1,578 +0,0 @@
-# -*- shell-script -*-
-# @configure_input@
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 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/>.
-
-# Defines for Automake testing environment.
-# Tom Tromey <tromey@cygnus.com>
-
-# Be more Bourne compatible.
-# (Snippet copied from configure's initialization in Autoconf 2.64)
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-
-# A single whitespace character.
-sp=' '
-# A tabulation character.
-tab='  '
-# A newline character.
-nl='
-'
-
-# As autoconf-generated configure scripts do, ensure that IFS
-# is defined initially, so that saving and restoring $IFS works.
-IFS=$sp$tab$nl
-
-# Ensure we are running from the right directory.
-test -f ./defs || {
-   echo "defs: not found in current directory" 1>&2
-   exit 1
-}
-
-if test -z "$srcdir"; then
-   # compute $srcdir.
-   srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
-   test "$srcdir" = $0 && srcdir=.
-else :; fi
-
-# Ensure $srcdir is set correctly.
-test -f "$srcdir/defs.in" || {
-   echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
-   exit 1
-}
-
-# The name of the current test (without the `.test' suffix).
-# Test scripts can override it if they need to (but this should
-# be done carefully, and *before* including ./defs).
-if test -z "$me"; then
-  me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
-elif env | grep '^me=' >/dev/null; then
-  echo "$0: variable \`me' is set in the environment: this is unsafe" >&2
-  exit 99
-fi
-
-# Check that the environment is properly sanitized.
-for var in required parallel_tests; do
-  if env | grep "^$var=" >/dev/null; then
-    echo "$me: variable \`$var' is set in the environment:" \
-         "this is unsafe" >&2
-    exit 99
-  fi
-done
-unset var
-
-# This might be used in testcases checking distribution-related features.
-# Test scripts are free to override this if they need to.
-distdir=$me-1.0
-
-APIVERSION='@APIVERSION@'
-PATH_SEPARATOR='@PATH_SEPARATOR@'
-
-# Make sure we override the user shell.
-SHELL='@SHELL@'
-export SHELL
-# User can override various tools used.
-MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}}
-test -z "$PERL" && PERL='@PERL@'
-test -z "$AUTOCONF" && AUTOCONF="@am_AUTOCONF@"
-test -z "$AUTOM4TE" && AUTOM4TE="@am_AUTOM4TE@"
-test -z "$AUTORECONF" && AUTORECONF="@am_AUTORECONF@"
-test -z "$AUTOHEADER" && AUTOHEADER="@am_AUTOHEADER@"
-test -z "$AUTOUPDATE" && AUTOUPDATE="@am_AUTOUPDATE@"
-test -z "$MISSING" && MISSING=`pwd`/../lib/missing
-
-# This is a hack to seamlessly support the infamous "autoconf wrappers",
-# that might dispatch different autoconf versions depending on the name
-# of the input files and/or the command-line options used.  See:
-# <http://lists.gnu.org/archive/html/automake/2011-12/msg00039.html>
-# FIXME: in the long run, the better fix will be to convert our testsuite
-# to use `configure.ac' instead of `configure.in' as autoconf input.
-AUTOCONF="$AUTOCONF -B /no/such/dir"
-AUTOM4TE="$AUTOM4TE -B /no/such/dir"
-AUTORECONF="$AUTORECONF -B /no/such/dir"
-
-# Use -Werror because this also turns some Perl warnings into error.
-# (Tests for which this is inappropriate should use -Wno-error.)
-test -z "$ACLOCAL" && ACLOCAL="aclocal-$APIVERSION -Werror"
-
-# See how Automake should be run.  We put --foreign as the default
-# strictness to avoid having to create lots and lots of files.  A test
-# can override this by specifying a different strictness.  Use -Wall
-# -Werror by default.  Tests for which this is inappropriate
-# (e.g. when testing that a warning is enabled by a specific switch)
-# should use -Wnone or/and -Wno-error
-test -z "$AUTOMAKE" && AUTOMAKE="automake-$APIVERSION --foreign -Werror -Wall"
-
-PATH="`pwd`$PATH_SEPARATOR$PATH"
-echo "$PATH"
-# Some shells forget to export modified environment variables.
-# (See note about `export' in the Autoconf manual.)
-export PATH
-
-# We use a trap below for cleanup.  This requires us to go through
-# hoops to get the right exit status transported through the signal.
-# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
-# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
-# sh inside this function.
-Exit ()
-{
-  set +e
-  (exit $1)
-  exit $1
-}
-
-# Print warnings (e.g., about skipped and failed tests) to this file
-# number.  Override by putting, say:
-#   stderr_fileno_=9; export stderr_fileno_; exec 9>&2;
-# in the definition of AM_TESTS_ENVIRONMENT.
-# This is useful when using automake's parallel tests mode, to print the
-# reason for skip/failure to console, rather than to the *.log files.
-: ${stderr_fileno_=2}
-
-# Copied from Gnulib's `tests/init.sh'.
-warn_ () { echo "$@" 1>&$stderr_fileno_; }
-fail_ () { warn_ "$me: failed test: $@"; Exit 1; }
-skip_ () { warn_ "$me: skipped test: $@"; Exit 77; }
-fatal_ () { warn_ "$me: hard error: $@"; Exit 99; }
-framework_failure_ () { warn_ "$me: set-up failure: $@"; Exit 99; }
-
-# cross_compiling
-# ---------------
-# Tell whether we are cross-compiling.  This is especially useful to skip
-# tests (or portions of them) that requires a native compiler.
-cross_compiling ()
-{
-  test x"$host_alias" != x
-}
-
-# So that we can force the use of correct gcc, g++ etc., consistently
-# with cross-compilation settings.
-if cross_compiling; then
-  am__tool_prefix="$host_alias-"
-else
-  am__tool_prefix=
-fi
-
-for tool in : $required
-do
-  # Check that each required tool is present.
-  case $tool in
-    :) ;;
-    bison|yacc)
-      # Since bison is required, we pick YACC for ./configure.
-      YACC='bison -y'
-      export YACC
-      echo "$me: running bison --version"
-      ( bison --version ) || exit 77
-      ;;
-    flex|lex)
-      # Since flex is required, we pick LEX for ./configure.
-      LEX=flex
-      export LEX
-      echo "$me: running flex --version"
-      flex --version || exit 77
-      ;;
-    cc|c++|fortran|fortran77)
-      echo "$me: dummy requirement '$tool', no check done"
-      ;;
-    bzip2)
-      # Do not use --version, bzip2 still tries to compress stdin.
-      echo "$me: running bzip2 --help"
-      ( bzip2 --help ) || exit 77
-      ;;
-    etags)
-      # Exuberant Ctags will create a TAGS file even
-      # when asked for --help or --version.  (Emacs's etags
-      # does not have such problem.)  Use -o /dev/null
-      # to make sure we do not pollute the tests/ directory.
-      echo "$me: running etags --version -o /dev/null"
-      ( etags --version -o /dev/null ) || exit 77
-      ;;
-    GNUmake)
-      # Use --version AND -v, because SGI Make doesn't fail on --version.
-      # Also grep for GNU because newer versions of FreeBSD make do
-      # not complain about `--version' (they seem to silently ignore it).
-      echo "$me: running $MAKE --version -v | grep GNU"
-      ( $MAKE --version -v | grep GNU ) || exit 77
-      ;;
-    gcc)
-      # When gcc is required, export `CC=gcc' so that ./configure
-      # always use it.  This is important only when the user
-      # has defined CC in his environment, otherwise ./configure will
-      # prefer gcc to other compilers.
-      CC=${am__tool_prefix}gcc
-      export CC
-      echo "$me: running $CC --version"
-      ( $CC --version ) || exit 77
-      ;;
-    gcj)
-      GCJ=${am__tool_prefix}gcj
-      export GCJ
-      echo "$me: running $GCJ --version"
-      ( $GCJ --version ) || exit 77
-      ( $GCJ -v ) || exit 77
-      ;;
-    g++)
-      CXX=${am__tool_prefix}g++
-      export CXX
-      echo "$me: running $CXX --version"
-      ( $CXX --version ) || exit 77
-      ;;
-    gfortran)
-      FC=${am__tool_prefix}gfortran
-      export FC
-      echo "$me: running $FC --version"
-      $FC --version || skip_ "GNU Fortran compiler not available"
-      echo "$me: running $FC -v"
-      $FC -v || skip_ "botched installation for GNU Fortran compiler"
-      case " $required " in
-        *\ g77\ *) ;;
-        *) F77=$FC; export F77;;
-      esac
-      ;;
-    g77)
-      F77=${am__tool_prefix}g77
-      export F77
-      echo "$me: running $F77 --version"
-      $F77 --version || skip_ "GNU Fortran 77 compiler not available"
-      echo "$me: running $F77 -v"
-      $F77 -v || skip_ "botched installation for GNU Fortran 77 compiler"
-      case " $required " in
-        *\ gfortran\ *) ;;
-        *) FC=$F77; export FC;;
-      esac
-      ;;
-    icc)
-      CC=icc
-      export CC
-      # There is no way to ask *only* the compiler's version.
-      # This tool always wants to do something (by default
-      # it will try link *nothing* and complain it cannot find
-      # main(); funny).  Use -help so it does not try linking anything.
-      echo "$me: running $CC -V -help"
-      ( $CC -V -help ) || exit 77
-      ;;
-    javac)
-      # The Java compiler from JDK 1.5 (and presumably earlier versions)
-      # cannot handle the `-version' option by itself: it bails out
-      # telling that source files are missing.  Adding also the `-help'
-      # option seems to solve the problem.
-      echo "$me: running javac -version -help"
-      javac -version -help || exit 77
-      ;;
-    makedepend)
-      echo "$me: running makedepend -f-"
-      ( makedepend -f- ) || exit 77
-      ;;
-    makeinfo-html)
-      # Make sure makeinfo understands --html.
-      echo "$me: running makeinfo --html --version"
-      ( makeinfo --html --version ) || exit 77
-      ;;
-    non-root)
-      # Skip this test case if the user is root.
-      # We try to append to a read-only file to detect this.
-      priv_check_temp=priv-check.$$
-      touch $priv_check_temp || exit 1
-      chmod a-w $priv_check_temp || exit 1
-      (echo foo >> $priv_check_temp) >/dev/null 2>&1
-      overwrite_status=$?
-      rm -f $priv_check_temp
-      test $overwrite_status = 0 && exit 77
-      ;;
-    native)
-      cross_compiling && skip_ "doesn't work in cross-compile mode"
-      ;;
-    python)
-      # Python doesn't support --version, it has -V
-      echo "$me: running python -V"
-      ( python -V ) || exit 77
-      ;;
-    ro-dir)
-      # Skip this test case if read-only directories aren't supported
-      # (e.g., under DOS.)
-      ro_dir_temp=ro_dir.$$
-      mkdir $ro_dir_temp || exit 1
-      chmod a-w $ro_dir_temp || exit 1
-      (: > $ro_dir_temp/probe) >/dev/null 2>/dev/null
-      create_status=$?
-      rm -rf $ro_dir_temp
-      test $create_status = 0 && exit 77
-      ;;
-    rst2html)
-      # Try the variants that are tried in check.am.
-      while :; do
-       for r2h in $RST2HTML rst2html rst2html.py; do
-         echo "$me: running $r2h --version"
-         $r2h --version && break 2
-       done
-       exit 77
-      done
-      ;;
-    runtest)
-      # DejaGnu's runtest program. We rely on being able to specify
-      # the program on the runtest command-line. This requires
-      # DejaGnu 1.4.3 or later.
-      echo "$me: running runtest --version"
-      (runtest SOMEPROGRAM=someprogram --version) || exit 77
-      ;;
-    tex)
-      # No all versions of Tex support `--version', so we use
-      # a configure check.
-      test -n "@TEX@" || exit 77
-      ;;
-    texi2dvi-o)
-      # Texi2dvi supports `-o' since Texinfo 4.1.
-      echo "$me: running texi2dvi -o /dev/null --version"
-      ( texi2dvi -o /dev/null --version ) || exit 77
-      ;;
-    # Generic case: the tool must support --version.
-    *)
-      echo "$me: running $tool --version"
-      ( $tool --version ) || exit 77
-      ;;
-  esac
-done
-
-
-# Always use an absolute srcdir.  Otherwise symlinks made in subdirs
-# of the test dir just won't work.
-case "$srcdir" in
- [\\/]* | ?:[\\/]*)
-    ;;
-
- *)
-    srcdir=`CDPATH=: && cd "$srcdir" && pwd`
-    ;;
-esac
-
-curdir=`pwd`
-testSubDir=$me.dir
-test ! -d $testSubDir || {
-  find $testSubDir -type d ! -perm -700 -exec chmod u+rwx {} ";"
-  rm -rf $testSubDir
-}
-mkdir $testSubDir
-
-sh_errexit_works=@sh_errexit_works@
-if test "$sh_errexit_works" = yes; then
-  trap 'exit_status=$?
-    set +e
-    cd "$curdir"
-    case $exit_status,$keep_testdirs in
-    0,)
-      find $testSubDir -type d ! -perm -700 -exec chmod u+rwx {} ";"
-      rm -rf $testSubDir
-      ;;
-    esac
-    test "$signal" != 0 &&
-      echo "$me: caught signal $signal"
-    echo "$me: exit $exit_status"
-    exit $exit_status
-  ' 0
-  for signal in 1 2 13 15; do
-    trap 'signal='$signal'; { Exit 1; }' $signal
-  done
-fi
-signal=0
-
-# Copy in some files we need.
-for file in install-sh missing depcomp; do
-   cp "$srcdir/../lib/$file" "$testSubDir/$file" || Exit 1
-done
-
-cd ./$testSubDir
-
-# Build appropriate environment in test directory.  Eg create
-# configure.in, touch all necessary files, etc.
-# Don't use AC_OUTPUT, but AC_CONFIG_FILES so that appending
-# still produces a valid configure.ac.  But then, tests running
-# config.status really need to append AC_OUTPUT.
-{
-  echo "AC_INIT([$me], [1.0])"
-  if test x"$parallel_tests" = x"yes"; then
-    echo "AM_INIT_AUTOMAKE([parallel-tests])"
-  else
-    echo "AM_INIT_AUTOMAKE"
-  fi
-  echo "AC_CONFIG_FILES([Makefile])"
-} >configure.in
-
-# Unset some make-related variables that may cause $MAKE to act like
-# a recursively invoked sub-make.  Any $MAKE invocation in a test is
-# conceptually an independent invocation, not part of the main
-# 'automake' build.
-unset MFLAGS MAKEFLAGS AM_MAKEFLAGS MAKELEVEL
-unset __MKLVL__ MAKE_JOBS_FIFO                     # For BSD make.
-unset DMAKE_CHILD DMAKE_DEF_PRINTED DMAKE_MAX_JOBS # For Solaris dmake.
-# Unset verbosity flag.
-unset V
-# Also unset variables that will let `make -e install' divert
-# files into unwanted directories.
-unset DESTDIR
-unset prefix exec_prefix bindir datarootdir datadir docdir dvidir
-unset htmldir includedir infodir libdir libexecdir localedir mandir
-unset oldincludedir pdfdir psdir sbindir sharedstatedir sysconfdir
-# Unset variables that might change the "make distcheck" behaviour.
-unset DISTCHECK_CONFIGURE_FLAGS AM_DISTCHECK_CONFIGURE_FLAGS
-# Also unset variables that control our test driver.  While not
-# conceptually independent, they cause some changed semantics we
-# need to control (and test for) in some of the tests to ensure
-# backward-compatible behavior.
-unset TESTS_ENVIRONMENT AM_TESTS_ENVIRONMENT
-unset DISABLE_HARD_ERRORS
-unset AM_COLOR_TESTS
-unset TESTS
-unset TEST_LOG_COMPILER
-unset TEST_LOGS
-unset RECHECK_LOGS
-unset VERBOSE
-
-echo "=== Running test $0"
-
-# We might need extra macros, e.g., from Libtool or Gettext.
-case " $required " in *\ libtool*) . ../libtool-macros.dir/get.sh;; esac
-case " $required " in *\ gettext*) . ../gettext-macros.dir/get.sh;; esac
-
-testaclocaldir='@abs_top_srcdir@/m4'
-
-# POSIX no longer requires 'egrep' and 'fgrep',
-# but some hosts lack 'grep -E' and 'grep -F'.
-EGREP='@EGREP@'
-FGREP='@FGREP@'
-
-# The amount we should wait after modifying files depends on the platform.
-# For instance, Windows '95, '98 and ME have 2-second granularity
-# and can be up to 3 seconds in the future w.r.t. the system clock.
-sleep='sleep @MODIFICATION_DELAY@'
-
-# The tests call `make -e' but we do not want $srcdir from the environment
-# to override the definition from the Makefile.
-testsrcdir=$srcdir
-unset srcdir
-
-# An old timestamp that can be given to a file, in "touch -t" format.
-# The time stamp should be portable to all file systems of interest.
-# Just for fun, choose the exact time of the announcement of the GNU project
-# in UTC; see <http://www.gnu.org/gnu/initial-announcement.html>.
-old_timestamp=198309271735.59
-
-# is_newest FILE FILES
-# --------------------
-# Return false if any file in FILES is newer than FILE.
-# Resolve ties in favor of FILE.
-is_newest ()
-{
-  is_newest_files=`find "$@" -prune -newer "$1"`
-  test -z "$is_newest_files"
-}
-
-# using_gmake
-# -----------
-# Return success if $MAKE is GNU make, return failure otherwise.
-# Caches the result for speed reasons.
-using_gmake ()
-{
-  case $am__using_gmake in
-    yes)
-      return 0;;
-    no)
-      return 1;;
-    '')
-      # Use --version AND -v, because SGI Make doesn't fail on --version.
-      # Also grep for GNU because newer versions of FreeBSD make do
-      # not complain about `--version' (they seem to silently ignore it).
-      if $MAKE --version -v | grep GNU; then
-        am__using_gmake=yes
-        return 0
-      else
-        am__using_gmake=no
-        return 1
-      fi;;
-    *)
-      fatal_ "invalid value for \$am__using_gmake: '$am__using_gmake'";;
-  esac
-}
-am__using_gmake="" # Avoid interferences from the environment.
-
-# AUTOMAKE_run status [options...]
-# --------------------------------
-# Run Automake with OPTIONS, and fail if automake
-# does not exit with STATUS.
-AUTOMAKE_run ()
-{
-  expected_exitcode=$1
-  shift
-  exitcode=0
-  $AUTOMAKE ${1+"$@"} >stdout 2>stderr || exitcode=$?
-  cat stderr >&2
-  cat stdout
-  test $exitcode = $expected_exitcode || Exit 1
-}
-
-# AUTOMAKE_fails [options...]
-# ---------------------------
-# Run Automake with OPTIONS, and fail if automake
-# does not exit with STATUS.
-AUTOMAKE_fails ()
-{
-  AUTOMAKE_run 1 ${1+"$@"}
-}
-
-commented_sed_unindent_prog='
-  /^$/b                    # Nothing to do for empty lines.
-  x                        # Get x<indent> into pattern space.
-  /^$/{                    # No prior x<indent>, go prepare it.
-    g                      # Copy this 1st non-blank line into pattern space.
-    s/^\(['"$tab"' ]*\).*/x\1/   # Prepare x<indent> in pattern space.
-  }                        # Now: x<indent> in pattern and <line> in hold.
-  G                        # Build x<indent>\n<line> in pattern space, and
-  h                        # duplicate it into hold space.
-  s/\n.*$//                # Restore x<indent> in pattern space, and
-  x                        # exchange with the above duplicate in hold space.
-  s/^x\(.*\)\n\1//         # Remove leading <indent> from <line>.
-  s/^x.*\n//               # Restore <line> when there is no leading <indent>.
-'
-
-# unindent [input files...]
-# -------------------------
-# Remove the "proper" amount of leading whitespace from the given files,
-# and output the result on stdout.  That amount is determined by looking
-# at the leading whitespace of the first non-blank line in the input
-# files.  If no input file is specified, standard input is implied.
-unindent ()
-{
-  if test x"$sed_unindent_prog" = x; then
-    sed_unindent_prog=`printf '%s\n' "$commented_sed_unindent_prog" | sed -e "s/  *# .*//"`
-  fi
-  sed "$sed_unindent_prog" ${1+"$@"}
-}
-sed_unindent_prog="" # Avoid interferences from the environment.
-
-# Turn on shell traces.
-set -x
-
-pwd
index 5ffb9a1..44b3d80 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat > acinclude.m4 << 'END'
-AC_DEFUN([AM_FUNC_TWO])
+AC_DEFUN([AM_FUNC_THREE])
+AC_DEFUN([AM_FUNC_TWO], [@!GrepThisString!@AM_FUNC_THREE])
 AC_DEFUN([AM_FUNC_ONE], [AC_REQUIRE([AM_FUNC_TWO])])
 END
 
+cat >>configure.in << 'END'
+AM_FUNC_ONE
+END
+
 $ACLOCAL
+$AUTOCONF
+grep '^@!GrepThisString!@$' configure
+
+:
index 6c10a8f..3aed357 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 dnl if buggy this will require getloadavg.c
 AC_PROG_CC
@@ -38,3 +37,5 @@ END
 
 $ACLOCAL
 $AUTOMAKE
+
+:
index ad9578f..221e796 100755 (executable)
@@ -20,8 +20,6 @@
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index 8a70d58..f1ef8a4 100755 (executable)
@@ -20,8 +20,6 @@
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index 7bd34ed..84ec7f6 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index 591267e..fbfc57c 100755 (executable)
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
 write_check_for ()
 {
   echo "send_user \"$1: \$$1\\n\""
-  cat << END
-if { \$$1 == "/$1/" } {
-    pass "test_$1"
-} else {
-    fail "test_$1"
-}
+  unindent << END
+    if { \$$1 == "/$1/" } {
+        pass "test_$1"
+    } else {
+        fail "test_$1"
+    }
 END
 }
 
@@ -154,8 +152,8 @@ grep 'zardoz.*quux' tool.log && Exit 1
 # Check that files in $(EXTRA_DEJAGNU_SITE_CONFIG) are not distributed
 # by default.
 $MAKE distdir
-ls -l $me-1.0
-test ! -r $me-1.0/bar.dir/bar
-test ! -r $me-1.0/quux.exp
+ls -l $distdir
+test ! -r $distdir/bar.dir/bar
+test ! -r $distdir/quux.exp
 
 :
index a51bc40..a67e55a 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -60,7 +58,7 @@ is_newest site.exp Makefile  # Sanity check.
 grep '|objdir|' site.exp
 test `grep -c '|objdir|' site.exp` -eq 1
 
-# We can done a "more semantic" check if DejaGnu is available.
+# We can do a "more semantic" check if DejaGnu is available.
 if runtest SOMEPROGRAM=someprogram --version; then
   $MAKE check
   grep 'PASS: test_obj' foo.sum
index b3e58e7..43bb0f0 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = dejagnu
 TESTS = frob.test
 END
 
+test x"$am_parallel_tests" != x"yes" || : > test-driver
+
 $ACLOCAL
 $AUTOMAKE
 
index 121f6d8..154c087 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
index 2c5d375..42529c0 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
 cat > hammer << 'END'
 #! /bin/sh
 echo "Everything looks like a nail to me!"
index fa64a31..02eb444 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 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
 
 # Check that the DejaGnu rules work for a simple program and test case.
 # Also check PR 488: Failure of the first of several tools tested.
+# From the original bug report:
+# ``If you use dejagnu for testing and have multiple tools (i.e.,
+#   multiple entries in the DEJATOOL variable) then the success/failure
+#   of "make check" is only dependent on the success/failure of the
+#   tests on the final tool. Thus there may be failures in the tests on
+#   previous tools, but at first glance "make check" has passed.''
 
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
 cat > hammer << 'END'
 #! /bin/sh
 echo "Everything looks like a nail to me!"
index 0237a08..9eb51f1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -20,8 +20,6 @@
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
 package=$me
 
 cat > $package << 'END'
index 662ca28..eba687e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
 cat > faildeja << 'END'
 #! /bin/sh
 echo whatever
index 0be4d1f..d16e02d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 required=runtest
 . ./defs || Exit 1
 
-set -e
-
-# Check whether DejaGnu supports --status
-runtest --help | grep '.*--status' || Exit 77
+runtest --help | grep '.*--status' \
+  || skip_ "dejagnu lacks support for '--status'"
 
 cat > failtcl << 'END'
 #! /bin/sh
index 1e8d11a..74b3745 100755 (executable)
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 echo 'include $(top_srcdir)/foobar.am' > Makefile.am
index 6b0b9af..82db3f0 100755 (executable)
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 m4_include([foobar.m4])
 AC_OUTPUT
index d085a50..a5c3be9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
+echo 'AM_FOO' >> configure.in
+echo 'AC_DEFUN([AM_FOO], [AC_REQUIRE([AC_HEADER_STDC])])' > AM_FOO.m4
 
-cat >> configure.in << 'END'
-AM_C_PROTOTYPES
-FOO
-END
-
-cat > AM_C_PROTOTYPES.m4 << 'END'
-AC_DEFUN([AM_C_PROTOTYPES], [AC_REQUIRE([AC_HEADER_STDC])])
-END
-
-# Our --acdir overrides the one in $ACLOCAL.
 $ACLOCAL -I .
+
+:
diff --git a/tests/depcomp.sh b/tests/depcomp.sh
new file mode 100755 (executable)
index 0000000..d149280
--- /dev/null
@@ -0,0 +1,426 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Check dependency tracking in various flavours.
+# Contains both libtool and non-libtool case.
+# Sourced by the various (autogenerated) 'depcomp*.tap' tests.
+# Examples of reported failures that motivated those test are
+# listed below.
+
+# -------------------------------------------------------------------------
+
+# <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00028.html>
+#
+# Here's the bug: makedepend will prefix VPATH to the object file name,
+# thus the second make will invoke depcomp with object='../../src/foo.o',
+# causing errors such as:
+#
+#  touch: cannot touch `../../src/.deps/foo.TPo': No such file or directory
+#  makedepend: error:  cannot open "../../src/.deps/foo.TPo"
+#  ../../depcomp: line 560: ../../src/.deps/foo.TPo: No such file or directory
+
+# -------------------------------------------------------------------------
+
+# <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8473>
+# <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00079.html>
+#
+# Here's the bug: hp depmode will prefix VPATH to the object file name,
+# thus the second gmake will invoke depcomp with object='../../src/foo.o',
+# causing errors such as (broken on multiple lines for clarity):
+#
+#   cpp: "", line 0: error 4066: Cannot create
+#        "../../gllib/.deps/nonblocking.TPo" file for
+#        "-M../../gllib/.deps/nonblocking.TPo" option.
+#        (No such file or directory[errno=2])
+#
+
+# -------------------------------------------------------------------------
+
+# <http://lists.gnu.org/archive/html/automake-patches/2011-04/msg00140.html>
+# <http://lists.gnu.org/archive/html/automake-patches/2011-05/msg00019.html>
+#
+# A partial failure of an earlier version of this test; some bad
+# post-processing of the `*.Po' files led to the following broken
+# contents of `src/sub/.deps/subfoo.Po':
+#
+#  > sub/subfoo.o: ../../depmod-data.dir/src/sub/subfoo.c \
+#  >   ../../depmod-data.dir/src/foo.h
+#  > ../../depmod-data.dir/src/sub/subfoo.c \:
+#  >   ../../depmod-data.dir/src/foo.h:
+#
+# which caused make to die with an error like:
+#
+#  "sub/.deps/subfoo.Po:3: *** missing separator.  Stop."
+
+# -------------------------------------------------------------------------
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+longpath=this-is/a-path/which-has/quite-a/definitely/truly/long_long_name
+cachevar=am_cv_CC_dependencies_compiler_type
+
+srctree=depmod-1.0
+mkdir $srctree
+cd $srctree
+
+cd_top ()
+{
+  cd "$ocwd" || fatal_ "cannot chdir back to top directory"
+}
+
+delete ()
+{
+  test -f "$1" || fatal_ "$1: file does not exist"
+  rm -f "$1" || fatal_ "$1: couldn't remove"
+}
+
+edit ()
+{
+  file=$1; shift
+  sed "$@" <"$file" > t && mv -f t "$file" \
+    || fatal_ "$file: editing of file failed"
+}
+
+rewrite ()
+{
+  file=$1; shift
+  "$@" > "$file" || fatal_ "$file: couldn't rewrite"
+}
+
+setup_srcdir ()
+{
+  srcdir=$1 # This is intended to be global.
+  mkdir -p "$srcdir" \
+    || fatal_ "couldn't create source directory '$srcdir'"
+  cp -pR "$ocwd/$srctree"/* "$srcdir"/ \
+    || fatal_ "couldn't populate source directory '$srcdir'"
+}
+
+
+check_no_depfiles ()
+{
+  find . -name '*.Plo' -o -name '*.Po' | grep . && return 1
+  return 0
+}
+
+check_distclean ()
+{
+  # "make distcleancheck" can only run from a VPATH build.
+  if test $vpath = no; then
+    make_ok distclean && check_no_depfiles
+  else
+    $MAKE distcleancheck
+  fi
+}
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_AR
+`if test $depcomp_with_libtool = yes; then
+  echo AC_PROG_LIBTOOL
+else
+  echo AC_PROG_RANLIB
+fi`
+AC_CONFIG_FILES([Makefile src/Makefile])
+AC_OUTPUT
+END
+
+mkdir build-aux sub src src/sub2
+
+case $depcomp_with_libtool in
+  yes)
+    po=Plo objext=lo a=la
+    normalized_target=libfoo_la
+    # On platforms requiring that no undefined symbols exist in order
+    # to build shared libraries (e.g. Windows DLLs), you have to
+    # explicitly declare that the libtool library you are building
+    # does not actually have any undefined symbols, for libtool to
+    # even try to build it as a shared library.  Without that
+    # explicit declaration, libtool falls back to a static library
+    # only, regardless of any --enable-shared flags etc.
+    LIBPRIMARY=LTLIBRARIES LINKADD=LIBADD NOUNDEF=-no-undefined
+    libbaz_ldflags="libbaz_${a}_LDFLAGS = $NOUNDEF"
+    echo lib_LTLIBRARIES = libfoo.la >> Makefile.am
+    make_ok ()
+    {
+      $MAKE ${1+"$@"} >output 2>&1 || { cat output; return 1; }
+      cat output
+      $FGREP 'unknown directive' output && return 1
+      rm -f output
+      # Checks for stray files possibly left around by less common
+      # depmodes.
+      find . -name '*.[ud]' | grep . && return 1
+      return 0
+    }
+    ;;
+  no)
+    po=Po objext='$(OBJEXT)' a=a
+    normalized_target=foo
+    LIBPRIMARY=LIBRARIES LINKADD=LDADD NOUNDEF=
+    libbaz_ldflags=
+    echo bin_PROGRAMS = foo >> Makefile.am
+    make_ok ()
+    {
+      $MAKE ${1+"$@"}
+    }
+    ;;
+  *)
+    fatal_ "invalid value '$depcomp_with_libtool' for variable" \
+           "\$depcomp_with_libtool"
+    ;;
+esac
+
+cat >> Makefile.am <<END
+SUBDIRS = src
+# We include subfoo only to be sure that the munging in depcomp
+# doesn't remove too much from the object file name.
+${normalized_target}_SOURCES = foo.c sub/subfoo.c foo.h sub/subfoo.h
+${normalized_target}_LDFLAGS = $NOUNDEF
+${normalized_target}_${LINKADD} = src/libbaz.$a
+
+.PHONY: grep-test
+grep-test:
+## For debugging.
+       cat \$(DEPDIR)/foo.$po || :
+       cat \$(DEPDIR)/subfoo.$po || :
+       cat src/\$(DEPDIR)/baz.$po || :
+       cat src/sub2/\$(DEPDIR)/sub2foo.$po || :
+## Checks done here.
+       grep '^foo.$objext.*:' \$(DEPDIR)/foo.$po
+       grep '^subfoo\.$objext.*:' \$(DEPDIR)/subfoo.$po
+       grep '^baz\.$objext.*:' src/\$(DEPDIR)/baz.$po
+       grep '^sub2/sub2foo\.$objext.*:' src/sub2/\$(DEPDIR)/sub2foo.$po
+END
+
+cat > src/Makefile.am <<END
+AUTOMAKE_OPTIONS = subdir-objects
+noinst_${LIBPRIMARY} = libbaz.$a
+# We include sub2foo only to be sure that the munging in depcomp
+# doesn't remove too much from the object file name.
+libbaz_${a}_SOURCES = baz.c sub2/sub2foo.c baz.h sub2/sub2foo.h
+$libbaz_ldflags
+END
+
+cat > foo.c <<'END'
+#include "foo.h"
+#include "src/baz.h"
+#include <stdlib.h>
+int main (void)
+{
+  printf ("foo bar\n");
+  exit (EXIT_SUCCESS + subfoo () + baz ());
+}
+END
+
+cat > foo.h <<'END'
+#include <stdio.h>
+#include "sub/subfoo.h"
+END
+
+cat > sub/subfoo.c <<'END'
+#include "sub/subfoo.h"
+int subfoo (void) { return 0; }
+END
+
+echo '/* empty */' > src/sub2/sub2foo.h
+
+cat > sub/subfoo.h <<'END'
+#include <stdio.h>
+extern int subfoo (void);
+END
+
+cat > src/baz.c <<'END'
+#include "baz.h"
+int baz (void) { return 0; }
+END
+
+cat > src/baz.h <<'END'
+extern int baz (void);
+END
+
+cat > src/sub2/sub2foo.c <<'END'
+#include "sub2foo.h"
+int sub2foo (void) { return 0; }
+END
+
+test $depcomp_with_libtool = no || libtoolize \
+  || fatal_ "libtoolize failed"
+$ACLOCAL && $AUTOCONF && $AUTOMAKE -a \
+  || fatal_ "autotools failed"
+test -f build-aux/depcomp \
+  || fatal_ "depcomp script not installed"
+
+# To offer extra coverage for the depmodes (like "aix" of "hp2") where the
+# name of the compiler-generated depfiles can depend on whether libtool is
+# in use *and* on which kind of libraries libtool is building (static,
+# shared, or both), we would like to run the libtool-oriented tests thrice:
+# once after having run configure with the '--disable-shared' option, once
+# after having run it with the '--enable-shared' options, and once by
+# leaving it to configure to automatically select which kind of library (or
+# libraries) to build.
+#
+# But doing such three-fold checks unconditionally for all the depmodes
+# would slow down the already too slow libtool tests unacceptably (up to a
+# 150-200% factor), with no real gain in coverage for most of the depmodes.
+# So, since the depmodes that would benefit from the extra tests are never
+# forced to configure in out tests below, but can only be automatically
+# selected by '--enable-dependency-tracking', we make this threefold check
+# only in this later case.
+
+case $depmode in
+  auto)
+    if test $depcomp_with_libtool = no; then
+      plan_ 28
+      do_all_tests () { do_test; }
+    else
+      plan_ 84
+      do_all_tests ()
+      {
+        do_test default
+        do_test noshared --disable-shared
+        do_test nostatic --disable-static
+      }
+    fi
+    displayed_depmode='..*' # At least one character long.
+    cfg_deptrack=--enable-dependency-tracking ;;
+  disabled)
+    plan_ 28
+    do_all_tests () { do_test; }
+    displayed_depmode=none
+    cfg_deptrack=--disable-dependency-tracking ;;
+  *)
+    plan_ 28
+    do_all_tests () { do_test; }
+    displayed_depmode="(cached) $depmode"
+    cfg_deptrack="$cachevar=$depmode"
+    # Sanity check: ensure the cache variable we force is truly
+    # used by configure.
+    $FGREP $cachevar configure \
+      || fatal_ "configure lacks required cache variable '$cachevar'";;
+esac
+
+cd_top
+
+do_test ()
+{
+  cd_top
+  if test $vpath = no; then
+    pfx="in-tree build"
+  else
+    pfx="$vpath VPATH"
+  fi
+  if test $# -gt 0; then
+    subdir=$1; shift
+    pfx="$pfx, $subdir"
+    test -d $subdir || mkdir $subdir || fatal_ "creating directory $subdir"
+    cd $subdir
+  fi
+  pfx="[$pfx]"
+  case $vpath in
+    simple)
+      mkdir -p vpath-simple/build
+      cd vpath-simple/build
+      setup_srcdir ..
+      ;;
+    long)
+      mkdir -p vpath-long/src vpath-long/wrk
+      cd vpath-long/wrk
+      setup_srcdir ../src/$longpath
+      ;;
+    absolute)
+      mkdir -p vpath-abs/build
+      cd vpath-abs/build
+      absdir="`(cd .. && pwd)`" || fatal_ "getting absolute directory"
+      setup_srcdir "$absdir/vpath-abs"
+      unset absdir
+      ;;
+    no)
+      mkdir intree
+      cd intree
+      setup_srcdir .
+      ;;
+    *)
+      fatal_ "invalid value '$vpath' for variable \$vpath"
+      ;;
+  esac
+
+  command_ok_ \
+    "$pfx configure" \
+    "$srcdir/configure" $cfg_deptrack ${1+"$@"} >stdout
+  cat stdout
+
+  command_ok_ \
+    "$pfx right depmode selected" \
+    grep "^checking dependency style .*\.\.\. $displayed_depmode$" stdout
+  rm -f stdout
+
+  command_ok_ "$pfx simple make" make_ok
+  # Some bugs in VPATH builds only kick in during a rebuild.
+  command_ok_ "$pfx clean & rebuild" eval '$MAKE clean && make_ok'
+
+  if test $depmode = disabled; then
+      command_ok_ "$pfx no dependency files generated" check_no_depfiles
+      r=ok \
+        && grep "[ $tab]depmode=none" Makefile \
+        && rewrite "$srcdir"/src/sub2/sub2foo.h echo 'choke me' \
+        && delete "$srcdir"/sub/subfoo.h \
+        && make_ok \
+        || r='not ok'
+      result_ "$r" "$pfx dependency tracking is truly disabled"
+  elif grep "[ $tab]depmode=none" Makefile; then
+    skip_row_ 2 -r "automatic dependency tracking couldn't be activated"
+  else
+    command_ok_ "$pfx generated $po files look correct" $MAKE grep-test
+    r=ok \
+      && : "Some checks in the subdir." \
+      && $sleep \
+      && : "Ensure rebuild rules really kick in." \
+      && rewrite "$srcdir"/src/sub2/sub2foo.h echo 'choke me' \
+      && cd src \
+      && not $MAKE  \
+      && cd .. \
+      && : "Ensure the deleted header bug is fixed." \
+      && delete "$srcdir"/src/sub2/sub2foo.h \
+      && edit "$srcdir"/src/sub2/sub2foo.c -e 1d \
+      && cd src \
+      && make_ok \
+      && : "Now do similar checks for the parent directory." \
+      && cd .. \
+      && rewrite "$srcdir"/sub/subfoo.h echo 'choke me' \
+      && not $MAKE \
+      && delete "$srcdir"/sub/subfoo.h \
+      && edit "$srcdir"/sub/subfoo.c -e 1d \
+      && edit "$srcdir"/foo.h -e 2d \
+      && make_ok \
+      || r='not ok'
+    result_ "$r" "$pfx dependency tracking works"
+  fi
+
+  command_ok_ "$pfx make distclean" check_distclean
+  cd_top
+}
+
+for vpath in no simple long absolute; do
+  do_all_tests
+done
+
+:
index d5b6c78..f456c47 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure depcomp is installed and found properly
-# when required for multiple directories
+# when required for multiple directories.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -44,7 +42,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 
 # There used to be a bug where this was created in the first subdir with C
-# sources in it instead of in $top_srcdir or $ac_auxdir
+# sources in it instead of in $top_srcdir or $ac_auxdir.
 test -f depcomp
 
 :
diff --git a/tests/depcomp10.test b/tests/depcomp10.test
deleted file mode 100755 (executable)
index 0fa6c6a..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-#! /bin/sh
-# Copyright (C) 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/>.
-
-# hp depmode should work with GNU make in VPATH mode (bug similar to
-# depcomp9.test).
-# For automake bug#8473.
-
-# Here's the bug: hp depmode will prefix VPATH to the object file name,
-# thus the second gmake will invoke depcomp with object='../../src/foo.o',
-# causing errors such as (broken on multiple lines for clarity):
-#   cpp: "", line 0: error 4066: Cannot create
-#        "../../gllib/.deps/nonblocking.TPo" file for
-#        "-M../../gllib/.deps/nonblocking.TPo" option.
-#        (No such file or directory[errno=2])
-
-required=GNUmake
-. ./defs || Exit 1
-
-mkdir src src/sub build
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_CONFIG_FILES([src/Makefile])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-SUBDIRS = src
-END
-
-cat > src/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c foo.h sub/subfoo.c
-END
-
-cat > src/foo.h <<EOF
-extern int subfoo (void);
-EOF
-
-cat >src/foo.c <<EOF
-#include "foo.h"
-int main (void)
-{
-  return subfoo ();
-}
-EOF
-
-cat >src/sub/subfoo.c <<EOF
-#include "foo.h"
-int subfoo (void)
-{
-  return 0;
-}
-EOF
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-cd build
-../configure am_cv_CC_dependencies_compiler_type=hp
-# Do not error out with the first make, as the forced 'hp' depmode might
-# not actually work, but we have overridden the _AM_DEPENDENCIES tests.
-$MAKE || Exit 77
-
-# We must clean and rebuild, as the actual error only happens the second
-# time the objects are built because 'depcomp' has silently messed up the
-# .Po files the first time.
-$MAKE clean
-
-$MAKE >out 2>&1 || { cat out; Exit 1; }
-cat out
-grep 'src/[._]deps' out && Exit 1
-
-:
index e8e4a67..2bceaaf 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # Test to make sure that depcomp is not used when it's not installed
 # From Pavel Roskin.
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([subdir/Makefile])
 AC_PROG_CC
@@ -42,13 +40,11 @@ END
 
 : > subdir/foo.c
 
-# Ignore user CFLAGS.
-unset CFLAGS || :
-
 $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 ./configure 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
 test ! -s stderr
 
 :
diff --git a/tests/depcomp6.test b/tests/depcomp6.test
deleted file mode 100755 (executable)
index ea15e20..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2006, 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/>.
-
-# Check dependency generation (non libtool case).
-
-. ./defs || Exit 1
-
-set -e
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_PROG_RANLIB
-AC_CONFIG_FILES([sub2/Makefile])
-AC_OUTPUT
-END
-
-mkdir sub sub2 sub2/sub3
-
-cat >Makefile.am <<'END'
-SUBDIRS = sub2
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c sub/bar.c foo.h sub/bar.h
-foo_LDADD = sub2/libbaz.a
-END
-
-cat >sub2/Makefile.am <<'END'
-AUTOMAKE_OPTIONS = subdir-objects
-noinst_LIBRARIES = libbaz.a
-libbaz_a_SOURCES = baz.c sub3/ba3.c baz.h sub3/ba3.h
-END
-
-cat >foo.c <<'END'
-#include "foo.h"
-#include "sub2/baz.h"
-#include <stdlib.h>
-int main (void) { printf ("foo"); return bar () + baz (); }
-END
-
-cat >foo.h <<'END'
-#include <stdio.h>
-#include "sub/bar.h"
-END
-
-cat >sub/bar.c <<'END'
-#include "sub/bar.h"
-int bar (void) { return 0; }
-END
-
-touch sub2/sub3/ba3.h
-
-cat >sub/bar.h <<'END'
-#include <stdio.h>
-extern int bar (void);
-END
-
-cat >sub2/baz.c <<'END'
-#include "baz.h"
-int baz (void) { return 0; }
-END
-
-cat >sub2/baz.h <<'END'
-extern int baz (void);
-END
-
-cat >sub2/sub3/ba3.c <<'END'
-#include "ba3.h"
-int ba3 (void) { return 0; }
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-./configure --enable-dependency-tracking
-$MAKE
-
-# Check that dependency tracking works.
-if grep 'depmode=none' Makefile; then
-  Exit 77
-fi
-
-cd sub2
-$sleep
-echo 'choke me' > sub3/ba3.h
-# Do not use `$MAKE && Exit 1' here, since even relatively-recent
-# versions of the BSD shell wrongly exit when the `errexit' shell
-# flag is active if a command within "&&" fails inside a compound
-# statement.
-if $MAKE; then Exit 1; else :; fi
-
-# Ensure the deleted header bug is fixed.
-rm -f sub3/ba3.h
-sed 1d sub3/ba3.c >sub3/ba3.t
-mv -f sub3/ba3.t sub3/ba3.c
-$MAKE
-
-:
diff --git a/tests/depcomp7.test b/tests/depcomp7.test
deleted file mode 100755 (executable)
index 47f09fc..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2006, 2007, 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/>.
-
-# Check dependency generation (libtool case).
-
-required='libtoolize'
-. ./defs || Exit 1
-
-set -e
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AM_PROG_LIBTOOL
-AC_CONFIG_FILES([sub2/Makefile])
-AC_OUTPUT
-END
-
-mkdir sub sub2 sub2/sub3
-
-cat >Makefile.am <<'END'
-SUBDIRS = sub2
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c sub/bar.c foo.h sub/bar.h
-foo_LDADD = sub2/libbaz.la
-END
-
-cat >sub2/Makefile.am <<'END'
-AUTOMAKE_OPTIONS = subdir-objects
-noinst_LTLIBRARIES = libbaz.la
-libbaz_la_SOURCES = baz.c sub3/ba3.c baz.h sub3/ba3.h
-END
-
-cat >foo.c <<'END'
-#include "foo.h"
-#include "sub2/baz.h"
-#include <stdlib.h>
-int main (void) { printf ("foo"); return bar () + baz (); }
-END
-
-cat >foo.h <<'END'
-#include <stdio.h>
-#include "sub/bar.h"
-END
-
-cat >sub/bar.c <<'END'
-#include "sub/bar.h"
-int bar (void) { return 0; }
-END
-
-echo 'extern int x;' > sub2/sub3/ba3.h
-
-cat >sub/bar.h <<'END'
-#include <stdio.h>
-extern int bar (void);
-END
-
-cat >sub2/baz.c <<'END'
-#include "baz.h"
-int baz (void) { return 0; }
-END
-
-cat >sub2/baz.h <<'END'
-extern int baz (void);
-END
-
-cat >sub2/sub3/ba3.in <<'END'
-#include "ba3.h"
-int ba3 (void) { return 0; }
-END
-
-libtoolize
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-st=0
-for staticshared in --disable-shared "" --disable-static; do
-
-  cp sub2/sub3/ba3.in sub2/sub3/ba3.c
-  ./configure --enable-dependency-tracking $staticshared
-  $MAKE
-
-  # If we cannot enable dependency tracking, perform only the most basic
-  # checks, and don't consider this test to be PASSed but SKIPped, because
-  # the main purpose of this test is exposing the depmode features.
-  if grep 'depmode=none' Makefile; then
-    st=77
-  else
-    cd sub2
-    $sleep
-    echo 'choke me' > sub3/ba3.h
-    # Do not use `$MAKE && Exit 1' here, since even relatively-recent
-    # versions of the BSD shell wrongly exit when the `errexit' shell
-    # flag is active if a command within "&&" fails inside a compound
-    # statement.
-    if $MAKE; then Exit 1; else :; fi
-
-    # Ensure the deleted header bug is fixed.
-    rm -f sub3/ba3.h
-    sed 1d sub3/ba3.in >sub3/ba3.c
-    $MAKE
-    cd ..
-  fi
-
-  $MAKE distclean
-  test ! -f sub2/sub3/ba3.u
-  test ! -f sub2/sub3/ba3.d
-
-  echo 'extern int x;' > sub2/sub3/ba3.h
-
-done
-
-Exit $st
index b94cf1d..222797d 100755 (executable)
 # Keep this in sync with sister test `depcomp8b.test', which checks the
 # same thing for libtool objects.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 #x AM_PROG_CC_C_O
@@ -48,7 +47,7 @@ END
 
 $ACLOCAL
 $AUTOMAKE -a
-grep include Makefile.in # for debugging
+grep include Makefile.in # For debugging.
 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
 grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
 grep 'include.*/\./\$(DEPDIR)' Makefile.in && Exit 1
@@ -57,7 +56,7 @@ $AUTOCONF
 # Don't reject slower dependency extractors, for better coverage.
 ./configure --enable-dependency-tracking
 $MAKE
-./zardoz
+cross_compiling || ./zardoz
 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
 
 # Try again with subdir-objects option.
@@ -68,7 +67,7 @@ echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
 
 $ACLOCAL
 $AUTOMAKE -a
-grep include Makefile.in # for debugging
+grep include Makefile.in # For debugging.
 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
 grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
 $EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && Exit 1
@@ -77,7 +76,7 @@ $AUTOCONF
 # Don't reject slower dependency extractors, for better coverage.
 ./configure --enable-dependency-tracking
 $MAKE
-./zardoz
+cross_compiling || ./zardoz
 DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
 
 :
index 715d951..d4ee9c3 100755 (executable)
 # Keep this in sync with sister test `depcomp8a.test', which checks the
 # same thing for non-libtool objects.
 
-required=libtoolize
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 #x AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
@@ -44,7 +43,7 @@ libtoolize
 
 $ACLOCAL
 $AUTOMAKE -a
-grep include Makefile.in # for debugging
+grep include Makefile.in # For debugging.
 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
 grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
 grep 'include.*/\./\$(DEPDIR)' Makefile.in && Exit 1
@@ -63,7 +62,7 @@ echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
 
 $ACLOCAL
 $AUTOMAKE -a
-grep include Makefile.in # for debugging
+grep include Makefile.in # For debugging.
 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
 grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
 $EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && Exit 1
diff --git a/tests/depcomp9.test b/tests/depcomp9.test
deleted file mode 100755 (executable)
index 9972c3d..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#! /bin/sh
-# Copyright (C) 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/>.
-
-# makedepend should work in VPATH mode.
-
-# Here's the bug: makedepend will prefix VPATH to the object file name,
-# thus the second make will invoke depcomp with object='../../src/foo.o',
-# causing errors such as:
-# touch: cannot touch `../../src/.deps/foo.TPo': No such file or directory
-# makedepend: error:  cannot open "../../src/.deps/foo.TPo"
-# ../../depcomp: line 560: ../../src/.deps/foo.TPo: No such file or directory
-
-# We include subfoo only to be sure that we don't remove too much
-# from the object file name.
-
-required='makedepend'
-. ./defs || Exit 1
-
-mkdir src src/sub build
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_CONFIG_FILES([src/Makefile])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-SUBDIRS = src
-END
-
-cat > src/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS = foo
-foo_SOURCES = foo.c foo.h sub/subfoo.c
-END
-
-cat > src/foo.h <<EOF
-extern int subfoo (void);
-EOF
-
-cat >src/foo.c <<EOF
-#include "foo.h"
-int main (void)
-{
-  return subfoo ();
-}
-EOF
-
-cat >src/sub/subfoo.c <<EOF
-#include "foo.h"
-int subfoo (void)
-{
-  return 0;
-}
-EOF
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-cd build
-../configure am_cv_CC_dependencies_compiler_type=makedepend
-
-# Do not error out with the first make, as the forced 'makedepend'
-# depmode might not actually work, but we have overridden the
-# _AM_DEPENDENCIES tests.
-$MAKE || Exit 77
-
-# We must clean and rebuild, as the actual error only happens the second
-# time the objects are built because 'makedepend' has silently messed up
-# the .Po files the first time.
-$MAKE clean
-
-$MAKE >out 2>&1 || { cat out; Exit 1; }
-cat out
-grep 'src/[._]deps' out && Exit 1
-
-:
index f36eb47..d5644de 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
 # Make sure depcomp is found for the distribution.
 # From Eric Magnien.
 
+required=cc
 . ./defs || Exit 1
 
 rm -f configure.in
 
 mkdir config
 for i in *; do
-   if test $i != "config"; then
-      mv $i config
+   if test "$i" != "config"; then
+      mv -f "$i" config
    fi
 done
 
-cat > configure.in << 'END'
-AC_INIT(subdir/foo.c)
-AC_CONFIG_AUX_DIR(config)
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE
 AC_PROG_CC
-AC_OUTPUT(subdir/Makefile Makefile)
+AC_CONFIG_FILES([subdir/Makefile Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 SUBDIRS = subdir
+check-local: test1 test2
+.PHONY: test1 test2
+test1:
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]config/depcomp '
+test2: distdir
+       ls -l $(distdir)/*
+       test -f $(distdir)/config/depcomp
 END
 
 mkdir subdir
-: > subdir/foo.c
+cat > subdir/foo.c << 'END'
+int main(void)
+{
+  return 0;
+}
+END
 
 cat > subdir/Makefile.am << 'END'
 bin_PROGRAMS = foo
 foo_SOURCES = foo.c
 END
 
-set -e
-
 $ACLOCAL
-$AUTOMAKE --add-missing
 $AUTOCONF
-grep config/depcomp Makefile.in
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+:
index 5714c98..98b1307 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1999, 2001, 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2001, 2002, 2004, 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
@@ -20,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >> configure.in
 
 cat > Makefile.am << 'END'
index f12e460..1c7b297 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1997, 1998, 2000, 2001, 2002, 2010 Free Software
+# Copyright (C) 1997, 1998, 2000, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_SUBST(DEPS)
index 451c018..1dd782d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >> configure.in
 
 $ACLOCAL
 
 headers=
-for header in one.h two.h three.h four.h five.h six.h
-do
-    headers="$headers $header"
-    cat > Makefile.am << END
-bin_PROGRAMS = fred
-fred_SOURCES = fred1.c $headers
+for header in one.h two.h three.h four.h five.h six.h; do
+  headers="$headers $header"
+  unindent > Makefile.am << END
+    bin_PROGRAMS = fred
+    fred_SOURCES = fred1.c $headers
 END
-
-    $AUTOMAKE
-
-    test 1 = `grep '^@AMDEP_TRUE@@am__include@' Makefile.in | wc -l`
+  $AUTOMAKE
+  test 1 = `grep '^@AMDEP_TRUE@@am__include@' Makefile.in | wc -l`
 done
+
+:
index 0d9be3b..a2fe551 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2011, 2012 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
 # Check that _AM_OUTPUT_DEPENDENCY_COMMANDS works with eval-style
 # quoting in $CONFIG_FILES, done by newer Autoconf.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << END
 AC_PROG_CC
 AC_OUTPUT
@@ -75,4 +74,5 @@ do
     test -d $depdir || Exit 1
   fi
 done
+
 :
index de2adf9..57a7278 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2011, 2012 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << END
 AC_PROG_CC
 AC_OUTPUT
@@ -44,4 +42,5 @@ $AUTOCONF
 }
 cat stderr >&2
 grep shift stderr && Exit 1
+
 :
diff --git a/tests/deprecated-acinit.test b/tests/deprecated-acinit.test
new file mode 100755 (executable)
index 0000000..7908bb6
--- /dev/null
@@ -0,0 +1,52 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that automake and autoconf complain about an old-style AC_INIT
+# call used with a new-style AM_AUTOMAKE_INIT call.
+
+. ./defs || Exit 1
+
+: > Makefile.am
+
+# We'll need a proper aclocal.m4, but aclocal is expected to fail
+# later, so get and store it now.
+$ACLOCAL
+mv aclocal.m4 aclocal-m4.sav
+
+errmsg='AC_INIT should be called with package and version argument'
+
+for ac_init in AC_INIT 'AC_INIT([Makefile.am])'; do
+  for am_init_automake in AM_INIT_AUTOMAKE 'AM_INIT_AUTOMAKE([1.11])'; do
+    rm -rf autom4te*.cache aclocal.m4
+    unindent > configure.in <<END
+        $ac_init
+        $am_init_automake
+        AC_CONFIG_FILES([Makefile])
+END
+    cat configure.in # For debugging.
+    $ACLOCAL 2>stderr && { cat stderr >&2; Exit 1; }
+    cat stderr >&2
+    grep "^configure\\.in:.* $errmsg" stderr
+    cp aclocal-m4.sav aclocal.m4
+    $AUTOCONF 2>stderr && { cat stderr >&2; Exit 1; }
+    cat stderr >&2
+    grep "^configure\\.in:.* $errmsg" stderr
+    AUTOMAKE_fails
+    grep "^configure\\.in:.* $errmsg" stderr
+  done
+done
+
+:
index 951a4b1..8fefbc2 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2011, 2012 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
@@ -23,8 +23,6 @@ required='ro-dir'
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AC_OUTPUT
 EOF
@@ -48,4 +46,5 @@ $AUTOCONF
 $AUTOMAKE -a
 ./configure
 $MAKE distcheck && Exit 1
+
 :
similarity index 59%
rename from tests/acoutpt2.test
rename to tests/dirlist-abspath.test
index 2d0743c..b48ad8c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test for bug reported by Eric Magnien.
+# Check use of absolute paths in dirlist.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
+mkdir acdir-more sub sub/acdir
+echo "`pwd`/acdir-more" > sub/acdir/dirlist
 
-cat > configure.in <<END
-AC_INIT([$me], [1.0])
-AM_INIT_AUTOMAKE
-AC_OUTPUT([subdir/Makefile subdir/foo Makefile foo], [true])
-END
+echo 'AC_DEFUN([AM_FOO], [foo-foo--foo])' > acdir-more/foo.m4
 
-mkdir subdir
+cd sub
 
-: > Makefile.am
-: > subdir/Makefile.am
-: > foo.in
-: > subdir/foo.in
+cat > configure.in <<EOF
+AC_INIT([$me], [1.0])
+AM_FOO
+EOF
 
-$ACLOCAL
-$AUTOMAKE
+$ACLOCAL --system-acdir acdir
+$AUTOCONF
 
-count=`$FGREP foo.in Makefile.in | wc -l`
-test $count -eq 2
+# Only -I directories are subject to file inclusion.
+grep m4_include aclocal.m4 && Exit 1
 
-# This ought to work as well.
-$ACLOCAL
-$AUTOMAKE --add-missing --force-missing
+grep 'foo-foo--foo' configure
 
 :
index cfa1ed9..99b0f1d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check dirlist support.
-# This test relies on m4/dirlist
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<EOF
 AC_INIT
 AM_INIT_GUILE_MODULE
 EOF
 
-mkdir dirlist-test
+mkdir acdir dirlist-test
+echo ./dirlist-test > acdir/dirlist
 
 cat >dirlist-test/dirlist-check.m4 <<'END'
 AC_DEFUN([AM_INIT_GUILE_MODULE],[
@@ -41,12 +39,12 @@ cat >dirlist-test/init.m4 <<EOF
 AC_DEFUN([AM_INIT_AUTOMAKE], [I should not be included])
 EOF
 
-$ACLOCAL
+$ACLOCAL --system-acdir acdir
 $AUTOCONF
 
-# there should be no m4_include in aclocal.m4, even tho m4/dirlist contains
-# `./dirlist-test' as a relative directory.  Only -I directories are subject
-# to file inclusion.
+# There should be no m4_include in aclocal.m4, even though m4/dirlist
+# contains `./dirlist-test' as a relative directory.  Only -I directories
+# are subject to file inclusion.
 grep m4_include aclocal.m4 && Exit 1
 
 grep 'GUILE-VERSION' configure
index 5f49614..4b7df2f 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2006, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check dirlist globbing support.
-# This test relies on m4/dirlist
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<EOF
 AC_INIT
 AM_INIT_GUILE_MODULE
@@ -43,12 +41,18 @@ AC_DEFUN([AM_FOO_BAR],[
 : foo bar baz
 ])
 END
-$ACLOCAL
+
+mkdir my-acdir
+cat > my-acdir/dirlist <<'END'
+dirlist2*-test
+END
+
+$ACLOCAL --system-acdir my-acdir
 $AUTOCONF
 
-# there should be no m4_include in aclocal.m4, even tho m4/dirlist contains
-# `./dirlist-test' as a relative directory.  Only -I directories are subject
-# to file inclusion.
+# There should be no m4_include in aclocal.m4, even though m4/dirlist
+# contains `./dirlist-test' as a relative directory.  Only -I directories
+# are subject to file inclusion.
 grep m4_include aclocal.m4 && Exit 1
 
 grep 'GUILE-VERSION' configure
index 0e4faa3..5108265 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2000, 2001, 2002, 2010 Free Software
+# Copyright (C) 1996, 1997, 2000, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -21,6 +21,7 @@
 
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
+AM_PROG_AR
 AC_PROG_CC
 AC_LIBOBJ([fsusage])
 AC_OUTPUT
@@ -33,10 +34,11 @@ libtu_a_LIBADD = @LIBOBJS@
 END
 
 : > fsusage.c
+: > ar-lib
 
 $ACLOCAL
 AUTOMAKE_fails
 
 grep 'automatically discovered.*fsusage\.c.*explicitly mentioned' stderr
 
-Exit 0
+:
diff --git a/tests/dist-auxdir-many-subdirs.test b/tests/dist-auxdir-many-subdirs.test
new file mode 100755 (executable)
index 0000000..6078f04
--- /dev/null
@@ -0,0 +1,140 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# It should be legitimate for many subdir Makefiles to require the
+# same config-aux files.
+
+am_create_testdir=empty
+am_parallel_tests=yes
+required=cc
+. ./defs || Exit 1
+
+count=0
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+
+# Usage: do_check [--add-missing] [CONFIG-AUXDIR-PATH=.]
+do_check ()
+{
+  case $1 in
+    -a|--add-missing) add_missing=yes; shift;;
+    *) add_missing=no;;
+  esac
+  auxdir=${1-.}
+
+  count=`expr $count + 1`
+  mkdir T$count.d
+  cd T$count.d
+
+  distdir=$me-$count
+  unindent > configure.in << END
+    AC_INIT([$me], [$count])
+    AC_CONFIG_AUX_DIR([$auxdir])
+    AM_INIT_AUTOMAKE([parallel-tests])
+    AC_PROG_CC
+    # We don't want to require python or emcas in this test, so
+    # the tricks below.
+    AM_PATH_PYTHON([2.2], [], [:])
+    EMACS=no; AM_PATH_LISPDIR
+    AC_CONFIG_FILES([Makefile])
+END
+
+  unindent > Makefile.stub <<'END'
+    ## For depcomp.
+    bin_PROGRAMS = foo
+    foo_SOURCES = foo.c
+    ## For py-compile.
+    python_PYTHON = bar.py
+    ## For elisp-comp.
+    lisp_LISP = baz.el
+    ## For test-driver.
+    TESTS =
+END
+
+  required_files='
+    install-sh
+    missing
+    depcomp
+    py-compile
+    elisp-comp
+    test-driver
+  '
+
+  echo "SUBDIRS =" > Makefile.am
+
+  suffixes='0 1 2 3 4 5 6 7 8 9'
+
+  for x in $suffixes; do
+    mkdir sub$x
+    echo "SUBDIRS += sub$x" >> Makefile.am
+    echo "AC_CONFIG_FILES([sub$x/Makefile])" >> configure.in
+    cp Makefile.stub sub$x/Makefile.am
+    echo 'int main (void) { return 0; }' > sub$x/foo.c
+    touch sub$x/bar.py sub$x/baz.el
+  done
+  echo AC_OUTPUT >> configure.in
+
+  $ACLOCAL
+  $AUTOCONF
+
+  "$am_scriptdir"/install-sh -d $auxdir \
+    || fatal_ "creating directory \`$auxdir' with install-sh"
+  if test $add_missing = yes; then
+    $AUTOMAKE -a --copy
+    for f in $required_files; do
+      test -f $auxdir/$f
+      # To ensure that if a auxiliary file is required and distributed
+      # by many Makefiles, the "dist" rule won't try to copy it multiple
+      # times in $(distdir).
+      chmod a-w $auxdir/$f
+    done
+  else
+    for f in $required_files; do
+      cp "$am_scriptdir"/$f $auxdir/$f \
+        || fatal_ "faild to fetch auxiliary script \`$f'"
+      # See comments above.
+      chmod a-w $auxdir/$f
+    done
+    $AUTOMAKE
+  fi
+
+  for vpath in : false; do
+    if $vpath; then
+      mkdir build
+      cd build
+      srcdir=..
+    else
+      srcdir=.
+    fi
+    $srcdir/configure
+    $MAKE distdir
+    find $distdir # For debugging.
+    for f in $required_files; do
+      test -f $distdir/$auxdir/$f
+    done
+    cd $srcdir
+  done
+
+  cd "$ocwd" || fatal_ "cannot chdir back to '$ocwd'"
+}
+
+do_check .
+do_check --add-missing .
+do_check build-aux
+do_check --add-missing build-aux
+do_check a/b/c
+do_check --add-missing a/b/c
+
+:
index 08daa6c..77e6ffb 100755 (executable)
@@ -22,8 +22,6 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([sub])
index 2776a25..d04b6c9 100755 (executable)
@@ -22,8 +22,6 @@
 am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 i=0
 for auxdir in build-aux ''; do
 
@@ -61,8 +59,8 @@ END
 END
 
   mkdir subdir
-  : > subdir/Makefile.am
-  
+  echo > subdir/Makefile.am # `echo', not `:', for Solaris /bin/sh.
+
   test -z "$auxdir" || mkdir "$auxdir" || Exit 99
 
   if test -z "$auxdir"; then
@@ -81,7 +79,8 @@ END
   grep "^configure\\.in:6:.* required file.*$auxdir_rx/zardoz"    stderr
 
   touch $auxdir/foo.txt $auxdir/bar.sh $auxdir/zardoz
-  cp "$testsrcdir"/../lib/missing "$testsrcdir"/../lib/install-sh $auxdir
+  cp "$am_scriptdir"/missing "$am_scriptdir"/install-sh $auxdir \
+    || fatal_ "fetching auxiliary scripts \`missing' and \`install-sh'"
   $AUTOMAKE
   ./configure
   $MAKE test
diff --git a/tests/dist-formats.tap b/tests/dist-formats.tap
new file mode 100755 (executable)
index 0000000..612af54
--- /dev/null
@@ -0,0 +1,451 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Check support for different compression formats used by distribution
+# archives.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+plan_ 70
+
+# ---------------------------------------------------- #
+#  Common and/or auxiliary subroutines and variables.  #
+# ---------------------------------------------------- #
+
+ocwd=`pwd` || fatal_ "obtaining current working directory"
+
+TAR='' && unset TAR
+
+# Create common aclocal.m4 file, for later tests.
+mkdir setup \
+  && cd setup \
+  && echo 'AC_INIT([x], [0]) AM_INIT_AUTOMAKE' > configure.ac \
+  && $ACLOCAL \
+  && mv aclocal.m4 .. \
+  && cd .. \
+  && rm -rf setup \
+  || fatal_ "creating common aclocal.m4 file"
+
+# Some make implementations (e.g., HP-UX) don't grok `-j', some require
+# no space between `-j' and the number of jobs (e.g., older GNU make
+# versions), and some *do* require a space between `-j' and the number
+# of jobs (e.g., Solaris dmake).  We need a runtime test to see what
+# works.
+for MAKE_j4 in "$MAKE -j4" "$MAKE -j 4" false; do
+  echo all: | $MAKE_j4 -f - && break
+  : For shells with buggy 'set -e'.
+done
+
+# Set variables `$compressor' and `$suffix'.
+setup_vars_for_compression_format ()
+{
+  suffix=NONE compressor=NONE
+  case $1 in
+    gzip) suffix=tar.gz  compressor=gzip     ;;
+    tarZ) suffix=tar.Z   compressor=compress ;;
+    lzip) suffix=tar.lz  compressor=lzip     ;;
+      xz) suffix=tar.xz  compressor=xz       ;;
+   bzip2) suffix=tar.bz2 compressor=bzip2    ;;
+     zip) suffix=zip     compressor=zip      ;;
+    shar) suffix=shar.gz compressor=shar     ;;
+       *) fatal_ "invalid compression format '$1'";;
+  esac
+}
+
+all_compression_formats='gzip tarZ lzip xz bzip2 zip shar'
+
+all_compressors=`
+  for x in $all_compression_formats; do
+    setup_vars_for_compression_format $x
+    echo $compressor
+  done | tr "$nl" ' '`
+echo All compressors: $all_compressors
+
+missing_compressors=`
+  for c in $all_compressors; do
+    case $c in
+      # Assume gzip(1) is available on every reasonable portability target.
+      gzip)
+        continue
+        ;;
+      # On Cygwin, as of 9/2/2012, 'compress' is provided by sharutils
+      # and is just a dummy script that is not able to actually compress
+      # (it can only decompress).  So, check that the 'compress' program
+      # is actually able to compress input.
+      # Note that, at least on GNU/Linux, 'compress' does (and is
+      # documented to) exit with status 2 if the output is larger than
+      # the input after (attempted) compression; so we need to pass it
+      # an input that it can actually reduce in size when compressing.
+      compress)
+        for x in 1 2 3 4 5 6 7 8; do
+          echo aaaaaaaaaaaaaaa
+        done | $c -c >/dev/null && continue
+        : For shells with busted 'set -e'.
+        ;;
+      *)
+        $c --version </dev/null >&2 && continue
+        : For shells with busted 'set -e'.
+        ;;
+    esac
+    echo $c
+  done | tr "$nl" ' '`
+echo Missing compressors: $missing_compressors
+
+have_compressor ()
+{
+  case " $missing_compressors " in *\ $1\ *) false;; *) : ;; esac
+}
+
+have_all_compressors ()
+{
+  test -z "$missing_compressors"
+}
+
+start_subtest ()
+{
+  name=$1; shift
+  test -n "$name" || fatal_ "start_subtest: no subtest name given"
+  if test $# -gt 0; then
+    eval "$@" || fatal_ "start_subtest: evaluating assignments"
+  fi
+  ac_opts=`echo $ac_opts | tr ',' ' '`
+  am_opts=`echo $am_opts | tr ',' ' '`
+  mkdir "$name"
+  cd "$name"
+  unindent > configure.in <<END
+    AC_INIT([$name], [1.0])
+    AM_INIT_AUTOMAKE([$ac_opts])
+    AC_CONFIG_FILES([Makefile])
+    AC_OUTPUT
+END
+  echo "AUTOMAKE_OPTIONS = $am_opts" > Makefile.am
+  # It is imperative that aclocal.m4 is copied after configure.in has
+  # been created, to avoid a spurious trigger of the automatic remake
+  # rules for configure & co.
+  cp "$ocwd"/aclocal.m4 \
+     "$am_scriptdir"/missing \
+     "$am_scriptdir"/install-sh \
+     .
+}
+
+end_subtest ()
+{
+  unset name; unset ac_opts; unset am_opts;
+  cd "$ocwd" || fatal_ "couldn't chdir back to '$ocwd'"
+}
+
+command_ok_if_have_compressor ()
+{
+  if have_compressor "$compressor"; then
+    command_ok_ "$@"
+  else
+    skip_ -r "'$compressor' not available" "$1"
+  fi
+}
+
+can_compress ()
+{
+  test $# -eq 2 || fatal_ "can_compress: bad number of arguments"
+  tarname=$1 format=$2
+  setup_vars_for_compression_format "$format"
+
+  command_ok_ "'dist-$format' target always created" $MAKE -n dist-$format
+
+  command_ok_if_have_compressor "'make dist-$format' work by default" \
+    eval '
+      rm -rf *$tarname* \
+        && make dist-$format \
+        && test -f $tarname-1.0.$suffix \
+        && ls -l *$tarname* \
+        && test "`ls *$tarname*`" = $tarname-1.0.$suffix'
+
+  unset suffix compressor format tarname
+}
+
+# ---------------------------------------- #
+#  Defaults layout of the dist-* targets.  #
+# ---------------------------------------- #
+
+start_subtest defaults
+
+command_ok_ "default [automake]"        $AUTOMAKE
+command_ok_ "default [autoconf]"        $AUTOCONF
+command_ok_ "default [configure]"       ./configure
+command_ok_ "default [make distcheck]"  $MAKE distcheck
+
+command_ok_ "'make dist' only builds *.tar.gz by default" \
+            test "`ls *defaults*`" = defaults-1.0.tar.gz
+
+rm -rf *defaults*
+
+for fmt in $all_compression_formats; do
+  can_compress defaults $fmt
+done
+unset fmt
+
+end_subtest
+
+# ----------------------------------------------------------- #
+#  Check diagnostic for no-dist-gzip without another dist-*.  #
+# ----------------------------------------------------------- #
+
+nogzip_stderr ()
+{
+  grep "$1:.*no-dist-gzip" stderr \
+    && grep "$1:.* at least one archive format must be enabled" stderr
+}
+
+nogzip_automake_failure ()
+{
+  AUTOMAKE_fails -d "no-dist-gzip ($1) without other formats is an error"
+  command_ok_ "no-dist-gzip ($1) without other formats gives diagnostic" \
+              nogzip_stderr "$2"
+}
+
+start_subtest am-nogz-only am_opts=no-dist-gzip ac_opts=
+nogzip_automake_failure 'am' 'Makefile\.am:1'
+end_subtest
+
+start_subtest ac-nogz-only am_opts= ac_opts=no-dist-gzip
+nogzip_automake_failure 'ac' 'configure\.in:2'
+end_subtest
+
+# ------------------------------------------------- #
+#  Check use of no-dist-gzip with a dist-* option.  #
+# ------------------------------------------------- #
+
+append_to_opt ()
+{
+  var=$1_opts val=$2
+  eval "$var=\${$var:+\"\$$var,\"}\$val" || fatal_ "evaluating \${$var}"
+  unset var val
+}
+
+nogzip ()
+{
+  test $#,$1,$3,$5 = 6,in,and,in \
+    && case $2,$6 in ac,ac|ac,am|am,ac|am,am) :;; *) false;; esac \
+    || fatal_ "nogzip: invalid usage"
+  format=$4 where_dist_nogzip=$2 where_dist_format=$6
+  shift 6
+
+  am_opts= ac_opts=
+  append_to_opt $where_dist_format dist-$format
+  append_to_opt $where_dist_nogzip no-dist-gzip
+  setup_vars_for_compression_format "$format"
+  # Do these before the am_opts and ac_opts variable can be munged
+  # by `start_subtest'.
+  desc=
+  test -n "$am_opts" && desc=${desc:+"$desc "}"am=$am_opts"
+  test -n "$ac_opts" && desc=${desc:+"$desc "}"ac=$ac_opts"
+
+  start_subtest nogzip-$format am_opts=$am_opts ac_opts=$ac_opts
+
+  unindent >> Makefile.am <<END
+    check-ark-name:
+       test \$(DIST_ARCHIVES) = \$(distdir).$suffix
+    check-ark-exists:
+       test -f \$(distdir).$suffix
+    check-no-tar-gz:
+       test ! -f \$(distdir).tar.gz
+END
+
+  command_ok_ "$desc [automake]" $AUTOMAKE
+  command_ok_ "$desc [autoconf]" $AUTOCONF
+  command_ok_ "$desc [configure]" ./configure
+  command_ok_ "$desc [ark-name]" $MAKE check-ark-name
+  command_ok_if_have_compressor "$desc [distcheck]" $MAKE distcheck
+  command_ok_if_have_compressor "$desc [ark-exists]" $MAKE check-ark-exists
+  command_ok_ "$desc [no .tar.gz]"  $MAKE check-no-tar-gz
+
+  unset desc
+
+  end_subtest
+}
+
+#      $1 $2  $3   $4     $5  $6
+nogzip in am  and  bzip2  in  am
+nogzip in ac  and  xz     in  am
+nogzip in am  and  lzip   in  ac
+nogzip in ac  and  tarZ   in  ac
+
+
+# ----------------------------------------------------------- #
+#  The 'dist-gzip' target is created also with no-dist-gzip.  #
+# ----------------------------------------------------------- #
+
+start_subtest dist-gzip-persistence am_opts=no-dist-gzip,dist-xz
+command_ok_ "dist-gzip persistence [automake]"  $AUTOMAKE
+command_ok_ "dist-gzip persistence [autoconf]"  $AUTOCONF
+command_ok_ "dist-gzip persistence [configure]" ./configure
+can_compress dist-gzip-persistence gzip
+end_subtest
+
+
+# ----------------------- #
+#  Parallel compression.  #
+# ----------------------- #
+
+# We only use formats requiring 'gzip', 'bzip2' and 'compress' programs,
+# since there are the most likely to be all found on the great majority
+# of systems.
+
+start_subtest parallel-compression ac_opts=dist-bzip2 am_opts=dist-tarZ
+
+desc=gzip+bzip2+tarZ
+tarname=parallel-compression-1.0
+
+check_tarball ()
+{
+  format=$1
+  setup_vars_for_compression_format $format
+  (
+    tarball=$tarname.$suffix \
+      && test -f $tarball \
+      && mkdir check-$format \
+      && cp $tarball check-$format \
+      && cd check-$format \
+      && $compressor -d $tarball \
+      && tar xvf $tarname.tar \
+      && diff ../Makefile.in $tarname/Makefile.in \
+      && cd .. \
+      && rm -rf check-$format
+   )
+}
+
+command_ok_ "$desc [automake]" $AUTOMAKE
+
+skip_reason=
+have_compressor compress || skip_reason="'compress' not available"
+have_compressor bzip2 || skip_reason="'bzip2' not available"
+if test "$MAKE_j4" = false; then
+  test -z "$skip_reason" || skip_reason="$skip_reason and "
+  skip_reason="${skip_reason}make concurrency unavailable"
+fi
+
+if test -n "$skip_reason"; then
+  skip_row_ 6 -r "$skip_reason" "$desc"
+else
+  command_ok_ "$desc [autoconf]" $AUTOCONF
+  command_ok_ "$desc [configure]" ./configure
+  command_ok_ "$desc [make -j4 dist-all]"  $MAKE_j4 dist
+  ls -l # For debugging.
+  command_ok_ "$desc [check .tar.gz tarball]"  check_tarball gzip
+  command_ok_ "$desc [check .tar.bz2 tarball]" check_tarball bzip2
+  command_ok_ "$desc [check .tar.Z tarball]"   check_tarball tarZ
+fi
+
+unset tarname desc skip_reason
+
+end_subtest
+
+
+# --------------------------------------------------------- #
+#  The various 'dist-*' targets can happily work together.  #
+# --------------------------------------------------------- #
+
+start_subtest all-together
+
+desc='all compressors together'
+tarname=all-together-1.0
+
+echo 'AM_INIT_AUTOMAKE([' > am-init.m4
+echo 'AUTOMAKE_OPTIONS =' > Makefile.am
+
+# Add half `dist-*' options to AM_INIT_AUTOMAKE, half to AUTOMAKE_OPTIONS.
+flip=:
+for fmt in $all_compression_formats; do
+  test $fmt = gzip && continue
+  if $flip; then
+    echo "  dist-$fmt" >> am-init.m4
+    flip=false
+  else
+    echo "AUTOMAKE_OPTIONS += dist-$fmt" >> Makefil.am
+    flip=:
+  fi
+done
+unset flip fmt
+
+echo '])' >> am-init.m4
+
+sed 's/AM_INIT_AUTOMAKE.*/m4_include([am-init.m4])/' configure.in > t
+mv -f t configure.in
+
+# For debugging.
+cat Makefil.am
+cat configure.in
+cat am-init.m4
+
+command_ok_ "$desc [aclocal]" $ACLOCAL --force
+command_ok_ "$desc [automake]" $AUTOMAKE
+command_ok_ "$desc [autoconf]" $AUTOCONF
+command_ok_ "$desc [configure]" ./configure
+
+if have_all_compressors; then
+  command_ok_ "$desc [make distcheck, real]" $MAKE distcheck
+else
+  skip_ -r "not all compressors available" "$desc [make distcheck, real]"
+fi
+
+# We fake existence of all the compressors here, so that we don't have
+# to require any of them to run the further tests.  This is especially
+# important since it's very unlikely that a non-developer has all the
+# compression tools installed on his machine at the same time.
+
+mkdir bin
+cd bin
+cat > check-distdir <<END
+#!/bin/sh
+{ ls -l '$tarname' && diff Makefile.am '$tarname'/Makefile.am; } >&2 \
+  || { echo "== distdir fail =="; exit 1; }
+END
+cat > grep-distdir-error <<'END'
+#!/bin/sh
+grep 'distdir fail' && exit 1
+:
+END
+chmod a+x check-distdir grep-distdir-error
+for prog in tar $all_compressors; do
+  case $prog in
+    tar|shar|zip) cp check-distdir $prog;;
+               *) cp grep-distdir-error $prog;;
+  esac
+done
+unset prog
+ls -l # For debugging.
+cd ..
+
+oPATH=$PATH
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+
+command_ok_ \
+  "$desc ['make dist-all', stubbed]" \
+  $MAKE dist-all
+
+subdesc="$desc ['make dist -j4', stubbed]"
+if test "$MAKE_j4" = false; then
+  skip_ -r "make concurrency unavailable" "$subdesc"
+else
+  command_ok_ "$subdesc" $MAKE_j4 dist
+fi
+unset subdesc
+
+PATH=$oPATH; export PATH
+
+end_subtest
+
+:
index b028a2c..9a75963 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
index bb404bc..df9d579 100755 (executable)
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am <<'END'
index 56ba24c..4328417 100755 (executable)
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 m4_include([foobar.m4])
 m4_include([zardoz.m4])
index a2618e9..02e95c7 100755 (executable)
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 m4_pattern_forbid([^MY_])
 MY_FOOBAR || exit 1
diff --git a/tests/dist-readonly.test b/tests/dist-readonly.test
new file mode 100755 (executable)
index 0000000..3b558c9
--- /dev/null
@@ -0,0 +1,60 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that a readonly files are distributed as such, and not make
+# writable while being copied in the $(distdir).
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c
+EXTRA_DIST = bar.txt
+check-local: test
+.PHONY: test
+test:
+       test -f $(srcdir)/foo.c && test ! -w $(srcdir)/foo.c
+       if (echo x > $(srcdir)/foo.c); then exit 1; else :; fi
+       grep 'main (void)' $(srcdir)/foo.c
+       test -f $(srcdir)/bar.txt && test ! -w $(srcdir)/bar.txt
+       if (echo x > $(srcdir)/bar.txt); then exit 1; else :; fi
+       grep 'To be, or not to be' $(srcdir)/bar.txt
+END
+
+echo 'int main (void) { return 0; }' > foo.c
+echo To be, or not to be ... > bar.txt
+chmod a-w foo.c bar.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE distdir
+ls -l $distdir # For debugging.
+test -f foo.c && test ! -w foo.c || Exit 1
+(echo x > foo.c) && Exit 1
+test -f bar.txt && test ! -w bar.txt || Exit 1
+(echo x > bar.txt) && Exit 1
+$MAKE distcheck
+
+:
diff --git a/tests/dist-repeated.test b/tests/dist-repeated.test
new file mode 100755 (executable)
index 0000000..7dd8bdd
--- /dev/null
@@ -0,0 +1,102 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that we can distribute the same file as many times as we want.
+# The distdir target should take care of not copying it more than one
+# time anyway.
+
+. ./defs || Exit 1
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.c
+bar_SOURCES = foo.c
+python_PYTHON = bar.py
+EXTRA_DIST = foo.c bar.py
+
+.PHONY: sanity-check
+sanity-check:
+       for f in $(DISTFILES); do echo " $$f "; done > dist.txt
+       cat dist.txt
+       test `grep ' foo\.c '  dist.txt | wc -l` -eq 3
+       test `grep ' bar\.py ' dist.txt | wc -l` -eq 2
+
+# So that we don't have to require a C compiler.
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+
+# So that we don't have to require a Python interpreter.
+pythondir = ${prefix}/py
+PYTHON = false
+END
+
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+
+# Help to ensure cp won't see the same file twice.
+mkdir bin
+cat > bin/cp <<END
+#!/bin/sh
+PATH='$PATH'; export PATH
+
+case " \$* " in
+  *foo.c\ *)
+    if test -f '$ocwd'/foo-c-copied; then
+      echo "\$0: we tried to copy foo.c twice" >&2
+      exit 1
+    else
+      # For a sanity check later.
+      echo ok > '$ocwd'/cp-wrapper-has-seen-foo-c
+    fi
+    ;;
+esac
+
+case " \$* " in
+  *bar.py\ *)
+    if test -f '$ocwd'/bar-py-copied; then
+      echo "\$0: we tried to copy bar.py twice" >&2
+      exit 1
+    else
+      # For a sanity check later.
+      echo ok > '$ocwd'/cp-wrapper-has-seen-bar-py
+    fi
+    ;;
+esac
+
+exec cp "\$@"
+END
+chmod a+x bin/cp
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH;
+
+: > foo.c
+: > bar.py
+: > py-compile
+
+# Help to ensure cp won't try to copy the same file twice.
+chmod a-w foo.c bar.py
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE sanity-check || fatal_ "expected invariants not verified"
+$MAKE distdir
+test -f cp-wrapper-has-seen-foo-c && test -f cp-wrapper-has-seen-bar-py \
+  || fatal_ "our cp wrapper hasn't run correctly"
+
+:
index dc31ee3..4393353 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_ARG_ENABLE([success], [], [success=$enableval], [success=no])
 AS_IF([test $success = yes && test "$sentence" = 'it works :-)'],
index 695b47c..5c9a320 100755 (executable)
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_SUBDIRS([subpkg])
 if test $dc != ok || test $am_dc != ok; then
index 117d83c..9a2eb4c 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_ARG_ENABLE([success], [], [success=$enableval], [success=no])
 AS_IF([test $success = yes && test "$sentence" = 'it works :-)'],
index 9a2c384..16b151e 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index befc1d6..7a20156 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_SUBDIRS([subpkg])
 AC_OUTPUT
index 1d42748..d4ba30d 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cwd=`pwd` || fatal_ "cannot get current working directory"
 
 cp "$testsrcdir"/distcheck-hook-m4.am . \
index e3f265e..5df5650 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cwd=`pwd` || fatal_ "cannot get current working directory"
 
 cp "$testsrcdir"/distcheck-hook-m4.am . \
index 3cf38c5..468ce6c 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check that we can override ${infodir} while having distcheck still
-# working.  Relate to automake bug#9579.
+# working.  Related to automake bug#9579.
 
 required='makeinfo tex texi2dvi install-info'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index e774dd7..5e90d0a 100755 (executable)
 # by a process (e.g., that is its "current working directory").
 # See automake bug#10470.
 
-parallel_tests=no
+am_parallel_tests=no
 . ./defs || Exit 1
 
-set -e
-
 mkdir foo.d
 sh -c "cd foo.d && sleep '4'" &
 # Without this sleep, the "rm -rf foo.d" below would reliably beat
index 667401d..341a680 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index 0f32e33..cf2b0fe 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 # Make sure the suggested `distcleancheck_listfiles' in the manual works.
 # The example Makefile.am we use is from the FAQ entry `distcleancheck'.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << 'END'
 AC_PROG_CC
 AC_OUTPUT
similarity index 53%
rename from tests/distcom6.test
rename to tests/distcom-subdir.test
index ca71571..f873682 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2009, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure that depcomp and compile required in subdirectories
-# are added to the top-level DIST_COMMON even with --no-force.
-# This is similar to distcom2.test, but with --no-force added.
-# Report from Scott James Remnant (Debian #206299).
-# Please keep this in sync with sister test 'distcom2.test'.
+# Test to make sure that if an auxfile (here depcomp) is required
+# by a subdir Makefile.am, it is distributed by that Makefile.am.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
 AC_CONFIG_FILES([subdir/Makefile])
+AC_PROG_CC
 AC_OUTPUT
 END
 
@@ -35,38 +29,47 @@ cat > Makefile.am << 'END'
 SUBDIRS = subdir
 END
 
+rm -f depcomp
 mkdir subdir
-: > subdir/foo.c
+
+: > subdir/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+test ! -f depcomp
 
 cat > subdir/Makefile.am << 'END'
-noinst_PROGRAMS = foo
-foo_SOURCES = foo.c
-foo_CFLAGS = -DBAR
+bin_PROGRAMS = foo
 END
 
-rm -f compile depcomp
-
-$ACLOCAL
-$AUTOMAKE --add-missing --no-force
+: > subdir/foo.c
 
-test -f compile
+$AUTOMAKE -a subdir/Makefile
 test -f depcomp
 
-sed -n -e '/^DIST_COMMON =.*\\$/ {
-   :loop
-   p
-   n
-   t clear
-   :clear
-   s/\\$/\\/
-   t loop
-   p
-   n
-   }' -e 's/$/ /' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
-
-cat dc.txt # might be useful for debugging
+# FIXME: the logic of this check and other similar ones in other
+# FIXME: `distcom*.test' files should be factored out in a common
+# FIXME: subroutine in `defs'...
+sed -n -e "
+  /^DIST_COMMON =.*\\\\$/ {
+    :loop
+    p
+    n
+    t clear
+    :clear
+    s/\\\\$/\\\\/
+    t loop
+    s/$/ /
+    s/[$tab ][$tab ]*/ /g
+    p
+    n
+  }" subdir/Makefile.in > dc.txt
+cat dc.txt
+$FGREP ' $(top_srcdir)/depcomp ' dc.txt
 
-$FGREP ' compile ' dc.txt
-$FGREP ' depcomp ' dc.txt
+./configure
+$MAKE distdir
+test -f $distdir/depcomp
 
 :
index 23841c6..504dcf6 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2006, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2002, 2004, 2006, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure that depcomp and compile are added to DIST_COMMON
-# From Pavel Roskin.
-# Please keep this in sync with sister test 'distcom6.test'.
+# Test to make sure that depcomp and compile are added to DIST_COMMON.
+# Report from Pavel Roskin.  Report of problems with `--no-force' from
+# Scott James Remnant (Debian #206299)
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -43,29 +41,43 @@ foo_SOURCES = foo.c
 foo_CFLAGS = -DBAR
 END
 
-rm -f compile depcomp
-
 $ACLOCAL
-$AUTOMAKE --add-missing
 
-test -f compile
-test -f depcomp
+for opt in '' --no-force; do
+
+  $AUTOMAKE $opt --add-missing
+
+  test -f compile
+  test -f depcomp
+
+  for dir in . subdir; do
+    # FIXME: the logic of this check and other similar ones in other
+    # FIXME: `distcom*.test' files should be factored out in a common
+    # FIXME: subroutine in `defs'...
+    sed -n -e "
+      /^DIST_COMMON =.*\\\\$/ {
+        :loop
+        p
+        n
+        t clear
+        :clear
+        s/\\\\$/\\\\/
+        t loop
+        s/$/ /
+        s/[$tab ][$tab ]*/ /g
+        p
+        n
+      }" $dir/Makefile.in > $dir/dc.txt
+  done
 
-sed -n -e '/^DIST_COMMON =.*\\$/ {
-   :loop
-   p
-   n
-   t clear
-   :clear
-   s/\\$/\\/
-   t loop
-   p
-   n
-   }' -e 's/$/ /' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
+  cat dc.txt # For debugging.
+  cat subdir/dc.txt # Likewise.
 
-cat dc.txt # might be useful for debugging
+  $FGREP ' $(top_srcdir)/depcomp ' subdir/dc.txt
+  # The `compile' script will be listed in the DIST_COMMON of the top-level
+  # Makefile because it's required in configure.in (by AM_PROG_CC_C_O).
+  $FGREP ' $(top_srcdir)/compile ' dc.txt || $FGREP ' compile ' dc.txt
 
-$FGREP ' compile ' dc.txt
-$FGREP ' depcomp ' dc.txt
+done
 
 :
index 9cc62ea..5cb5e84 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2010 Free Software
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 README:
        echo 'I bet you are reading me.' > README
 END
 
-# Files required by --gnu
+# Files required by `--gnu'.
 : > NEWS
 : > AUTHORS
 : > ChangeLog
index 5dde663..7eda400 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 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
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
    AC_CONFIG_FILES([tests/autoconf:tests/wrapper.in],
                    [chmod +x tests/autoconf])
@@ -69,7 +67,7 @@ sed -n -e '/^DIST_COMMON =.*\\$/ {
    n
    }' -e '/^DIST_COMMON =/ p' Makefile.in > dc.txt
 
-cat dc.txt # might be useful for debugging
+cat dc.txt # For debugging.
 
 test 1 = `grep tests dc.txt | wc -l`
 grep configure dc.txt
index 7cadfd5..2e45913 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 extract_distcommon ()
 {
   sed -n -e '/^DIST_COMMON =.*\\$/ {
@@ -76,7 +74,7 @@ $MAKE test
 extract_distcommon Makefile.in > top.txt
 extract_distcommon tests/Makefile.in > inner.txt
 
-# might be useful for debugging
+# Might be useful for debugging.
 cat top.txt
 cat inner.txt
 
index 04ba363..a576e3d 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003, 2006, 2007, 2009, 2010 Free
-# Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 2006, 2007, 2009, 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
@@ -24,8 +24,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index 268cfcb..55cdc44 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 . ./defs || Exit 1
 
-set -e
-
 echo text > file
 
-ln -s file lnk || {
-  echo "$me: cannot create symlinks to files" >&2
-  Exit 77
-}
+ln -s file lnk || skip_ "cannot create symlinks to files"
 
 mkdir A
 mkdir B
@@ -47,7 +42,7 @@ cat >> configure.in << 'END'
 AC_OUTPUT
 END
 
-echo "me = $me" > Makefile.am  # for better failure messages
+echo "me = $me" > Makefile.am # For better failure messages.
 cat >> Makefile.am << 'END'
 EXTRA_DIST = lnk B/bbb bar1 bar2 bar3 quux
 .PHONY: test
index 2314408..41cc499 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # We need, for our broken symlinks, names that make it hard to get false
 # positives when grepping make output to look for them.
 lnk_base=BrknSymlnk
@@ -29,10 +27,7 @@ lnk2=${lnk_base}__002
 lnka=${lnk_base}__aaa
 lnkb=${lnk_base}__bbb
 
-ln -s nonesuch $lnk1 || {
-  echo "$me: cannot create broken symlinks" >&2
-  Exit 77
-}
+ln -s nonesuch $lnk1 || skip_ "cannot create broken symlinks"
 
 ln -s "`pwd`/nonesuch" $lnk2
 
@@ -56,7 +51,7 @@ END
 $ACLOCAL
 $AUTOCONF
 
-ls -l # for debugging
+ls -l # For debugging.
 
 # Don't try to use "make -k", because some botched make implementations
 # (HP-UX, IRIX) might still exit on the first error in this situations.
index 117d986..c92f70d 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test of names in tar file.
-# From Rainer Orth
+# From Rainer Orth.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_SRCDIR([a.c])
 AC_PROG_CC
index 629c949..4665f9c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_HEADERS([config.h])
 AM_WITH_DMALLOC
@@ -46,15 +44,15 @@ $AUTOMAKE
 $AUTOCONF
 
 ./configure
-cat config.h # debug info
+cat config.h # For debugging.
 grep '^ */\* *# *undef  *WITH_DMALLOC *\*/ *$' config.h
 
 ./configure --without-dmalloc
-cat config.h # debug info
+cat config.h # For debugging.
 grep '^ */\* *# *undef  *WITH_DMALLOC *\*/ *$' config.h
 
 ./configure --with-dmalloc
-cat config.h # debug info
+cat config.h # For debugging.
 grep '^# *define  *WITH_DMALLOC  *1 *$' config.h
 $MAKE check-with-dmalloc
 
index 685d2b6..f3a68d6 100755 (executable)
@@ -24,8 +24,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am <<'END'
 $(FOO:=x): bar
 END
index acff363..c50bc1f 100755 (executable)
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am <<END
 .PHONY: test
 test: all check
index 77b5129..81d4cbc 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 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
@@ -23,8 +23,6 @@
 required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am <<'EOF'
index 7105cb0..9185990 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -24,8 +24,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >Makefile.am <<'EOF'
 x = 1
 foo$x = 1
index 6fc2737..cda9605 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 
 . ./defs || Exit 1
 
-set -e
+#
+# First, try a setup where we have a `portability-recursive' warning,
+# but no "simple" `portability' warning.
+#
 
 cat >Makefile.am <<'EOF'
 x = 1
@@ -28,11 +31,61 @@ EOF
 
 $ACLOCAL
 
-# $AUTOMAKE already contains -Wall -Werror.
-AUTOMAKE_fails -Wportability
-$AUTOMAKE --force -Wno-all
-$AUTOMAKE --force -Wno-portability
+# Enabling `portability' warnings should enable `portability-recursive'
+# warnings.
+AUTOMAKE_fails -Wnone -Wportability
+grep 'recursive variable expansion' stderr
+# `portability-recursive' warnings can be enabled by themselves.
+AUTOMAKE_fails -Wnone -Wportability-recursive
+grep 'recursive variable expansion' stderr
+
+# Various ways to disable `portability-recursive'.
+$AUTOMAKE -Wno-all
+$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wall -Wno-portability-recursive
+
+# `-Wno-portability-recursive' after `-Wportability' correctly disables
+# `portability-recursive' warnings.
+$AUTOMAKE -Wportability -Wno-portability-recursive
+
+# `-Wno-portability' disables `portability-recursive' warnings; but
+# a later `-Wportability-recursive' re-enables them.  This time, we
+# use AUTOMAKE_OPTIONS to specify the warning levels.
 echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am
-$AUTOMAKE --force
+$AUTOMAKE
+echo 'AUTOMAKE_OPTIONS += -Wportability-recursive' >> Makefile.am
+AUTOMAKE_fails
+grep 'recursive variable expansion' stderr
+
+#
+# Now try a setup where we have both a `portability' warning and
+# a `portability-recursive' one.
+#
+
+cat >Makefile.am <<'EOF'
+x = 1
+bla = $(foo$(x))
+noinst_PROGRAMS = foo
+foo_CPPFLAGS = -Dwhatever
+EOF
+
+echo AC_PROG_CC >> configure.in
+
+$ACLOCAL --force
+
+# Can disable both `portability' and `portability-recursive' warnings.
+$AUTOMAKE -Wno-portability
+
+# Disabling `portability-recursive' warnings should not disable
+# `portability' warnings.
+AUTOMAKE_fails -Wportability -Wno-portability-recursive
+grep AM_PROG_CC_C_O stderr
+grep 'recursive variable expansion' stderr && Exit 1
+
+# Enabling `portability-recursive' warnings should not enable
+# all the `portability' warning.
+AUTOMAKE_fails -Wno-portability -Wportability-recursive
+grep AM_PROG_CC_C_O stderr && Exit 1
+grep 'recursive variable expansion' stderr
 
 :
index b4e9c50..047308c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >> configure.in
 
 cat > Makefile.am << 'END'
index 654d99b..a1516fc 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2002, 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_FUNC_STRTOD
 END
index 32cf81a..cf1a67f 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
 echo 'AM_CONDITIONAL(FOO, true)' >> configure.in
 
 cat > Makefile.am << 'END'
-# flag to tell us if apache dir is a source distribution
+# Flag to tell us if apache dir is a source distribution.
 APACHE_DIR_IS_SRC = @APACHE_DIR_IS_SRC@
 
-# we only need to descend into the c dir if we're doing a 1.3 DSO configuration
+# We only need to descend into the c dir if we're doing a 1.3 DSO
+# configuration.
 ifeq ("${APACHE_DIR_IS_SRC}","yes")
 SUBDIRS = java
 else
@@ -36,4 +36,4 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:7:.*else without if' stderr
+grep '^Makefile\.am:8:.*else without if' stderr
index db5af87..8ca73cf 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2007
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2007, 2011
 # Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >>configure.in
 echo 'data_DATA =' >Makefile.am
 
index efebb70..293adbd 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index e88152f..a9dfd7b 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 71c7552..958b48d 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_SUBST(ZOO_OBJ)
index 013b80a..1929af8 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 htmldir = $(prefix)/html
 html_DATA = zot.html
index aca1497..bd14712 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 2004, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 quuz_DATA = zot.html
 pkgdata_DATA = qbert
index d51bdf9..5292154 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AC_SUBST([pkgdatadir], ["FOO"])
 AC_OUTPUT
index 3fd42a8..08cc034 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
 # Also make sure the old definitions of bin_PROGRAMS and friend
 # aren't left around.  Report from Jim Meyering.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_CONDITIONAL([WANT_MT], [test -z "$revert"])
index fc05712..c815034 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2008, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 28a7d5e..637cc58 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2007, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index e6cfe7d..9ce25fe 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2010, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([COND], [test -n "$cond"])
 AC_SUBST([programs], ['prg1$(EXEEXT) prg2$(EXEEXT)'])
-AC_PROG_CC
+AC_SUBST([CC], [whocares])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-EXEEXT = .bin
+AUTOMAKE_OPTIONS = no-dependencies
+EXEEXT = .x
 if COND
   BAR = bar
   DEP = bar
@@ -40,42 +40,31 @@ bin_PROGRAMS = $(programs) @programs@ prg3 $(BAR) $(BAZE)
 EXTRA_PROGRAMS = prg1 prg2 prg3
 TESTS = prg1 prg3 prg4 $(BAZ)
 
-print-bin:
-       @echo BEG: $(bin_PROGRAMS) :END
-print-extra:
-       @echo BEG: $(EXTRA_PROGRAMS) :END
-print-tests:
-       @echo BEG: $(TESTS) :END
-print-barbaz:
-       @echo BEG: $(BAR) $(BAZ) :END
+.PHONY: test-cond test-nocond
+test-nocond:
+       is $(bin_PROGRAMS) == prg1.x prg2.x prg1.x prg2.x prg3.x
+       is $(EXTRA_PROGRAMS) == prg1.x prg2.x prg3.x
+       is $(TESTS) == prg1.x prg3.x prg4
+test-cond:
+       is $(bin_PROGRAMS) == prg1.x prg2.x prg1.x prg2.x prg3.x bar.x baz.x
+       is $(EXTRA_PROGRAMS) == prg1.x prg2.x prg3.x
+       is $(TESTS) == prg1.x prg3.x prg4 baz.x bar.x
+       is $(BAR) $(BAZ) == bar baz bar
 END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --add-missing --copy
+
 ./configure
-$MAKE print-bin > output
-cat output
-$FGREP 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin' output
-$MAKE print-extra > output
-cat output
-$FGREP 'prg1.bin prg2.bin prg3.bin' output
-$MAKE print-tests > output
-cat output
-$FGREP 'prg1.bin prg3.bin prg4' output
+$MAKE test-nocond
 
 ./configure cond=yes
-$MAKE print-bin > output
-cat output
-$FGREP 'prg1.bin prg2.bin prg1.bin prg2.bin prg3.bin bar.bin baz.bin' output
-$MAKE print-tests > output
-cat output
-$FGREP 'prg1.bin prg3.bin prg4 baz.bin bar.bin' output
-$MAKE print-barbaz > output
-cat output
-$FGREP 'bar baz bar' output
+$MAKE test-cond
 
 # Only two am__EXEEXT_* variables are needed here: one for BAR, and one
 # BAZ.  The latter must use the former.
 test 2 = `grep '__EXEEXT_. =' Makefile.in | wc -l`
 grep 'am__EXEEXT_2 = .*am__EXEEXT_1' Makefile.in
+
+:
index 2747f6e..daa5b01 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2004
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2004, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >> configure.in
 
 cat > Makefile.am << 'END'
index af2eab2..5ac3cd1 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2006, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_F77
 AC_PROG_FC
index 185b708..ef218ae 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2009, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_PROG_CXX
 EOF
diff --git a/tests/ext3.test b/tests/ext3.test
new file mode 100755 (executable)
index 0000000..191a34e
--- /dev/null
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 2009, 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 3 of the License, 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/>.
+
+# Cover corner cases of derive_suffix wrt. file extensions:
+# - extension declared with SUFFIXES but with no suffix rule for it
+# - extension with a suffix rule but none that leads us to $(OBJEXT)
+# In both cases, we don't try to create a rule; but we shouldn't
+# fail either, because magic might be happening behind our back.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.goo
+SUFFIXES = .goo
+bar_SOURCES = bar.woo
+.woo.zoo: ; making a zoo $@ from a woo $<
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+Exit 0
diff --git a/tests/extra-portability.test b/tests/extra-portability.test
new file mode 100755 (executable)
index 0000000..22d3749
--- /dev/null
@@ -0,0 +1,96 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check interactions between the `portability' and `extra-portability'
+# warning categories:
+#   1. `-Wextra-portability' must imply `-Wportability'.
+#   2. `-Wno-portability' must imply `-Wno-extra-portability'.
+#   3. `-Wall' must imply `-Wextra-portability'.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror"
+
+cat >>configure.in <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+$ACLOCAL
+
+#
+# First, a setup where only an extra-portability warning is present
+# (no "simple" portability-warnings are).
+#
+
+cat >Makefile.am <<END
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = sub/foo.c
+END
+
+# Sanity check: extra-portability warnings causes the expected error.
+AUTOMAKE_fails -Wextra-portability
+grep 'requires.*AM_PROG_AR' stderr
+
+# Warnings in extra-portability category are not enabled by default.
+$AUTOMAKE
+
+# -Wall enables extra-portability.
+AUTOMAKE_fails -Wall
+grep 'requires.*AM_PROG_AR' stderr
+
+# Disabling portability disables extra-portability as well.
+$AUTOMAKE -Wextra-portability -Wno-portability
+$AUTOMAKE -Wall -Wno-portability
+
+#
+# Now, a setup where also a "simple" portability warning is present.
+#
+
+# Per-target flags require the use of AM_PROG_CC_C_O in configure.ac.
+echo libfoo_a_CPPFLAGS = -Dwhatever >> Makefile.am
+
+# Enabling extra-portability enables portability as well ...
+AUTOMAKE_fails -Wextra-portability
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr
+# ... even if it had been previously disabled.
+AUTOMAKE_fails -Wno-portability -Wextra-portability
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr
+
+# Disabling extra-portability leaves portability intact (1).
+AUTOMAKE_fails -Wportability -Wno-extra-portability
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr && Exit 1
+# Disabling extra-portability leaves portability intact (2).
+AUTOMAKE_fails -Wall -Wno-extra-portability
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr && Exit 1
+
+# Enabling portability does not enable extra-portability.
+AUTOMAKE_fails -Wportability
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr && Exit 1
+
+# Disabling portability disables extra-portability.
+$AUTOMAKE -Wno-portability
+$AUTOMAKE -Wextra-portability -Wno-portability
+$AUTOMAKE -Wall -Wno-portability
+
+:
diff --git a/tests/extra-portability2.test b/tests/extra-portability2.test
new file mode 100755 (executable)
index 0000000..ceaac22
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 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 that extra-portability warnings are not enabled by --gnits,
+# --gnu and --foreign.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$am_original_AUTOMAKE
+
+cat >>configure.in <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+$ACLOCAL
+
+# Make sure the test is useful.
+AUTOMAKE_fails -Wextra-portability \
+  || fatal_ "setup doesn't trigger \`extra-portability' warnings"
+
+$AUTOMAKE --foreign
+
+touch INSTALL NEWS README AUTHORS ChangeLog COPYING # Satisfy --gnu.
+$AUTOMAKE --gnu
+
+touch THANKS # Satisfy also --gnits.
+$AUTOMAKE --gnits
+
+:
diff --git a/tests/extra-portability3.test b/tests/extra-portability3.test
new file mode 100755 (executable)
index 0000000..125344d
--- /dev/null
@@ -0,0 +1,60 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check interactions between the `portability-recursive' and
+# `extra-portability' warning categories.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror"
+
+cat >>configure.in <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+$ACLOCAL
+
+cat >Makefile.am <<'END'
+baz = $(foo$(bar))
+lib_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+# 'extra-portability' implies 'portability-recursive'.
+AUTOMAKE_fails -Wextra-portability
+grep 'requires.*AM_PROG_AR' stderr
+grep 'recursive variable expansion' stderr
+
+# We can disable 'extra-portability' while leaving
+# 'portability-recursive' intact.
+AUTOMAKE_fails -Wportability-recursive -Wno-extra-portability
+grep 'requires.*AM_PROG_AR' stderr && Exit 1
+grep 'recursive variable expansion' stderr
+
+# We can disable 'portability-recursive' while leaving
+# 'extra-portability' intact.
+AUTOMAKE_fails -Wextra-portability -Wno-portability-recursive
+grep 'requires.*AM_PROG_AR' stderr
+grep 'recursive variable expansion' stderr && Exit 1
+
+# Disabling 'portability' disables 'portability-recursive' and
+# 'extra-portability'.
+$AUTOMAKE -Wextra-portability -Wno-portability
+
+:
similarity index 50%
rename from tests/yacc3.test
rename to tests/extra-programs-empty.test
index 86d897c..e46e1ac 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2011, 2012 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Ensure that generated .h file is distributed iff we have -d in
-# (AM_)?YFLAGS.
+# Test that EXTRA_PROGRAMS doesn't get removed because it is empty.
+# This check has been introduced in commit `Release-1-9-254-g9d0eaef'
+# into the former test `subst2.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
+AC_CONFIG_FILES([Makefile2 Makefile3])
+AC_SUBST([prog])
 AC_PROG_CC
-AC_PROG_YACC
+AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
-AUTOMAKE_OPTIONS = no-dependencies
-bin_PROGRAMS = zardoz
-zardoz_SOURCES = zardoz.y
-magic:
-       @echo $(DIST_COMMON)
+EXTRA_PROGRAMS =
+END
+
+cat > Makefile2.am <<'END'
+bin_PROGRAMS = a @prog@ b
+EXTRA_PROGRAMS =
+END
+
+cat > Makefile3.am <<'END'
+empty =
+EXTRA_PROGRAMS = $(empty)
 END
 
 $ACLOCAL
-$AUTOMAKE -a
-
-$FGREP -v @SET_MAKE@ Makefile.in > Makefile.sed
-# It should not be disted here
-grep 'zardoz.h' Makefile.in && Exit 1
-
-cp Makefile.am Save
-# Test all available flags to make sure header is distributed with
-# `-d'.
-for flag in YFLAGS AM_YFLAGS zardoz_YFLAGS; do
-   cp Save Makefile.am
-   echo "$flag = -d" >> Makefile.am
-
-   $AUTOMAKE -Wno-gnu
-   grep 'zardoz.h' Makefile.in
-done
+$AUTOMAKE
+
+grep '^EXTRA_PROGRAMS = *$' Makefile.in
+grep '^EXTRA_PROGRAMS = *$' Makefile2.in
+# Be laxer here, since EXTRA_PROGRAMS might be internally rewritten
+# by Automake when it contains references to other variables.
+grep '^EXTRA_PROGRAMS =' Makefile3.in
+
+:
index 134e875..da41d14 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -21,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 7bd6556..a635f9c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010  Free Software Foundation, Inc.
+# Copyright (C) 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
 
 # Check that wildcards in EXTRA_DIST are honoured.
 # Suggested by observations from Braden McDaniel.
+# See also sister test 'extra11.test', that check a similar usage
+# with the involvement of the $(wildcard) GNU make builtin.
 
 required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am <<'END'
-EXTRA_DIST=*.foo
+EXTRA_DIST = *.foo
 .PHONY: test
 test: distdir
        diff a.foo $(distdir)/a.foo
        diff b.foo $(distdir)/b.foo
        test ! -r $(distdir)/c.bar
+check-local:
+       test -f $(srcdir)/a.foo
+       test -f $(srcdir)/b.foo
+       test ! -r $(srcdir)/c.bar
 END
 
 $ACLOCAL
@@ -39,6 +43,10 @@ $AUTOCONF
 
 echo aaa > a.foo
 echo bbb > b.foo
-echo ccc > c.foo
+echo ccc > c.bar
 ./configure
 $MAKE test
+
+$MAKE distcheck
+
+:
index a0c55ca..38b1654 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010  Free Software Foundation, Inc.
+# Copyright (C) 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
 required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am <<'END'
-EXTRA_DIST = [!c-z].t d.t [ab].dir foo.* *zardoz*
+AUTOMAKE_OPTIONS = -Wno-portability
+
+EXTRA_DIST = $(wildcard [!c-z].t d.t [ab].dir foo.* *zardoz*)
 
 .PHONY: prereq
 prereq:
@@ -47,6 +47,7 @@ prereq:
 
 .PHONY: test
 test: distdir
+       ls -l $(distdir) $(distdir)/*.dir ;: For debugging.
        diff a.t $(distdir)/a.t
        diff b.t $(distdir)/b.t
        test ! -r $(distdir)/c.t
@@ -61,6 +62,22 @@ test: distdir
        diff foo.bar $(distdir)/foo.bar
        test ! -r $(distdir)/foo
        diff _zardoz_ $(distdir)/_zardoz_
+check-local:
+       ls -l . *.dir ;: For debugging.
+       test -f $(srcdir)/a.t
+       test -f $(srcdir)/b.t
+       test ! -r $(srcdir)/c.t
+       test -f $(srcdir)/d.t
+       test ! -r $(srcdir)/m.t
+       test ! -r $(srcdir)/z.t
+       test -f $(srcdir)/a.dir/f1
+       test -f $(srcdir)/a.dir/f2
+       test -f $(srcdir)/b.dir/f
+       test ! -r $(srcdir)/c.dir
+       test -f $(srcdir)/foo.x
+       test -f $(srcdir)/foo.bar
+       test ! -r $(srcdir)/foo
+       test -f $(srcdir)/_zardoz_
 END
 
 $ACLOCAL
@@ -69,5 +86,8 @@ $AUTOCONF
 
 ./configure
 $MAKE prereq
-ls -l . *.dir
+ls -l . *.dir # For debugging.
 $MAKE test
+$MAKE distcheck
+
+:
index db3bcc7..af079b0 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -21,8 +21,6 @@
 required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 
index e6c85a0..6660856 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index aea67bc..557cb84 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo 'AC_SUBST(CODICIL)' >> configure.in
 
 cat > Makefile.am << 'END'
index cf5e4a6..a52c158 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo 'AC_SUBST(CODICIL)' >> configure.in
 
 cat > Makefile.am << 'END'
index ebdda32..e66198d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
index 0dbf735..c687828 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
index 233cb0f..a746a08 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
index eb9f9a1..57bbe56 100755 (executable)
@@ -1,22 +1,18 @@
 #!/bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Ensure defining bin_PROGRAMS in terms of EXTRA_PROGRAMS works,
 # and that referring to the same program with inconsistent addition
@@ -24,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
 AC_OUTPUT
diff --git a/tests/extra9.test b/tests/extra9.test
new file mode 100755 (executable)
index 0000000..ac1e0a8
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+# Copyright (C) 2009, 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/>.
+
+# Ensure we warn about substitutions in bin_PROGRAMS if EXTRA_PROGRAMS
+# are missing; but only if the former is not AC_SUBSTed itself
+# (lib_LIBRARIES is in the same boat here).
+
+. ./defs || Exit 1
+
+cat >>configure.in <<'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_SUBST([lib_LIBRARIES])
+AC_SUBST([bins])
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+bin_PROGRAMS = @bins@
+END
+
+: > ar-lib
+
+$ACLOCAL
+AUTOMAKE_fails
+grep 'bin_PROGRAMS.*contains configure substitution' stderr
+grep 'lib_LIBRARIES.*contains configure substitution' stderr && Exit 1
+
+Exit 0
diff --git a/tests/extract-testsuite-summary b/tests/extract-testsuite-summary
new file mode 100644 (file)
index 0000000..a3a0d87
--- /dev/null
@@ -0,0 +1,15 @@
+#! /usr/bin/env perl
+# Extract the testsuite summary generated by the parallel-tests harness
+# from the output of "make check".
+
+use warnings FATAL => 'all';
+use strict;
+
+my $br = '=' x 76;
+my @sections = ('');
+while (<>)
+  {
+    push @sections, $_, '' if /$br/;
+    $sections[-1] .= $_ if !/$br/;
+  }
+print @sections[1..$#sections-1];
index 4cbfda5..3b46de9 100755 (executable)
 required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_SUBST([deps], [bardep])
 AM_CONDITIONAL([COND], [test -n "$cond"])
index 3d44512..37483d6 100755 (executable)
 required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_SUBST([deps], [bardep])
 AC_OUTPUT
index 83b9767..a282673 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_FC
 END
index a7e8f77..ca8e755 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_MAINTAINER_MODE
 AC_OUTPUT
index d35c4c6..6ca0d2b 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_F77
 AC_F77_LIBRARY_LDFLAGS
index a63f2ca..c048802 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat >Makefile.am <<'END'
@@ -27,15 +25,13 @@ AUTOMAKE_OPTIONS = filename-length-max=99
 EXTRA_DIST = 12345678
 END
 
-(for i in 1 2 3 4 5 6 7 8 9
-do
-  mkdir -p 12345678 || Exit 77
-  cd 12345678
-  touch x
-done) || Exit 77
+(for i in 1 2 3 4 5 6 7 8 9; do
+  mkdir -p 12345678 && cd 12345678 && touch x || Exit 1
+done) || skip_ "failed to create deep directory hierarchy"
 
 # AIX 5.3 `cp -R' is too buggy for `make dist'.
-cp -R 12345678 t || Exit 77
+cp -R 12345678 t \
+  || skip_ "'cp -R' failed to copy deep directory hierarchy"
 
 $ACLOCAL
 $AUTOCONF
@@ -43,15 +39,13 @@ $AUTOMAKE
 ./configure
 $MAKE distcheck
 
-(for i in 1 2 3 4 5 6 7 8 9 10 11
-do
-  mkdir -p 12345678 || Exit 77
-  cd 12345678
-  touch x
-done) || Exit 77
+(for i in 1 2 3 4 5 6 7 8 9 10 11; do
+  mkdir -p 12345678 && cd 12345678 && touch x || Exit 1
+done) || skip_ "failed to create deeper directory hierarchy"
 
 $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'filenames are too long' stderr
 test 2 = `grep 12345678 stderr | wc -l`
+
 :
index 33ac663..add730f 100755 (executable)
 
 . ./defs || Exit 1
 
-set -e
-
 # The name is so that 99 is exactly hit (including final \0).
 subdirname='cnfsubdir'
 
 cat >>configure.in <<END
-AC_CONFIG_SUBDIRS([${subdirname}])
+AC_CONFIG_SUBDIRS([$subdirname])
 AC_OUTPUT
 END
 
 cat >Makefile.am <<END
 AUTOMAKE_OPTIONS = filename-length-max=99
-SUBDIRS = ${subdirname}
+SUBDIRS = $subdirname
 END
 
-mkdir ${subdirname} || Exit 1
+mkdir $subdirname
 
-cat >> ${subdirname}/configure.in <<EOF
-AC_INIT([${subdirname}], [1.0])
+cat >> $subdirname/configure.in <<EOF
+AC_INIT([$subdirname], [1.0])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 EOF
 
-cat >${subdirname}/Makefile.am <<'END'
+cat >$subdirname/Makefile.am <<'END'
 AUTOMAKE_OPTIONS = filename-length-max=99
 EXTRA_DIST = 12345678
 END
 
-(cd ${subdirname}; for i in 1 2 3 4 5 6 7 8
-do
-  mkdir -p 12345678 || Exit 77
-  cd 12345678
-  touch x
-done)
+(cd $subdirname || Exit 1
+for i in 1 2 3 4 5 6 7 8; do
+  mkdir -p 12345678 && cd 12345678 && touch x || Exit 1
+done) || skip_ "failed to create deep directory hierarchy"
 
 # AIX 5.3 `cp -R' is too buggy for `make dist'.
-cp -R ${subdirname} t || Exit 77
-
-for init_dir in ${subdirname} .; do
-       (
-               cd ${init_dir} || Exit 1
-               $ACLOCAL
-               $AUTOCONF
-               $AUTOMAKE
-       ) || Exit 1
-done
+cp -R $subdirname t \
+  || skip_ "'cp -R' failed to copy deep directory hierarchy"
+
+cd $subdirname
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+cd ..
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
 ./configure
 $MAKE distcheck
 
-(cd ${subdirname}; for i in 1 2 3 4 5 6 7 8 9
-do
-  mkdir -p 12345678 || Exit 77
-  cd 12345678
-  touch x
-done)
+(cd $subdirname || Exit 1
+for i in 1 2 3 4 5 6 7 8 9; do
+  mkdir -p 12345678 && cd 12345678 && touch x || Exit 1
+done) || skip_ "failed to create deeper directory hierarchy"
 
 $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'filenames are too long' stderr
 test 1 = `grep 12345678 stderr | wc -l`
+
 :
index d2d521c..f250168 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_F77
 END
index 93d7d3f..a248f0f 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_F77
 END
index b93b602..a653bef 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_F77
 END
index 4b9f63c..7ee186c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 rm -f install-sh
 
 echo zot > install-sh
index 408ea8a..80d78d3 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
 
 . ./defs || Exit 1
 
-set -e
-
 rm -f install-sh
 
 echo zot > foo
 cp foo foo2
 
-ln -s foo2 install-sh || {
-  echo "$me: cannot create symlinks to files" >&2
-  Exit 77
-}
+ln -s foo2 install-sh || skip_ "cannot create symlinks to files"
 
 : > Makefile.am
 
index 930ae02..347ec13 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >Makefile.am <<END
 bin_PROGRAMS = hello
 hello_SOURCES = hello.f foo.f95
index 70d13f2..d118c10 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 2010, 2011, 2012 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
@@ -21,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'END'
@@ -60,4 +59,5 @@ grep '^[      ].*\$(FC.*\$(FCFLAGS_f90).*\.f95' Makefile.in && Exit 1
 grep '^[       ].*\$(FC.*\$(FCFLAGS_f95).*\.f90' Makefile.in && Exit 1
 grep '^[       ].*\$(FC.*\$(FCFLAGS_f90).*\.f03' Makefile.in && Exit 1
 grep '^[       ].*\$(FC.*\$(FCFLAGS_f08).*\.f90' Makefile.in && Exit 1
+
 :
index 84df399..273ccf4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -21,8 +21,6 @@
 required='g77 gfortran'
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >hello.f <<'END'
@@ -72,7 +70,7 @@ $AUTOMAKE -a
 grep '.\$(FCLINK)' Makefile.in && Exit 1
 
 $AUTOCONF
-# configure may Exit 77 if no compiler is found,
+# ./configure may exit with status 77 if no compiler is found,
 # or if the compiler cannot compile Fortran 90 files).
 ./configure
 $MAKE
index d6151a7..3927c32 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2009, 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
@@ -21,8 +21,6 @@
 required='libtoolize g77 gfortran'
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >hello.f <<'END'
@@ -56,6 +54,7 @@ AC_PROG_FC
 AC_FC_SRCEXT([f90], [],
   [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
 AC_FC_LIBRARY_LDFLAGS
+AM_PROG_AR
 LT_PREREQ([2.0])
 AC_PROG_LIBTOOL
 AC_OUTPUT
@@ -80,14 +79,13 @@ $AUTOMAKE -a
 $AUTOCONF
 
 # This test requires Libtool >= 2.0.  Earlier Libtool does not
-# have the LT_PREREQ macro to cause autoconf failure, so let's
-# skip in this case:
-grep LT_PREREQ configure && Exit 77
+# have the LT_PREREQ macro to cause autoconf failure.
+grep LT_PREREQ configure && skip_ "libtool is too old (probably < 2.0)"
 
 # Ensure we use --tag for f90, too.
 grep " --tag=FC" Makefile.in
 
-# configure may Exit 77 if no compiler is found,
+# ./configure may exit with status 77 if no compiler is found,
 # or if the compiler cannot compile Fortran 90 files).
 ./configure
 $MAKE
index 585e7c1..e70ee98 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_SRCDIR([foo.f])
 AC_PROG_F77
index c32a1b2..5e6ab33 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -19,8 +20,8 @@
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-_AM_DEPENDENCIES(GCJ)
-AC_SUBST(GCJ)
+_AM_DEPENDENCIES([GCJ])
+AC_SUBST([GCJ])
 END
 
 cat > Makefile.am << 'END'
@@ -28,7 +29,9 @@ bin_PROGRAMS = convert
 convert_SOURCES = x/y/convert.java
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^x/y/convert' Makefile.in
+
+:
index 3e3af60..3d60cff 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 _AM_DEPENDENCIES(GCJ)
 AC_SUBST(GCJ)
index 7d8a981..f2f7460 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,8 @@
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-_AM_DEPENDENCIES(GCJ)
-AC_SUBST(GCJ)
+_AM_DEPENDENCIES([GCJ])
+AC_SUBST([GCJ])
 END
 
 cat > Makefile.am << 'END'
@@ -28,8 +28,10 @@ bin_PROGRAMS = convert
 convert_SOURCES = x/y/convert.java
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 num=`grep depcomp Makefile.in | wc -l`
 test $num -gt 1
+
+:
index f3828ea..d5dedd6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 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
@@ -29,8 +29,6 @@ bin_PROGRAMS = convert
 convert_SOURCES = convert.java
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
@@ -47,3 +45,5 @@ test `wc -l < filt` = 1
 # Accept any outcome but `none'
 # (at the time of writing it should be gcc or gcc3).
 grep -v none filt
+
+:
index 6ef171d..f63a8d4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 _AM_DEPENDENCIES(GCJ)
 END
index be5f49c..347afd1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -19,8 +19,6 @@
 required='gcj'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_PROG_GCJ
 AC_OUTPUT
diff --git a/tests/gen-parallel-tests b/tests/gen-parallel-tests
deleted file mode 100755 (executable)
index fa51327..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-#! /bin/sh
-# Generate parallel-tests.am.
-#
-# Copyright (C) 2009, 2010, 2012 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/>.
-
-# For each automake test case that checks features of the TESTS automake
-# interface, generate a sibling test that does likewise, but with the
-# option `parallel-tests' enabled.  Individual tests can prevent the
-# creation of such a sibling by explicitly setting the `$parallel_tests'
-# variable to either "yes" or "no".  The rationale for this is that if
-# the variable is set to "yes", the test already uses the `parallel-tests'
-# option, so that a sibling would be just a duplicate; while if the
-# variable is set to "no", the test doesn't support, or is not meant to
-# run with, the `parallel-tests' option, and forcing it to do so in the
-# sibling would likely cause a spurious failure.
-
-set -e
-
-tests=`sed -n '/^handwritten_TESTS *=/,$p' <list-of-tests.mk \
-         | sed -n 's/\(.*\.test\).*/\1/p'`
-{
-  grep -l '^TESTS ' $tests
-  grep -l ' TESTS ' $tests
-} |
-grep -v '.-p\.test' |
-LC_ALL=C sort -u |
-while read tst; do
-  if grep '^[^#]*parallel-tests' $tst >/dev/null \
-     || grep "parallel_tests=" $tst >/dev/null
-  then :; else echo $tst; fi;
-done |
-{
-  echo "## Generated by gen-parallel-tests.  Edit Makefile.am instead of this."
-  echo "parallel_tests = \\"
-  sed 's,\.test$,-p.test,; $!s,$, \\,'
-}
diff --git a/tests/gen-testsuite-part b/tests/gen-testsuite-part
new file mode 100755 (executable)
index 0000000..195d6f5
--- /dev/null
@@ -0,0 +1,408 @@
+#! /usr/bin/env perl
+# Automatically compute some dependencies for the hand-written tests
+# of the Automake testsuite.  Also, automatically generate some more
+# tests from them (for particular cases/setups only).
+
+# Copyright (C) 2011, 2012 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/>.
+
+#--------------------------------------------------------------------------
+
+use warnings FATAL => "all";
+use strict;
+use File::Basename ();
+use constant TRUE => 1;
+use constant FALSE => 0;
+
+my $me = File::Basename::basename $0;
+
+# For use in VPATH builds.
+my $srcdir = ".";
+
+#--------------------------------------------------------------------------
+
+sub unindent ($)
+{
+  my $text = shift;
+  $text =~ /^(\s*)/;
+  my $indentation = $1;
+  $text =~ s/^$indentation//gm;
+  return $text;
+}
+
+sub atomic_write ($$;$)
+{
+  my ($outfile, $func) = (shift, shift);
+  my $perms = @_ > 0 ? shift : 0777;
+  my $tmpfile = "$outfile-t";
+  foreach my $f ($outfile, $tmpfile)
+    {
+      unlink $f or die "$me: cannot unlink `$f': $!\n"
+        if -e $f;
+    }
+  open (my $fh, ">$tmpfile")
+    or die "$me: can't write to `$tmpfile': $!\n";
+  $func->($fh);
+  close $fh
+    or die "$me: closing `$tmpfile': $!\n";
+  chmod ($perms & ~umask, $tmpfile)
+    or die "$me: cannot change perms for `$tmpfile': $!\n";
+  rename ($tmpfile, $outfile)
+    or die "$me: renaming `$tmpfile' -> `$outfile: $!\n'";
+}
+
+sub line_match ($$)
+{
+  my ($re, $file) = (shift, shift);
+  # Try both curdir and srcdir, with curdir first, to play nice
+  # with VPATH builds.
+  open (FH, "<$file") or open (FH, "<$srcdir/$file")
+    or die "$me: cannot open file `$file': $!\n";
+  my $ret = 0;
+  while (defined (my $line = <FH>))
+    {
+      if ($line =~ $re)
+        {
+          $ret = 1;
+          last;
+        }
+    }
+  close FH or die "$me: cannot close file `$file': $!\n";
+  return $ret;
+}
+
+sub write_wrapper_script ($$$)
+{
+  my ($file_handle, $wrapped_test, $shell_setup_code, $creator_name) = @_;
+  # FIXME: we use some creative quoting in the generated scripts,
+  # FIXME: to please maintainer-check.
+  print $file_handle unindent <<EOF;
+    #! /bin/sh
+    # This file has been automatically generated.  DO NOT EDIT BY HAND!
+    . ./defs-static || exit '99';
+    $shell_setup_code
+    # In the spirit of VPATH, we prefer a test in the build tree
+    # over one in the source tree.
+    for dir in . "\$testsrcdir"; do
+      if test -f "\$dir/$wrapped_test"; then
+        echo "\$0: will source \$dir/$wrapped_test"
+        . "\$dir/$wrapped_test"; exit "\$?"
+      fi
+    done
+    echo "\$0: cannot find wrapped test \\`$wrapped_test'" >&2
+    exit '99'
+EOF
+}
+
+sub get_list_of_tests ()
+{
+  my $make = defined $ENV{MAKE} ? $ENV{MAKE} : "make";
+  # Unset MAKEFLAGS, for when we are called from make itself.
+  my $cmd = "MAKEFLAGS= && unset MAKEFLAGS && cd '$srcdir' && "
+            . "$make -s -f list-of-tests.mk print-list-of-tests";
+  my @tests_list = split /\s+/, `$cmd`;
+  die "$me: cannot get list of tests\n" unless $? == 0 && @tests_list;
+  my $ok = 1;
+  foreach my $test (@tests_list)
+    {
+      # Respect VPATH builds.
+      next if -f $test || -f "$srcdir/$test";
+      warn "$me: test `$test' not found\n";
+      $ok = 0;
+    }
+  die "$me: some test scripts not found\n" if !$ok;
+  return @tests_list;
+}
+
+sub parse_options (@)
+{
+  use Getopt::Long qw/GetOptions/;
+  local @ARGV = @_;
+  GetOptions ('srcdir=s' => \$srcdir) or die "$me: usage error\n";
+  die "$me: too many arguments\n" if @ARGV > 0;
+  die "$me: srcdir `$srcdir': not a directory\n" unless -d $srcdir;
+}
+
+#--------------------------------------------------------------------------
+
+my %deps_extractor =
+  (
+    libtool_macros =>
+      {
+        line_matcher => qr/^\s*required=.*\blibtool/,
+        nodist_prereqs => "libtool-macros.log",
+      },
+    gettext_macros =>
+      {
+        line_matcher => qr/^\s*required=.*\bgettext/,
+        nodist_prereqs => "gettext-macros.log",
+      },
+    use_trivial_test_driver =>
+      {
+        line_matcher => qr/\btrivial-test-driver\b/,
+        dist_prereqs => "trivial-test-driver",
+      },
+    check_testsuite_summary =>
+      {
+        line_matcher => qr/\btestsuite-summary-checks\.sh\b/,
+        dist_prereqs => "testsuite-summary-checks.sh",
+      },
+    extract_testsuite_summary =>
+      {
+        line_matcher => qr/\bextract-testsuite-summary\b/,
+        dist_prereqs => "extract-testsuite-summary",
+      },
+    check_tap_testsuite_summary =>
+      {
+        line_matcher => qr/\btap-summary-aux\.sh\b/,
+        dist_prereqs => "tap-summary-aux.sh",
+      },
+    on_tap_with_common_setup =>
+      {
+        line_matcher => qr/\btap-setup\.sh\b/,
+        dist_prereqs => "tap-setup.sh",
+        nodist_prereqs => "tap-common-setup.log",
+      },
+    depcomp =>
+      {
+        line_matcher => qr/\bdepcomp\.sh\b/,
+        dist_prereqs => "depcomp.sh",
+      },
+  );
+
+#--------------------------------------------------------------------------
+
+my %test_generators =
+  (
+    #
+    # For each test script in the Automake testsuite that itself tests
+    # features of the TESTS automake interface, define a sibling test
+    # that does likewise, but with the option `parallel-tests' enabled.
+    #
+    # A test is considered a candidate for sibling-generation if any
+    # Makefile.am generated by it define the TESTS variable.
+    #
+    # Individual tests can prevent the creation of such a sibling by
+    # explicitly setting the `$am_parallel_tests' variable to either "yes"
+    # or "no".  The rationale for this is that if the variable is set to
+    # "yes", the test already uses the `parallel-tests' option, so that
+    # a sibling would be just a duplicate; while if the variable is set
+    # to "no", the test doesn't support, or is not meant to run with, the
+    # `parallel-tests' option, and forcing it to do so in the sibling
+    # would likely cause a spurious failure.
+    #
+    parallel_testsuite_harness =>
+      {
+        line_matcher =>
+          qr/(?:^|\s)TESTS\s*=/,
+        line_rejecter =>
+          qr/(?:^[^#]*\bparallel-tests\b)|\bam_parallel_tests=/,
+        shell_setup_code =>
+          'am_parallel_tests=yes'
+      },
+    #
+    # For each test script in the Automake testsuite that tests features
+    # of one or more automake-provided shell script from the `lib/'
+    # subdirectory by running those scripts directly (i.e., not thought
+    # make calls and automake-generated makefiles), define a sibling test
+    # that does likewise, but running the said script with the configure
+    # time $SHELL instead of the default system shell /bin/sh.
+    #
+    # A test is considered a candidate for sibling-generation if it calls
+    # the `get_shell_script' function anywhere.
+    #
+    # Individual tests can prevent the creation of such a sibling by
+    # explicitly setting the `$am_test_prefer_config_shell' variable
+    # to either "yes" or "no".
+    # The rationale for this is that if the variable is set to "yes",
+    # the test already uses $SHELL, so that a sibling would be just a
+    # duplicate; while if the variable is set to "no", the test doesn't
+    # support, or is not meant to use, $SHELL to run the script under
+    # testing, and forcing it to do so in the sibling would likely
+    # cause a spurious failure.
+    #
+    prefer_config_shell =>
+      {
+        line_matcher =>
+          qr/(^|\s)get_shell_script\s/,
+        line_rejecter =>
+          qr/\bam_test_prefer_config_shell=/,
+        shell_setup_code =>
+          'am_test_prefer_config_shell=yes',
+      },
+    #
+    # Tests on tap support should be run with both the perl and awk
+    # implementations of the TAP driver (they run with the awk one
+    # by default).
+    #
+    perl_tap_driver =>
+      {
+        line_matcher =>
+          qr<(?:\bfetch_tap_driver\b|[\s/]tap-setup\.sh\b)>,
+        line_rejecter =>
+          qr/\bam_tap_implementation=/,
+        shell_setup_code =>
+          'am_tap_implementation=perl',
+      },
+  );
+
+#--------------------------------------------------------------------------
+
+parse_options @ARGV;
+
+my @all_tests = get_list_of_tests;
+my @generated_tests = (); # Will be updated later.
+
+print "## -*- Makefile -*-\n";
+print "## Generated by $me.  DO NOT EDIT BY HAND!\n\n";
+
+print <<EOF;
+
+## --------------------------------------------- ##
+##  Autogenerated tests and their dependencies.  ##
+## --------------------------------------------- ##
+
+EOF
+
+# FIXME: the following is not really right, since cannot compose wrapping
+# of tests matching more than one condition.  Still, there should be no
+# such test at the moment, so the limitation is (temporarily) acceptable.
+while (my ($k, $g) = each %test_generators)
+  {
+    my @wrapped_tests = grep {
+      line_match ($g->{line_matcher}, $_)
+        && !line_match ($g->{line_rejecter}, $_)
+    } @all_tests;
+    foreach my $wrapped_test (@wrapped_tests)
+      {
+        (my $base = $wrapped_test) =~ s/\.([^.]*)$//;
+        my $suf = $1 or die "$me: test `$wrapped_test' lacks a suffix\n";
+        my $wrapper_test =  "$base-w.$suf";
+        # Register wrapper test as "autogenerated".
+        push @generated_tests, $wrapper_test;
+        # Create wrapper test.
+        atomic_write $wrapper_test,
+                     sub { write_wrapper_script $_[0], $wrapped_test,
+                           $g->{shell_setup_code} },
+                     0555;
+        # The generated test works by sourcing the original test, so that
+        # it has to be re-run every time that changes ...
+        print "$base-w.log: $wrapped_test\n";
+        # ... but also every time the prerequisites of the wrapped test
+        # changes.  The simpler (although suboptimal) way to do so is to
+        # ensure that the wrapped tests runs before the wrappee one (in
+        # case it needs to be re-run *at all*.
+        # FIXME: we could maybe refactor the script to find a more
+        # granular way to express such implicit dependencies.
+        print "$base-w.log: $base.log\n";
+      }
+  }
+
+print <<EOF;
+
+## ---------------------------------------------------- ##
+##  Ad-hoc autogenerated tests and their dependencies.  ##
+## ---------------------------------------------------- ##
+
+EOF
+
+print "## Tests on automatic dependency tracking (see 'depcomp.sh').\n";
+
+# Key: depmode, value: list of required programs.
+my %depmodes =
+  (
+    auto         => ["cc"],
+    disabled     => ["cc"],
+    makedepend   => ["cc", "makedepend"],
+    dashmstdout  => ["gcc"],
+    cpp          => ["gcc"],
+# This is for older (pre-3.x) GCC versions.  Newer versions
+# have depmode "gcc3".
+    gcc          => ["gcc"],
+# This is for older (pre-7) msvc versions.  Newer versions
+# have depmodes "msvc7" and "msvc7msys".
+    msvisualcpp  => ["cl", "cygpath"],
+    msvcmsys     => ["cl", "mingw"],
+  );
+
+foreach my $lt (TRUE, FALSE)
+  {
+    foreach my $m (keys %depmodes)
+      {
+        my @required =
+          (
+            @{$depmodes{$m}},
+            $lt ? ("libtoolize",) : (),
+          );
+        my @vars_init =
+          (
+            "depmode=$m",
+            "depcomp_with_libtool=" . ($lt ? "yes" : "no"),
+          );
+        my $base = "depcomp" . ($lt ? "-lt-" : "-") . $m;
+        # Register wrapper test as "autogenerated" ...
+        push @generated_tests, "$base.tap";
+        atomic_write ("$base.tap", sub
+          {
+            my $file_handle = shift;
+            print $file_handle unindent <<EOF;
+              #! /bin/sh
+              # Automatically generated test.  DO NOT EDIT BY HAND!
+              @vars_init
+              required="@required"
+              . ./defs-static || exit '99'
+              . "\$testsrcdir/depcomp.sh"; exit "\$?"
+EOF
+          },
+          0555);
+      }
+   }
+
+# Update generated makefile fragment to account for all the generated tests.
+print "generated_TESTS =\n";
+map { print "generated_TESTS += $_\n" } @generated_tests;
+
+# The test scripts are scanned for automatic dependency generation *after*
+# the generated tests have been created, so they too can be scanned.  To
+# do so correctly, we need to update the list in `@all_tests' to make it
+# comprise also the freshly-generated tests.
+
+push @all_tests, @generated_tests;
+
+print <<EOF;
+
+## ----------------------------- ##
+##  Autogenerated dependencies.  ##
+## ----------------------------- ##
+
+EOF
+
+while (my ($k, $x) = each %deps_extractor)
+  {
+    my $dist_prereqs = $x->{dist_prereqs} || "";
+    my $nodist_prereqs = $x->{nodist_prereqs} || "";
+    my @tests = grep { line_match $x->{line_matcher}, $_ } @all_tests;
+    map { s/\.[^.]*$//; s/$/\.log/; } (my @logs = @tests);
+    print "## Added by deps-extracting key `$k'.\n";
+    ## The list of all tests which have a dependency detected by the
+    ## current key.
+    print join(" \\\n  ", "${k}_TESTS =", @tests) . "\n";
+    print "EXTRA_DIST += $dist_prereqs\n";
+    map { print "$_: $dist_prereqs $nodist_prereqs\n" } @logs;
+    print "\n";
+  }
+
+
+__END__
index bad4735..789a015 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
-# FIXME: remove these once we are merged into master.
-top_testsrcdir=$testsrcdir/..
-testbuilddir=`(cd .. && pwd)`
-top_testbuilddir=`(cd $testbuilddir/.. && pwd)`
-
 st=0
 if test -d "$top_testsrcdir"/.git; then
   # We are running from a git checkout.
@@ -44,6 +37,10 @@ else
   ' "$top_testsrcdir"/ChangeLog || st=1
 fi
 $PERL -V || st=1
+# It's OK for the user not to have the TAP::Parser module; this can
+# happen with older perl installation, or on MinGW/MSYS.
+$PERL -e 'use TAP::Parser; print $TAP::Parser::VERSION, "\n"' || :
+
 cat "$top_testbuilddir/config.log" || st=1
 cat "$testbuilddir/aclocal-$APIVERSION" || st=1
 cat "$testbuilddir/automake-$APIVERSION" || st=1
index 03efe85..8dd05b5 100755 (executable)
@@ -74,7 +74,7 @@ else
   if $ACLOCAL -Wno-syntax -I m4 --install && test -f m4/gettext.m4; then
     : # Gettext macros already accessible by default.
   else
-    echo "skip_ \"couldn't find or get gettext macros\"" >> get.sh
+    echo "skip_all_ \"couldn't find or get gettext macros\"" >> get.sh
   fi
 fi
 
index b0bb2d2..d40c898 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 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
@@ -19,8 +19,6 @@
 required='gettext'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<END
 AM_GNU_GETTEXT
 AM_GNU_GETTEXT_VERSION([0.14.3])
@@ -53,7 +51,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 
-# po/ and intl/ are required
+# po/ and intl/ are required.
 
 AUTOMAKE_fails --add-missing
 grep 'AM_GNU_GETTEXT.*SUBDIRS' stderr
@@ -71,7 +69,7 @@ grep 'AM_GNU_GETTEXT.*po' stderr
 echo 'SUBDIRS = po intl' >Makefile.am
 $AUTOMAKE --add-missing
 
-# Make sure distcheck runs ./configure --with-included-gettext
+# Make sure distcheck runs `./configure --with-included-gettext'.
 grep 'with-included-gettext' Makefile.in
 
 # `SUBDIRS = po intl' isn't required if po/ doesn't exist.
index a8c95ad..dad775a 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 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
@@ -20,8 +21,6 @@
 required='gettext'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<END
 AM_GNU_GETTEXT([external])
 AC_OUTPUT
index a25af87..560c01b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -19,8 +19,6 @@
 required='gettext'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<END
 AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_INTL_SUBDIR
@@ -30,9 +28,9 @@ END
 echo 'SUBDIRS = po' >Makefile.am
 mkdir po
 
-# if aclocal fails, assume the gettext macros are too old and do not
+# If aclocal fails, assume the gettext macros are too old and do not
 # define AM_GNU_GETTEXT_INTL_SUBDIR.
-$ACLOCAL || Exit 77
+$ACLOCAL || skip_ "your gettext macros are probably too old"
 
 # config.rpath is required.
 : >config.rpath
index 897d0ab..7803a2a 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [3.5.3.2])
 AM_INIT_AUTOMAKE
index 4c5d54f..255ba7b 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2007, 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
@@ -16,7 +17,7 @@
 
 # Test to ensure std-options checking is correct.
 
-required=gcc
+required='cc native'
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
@@ -38,7 +39,7 @@ bin_SCRIPTS = sub/scriptok.sh sub/scriptnok.sh
 grep-stderr:
        grep 'pfubar$(EXEEXT) does not support' stderr
        grep 'pfubar3$(EXEEXT) does not support' stderr
-       grep 'pscriptnok.sh does not support' stderr
+       grep 'pscriptnok\.sh does not support' stderr
 ## Only three failures please.
        test `grep 'does not support --help' stderr | wc -l` = 3
        test `grep 'does not support --version' stderr | wc -l` = 3
@@ -48,12 +49,16 @@ test-install: install
        test ! -f ../inst-dir/bin/fine$(EXEEXT)
 END
 
-echo 'int main () { return 0; }' > fubar.c
+cat > fubar.c <<'END'
+int main (void)
+{
+  return 0;
+}
+END
 
 cat > fine.c << 'END'
 #include <stdio.h>
-int
-main ()
+int main (void)
 {
   puts ("Which version? Which usage?");
   return 0;
@@ -90,8 +95,6 @@ chmod +x sub/scriptnok.sh
 # (alpha.test checks the case where it must be distributed.)
 : > README-alpha
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
@@ -106,5 +109,7 @@ cd build
 $MAKE all
 $MAKE test-install
 $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k.
-cat stderr
+cat stderr >&2
 $MAKE grep-stderr
+
+:
index 7a08fb8..5813527 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 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
@@ -16,7 +16,7 @@
 
 # Check that AM_INSTALLCHECK_STD_OPTIONS_EXEMPT works.
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
@@ -40,13 +40,18 @@ AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = nok$(EXEEXT) nok.sh
 
 grep-stderr:
        grep 'sub/pnok$(EXEEXT) does not support' stderr
-       grep 'sub/pnok.sh does not support' stderr
+       grep 'sub/pnok\.sh does not support' stderr
 ## Only two failures please.
        test `grep 'does not support --help' stderr | wc -l` = 2
        test `grep 'does not support --version' stderr | wc -l` = 2
 END
 
-echo 'int main () { return 0; }' > nok.c
+cat > nok.c <<'END'
+int main (void)
+{
+  return 0;
+}
+END
 
 mkdir sub
 
@@ -70,8 +75,6 @@ chmod +x sub/nok.sh
 : > ChangeLog
 : > THANKS
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
@@ -83,14 +86,19 @@ cd build
 ../configure "--prefix=`pwd`/../inst-dir" --program-prefix=p
 $MAKE
 $MAKE install
+$MAKE installcheck && Exit 1
 $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k.
-cat stderr
+cat stderr >&2
 $MAKE grep-stderr
 
 # Make sure there is no more error when all targets are exempted.
 cd ..
-echo 'AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += sub/nok$(EXEEXT) sub/nok.sh' >> Makefile.am
+cat >> Makefile.am <<'END'
+AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += sub/nok$(EXEEXT) sub/nok.sh
+END
 $AUTOMAKE
 cd build
 ./config.status  # Don't rely on the rebuild rules (they need GNU make).
 $MAKE installcheck
+
+:
index 72bfa66..f5f299f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -20,8 +20,6 @@
 required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([sub/GNUmakefile])
 AC_OUTPUT
index 9c8aeb4..a29ffb4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -18,7 +18,8 @@
 
 . ./defs || Exit 1
 
-set -e
+# We need (almost) complete control over automake options.
+AUTOMAKE="$am_original_AUTOMAKE -Werror"
 
 cat >> configure.in << 'END'
 AC_PROG_CC
@@ -40,12 +41,14 @@ END
 
 $ACLOCAL
 # Don't warn in foreign mode
-$AUTOMAKE -Wnone --add-missing --foreign
+$AUTOMAKE --add-missing --foreign
 # Warn in gnu mode
-AUTOMAKE_fails -Wnone --add-missing --gnu
-grep 'Makefile.am:1:.*CFLAGS' stderr
-grep 'Makefile.am:2:.*LDFLAGS' stderr
+AUTOMAKE_fails --add-missing --gnu
+grep '^Makefile\.am:1:.*CFLAGS' stderr
+grep '^Makefile\.am:2:.*LDFLAGS' stderr
 # No reason to warn about CXXFLAGS since it's not used.
 grep CXXFLAGS stderr && Exit 1
 # Don't warn if -Wno-gnu.
-$AUTOMAKE -Wnone --gnu -Wno-gnu
+$AUTOMAKE --gnu -Wno-gnu
+
+:
index 0227e3a..b59f566 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([gnuwarn2], [1.0])
 AM_INIT_AUTOMAKE([no-installman])
index 350f8fc..2b272b9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2005, 2006, 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
 
 . ./defs || Exit 1
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in <<END
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
-include foo
+include Will_Be_Included_In_Makefile
 END
 
-: > foo
+: > Will_Be_Included_In_Makefile
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-len="`grep '^srcdir' Makefile.in | wc -l`"
-echo "len = $len"
-test $len -eq 1 || Exit 1
+$ACLOCAL
+$AUTOMAKE
+len=`grep '^srcdir' Makefile.in | wc -l`
+test $len -eq 1
 
 # Also make sure include file is distributed.
-(sed -n -e '/^DIST_COMMON =.*\\$/ {
+sed -n -e '/^DIST_COMMON =.*\\$/ {
    :loop
    p
    n
@@ -44,4 +46,6 @@ test $len -eq 1 || Exit 1
    t loop
    p
    n
-   }' -e '/^DIST_COMMON =/ p' Makefile.in | grep foo)
+   }' -e '/^DIST_COMMON =/ p' Makefile.in | grep Will_Be_Included_In_Makefile
+
+:
index 2ad2735..9d16747 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test for PR 68.
+#
+# == Report ==
+#  If an autoconf substitution variable of the form "*_HEADERS" --
+#  for example "MY_HEADERS" -- is used in an "include_" variable
+#  in conjunction with EXTRA_HEADERS, $(MY_HEADERS) gets included
+#  in the HEADERS variable for *all* generated Makefile.ins in the
+#  project.
 
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_SUBST(MY_HEADERS)
+AC_SUBST([MY_HEADERS])
 AC_PROG_CC
 END
 
@@ -31,8 +39,8 @@ END
 : > joe.c
 : > qq.h
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '[^@]MY_HEADERS' Makefile.in && Exit 1
 Exit 0
index e676e5e..651e048 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_DEP_TRACK
@@ -30,12 +28,10 @@ END
 $ACLOCAL
 $AUTOCONF
 
-./configure --help >stdout || { cat stdout; Exit 1; }
-cat stdout
+grep_configure_help --enable-dependency-tracking \
+                    ' not reject slow dependency extract'
 
-$EGREP '^  *--enable-dependency-tracking( |$)' stdout
-$EGREP '^  *--disable-dependency-tracking( |$)' stdout
-$FGREP ' speeds up one-time build' stdout
-$FGREP ' slow dependency extract' stdout
+grep_configure_help --disable-dependency-tracking \
+                    ' speeds up one-time build'
 
 :
index 6bad661..d44ff7a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -31,12 +29,10 @@ END
 $ACLOCAL
 $AUTOCONF
 
-./configure --help >stdout || { cat stdout; Exit 1; }
-cat stdout
+grep_configure_help --enable-dependency-tracking \
+                    ' not reject slow dependency extract'
 
-$EGREP '^  *--enable-dependency-tracking( |$)' stdout
-$EGREP '^  *--disable-dependency-tracking( |$)' stdout
-$FGREP ' speeds up one-time build' stdout
-$FGREP ' slow dependency extract' stdout
+grep_configure_help --disable-dependency-tracking \
+                    ' speeds up one-time build'
 
 :
index 51b3ba4..dc8c4c1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_WITH_DMALLOC
@@ -29,11 +27,6 @@ END
 $ACLOCAL
 $AUTOCONF
 
-./configure --help >stdout || { cat stdout; Exit 1; }
-cat stdout
-
-$EGREP '^   *--with-dmalloc( |$) ' stdout
-$FGREP ' use dmalloc' stdout
-$FGREP 'www.dmalloc.com' stdout
+grep_configure_help --with-dmalloc ' use dmalloc.*http://www\.dmalloc\.com'
 
 :
index fdd9fa0..8b5ec71 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -32,8 +30,8 @@ $AUTOCONF
 ./configure --help >stdout || { cat stdout; Exit 1; }
 cat stdout
 
-grep '^  *--program-prefix[= ]' stdout
-grep '^  *--program-suffix[= ]' stdout
-grep '^  *--program-transform-name[= ]' stdout
+grep '^  --program-prefix[= ]' stdout
+grep '^  --program-suffix[= ]' stdout
+grep '^  --program-transform-name[= ]' stdout
 
 :
index 5eb7ab9..9a72189 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_PATH_LISPDIR
@@ -32,11 +30,8 @@ $AUTOCONF
 ./configure --help >stdout || { cat stdout; Exit 1; }
 cat stdout
 
-$EGREP '^  *--with-lispdir( |$)' stdout
-grep ' override.*lisp directory' stdout
-$EGREP '^  *EMACS( |$)' stdout
-grep ' .*[eE]macs editor' stdout
-$EGREP '^  *EMACSLOADPATH( |$)' stdout
-grep ' .*[eE]macs library search path' stdout
+grep_configure_help --with-lispdir ' override.*lisp directory'
+grep_configure_help EMACS          ' [eE]macs editor'
+grep_configure_help EMACSLOADPATH  ' [eE]macs library search path'
 
 :
index 1657c34..6c31cde 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011, 2012 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
 
 # Make sure that our macro `AM_ENABLE_MULTILIB' adds proper text to
 # the configure help screen.
+# FIXME: the features tested by this script has been moved in contrib.
+# FIXME: We should move this script accordingly.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_ENABLE_MULTILIB
 END
 
-$ACLOCAL
+cat "$top_testsrcdir"/contrib/multilib/multi.m4 > aclocal.m4
 $AUTOCONF
 
-./configure --help >stdout || { cat stdout; Exit 1; }
-cat stdout
-
-$EGREP '^  *--enable-multilib( |$)' stdout
-$FGREP ' many library versions (default)' stdout
+grep_configure_help --enable-multilib ' many library versions \(default\)'
 
 :
index ba20013..9e4e48a 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_PATH_PYTHON
@@ -29,9 +27,6 @@ END
 $ACLOCAL
 $AUTOCONF
 
-./configure --help >stdout || { cat stdout; Exit 1; }
-cat stdout
-
-grep '^  *PYTHON  *the Python interpreter$' stdout
+grep_configure_help PYTHON 'the Python interpreter'
 
 :
index e59f2f1..855be52 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_SILENT_RULES
@@ -30,16 +28,16 @@ $ACLOCAL
 
 mv -f configure.in configure.tmpl
 
+q="[\`'\"]"
+
 for args in '' '([])' '([yes])' '([no])'; do
   sed "s/AM_SILENT_RULES.*/&$args/" configure.tmpl >configure.in
   cat configure.in
   $AUTOCONF --force
-  ./configure --help >stdout || { cat stdout; Exit 1; }
-  cat stdout
-  $EGREP '^  *--enable-silent-rules( |$)' stdout
-  grep ' less verbose build.*undo.*make V=1' stdout
-  $EGREP '^  *--disable-silent-rules ( |$)' stdout
-  grep ' verbose build.*undo.*make V=0' stdout
+  grep_configure_help --enable-silent-rules \
+                      " less verbose build.*\\(undo.*${q}make V=1${q}"
+  grep_configure_help --disable-silent-rules \
+                      " verbose build.*\\(undo.*${q}make V=0${q}"
 done
 
 :
index 8f5ff5f..0438b4d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_PROG_UPC
@@ -29,10 +27,7 @@ END
 $ACLOCAL
 $AUTOCONF
 
-./configure --help >stdout || { cat stdout; Exit 1; }
-cat stdout
-
-grep '^  *UPCFLAGS .*Unified Parallel C compiler flags' stdout
-grep '^  *UPC .*Unified Parallel C compiler command' stdout
+grep_configure_help UPC      '[Uu]nified Parallel C compiler command'
+grep_configure_help UPCFLAGS '[Uu]nified Parallel C compiler flags'
 
 :
index dd8b3b4..71e7f72 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2008, 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
 
 . ./defs || Exit 1
 
-set -e
-
 # Ensure we run in an empty directory.
 mkdir emptydir
 cd emptydir
 
-# Honour user overrides for $ACLOCAL and $AUTOMAKE.
-ACLOCAL=`echo " $ACLOCAL " | sed 's/ -W[^ ]*/ /g'`
-AUTOMAKE=`echo " $AUTOMAKE " | sed 's/ -W[^ ]*/ /g'`
+# Honour user overrides for $ACLOCAL and $AUTOMAKE, but without
+# adding extra options.
+ACLOCAL=$am_original_ACLOCAL
+AUTOMAKE=$am_original_AUTOMAKE
 
 $ACLOCAL --version
 $ACLOCAL --help
index b74f30a..0f710b7 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # contains a broken configure.in and a broken acinclude.m4.
 . ./defs || Exit 1
 
-set -e
-
 # Ensure we run in a new, clean directory.
 mkdir cleandir
 cd cleandir
 
-# Honour user overrides for $ACLOCAL and $AUTOMAKE.
-ACLOCAL=`echo " $ACLOCAL " | sed 's/ -W[^ ]*/ /g'`
-AUTOMAKE=`echo " $AUTOMAKE " | sed 's/ -W[^ ]*/ /g'`
+# Honour user overrides for $ACLOCAL and $AUTOMAKE, but without
+# adding extra options.
+ACLOCAL=$am_original_ACLOCAL
+AUTOMAKE=$am_original_AUTOMAKE
 
 echo '[' > configure.in
 echo '[' > acinclude.m4
index 72399e3..5c67a14 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 . ./defs || Exit 1
 
-set -e
-
 # We must have full control over the content of the current directory.
 mkdir cleandir
 cd cleandir
 
-# Honour user overrides for $ACLOCAL and $AUTOMAKE.
-ACLOCAL=`echo " $ACLOCAL " | sed 's/ -W[^ ]*/ /g'`
-AUTOMAKE=`echo " $AUTOMAKE " | sed 's/ -W[^ ]*/ /g'`
+# Honour user overrides for $ACLOCAL and $AUTOMAKE, but without
+# adding extra options.
+ACLOCAL=$am_original_ACLOCAL
+AUTOMAKE=$am_original_AUTOMAKE
 
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
@@ -36,7 +35,7 @@ AC_CONFIG_FILES([Makefile])
 END
 
 cat > Makefile.am <<END
-## so that install-sh will be required
+# So that install-sh will be required.
 pkgdata_DATA =
 END
 
index 1b7de41..aba7145 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 . ./defs || Exit 1
 
-set -e
-
 # Ensure we run in an empty directory.
 mkdir emptydir
 cd emptydir
 
-# Honour user overrides for $ACLOCAL and $AUTOMAKE.
-ACLOCAL=`echo " $ACLOCAL " | sed 's/ -W[^ ]*/ /g'`
-AUTOMAKE=`echo " $AUTOMAKE " | sed 's/ -W[^ ]*/ /g'`
+# Honour user overrides for $ACLOCAL and $AUTOMAKE, but without
+# adding extra options.
+ACLOCAL=$am_original_ACLOCAL
+AUTOMAKE=$am_original_AUTOMAKE
 
-escape_dots () { sed 's/\./\\./g'; } # avoid issues with `\' in backquotes
+escape_dots () { sed 's/\./\\./g'; } # Avoid issues with `\' in backquotes.
 apiversion_rx=`echo "$APIVERSION" | escape_dots`
 
 $ACLOCAL --version --help >stdout || { cat stdout; Exit 1; }
index 8f0c5cc..cf0a243 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
@@ -21,8 +21,6 @@
 # Report from Peter O'Gorman.
 
 . ./defs || Exit 1
-set -e
-
 echo AC_OUTPUT >>configure.in
 
 : >CHANGELOG
diff --git a/tests/hosts.test b/tests/hosts.test
deleted file mode 100755 (executable)
index 2df150b..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2004  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/>.
-
-# Test to make sure automake correctly recognizes presence of
-# AC_CANONICAL_(BUILD|HOST|SYSTEM|TARGET), and creates config.* in all
-# those cases.
-# From Norman Gray.
-
-. ./defs || Exit 1
-
-set -e
-
-: >Makefile.am
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-test ! -f config.guess
-test ! -f config.sub
-
-# Test all four of the AC_CANONICAL_* targets, including _SYSTEM, which is
-# supported but deprecated by autoconf.
-for macro in AC_CANONICAL_BUILD AC_CANONICAL_HOST \
-             AC_CANONICAL_SYSTEM AC_CANONICAL_TARGET
-do
-  rm -rf autom4te.cache config.sub config.guess
-
-  cat >configure.in<<EOF
-AC_INIT([hosts], [1.0])
-$macro
-AM_INIT_AUTOMAKE
-AC_CONFIG_FILES([Makefile])
-EOF
-
-  $ACLOCAL
-  $AUTOMAKE --add-missing
-
-  # Show the files which were installed
-  ls
-
-  test -f config.guess
-  test -f config.sub
-done
index 210b2dc..64feca7 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -27,7 +28,9 @@ cat > Makefile.am << 'END'
 noinst_PROGRAMS = libapp_1
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^libapp_1_OBJECTS' Makefile.in | $FGREP '.$(OBJEXT)'
+
+:
index 2cde524..cf03cbd 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure info files are distributed correctly.
+# FIXME: This test is probably obsoleted, or wrong.  The generated
+#        Makefile.in seems not to define any `INFOS' variable!
 
 . ./defs || Exit 1
 
 cat > Makefile.am << 'END'
 info_TEXINFOS = foo.texi
-
-magic:
-       @echo $(INFOS)
 END
 
 echo '@setfilename foo.info' > foo.texi
 : > texinfo.tex
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 for i in `grep '^INFOS =' Makefile.in | sed -e 's/^INFOS = //'`; do
    echo $i
@@ -41,3 +41,5 @@ for i in `grep '^INFOS =' Makefile.in | sed -e 's/^INFOS = //'`; do
        ;;
    esac
 done
+
+:
index 38ec681..896bd27 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 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
 # 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 we give a sensible error message when neither AC_INIT nor
-# AM_INIT_AUTOMAKE are given arguments.
+# Make sure we give a sensible error message when AC_INIT and
+# AM_INIT_AUTOMAKE are both given less than two arguments.
 
 . ./defs || Exit 1
 
-set -e
-
-cat >configure.in <<END
-AC_INIT
-AM_INIT_AUTOMAKE
+for ac_init_args in '' '([x])'; do
+  for am_init_args in '' '([1.10])'; do
+    rm -rf aclocal.m4 autom4te*.cache
+    unindent >configure.in <<END
+      AC_INIT$ac_init_args
+      AM_INIT_AUTOMAKE$am_init_args
 END
+    cat configure.in # For debugging.
+    # The error message should mention AC_INIT, not AC_PACKAGE_VERSION.
+    ($ACLOCAL && $AUTOCONF) 2>stderr && { cat stderr >&2; Exit 1; }
+    cat stderr >&2
+    $FGREP AC_PACKAGE_VERSION stderr && Exit 1
+    grep 'configure\.in:.* AC_INIT .*arguments' stderr
+  done
+done
 
-# The error message should mension AC_INIT, not AC_PACKAGE_VERSION.
-($ACLOCAL && $AUTOCONF) 2>stderr && { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep AC_PACKAGE_VERSION stderr && Exit 1
-grep AC_INIT stderr
+:
index 31631d7..9e069eb 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >configure.in <<END
 AC_INIT([init2], [1.0])
 AM_INIT_AUTOMAKE([nosuchoption])
index c64f1f7..11bde9b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2010, 2011
 # Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 
 . ./defs || Exit 1
 
+echo AC_OUTPUT >> configure.in
+
 cat > Makefile.am << 'END'
 pkgdata_DATA =
-magic:
-       @echo $(DISTFILES)
+.PHONY: test
+test: distdir
+       find $(distdir) ;: For debugging.
+       echo ' ' $(DISTFILES) ' ' | grep '[ /]install-sh '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]install-sh '
+       test -f $(distdir)/install-sh
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+$MAKE test
 
-$FGREP -v @SET_MAKE@ Makefile.in > Makefile.sed
-$MAKE -s -f Makefile.sed SHELL=$SHELL magic | grep install-sh
+:
index 044bf6d..7a8fcf7 100755 (executable)
@@ -30,8 +30,6 @@ mkdir bin
 saved_PATH=$PATH; export saved_PATH
 PATH=$cwd/bin$PATH_SEPARATOR$PATH; export PATH
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
index 3cc71f5..a04c0af 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2010 Free Software
+# Copyright (C) 1999, 2000, 2001, 2002, 2006, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT
 dnl Prevent automake from looking in .. and ../..
@@ -41,7 +39,7 @@ $AUTOMAKE -a
 chmod 000 Makefile.am
 
 # On some systems (like DOS and Windows), files are always readable.
-test ! -r Makefile.am || Exit 77
+test ! -r Makefile.am || skip_ "cannot drop file read permissions"
 
 ./configure
 
index b09f495..faa074d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test for PR 203.
+# == Report ==
+# Some standard targets are missing `-local' hooks.  For instance,
+# installdirs is missing this.  Ideally this would be an automatic
+# feature of any exported target.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 installdirs-local:
        @echo here
index a6ec01a..544b6cb 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002  Free Software Foundation, Inc.
+# 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
 
 . ./defs || Exit 1
 
-echo 'AC_SUBST(INSTALL_DATA)' >> configure.in
+cat >> configure.in <<END
+AC_SUBST([INSTALL_DATA])
+END
 
 : > Makefile.am
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
-(grep '^DATA =' Makefile.in | grep INSTALL_DATA) && Exit 1
+grep '^DATA =' Makefile.in | grep 'INSTALL_DATA' && Exit 1
 Exit 0
index 966f0cf..7dd911a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 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
@@ -62,7 +62,6 @@ pkgdata_SCRIPTS = script
 ##pkginclude_SCRIPTS = script
 EOF
 
-set -e
 $ACLOCAL || Exit 1
 $AUTOMAKE
 
index 94a6a25..6b8aa18 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011, 2012 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
@@ -19,8 +19,6 @@
 required=javac
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_OUTPUT
 END
@@ -57,4 +55,5 @@ $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'rm -f' stdout && Exit 1
 $MAKE -e uninstall DESTDIR="$destdir"
+
 :
index 475e935..9187b92 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011, 2012 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
@@ -19,8 +19,6 @@
 required=emacs
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AM_PATH_LISPDIR
 AC_OUTPUT
@@ -55,4 +53,5 @@ $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'rm -f' stdout && Exit 1
 $MAKE -e uninstall DESTDIR="$destdir"
+
 :
index 1fb4f37..bf9330f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# If $(libdir) is the empty string, then nothing should be installed there.
+# If $(libdir) or $(pyexecdir) is the empty string, then nothing should
+# be installed there.
 # This test exercises the libtool code paths.
 
-required=libtoolize
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_LIBTOOL
+AM_PATH_PYTHON
 AC_OUTPUT
 END
 
@@ -37,6 +38,8 @@ bin_PROGRAMS = p
 nobase_bin_PROGRAMS = np sub/np
 lib_LTIBRARIES = libfoo.la
 nobase_lib_LTLIBRARIES = libnfoo.la sub/libnfoo.la
+pyexec_LTIBRARIES = libpy.la
+nobase_pyexec_LTLIBRARIES = libnpy.la sub/libnpy.la
 END
 
 cat >p.c <<'END'
@@ -47,6 +50,9 @@ cp p.c sub/np.c
 cp p.c libfoo.c
 cp p.c libnfoo.c
 cp p.c sub/libnfoo.c
+cp p.c libpy.c
+cp p.c libnpy.c
+cp p.c sub/libnpy.c
 
 libtoolize
 $ACLOCAL
@@ -57,11 +63,13 @@ instdir=`pwd`/inst
 destdir=`pwd`/dest
 mkdir build
 cd build
-../configure --prefix="$instdir"
+../configure --prefix="$instdir" PYTHON="echo" \
+             am_cv_python_pythondir="$instdir/python" \
+             am_cv_python_pyexecdir="$instdir/pyexec"
 $MAKE
 
-bindir= libdir=
-export bindir libdir
+bindir= libdir= pyexecdir=
+export bindir libdir pyexecdir
 $MAKE -e install
 test ! -d "$instdir"
 $MAKE -e install DESTDIR="$destdir"
@@ -69,6 +77,11 @@ test ! -d "$instdir"
 test ! -d "$destdir"
 $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
 cat stdout
-grep 'rm -f' stdout && Exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+# Creative quoting below to please maintainer-check.
+grep 'rm'' ' stdout && Exit 1
+$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; Exit 1; }
+cat stdout
+# Creative quoting below to please maintainer-check.
+grep 'rm'' ' stdout && Exit 1
+
 :
index 6a73b75..5e7c6a1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# If $(bindir) is the empty string, then nothing should be installed there.
+# If $(bindir), $(libdir) or $(pyexecdir) is the empty string, then
+# nothing should be installed there.
 # This test exercises the prog and libs code paths.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_RANLIB
+AM_PATH_PYTHON
 AC_OUTPUT
 END
 
@@ -36,6 +38,8 @@ bin_PROGRAMS = p
 nobase_bin_PROGRAMS = np sub/np
 lib_LIBRARIES = libfoo.a
 nobase_lib_LIBRARIES = libnfoo.a sub/libnfoo.a
+pyexec_PROGRAMS = py
+nobase_pyexec_PROGRAMS = npy sub/npy
 END
 
 cat >p.c <<'END'
@@ -46,6 +50,9 @@ cp p.c sub/np.c
 cp p.c libfoo.c
 cp p.c libnfoo.c
 cp p.c sub/libnfoo.c
+cp p.c py.c
+cp p.c npy.c
+cp p.c sub/npy.c
 
 $ACLOCAL
 $AUTOCONF
@@ -55,11 +62,13 @@ instdir=`pwd`/inst
 destdir=`pwd`/dest
 mkdir build
 cd build
-../configure --prefix="$instdir"
+../configure --prefix="$instdir" PYTHON="echo" \
+             am_cv_python_pythondir="$instdir/python" \
+             am_cv_python_pyexecdir="$instdir/pyexec"
 $MAKE
 
-bindir= libdir=
-export bindir libdir
+bindir= libdir= pyexecdir=
+export bindir libdir pyexecdir
 $MAKE -e install
 test ! -d "$instdir"
 $MAKE -e install DESTDIR="$destdir"
@@ -67,6 +76,11 @@ test ! -d "$instdir"
 test ! -d "$destdir"
 $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
 cat stdout
-grep 'rm -f' stdout && Exit 1
-$MAKE -e uninstall DESTDIR="$destdir"
+# Creative quoting below to please maintainer-check.
+grep 'rm'' ' stdout && Exit 1
+$MAKE -e uninstall DESTDIR="$destdir" > stdout || { cat stdout; Exit 1; }
+cat stdout
+# Creative quoting below to please maintainer-check.
+grep 'rm'' ' stdout && Exit 1
+
 :
index 2af2408..3293f69 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011, 2012 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
@@ -19,8 +19,6 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AM_PATH_PYTHON
 AC_OUTPUT
@@ -59,4 +57,5 @@ $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'rm -f' stdout && Exit 1
 $MAKE -e uninstall DESTDIR="$destdir"
+
 :
index 8210535..5e9ee9d 100755 (executable)
 required='makeinfo-html tex texi2dvi'
 . ./defs || Exit 1
 
-dvips --help || Exit 77
-pdfetex --help || pdftex --help || Exit 77
-
-set -e
+dvips --help \
+  || skip_ "dvips is missing"
+pdfetex --version || pdftex --version \
+  || skip_ "pdeftex and pdftex are both missing"
 
 cat >>configure.in <<'END'
 AC_OUTPUT
index 1132738..f38394e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011, 2012 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_SUBST([foodir], ['${datadir}'/foo])
 AC_OUTPUT
@@ -68,4 +66,5 @@ $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'rm -f' stdout && Exit 1
 $MAKE -e uninstall DESTDIR="$destdir"
+
 :
index b0b78b7..e764d7d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011, 2012 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_SUBST([foodir], ['${datadir}'/foo])
 AC_OUTPUT
@@ -90,4 +88,5 @@ $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'rm -f' stdout && Exit 1
 $MAKE -e uninstall DESTDIR="$destdir"
+
 :
index 411f867..f3f5a5d 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 : > Makefile.am
 
 $ACLOCAL
index 70d4657..3ac2986 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -22,8 +22,6 @@
 required='makeinfo'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<END
 AC_OUTPUT
 END
@@ -57,7 +55,7 @@ $MAKE uninstall
 for file in info1.info
 do
   chmod a-r $file
-  test ! -r $file || Exit 77
+  test ! -r $file || skip_ "cannot drop file read permissions"
   $MAKE install-data && Exit 1
   chmod u+r $file
 done
index 8f527cf..7daf387 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -22,8 +22,6 @@
 required=javac
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_OUTPUT
 END
@@ -34,11 +32,7 @@ java_JAVA = java1.java java2.java java3.java
 END
 
 for n in 1 2 3; do
-  cat >java$n.java <<END
-class java$n
-{
-}
-END
+  echo "class java$n { }" >java$n.java
 done
 
 $ACLOCAL
@@ -55,7 +49,7 @@ $MAKE uninstall
 for file in java1.class
 do
   chmod a-r $file
-  test ! -r $file || Exit 77
+  test ! -r $file || skip_ "cannot drop file read permissions"
   $MAKE install-data && Exit 1
   chmod u+r $file
 done
index 1e756a6..d137603 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
 
 # This is the libtool sister test of instfail.test
 
-required='libtool libtoolize'
+required='cc libtool libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<END
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
@@ -66,7 +65,7 @@ $MAKE uninstall
 for file in liblt1.la libltn1.la
 do
   chmod a-r $file
-  test ! -r $file || Exit 77
+  test ! -r $file || skip_ "cannot drop file read permissions"
   $MAKE install-exec && Exit 1
   chmod u+r $file
 done
index 38a1c9c..9d5b571 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
 
 # This test has a few sister tests, for java, info, libtool.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<END
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_PATH_LISPDIR
 AC_OUTPUT
@@ -70,7 +70,7 @@ $MAKE uninstall
 for file in lib1.a libn1.a
 do
   chmod a-r $file
-  test ! -r $file || Exit 77
+  test ! -r $file || skip_ "cannot drop file read permissions"
   $MAKE install-exec && Exit 1
   chmod u+r $file
 done
index 1b03324..50b7fd2 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2005, 2007, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005, 2007, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AC_PROG_LN_S
 AC_OUTPUT
index 89c1a5e..7557705 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1998, 2001, 2002, 2003, 2006 Free Software
+# Copyright (C) 1996, 1998, 2001, 2002, 2003, 2006, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'EOF'
index 77844fa..d082c08 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
@@ -25,7 +26,9 @@ EOF
 
 : > frob.8
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^install-man' Makefile.in
+
+:
index fe55be4..f0b15f4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # In order to have a useful test on modern systems (which have a high
 # limit, if any), use a fake install program that errors out for more
 # than 2K characters in a command line.  The POSIX limit is 4096, but
@@ -30,14 +28,7 @@ set -e
 limit=2500
 subdir=long_subdir_name_with_many_characters
 nfiles=81
-
-# Let's use `seq' if available, it's faster than the loop.
-list=`(seq 1 $nfiles) 2>/dev/null || {
-  i=1
-  while test $i -le $nfiles; do
-    echo $i
-    i=\`expr $i + 1\`
-  done; }`
+list=`seq_ 1 $nfiles`
 
 sed "s|@limit@|$limit|g" >myinstall.in <<'END'
 #! /bin/sh
@@ -92,11 +83,11 @@ notrans_man3_MANS =
 END
 
 for n in $list; do
-  cat >>Makefile.am <<END
-man_MANS += page$n.1
-man3_MANS += page$n.man
-notrans_man_MANS += npage$n.1
-notrans_man3_MANS += npage$n.man
+  unindent >>Makefile.am <<END
+    man_MANS += page$n.1
+    man3_MANS += page$n.man
+    notrans_man_MANS += npage$n.1
+    notrans_man3_MANS += npage$n.man
 END
   echo >page$n.1
   echo >page$n.man
@@ -136,7 +127,7 @@ srcdir=../../$subdir
 
 for file in page3.1 page$nfiles.1 npage3.1 npage$nfiles.1; do
   chmod a-r $srcdir/$file
-  test ! -r $srcdir/$file || Exit 77
+  test ! -r $srcdir/$file || skip_ "cannot drop file read permissions"
   $MAKE install-man1 && Exit 1
   chmod u+r $srcdir/$file
 done
index 7648e1b..0031913 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 required='python'
 . ./defs || Exit 1
 
-set -e
-
 limit=2500
 subdir=long_subdir_name_with_many_characters
 nfiles=81
-
-list=`(seq 1 $nfiles) 2>/dev/null || {
-  i=1
-  while test $i -le $nfiles; do
-    echo $i
-    i=\`expr $i + 1\`
-  done; }`
+list=`seq_ 1 $nfiles`
 
 sed "s|@limit@|$limit|g" >myinstall.in <<'END'
 #! /bin/sh
@@ -86,9 +78,9 @@ nobase_python_PYTHON =
 END
 
 for n in $list; do
-  cat >>Makefile.am <<END
-python_PYTHON += python$n.py
-nobase_python_PYTHON += npython$n.py
+  unindent >>Makefile.am <<END
+    python_PYTHON += python$n.py
+    nobase_python_PYTHON += npython$n.py
 END
   echo >python$n.py
   echo >npython$n.py
@@ -123,7 +115,7 @@ srcdir=../../$subdir
 for file in python3.py python$nfiles.py
 do
   chmod a-r $srcdir/$file
-  test ! -r $srcdir/$file || Exit 77
+  test ! -r $srcdir/$file || skip_ "cannot drop file read permissions"
   $MAKE install && Exit 1
   chmod u+r $srcdir/$file
 done
index 2de026d..5a5a324 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
@@ -28,8 +28,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # In order to have a useful test on modern systems (which have a high
 # limit, if any), use a fake install program that errors out for more
 # than 2K characters in a command line.  The POSIX limit is 4096, but
@@ -38,14 +36,7 @@ set -e
 limit=2500
 subdir=long_subdir_name_with_many_characters
 nfiles=81
-
-# Let's use `seq' if available, it's faster than the loop.
-list=`(seq 1 $nfiles) 2>/dev/null || {
-  i=1
-  while test $i -le $nfiles; do
-    echo $i
-    i=\`expr $i + 1\`
-  done; }`
+list=`seq_ 1 $nfiles`
 
 sed "s|@limit@|$limit|g" >myinstall.in <<'END'
 #! /bin/sh
@@ -102,13 +93,13 @@ nobase_include_HEADERS =
 END
 
 for n in $list; do
-  cat >>Makefile.am <<END
-bin_SCRIPTS += script$n
-nobase_bin_SCRIPTS += nscript$n
-data_DATA += data$n
-nobase_data_DATA += ndata$n
-include_HEADERS += header$n.h
-nobase_include_HEADERS += nheader$n.h
+  unindent >>Makefile.am <<END
+    bin_SCRIPTS += script$n
+    nobase_bin_SCRIPTS += nscript$n
+    data_DATA += data$n
+    nobase_data_DATA += ndata$n
+    include_HEADERS += header$n.h
+    nobase_include_HEADERS += nheader$n.h
 END
   echo >script$n
   echo >nscript$n
@@ -151,7 +142,7 @@ srcdir=../../$subdir
 for file in script3 script$nfiles
 do
   chmod a-r $srcdir/$file
-  test ! -r $srcdir/$file || Exit 77
+  test ! -r $srcdir/$file || skip_ "cannot drop file read permissions"
   $MAKE install-binSCRIPTS && Exit 1
   chmod u+r $srcdir/$file
 done
index 61f5f9e..53397c3 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1999, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1999, 2001, 2002, 2003, 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
@@ -20,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 : > Makefile.am
 rm -f install-sh
 
index 927edeb..45e1746 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/>.
 
-# Various install-sh checks
+# Various install-sh checks.
 
+am_create_testdir=empty
 . ./defs || Exit 1
-set -e
 
-# Basic errors
+get_shell_script install-sh
+
+# Basic errors.
 ./install-sh && Exit 1
 ./install-sh -m 644 dest && Exit 1
 
-# Directories
+# Directories.
 
 # It should be OK to create no directory.  We sometimes need
 # this when directory are conditionally defined.
@@ -38,7 +40,7 @@ test -d d1
 test -d d2
 test -d d3
 test -d d4
-# Subdirectories
+# Subdirectories.
 ./install-sh -d p1/p2/p3 p4//p5//p6//
 test -d p1/p2/p3
 test -d p4/p5/p6
@@ -51,7 +53,7 @@ test -f y
 ./install-sh -m 644 y z
 test -f y
 test -f z
-# Multiple files
+# Multiple files.
 ./install-sh -m 644 -c x z d1
 test -f x
 test -f z
index b7b8761..80c2e54 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008, 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
 
 # More install-sh checks: check -C.
 
+am_create_testdir=empty
 required=non-root
 . ./defs || Exit 1
-set -e
 
 # Solaris /usr/ucb/touch does not accept -t.
-touch -t $old_timestamp foo || Exit 77
+touch -t $old_timestamp foo \
+  || skip_ "touch utility doesn't accept '-t' option"
+
+get_shell_script install-sh
 
 ./install-sh -d d1
 
diff --git a/tests/instspc.tap b/tests/instspc.tap
new file mode 100755 (executable)
index 0000000..914b36c
--- /dev/null
@@ -0,0 +1,335 @@
+#! /bin/sh
+# Copyright (C) 2010, 2011, 2012 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/>.
+
+# Check that building from, or installing to, directories with shell
+# metacharacters succeed.
+# Original report from James Amundson about file names with spaces.
+# Other characters added by Paul Eggert.
+
+. ./defs || Exit 99
+
+# Usage: is_in_list ITEM [LIST...]
+is_in_list ()
+{
+  item=$1; shift;
+  case " $* " in
+    *[\ \      ]"$item"[\ \    ]*) return 0;;
+    *) return 1;;
+  esac
+}
+
+# Helper subroutine for test data definition.
+# Usage: define_problematic_string NAME STRING
+define_problematic_string ()
+{
+  tst=$1; shift
+  eval "instspc__$tst=\$1" \
+    || fatal_ "define_problematic_string: bad argument: '$tst'"
+  shift
+  all_test_names_list="$all_test_names_list $tst"
+  # Some of the "problematic" characters cannot be used in the name of
+  # a build or install directory on a POSIX host.  These lists should
+  # be empty, but are not due to limitations in Autoconf, Automake, Make,
+  # M4, or the shell.
+  if is_in_list fail-builddir "$@"; then
+    builddir_xfails="$builddir_xfails $tst"
+  fi
+  if is_in_list fail-destdir "$@"; then
+    destdir_xfails="$destdir_xfails $tst"
+  fi
+}
+
+# Be sure to avoid interferences from the environment.
+all_test_names_list=''
+builddir_xfails=''
+destdir_xfails=''
+
+expected_to_fail ()
+{
+   case $1 in
+     build) is_in_list "$2" $builddir_xfails;;
+      dest) is_in_list "$2" $destdir_xfails;;
+         *) fatal_ "incorrect 'expected_to_fail' usage";;
+   esac
+}
+
+# Helper subroutines for creation of input data files.
+create_input_data ()
+{
+  mkdir sub
+
+  unindent >> configure.in << 'EOF'
+    AC_PROG_CC
+    AM_PROG_AR
+    AC_PROG_RANLIB
+    AC_OUTPUT
+EOF
+
+  : > sub/base.h
+  : > sub/nobase.h
+  : > sub/base.dat
+  : > sub/nobase.dat
+  : > sub/base.sh
+  : > sub/nobase.sh
+
+  unindent > source.c << 'EOF'
+    int
+    main (int argc, char **argv)
+    {
+      return 0;
+    }
+EOF
+
+  unindent > Makefile.am << 'EOF'
+    foodir = $(prefix)/foo
+    fooexecdir = $(prefix)/foo
+
+    foo_HEADERS = sub/base.h
+    nobase_foo_HEADERS = sub/nobase.h
+
+    dist_foo_DATA = sub/base.dat
+    nobase_dist_foo_DATA = sub/nobase.dat
+
+    dist_fooexec_SCRIPTS = sub/base.sh
+    nobase_dist_fooexec_SCRIPTS = sub/nobase.sh
+
+    fooexec_PROGRAMS = sub/base
+    nobase_fooexec_PROGRAMS = sub/nobase
+    sub_base_SOURCES = source.c
+    sub_nobase_SOURCES = source.c
+
+    fooexec_LIBRARIES = sub/libbase.a
+    nobase_fooexec_LIBRARIES = sub/libnobase.a
+    sub_libbase_a_SOURCES = source.c
+    sub_libnobase_a_SOURCES = source.c
+
+    .PHONY: test-inst
+    test-inst: install
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.h'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.dat'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.sh'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a'
+       test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a'
+       test   -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a'
+EOF
+
+  $ACLOCAL     || framework_failure_ "aclocal failed"
+  $AUTOCONF    || framework_failure_ "autoconf failed"
+  $AUTOMAKE -a || framework_failure_ "automake failed"
+}
+
+# ================= #
+#  Test data begin  #
+# ----------------- #
+
+# Some control characters that are white space.
+bs='\b'   # back space
+cr='\r'   # carriage return
+ff='\f'   # form feed
+ht='   ' # horizontal tab
+lf='
+'         # line feed (aka newline)
+
+# Hack to save typing and make code visually clearer.
+def=define_problematic_string
+
+$def    squote          \'          fail-builddir  fail-destdir
+$def    dquote          '"'         fail-builddir  fail-destdir
+$def    bquote          '`'         fail-builddir  fail-destdir
+$def    sharp           '#'         fail-builddir  fail-destdir
+$def    dollar          '$'         fail-builddir  fail-destdir
+$def    bang            '!'
+$def    bslash          '\'         fail-builddir
+$def    ampersand       '&'         fail-builddir
+$def    percent         '%'
+$def    leftpar         '('
+$def    rightpar        ')'
+$def    pipe            '|'
+$def    caret           '^'
+$def    tilde           '~'
+$def    qmark           '?'
+$def    star            '*'
+$def    plus            '+'
+$def    minus           '-'
+$def    comma           ','
+$def    colon           ':'
+$def    semicol         ';'
+$def    equal           '='
+$def    less            '<'
+$def    more            '>'
+$def    at              '@'
+$def    lqbrack         '['
+$def    rqbrack         ']'
+$def    lcbrack         '{'
+$def    rcbrack         '}'
+$def    space           ' '
+$def    tab             "$ht"
+$def    linefeed        "$lf"       fail-builddir  fail-destdir
+$def    backspace       "$bs"
+$def    formfeed        "$ff"
+$def    carriageret     "$cr"
+$def    quadrigraph0    '@&t@'      fail-builddir
+$def    quadrigraph1    '@<:@'
+$def    quadrigraph2    '@:>@'
+$def    quadrigraph3    '@S|@'
+$def    quadrigraph4    '@%:@'
+$def    a_b             'a b'
+$def    a__b            'a  b'
+$def    a_lf_b          "a${lf}b"   fail-builddir  fail-destdir
+$def    dotdotdot       '...'
+$def    dosdrive        'a:'
+$def    miscglob1       '?[a-z]*'
+$def    miscglob2       '.*?[0-9]'
+
+unset def
+
+# --------------- #
+#  Test data end  #
+# =============== #
+
+# Allow the user to select a subset of the tests.
+if test $# -gt 0; then
+  test_names_list=$*
+  for test_name in $test_names_list; do
+    case " $all_test_names_list " in
+      *" $test_name "*);;
+      *) fatal_ "invalid user-specified test_name '$test_name'"
+    esac
+  done
+  # We need to determine the TAP plan adaptively.
+  n=`for t in $test_names_list; do echo $t; done | wc -l`
+  plan_ `expr $n '*' 2` # Two tests per "problematic string".
+  unset n
+else
+  test_names_list=$all_test_names_list
+  # Prefer static TAP plan if possible, it minimizes the chance of errors.
+  plan_ 94
+fi
+
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+
+create_input_data
+
+for test_name in $test_names_list; do
+
+  eval "test_string=\${instspc__$test_name}" \
+    || fatal_ "invalid test name: '$test_name'"
+
+  if test x"$test_string" = x; then
+    if test x"$test_name" != xcarriageret; then
+      fatal_ "invalid test name: '$test_name'"
+    else
+      # MSYS version 1.0.17 still mishandles carriage returns; see
+      # automake bug#7849.
+      skip_ -r "carriage-return treated as null char" "$test_name in builddir"
+      skip_ -r "carriage-return treated as null char" "$test_name in destdir"
+      continue
+    fi
+  fi
+
+  # Skip the next checks if this system doesn't support the required
+  # characters in file names.
+
+  mkdir "./$test_string" || {
+    skip_ -r "mkdir failed" "$test_name in builddir"
+    skip_ -r "mkdir failed" "$test_name in destdir"
+    continue
+  }
+
+  case $test_string in
+  *:*)
+    # On MSYS 1.0.17, "mkdir ./a:" creates ./a, and "cd ./a:" takes you
+    # to a strange directory with pwd equal to "a".  But only for
+    # interactive shells.  Or something?  In this script, "cd ./a:" fails
+    # on MSYS.  Marvelous.
+    ( cd "./$test_string" ) || {
+      rmdir "./$test_string" || fatal_ "removing directory"
+      skip_ -r "cd failed" "$test_name in builddir"
+      skip_ -r "cd failed" "$test_name in destdir"
+      continue
+    }
+    ;;
+  esac
+
+  # Where are the "weird" characters going to be used, in $(builddir)
+  # or in $(DESTDIR)?  They are always going to be used in $(prefix)
+  # though; should we maybe separate this into a dedicated check?
+  for where in build dest; do
+
+    case $where in
+      build)
+        build=./$test_string
+        dest=$ocwd/dest-$test_name
+        ;;
+      dest)
+        build=build-$test_name
+        dest=$ocwd/$test_string
+        mkdir "$build" || fatal_ "cannot create '$build'"
+        ;;
+      *)
+        fatal_ "invalid where '$where'"
+        ;;
+    esac
+
+    cd "$build" || fatal_ "cannot chdir into '$build'"
+
+    # Some make implementations eliminate leading and trailing whitespace
+    # from macros passed on the command line, and some eliminate leading
+    # whitespace from macros set from environment variables, so prepend
+    # './' and use the latter here.
+    r=ok
+    ../configure --prefix "/$test_string-prefix" \
+      && $MAKE all \
+      && DESTDIR="$dest" file="./$test_string" $MAKE -e test-inst \
+      || r='not ok'
+
+    description="$test_name in ${where}dir"
+    if expected_to_fail "$where" "$test_name"; then
+      directive=TODO
+      reason="long-standing limitation"
+    else
+      directive=
+      reason=
+    fi
+    # Test case outcome is here.
+    result_ "$r" -D "$directive" -r "$reason" -- "$description"
+
+    cd "$ocwd" || fatal_ "cannot chdir back to test directory"
+
+    # Remove subdirectories for tests that have passed, to avoid ending up
+    # with a too big test directory.  This is especially important since
+    # some tests in this tests are expected to fail, and this will cause
+    # the test directory not to be removed when the script terminates.
+    if not am_keeping_testdirs && test "$r" = ok; then
+      rm_rf_ "$build" "$dest" || fatal_ "removing temporary subdirectory"
+    else
+      : For lesser shells with broken 'set -e'.
+    fi
+
+  done # $instspc_action
+
+done # $test_name
+
+:
diff --git a/tests/instspc.test b/tests/instspc.test
deleted file mode 100755 (executable)
index 7d00788..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2004, 2005, 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/>.
-
-# Check that installation to directory with shell metacharacters succeed.
-# Original report from James Amundson about file names with spaces.
-# Other characters added by Paul Eggert.
-
-# This is mostly the same input as nobase.test, but we do not use
-# libtool libraries, because Libtool does not preserve space in
-# file names (Issue observed with ltmain.sh (GNU libtool) 1.5a (1.1323
-# 2003/11/10 21:06:47))
-
-
-required='gcc'
-. ./defs || Exit 1
-
-set -e
-
-# Set up files that won't change each time through the loop.
-
-cat >> configure.in <<'EOF'
-AC_PROG_CC
-AC_PROG_RANLIB
-AC_OUTPUT
-EOF
-
-mkdir sub
-
-: > sub/base.h
-: > sub/nobase.h
-: > sub/base.dat
-: > sub/nobase.dat
-: > sub/base.sh
-: > sub/nobase.sh
-
-cat >source.c <<'EOF'
-int
-main (int argc, char **argv)
-{
-  return 0;
-}
-EOF
-cp source.c source2.c
-
-cat > Makefile.am << 'EOF'
-foodir = $(prefix)/foo
-fooexecdir = $(prefix)/foo
-
-foo_HEADERS = sub/base.h
-nobase_foo_HEADERS = sub/nobase.h
-
-dist_foo_DATA = sub/base.dat
-nobase_dist_foo_DATA = sub/nobase.dat
-
-dist_fooexec_SCRIPTS = sub/base.sh
-nobase_dist_fooexec_SCRIPTS = sub/nobase.sh
-
-fooexec_PROGRAMS = sub/base
-nobase_fooexec_PROGRAMS = sub/nobase
-sub_base_SOURCES = source.c
-sub_nobase_SOURCES = source.c
-
-fooexec_LIBRARIES = sub/libbase.a
-nobase_fooexec_LIBRARIES = sub/libnobase.a
-sub_libbase_a_SOURCES = source.c
-sub_libnobase_a_SOURCES = source.c
-
-test-install-sep: install
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.h'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.h'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.h'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.dat'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.dat'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.dat'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase.sh'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase.sh'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/base.sh'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/nobase$(EXEEXT)'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/nobase$(EXEEXT)'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/base$(EXEEXT)'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/sub/libnobase.a'
-       test ! -f '$(DESTDIR)/$(file)-prefix/foo/libnobase.a'
-       test   -f '$(DESTDIR)/$(file)-prefix/foo/libbase.a'
-EOF
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-# Some control characters that are white space:
-# back space, carriage return, form feed, horizontal tab, line feed, space
-bs='\b'
-cr='\r'
-ff='\f'
-ht='   '
-lf='
-'
-sp=' '
-
-build_failures=
-install_failures=
-
-for file in \
-  '!' '"' '#' '$' '%' '&' \' '(' ')' '*' '+' ',' '-' ':' ';' \
-  '<' '=' '>' '?' '@' '[' '\' ']' '^' '`' '{' '|' '}' '~' \
-  "$bs" "$cr" "$ff" "$ht" "$lf" "$sp" \
-  '@<:@' '@:>@' '@S|@' '@%:@' '@&t@' \
-  "a${sp}b" "a${sp}${sp}b" "a${lf}b" ... a:
-do
-  for test in build install; do
-    case $test in
-    build)
-      build=$file
-      dest=`pwd`/sub1;;
-    install)
-      build=sub1
-      dest=`pwd`/$file;;
-    esac
-
-    # Make sure this system supports this character in file names.
-    mkdir sub1 "./$file" || Exit 77
-
-    cd "$build"
-
-    # Some make implementations eliminate leading and trailing whitespace
-    # from macros passed on the command line, and some eliminate leading
-    # whitespace from macros set from environment variables, so prepend
-    # './' and use the latter here.
-    ../configure --prefix "/$file-prefix" &&
-    $MAKE &&
-    DESTDIR=$dest file=./$file $MAKE -e test-install-sep ||
-      eval "${test}_failures=\"\$${test}_failures$lf\$file\""
-
-    cd ..
-
-    rm -fr sub1 "./$file"
-  done
-done
-
-# The list of the above file names that cannot be used as a build directory
-# on a POSIX host.  This list should be empty, but is not due to limitations
-# in Autoconf, Automake, Make, M4, or the shell.
-expected_build_failures='
-"
-#
-$
-&
-'\''
-\
-`
-'"$lf"'
-@&t@
-a'"${lf}"'b'
-
-# Similarly, the list of file names that cannot be used as an install directory
-# on a POSIX host.  This list should also be empty.
-expected_install_failures='
-"
-#
-$
-'\''
-`
-'"$lf"'
-a'"${lf}"'b'
-
-fail=0
-for test in build install; do
-  eval failures=\$${test}_failures
-  case $failures in
-  ?*)
-    cat >&2 <<EOF
-$0: $test test failed for the following file names:$failures
-EOF
-    eval test \"\$failures\" = \"\$expected_${test}_failures\" || fail=1
-  esac
-done
-
-Exit $fail
index 05464d2..911dc65 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index cff8d1d..804305e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -31,5 +32,7 @@ x_SOURCES = x.c
 x_LDADD = $(X_EXTRA_LIBS)
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
diff --git a/tests/is b/tests/is
new file mode 100755 (executable)
index 0000000..1e1c0ce
--- /dev/null
+++ b/tests/is
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Test that two whitespace-separated lists are equal.
+# Assumes the two lists are passed on the command line separated by
+# a '==' string.
+# This script is useful to test equality of lists in makefile rules,
+# in the face of variables defined through line-continuations,
+# automake rewrites and expansions of empty variables.
+
+set -e
+set -u
+
+# Initialize before unsetting, for shells (like older bash or Solaris
+# ksh) that fail to unset variables that are already unset.
+exp= got=; unset exp got
+seen_eqeq=no
+while test $# -gt 0; do
+  if test x"$1" = x"=="; then
+    if test $seen_eqeq = no; then
+      seen_eqeq=yes
+    else
+      echo "$0: more than one '==' argument seen on command line" >&2
+      exit 2
+    fi
+  else
+    if test $seen_eqeq = no; then
+      got=${got+"$got "}$1
+    else
+      exp=${exp+"$exp "}$1
+    fi
+  fi
+  shift
+done
+
+if test $seen_eqeq = no; then
+  echo "$0: no '==' argument seen on command line" >&2
+  exit 2
+fi
+
+test x"${exp-}" = x"${got-}"
index a67b4e8..86b5f05 100755 (executable)
@@ -21,8 +21,6 @@
 required=javac
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -55,7 +53,7 @@ echo '}' >> Two.java
 
 # "make check" should compile files in $(check_JAVA) ...
 $MAKE check
-ls -l # for debugging
+ls -l # For debugging.
 test -f One.class
 test -f Two.class
 # ... but should *not* install them.
index 7db5e53..c837ff7 100755 (executable)
@@ -19,8 +19,6 @@
 required=javac
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
index 74b7a00..d947da3 100755 (executable)
@@ -19,8 +19,6 @@
 required=javac
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AC_OUTPUT
 EOF
diff --git a/tests/java-compile-run-flat.test b/tests/java-compile-run-flat.test
new file mode 100755 (executable)
index 0000000..4a00aef
--- /dev/null
@@ -0,0 +1,241 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test on compilation and execution of Java class files.
+# Also meddle with wrapper scripts, as would be probably seen in a real
+# "UNIX-style" use case.
+# This test uses a "flat" setup for the source tree (i.e., everything in
+# the top-level directory), and forces the use of the old, non-parallel
+# testsuite driver.  The sister test `java-compile-run-nested.test' do
+# similar checks with a more usual, "nested" setup, and using the newer
+# 'parallel-tests' driver.
+
+required='java javac'
+am_parallel_tests=no
+. ./defs || Exit 1
+
+echo "AC_SUBST([PATH_SEPARATOR], ['$PATH_SEPARATOR'])" >> configure.in
+
+cat >> configure.in <<'END'
+AC_SUBST([JAVA], [java])
+AC_CONFIG_SRCDIR([PkgLocation.jin])
+AC_CONFIG_FILES([PkgLocation.java:PkgLocation.jin])
+AC_OUTPUT
+END
+
+## TOP-LEVEL SETUP AND TARGETS ##
+
+cat > Makefile.am <<'END'
+EXTRA_DIST = # Will be updated later.
+
+test-built:
+       ls -l $(srcdir)               ;: For debugging.
+       test $(srcdir) = . || ls -l . ;: Likewise.
+       test -f $(srcdir)/Main.java
+       test -f $(srcdir)/HelloStream.java
+       test -f $(srcdir)/PkgLocation.jin
+       test -f PkgLocation.java
+       test -f HelloStream.class
+       test -f PkgLocation.class
+       test -f Main.class
+       test -f classjava.stamp
+
+test-installed:
+       ls -l $(javadir) ;: For debugging.
+       test -f $(javadir)/HelloStream.class
+       test -f $(javadir)/PkgLocation.class
+       test -f $(javadir)/Main.class
+       if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
+
+run-installed:
+       jprog_doing_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
+check-local: test-built
+installcheck-local: test-installed run-installed
+
+.PHONY: test-built test-installed run-installed
+END
+
+## WRAPPER SCRIPT ##
+
+cat >> Makefile.am <<'END'
+bin_SCRIPTS = jprog
+
+edit_script = sed -e 's|[@]JAVA@|$(JAVA)|g' \
+                  -e 's|[@]javadir@|$(javadir)|g' \
+                  -e 's|[@]SHELL@|$(SHELL)|g' \
+                  -e 's|[@]PATH_SEPARATOR@|$(PATH_SEPARATOR)|g'
+
+jprog: jprog.sh
+       rm -f $@ $@-t
+       $(edit_script) `test -f '$@.sh' || echo $(srcdir)/`$@.sh >$@-t
+       chmod a-w $@-t && chmod a+x $@-t && mv -f $@-t $@
+       sed 's/^/ | /' $@ ;: for debugging.
+
+EXTRA_DIST += jprog.sh
+CLEANFILES = jprog
+END
+
+cat > jprog.sh <<'END'
+#!@SHELL@
+CLASSPATH=${jprog_classpath-'@javadir@'}${CLASSPATH+"@PATH_SEPARATOR@$CLASSPATH"}
+export CLASSPATH
+case $# in
+  0) exec @JAVA@ Main;;
+  *) exec @JAVA@ Main "$@";;
+esac
+END
+
+## JAVA SOURCES ##
+
+cat >> Makefile.am <<'END'
+javadir = $(pkgdatadir)/java
+
+dist_java_JAVA = Main.java HelloStream.java
+nodist_java_JAVA = PkgLocation.java
+END
+
+cat > PkgLocation.jin <<'END'
+public class PkgLocation {
+    public static String prefix() {
+        return new String("@prefix@");
+    }
+}
+END
+
+cat > Main.java <<'END'
+public class Main {
+    public static void main(String[] args) {
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("--print-prefix")) {
+                System.out.println(PkgLocation.prefix());
+            } else if (args[i].equals("--hello-stdout")) {
+                HelloStream.to(System.out);
+            } else if (args[i].equals("--hello-stderr")) {
+                HelloStream.to(System.err);
+            } else {
+               System.err.println("jprog: invalid option '" + args[i] +
+                                  "'");
+               System.exit(2);
+            }
+        }
+        System.exit(0);
+    }
+}
+END
+
+cat > HelloStream.java <<'END'
+import java.io.PrintStream;
+class HelloStream {
+    public static void to(PrintStream stream) {
+        stream.println("Hello, Stream!");
+    }
+}
+END
+
+## TESTS ##
+
+cat >> Makefile.am <<'END'
+## We must use `TESTS_ENVIRONMENT', not `AM_TESTS_ENVIRONMENT',
+## because the latter is not hnoured by the old serial test
+## harness.
+TESTS_ENVIRONMENT = \
+    if test x"$$jprog_doing_installcheck" != x"yes"; then \
+        jprog_classpath='$(abs_top_builddir):$(abs_top_srcdir)'; \
+        export jprog_classpath; \
+        PATH='$(abs_top_builddir)$(PATH_SEPARATOR)'$$PATH; \
+        export PATH; \
+    else \
+        unset jprog_classpath || :; \
+        PATH='$(prefix)/bin$(PATH_SEPARATOR)'$$PATH; \
+        export PATH; \
+    fi; \
+    config_time_prefix='@prefix@'; export config_time_prefix;
+
+TESTS = \
+  simple.test \
+  prefix.test \
+  stdout.test \
+  stderr.test \
+  badarg.test
+
+XFAIL_TESTS = badarg.test
+
+EXTRA_DIST += $(TESTS)
+END
+
+cat > simple.test <<'END'
+#!/bin/sh
+jprog
+END
+
+cat > prefix.test <<'END'
+#!/bin/sh
+jprefix=`jprog --print-prefix` || exit 1
+echo "$0: exp prefix: $config_time_prefix"
+echo "$0: got prefix: $jprefix"
+test x"$jprefix" = x"$config_time_prefix"
+END
+
+cat > stdout.test <<'END'
+#!/bin/sh
+rc=0
+jprog --hello-stdout >stdout.out 2>stdout.err || { echo \$?=$?; rc=1; }
+sed 's/^/out:/' <stdout.out      # For debugging.
+sed 's/^/err:/' <stdout.err >&2  # Likewise.
+test -s stdout.err && rc=1
+test "`cat stdout.out`" = 'Hello, Stream!' || rc=1
+rm -f stdout.out stdout.err || rc=1
+exit $rc
+END
+
+cat > stderr.test <<'END'
+#!/bin/sh
+rc=0
+jprog --hello-stderr >stderr.out 2>stderr.err || { echo \$?=$?; rc=1; }
+sed 's/^/out:/' <stderr.out      # For debugging.
+sed 's/^/err:/' <stderr.err >&2  # Likewise.
+test -s stderr.out && rc=1
+test "`cat stderr.err`" = 'Hello, Stream!' || rc=1
+rm -f stderr.out stderr.err || rc=1
+exit $rc
+END
+
+cat > badarg.test <<'END'
+#!/bin/sh
+jprog --bad-argument
+END
+
+chmod a+x *.test
+
+## DO CHECKS ##
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# To have the parallel testsuite more verbose.
+VERBOSE=yes; export VERBOSE
+
+./configure --prefix="`pwd`/_inst"
+cat PkgLocation.java # For debugging.
+$MAKE check
+$MAKE install
+$MAKE test-installed
+$MAKE run-installed
+$MAKE distcheck
+
+:
diff --git a/tests/java-compile-run-nested.test b/tests/java-compile-run-nested.test
new file mode 100755 (executable)
index 0000000..30bd6a0
--- /dev/null
@@ -0,0 +1,251 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test on compilation and execution of Java class files.
+# Also meddle with wrapper scripts, as would be probably seen in a real
+# "UNIX-style" use case.
+# This test uses a typical "nested" source tree setup (i.e., different
+# components/aspects are separated into different subdirectories),
+# and uses the 'parallel-tests' testsuite driver.  The sister test
+# `java-compile-run-flat.test' do similar checks with a "flat" setup
+# (i.e., everything in the top-level directory), and forcing the use
+# of the older non-parallel 'simple-tests' driver.
+
+required='java javac'
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+echo "AC_SUBST([PATH_SEPARATOR], ['$PATH_SEPARATOR'])" >> configure.in
+
+cat >> configure.in <<'END'
+AC_SUBST([JAVA], [java])
+AC_CONFIG_SRCDIR([jprog/PkgLocation.jin])
+AC_SUBST([jprogdatadir],  ['${pkgdatadir}'])
+AC_SUBST([jprogclassdir], ['${jprogdatadir}/jprog'])
+AC_CONFIG_FILES([jprog/PkgLocation.java:jprog/PkgLocation.jin])
+AC_CONFIG_FILES([jprog/Makefile bin/Makefile tests/Makefile])
+AC_OUTPUT
+END
+
+## TOP-LEVEL SETUP AND TARGETS ##
+
+cat > Makefile.am <<'END'
+SUBDIRS = bin jprog tests
+
+test-built:
+       ls -l $(srcdir)/*             ;: For debugging.
+       test $(srcdir) = . || ls -l * ;: Likewise.
+       test -f $(srcdir)/jprog/Main.java
+       test -f $(srcdir)/jprog/HelloStream.java
+       test -f $(srcdir)/jprog/PkgLocation.jin
+       test -f jprog/PkgLocation.java
+       test -f jprog/HelloStream.class
+       test -f jprog/Main.class
+       test -f jprog/PkgLocation.class
+       test -f jprog/classjprogclass.stamp
+
+test-installed:
+       ls -l $(jprogclassdir) ;: For debugging.
+       test -f $(jprogclassdir)/HelloStream.class
+       test -f $(jprogclassdir)/Main.class
+       test -f $(jprogclassdir)/PkgLocation.class
+       if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
+
+run-installed:
+       jprog_doing_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
+
+check-local: test-built
+installcheck-local: test-installed run-installed
+
+.PHONY: test-built test-installed run-installed
+END
+
+## WRAPPER SCRIPT ##
+
+mkdir bin
+
+cat > bin/Makefile.am <<'END'
+bin_SCRIPTS = jprog
+
+edit_script = sed -e 's|[@]JAVA@|$(JAVA)|g' \
+                  -e 's|[@]jprogdatadir@|$(jprogdatadir)|g' \
+                  -e 's|[@]SHELL@|$(SHELL)|g' \
+                  -e 's|[@]PATH_SEPARATOR@|$(PATH_SEPARATOR)|g'
+
+jprog: jprog.sh
+       rm -f $@ $@-t
+       $(edit_script) `test -f '$@.sh' || echo $(srcdir)/`$@.sh >$@-t
+       chmod a-w $@-t && chmod a+x $@-t && mv -f $@-t $@
+       sed 's/^/ | /' $@ ;: for debugging.
+
+EXTRA_DIST = jprog.sh
+CLEANFILES = jprog
+END
+
+cat > bin/jprog.sh <<'END'
+#!@SHELL@
+CLASSPATH=${jprog_classpath-'@jprogdatadir@'}${CLASSPATH+"@PATH_SEPARATOR@$CLASSPATH"}
+export CLASSPATH
+case $# in
+  0) exec @JAVA@ jprog.Main;;
+  *) exec @JAVA@ jprog.Main "$@";;
+esac
+END
+
+## JAVA SOURCES ##
+
+mkdir jprog
+
+cat > jprog/Makefile.am <<'END'
+dist_jprogclass_JAVA = Main.java HelloStream.java
+nodist_jprogclass_JAVA = PkgLocation.java
+END
+
+cat > jprog/PkgLocation.jin <<'END'
+package jprog;
+public class PkgLocation {
+    public static String prefix() {
+        return new String("@prefix@");
+    }
+}
+END
+
+cat > jprog/Main.java <<'END'
+package jprog;
+import jprog.PkgLocation;
+import jprog.HelloStream;
+public class Main {
+    public static void main(String[] args) {
+        for (int i = 0; i < args.length; i++) {
+            if (args[i].equals("--print-prefix")) {
+                System.out.println(PkgLocation.prefix());
+            } else if (args[i].equals("--hello-stdout")) {
+                HelloStream.to(System.out);
+            } else if (args[i].equals("--hello-stderr")) {
+                HelloStream.to(System.err);
+            } else {
+               System.err.println("jprog: invalid option '" + args[i] +
+                                  "'");
+               System.exit(2);
+            }
+        }
+        System.exit(0);
+    }
+}
+END
+
+cat > jprog/HelloStream.java <<'END'
+package jprog;
+import java.io.PrintStream;
+class HelloStream {
+    public static void to(PrintStream stream) {
+        stream.println("Hello, Stream!");
+    }
+}
+END
+
+## TESTS ##
+
+mkdir tests
+
+cat > tests/Makefile.am <<'END'
+AM_TESTS_ENVIRONMENT = \
+    if test x"$$jprog_doing_installcheck" != x"yes"; then \
+        jprog_classpath='$(abs_top_builddir):$(abs_top_srcdir)'; \
+        export jprog_classpath; \
+        PATH='$(abs_top_builddir)/bin$(PATH_SEPARATOR)'$$PATH; \
+        export PATH; \
+    else \
+        unset jprog_classpath || :; \
+        PATH='$(prefix)/bin$(PATH_SEPARATOR)'$$PATH; \
+        export PATH; \
+    fi; \
+    config_time_prefix='@prefix@'; export config_time_prefix;
+
+TESTS = \
+  simple.test \
+  prefix.test \
+  stdout.test \
+  stderr.test \
+  badarg.test
+
+XFAIL_TESTS = badarg.test
+
+EXTRA_DIST = $(TESTS)
+END
+
+cat > tests/simple.test <<'END'
+#!/bin/sh
+jprog
+END
+
+cat > tests/prefix.test <<'END'
+#!/bin/sh
+jprefix=`jprog --print-prefix` || exit 1
+echo "$0: exp prefix: $config_time_prefix"
+echo "$0: got prefix: $jprefix"
+test x"$jprefix" = x"$config_time_prefix"
+END
+
+cat > tests/stdout.test <<'END'
+#!/bin/sh
+rc=0
+jprog --hello-stdout >stdout.out 2>stdout.err || { echo \$?=$?; rc=1; }
+sed 's/^/out:/' <stdout.out      # For debugging.
+sed 's/^/err:/' <stdout.err >&2  # Likewise.
+test -s stdout.err && rc=1
+test "`cat stdout.out`" = 'Hello, Stream!' || rc=1
+rm -f stdout.out stdout.err || rc=1
+exit $rc
+END
+
+cat > tests/stderr.test <<'END'
+#!/bin/sh
+rc=0
+jprog --hello-stderr >stderr.out 2>stderr.err || { echo \$?=$?; rc=1; }
+sed 's/^/out:/' <stderr.out      # For debugging.
+sed 's/^/err:/' <stderr.err >&2  # Likewise.
+test -s stderr.out && rc=1
+test "`cat stderr.err`" = 'Hello, Stream!' || rc=1
+rm -f stderr.out stderr.err || rc=1
+exit $rc
+END
+
+cat > tests/badarg.test <<'END'
+#!/bin/sh
+jprog --bad-argument
+END
+
+chmod a+x tests/*.test
+
+## DO CHECKS ##
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# To have the parallel testsuite more verbose.
+VERBOSE=yes; export VERBOSE
+
+./configure --prefix="`pwd`/_inst"
+cat jprog/PkgLocation.java # For debugging.
+$MAKE check
+$MAKE install
+$MAKE test-installed
+$MAKE run-installed
+$MAKE distcheck
+
+:
index e94f885..77270b4 100755 (executable)
@@ -20,8 +20,6 @@
 required=javac
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_CONFIG_SRCDIR([org/gnu/bug/Library.java])
 AC_CONFIG_FILES([
diff --git a/tests/java-extra.test b/tests/java-extra.test
new file mode 100755 (executable)
index 0000000..cc5d893
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check use of EXTRA with the JAVA primary.  Also test interaction
+# of JAVA with conditionals (it's natural to test it here, since
+# EXTRA_JAVA exists mostly for ensuring interoperation with Automake
+# conditionals).
+
+required=javac
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(pkgdatadir)/java
+
+EXTRA_JAVA = Class1.java Class2.java Class3.java
+
+java_JAVA = Class1.java
+
+if COND
+java_JAVA += Class2.java
+else !COND
+java_JAVA += Class3.java
+endif !COND
+
+Class3.java: Makefile
+       echo 'class Class3 {}' > $@
+CLEANFILES = Class3.java
+END
+
+echo "class Class1 {}" > Class1.java
+echo "class Class2 {}" > Class2.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure cond=yes
+$MAKE
+ls -l
+test -f Class1.class
+test -f Class2.class
+test ! -f Class3.class
+test ! -f Class3.java
+
+$MAKE distclean
+
+./configure cond=no
+$MAKE
+ls -l
+test -f Class1.class
+test ! -f Class2.class
+test -f Class3.class
+test -f Class3.java
+
+:
index d6a43e7..44d8d83 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012 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
 
 # Check that the JAVA primary can be used freely in the same Makefile.am
 # with proper combinations of the `dist_', `nodist_' and `nobase_'
-# modifiers.  Also check that `.java' files are not ditributed by default.
+# modifiers.  Also check that `.java' files are not distributed by
+# default.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index ec42a3b..d441c44 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
 java_JAVA = a.java
index 7b55290..b5e86dc 100755 (executable)
@@ -19,8 +19,6 @@
 required=javac
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_OUTPUT
 END
diff --git a/tests/java-noinst.test b/tests/java-noinst.test
new file mode 100755 (executable)
index 0000000..eb90aa9
--- /dev/null
@@ -0,0 +1,55 @@
+#! /bin/sh
+# Copyright (C) 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 that noinst_JAVA causes generated *.class files not to
+# be installed.
+
+required=javac
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+noinst_JAVA = 1.java
+dist_noinst_JAVA = 2.java
+nodist_noinst_JAVA = 3.java
+nobase_noinst_JAVA = 4.java
+nobase_dist_noinst_JAVA = 5.java
+nobase_nodist_noinst_JAVA = 6.java
+END
+
+for i in 1 2 3 4 5 6; do
+  echo "class Class$i {}" > $i.java
+done
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure --prefix="`pwd`/_inst"
+
+$MAKE
+ls -l
+for i in 1 2 3 4 5 6; do
+  test -f Class$i.class
+done
+
+$MAKE install
+test -d _inst && { ls -l _inst; Exit 1; }
+
+:
diff --git a/tests/java-rebuild.test b/tests/java-rebuild.test
new file mode 100755 (executable)
index 0000000..0b5ad64
--- /dev/null
@@ -0,0 +1,124 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test rebuild rules for Java class files.
+
+required='javac'
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AM_JAVACFLAGS = -verbose
+foodir = $(datadir)/java
+foo_JAVA = a.java
+dist_foo_JAVA = d.java
+nodist_foo_JAVA = n.java
+nobase_foo_JAVA = Nobase.java
+nobase_dist_foo_JAVA = NobaseDist.java
+nobase_nodist_foo_JAVA = NobaseNoDist.java
+END
+
+echo 'class _x {}' > a.java
+echo 'class x_ {}' > d.java
+echo 'class a {} class d {}' > n.java
+echo 'class Nobase_Foo {} class Nobase_Bar {}' > Nobase.java
+echo 'class NobaseDist {}' > NobaseDist.java
+echo 'class NobaseNoDist {}' > NobaseNoDist.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+all_classes='_x x_ a d Nobase_Foo Nobase_Bar NobaseDist NobaseNoDist'
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=..
+    mkdir build
+    cd build
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE
+  ls -l # For debugging.
+
+  # Sanity check.
+  test -f classfoo.stamp
+  for cls in $all_classes; do
+    test -f $cls.class
+  done
+
+  # When the stampfile is removed, all the *.class files should
+  # be considered out-of-date.
+  echo timestamp > older
+  $sleep
+  rm -f classfoo.stamp
+  $MAKE
+  for cls in $all_classes; do
+    is_newest $cls.class older
+  done
+
+  # When only a java file is modified, only the *.class files derived from
+  # it should be updated.
+  # The strings we loop on here have the following format:
+  # ``JAVA-FILES-TO-BE-TOUCHED -- CLASSES-THAT-SHOULD-BE-UPDATED''
+  for args in \
+    'a -- _x' \
+    'd -- x_' \
+    'n -- a d' \
+    'a d Nobase -- _x x_ Nobase_Foo Nobase_Bar' \
+    'n NobaseDist -- a d NobaseDist' \
+    'd NobaseNoDist -- x_ NobaseNoDist' \
+    "a d n Nobase NobaseDist NobaseNoDist -- $all_classes" \
+  ; do
+    set $args
+    touched_javas=
+    while test $# -gt 0; do
+      if test x"$1" = x"--"; then
+        shift
+        break
+      else
+        touched_javas="$touched_javas $1"
+        shift
+      fi
+    done
+    updated_classes=$*
+    echo timestamp > older
+    $sleep
+    for j in $touched_javas; do
+      touch $srcdir/$j.java
+    done
+    $MAKE
+    is_newest classfoo.stamp older
+    for cls in $all_classes; do
+      case " $updated_classes " in
+        *" $cls "*) is_newest $cls.class older;;
+        *) is_newest older $cls.class;;
+      esac
+    done
+  done # $args ...
+
+  cd $srcdir
+
+done # $vpath ...
+
+:
index 770eb2d..9bf8855 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
diff --git a/tests/java-uninstall.test b/tests/java-uninstall.test
new file mode 100755 (executable)
index 0000000..c1672e7
--- /dev/null
@@ -0,0 +1,99 @@
+#! /bin/sh
+# Copyright (C) 1998, 2001, 2002, 2004, 2007  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/>.
+
+# Check uninstallation of Java class files.
+
+required=javac
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(prefix)/java
+java_JAVA = Foo.java
+nobase_java_JAVA = Foo2.java
+nobase_dist_java_JAVA = Bar.java
+nodist_java_JAVA = Baz.java
+
+# Java files are not distributed by default, so we distribute
+# one "by hand" ...
+EXTRA_DIST = Foo.java
+# ... and make the other one generated.
+Foo2.java:
+       rm -f $@ $@-t
+       echo 'class bClass {}' > $@-t
+       chmod a-w $@-t && mv -f $@-t $@
+
+# Explicitly declared as `nodist_', so generate it.
+Baz.java:
+       rm -f $@ $@-t
+       echo 'class Baz {}' > $@-t
+       echo 'class Baz2 {}' >> $@-t
+       chmod a-w $@-t && mv -f $@-t $@
+
+DISTCLEANFILES = Baz.java Foo2.java
+END
+
+echo 'class aClass {}' > Foo.java
+echo 'class Zardoz {}' > Bar.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure --prefix="`pwd`"/_inst
+javadir=_inst/java
+
+check_uninstallation()
+{
+  test ! -r $javadir/aClass.class
+  test ! -r $javadir/bClass.class
+  test ! -r $javadir/Zardoz.class
+  test ! -r $javadir/Baz.class
+  test ! -r $javadir/Baz2.class
+  test   -f $javadir/Foo.class
+  test   -f $javadir/Bar.class
+  test   -f $javadir/xClass.class
+  test   -f $javadir/aclass.class
+}
+
+$MAKE
+ls -l
+$MAKE install
+: > $javadir/Foo.class
+: > $javadir/Bar.class
+: > $javadir/xClass.class
+: > $javadir/aclass.class
+ls -l $javadir
+$MAKE uninstall
+ls -l $javadir
+check_uninstallation
+
+# FIXME: "make uninstall" should continue to work also after "make clean",
+#        but currently this doesn't happen.  See automake bug#8540.
+$MAKE install
+ls -l $javadir
+$MAKE clean
+ls -l
+$MAKE uninstall
+ls -l $javadir
+#check_uninstallation
+
+$MAKE distcheck
+
+:
index 4aa91d0..fdf2092 100755 (executable)
@@ -20,8 +20,6 @@
 required=javac
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AC_OUTPUT
 EOF
index d3b942c..b4f1daf 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL(WITH_JDK, false)
 AC_OUTPUT
index e1850a8..836133b 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([WHO_CARES], [false])
 AC_OUTPUT
index 9b6d1f3..548865d 100755 (executable)
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 $ACLOCAL
 
 echo java_JAVA = a.java > Makefile.am
diff --git a/tests/javaflags.test b/tests/javaflags.test
new file mode 100755 (executable)
index 0000000..2b1e471
--- /dev/null
@@ -0,0 +1,60 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check support for $(JAVACFLAGS) and $(AM_JAVACFLAGS).
+
+. ./defs || Exit 1
+
+cat > fake-javac <<'END'
+#!/bin/sh
+echo "$*" > javaflags.list
+END
+chmod a+x fake-javac
+
+# Remove JAVAC from the environment, so that it won't interfere
+# with `make -e' below.
+unset JAVAC || :
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+# Simulate presence of the java compiler using our fake-javac script.
+AC_SUBST([JAVAC], ['$(abs_top_srcdir)'/fake-javac])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+foodir = $(prefix)
+foo_JAVA = bar.java
+AM_JAVACFLAGS = __am_flags__
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+grep '\$(JAVACFLAGS).*\$(AM_JAVACFLAGS)' Makefile.in && Exit 1
+
+: > bar.java
+
+$AUTOCONF
+./configure
+env JAVACFLAGS=__user_flags__ $MAKE -e
+
+ls -l
+
+cat javaflags.list
+grep '__am_flags__.*__user_flags__' javaflags.list
+
+:
index aa1506b..f80cec9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002  Free Software Foundation, Inc.
+# 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure JAVA variable can be defined.
+# Test to make sure JAVA variable can be defined by AC_SUBST.
 
 . ./defs || Exit 1
 
-echo 'AC_SUBST(JAVA)' >> configure.in
+cat >> configure.in << 'END'
+AC_SUBST([JAVA])
+END
 
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
 java_JAVA = a.java b.java c.java
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+grep -i java Makefile.in # For debugging.
+grep '^JAVA = *@JAVA@ *$' Makefile.in
+
+:
index d018645..7d6dd9c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002  Free Software Foundation, Inc.
+# 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure redefining JAVAC works.
+# Test to make sure redefining JAVAC with AC_SUBST works.
 
 . ./defs || Exit 1
 
-echo 'AC_SUBST(JAVAC)' >> configure.in
+cat >> configure.in << 'END'
+AC_SUBST([JAVAC])
+END
 
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
 java_JAVA = a.java b.java c.java
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
+
+grep -i java Makefile.in # For debugging.
+grep '^JAVAC = *@JAVAC@ *$' Makefile.in
 
-grep 'JAVAC.*@JAVAC@' Makefile.in
+:
index 7f4fce8..4c5dd7b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2010 Free Software
+# Copyright (C) 1997, 1999, 2000, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,6 @@
 required=libtool
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -42,6 +40,7 @@ END
 : > q.c
 
 $ACLOCAL || Exit 1
-AUTOMAKE_fails
-grep LDADD stderr || Exit 1
+AUTOMAKE_fails -Wno-extra-portability
+grep "libtu_la_LDADD" stderr
+grep " use [\`"']libtu_la_LIBADD' stderr
 Exit 0
index 39ca274..92fb42c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
 
 # Check for LDFLAGS in conditional.
 # PR 77.
+
 required=libtool
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_SUBST([LTLIBOBJS], [q.o])
-AM_CONDITIONAL(USE_SWIG, :)
+AM_CONDITIONAL([USE_SWIG], [:])
 AC_OUTPUT
 END
 
@@ -37,9 +40,12 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 : > q.c
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
diff --git a/tests/lex-clean-cxx.test b/tests/lex-clean-cxx.test
new file mode 100755 (executable)
index 0000000..6ca8071
--- /dev/null
@@ -0,0 +1,125 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that C++ source and header files derived from non-distributed
+# Yacc sources are cleaned by "make clean", while C++ source and
+# header files derived from distributed Yacc sources are cleaned by
+# "make maintainer-clean".
+# See also sister test `lex-clean.test'.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+
+foo_SOURCES = mainfoo.cc parsefoo.lxx
+
+bar_SOURCES = mainbar.cpp parsebar.ll
+bar_LFLAGS = $(AM_LFLAGS)
+
+baz_SOURCES = mainbaz.c++
+nodist_baz_SOURCES = parsebaz.l++
+
+qux_SOURCES = mainqux.cxx
+nodist_qux_SOURCES = parsequx.lpp
+qux_LFLAGS = $(AM_LFLAGS)
+
+parsebaz.l++ parsequx.lpp:
+       cp $(srcdir)/parsefoo.lxx $@
+
+CLEANFILES = parsebaz.l++ parsequx.lpp
+
+LDADD = $(LEXLIB)
+END
+
+cat > parsefoo.lxx << 'END'
+%%
+"GOOD"   return EOF;
+.
+%%
+int yywrap (void)
+{
+  return 1;
+}
+END
+cp parsefoo.lxx parsebar.ll
+
+cat > mainfoo.cc << 'END'
+// This file should contain valid C++ but invalid C.
+using namespace std;
+int main (int argc, char **argv)
+{
+  extern int yylex (void);
+  return yylex ();
+}
+END
+cp mainfoo.cc mainbar.cpp
+cp mainfoo.cc mainbaz.c++
+cp mainfoo.cc mainqux.cxx
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+cp config.status config.sav
+
+$MAKE
+ls -l
+# Sanity checks.
+test -f parsefoo.cxx
+test -f bar-parsebar.cc
+test -f parsebaz.l++
+test -f parsebaz.c++
+test -f parsequx.lpp
+test -f qux-parsequx.cpp
+
+for target in clean distclean; do
+  $MAKE $target
+  ls -l
+  test -f parsefoo.cxx
+  test -f bar-parsebar.cc
+  test ! -r parsebaz.l++
+  test ! -r parsebaz.c++
+  test ! -r parsequx.lpp
+  test ! -r qux-parsequx.cpp
+done
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+$MAKE maintainer-clean
+ls -l
+test -f parsefoo.lxx
+test -f parsebar.ll
+test ! -r parsefoo.cxx
+test ! -r bar-parsebar.cc
+test -f parsefoo.lxx
+test -f parsebar.ll
+test ! -r parsefoo.cxx
+test ! -r bar-parsebar.cc
+
+:
diff --git a/tests/lex-clean.test b/tests/lex-clean.test
new file mode 100755 (executable)
index 0000000..6f03887
--- /dev/null
@@ -0,0 +1,113 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that .c files derived from non-distributed .l sources
+# are cleaned by "make clean", while .c files derived from
+# distributed .l sources are cleaned by "make maintainer-clean".
+# See also sister test `lex-clean-cxx.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+
+foo_SOURCES = main.c lexer.l
+
+bar_SOURCES = main.c lexer.l
+bar_LFLAGS = $(AM_LFLAGS)
+
+baz_SOURCES = main.c
+nodist_baz_SOURCES = baz.l
+
+qux_SOURCES = main.c
+nodist_qux_SOURCES = baz.l
+qux_LFLAGS = $(AM_LFLAGS)
+
+baz.l:
+       cp $(srcdir)/lexer.l $@
+
+CLEANFILES = baz.l
+
+LDADD = $(LEXLIB)
+END
+
+cat > lexer.l << 'END'
+%%
+"GOOD"   return EOF;
+.
+END
+
+cat > main.c << 'END'
+int main (void)
+{
+  return yylex ();
+}
+
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+cp config.status config.sav
+
+$MAKE
+ls -l
+# Sanity checks.
+test -f lexer.l
+test -f lexer.c
+test -f bar-lexer.c
+test -f baz.l
+test -f baz.c
+test -f qux-baz.c
+
+for target in clean distclean; do
+  $MAKE $target
+  ls -l
+  test -f lexer.l
+  test -f lexer.c
+  test -f bar-lexer.c
+  test ! -r baz.l
+  test ! -r baz.c
+  test ! -r qux-baz.c
+done
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+$MAKE maintainer-clean
+ls -l
+test -f lexer.l
+test ! -r lexer.c
+test ! -r bar-lexer.c
+
+:
diff --git a/tests/lex-depend-cxx.test b/tests/lex-depend-cxx.test
new file mode 100755 (executable)
index 0000000..9b5416d
--- /dev/null
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test to make sure dependencies work with Lex/C++.
+# Test synthesized from PR automake/6.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AM_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_PROGRAMS = joe moe
+joe_SOURCES = joe.ll
+moe_SOURCES = moe.l++
+LDADD = $(LEXLIB)
+
+.PHONY: test-deps-exist
+test-deps-exist:
+       ls -l $(DEPDIR) ;: For debugging.
+       test -f $(DEPDIR)/joe.Po
+       test -f $(DEPDIR)/moe.Po
+
+.PHONY: test-obj-updated
+test-obj-updated: joe.$(OBJEXT) moe.$(OBJEXT)
+       stat older my-hdr.hxx joe.$(OBJEXT) moe.$(OBJEXT) || :
+       test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT)
+       test `ls -t older moe.$(OBJEXT) | sed 1q` = moe.$(OBJEXT)
+END
+
+cat > joe.ll << 'END'
+%%
+"foo" return EOF;
+.
+%%
+#include "my-hdr.hxx"
+int yywrap (void)
+{
+  return 1;
+}
+int main (int argc, char **argv)
+{
+  printf("Hello, World!\n");
+  return 0;
+}
+END
+
+cp joe.ll moe.l++
+
+cat > my-hdr.hxx <<'END'
+// This header contains deliberetly invalid C (but valid C++)
+#include <cstdio>
+using namespace std;
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+$FGREP joe.Po Makefile.in
+$FGREP moe.Po Makefile.in
+
+$AUTOCONF
+# Try to enable dependency tracking if possible, even if that means
+# using slow dependency extractors.
+./configure --enable-dependency-tracking
+
+$MAKE test-deps-exist
+$MAKE
+
+: > older
+$sleep
+touch my-hdr.hxx
+$MAKE test-obj-updated
+
+:
diff --git a/tests/lex-depend-grep.test b/tests/lex-depend-grep.test
new file mode 100755 (executable)
index 0000000..2f1af8c
--- /dev/null
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 1999, 2001, 2002, 2006, 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/>.
+
+# Test to make sure dependencies for Lex and C/C++ does not break
+# in obvious ways.  See PR automake/6, and related semantic tests
+# `lex-depend.test' and `lex-depend-cxx.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_CXX
+AM_PROG_LEX
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = zoo foo
+zoo_SOURCES = joe.ll
+foo_SOURCES = moe.l
+noinst_PROGRAMS = zardoz
+zardoz_SOURCES = _0.l _1.ll _2.lxx _3.l++ _4.lpp
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+$EGREP '([mj]oe|_[01234]|include|\.P)' Makefile.in # For debugging.
+
+for x in joe moe _0 _1 _2 _3 _4; do
+  grep "include.*$x\.Po" Makefile.in
+done
+
+:
diff --git a/tests/lex-depend.test b/tests/lex-depend.test
new file mode 100755 (executable)
index 0000000..2ef27da
--- /dev/null
@@ -0,0 +1,88 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test to make sure automatic dependency tracking work with Lex/C.
+# Test suggested by PR automake/6.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = zoo
+zoo_SOURCES = joe.l
+LDADD = $(LEXLIB)
+
+.PHONY: test-deps-exist
+test-deps-exist:
+       ls -l $(DEPDIR) ;: For debugging.
+       test -f $(DEPDIR)/joe.Po
+
+.PHONY: test-obj-updated
+test-obj-updated: joe.$(OBJEXT)
+       stat older my-hdr.h joe.$(OBJEXT) || : For debugging.
+       test `ls -t older joe.$(OBJEXT) | sed 1q` = joe.$(OBJEXT)
+END
+
+cat > joe.l << 'END'
+%%
+"foo" return EOF;
+.
+%%
+#include "my-hdr.h"
+int main (void)
+{
+  printf("%s\n", MESSAGE);
+  return 0;
+}
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
+END
+
+cat > my-hdr.h <<'END'
+#include <stdio.h>
+#define MESSAGE "Hello, World!"
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+$FGREP joe.Po Makefile.in
+
+$AUTOCONF
+# Try to enable dependency tracking if possible, even if that means
+# using slow dependency extractors.
+./configure --enable-dependency-tracking
+
+$MAKE test-deps-exist
+$MAKE
+
+: > older
+$sleep
+touch my-hdr.h
+$MAKE test-obj-updated
+
+:
diff --git a/tests/lex-lib-external.test b/tests/lex-lib-external.test
new file mode 100755 (executable)
index 0000000..1fb0009
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check that we can get use the `yywrap' function from a system-wide
+# library, if that's available.
+
+required='cc lex'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = lexer
+lexer_SOURCES = foo.l
+lexer_LDADD = $(LEXLIB)
+
+.PHONY: have-lexlib
+have-lexlib:
+       test x'$(LEXLIB)' != x
+       echo 'int main (void) { return yywrap (); }' > x.c
+       $(CC) -c x.c
+       $(CC) x.$(OBJEXT) $(LEXLIB)
+       rm -f x.c *.$(OBJEXT) *.o *.out *.exe
+END
+
+cat > foo.l <<'END'
+%%
+"GOOD"   return EOF;
+.
+%%
+int main (void)
+{
+  /* We don't use a 'while' loop here (like a real lexer would do)
+     to avoid possible hangs. */
+  if (yylex () == EOF)
+    return 0;
+  else
+    return 1;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE have-lexlib || skip_ "no system-wide lex library found"
+
+# Program should build and run and distribute.
+$MAKE all
+if cross_compiling; then :; else
+  echo GOOD | ./lexer
+  echo BAD | ./lexer && Exit 1
+  : For shells with busted 'set -e'.
+fi
+$MAKE distcheck
+
+:
similarity index 55%
rename from tests/depcomp3.test
rename to tests/lex-lib.test
index 649fada..8339667 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 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
 # 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 dashmstdout generates dependencies.
+# Check that we can provide a personal `yywrap' function in a custom
+# library.
+# See also test `lex-lib-external.test'.
 
-required='gcc'
+required='cc lex'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
-AM_PROG_CC_C_O
+AM_PROG_AR
+AC_PROG_RANLIB
+LEXLIB=libmylex.a
+AC_PROG_LEX
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-check_PROGRAMS = prg
-prg_SOURCES = src/sub.c src/foo.h
-
-.PHONY: grepdeps
-grepdeps:
-       grep 'src/sub\.$(OBJEXT).*:' src/$(DEPDIR)/sub.Po
-
+bin_PROGRAMS = lexer
+lexer_SOURCES = foo.l
+lexer_LDADD = $(LEXLIB)
+EXTRA_lexer_DEPENDENCIES = $(LEXLIB)
+noinst_LIBRARIES = libmylex.a
+libmylex_a_SOURCES = mu.c
 END
 
-mkdir src
-
-: > src/foo.h
+cat > mu.c << 'END'
+int yywrap (void)
+{
+  return 1;
+}
+END
 
-cat >src/sub.c <<EOF
-#include "foo.h"
-int
-main ()
+cat > foo.l <<'END'
+%%
+"END" return EOF;
+.
+%%
+int main (void)
 {
-   return 0;
+  return 0;
 }
-EOF
+END
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-# Sanity check: make sure the cache variable we force is used by configure
-grep am_cv_CC_dependencies_compiler_type configure
-
-./configure am_cv_CC_dependencies_compiler_type=dashmstdout
-$MAKE check
-$MAKE grepdeps
+./configure
+$MAKE
+test -f foo.c
+test -f libmylex.a
 
 :
diff --git a/tests/lex-libobj.test b/tests/lex-libobj.test
new file mode 100755 (executable)
index 0000000..75831c4
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 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/>.
+
+# Check that we can provide a personal `yywrap' function through the
+# LIBOBJ machinery.
+
+required='cc lex'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PROG_LEX
+save_LIBS=$LIBS
+LIBS="$LEXLIB $LIBS"
+AC_REPLACE_FUNCS([yywrap])
+LIBS=$save_LIBS
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.l
+foo_LDADD = $(LEXLIB) $(LIBOBJS)
+END
+
+cat > yywrap.c << 'END'
+int yywrap (void)
+{
+  return 1;
+}
+END
+
+cat > foo.l <<'END'
+%%
+"END" return EOF;
+.
+%%
+int main (void)
+{
+  return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+grep LIBOBJS Makefile # For debugging.
+$MAKE
+$MAKE distclean
+
+# Force "no system lex library".
+./configure LEXLIB='-L /lib'
+grep LIBOBJS Makefile # For debugging.
+grep '^LIBOBJS *=.*yywrap.*\.o' Makefile # Sanity check.
+$MAKE
+
+$MAKE distcheck
+
+:
diff --git a/tests/lex-line.test b/tests/lex-line.test
new file mode 100755 (executable)
index 0000000..a7e1640
--- /dev/null
@@ -0,0 +1,122 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that automake lex support ensures that lex-generated C
+# files use correct "#line" directives.  Try also with the
+# `subdir-object' option enabled.
+# See also sister test `yacc-line.test'.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+mkdir dir sub sub/dir
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+bin_PROGRAMS = foo bar
+LDADD = $(LEXLIB)
+bar_LFLAGS = -v
+foo_SOURCES = zardoz.l
+bar_SOURCES = dir/quux.l
+## Avoid spurious failures with Solaris make.
+zardoz.@OBJEXT@: zardoz.c
+bar-quux.@OBJEXT@: bar-quux.c
+END
+
+cat > sub/Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+noinst_PROGRAMS = foo bar
+## We already used $(LEXLIB) above, so try @LEXLIB@ now.
+LDADD = @LEXLIB@
+foo_LFLAGS = -v
+foo_SOURCES = zardoz.l
+bar_SOURCES = dir/quux.l
+## Avoid spurious failures with Solaris make.
+foo-zardoz.@OBJEXT@: foo-zardoz.c
+dir/quux.@OBJEXT@: dir/quux.c
+END
+
+cat > zardoz.l << 'END'
+%%
+"END"  return EOF;
+.
+%%
+int main ()
+{
+  while (yylex () != EOF)
+    ;
+  return 0;
+}
+
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
+END
+
+cp zardoz.l dir/quux.l
+cp zardoz.l sub/zardoz.l
+cp zardoz.l sub/dir/quux.l
+
+c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=..
+    mkdir build
+    cd build
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE
+
+  # For debugging,
+  ls -l . sub sub/dir
+  $FGREP '.l' $c_outputs
+
+  # Adjusted "#line" should not contain reference to the builddir.
+  $EGREP '#.*line.*(build|\.\.).*\.l' $c_outputs && Exit 1
+  # Adjusted "#line" should not contain reference to the default
+  # output file names, e.g., `lex.yy.c'.
+  $EGREP '#.*line.*lex\.yy' $c_outputs && Exit 1
+  # Don't be excessively strict in grepping, to avoid spurious failures.
+  grep '#.*line.*zardoz\.l' zardoz.c
+  grep '#.*line.*quux\.l' bar-quux.c
+  grep '#.*line.*zardoz\.l' sub/foo-zardoz.c
+  grep '#.*line.*quux\.l' sub/dir/quux.c
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/lex-nodist.test b/tests/lex-nodist.test
new file mode 100755 (executable)
index 0000000..092e089
--- /dev/null
@@ -0,0 +1,89 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Checks for .c files derived from non-distributed .l sources.
+# The test `lex-pr204.test' does similar check with AM_MAINTAINER_MODE
+# enabled.
+# The tests 'yacc-nodist.test' and 'yacc-pr204.test' does similar checks
+# for yacc-generated .c and .h files.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+dnl Sister test 'lex-pr204.test' should use 'AC_PROG_LEX' instead.
+AM_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+.PHONY: test-build test-dist
+test-build: all
+       ls -l
+       test -f lexer.l
+       test -f lexer.c
+test-dist: distdir
+       ls -l $(distdir)
+       test ! -r $(distdir)/lexer.l
+       test ! -r $(distdir)/lexer.c
+check-local: test-build test-dist
+
+lexer.l:
+       rm -f $@ $@-t
+       :; { : \
+         && echo '%%' \
+         && echo '"GOOD" return EOF;' \
+         && echo '.'; \
+       } > $@-t
+       chmod a-w $@-t && mv -f $@-t $@
+
+bin_PROGRAMS = prog
+prog_SOURCES = main.c
+nodist_prog_SOURCES = lexer.l
+prog_LDADD = $(LEXLIB)
+CLEANFILES = $(nodist_prog_SOURCES)
+END
+
+cat > main.c << 'END'
+int main ()
+{
+  return yylex ();
+}
+
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+$MAKE test-build
+$MAKE test-dist
+
+# But the distribution must work correctly, assuming the user has
+# the proper tools to process yacc files.
+$MAKE distcheck
+
+:
diff --git a/tests/lex-noyywrap.test b/tests/lex-noyywrap.test
new file mode 100755 (executable)
index 0000000..98561f2
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010, 2011, 2012 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/>.
+
+# Check Lex support with flex using the `%noyywrap' option.
+
+required='cc flex'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.l
+
+.PHONY: test-no-lexlib
+check-local: test-no-lexlib
+test-no-lexlib:
+       test x'$(LEXLIB)' = x'none needed'
+END
+
+cat > foo.l << 'END'
+%option noyywrap
+%%
+"GOOD"   return EOF;
+.
+%%
+int main (void)
+{
+  /* We don't use a 'while' loop here (like a real lexer would do)
+     to avoid possible hangs. */
+  if (yylex () == EOF)
+    return 0;
+  else
+    return 1;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure LEXLIB="none needed"
+
+# Program should build and run.
+$MAKE
+if cross_compiling; then :; else
+  echo GOOD | ./foo
+  echo BAD | ./foo && Exit 1
+  : For shells with busted 'set -e'.
+fi
+
+# Sanity check on distribution.
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='LEXLIB="none needed"'
+
+:
diff --git a/tests/lex-pr204.test b/tests/lex-pr204.test
new file mode 100755 (executable)
index 0000000..095d611
--- /dev/null
@@ -0,0 +1,88 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Related to PR 204.
+# C sources derived from nodist_ lex sources should not be distributed.
+# See also related test `lex-nodist.test'.
+# The tests 'yacc-nodist.test' and 'yacc-pr204.test' does similar checks
+# for yacc-generated .c and .h files.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'EOF'
+AM_MAINTAINER_MODE
+AC_PROG_CC
+dnl We use AC_PROG_LEX deliberately.
+dnl Sister 'lex-nodist.test' should use 'AM_PROG_LEX' instead.
+AC_PROG_LEX
+AC_OUTPUT
+EOF
+
+# The LEXER2 intermediate variable is there to make sure Automake
+# matches 'nodist_' against the right variable name...
+cat > Makefile.am << 'EOF'
+EXTRA_PROGRAMS = foo
+LEXER2 = lexer2.l
+nodist_foo_SOURCES = lexer.l $(LEXER2)
+
+distdirtest: distdir
+       test ! -f $(distdir)/lexer.c
+       test ! -f $(distdir)/lexer.l
+       test ! -f $(distdir)/lexer.h
+       test ! -f $(distdir)/lexer2.c
+       test ! -f $(distdir)/lexer2.l
+       test ! -f $(distdir)/lexer2.h
+EOF
+
+cat > lexer.l << 'END'
+%%
+"GOOD"   return EOF;
+.
+%%
+int main (void)
+{
+  return yylex ();
+}
+END
+
+cp lexer.l lexer2.l
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE distdirtest
+
+# Make sure lexer.c and lexer2.c are still targets.
+$MAKE lexer.c lexer2.c
+test -f lexer.c
+test -f lexer2.c
+
+# Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
+# it's a nodist_ lexer.
+$sleep
+touch lexer.l lexer2.l
+$sleep
+$MAKE lexer.c lexer2.c
+stat lexer.c lexer.l lexer2.c lexer2.l || : # For debugging.
+test `ls -t lexer.c lexer.l | sed 1q` = lexer.c
+test `ls -t lexer2.c lexer2.l | sed 1q` = lexer2.c
+
+:
index 4449715..bca664d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012 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
 # Ensure subdirs for subdir scanners are generated when subdir-objects
 # are used, even when dependency tracking is disabled.
 
-required=flex
+required='cc lex'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<\END
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -53,7 +51,7 @@ int main (void)
 
 int yywrap(void)
 {
-  return 0;
+  return 1;
 }
 END
 
index c59c4e3..3327eb4 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1998, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2001, 2002, 2006, 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
@@ -16,8 +17,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_LEX
@@ -29,19 +28,14 @@ zot_SOURCES = joe.l
 LDADD = @LEXLIB@
 END
 
-: > joe.l
-
 $ACLOCAL
 $AUTOMAKE -a
 
-
 # Test to make sure that lex source generates correct target.
-
 $FGREP '$(LEX)' Makefile.in
 
 # Test to make sure that lex source generates correct clean rule.
 # From Ralf Corsepius.
-
 $FGREP joel Makefile.in && Exit 1
 
 :
index d588edf..72be79d 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
@@ -29,8 +28,9 @@ bin_PROGRAMS = zot
 zot_SOURCES = joe.l
 END
 
-: > joe.l
-
 $ACLOCAL
-AUTOMAKE_fails
-grep AM_PROG_LEX stderr
+AUTOMAKE_fails -a
+grep 'LEX.* undefined' stderr
+grep 'add .*AM_PROG_LEX' stderr
+
+:
index c0af6b2..474490b 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010, 2011 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 2010, 2011, 2012 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# Basic semantic checks on Lex support.
 # Test associated with PR 19.
 # From Matthew D. Langston.
 
-required='gcc flex GNUmake'
+required='cc lex'
 . ./defs || Exit 1
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-cat > configure.in << 'END'
-AC_INIT
-dnl Prevent automake from looking in .. and ../..
-AC_CONFIG_AUX_DIR(.)
-AM_INIT_AUTOMAKE(am_lex_bug, 0.1.1)
-
-dnl Checks for programs.
+cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_LEX
-AC_PROG_YACC
-AC_OUTPUT(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-LDADD             = @LEXLIB@
-noinst_PROGRAMS   = foo
-foo_SOURCES       = foo.l
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.l
 END
 
 cat > foo.l << 'END'
 %%
-"END"   return EOF;
+"GOOD"   return EOF;
 .
 %%
-int
-main ()
-{
-  while (yylex () != EOF)
-    ;
 
-  return 0;
+int main (void)
+{
+  /* We don't use a 'while' loop here (like a real lexer would do)
+     to avoid possible hangs. */
+  if (yylex () == EOF)
+    return 0;
+  else
+    return 1;
 }
 
 /* Avoid possible link errors. */
@@ -65,25 +56,34 @@ int yywrap (void)
 }
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
+
 ./configure
+
+# Program should build and run.
 $MAKE
-echo 'This is the END' | ./foo
-$MAKE distcheck
+if cross_compiling; then :; else
+  echo GOOD | ./foo
+  echo BAD | ./foo && Exit 1
+  : For shells with busted 'set -e'.
+fi
+
+# The generated file `foo.c' must be shipped.
+$MAKE distdir
+test -f $distdir/foo.c
 
-# foo.c must be shipped.
-gunzip am_lex_bug-0.1.1.tar.gz
-tar tf am_lex_bug-0.1.1.tar | $FGREP foo.c
+# Sanity check on distribution.
+yl_distcheck
 
 # While we are at it, make sure that foo.c is erased by
 # maintainer-clean, and not by distclean.
 test -f foo.c
 $MAKE distclean
 test -f foo.c
-./configure
+./configure # Re-create `Makefile'.
 $MAKE maintainer-clean
 test ! -f foo.c
+
+:
index 88924b2..2ba2ad6 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
 
 # Test for subdir lexers.
 
-required='gcc GNUmake flex'
+required='cc lex'
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << 'END'
-AC_INIT([lex5], [1.0])
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE
-AC_CONFIG_FILES([Makefile])
+cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
 AM_PROG_LEX
@@ -57,21 +52,22 @@ main ()
 }
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
+# We expect ylwrap to be used and distributed even if there is
+# only one lexer.
+test -f ylwrap
+
 mkdir sub
 cd sub
 ../configure
 $MAKE foo/foo.o
+ls -l # For debugging.
 
 test -f foo/foo.c
 test -f foo/foo.o
-# ylwrap is not needed
-test ! -f ./ylwrap
 
 # Now, adds another lexer to test ylwrap.
 
@@ -89,11 +85,12 @@ END
 $sleep
 
 $AUTOMAKE -a --no-force
-test -f ./ylwrap
 
 cd sub
+using_gmake || $MAKE Makefile
 $MAKE foo/foo2.o
+ls -l # For debugging.
 test -f foo/foo2.c
 test -f foo/foo2.o
 
-Exit 0
+:
similarity index 63%
rename from tests/cxxansi.test
rename to tests/lexcpp.test
index 9d6fd6e..7fd409a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure ansi2knr doesn't use `$U' for C++.
-# Report from Robert Boehne.
+# Test to make sure Lex + C++ is supported.
+# Please keep this is sync with sister test yaccpp.test.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXX
-AM_C_PROTOTYPES
+AC_PROG_LEX
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
-sbin_PROGRAMS = anonymous
-anonymous_SOURCES = doe.c jane.C
+bin_PROGRAMS = foo bar baz qux
+foo_SOURCES = foo.l++
+bar_SOURCES = bar.lpp
+baz_SOURCES = baz.ll
+qux_SOURCES = qux.lxx
 END
 
-: > ansi2knr.c
-: > ansi2knr.1
-
-: > doe.C
-: > jane.C
-
 $ACLOCAL
-$AUTOMAKE -Wno-obsolete
+$AUTOMAKE -a
 
-$FGREP 'jane$U' Makefile.in && Exit 1
-$FGREP 'doe$U' Makefile.in
+sed -e 's/^/ /' -e 's/$/ /' Makefile.in >mk
+$FGREP ' foo.c++ ' mk
+$FGREP ' bar.cpp ' mk
+$FGREP ' baz.cc '  mk
+$FGREP ' qux.cxx ' mk
 
-Exit 0
+:
diff --git a/tests/lexvpath.test b/tests/lexvpath.test
new file mode 100755 (executable)
index 0000000..d86ef2f
--- /dev/null
@@ -0,0 +1,119 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# This test checks that dependent files are updated before including
+# in the distribution.  `lexer.c' depends on `lexer.l'.  The latter is
+# updated so that `lexer.c' should be rebuild.  Then we are running
+# `make' and `make distdir' and check whether the version of `lexer.c'
+# to be distributed is up to date.
+
+# Please keep this in sync with sister test `yaccvapth.test'.
+
+required='cc lex'
+. ./defs || Exit 1
+
+cat > lexoutroot.in << 'END'
+LEX_OUTPUT_ROOT='@LEX_OUTPUT_ROOT@'
+END
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([lexoutroot])
+AC_PROG_CC
+AC_PROG_LEX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = lexer.l foo.c
+LDADD = $(LEXLIB)
+END
+
+# Original lexer, with a "foobar" comment
+cat > lexer.l << 'END'
+%%
+"END" return EOF;
+.
+%%
+/*foobar*/
+END
+
+cat > foo.c << 'END'
+int main (void)
+{
+  return 0;
+}
+/* Avoid possible link errors. */
+int yywrap (void)
+{
+  return 1;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir sub
+
+# We must run configure early, to find out why $LEX_OUTPUT_ROOT is.
+cd sub
+../configure
+. ./lexoutroot
+test -n "$LEX_OUTPUT_ROOT" # Sanity check.
+cd ..
+
+$LEX lexer.l
+mv "$LEX_OUTPUT_ROOT".c lexer.c
+
+cd sub
+
+# Ensure that lexer.l will be newer than lexer.c.
+$sleep
+
+# New lexer, with `fubar' comment.
+cat > ../lexer.l << 'END'
+%%
+"END" return EOF;
+.
+%%
+/*fubar*/
+END
+
+$MAKE
+$MAKE distdir
+$FGREP '/*fubar*/' $distdir/lexer.c
+
+#
+# Now check to make sure that `make dist' will rebuilt the parser.
+#
+
+# Ensure that lexer.l will be newer than lexer.c.
+$sleep
+
+# New lexer, with `maude' comment.
+cat > ../lexer.l << 'END'
+%%
+"END" return EOF;
+.
+%%
+/*maude*/
+END
+
+$MAKE distdir
+$FGREP '/*maude*/' $distdir/lexer.c
+
+:
index 4c3e048..63e1073 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # Check that $(LFLAGS) takes precedence over both $(AM_LFLAGS) and
 # $(foo_LFLAGS).
 # Please keep this in sync with the sister tests lflags2.test, yflags.test
-# and yflags2.test
+# and yflags2.test.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >fake-lex <<'END'
 #!/bin/sh
 echo '/*' "$*" '*/' >lex.yy.c
@@ -35,7 +34,7 @@ chmod a+x fake-lex
 unset LEX || :
 
 cat >> configure.in <<'END'
-AC_PROG_CC
+AC_SUBST([CC], [false])
 # Simulate presence of Lex using our fake-lex script.
 AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex])
 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
@@ -44,6 +43,7 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = foo bar
 foo_SOURCES = main.c foo.l
 bar_SOURCES = main.c bar.l
@@ -57,19 +57,17 @@ $AUTOMAKE -a
 grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && Exit 1
 grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && Exit 1
 
-echo 'int main(void){ return 0; }' > main.c
 : > foo.l
 : > bar.l
 
 $AUTOCONF
 ./configure
-env LFLAGS=__user_flags__ $MAKE -e
-
-ls -l
+env LFLAGS=__user_flags__ $MAKE -e foo.c bar-bar.c
 
 cat foo.c
-grep '__am_flags__.*__user_flags__' foo.c
 cat bar-bar.c
+
+grep '__am_flags__.*__user_flags__' foo.c
 grep '__bar_flags__.*__user_flags__' bar-bar.c
 
 :
index f13c656..139c800 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # Check that $(LFLAGS) takes precedence over both $(AM_LFLAGS) and
 # $(foo_LFLAGS).
 # Please keep this in sync with the sister tests lflags.test, yflags.test
-# and yflags2.test
+# and yflags2.test.
 
-required=g++ # FIXME: any working C++ compiler should be OK
 . ./defs || Exit 1
 
-set -e
-
 cat >fake-lex <<'END'
 #!/bin/sh
 echo '/*' "$*" '*/' >lex.yy.c
@@ -36,7 +33,7 @@ chmod a+x fake-lex
 unset LEX || :
 
 cat >> configure.in <<'END'
-AC_PROG_CXX
+AC_SUBST([CXX], [false])
 # Simulate presence of Lex using our fake-lex script.
 AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex])
 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
@@ -45,6 +42,7 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = foo bar
 foo_SOURCES = main.cc foo.ll
 bar_SOURCES = main.cc bar.l++
@@ -58,19 +56,17 @@ $AUTOMAKE -a
 grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && Exit 1
 grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && Exit 1
 
-echo 'int main(void) { return 0; }' > main.cc
 : > foo.ll
 : > bar.l++
 
 $AUTOCONF
 ./configure
-env LFLAGS=__user_flags__ $MAKE -e
-
-ls -l
+env LFLAGS=__user_flags__ $MAKE -e foo.cc bar-bar.c++
 
 cat foo.cc
-grep '__am_flags__.*__user_flags__' foo.cc
 cat bar-bar.c++
+
+grep '__am_flags__.*__user_flags__' foo.cc
 grep '__bar_flags__.*__user_flags__' bar-bar.c++
 
 :
index a6561b7..a305f78 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 libexec_PROGRAMS = foo
 pkglibexec_PROGRAMS = bar
diff --git a/tests/libobj-basic.test b/tests/libobj-basic.test
new file mode 100755 (executable)
index 0000000..6578264
--- /dev/null
@@ -0,0 +1,112 @@
+#! /bin/sh
+# Copyright (C) 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 AC_LIBSOURCE and AC_LIBSOURCES work.
+
+required=cc
+. ./defs || Exit 1
+
+mv configure.in configure.proto
+cat >> configure.proto << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES = foo.c
+libtu_a_LIBADD = $(LIBOBJS)
+
+include extra-checks.am
+.PHONY: $(extra_checks) pre-test
+
+pre-test: distdir
+       ls -l $(srcdir) $(builddir) $(distdir)
+       $(AR) tv libtu.a
+$(extra_checks): pre-test
+check-local: $(extra_checks)
+
+maude-src:
+       grep dummy_maude $(srcdir)/maude.c
+maude-dist:
+       grep dummy_maude $(distdir)/maude.c
+liver-src:
+       grep dummy_liver $(srcdir)/liver.c
+liver-dist:
+       grep dummy_liver $(distdir)/liver.c
+liver-not-dist:
+       test -d $(distdir)
+       test ! -r $(distdir)/liver.c
+maude-not-dist:
+       test -d $(distdir)
+       test ! -r $(distdir)/maude.c
+END
+
+cat > foo.c << 'END'
+extern int dummy_foo;
+END
+
+cat > maude.c << 'END'
+extern int dummy_maude;
+END
+
+cat > liver.c << 'END'
+extern int dummy_liver;
+END
+
+# AC_LIBSOURCE should work also if called after AC_OUTPUT.
+cat configure.proto - > configure.in <<END
+AC_LIBSOURCE([maude.c])
+END
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist liver-not-dist
+END
+
+cp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script \`ar-lib'"
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+$MAKE distclean
+# Avoid timestamp-related differences.
+rm -rf autom4te*.cache
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist liver-src liver-dist
+END
+
+# AC_LIBSOURCES should work also if called after AC_OUTPUT.
+cat configure.proto - > configure.in <<END
+AC_LIBSOURCES([maude.c, liver.c])
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+:
index 0d24741..d261018 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2010, 2011, 2012 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
 # Do not complain about the nonexistence of a source for LIBOBJS if
 # it's in BUILT_SOURCES.  Reported by Erez Zadok.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([foo])
 AC_OUTPUT
@@ -30,13 +31,24 @@ END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libfoo.a
-libfoo_a_LIBADD = @LIBOBJS@
+libfoo_a_SOURCES =
+libfoo_a_LIBADD = $(LIBOBJS)
+BUILT_SOURCES = foo.c
+CLEANFILES = foo.c
+foo.c:
+       echo 'extern int dummy;' > $@
 END
 
+cp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'"
+
 $ACLOCAL
-AUTOMAKE_fails
-grep 'Makefile.am:2:.*foo\.c' stderr
+$AUTOCONF
+$AUTOMAKE
 
-echo 'BUILT_SOURCES = foo.c' >> Makefile.am
+./configure
 
-$AUTOMAKE
+$MAKE
+ar t libfoo.a # For debugging.
+$MAKE distcheck
+
+:
index 5f1d029..73b1b61 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
 # Test if a file can be mentioned in LIBOBJS and explicitly.
 # (See libobj13.test for the LTLIBRARIES check.)
 
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([foo])
 AC_LIBOBJ([bar])
@@ -44,26 +43,35 @@ p1_LDADD = @LIBOBJS@
 p2_SOURCES = bar.c
 END
 
+: > ar-lib
 : > foo.c
 : > bar.c
 
 $ACLOCAL
-$AUTOMAKE
 
 # This however should be diagnosed, since foo.c and bar.c are in @LIBOBJS@.
-echo 'libfoo_a_SOURCES += foo.c' >> Makefile.am
-echo 'p1_SOURCES += bar.c' >> Makefile.am
+cat >> Makefile.am << 'END'
+libfoo_a_SOURCES += foo.c
+p1_SOURCES += bar.c
+END
+
 AUTOMAKE_fails
-$FGREP foo.c stderr
-$FGREP bar.c stderr
+grep 'foo\.c.*explicitly mentioned' stderr
+grep 'bar\.c.*explicitly mentioned' stderr
 
 # Global `LDADD' can also come into play.
 cat > Makefile.am << 'END'
 noinst_PROGRAMS = a b
 LDADD = @LIBOBJS@
 END
+
 $AUTOMAKE
 grep 'a_DEPENDENCIES.*LIBOBJS' Makefile.in
-echo 'a_SOURCES = foo.c' >> Makefile.am
+
+cat >> Makefile.am << 'END'
+a_SOURCES = foo.c
+END
 AUTOMAKE_fails
-$FGREP foo.c stderr
+grep 'foo\.c.*explicitly mentioned' stderr
+
+:
index 6ca68c9..0022ea0 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-
 # Test if a file can be mentioned in LTLIBOBJS and explicitly.
 # (Like libobj12.test, but for Libtool libraries.)
 
 required='libtoolize'
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_LIBOBJ([foo])
 AC_OUTPUT
@@ -47,4 +46,6 @@ $AUTOMAKE --add-missing
 # This however should be diagnosed, since foo.c is in @LIBOBJS@.
 echo 'libfoo_la_SOURCES += foo.c' >> Makefile.am
 AUTOMAKE_fails
-$FGREP foo.c stderr
+grep 'foo\.c.*explicitly mentioned' stderr
+
+:
index 0ee750c..41b9ba1 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
 # Regression test for an internal error when @LIBOBJS@ is used in
 # a variable that is not defined in the same conditions as the _LDADD
 # that uses it.
-# Report from Bill Davidson
+# Report from Bill Davidson.
 
-required=gcc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AC_PROG_CC
 AC_LIBSOURCE([bar.c])
-AM_CONDITIONAL([CASE], :)
+AM_CONDITIONAL([CASE], [:])
 AC_OUTPUT
 EOF
 
@@ -43,3 +40,5 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+
+:
similarity index 71%
rename from tests/libobj11.test
rename to tests/libobj15a.test
index 204ff8b..1889d63 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2008  Free Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# AC_LIBOBJ must allow [] around its argument.
+# Nonexistent sources for AC_LIBOBJ should cause an Automake failure.
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
-AC_LIBOBJ([mountlist])
-AC_OUTPUT(Makefile)
+AC_LIBOBJ([foobar])
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > mountlist.c
+: > ar-lib
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*foobar\.c.*' stderr
+
+:
diff --git a/tests/libobj15b.test b/tests/libobj15b.test
new file mode 100755 (executable)
index 0000000..03415c2
--- /dev/null
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Nonexistent source for AC_LIBSOURCE should cause Automake to fail.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_LIBSOURCE([foobar.c])
+# NOTE: this call to AC_OUTPUT is really needed; see Automake bug #7635
+#       <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7635>
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
+END
+
+: > ar-lib
+
+$ACLOCAL
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*foobar\.c.*' stderr
+
+:
similarity index 51%
rename from tests/libobj8.test
rename to tests/libobj15c.test
index 206bca6..603e2eb 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure `_.c' dependencies are generated for LIBOBJS
-# objects.
+# Nonexistent sources for AC_LIBSOURCES should cause Automake to fail.
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat >> configure.in << 'END'
 AC_PROG_CC
-AC_PROG_CC_STDC
 AC_PROG_RANLIB
-AC_REPLACE_FUNCS(basename dirname strsignal)
-AM_C_PROTOTYPES
-AC_OUTPUT(Makefile)
+AC_LIBSOURCES([foobar.c, bazquux.c])
+# NOTE: this call to AC_OUTPUT is really needed; see Automake bug #7635
+#       <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7635>
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > basename.c
-: > dirname.c
-: > strsignal.c
+# Don't trip on errors due to missing `AM_PROG_AR'.
+AUTOMAKE="$AUTOMAKE -Wno-extra-portability"
 
-: > ansi2knr.1
-: > ansi2knr.c
+$ACLOCAL
 
-$ACLOCAL || Exit 1
-$AUTOMAKE  -Wno-obsolete || Exit 1
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*foobar\.c.*' stderr
+grep 'configure\.in:.*required file.*bazquux\.c.*' stderr
 
-grep 'strsignal_.c:' Makefile.in
+: > foobar.c
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*bazquux\.c.*' stderr
+grep 'foobar\.c' stderr && Exit 1
+
+:
diff --git a/tests/libobj16a.test b/tests/libobj16a.test
new file mode 100755 (executable)
index 0000000..4a5709a
--- /dev/null
@@ -0,0 +1,139 @@
+#! /bin/sh
+# Copyright (C) 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 AC_LIBOBJ and friends work.
+# Please keep this in sync with sister test `libobj16b.test'.
+
+required=cc
+. ./defs || Exit 1
+
+mv configure.in configure.proto
+cat >> configure.proto << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+%LIBOBJ-STUFF% # Will be activated later.
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
+
+include extra-checks.am
+.PHONY: $(extra_checks) pre-test
+
+pre-test: distdir
+       ls -l $(srcdir) $(builddir) $(distdir)
+       $(AR) tv libtu.a
+$(extra_checks): pre-test
+check-local: $(extra_checks)
+
+maude-src:
+       grep dummy_maude $(srcdir)/maude.c
+maude-dist:
+       grep dummy_maude $(distdir)/maude.c
+liver-src:
+       grep dummy_liver $(srcdir)/liver.c
+liver-dist:
+       grep dummy_liver $(distdir)/liver.c
+liver-not-dist: distdir
+       test ! -r $(distdir)/liver.c
+maude-not-dist: distdir
+       test ! -r $(distdir)/maude.c
+maude-lib:
+       $(AR) t libtu.a | grep maude
+maude-not-lib:
+       $(AR) t libtu.a | grep maude && exit 1; exit 0
+liver-lib:
+       $(AR) t libtu.a | grep liver
+liver-not-lib:
+       $(AR) t libtu.a | grep liver && exit 1; exit 0
+END
+
+cat > maude.c << 'END'
+extern int dummy_maude;
+END
+
+cat > liver.c << 'END'
+extern int dummy_liver;
+END
+
+sed '/%LIBOBJ-STUFF%/{
+s/.*//
+i\
+AC_LIBOBJ([maude])
+}' configure.proto > configure.in
+cat configure.in # For debugging.
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist maude-lib liver-not-dist
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+# Avoid timestamp-related differences.
+rm -rf autom4te*.cache
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist liver-src liver-dist
+if MAUDE_COND
+extra_checks += maude-lib liver-not-lib
+else
+extra_checks += maude-not-lib liver-lib
+endif
+END
+
+sed '/%LIBOBJ-STUFF%/{
+s/.*//
+i\
+AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\
+if test x"$MAUDE" = x"yes"; then\
+  AC_LIBOBJ([maude])\
+else\
+  AC_LIBOBJ([liver])\
+fi\
+AC_LIBSOURCES([maude.c, liver.c])
+}' configure.proto > configure.in
+cat configure.in # For debugging.
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure MAUDE=yes
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+./configure MAUDE=no
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+:
diff --git a/tests/libobj16b.test b/tests/libobj16b.test
new file mode 100755 (executable)
index 0000000..1326a9e
--- /dev/null
@@ -0,0 +1,139 @@
+#! /bin/sh
+# Copyright (C) 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 AC_LIBOBJ and friends work.
+# Please keep this in sync with sister test `libobj16a.test'.
+
+required=cc
+. ./defs || Exit 1
+
+mv configure.in configure.proto
+cat >> configure.proto << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+%LIBOBJ-STUFF% # Will be activated later.
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = @LIBOBJS@
+
+include extra-checks.am
+.PHONY: $(extra_checks) pre-test
+
+pre-test: distdir
+       ls -l $(srcdir) $(builddir) $(distdir)
+       $(AR) tv libtu.a
+$(extra_checks): pre-test
+check-local: $(extra_checks)
+
+maude-src:
+       grep dummy_maude $(srcdir)/maude.c
+maude-dist:
+       grep dummy_maude $(distdir)/maude.c
+liver-src:
+       grep dummy_liver $(srcdir)/liver.c
+liver-dist:
+       grep dummy_liver $(distdir)/liver.c
+liver-not-dist: distdir
+       test ! -r $(distdir)/liver.c
+maude-not-dist: distdir
+       test ! -r $(distdir)/maude.c
+maude-lib:
+       $(AR) t libtu.a | grep maude
+maude-not-lib:
+       $(AR) t libtu.a | grep maude && exit 1; exit 0
+liver-lib:
+       $(AR) t libtu.a | grep liver
+liver-not-lib:
+       $(AR) t libtu.a | grep liver && exit 1; exit 0
+END
+
+cat > maude.c << 'END'
+extern int dummy_maude;
+END
+
+cat > liver.c << 'END'
+extern int dummy_liver;
+END
+
+sed '/%LIBOBJ-STUFF%/{
+s/.*//
+i\
+AC_LIBOBJ(maude) dnl: do not quote this!
+}' configure.proto > configure.in
+cat configure.in # For debugging.
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist maude-lib liver-not-dist
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -Wno-extra-portability
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+# Avoid timestamp-related differences.
+rm -rf autom4te*.cache
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist liver-src liver-dist
+if MAUDE_COND
+extra_checks += maude-lib liver-not-lib
+else
+extra_checks += maude-not-lib liver-lib
+endif
+END
+
+sed '/%LIBOBJ-STUFF%/{
+s/.*//
+i\
+AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\
+if test x"$MAUDE" = x"yes"; then\
+  AC_LIBOBJ(maude) dnl: do not quote this!\
+else\
+  AC_LIBOBJ(liver) dnl: do not quote this!\
+fi\
+AC_LIBSOURCE(maude.c) dnl: do not quote this!\
+AC_LIBSOURCE(liver.c) dnl: do not quote this!
+}' configure.proto > configure.in
+cat configure.in # For debugging.
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -Wno-extra-portability
+
+./configure MAUDE=yes
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+./configure MAUDE=no
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+:
similarity index 52%
rename from tests/depcomp4.test
rename to tests/libobj17.test
index 4f2df97..2089ae4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test for PR 385: makedepend doesn't work with Libtool.
+# Make sure AC_LIBOBJ accept non-literal arguments.
 
-required='libtoolize gcc makedepend'
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_PROG_LIBTOOL
+AC_PROG_RANLIB
+AM_PROG_AR
+foo=${FOO-oops}
+AC_LIBSOURCES([quux.c, zardoz.c])
+AC_LIBOBJ([$foo])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-noinst_LTLIBRARIES = liba.la
-liba_la_SOURCES = a.c foo.h
-
-.PHONY: grepdeps
-grepdeps:
-       grep 'a\.lo *:' ./$(DEPDIR)/a.Plo
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > foo.h
+cat > quux.c <<'END'
+extern int dummy;
+END
 
-cat >a.c <<EOF
-#include "foo.h"
-int a() { return 0; }
-EOF
+cat > zardoz.c <<'END'
+extern int dummy;
+END
 
-libtoolize --force
+# These might print warnings, but should not error out.
 $ACLOCAL
-$AUTOCONF
 $AUTOMAKE -a
+$AUTOCONF
+
+./configure FOO=quux
+$MAKE
+ls -l # For debugging.
+test -f libtu.a
+ar t libtu.a | $FGREP quux
+ar t libtu.a | $FGREP zardoz && Exit 1
 
-# Sanity check: make sure the cache variable we force is used by configure
-grep am_cv_CC_dependencies_compiler_type configure
+$MAKE distclean
 
-./configure am_cv_CC_dependencies_compiler_type=makedepend
-$MAKE >output 2>&1 || { cat output; Exit 1; }
-cat output
-grep 'unknown directive' output && Exit 1
-$MAKE grepdeps
+./configure FOO=zardoz
+$MAKE
+ls -l # For debugging.
+test -f libtu.a
+ar t libtu.a | $FGREP zardoz
+ar t libtu.a | $FGREP quux && Exit 1
 
 :
similarity index 58%
rename from tests/depend2.test
rename to tests/libobj18.test
index 57d87d7..66188c6 100755 (executable)
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure dependency tracking works with
-# --disable-dependency-tracking.
-# Report from Robert Boehne
+# Make sure AC_LIBSOURCE and AC_LIBSOURCES use arguments literally.
 
-required=gcc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+foo=dummy bar=dummy baz=dummy
+AC_LIBSOURCE([$foo.c])
+AC_LIBSOURCES([$bar.c, $baz.c])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-bin_PROGRAMS = hello
-END
-
-cat > hello.h << 'END'
-#include <stdio.h>
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-cat > hello.c << 'END'
-#include "hello.h"
-int
-main (int argc, char *argv[])
-{
-   printf ("yeah, yeah\n");
-   return 0;
-}
-END
+: > dummy.c
 
 $ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-./configure --disable-dependency-tracking
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*\$foo\.c.*not found' stderr
+grep 'configure\.in:.*required file.*\$bar\.c.*not found' stderr
+grep 'configure\.in:.*required file.*\$baz\.c.*not found' stderr
 
-$MAKE
+:
diff --git a/tests/libobj19.test b/tests/libobj19.test
new file mode 100755 (executable)
index 0000000..ac8f5f7
--- /dev/null
@@ -0,0 +1,96 @@
+#! /bin/sh
+# Copyright (C) 2010, 2011, 2012 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/>.
+
+# Test support for AC_CONFIG_LIBOBJ_DIR.
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_CONFIG_LIBOBJ_DIR([libobj-dir])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_LIBOBJ([foobar])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
+## Hack with this variable ans with extra make recursion in the check-local
+## rule are required for when we move this Makefile in a subdir, later.
+my_distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)
+check-local:
+       (cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) distdir)
+       ls -l $(top_srcdir)/* $(top_builddir)/* $(my_distdir)/*
+       test -f libtu.a
+       test ! -r $(top_srcdir)/foobar.c
+       test -f $(top_srcdir)/libobj-dir/foobar.c
+       test ! -r $(my_distdir)/foobar.c
+       test -f $(my_distdir)/libobj-dir/foobar.c
+       $(AR) t libtu.a
+       $(AR) t libtu.a | grep foobar
+END
+
+mkdir libobj-dir
+cat > libobj-dir/foobar.c << 'END'
+extern int dummy;
+END
+
+cp "$am_scriptdir/ar-lib" . || fatal_ "fetching auxiliary script 'ar-lib'"
+cp "$am_scriptdir/compile" . || fatal_ "fetching auxiliary script 'compile'"
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+
+# Same check, but with the Makefile.am using $(LIBOBJS) not being
+# the top-level one.
+
+$MAKE distclean
+rm -rf autom4te*.cache aclocal.m4 configure
+
+mkdir sub
+mv -f Makefile.am sub
+echo SUBDIRS = sub > Makefile.am
+
+sed '/^AC_OUTPUT/i\
+AC_CONFIG_FILES([sub/Makefile])
+' configure.in > t
+mv -f t configure.in
+cat configure.in # For debugging.
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+
+:
index 81b0e72..0f417a8 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 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
 # Test to make sure LIBOBJS works in subdirs.
 # Bug from Josh MacDonald.
 
+required=cc
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
+AC_CHECK_TOOLS([AR], [ar])
 AC_LIBOBJ([fsusage])
-AC_OUTPUT(subdir/Makefile)
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = subdir
+check-local: distdir
+       ls -l $(srcdir) $(srcdir)/subdir
+       ls -l $(distdir) $(distdir)/subdir
+       ls -l $(builddir) $(builddir)/subdir
+       test -f $(srcdir)/subdir/fsusage.c
+       test -f $(distdir)/subdir/fsusage.c
+       $(AR) tv $(builddir)/subdir/libtu.a
 END
 
 mkdir subdir
@@ -37,9 +50,20 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
-: > subdir/fsusage.c
+cat > subdir/fsusage.c << 'END'
+extern int dummy;
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Older grepping check, kept "just to be sure".
+$FGREP 'fsusage.c' subdir/Makefile.in
+
+./configure
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$MAKE check
+$MAKE distcheck
 
-grep 'fsusage\.c' subdir/Makefile.in
+:
diff --git a/tests/libobj20a.test b/tests/libobj20a.test
new file mode 100755 (executable)
index 0000000..b2f7063
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test error reporting for AC_CONFIG_LIBOBJ_DIR.
+# See also sister tests `libobj20b.test' and `libobj20c.test' .
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_CONFIG_LIBOBJ_DIR([libobj-dir])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_LIBOBJ([foo])
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
+END
+
+mkdir libobj-dir
+: > libobj-dir/foo.c
+: > ar-lib
+
+$ACLOCAL
+AUTOMAKE_fails
+grep 'LIBOBJS.*used outside.*libobj-dir' stderr
+grep 'subdir-objects.*not set' stderr
+
+:
diff --git a/tests/libobj20b.test b/tests/libobj20b.test
new file mode 100755 (executable)
index 0000000..68a292b
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test error reporting for AC_CONFIG_LIBOBJ_DIR.
+# See also sister tests `libobj20a.test' and `libobj20c.test' .
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_CONFIG_LIBOBJ_DIR([libobj-dir])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_LIBSOURCE([foobar.c])
+# NOTE: this call to AC_OUTPUT is really needed; see Automake bug #7635
+#       <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7635>
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
+END
+
+: > ar-lib
+
+$ACLOCAL
+
+AUTOMAKE_fails
+grep 'configure\.in:.*required directory.*libobj-dir' stderr
+
+mkdir libobj-dir
+: > foobar.c # Oops, it should be in libobj-dir!
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*libobj-dir/foobar.c.*' stderr
+
+rm -f foobar.c
+
+: > libobj-dir/foobar.c
+$AUTOMAKE # Now we should succeed.
+
+:
similarity index 52%
rename from tests/depcomp5.test
rename to tests/libobj20c.test
index 4fe7e16..faeedc1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 icc's dependency mode.
+# Test error reporting for AC_CONFIG_LIBOBJ_DIR.
+# See also sister tests `libobj20a.test' and `libobj20b.test' .
 
-required='icc'
 . ./defs || Exit 1
 
-set -e
-
-# Automake supports icc since version 7.0 through a dedicated depcomp mode.
-# icc 8.0 and greater understand gcc options, so depmode is set to gcc.
-if icc -V -help 2>&1 | grep 'Version 7'; then
-  expect='depmode=icc'
-else
-  expect='depmode=gcc'
-fi
-
 cat >> configure.in << 'END'
+AC_CONFIG_LIBOBJ_DIR([libobj-dir])
 AC_PROG_CC
-AM_PROG_CC_C_O
-AC_OUTPUT
+AC_PROG_RANLIB
+AC_LIBOBJ([foobar])
 END
 
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = subdir-objects
-check_PROGRAMS = prg
-prg_SOURCES = src/sub.c src/foo.h
-
-.PHONY: grepdeps
-grepdeps:
-       grep 'src/sub\.$(OBJEXT).*:' src/$(DEPDIR)/sub.Po
-
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-mkdir src
+$ACLOCAL
 
-touch src/foo.h
+# Don't trip on errors due to missing `AM_PROG_AR'.
+AUTOMAKE="$AUTOMAKE -Wno-extra-portability"
 
-cat >src/sub.c <<EOF
-#include "foo.h"
-int
-main ()
-{
-   return 0;
-}
-EOF
+AUTOMAKE_fails
+grep 'configure\.in:.*required directory.*\./libobj-dir' stderr
 
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
+mkdir libobj-dir
+: > foobar.c # Oops, it should be in libobj-dir!
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*libobj-dir/foobar.c.*' stderr
+
+rm -f foobar.c
 
-./configure
-grep "$expect" Makefile
-$MAKE check
-$MAKE grepdeps
+: > libobj-dir/foobar.c
+$AUTOMAKE # Now we should succeed.
 
 :
index 0aeced9..10686f4 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003, 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
 # 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 we complain if @LIBOBJS@ is used without being set in configure.in
+# Make sure we complain if @LIBOBJS@ is used without being set in
+# configure.in.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
+AM_PROG_AR
 END
 
 cat > Makefile.am << 'END'
@@ -30,6 +31,10 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:3:.*LIBOBJS' stderr
+grep 'Makefile\.am:3:.*LIBOBJS' stderr
+
+:
index d6639be..8852262 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -25,8 +26,10 @@ END
 
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_REPLACE_FUNCS(foo)
+AC_REPLACE_FUNCS([foo])
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
index 6add9e3..d92aca1 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -27,11 +28,13 @@ END
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_REPLACE_FUNCS(\
-   foo)
+   foo_bar_quux)
 END
 
-: > foo.c
+: > foo_bar_quux.c
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-$FGREP foo.c Makefile.in
+$ACLOCAL
+$AUTOMAKE
+$FGREP foo_bar_quux.c Makefile.in
+
+:
index 73a8ab0..d18671c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 2000, 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
 
 # Test for multiple replacement functions.
 
+required=cc
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
-AC_REPLACE_FUNCS(basename dirname strsignal)
-AC_OUTPUT(Makefile)
+# `am__dummy_function' is there to ensure that at least one function is
+# replaced, to avoid creating an empty archive which can cause problems
+# with e.g. Solaris ar.
+AC_REPLACE_FUNCS([basename dirname am__dummy_function])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
+check-local: test1 test2 test3
+.PHONY: test1 test2 test3
+test1: all
+       $(AR) tv libtu.a
+test2:
+       @echo DIST_COMMON = $(DIST_COMMON)
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]basename\.c '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]dirname\.c '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]am__dummy_function\.c '
+test3: distdir
+       test -f $(distdir)/basename.c
+       test -f $(distdir)/dirname.c
+       test -f $(distdir)/am__dummy_function.c
 END
 
-: > basename.c
-: > dirname.c
-: > strsignal.c
-
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-
-sed -n -e ': again
-  /^DIST_COMMON.*[^\]$/ p
-  /^DIST_COMMON/ {
-     s/^DIST_COMMON//p
-     n
-     s/^/DIST_COMMON/
-     b again
-  }' < Makefile.in | $FGREP dirname.c
+cat > basename.c <<'END'
+extern int dummy1;
+END
+cat > dirname.c <<'END'
+extern int dummy2;
+END
+cat > am__dummy_function.c <<'END'
+extern int dummy3;
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+
+:
index 1e2b58b..8ad40f1 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2008  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2008, 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
@@ -22,6 +23,7 @@ cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AM_MAINTAINER_MODE
 AC_PROG_CC
+AM_PROG_AR
 END
 
 cat > Makefile.am << 'END'
@@ -30,5 +32,8 @@ lib_LIBRARIES = libfoo.a
 libfoo_a_DEPENDENCIES = libzot.a
 END
 
-$ACLOCAL || Exit 1
+: > ar-lib
+$ACLOCAL
 $AUTOMAKE
+
+:
index 0dbff28..7bd3e62 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
 
 cat > Makefile.am << 'END'
 EXTRA_LIBRARIES = libfoo.a
 END
 
 $ACLOCAL
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-portability
 grep AC_PROG_RANLIB stderr
index 9d30d87..8e3a0c9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_PROG_CC
 AM_CONDITIONAL([A], [:])
index 51a68d4..f0f2e32 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009, 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
 # Make sure .libs directories are removed for _PROGRAMS.
 # Report from Guillermo Ontañón.
 
-required=libtoolize
+required='cc libtoolize'
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
index 850ca82..e7b7354 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -17,9 +17,8 @@
 # Make sure config.lt is removed with Libtool 2.2.x's LT_OUTPUT.
 # Report by Charles Wilson.
 
-required=libtoolize
+required='cc libtoolize'
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
 AC_PROG_LIBTOOL
@@ -35,4 +34,5 @@ $AUTOMAKE --add-missing
 $AUTOCONF
 ./configure
 $MAKE distcheck
+
 :
index 06a35d9..a4ec095 100755 (executable)
@@ -40,7 +40,7 @@ else
   if $ACLOCAL -Wno-syntax -I m4 --install && test -f m4/libtool.m4; then
     : # Libtool macros already accessible by default.
   else
-    echo "skip_ \"couldn't find or get libtool macros\"" >> get.sh
+    echo "skip_all_ \"couldn't find or get libtool macros\"" >> get.sh
   fi
 fi
 
index dd2a939..87b55a7 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -15,7 +15,8 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure libtool is removed.
-# Report from Kevin Dalley
+# Report from Kevin Dalley.
+
 required=libtool
 . ./defs || Exit 1
 
@@ -23,7 +24,7 @@ cat >> configure.in << 'END'
 AC_LIBTOOL_DLOPEN
 AC_DISABLE_SHARED
 AC_PROG_LIBTOOL
-AC_SUBST(LIBTOOL_DEPS)
+AC_SUBST([LIBTOOL_DEPS])
 END
 
 : > Makefile.am
@@ -32,7 +33,9 @@ END
 : > config.guess
 : > config.sub
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep 'rm -f libtool' Makefile.in
+
+:
index a50f6a4..f2fe1af 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
 
 # Make sure libtool clean targets exist.
 # Report from Eric Magnien.
+
 required=libtoolize
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(mypackage,0.1)
-
+cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
-
-AC_CONFIG_FILES([
-  sub/Makefile
-  Makefile
-])
+AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 END
 
@@ -45,8 +40,10 @@ lib_LTLIBRARIES = libfoo.la
 libfoo_la_SOURCES = foo.c
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 : > ltmain.sh
-$AUTOMAKE -a || Exit 1
+$AUTOMAKE -a
 
 grep 'rm -f .*\.lo' sub/Makefile.in
+
+:
index 3427f28..ad0f8c5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2004, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2009, 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
 # Try to build and package a program linked to a Libtool library.
 # Also make sure we do not bloat the Makefile with unneeded rules.
 
-required='libtoolize gcc'
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_OUTPUT
 END
@@ -52,7 +51,7 @@ cat > sub/1.c << 'END'
 int zero ();
 
 int
-main ()
+main (void)
 {
    return zero ();
 }
@@ -87,3 +86,5 @@ $FGREP 'a.lo:' Makefile.in
 
 $MAKE
 $MAKE distcheck
+
+:
index 9f6a730..a694586 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 END
 
 cat > Makefile.am << 'END'
 EXTRA_LTLIBRARIES = liblib.la
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
 grep '[Ll]ibtool library .*LIBTOOL.* undefined' stderr
index c7f0476..23cf062 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 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
 required='libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
index ad01b14..c4ae469 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
 required='libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
index a2f912f..574b285 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2007, 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
 # Make sure we allow Libtool's -dlopen/-dlpreopen
 # Also check basic support for AM_LIBTOOLFLAGS/LIBTOOLFLAGS
 
-required='libtoolize gcc'
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 AC_OUTPUT
@@ -44,6 +43,7 @@ bin_PROGRAMS = prg
 prg_SOURCES = prg.c
 prg_LDADD = -dlopen libmod1.la -dlpreopen mod2.la
 
+.PHONY: print
 print:
        @echo 1BEG: $(prg_DEPENDENCIES) :END1
        @echo 2BEG: $(libmod1_la_DEPENDENCIES) :END2
@@ -53,24 +53,21 @@ END
 mkdir sub liba
 
 cat > sub/mod1.c << 'END'
-int
-mod1 ()
+int mod1 (void)
 {
    return 1;
 }
 END
 
 cat > mod2.c << 'END'
-int
-mod2 ()
+int mod2 (void)
 {
    return 2;
 }
 END
 
 cat > prg.c << 'END'
-int
-main ()
+int main (void)
 {
    return 0;
 }
@@ -82,7 +79,10 @@ $AUTOCONF
 $AUTOMAKE --add-missing --copy
 
 ./configure "--prefix=`pwd`/_inst"
-env LIBTOOLFLAGS=--silent $MAKE print >output 2>&1
+env LIBTOOLFLAGS=--silent $MAKE print >output 2>&1 || {
+  cat output
+  Exit 1
+}
 cat output
 grep '1BEG: libmod1.la mod2.la :END1' output
 grep '2BEG: mod2.la :END2' output
@@ -90,11 +90,19 @@ grep '3BEG: .*silent.*silent.* :END3' output
 test 2 -le `grep mod2_la_LIBTOOLFLAGS Makefile | wc -l`
 $MAKE
 
-env LIBTOOLFLAGS=--silent $MAKE install >output 2>&1
+env LIBTOOLFLAGS=--silent $MAKE install >output 2>&1 || {
+  cat output
+  Exit 1
+}
 cat output
 grep 'silent.*silent.*prg' output
 grep 'silent.*silent.*libmod1' output
 
-env LIBTOOLFLAGS=--silent $MAKE uninstall >output 2>&1
+env LIBTOOLFLAGS=--silent $MAKE uninstall >output 2>&1 || {
+  cat output
+  Exit 1
+}
 cat output
 grep 'silent.*silent.*libmod1' output
+
+:
index a1bb88a..3aefcf8 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
 required='libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
index c0d9688..d21ff55 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005  Free Software Foundation, Inc.
+# Copyright (C) 2005, 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
 
 # Make sure xxx_LINK is defined for each target that requires specific
 # flags.
-# Quite similar to libtool7.test, using AM_LDFLAGS in addition to xxx_LDFLAGS.
+# Quite similar to libtool7.test, using AM_LDFLAGS in addition to
+# xxx_LDFLAGS.
 
-required='libtoolize gcc'
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 AC_OUTPUT
@@ -59,24 +59,21 @@ END
 mkdir liba
 
 cat > mod1.c << 'END'
-int
-mod1 ()
+int mod1 (void)
 {
    return 1;
 }
 END
 
 cat > mod2.c << 'END'
-int
-mod2 ()
+int mod2 (void)
 {
    return 2;
 }
 END
 
 cat > prg.c << 'END'
-int
-main ()
+int main (void)
 {
    return 0;
 }
@@ -90,7 +87,7 @@ $AUTOMAKE --add-missing --copy
 ./configure
 env LDFLAGS=ldflags AM_LDFLAGS=am_ldflags libmod1_la_LDFLAGS=lm1_la_ldflags \
     CFLAGS=cflags AM_CFLAGS=am_cflags prg2_CFLAGS=prg2_cflags \
-    $MAKE -e print >output 2>&1
+    $MAKE -e print >output 2>&1 || { cat output; Exit 1; }
 cat output
 grep '1BEG: libmod1.la mod2.la :END1' output
 grep '2BEG: mod2.la :END2' output
@@ -101,3 +98,5 @@ grep '5BEG: :END5' output
 grep '6BEG:.* prg2_cflags cflags .*am_ldflags ldflags.* :END6' output
 grep '6BEG: .*am_cflags.* :END6' output && Exit 1
 $MAKE
+
+:
index 4a69791..3b39425 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 
 # Make sure COPYING is not overwritten, even with -a -f.
 
-required=makeinfo
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >>configure.in
+
 cat >Makefile.am <<\EOF
 test1: distdir
        grep 'GNU GENERAL PUBLIC LICENSE' $(distdir)/COPYING
@@ -46,7 +44,7 @@ $AUTOMAKE --gnu --add-missing
 ./configure
 $MAKE test1
 
-# rm before echo, because COPYING is likely to be a symlink to
+# Use 'rm' before 'echo', because COPYING is likely to be a symlink to
 # the real COPYING...
 rm -f COPYING
 echo 'MY-OWN-LICENSE' >COPYING
index 75f7811..ca6a249 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = gnu
 END
@@ -34,7 +32,7 @@ $ACLOCAL
 AUTOMAKE_fails
 grep 'COPYING' stderr
 
-AUTOMAKE_run --add-missing
+AUTOMAKE_run --add-missing
 grep 'COPYING' stderr
 grep 'GNU General Public License' stderr
 grep 'Consider adding.*version control' stderr
index d1a093c..fd3cdc3 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
index 661d683..77c3785 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
index 979eb67..7afe52c 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_FC
 END
index c4df8ce..5484f58 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_F77
 END
index 8c80f8c..78a2457 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_F77
index 30263d0..c609955 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
index c75ffc7..75aee34 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXX
 AC_PROG_F77
diff --git a/tests/link_override.test b/tests/link_override.test
new file mode 100755 (executable)
index 0000000..bcce05a
--- /dev/null
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 2009, 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 3 of the License, 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/>.
+
+# Test to make sure _LINK variables are detected and used as documented.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz boo
+foo_LINK = $(LINK)
+bar_LINK = $(LINK)
+bar_LDFLAGS = $(AM_LDFLAGS)
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+
+# We should use foo_LINK not LINK.
+grep '.\$(foo_LINK)' Makefile.in
+grep '.\$(LINK).*foo' Makefile.in && Exit 1
+
+# We should not override the user definition of bar_LINK.
+# IOW, bar_LDFLAGS is useless unless bar_LINK refers to it.
+grep '^ *bar_LINK *=.*bar_LDFLAGS' Makefile.in && Exit 1
+grep '.\$(bar_LINK).*bar' Makefile.in
+
+Exit 0
index 2fccdb2..9ce19f7 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -18,9 +18,8 @@
 
 . ./defs || Exit 1
 
-set -e
 
-echo 1
+: TRY 1 -- We lack both EMACS and lispdir.
 
 cat > Makefile.am << 'END'
 lisp_LISP = foo.el
@@ -29,10 +28,12 @@ END
 $ACLOCAL
 AUTOMAKE_fails
 grep AM_PATH_LISPDIR stderr
+grep '[Ll]isp source.*EMACS.* undefined' stderr
+grep '[Ll]isp source.*lispdir.* undefined' stderr
+grep ' add .*AM_PATH_LISPDIR' stderr
 
 
-echo 2
-# Setting lispdir should not be enough.
+: TRY 2 -- Setting lispdir should not be enough.
 
 cat > Makefile.am << 'END'
 lispdir = /usr/share/emacs/site-lisp
@@ -41,10 +42,12 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep AM_PATH_LISPDIR stderr
+grep 'lispdir.*undefined' stderr && Exit 1
+grep '[Ll]isp source.*EMACS.* undefined' stderr
+grep 'define .*EMACS.* add .*AM_PATH_LISPDIR' stderr
+
 
-echo 3
-# Setting EMACS should not be enough.
+: TRY 3 -- Setting EMACS should not be enough.
 
 cat > Makefile.am << 'END'
 EMACS = emacs
@@ -53,11 +56,12 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep AM_PATH_LISPDIR stderr
+grep 'EMACS.*undefined' stderr && Exit 1
+grep '[Ll]isp source.*lispdir.* undefined' stderr
+grep 'define .*lispdir.* add .*AM_PATH_LISPDIR' stderr
 
 
-echo 4
-# Setting both is OK.
+: TRY 4 -- Setting both EMACS and lispdir is OK.
 
 cat > Makefile.am << 'END'
 lispdir = /usr/share/emacs/site-lisp
@@ -67,3 +71,5 @@ END
 
 $ACLOCAL
 $AUTOMAKE -a
+
+:
index 809d491..aaf17c5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2008, 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
@@ -19,8 +19,6 @@
 required=emacs
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 lisp_LISP = am-one.el am-two.el am-three.el
 EXTRA_DIST = am-one.el am-two.el
@@ -38,11 +36,11 @@ echo "(require 'am-two)" > am-one.el
 echo "(require 'am-three) (provide 'am-two)" > am-two.el
 # am-three.el is a built source
 
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
-./configure
+
+./configure --prefix="`pwd`/_inst"
 
 $MAKE
 
@@ -56,14 +54,41 @@ rm -f am-one.elc
 $MAKE
 test -f am-one.elc
 
+# Test installation/deinstallation.
+
+$MAKE install
+
+find _inst # For debugging.
+
+# Keep thin in sync with m4/lispdir.m4.
+for dir in lib/emacs lib/xemacs share/emacs share/xemacs :; do
+  if test $dir = :; then
+    Exit 1
+  elif test -d _inst/$dir/site-lisp; then
+    break
+  fi
+done
+
+test -f _inst/$dir/site-lisp/am-one.el
+test -f _inst/$dir/site-lisp/am-one.elc
+test -f _inst/$dir/site-lisp/am-two.el
+test -f _inst/$dir/site-lisp/am-two.elc
+test -f _inst/$dir/site-lisp/am-three.el
+test -f _inst/$dir/site-lisp/am-three.elc
+
+$MAKE uninstall
+find _inst | $EGREP '\.elc?$' && Exit 1
+
 # Make sure we build all files when any of them change.
 # (We grep a message to make sure the compilation happens.)
 unique=0a3346e2af8a689b85002b53df09142a
 $sleep
 echo "(message \"$unique\")(provide 'am-three)" > am-three.el
-$MAKE >output 2>&1
+$MAKE >output 2>&1 || { cat output; Exit 1; }
 cat output
 grep $unique output
 
 # It should also work for VPATH-builds.
 $MAKE distcheck
+
+:
index 080ab3b..8f1bfe5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2007, 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
@@ -20,8 +20,6 @@
 required=emacs
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 lisp_LISP = am-one.el am-two.el am-three.el
 EXTRA_DIST = am-one.el am-two.el
@@ -44,13 +42,9 @@ install-test: install
        test ! -f "$(lispdir)/am-two.elc"
        test ! -f "$(lispdir)/am-three.elc"
 
-install-test2: install
-       test ! -f "$(lispdir)/am-one.el"
-       test ! -f "$(lispdir)/am-two.el"
-       test ! -f "$(lispdir)/am-three.el"
-       test ! -f "$(lispdir)/am-one.elc"
-       test ! -f "$(lispdir)/am-two.elc"
-       test ! -f "$(lispdir)/am-three.elc"
+not-installed:
+       find "$(lispdir)" | grep '\.el$$' && exit 1; :
+       find "$(lispdir)" | grep '\.elc$$' && exit 1; :
 EOF
 
 cat >> configure.in << 'EOF'
@@ -71,10 +65,16 @@ $MAKE
 $MAKE test
 $MAKE install-test
 $MAKE uninstall
+$MAKE not-installed
 
 # Fake the absence of emacs.
-# *.el files should not be installed.
+# *.el files should not be installed, but "make install" and
+# "make uninstall" should continue to work.
 ./configure EMACS=no --prefix "`pwd`"
 $MAKE
 $MAKE test
-$MAKE install-test2
+$MAKE install
+$MAKE not-installed
+$MAKE uninstall
+
+:
index e7b29e7..59bd8ec 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2007, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2007, 2009, 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
@@ -20,8 +20,6 @@
 required=emacs
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 lisp_DATA = am-one.el am-two.el am-three.el
 EXTRA_DIST = am-one.el am-two.el
@@ -42,6 +40,10 @@ install-test: install
        test ! -f "$(lispdir)/am-one.elc"
        test ! -f "$(lispdir)/am-two.elc"
        test ! -f "$(lispdir)/am-three.elc"
+
+not-installed:
+       find "$(lispdir)" | grep '\.el$$' && exit 1; :
+       find "$(lispdir)" | grep '\.elc$$' && exit 1; :
 EOF
 
 cat >> configure.in << 'EOF'
@@ -62,10 +64,16 @@ $MAKE
 $MAKE test
 $MAKE install-test
 $MAKE uninstall
+$MAKE not-installed
 
 # Fake the absence of emacs.
-# *.el files SHOULD be installed.
+# *.el files SHOULD be installed by "make install" (and uninstalled
+# by "make uninstall").
 ./configure EMACS=no --prefix "`pwd`"
 $MAKE
 $MAKE test
 $MAKE install-test
+$MAKE uninstall
+$MAKE not-installed
+
+:
index f386534..1af351c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2005, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2007, 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
@@ -19,8 +19,6 @@
 required=emacs
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 dist_lisp_LISP = am-one.el
 if WANT_TWO
@@ -35,7 +33,7 @@ dist-test: distdir
 EOF
 
 cat >> configure.in << 'EOF'
-AM_CONDITIONAL([WANT_TWO], test -n "$want_two")
+AM_CONDITIONAL([WANT_TWO], [test -n "$want_two"])
 AM_PATH_LISPDIR
 AC_OUTPUT
 EOF
@@ -47,6 +45,7 @@ echo "(require 'am-one)" > am-three.el
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
+
 ./configure "--with-lispdir=`pwd`/lisp"
 
 $MAKE
@@ -71,15 +70,15 @@ test ! -f am-two.elc
 test ! -f am-three.elc
 test ! -f elc-stamp
 
-
 ./configure "--with-lispdir=`pwd`/lisp" want_two=1
+
 $MAKE
 test -f am-one.elc
 test -f am-two.elc
 test -f am-three.elc
 test -f elc-stamp
 
-# Let's mutilate the source tree, the check the recover rule.
+# Let's mutilate the source tree, to check the recover rule.
 rm -f am-*.elc
 $MAKE
 test -f am-one.elc
@@ -102,3 +101,5 @@ test ! -f am-one.elc
 test ! -f am-two.elc
 test ! -f am-three.elc
 test ! -f elc-stamp
+
+:
index cf52527..f1d0093 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005  Free Software Foundation, Inc.
+# Copyright (C) 2005, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 dist_lisp_LISP = am-one.el am-two.el am-three.el
 EOF
@@ -39,8 +37,7 @@ $AUTOCONF
 $AUTOMAKE --add-missing
 ./configure
 
-$MAKE >stdout
-
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l`
 
@@ -50,3 +47,5 @@ test ! -f am-three.elc
 test -f elc-stamp
 
 $MAKE distcheck
+
+:
index 8a3edf2..5b8a6ff 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2005, 2008, 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
@@ -19,8 +19,6 @@
 required='GNUmake emacs'
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 dist_lisp_LISP = am-one.el am-two.el am-three.el
 EOF
@@ -53,7 +51,7 @@ test -f elc-stamp
 rm -f am-*.elc
 
 : >stdout
-$MAKE -j >>stdout
+$MAKE -j >>stdout || { cat stdout; Exit 1; }
 
 cat stdout
 test 1 -eq `grep 'Warnings can be ignored' stdout | wc -l`
@@ -61,3 +59,5 @@ test -f am-one.elc
 test -f am-two.elc
 test -f am-three.elc
 test -f elc-stamp
+
+:
index 3bca21a..e786ec3 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2008, 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
@@ -19,8 +19,6 @@
 required='emacs non-root'
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'EOF'
 dist_lisp_LISP = am-one.el am-two.el am-three.el
 EOF
index bc64d61..3bcc4b6 100644 (file)
@@ -2,6 +2,7 @@
 ## testsuite.  This fragment is meant to be included by the Makefile.am,
 ## but also to be executed directly by make when bootstrapping automake.
 
+## Copyright (C) 2011 Free Software Foundation, Inc.
 ## Copyright (C) 2011, 2012 Free Software Foundation, Inc.
 ##
 ## This program is free software; you can redistribute it and/or modify
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 perl_TESTS = \
+pm/Cond2.pl \
+pm/Cond3.pl \
 pm/Condition.pl \
 pm/Condition-t.pl \
+pm/DisjCon2.pl \
+pm/DisjCon3.pl \
 pm/DisjConditions.pl \
 pm/DisjConditions-t.pl \
 pm/Version.pl \
+pm/Version2.pl \
+pm/Version3.pl \
 pm/Wrap.pl
 
 # The order here is mostly alphabetical, with the deliberate exception
@@ -32,9 +39,7 @@ pm/Wrap.pl
 handwritten_TESTS = \
 get-sysconf.test \
 $(perl_TESTS) \
-self-check-env-sanitize.test \
-self-check-report.test \
-aclibobj.test \
+instspc.tap \
 aclocal.test \
 aclocal3.test \
 aclocal4.test \
@@ -56,6 +61,7 @@ acloca19.test \
 acloca20.test \
 acloca21.test \
 acloca22.test \
+acloca23.test \
 aclocal-acdir.test \
 aclocal-install-absdir.test \
 aclocal-print-acdir.test \
@@ -64,15 +70,11 @@ aclocal-path-install.test \
 aclocal-path-install-serial.test \
 aclocal-path-nonexistent.test \
 aclocal-path-precedence.test \
-acoutnoq.test \
-acoutpt.test \
-acoutpt2.test \
-acoutqnl.test \
-acoutbs.test \
-acoutbs2.test \
+ac-output-old.tap \
 acsilent.test \
 acsubst.test \
 acsubst2.test \
+add-missing.tap \
 all.test \
 all2.test \
 alloca.test \
@@ -85,21 +87,24 @@ amhello-binpkg.test \
 amassign.test \
 ammissing.test \
 amopt.test \
+amopts-location.test \
+amopts-variable-expansion.test \
 amsubst.test \
-ansi2knr-deprecation.test \
-ansi.test \
-ansi2.test \
-ansi3.test \
-ansi3b.test \
-ansi4.test \
-ansi5.test \
-ansi6.test \
-ansi7.test \
-ansi8.test \
-ansi9.test \
-ansi10.test \
+ansi2knr-no-more.test \
+ar-lib.test \
+ar-lib2.test \
+ar-lib3.test \
+ar-lib4.test \
+ar-lib5a.test \
+ar-lib5b.test \
+ar-lib6a.test \
+ar-lib6b.test \
+ar-lib7.test \
 ar.test \
 ar2.test \
+ar3.test \
+ar4.test \
+ar5.test \
 asm.test \
 asm2.test \
 asm3.test \
@@ -117,11 +122,22 @@ autohdr2.test \
 autohdr3.test \
 autohdr4.test \
 autohdrdry.test \
-automake.test \
+automake-cmdline.tap \
 auxdir.test \
-auxdir2.test \
-auxdir3.test \
-auxdir4.test \
+auxdir6.test \
+auxdir7.test \
+auxdir8.test \
+auxdir-autodetect.test \
+auxdir-computed.tap \
+auxdir-misplaced.test \
+auxdir-nonexistent.test \
+auxdir-unportable.tap \
+backcompat.test \
+backcompat2.test \
+backcompat3.test \
+backcompat4.test \
+backcompat5.test \
+backcompat6.test \
 backsl.test \
 backsl2.test \
 backsl3.test \
@@ -131,11 +147,15 @@ badopt.test \
 badprog.test \
 block.test \
 bsource.test \
+candist.test \
 canon.test \
 canon2.test \
 canon3.test \
 canon4.test \
 canon5.test \
+canon6.test \
+canon7.test \
+canon8.test \
 canon-name.test \
 ccnoco.test \
 ccnoco2.test \
@@ -148,20 +168,22 @@ check5.test \
 check6.test \
 check7.test \
 check8.test \
-check9.test \
 check10.test \
 check11.test \
 check12.test \
+check-subst.test \
+check-subst-prog.test \
 check-exported-srcdir.test \
+check-fd-redirect.test \
 check-tests-in-builddir.test \
-check-tests_environment.test \
+check-no-test-driver.test \
 check-concurrency-bug9245.test \
-tests-environment-backcompat.test \
 checkall.test \
 clean.test \
 clean2.test \
 colneq.test \
 colneq2.test \
+colneq3.test \
 colon.test \
 colon2.test \
 colon3.test \
@@ -185,8 +207,13 @@ commen11.test \
 comments-in-var-def.test \
 compile.test \
 compile2.test \
+compile3.test \
+compile4.test \
+compile5.test \
+compile6.test \
 compile_f90_c_cxx.test \
 compile_f_c_cxx.test \
+cond-basic.test \
 cond.test \
 cond2.test \
 cond3.test \
@@ -231,13 +258,13 @@ cond42.test \
 cond43.test \
 cond44.test \
 cond45.test \
+cond46.test \
 condd.test \
 condhook.test \
 condhook2.test \
 condinc.test \
 condinc2.test \
 condlib.test \
-condman.test \
 condman2.test \
 condman3.test \
 configure.test \
@@ -260,15 +287,22 @@ confsub.test \
 confvar.test \
 confvar2.test \
 copy.test \
-ctarget1.test \
+cscope.tap \
+cscope2.test \
+cscope3.test \
 cxx.test \
 cxx2.test \
-cxxansi.test \
 cxxcpp.test \
 cxxlibobj.test \
 cxxlink.test \
 cxxnoc.test \
 cxxo.test \
+cygnus-check-without-all.test \
+cygnus-dependency-tracking.test \
+cygnus-imply-foreign.test \
+cygnus-no-dist.test \
+cygnus-no-installinfo.test \
+cygnus-requires-maintainer-mode.test \
 cygwin32.test \
 dash.test \
 defun.test \
@@ -290,39 +324,36 @@ deleted-m4.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
-depcomp3.test \
-depcomp4.test \
-depcomp5.test \
-depcomp6.test \
-depcomp7.test \
 depcomp8a.test \
 depcomp8b.test \
-depcomp9.test \
-depcomp10.test \
 depdist.test \
 depend.test \
-depend2.test \
 depend3.test \
 depend4.test \
 depend5.test \
 depend6.test \
+deprecated-acinit.test \
 destdir.test \
 dirlist.test \
 dirlist2.test \
+dirlist-abspath.test \
 discover.test \
-dist-auxfile.test \
+dist-formats.tap \
+dist-auxdir-many-subdirs.test \
 dist-auxfile-2.test \
+dist-auxfile.test \
 dist-included-parent-dir.test \
 dist-missing-am.test \
 dist-missing-included-m4.test \
 dist-missing-m4.test \
+dist-readonly.test \
+dist-repeated.test \
 distcleancheck.test \
 distcom2.test \
 distcom3.test \
 distcom4.test \
 distcom5.test \
-distcom6.test \
-distcom7.test \
+distcom-subdir.test \
 distdir.test \
 distlinks.test \
 distlinksbrk.test \
@@ -334,9 +365,9 @@ distcheck-hook.test \
 distcheck-hook2.test \
 distcheck-missing-m4.test \
 distcheck-outdated-m4.test \
+distcheck-override-infodir.test \
 distcheck-pr9579.test \
 distcheck-pr10470.test \
-distcheck-override-infodir.test \
 dmalloc.test \
 doc-parsing-buglets-colneq-subst.test \
 doc-parsing-buglets-tabs.test \
@@ -360,6 +391,7 @@ exeext4.test \
 exsource.test \
 ext.test \
 ext2.test \
+ext3.test \
 extra.test \
 extra2.test \
 extra3.test \
@@ -368,9 +400,14 @@ extra5.test \
 extra6.test \
 extra7.test \
 extra8.test \
+extra9.test \
 extra10.test \
 extra11.test \
 extra12.test \
+extra-programs-empty.test \
+extra-portability.test \
+extra-portability2.test \
+extra-portability3.test \
 extradep.test \
 extradep2.test \
 f90only.test \
@@ -416,11 +453,9 @@ help-init.test \
 help-lispdir.test \
 help-multilib.test \
 help-python.test \
-help-regex.test \
 help-silent.test \
 help-upc.test \
 hfs.test \
-hosts.test \
 implicit.test \
 info.test \
 init.test \
@@ -428,7 +463,6 @@ init2.test \
 insh2.test \
 install2.test \
 installdir.test \
-install-info-dir.test \
 instsh.test \
 instsh2.test \
 instsh3.test \
@@ -453,45 +487,75 @@ instman2.test \
 instmany.test \
 instmany-mans.test \
 instmany-python.test \
-instspc.test \
+install-info-dir.test \
 interp.test \
 interp2.test \
 java.test \
 java2.test \
 java3.test \
+javadir-undefined.test \
+javaflags.test \
 java-check.test \
+java-clean.test \
+java-compile-install.test \
+java-compile-run-flat.test \
+java-compile-run-nested.test \
 java-empty-classpath.test \
-javadir-undefined.test \
 javaprim.test \
 javasubst.test \
-java-clean.test \
+java-extra.test \
+java-mix.test \
+java-no-duplicate.test \
 java-nobase.test \
-java-compile-install.test \
+java-noinst.test \
+java-rebuild.test \
 java-sources.test \
-java-no-duplicate.test \
-java-mix.test \
+java-uninstall.test \
 ldadd.test \
 ldflags.test \
 lex.test \
 lex2.test \
 lex3.test \
-lex4.test \
 lex5.test \
+lexcpp.test \
+lexvpath.test \
 lex-subobj-nodep.test \
+lex-lib.test \
+lex-lib-external.test \
+lex-libobj.test \
+lex-noyywrap.test \
+lex-clean-cxx.test \
+lex-clean.test \
+lex-depend-cxx.test \
+lex-depend-grep.test \
+lex-depend.test \
+lex-line.test \
+lex-nodist.test \
+lex-pr204.test \
 lflags.test \
 lflags2.test \
 libexec.test \
+libobj-basic.test \
 libobj2.test \
 libobj3.test \
 libobj4.test \
 libobj5.test \
 libobj7.test \
-libobj8.test \
 libobj10.test \
-libobj11.test \
 libobj12.test \
 libobj13.test \
 libobj14.test \
+libobj15a.test \
+libobj15b.test \
+libobj15c.test \
+libobj16a.test \
+libobj16b.test \
+libobj17.test \
+libobj18.test \
+libobj19.test \
+libobj20a.test \
+libobj20b.test \
+libobj20c.test \
 library.test \
 library2.test \
 library3.test \
@@ -515,6 +579,7 @@ link_fc.test \
 link_fccxx.test \
 link_fcxx.test \
 link_f_only.test \
+link_override.test \
 lisp2.test \
 lisp3.test \
 lisp4.test \
@@ -536,7 +601,6 @@ ltinstloc.test \
 ltlibobjs.test \
 ltlibsrc.test \
 ltorder.test \
-lzip.test \
 lzma.test \
 m4-inclusion.test \
 maintclean.test \
@@ -555,6 +619,9 @@ man2.test \
 man3.test \
 man4.test \
 man5.test \
+man6.test \
+man7.test \
+man8.test \
 mdate.test \
 mdate2.test \
 mdate3.test \
@@ -567,12 +634,15 @@ missing3.test \
 missing4.test \
 missing5.test \
 missing6.test \
+missing-auxfile-stops-makefiles-creation.test \
 mkinstall.test \
 mkinst2.test \
 mkinst3.test \
 mmode.test \
 mmodely.test \
 multlib.test \
+no-extra-makefile-code.test \
+no-outdir-option.test \
 nobase.test \
 nobase-libtool.test \
 nobase-python.test \
@@ -585,8 +655,6 @@ nodepcomp.test \
 nodist.test \
 nodist2.test \
 nodist3.test \
-nogzip.test \
-nogzip2.test \
 noinst.test \
 noinstdir.test \
 nolink.test \
@@ -597,8 +665,8 @@ objc.test \
 objc2.test \
 objext-pr10128.test \
 obsolete.test \
+oldvars.test \
 order.test \
-outdir.test \
 output.test \
 output2.test \
 output3.test \
@@ -613,28 +681,82 @@ output11.test \
 output12.test \
 output13.test \
 output-order.test \
-overrid.test \
+override-conditional-1.test \
+override-conditional-2.test \
+override-html.test \
+override-suggest-local.test \
 parallel-am.test \
 parallel-am2.test \
 parallel-am3.test \
 parallel-tests.test \
 parallel-tests2.test \
 parallel-tests3.test \
-parallel-tests4.test \
 parallel-tests5.test \
 parallel-tests6.test \
-parallel-tests7.test \
 parallel-tests8.test \
 parallel-tests9.test \
 parallel-tests10.test \
-parallel-tests-dryrun.test \
-parallel-tests-harderror.test \
-parallel-tests-unreadable-log.test \
+parallel-tests-exeext.test \
+parallel-tests-suffix.test \
+parallel-tests-suffix-prog.test \
+parallel-tests-log-compiler-1.test \
+parallel-tests-log-compiler-2.test \
+parallel-tests-dry-run-1.test \
+parallel-tests-dry-run-2.test \
+parallel-tests-fd-redirect.test \
+parallel-tests-fd-redirect-exeext.test \
+parallel-tests-extra-programs.test \
+parallel-tests-unreadable.test \
 parallel-tests-subdir.test \
+parallel-tests-interrupt.tap \
+parallel-tests-reset-term.test \
+parallel-tests-harderror.test \
 parallel-tests-log-override-1.test \
 parallel-tests-log-override-2.test \
 parallel-tests-log-override-recheck.test \
 parallel-tests-log-compiler-example.test \
+parallel-tests-cmdline-override.test \
+parallel-tests-fork-bomb.test \
+parallel-tests-empty-testlogs.test \
+parallel-tests-driver-install.test \
+parallel-tests-no-color-in-log.test \
+parallel-tests-no-spurious-summary.test \
+parallel-tests-exit-statuses.test \
+parallel-tests-console-output.test \
+parallel-tests-once.test \
+parallel-tests-trailing-bslash.test \
+tests-environment.test \
+am-tests-environment.test \
+tests-environment-backcompat.test \
+testsuite-summary-color.test \
+testsuite-summary-count.test \
+testsuite-summary-count-many.test \
+testsuite-summary-reference-log.test \
+test-driver-acsubst.test \
+test-driver-cond.test \
+test-driver-custom-no-extra-driver.test \
+test-driver-custom.test \
+test-driver-custom-xfail-tests.test \
+test-driver-custom-multitest.test \
+test-driver-custom-multitest-recheck.test \
+test-driver-custom-multitest-recheck2.test \
+test-driver-create-log-dir.test \
+test-driver-strip-vpath.test \
+test-driver-trs-suffix-registered.test \
+test-driver-fail.test \
+test-driver-is-distributed.test \
+test-harness-vpath-rewrite.test \
+test-log.test \
+test-logs-repeated.test \
+test-metadata-global-log.test \
+test-metadata-global-result.test \
+test-metadata-recheck.test \
+test-metadata-results.test \
+test-missing.test \
+test-missing2.test \
+test-trs-basic.test \
+test-trs-recover.test \
+test-trs-recover2.test \
 test-extensions.test \
 test-extensions-cond.test \
 parse.test \
@@ -652,13 +774,21 @@ pluseq8.test \
 pluseq9.test \
 pluseq10.test \
 pluseq11.test \
+posixsubst-data.test \
+posixsubst-extradist.test \
+posixsubst-ldadd.test \
+posixsubst-libraries.test \
+posixsubst-ltlibraries.test \
+posixsubst-programs.test \
+posixsubst-scripts.test \
+posixsubst-sources.test \
+posixsubst-tests.test \
 postproc.test \
 ppf77.test \
 pr2.test \
 pr9.test \
 pr72.test \
 pr87.test \
-pr204.test \
 pr211.test \
 pr220.test \
 pr224.test \
@@ -679,11 +809,12 @@ prefix.test \
 primary.test \
 primary2.test \
 primary3.test \
-primary-prefix-invalid-couples.test \
+primary-prefix-invalid-couples.tap \
 primary-prefix-valid-couples.test \
 primary-prefix-couples-force-valid.test \
 primary-prefix-couples-documented-valid.test \
 proginst.test \
+programs-primary-rewritten.test \
 py-compile-basic.test \
 py-compile-basic2.test \
 py-compile-basedir.test \
@@ -696,6 +827,7 @@ python2.test \
 python3.test \
 python4.test \
 python5.test \
+python5b.test \
 python6.test \
 python7.test \
 python8.test \
@@ -703,33 +835,74 @@ python9.test \
 python10.test \
 python11.test \
 python12.test \
+python-dist.test \
+python-vars.test \
+python-virtualenv.test \
 recurs.test \
 recurs2.test \
 remake.test \
+remake1a.test \
 remake2.test \
 remake3.test \
+remake3a.test \
 remake4.test \
 remake5.test \
 remake6.test \
 remake7.test \
+remake8a.test \
+remake8b.test \
+remake9a.test \
+remake9b.test \
+remake9c.test \
+remake9d.test \
+remake10a.test \
+remake10b.test \
+remake10c.test \
+remake11.test \
+remake12.test \
+remake-all-1.test \
+remake-all-2.test \
 remake-subdir-from-subdir.test \
 remake-subdir-gnu.test \
 remake-subdir.test \
 remake-subdir2.test \
 remake-subdir-long-time.test \
+remake-gnulib-add-acsubst.test \
+remake-gnulib-add-header.test \
+remake-gnulib-remove-header.test \
+remake-moved-m4-file.test \
+remake-deleted-m4-file.test \
+remake-renamed-m4-file.test \
+remake-renamed-m4-macro-and-file.test \
+remake-renamed-m4-macro.test \
 remake-am-pr10111.test \
 remake-m4-pr10111.test \
-remake-deleted-am.test \
 remake-deleted-am-2.test \
 remake-deleted-am-subdir.test \
+remake-deleted-am.test \
 remake-renamed-am.test \
 pr8365-remake-timing.test \
-regex.test \
-regex-obsolete.test \
 req.test \
 reqd.test \
 reqd2.test \
+repeated-options.test \
+rst-formatting.test \
 rulepat.test \
+self-check-cleanup.tap \
+self-check-configure-help.test \
+self-check-dir.tap \
+self-check-env-sanitize.tap \
+self-check-exit.tap \
+self-check-explicit-skips.test \
+self-check-is_newest.tap \
+self-check-me.tap \
+self-check-reexec.tap \
+self-check-report.test \
+self-check-sanity.test \
+self-check-seq.tap \
+self-check-is-blocked-signal.tap \
+self-check-tap.test \
+self-check-unindent.tap \
 sanity.test \
 scripts.test \
 seenc.test \
@@ -739,18 +912,20 @@ silent3.test \
 silent4.test \
 silent6.test \
 silent7.test \
+silent8.test \
 silent9.test \
 silentcxx.test \
+silentcxx-gcc.test \
 silentf77.test \
 silentf90.test \
 silent-many-gcc.test \
 silent-many-generic.test \
-silent-lex-gcc.test \
-silent-lex-generic.test \
-silent-nested-vars.test \
-silent-yacc-gcc.test \
-silent-yacc-generic.test \
+silent-nowarn.test \
 silent-configsite.test \
+silent-nested-vars.test \
+silent-lex.test \
+silent-yacc.test \
+silent-yacc-headers.test \
 srcsub.test \
 srcsub2.test \
 space.test \
@@ -772,6 +947,8 @@ stdinc.test \
 stamph2.test \
 stdlib.test \
 stdlib2.test \
+strictness-override.test \
+strictness-precedence.test \
 strip.test \
 strip2.test \
 strip3.test \
@@ -791,7 +968,6 @@ subcond2.test \
 subcond3.test \
 subobj.test \
 subobj2.test \
-subobj3.test \
 subobj4.test \
 subobj5.test \
 subobj6.test \
@@ -809,29 +985,116 @@ subpkg3.test \
 subpkg4.test \
 subpkg-yacc.test \
 subst.test \
-subst2.test \
 subst3.test \
 subst4.test \
+subst5.test \
+subst-no-trailing-empty-line.test \
 substref.test \
 substre2.test \
 substtarg.test \
 suffix.test \
 suffix2.test \
-suffix3.test \
+suffix3.tap \
 suffix4.test \
 suffix5.test \
 suffix6.test \
+suffix6b.test \
+suffix6c.test \
 suffix7.test \
-suffix8.test \
+suffix8.tap \
 suffix9.test \
-suffix10.test \
-suffix11.test \
+suffix10.tap \
+suffix11.tap \
 suffix12.test \
 suffix13.test \
+suffix-chain.tap \
 symlink.test \
 symlink2.test \
 syntax.test \
+tap-ambiguous-directive.test \
+tap-autonumber.test \
+tap-bailout.test \
+tap-bailout-leading-space.test \
+tap-bailout-and-logging.test \
+tap-bailout-suppress-badexit.test \
+tap-bailout-suppress-later-diagnostic.test \
+tap-bailout-suppress-later-errors.test \
+tap-color.test \
+tap-deps.test \
+tap-diagnostic.test \
+tap-empty-diagnostic.test \
+tap-empty.test \
+tap-escape-directive.test \
+tap-escape-directive-2.test \
+tap-exit.test \
+tap-signal.tap \
+tap-fancy.test \
+tap-fancy2.test \
+tap-global-log.test \
+tap-global-result.test \
+tap-log.test \
+tap-msg0-result.test \
+tap-msg0-directive.test \
+tap-msg0-planskip.test \
+tap-msg0-bailout.test \
+tap-msg0-misc.test \
+tap-merge-stdout-stderr.test \
+tap-no-merge-stdout-stderr.test \
+tap-no-disable-hard-error.test \
+tap-no-spurious-summary.test \
+tap-no-spurious-numbers.test \
+tap-no-spurious.test \
+tap-not-ok-skip.test \
+tap-number-wordboundary.test \
+tap-numeric-description.test \
+tap-negative-numbers.test \
+tap-numbers-leading-zero.test \
+tap-out-of-order.test \
+tap-passthrough.test \
+tap-passthrough-exit.test \
+tap-plan.test \
+tap-plan-corner.test \
+tap-plan-errors.test \
+tap-plan-middle.test \
+tap-plan-whitespace.test \
+tap-plan-leading-zero.test \
+tap-plan-malformed.test \
+tap-missing-plan-and-bad-exit.test \
+tap-planskip.test \
+tap-planskip-late.test \
+tap-planskip-and-logging.test \
+tap-planskip-unplanned.test \
+tap-planskip-unplanned-corner.test \
+tap-planskip-case-insensitive.test \
+tap-planskip-whitespace.test \
+tap-planskip-badexit.test \
+tap-planskip-bailout.test \
+tap-planskip-later-errors.test \
+tap-realtime.test \
+tap-test-number-0.test \
+tap-recheck-logs.test \
+tap-result-comment.test \
+tap-todo-skip-together.test \
+tap-todo-skip-whitespace.test \
+tap-todo-skip.test \
+tap-unplanned.test \
+tap-whitespace-normalization.test \
+tap-with-and-without-number.test \
+tap-xfail-tests.test \
+tap-common-setup.test \
+tap-bad-prog.tap \
+tap-basic.test \
+tap-diagnostic-custom.test \
+tap-driver-stderr.test \
+tap-doc.test \
+tap-doc2.test \
+tap-more.test \
+tap-more2.test \
+tap-recheck.test \
+tap-summary.test \
+tap-summary-color.test \
 tags.test \
+tags2.test \
 tagsub.test \
 tar.test \
 tar2.test \
@@ -839,6 +1102,8 @@ tar3.test \
 tar-override.test \
 target-cflags.test \
 targetclash.test \
+tests-environment-fd-redirect.test \
+tests-environment-and-log-compiler.test \
 txinfo.test \
 txinfo2.test \
 txinfo3.test \
@@ -869,10 +1134,11 @@ txinfo30.test \
 txinfo31.test \
 txinfo32.test \
 txinfo33.test \
+txinfo-unrecognized-extension.test \
 transform.test \
 transform2.test \
-uninstall-pr9578.test \
 uninstall-fail.test \
+uninstall-pr9578.test \
 unused.test \
 upc.test \
 upc2.test \
@@ -888,6 +1154,8 @@ vala-mix.test \
 vars.test \
 vars3.test \
 vartar.test \
+vartypos.test \
+vartypo2.test \
 version.test \
 version2.test \
 version3.test \
@@ -900,26 +1168,59 @@ vtexi.test \
 vtexi2.test \
 vtexi3.test \
 vtexi4.test \
+warnings-override.test \
+warnings-precedence.test \
+warnings-strictness-interactions.test \
+warnings-unknown.test \
 warnopts.test \
+warnings-win-over-strictness.test \
+warning-groups-win-over-strictness.test \
 werror.test \
 werror2.test \
 werror3.test \
+werror4.test \
 whoami.test \
 xsource.test \
-xz.test \
 yacc.test \
 yacc2.test \
-yacc3.test \
 yacc4.test \
 yacc5.test \
-yacc6.test \
 yacc7.test \
 yacc8.test \
 yaccdry.test \
 yaccpp.test \
 yaccvpath.test \
+yacc-auxdir.test \
+yacc-basic.test \
+yacc-cxx.test \
+yacc-bison-skeleton-cxx.test \
+yacc-bison-skeleton.test \
+yacc-clean.test \
+yacc-clean-cxx.test \
+yacc-d-basic.test \
+yacc-d-cxx.test \
+yacc-d-vpath.test \
+yacc-deleted-headers.test \
+yacc-depend.test \
+yacc-depend2.test \
 yacc-dist-nobuild-subdir.test \
+yacc-dist-nobuild.test \
+yacc-line.test \
+yacc-mix-c-cxx.test \
+yacc-nodist.test \
+yacc-pr204.test \
+yacc-weirdnames.test \
 yflags.test \
 yflags2.test \
+yflags-cmdline-override.test \
+yflags-conditional.test \
+yflags-d-false-positives.test \
+yflags-force-conditional.test \
+yflags-force-override.test \
+yflags-var-expand.test \
 libtool-macros.test \
 gettext-macros.test
+
+print-list-of-tests:
+       @echo $(handwritten_TESTS)
+.PHONY: print-list-of-tests
index 5ff75db..6bd933d 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
 
 # Test to make sure variable is expanded properly.
 # From Adam J. Richter.
+
 required=libtool
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_SUBST(LTLIBOBJS)
+AC_SUBST([LTLIBOBJS])
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
@@ -34,8 +37,11 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
index 13a2183..eee4797 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [true])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -44,30 +43,55 @@ VAR = 1 \
       3
 END
 
-$ACLOCAL
-AUTOMAKE_fails
+: > ar-lib
 
 # Smash the useless difference of lib file locations.
-sed 's,^.*lib/am/\([a-z]*\.am\),\1,' stderr >observed
+smash_useless_diffs ()
+{
+  # FIXME: we could get rid of the second 's|||' once we improve our
+  # wrapper scripts ...
+  sed -e "s|^$am_amdir/\\([a-z]*\.am\\)|\\1|" \
+      -e "s|^automake-$APIVERSION:|automake:|" ${1+"$@"};
+}
+
+$ACLOCAL
+AUTOMAKE_fails -Wno-error
+
+smash_useless_diffs stderr >observed
+
 cat >expected <<\EOF
-Makefile.am:12: VAR multiply defined in condition TRUE ...
+Makefile.am:12: warning: VAR multiply defined in condition TRUE ...
 Makefile.am:8: ... `VAR' previously defined here
-automake: libfoo_a_OBJECTS should not be defined
+automake: error: libfoo_a_OBJECTS should not be defined
 Makefile.am:3:   while processing library `libfoo.a'
-automake: use `libfoo_a_LDADD', not `libfoo_a_LIBADD'
+automake: error: use `libfoo_a_LDADD', not `libfoo_a_LIBADD'
 Makefile.am:3:   while processing library `libfoo.a'
-library.am: deprecated feature: target `libfoo.a' overrides `libfoo.a$(EXEEXT)'
+library.am: warning: deprecated feature: target `libfoo.a' overrides `libfoo.a$(EXEEXT)'
 library.am: change your target to read `libfoo.a$(EXEEXT)'
 Makefile.am:3:   while processing library `libfoo.a'
 program.am: target `libfoo.a$(EXEEXT)' was defined here
 Makefile.am:1:   while processing program `libfoo.a'
-program.am: redefinition of `libfoo.a$(EXEEXT)'...
+program.am: warning: redefinition of `libfoo.a$(EXEEXT)' ...
 Makefile.am:1:   while processing program `libfoo.a'
 library.am: ... `libfoo.a' previously defined here
 Makefile.am:3:   while processing library `libfoo.a'
-tags.am: redefinition of `ctags'...
+tags.am: warning: redefinition of `ctags' ...
 program.am: ... `ctags$(EXEEXT)' previously defined here
 Makefile.am:6:   while processing program `ctags'
 EOF
 
+cat expected
+cat observed
 diff expected observed || Exit 1
+
+AUTOMAKE_fails -Werror
+smash_useless_diffs stderr >observed
+(echo 'automake: warnings are treated as errors' && cat expected) > t
+mv -f t expected
+
+cat expected
+cat observed
+
+diff expected observed || Exit 1
+
+:
index 2d81afa..1d30b28 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 n=1
 files=
 match=
index aefd9a8..77f6e1e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 (echo DUMMY = some_long_filename_1;
 for i in 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20;
 do
index 0350a3d..6af0ee1 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2003, 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2007, 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
 # Test for conditional libtool libraries.
 # This combines two examples from the manual.
 
-required='libtoolize gcc'
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AM_CONDITIONAL([WANT_LIBFOO], [true])
 AM_CONDITIONAL([WANT_LIBBAR], [false])
 AC_SUBST([WANTEDLIBS], ['lib1foo.la lib1bar.la'])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
@@ -102,3 +101,5 @@ test ! -f lib1foo.la
 test ! -f lib1bar.la
 test ! -f lib2foo.la
 test ! -f lib3foo.la
+
+:
index 1687513..4f28cc6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 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
 
 # Test for bug in conditionals.
 
-required='libtoolize gcc'
+required='cc native libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_SUBST([HELLO_SYSTEM], [hello-generic.lo])
-AM_CONDITIONAL([LINUX], true)
+AM_CONDITIONAL([LINUX], [true])
 AC_OUTPUT
 END
 
@@ -56,17 +55,36 @@ check-local:
        : > check-ok
 END
 
-echo 'char* str() { return "hello-linux"; }' >hello-linux.c
-echo 'char* str() { return "hello-generic"; }' >hello-generic.c
-cat >hello-common.c <<'END'
+cat > hello-linux.c <<'END'
+const char* str (void)
+{
+  return "hello-linux";
+}
+END
+
+cat > hello-generic.c <<'END'
+const char* str (void)
+{
+  return "hello-generic";
+}
+END
+
+cat > hello-common.c <<'END'
 #include <stdio.h>
-char* str();
-void print()
+const char* str (void);
+void print (void)
 {
   puts (str ());
 }
 END
-echo 'int main() { print(); return 0; }' >main.c
+
+cat > main.c <<'END'
+int main (void)
+{
+  print();
+  return 0;
+}
+END
 
 libtoolize
 $ACLOCAL
@@ -75,3 +93,5 @@ $AUTOMAKE --add-missing
 ./configure
 $MAKE check
 test -f check-ok
+
+:
index 0ec2132..00c8cd7 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2003, 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2007, 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
 # Test for libtool convenience libraries.
 # This example is taken from the manual.
 
-required='libtoolize gcc'
+required='cc native libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
-AC_CONFIG_FILES(sub1/Makefile
-               sub2/Makefile
-               sub2/sub21/Makefile
-               sub2/sub22/Makefile)
+AC_CONFIG_FILES([sub1/Makefile
+                 sub2/Makefile
+                 sub2/sub21/Makefile
+                 sub2/sub22/Makefile])
 AC_OUTPUT
 END
 
@@ -90,7 +89,7 @@ END
 
 echo 'int sub22 () { return 22; }' > sub2/sub22/sub22.c
 
-cat >test.c <<EOF
+cat >test.c <<'EOF'
 #include <stdio.h>
 int main ()
 {
@@ -153,3 +152,5 @@ find lib -type f -print > lib.lst
 test 0 = `wc -l < lib.lst`
 find bin -type f -print > bin.lst
 test 0 = `wc -l < bin.lst`
+
+:
index 43d0ae3..8f47402 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,9 +19,8 @@
 required=libtool
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_PROG_CXX
 AM_CONDITIONAL(HACKING_COMPACT_BUILD, whatever)
@@ -51,6 +50,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
index 85705e0..64bc679 100755 (executable)
 # interface (with LT_INIT etc.) is used (this interface has been
 # present since libtool 1.9b, circa 2004).
 
-required='libtoolize'
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 dnl Older libtool versions don't define LT_PREREQ :-(
 m4_ifdef([LT_PREREQ],
     [LT_PREREQ([2.0])],
@@ -47,7 +46,11 @@ END
 libtoolize
 # Skip if older libtool (pre-2.0) is used.
 { $ACLOCAL && $AUTOCONF; } || {
-  if test $? -eq 63; then Exit 77; else Exit 1; fi
+  if test $? -eq 63; then
+    skip_ "libtool is too old (probably < 2.0)"
+  else
+    Exit 1
+  fi
 }
 $EGREP 'LT_(INIT|PREREQ)' configure && Exit 1 # Sanity check.
 $AUTOMAKE -a
index bb3203a..dd8f63c 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
-# Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2010, 2011, 2012 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
 required='libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AM_CONDITIONAL([COND], [:])
 AC_OUTPUT
@@ -46,16 +46,16 @@ AUTOMAKE_fails --add-missing
 # libtoolize might have installed config.guess and config.sub already,
 # and autom4te might warn about bugs in Libtool macro files, so filter
 # out warnings about Makefile.am only.  We don't care in this test
-# whether automake installs config.guess and config.sub.
+# whether automake installs config.guess, config.sub and ar-lib.
 
 cat >expected <<'END'
-Makefile.am:5: sub/liba2.la multiply defined in condition COND
+Makefile.am:5: error: sub/liba2.la multiply defined in condition COND
 Makefile.am:5: `sub/liba2.la' should be installed below `lib' in condition COND ...
 Makefile.am:2: ... and should also be installed in `lib' in condition COND.
-Makefile.am:4: liba1.la multiply defined in condition COND
+Makefile.am:4: error: liba1.la multiply defined in condition COND
 Makefile.am:4: `liba1.la' should be installed in `pkglib' in condition COND ...
 Makefile.am:2: ... and should also be installed in `lib' in condition COND.
-Makefile.am:2: Libtool libraries can be built for only one destination.
+Makefile.am:2: Libtool libraries can be built for only one destination
 END
 
 grep '^Makefile.am' stderr | diff - expected
@@ -65,4 +65,5 @@ mv -f t Makefile.am
 
 $AUTOMAKE
 grep ' -rpath \$(libdir)/sub' Makefile.in
+
 :
index fd66473..e430cdd 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -20,7 +21,8 @@ required=libtool
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_SUBST(LTLIBOBJS)
+AC_SUBST([LTLIBOBJS])
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
@@ -32,8 +34,11 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
index 2c9911d..aea10d8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 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
 
 # Test to make sure a sensible default source for libraries is used.
 
-required='libtool gcc'
+required='cc libtool'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
@@ -39,7 +38,10 @@ $(srcdir)/zoo_d_old2_la.c: $(srcdir)/old_la.c
 END
 
 cat > foo.c << 'END'
-int foo (void) { return 0; }
+int foo (void)
+{
+  return 0;
+}
 END
 
 cp foo.c zoo.d/bar.c
@@ -49,10 +51,10 @@ libtoolize
 $ACLOCAL
 $AUTOCONF
 AUTOMAKE_fails -a
-grep 'Makefile.am:2:.*old_la.c' stderr
-grep 'Makefile.am:2:.*old.c' stderr
-grep 'Makefile.am:3:.*zoo_d_old2_la.c' stderr
-grep 'Makefile.am:3:.*zoo\.d/old2.c' stderr
+grep '^Makefile\.am:2:.*old_la\.c' stderr
+grep '^Makefile\.am:2:.*old\.c' stderr
+grep '^Makefile\.am:3:.*zoo_d_old2_la\.c' stderr
+grep '^Makefile\.am:3:.*zoo\.d/old2\.c' stderr
 
 $AUTOMAKE -Wno-obsolete
 
@@ -68,3 +70,5 @@ test -f old.la
 test -f zoo.d/old2.la
 
 $MAKE distcheck
+
+:
index 0f69211..594a2f4 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
 
 # Test for correct installation order of nobase libtool libraries.
 
-required='libtoolize'
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
@@ -59,4 +58,5 @@ grep 'has not been installed' stderr && Exit 1
 
 $MAKE uninstall
 test `find inst -type f -print | wc -l` -eq 0
+
 :
index bf65aea..f0c284b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2007, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2007, 2011, 2012 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
 # 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 support for no-dist-gzip with lzma
+# Check support for no-dist-gzip with lzma.
 
 . ./defs || Exit 1
 
-errmsg='lzma.*deprecated.*dist-xz.*dist-lzip.*instead'
-
-set -e
+errmsg='support for lzma.*removed'
 
 echo AUTOMAKE_OPTIONS = dist-lzma > Makefile.am
 $ACLOCAL --force
-AUTOMAKE_fails -Wnone -Wobsolete
+AUTOMAKE_fails -Wnone -Wno-error
 grep "^Makefile\\.am:1:.*$errmsg" stderr
 
 cat > configure.in << 'END'
@@ -33,24 +31,11 @@ AM_INIT_AUTOMAKE([no-dist-gzip dist-lzma])
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 END
-
-cat > Makefile.am << 'END'
-test: distcheck
-       test $(DIST_ARCHIVES) = lzma-1.0.tar.lzma
-       test -f $(DIST_ARCHIVES)
-END
+: > Makefile.am
 
 rm -rf autom4te*.cache
 $ACLOCAL
-AUTOMAKE_fails
+AUTOMAKE_fails -Wnone -Wno-error
 grep "^configure\\.in:2:.*$errmsg" stderr
 
-$AUTOMAKE -Wno-obsolete
-
-lzma --version || skip_ "lzma compressor required for the rest of the test"
-
-$AUTOCONF
-./configure
-$MAKE test
-
 :
index 025d44f..c9106ae 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 2005, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 sinclude([doesntexist.m4])
 EOF
 
 mkdir sub
+
 cat > sub/p.m4 << 'END'
-AC_SUBST(MAGICALPIG)
+AC_SUBST([MAGICALPIG])
 END
 
 cat > sub/h.m4 << 'END'
-AC_SUBST(MAGICALHOG)
+AC_SUBST([MAGICALHOG])
 END
 
 cat > sub/g.m4 << 'END'
-AC_SUBST(GREPME)
+AC_SUBST([GREPME])
 END
 
 : > Makefile.am
 
-echo 'sinclude(sub/g.m4)' >> acinclude.m4
-echo 'm4_sinclude(sub/doesntexist.m4)' >> acinclude.m4
+echo 'sinclude([sub/g.m4])' >> acinclude.m4
+echo 'm4_sinclude([sub/doesntexist.m4])' >> acinclude.m4
 
 $ACLOCAL
 
-echo 'm4_sinclude(sub/p.m4)' >> aclocal.m4
-echo 'm4_include(sub/h.m4)' >> aclocal.m4
+echo 'm4_sinclude([sub/p.m4])' >> aclocal.m4
+echo 'm4_include([sub/h.m4])' >> aclocal.m4
 
 $AUTOMAKE
 
@@ -53,3 +53,5 @@ grep doesntexist Makefile.in && Exit 1
 grep MAGICALPIG Makefile.in
 grep MAGICALHOG Makefile.in
 grep GREPME Makefile.in
+
+:
index 4b93ab1..5b5420c 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([bar sub/Makefile])
 AC_OUTPUT
index 9e22463..aeda04c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -20,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([bar sub/Makefile])
 AC_OUTPUT
index 5771392..f330bd0 100755 (executable)
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 set_maintmode ()
 {
   rm -rf autom4te*.cache # Just to be sure not to use a stale cache.
@@ -49,9 +47,7 @@ $ACLOCAL
 
 $AUTOCONF --force
 
-./configure --help >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^  *--enable-maintainer-mode.* enable make rules' stdout
+grep_configure_help --enable-maintainer-mode 'enable make rules'
 
 check_configure_message_with "no"
 check_configure_message_with "yes" --enable-maintainer-mode
@@ -59,9 +55,7 @@ check_configure_message_with "yes" --enable-maintainer-mode
 set_maintmode "disable"
 
 $AUTOCONF --force
-./configure --help >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^  *--enable-maintainer-mode.* enable make rules' stdout
+grep_configure_help --enable-maintainer-mode 'enable make rules'
 
 check_configure_message_with "no"
 check_configure_message_with "yes" --enable-maintainer-mode
@@ -71,7 +65,7 @@ set_maintmode "enable"
 $AUTOCONF --force
 ./configure --help >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep '^  *--disable-maintainer-mode.* disable make rules' stdout
+grep_configure_help --disable-maintainer-mode 'disable make rules'
 
 check_configure_message_with "yes"
 check_configure_message_with "no" --disable-maintainer-mode
index 072d02f..0202dc9 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 echo AC_OUTPUT >> configure.in
index 1e3184d..eb4656a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
 required=GNUmake
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT(Makefile.am)
-AM_INIT_AUTOMAKE(foo,0,no)
+cat >> configure.in << 'END'
 AM_MAKE_INCLUDE
-AC_OUTPUT(Makefile)
+AC_OUTPUT
 END
 
 : > Makefile.am
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
@@ -45,14 +41,11 @@ export AUTOMAKE
 save="$MAKE"
 for flag in '' -w; do
    MAKE="$save $flag" ./configure
-
    $FGREP 'am__include = include' Makefile
-
+   $sleep
    touch configure.in
    $MAKE $flag
-
    $FGREP 'am__include = include' Makefile
-
    rm -f config.cache
 done
 
index 819c7d3..bfe0d67 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 : > Makefile.am
 
 $ACLOCAL
index e5d55a1..e54c144 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
-cat >configure.in <<'END'
+cat >configure.in <<END
 m4_include([version.m4])
-AC_INIT([version7], [THE_VERSION])
+AC_INIT([$me], [THE_VERSION])
 AM_INIT_AUTOMAKE
 AC_CONFIG_HEADER([config.h])
 AC_CONFIG_FILES([Makefile])
@@ -51,3 +49,5 @@ $sleep
 echo 'm4_define([THE_VERSION], [3.141])' > version.m4
 $MAKE -j
 ./configure --version | grep '3\.141'
+
+:
index e702999..3025c06 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_OUTPUT
 END
@@ -39,7 +37,7 @@ mkdir build
 cd build
 ../configure "--prefix=`pwd`/inst"
 
-$MAKE -j2 || Exit 77
+$MAKE -j2 || skip_ "$MAKE failed to run with two parallel jobs"
 $MAKE -j2 distcheck
 $MAKE test-distdir-removed
 
index 61f6886..01b4448 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011, 2012 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >> configure.in << 'END'
index 27494cc..d9b9c21 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011, 2012 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
 #
 #  1. no files or directories are created or removed, and
 #
-#  2. if using GNU make, stdout output is sufficiently complete.
-#
-# FIXME: The checks in (2) should also work with BSD make implementations
-# FIXME: that support the `.MAKE' special target, but currently we don't
-# FIXME: explicitly test that this is truly the case.
+#  2. if using GNU make or a make implementation supporting the .MAKE
+#     special target, the output from make is sufficiently complete.
 #
 # This test exercises the GCS-mandated targets (except for dist)
 # as well as tags, TAGS.
 
 . ./defs || Exit 1
 
-set -e
+# Does $MAKE support the '.MAKE' special target?
+have_dotmake=false
+if using_gmake; then
+  have_dotmake=: # GNU make must support it.
+else
+  unindent > mk.tmp << 'END'
+    targ.tmp:
+       : > $@
+    .MAKE: targ.tmp
+END
+  if $MAKE -n -f mk.tmp targ.tmp && test -f targ.tmp; then
+    have_dotmake=:
+  fi
+fi
 
 mkdir sub sub2
 
@@ -127,7 +137,6 @@ $AUTOCONF
 
 check_targets ()
 {
-  set -e
   for target in \
     all install install-strip uninstall clean distclean check \
     info html dvi pdf ps \
@@ -139,7 +148,7 @@ check_targets ()
     case $target in
     install-* | installdirs | tags | TAGS ) ;;
     *)
-      if using_gmake; then
+      if $have_dotmake; then
         grep "stamp-$target$" stdout || Exit 1
       fi
       test ! -f "stamp-$target$" || Exit 1
@@ -148,7 +157,7 @@ check_targets ()
     case $target in
     install-* | installdirs ) ;;
     *)
-      if using_gmake; then
+      if $have_dotmake; then
         grep "stamp-$target-sub" stdout || Exit 1
       fi
       test ! -f "sub/stamp-$target-sub" || Exit 1
@@ -157,7 +166,7 @@ check_targets ()
     case $target in
     distclean | maintainer-clean ) ;;
     *)
-      if using_gmake; then
+      if $have_dotmake; then
         grep "should-not-be-executed" stdout || Exit 1
       fi
       test ! -f "sub2/sub2-$target-should-not-be-executed" || Exit 1
@@ -166,7 +175,7 @@ check_targets ()
   done
 }
 
-$AUTOMAKE -Wno-override
+$AUTOMAKE -a -Wno-override
 ./configure
 check_targets || Exit 1
 
index f4a80aa..e494373 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
 . ./defs || Exit 1
 
 # Find the macros wanted by Automake.
-$ACLOCAL || Exit 1
+$ACLOCAL
 
 # Create some dummy Makefile.in.
 : > Makefile.am
 
-$AUTOMAKE || Exit 1
+$AUTOMAKE
 
 # We are definitely not needing a compiler or preprocessor.
-$EGREP '^(CC|CPP|CXX|CXXCPP) =' Makefile.in && Exit 1
+$EGREP '^ *(CC|CPP|CXX|CXXCPP) *=' Makefile.in && Exit 1
 
-Exit 0
+:
index 93b3bb2..3e326ea 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 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
@@ -26,6 +27,8 @@ END
 : > foo.1
 : > bar.man
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-grep '^MANS ' Makefile.in
+$ACLOCAL
+$AUTOMAKE
+grep '^MANS *=' Makefile.in
+
+:
index 0027645..6777f97 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
@@ -19,9 +20,9 @@
 
 . ./defs || Exit 1
 
-set -e
-
-echo AC_OUTPUT >> configure.in
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 man_MANS = foo.2
@@ -38,14 +39,16 @@ $AUTOMAKE
 
 # Let's play with $DESTDIR too, it shouldn't hurt.
 ./configure --prefix='' --mandir=/man
-DESTDIR="`pwd`/_inst" $MAKE -e install
+$MAKE DESTDIR="`pwd`/_inst" install
 
 test -f ./_inst/man/man2/foo.2
 test -f ./_inst/man/man4/foo.4
 test -f ./_inst/man/man4/bar.4
 
-DESTDIR="`pwd`/_inst" $MAKE -e uninstall
+$MAKE DESTDIR="`pwd`/_inst" uninstall
 
 test ! -f ./_inst/man/man2/foo.2
 test ! -f ./_inst/man/man4/foo.4
 test ! -f ./_inst/man/man4/bar.4
+
+:
index b5afe0e..ff49d87 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 dist_man_MANS = foo.1
 installcheck-local:
@@ -42,3 +40,5 @@ $AUTOMAKE
 $AUTOCONF
 ./configure
 DISTCHECK_CONFIGURE_FLAGS=foo=bar $MAKE -e distcheck
+
+:
index de75f83..9052511 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -33,8 +33,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 dist_man_MANS = $(srcdir)/foo.1 bar.1
 dist_bin_SCRIPTS = foo bar
@@ -42,9 +40,6 @@ $(srcdir)/foo.1:
        $(HELP2MAN) --output=$@ $(srcdir)/foo
 bar.1:
        $(HELP2MAN) --output=$(srcdir)/bar.1 $(srcdir)/bar
-
-## It is a bug that we need to list $(srcdir)/bar.1 explicitly here.
-MAINTAINERCLEANFILES = $(dist_man_MANS) $(srcdir)/bar.1
 END
 
 cat >>configure.in <<'END'
@@ -62,26 +57,38 @@ while test $# -gt 0; do
   shift
 done
 END
-
 cp foo bar
+chmod +x foo bar
 
-cat > help2man <<'END'
+mkdir bin
+cat > bin/help2man <<'END'
 #! /bin/sh
-# fake help2man script that lets `missing' think it is not installed
+# Fake help2man script that lets `missing' think it is not installed.
 exit 127
 END
+chmod +x bin/help2man
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH
 
-chmod +x foo bar help2man
-save_PATH=$PATH
-PATH=`pwd`$PATH_SEPARATOR$PATH
+grep_error_messages()
+{
+  grep ' man pages contain.*missing help2man.* replacement text' stderr \
+   && grep 'install help2man' stderr \
+   && grep 'regenerate the man pages' stderr \
+   || Exit 1
+}
 
 $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
+
 ./configure
 $MAKE
-$MAKE dist && Exit 1
-$MAKE distcheck && Exit 1
+$MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep_error_messages
+$MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep_error_messages
 $MAKE distclean
 
 mkdir build
@@ -90,20 +97,9 @@ cd build
 $MAKE
 $MAKE dist 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep 'install help2man' stderr
+grep_error_messages
 $MAKE distcheck 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
-grep 'install help2man' stderr
-
-rm -f ../help2man
-PATH=$save_PATH
-export PATH
+grep_error_messages
 
-# If help2man is installed, then ensure that the recommendation works.
-if (help2man --version) >/dev/null 2>&1; then
-  $MAKE maintainer-clean
-  ../configure
-  $MAKE
-  $MAKE distcheck
-fi
 :
index 437dc33..955442e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -18,9 +18,9 @@
 
 . ./defs || Exit 1
 
-set -e
-
-echo AC_OUTPUT >> configure.in
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 man_MANS = foo-1.4.5/foo.2 foo-1.4.5/bar.3 baz-1.4.2
@@ -42,7 +42,7 @@ $AUTOMAKE
 
 # Let's play with $DESTDIR too, it shouldn't hurt.
 ./configure --mandir=/man
-DESTDIR="`pwd`/_inst" $MAKE -e install
+$MAKE DESTDIR="`pwd`/_inst" install
 
 test -f ./_inst/man/man2/foo.2
 test -f ./_inst/man/man2/nfoo.2
@@ -55,7 +55,7 @@ test ! -d ./_inst/man/man1
 test ! -d ./_inst/man/man4
 test ! -d ./_inst/man/man5
 
-DESTDIR="`pwd`/_inst" $MAKE -e uninstall
+$MAKE DESTDIR="`pwd`/_inst" uninstall
 
 test ! -f ./_inst/man/man2/foo.2
 test ! -f ./_inst/man/man2/nfoo.2
diff --git a/tests/man6.test b/tests/man6.test
new file mode 100755 (executable)
index 0000000..be96188
--- /dev/null
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Ensure `make distcheck' passes when help2man generates man pages,
+# even if the `missing' script is involved.
+
+required=help2man
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+dist_man_MANS = $(srcdir)/foobar.1 bazquux.1 zardoz.1
+dist_bin_SCRIPTS = foobar bazquux zardoz
+$(srcdir)/foobar.1:
+       $(HELP2MAN) --output=$@ $(srcdir)/foobar
+bazquux.1:
+       $(HELP2MAN) --output=$@ $(srcdir)/bazquux
+zardoz.1:
+       $(HELP2MAN) --output=$(srcdir)/zardoz.1 $(srcdir)/zardoz
+END
+
+cat >> configure.in <<'END'
+AM_MISSING_PROG([HELP2MAN], [help2man])
+AC_OUTPUT
+END
+
+cat > foobar <<'END'
+#! /bin/sh
+while test $# -gt 0; do
+  case $1 in
+    -h | --help) echo "usage: $0 [OPTIONS]..."; exit 0;;
+    -v | --version) echo "$0 1.0"; exit 0;;
+  esac
+  shift
+done
+END
+
+cp foobar bazquux
+cp foobar zardoz
+
+chmod +x foobar bazquux zardoz
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+mkdir build
+cd build
+
+../configure
+# Sanity check.
+grep '^HELP2MAN *=.*/missing --run help2man' Makefile
+
+$MAKE
+$FGREP foobar ../foobar.1
+$FGREP bazquux ./bazquux.1
+$FGREP zardoz ../zardoz.1
+
+$MAKE distdir
+$FGREP foobar  $me-1.0/foobar.1
+$FGREP bazquux $me-1.0/bazquux.1
+$FGREP zardoz  $me-1.0/zardoz.1
+
+$MAKE distcheck
+
+cd ..
+rm -f *.1 # Remove leftover generated manpages.
+
+./configure
+# Sanity check.
+grep '^HELP2MAN *=.*/missing --run help2man' Makefile
+
+$MAKE
+$FGREP foobar  foobar.1
+$FGREP bazquux bazquux.1
+$FGREP zardoz  zardoz.1
+
+$MAKE distdir
+$FGREP foobar  $me-1.0/foobar.1
+$FGREP bazquux $me-1.0/bazquux.1
+$FGREP zardoz  $me-1.0/zardoz.1
+
+$MAKE distcheck
+
+:
diff --git a/tests/man7.test b/tests/man7.test
new file mode 100755 (executable)
index 0000000..9f4f9ad
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check for a bug in maintainer-clean w.r.t. generated manpages.
+
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+dist_man_MANS = $(srcdir)/foo.1 bar.1
+$(srcdir)/foo.1 bar.1:
+       : > $@
+MAINTAINERCLEANFILES = $(dist_man_MANS)
+END
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+
+$MAKE
+test -f bar.1
+test -f ../foo.1
+
+$MAKE maintainer-clean
+test ! -f bar.1
+test ! -f ../foo.1
+
+cd ..
+./configure
+
+$MAKE
+test -f bar.1
+test -f foo.1
+
+$MAKE maintainer-clean
+test ! -f bar.1
+test ! -f foo.1
+
+:
diff --git a/tests/man8.test b/tests/man8.test
new file mode 100755 (executable)
index 0000000..2257627
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check for a bug in distcheck w.r.t. generated manpages.
+
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+dist_man_MANS = foo.1
+foo.1:
+## This 'rm' command will fail if $(srcdir) is unwritable.
+       rm -f $(srcdir)/$@
+       : > $(srcdir)/$@
+END
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+mkdir build
+cd build
+../configure
+
+$MAKE
+test -f ../foo.1
+$MAKE distdir
+test -f $me-1.0/foo.1
+$MAKE distcheck
+
+cd ..
+rm -f foo.1
+./configure
+
+$MAKE
+test -f foo.1
+$MAKE distdir
+test -f $me-1.0/foo.1
+$MAKE distcheck
+
+:
index 0dfba07..5d7810e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 1997, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
 END
index 11b6d5d..c577031 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 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
@@ -32,7 +33,9 @@ END
 echo '@setfilename textutils' > textutils.texi
 
 # Use "././" to confuse Automake into thinking this is a subdir build.
-$ACLOCAL || Exit 1
-$AUTOMAKE ././Makefile || Exit 1
+$ACLOCAL
+$AUTOMAKE ././Makefile
 
 grep 'mdate-sh' Makefile.in | grep -v SHELL
+
+:
index 75105f9..970bd54 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2004, 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
@@ -18,8 +19,8 @@
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT([mdate3], [1.0])
+cat > configure.in << END
+AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([foo])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
@@ -41,11 +42,9 @@ mkdir foo
 : > foo/mdate-sh
 mv install-sh foo
 mv missing foo
-mv mkinstalldirs foo
-mv depcomp foo
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '[^/]mdate-sh' Makefile.in && Exit 1
 Exit 0
index ca24f56..dcac0fc 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure that mdate-sh is added to the right directory.
-# Report from Kevin Dalley
+# Report from Kevin Dalley.
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile sub/Makefile)
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
 END
 
 cat > Makefile.am << 'END'
@@ -40,6 +38,9 @@ cat > sub/textutils.texi << 'END'
 @setfilename textutils.info
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE -a || Exit 1
+$ACLOCAL
+$AUTOMAKE -a
+ls -l sub
 test -f sub/mdate-sh
+
+:
index c9140b6..db6a6c6 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2004, 2007  Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2004, 2007, 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
 
 # Test to make sure mdate-sh works correctly.
 
+am_create_testdir=empty
 . ./defs || Exit 1
-set -e
 
-cat >> configure.in << 'END'
-AC_OUTPUT
-END
+get_shell_script mdate-sh
 
-cat > Makefile.am << 'END'
-info_TEXINFOS = textutils.texi
-END
-
-cat > textutils.texi << 'END'
-@include version.texi
-@setfilename textutils.info
-END
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-
-set x `$SHELL ./mdate-sh Makefile.am`
+set x `./mdate-sh mdate-sh`
 shift
+echo "$*" # For debugging.
+
 # Check that mdate output looks like a date:
 test $# = 3
 case $1$3 in *[!0-9]*) Exit 1;; esac
 test $1 -lt 32
+# Hopefully automake will be obsolete in 80 years ;-)
+case $3 in 20[0-9][0-9]) :;; *) Exit 1;; esac
+case $2 in
+  January|February|March|April|May|June|July|August) ;;
+  September|October|November|December) ;;
+  *) Exit 1
+esac
+
+# Stricter checks on the year required a POSIX date(1) command.
+if year=`date +%Y` && test $year -gt 2010; then
+  test $year = $3 || Exit 1
+fi
+
+:
index e7f7d69..de93f35 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 # mdate-sh can work with weird file names, doesn't eval too much.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 a=
 file='file  name $a'
-( : > "$file" ) || Exit 77
+( : > "$file" ) \
+  || skip_ "file name with spaces and metacharacters not accepted"
+
+get_shell_script mdate-sh
 
-cp "$testsrcdir"/../lib/mdate-sh .
-$SHELL ./mdate-sh "$file" >stdout 2>stderr ||
+./mdate-sh "$file" >stdout 2>stderr ||
   { cat stdout; cat stderr >&2; Exit 1; }
 cat stdout
 cat stderr >&2
diff --git a/tests/missing-auxfile-stops-makefiles-creation.test b/tests/missing-auxfile-stops-makefiles-creation.test
new file mode 100755 (executable)
index 0000000..6492a14
--- /dev/null
@@ -0,0 +1,65 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Automake should stop the creation of Makefile.in files at the first
+# encountered error due to a required auxiliary file not found.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AM_PATH_PYTHON
+END
+
+echo SUBDIRS = > Makefile.am
+
+for i in 1 2 3 4 5; do
+  echo "AC_CONFIG_FILES([sub$i/Makefile])" >> configure.in
+  echo "SUBDIRS += sub$i" >> Makefile.am
+  mkdir sub$i
+  echo python_PYTHON = foo.py > sub$i/Makefile.am
+done
+
+: > sub1/Makefile.am
+
+$ACLOCAL
+
+unset AUTOMAKE_JOBS || :
+
+AUTOMAKE_fails
+ls -l Makefile.in */Makefile.in || : # For debugging.
+# Top-level Makefile.in might be created or not, we don't want to set
+# too strict semantics here, so don't check for it.  But the later
+# files shouldn't exist.
+test -f sub1/Makefile.in
+test ! -f sub2/Makefile.in
+test ! -f sub3/Makefile.in
+test ! -f sub4/Makefile.in
+test ! -f sub5/Makefile.in
+
+rm -f Makefile.in */Makefile.in
+
+: > sub2/Makefile.am
+: > sub3/Makefile.am
+
+AUTOMAKE_fails
+ls -l Makefile.in */Makefile.in || : # For debugging.
+test -f sub1/Makefile.in
+test -f sub2/Makefile.in
+test -f sub3/Makefile.in
+test ! -f sub4/Makefile.in
+test ! -f sub5/Makefile.in
+
+:
index eaf6f54..0ca5786 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2006, 2007, 2008  Free Software Foundation,
-# Inc.
+# Copyright (C) 2003, 2004, 2006, 2007, 2008, 2011, 2012 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AC_OUTPUT
 EOF
 
 : > Makefile.am
 
+get_shell_script missing
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
@@ -63,4 +63,5 @@ $MAKE
 $sleep
 touch aclocal.m4
 $MAKE && Exit 1
+
 :
index 2629198..5df575e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2006, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2006, 2007, 2011, 2012 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 m4_include([v.m4])
 AC_OUTPUT
@@ -29,6 +28,8 @@ EOF
 
 : > Makefile.am
 
+get_shell_script missing
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
@@ -54,4 +55,5 @@ $MAKE
 $sleep
 touch v.m4
 $MAKE && Exit 1
+
 :
index 54044f5..20b2429 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2008, 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
 
 # Test missing when running a tool's --version.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
+get_shell_script missing
 
 # b7cb8259 assumed not to exist.
 
index 13a4c22..767794a 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007, 2008, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >>configure.in
 
 touch Makefile.am
index a96e14e..0cb71e8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# test how well `missing' finds output file names of various tools.
+# Test how well `missing' finds output file names of various tools.
 # PR automake/483.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
+get_shell_script missing
 
-# these programs may be invoked by `missing'
+# These programs may be invoked by `missing'.
 needed_tools='chmod find sed test touch'
 needed_tools_csep=`echo $needed_tools | sed 's/ /, /g'`
 
@@ -35,9 +36,9 @@ AC_OUTPUT
 EOF
 
 for tool in $needed_tools; do
-  cat >$tool.in <<EOF
-#! /bin/sh
-exec @$tool@ "\$@"
+  unindent >$tool.in <<EOF
+    #! /bin/sh
+    exec @$tool@ "\$@"
 EOF
 done
 
index e543697..b6f1562 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 {
   echo 'm4_define([AC_AUTOCONF_VERSION], [9999a])'
   echo 'dnl!! m4_define([a], [oops])'
@@ -40,7 +38,7 @@ $AUTOMAKE
 $MAKE
 
 sed 's/^dnl!! //' < configure.ac > configure.tmp
-cmp configure.ac configure.tmp && Exit 99 # sanity check
+cmp configure.ac configure.tmp && fatal_ 'failed to edit configure.ac'
 mv -f configure.tmp configure.ac
 
 $MAKE 2>stderr || { cat stderr >&2; Exit 1; }
index 359f562..3058803 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003, 2007  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003, 2007, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
index 20b9b04..9dba968 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006, 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
 
 # Test mkinstalldirs with spaces in directory names.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
 # Make sure the directory we will create can be created...
-mkdir '~a b' || Exit 77
-mkdir '~a b/-x  y' || Exit 77
+mkdir '~a b' && mkdir '~a b/-x  y' \
+  || skip_ "directory names with spaces and metacharacters not accepted"
 rm -rf '~a b'
 
-cp "$testsrcdir/../lib/mkinstalldirs" .
+get_shell_script mkinstalldirs
 
 # Test mkinstalldirs with the installed mkdir.
 
index 4a65307..1f1bac8 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -24,8 +25,8 @@ END
 
 # The "././" prefix confuses Automake into thinking it is doing a
 # subdir build.  Yes, this is hacky.
-$ACLOCAL || Exit 1
-$AUTOMAKE ././Makefile || Exit 1
+$ACLOCAL
+$AUTOMAKE ././Makefile
 
 grep ' /mkinstalldirs' Makefile.in && Exit 1
 Exit 0
index c5a16c9..1dd64e7 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_MAINTAINER_MODE
 AC_OUTPUT
index fc94d37..4457bb0 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2004, 2006, 2007, 2009, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2004, 2006, 2007, 2009, 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
 # sources in maintainer mode.
 # From Derek R. Price.
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_MAINTAINER_MODE
 AC_PROG_CC
@@ -40,7 +38,8 @@ zardoz_SOURCES = zardoz.y joe.l
 LDADD = @LEXLIB@
 END
 
-# The point of this test is that it is not dependent on a working lex or yacc.
+# The point of this test is that it is not dependent on a working lex
+# or yacc.
 cat > joe.c <<EOF
 int joe (int arg)
 {
@@ -85,7 +84,7 @@ END
 chmod +x myyacc.sh mylex.sh
 PATH="`pwd`$PATH_SEPARATOR$PATH"
 
-# make maintainer-clean; ./configure; make should always work,
+# "make maintainer-clean; ./configure; make" should always work,
 # per GNU Standard.
 $MAKE maintainer-clean
 ./configure
index 75ef952..7401d9e 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2007, 2010, 2012 Free Software Foundation,
-# Inc.
+# Copyright (C) 2003, 2004, 2007, 2010, 2011, 2012 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
 
 # Check multilib support.
 # Based on a test case from Ralf Corsepius.
+# FIXME: the features tested by this script has been moved in contrib.
+# FIXME: We should move this script accordingly.
 
 required='gcc GNUmake'
 . ./defs || Exit 1
 
-set -e
+mldir=$top_testsrcdir/contrib/multilib
+mkdir m4
+cp "$mldir"/config-ml.in "$mldir"/symlink-tree .
+cp "$mldir"/multi.m4 m4
 
-# Multilib support has been deprecated in the Automake core.
-
-cat >>configure.in <<'END'
-AM_ENABLE_MULTILIB([Makefile], [.])
-END
-
-$ACLOCAL
-$AUTOCONF -Wall -Werror 2>stderr && { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep '^configure\.in:4:.*AM_ENABLE_MULTILIB.* removed.* soon' stderr
-grep '"multilib".*feature' stderr
-grep 'contrib.* in the Automake distribution' stderr
-
-rm -rf autom4te*.cache aclocal.m4 configure
-
-# Functional tests now.
+ACLOCAL_PATH=${ACLOCAL_PATH+"$ACLOCAL_PATH:"}`pwd`/m4
+export ACLOCAL_PATH
 
 cat >configure.in <<'END'
 AC_INIT([multlib], [1.0])
@@ -68,12 +59,18 @@ PATH=`pwd`$PATH_SEPARATOR$PATH
 cat >Makefile.am <<'EOF'
 SUBDIRS = @subdirs@
 EXTRA_DIST = config-ml.in symlink-tree
+check-all:
+       test -f debug/libfoo/libfoo.a
+       test -f debug/libbar/libbar.a
+       test -f libfoo/libfoo.a
+       test -f libbar/libbar.a
 EOF
 
 # libfoo tests multilib supports when there are no subdirectories
 # libbar tests multilib supports when there are subdirectories
 
 mkdir libfoo
+cp "$mldir"/multilib.am libfoo/
 
 cat >libfoo/configure.in <<'END'
 AC_PREREQ(2.57)
@@ -84,6 +81,7 @@ AC_CONFIG_SRCDIR(foo.c)
 AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_ENABLE_MULTILIB(Makefile,[..])
 AC_CONFIG_FILES([Makefile])
@@ -93,11 +91,13 @@ END
 cat >libfoo/Makefile.am <<'END'
 noinst_LIBRARIES = libfoo.a
 libfoo_a_SOURCES = foo.c
+include $(top_srcdir)/multilib.am
 END
 
 : > libfoo/foo.c
 
 mkdir libbar
+cp "$mldir"/multilib.am libbar/
 
 cat >libbar/configure.in <<'END'
 AC_PREREQ(2.57)
@@ -107,6 +107,7 @@ AC_INIT(libbar, 0.1, nobody@localhost)
 AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_ENABLE_MULTILIB(Makefile,[..])
 AC_CONFIG_FILES([Makefile sub/Makefile])
@@ -117,36 +118,38 @@ cat >libbar/Makefile.am <<'END'
 SUBDIRS = sub
 noinst_LIBRARIES = libbar.a
 libbar_a_SOURCES = bar.c
+include $(top_srcdir)/multilib.am
 END
 
 mkdir libbar/sub
-
-: >libbar/sub/Makefile.am
-
+echo 'include $(top_srcdir)/multilib.am' >libbar/sub/Makefile.am
 : > libbar/bar.c
 
-cp "$testsrcdir/../lib/config-ml.in" .
-cp "$testsrcdir/../lib/symlink-tree" .
-
-$ACLOCAL -Wno-obsolete
-$AUTOCONF -Werror -Wall -Wno-obsolete
+$ACLOCAL
+$AUTOCONF
 $AUTOMAKE --add-missing
+
 cd libfoo
 $ACLOCAL
-$AUTOCONF -Werror -Wall -Wno-obsolete
+$AUTOCONF
 $AUTOMAKE --add-missing
-cd ../libbar
+cd ..
+
+cd libbar
 $ACLOCAL
-$AUTOCONF -Werror -Wall -Wno-obsolete
+$AUTOCONF
 $AUTOMAKE --add-missing
 cd ..
 
-
 # Check VPATH builds
 mkdir build
 cd build
 ../configure --enable-multilib CC=mycc
 $MAKE
+test -f debug/libfoo/libfoo.a
+test -f debug/libbar/libbar.a
+test -f libfoo/libfoo.a
+test -f libbar/libbar.a
 $MAKE install
 $MAKE distcleancheck
 
@@ -154,4 +157,7 @@ $MAKE distcleancheck
 cd ..
 # Why to I have to specify --with-target-subdir?
 ./configure --enable-multilib --with-target-subdir=. CC=mycc
-$MAKE
+$MAKE check
+DISTCHECK_CONFIGURE_FLAGS='--enable-multilib CC=mycc' $MAKE distcheck
+
+:
similarity index 56%
rename from tests/acoutbs.test
rename to tests/no-extra-makefile-code.test
index 0ce981c..73d5458 100755 (executable)
@@ -1,5 +1,6 @@
 #!/bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002, 2010  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2000, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test for bug reported by François Pinard.
-# If \ is in AC_OUTPUT, automake barfs.
+# Check that we don't emit harmless but useless code in the generated
+# Makefile.in when the project does not use compiled languages.  Motivated
+# by a regression caused by removal of automatic de-ANSI-fication support:
+# <http://lists.gnu.org/archive/html/automake-patches/2011-08/msg00200.html>
 
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile \
-zot)
-END
+echo AC_OUTPUT >> configure.in
 
 : > Makefile.am
-: > zot.in
+
+rm -f depcomp compile
 
 $ACLOCAL
-$AUTOCONF
 $AUTOMAKE
 
-./configure
-
-test -f zot || Exit 1
-ls -a | grep '\\' && Exit 1
+$EGREP 'DEFAULT_INCLUDES|@am__isrc@|-compile|\$\(OBJEXT\)|tab\.[ch]' \
+  Makefile.in && Exit 1
 
 :
similarity index 69%
rename from tests/acoutqnl.test
rename to tests/no-outdir-option.test
index 75736f2..85921fc 100755 (executable)
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test for bug reported by François Pinard.
+# Check that the `-o' aka `--output-dir' option is not recognized anymore.
 
 . ./defs || Exit 1
 
-set -e
+: > Makefile.am
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT([Makefile],
-[echo zardoz has spoken])
-END
+AUTOMAKE_fails -Wno-error --output-dir=foo
+grep 'unrecognized option.*--output-dir' stderr
 
-: > Makefile.am
+AUTOMAKE_fails -Wno-error -o foo
+grep 'unrecognized option.*-o' stderr
 
-$ACLOCAL
-$AUTOMAKE
+:
index 12b055e..43c0702 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008  Free Software
-# Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 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
 # This is just the libtool equivalent of nobase.test, split
 # up for greater exposure of nobase.test.
 
-required='libtoolize gcc'
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
@@ -49,6 +48,8 @@ test-install-exec: install-exec
        test   -f inst/foo/sub/libnobase.la
        test ! -f inst/foo/libnobase.la
        test   -f inst/foo/libbase.la
+
+.PHONY: test-install-exec test-install-data
 EOF
 
 mkdir sub
@@ -91,3 +92,5 @@ $MAKE test-install-data
 $MAKE test-install-exec
 $MAKE uninstall
 test `find inst/foo -type f -print | wc -l` = 0
+
+:
index 90823e2..4ea9df4 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # Simulate no emacs and no python (it shouldn't be needed in this test).
 EMACS="no" PYTHON=":"; export EMCAS PYTHON
 
index db5b830..3974ca5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -19,8 +19,6 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AM_PATH_PYTHON
 AC_OUTPUT
@@ -32,6 +30,7 @@ my_PYTHON = one.py sub/base.py
 nobase_my_PYTHON = two.py sub/nobase.py
 
 test-install-data: install-data
+       find inst -print; : For debugging.
        test   -f inst/my/one.py
        test   -f inst/my/one.pyc
        test   -f inst/my/two.py
@@ -55,16 +54,13 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-mkdir inst
-inst=`pwd`/inst
-
 ./configure --prefix "`pwd`/inst" --program-prefix=p
 
 $MAKE
 $MAKE test-install-data
 $MAKE uninstall
 
-test `find inst/my -type f -print | wc -l` = 0
+find inst/my -type f -print | grep . && Exit 1
 
 $MAKE install-strip
 
@@ -78,4 +74,6 @@ cd build
 $MAKE
 $MAKE test-install-data
 $MAKE uninstall
-test `find inst/my -type f -print | wc -l` = 0
+find inst/my -type f -print | grep . && Exit 1
+
+:
index 8b0dc6e..231eb73 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009  Free
-# Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 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
 
 # Make sure nobase_* works.
 
-required='gcc'
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 EOF
@@ -95,6 +94,8 @@ test-install-exec: install-exec
        test   -f inst/foo/sub/libnobase.a
        test ! -f inst/foo/libnobase.a
        test   -f inst/foo/libbase.a
+
+.PHONY: test-install-exec test-install-data
 EOF
 
 mkdir sub
@@ -143,3 +144,5 @@ $MAKE test-install-data
 $MAKE test-install-exec
 $MAKE uninstall
 test `find inst/foo -type f -print | wc -l` = 0
+
+:
index 1a58bb7..e8389a0 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2011, 2012 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # -------------------------------------------------------------------
 # Do not upgrade this file to use the modern AC_INIT/AM_INIT_AUTOMAKE
 # forms.  The day these obsolete AC_INIT and AM_INIT_AUTOMAKE forms
@@ -56,4 +54,5 @@ $AUTOCONF
 ./configure
 
 grep 'DEFS.*-DVERSION=\\"UnIqUe' output && Exit 1
+
 :
index 5a6c0ee..4b5a431 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2011, 2012 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # First, check that PACKAGE and VERSION are output by default.
 
 cat > configure.in << 'END'
@@ -52,4 +50,5 @@ $AUTOMAKE   # Dummy call to make sure Automake grok `no-define' silently.
 ./configure
 
 grep 'DEFS.*-DVERSION=\\"UnIqUe' output && Exit 1
+
 :
index 650bbd0..0d140eb 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = zardoz
index 53bcaad..f45ee2c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2011, 2012 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
 foo_SOURCES = a.c b.cpp c.m d.S e.java f.upc
@@ -38,15 +36,9 @@ AM_PROG_UPC
 AC_OUTPUT
 END
 
-: > a.c
-: > b.cpp
-: > c.m
-: > d.S
-: > e.java
-: > f.upc
-
 $ACLOCAL
 $AUTOMAKE
 
 grep DEPMODE Makefile.in && Exit 1
+
 :
index 735c363..7042ae9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 rm -f depcomp
 
 : > Makefile.am
index 7239338..e300b91 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -18,7 +19,9 @@
 
 . ./defs || Exit 1
 
-echo AC_PROG_CC >> configure.in
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = eyeball
@@ -28,15 +31,11 @@ nodist_eyeball_SOURCES = b.c
 dist_eyeball_SOURCES = c.c
 END
 
-: > a.c
-: > b.c
-: > c.c
-
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
-grep '^am_eyeball_OBJECTS' Makefile.in || Exit 1
-grep '^DIST_SOURCES =' Makefile.in || Exit 1
+grep '^am_eyeball_OBJECTS' Makefile.in
+grep '^DIST_SOURCES =' Makefile.in
 grep '^DIST_SOURCES =.*nodist' Makefile.in && Exit 1
 
-Exit 0
+:
index 3d9e6ce..c7a8563 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2007, 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
@@ -29,10 +29,10 @@ EOF
 
 : > baz.h
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 ./configure --prefix "`pwd`/install"
 $MAKE install-data
+
+:
index 21cfec3..31f7490 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 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
@@ -18,7 +18,9 @@
 
 . ./defs || Exit 1
 
-echo AC_PROG_CC >> configure.in
+cat >> configure.in << 'END'
+AC_PROG_CC
+END
 
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = no-dist
@@ -26,12 +28,10 @@ bin_PROGRAMS = eyeball
 eyeball_SOURCES = a.c
 END
 
-: > a.c
-
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^dist:' Makefile.in && Exit 1
 grep '^DIST_SOURCES =' Makefile.in && Exit 1
 
-Exit 0
+:
index dd97481..ac4ff66 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 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
@@ -24,7 +25,9 @@ all-local:
        exit 1
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^install[-a-z]*:.* all' Makefile.in
+
+:
index 3f33c32..329990e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -34,12 +34,16 @@ END
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+: > ar-lib
+
+$ACLOCAL
+$AUTOMAKE
 
 grep 'noinstdir' Makefile.in && Exit 1
 grep 'checkdir' Makefile.in && Exit 1
-Exit 0
+
+:
index 5e42076..ca67339 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = no-exeext
 
index 43535ef..07f91f1 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
 
 # Test to make sure nostdinc option works correctly.
 
-. ./defs || Exit 1
+# We don't require a C compiler explicitly, because the first part of the
+# test (where `Makefile.in' is grepped) does not require one.  Insted, we
+# just skip the rest of the test if configure fails to find a working C
+# compiler.
 
-set -e
+. ./defs || Exit 1
 
 cat >> configure.in << 'END'
 AC_PROG_CC
@@ -34,7 +38,7 @@ END
 $ACLOCAL
 $AUTOMAKE
 
-grep '.*-I *\.' Makefile.in && Exit 1
+$EGREP '(-I *\.|-I.*srcdir|am__isrc)' Makefile.in && Exit 1
 
 # We'll test the fully-processed Makefile too.
 $AUTOCONF
@@ -42,12 +46,12 @@ $AUTOCONF
 # Test with $builddir != $srcdir
 mkdir build
 cd build
-../configure
+../configure || Exit $?
 $EGREP '.*-I *(\.|\$.srcdir.)' Makefile && Exit 1
 
 # Test with $builddir = $srcdir
 cd ..
-./configure
+./configure || Exit $?
 $EGREP '.*-I *(\.|\$.srcdir.)' Makefile && Exit 1
 
 Exit 0
index d3ee2b2..ce38926 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_OUTPUT
 END
@@ -39,7 +37,7 @@ notrans_man3_MANS = z-foo.man z-foo2.man
 notrans_dist_man2_MANS = z-bar.man z-bar2.man
 notrans_nodist_man1_MANS = z-baz.man z-baz2.man
 
-# These two are ignored
+# These two are ignored.
 dist_notrans_man_MANS = nosuch.8
 nodist_notrans_man9_MANS = nosuch.man
 
index a43ff2f..7a0d1ee 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -27,8 +28,11 @@ cat > Makefile.am << 'END'
 bin_PROGRAMS = zardoz
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
+grep '^zardoz_OBJECTS' Makefile.in
 count=`grep -c '^zardoz_OBJECTS' Makefile.in`
 test $count -eq 1
+
+:
index facc4d4..0ea5b40 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2006, 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
@@ -28,7 +29,9 @@ bin_PROGRAMS = hello
 hello_SOURCES = hello.m
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^\.SUFFIXES:.*\.m' Makefile.in
+
+:
index 9931ef7..3080d5c 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >>configure.in
 
 cat >Makefile.am <<'END'
index 0692164..e105635 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am <<'END'
@@ -40,8 +38,8 @@ zardoz_SOURCES = mu1.lisp mu2.lisp
 
 .PHONY: test
 test:
-       test '$(foo_OBJECTS)'    = 'foo.fasl'
-       test '$(zardoz_OBJECTS)' = 'mu1.fasl mu2.fasl'
+       is $(foo_OBJECTS) == foo.fasl
+       is $(zardoz_OBJECTS) == mu1.fasl mu2.fasl
 END
 
 $ACLOCAL
index 337e4db..4fd126a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2007, 2008, 2010 Free Software
+# Copyright (C) 1996, 2001, 2002, 2007, 2008, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -28,24 +28,31 @@ AC_INIT
 END
 
 $PERL -ne '/AU_DEFUN\(\[(\w+)\]/ && print "$1\n"' \
-    "$testsrcdir/../m4/obsolete.m4" >> obs
+  "$am_automake_acdir/obsolete.m4" > obs
 cat obs >> configure.in
-$PERL -ne 'chomp; print "grep $_ stderr || Exit 1\n"; ' obs > obs.1
+$PERL -ne 'chomp; print "grep $_ output || Exit 1\n"; ' obs > obs.1
 $PERL -ne 'chomp; print "grep $_ configure.in && Exit 1\n"; ' obs > obs.2
+echo : >> obs.1 # Since it will be sourced, it must end with a success.
+echo : >> obs.2 # Likewise.
+
+cat configure.in # For debugging.
+cat obs.1        # Likewise.
+cat obs.2        # Likewise.
 
 # Sanity check.  Make sure we have added something to configure.in.
-test `cat configure.in | wc -l` -gt 1 || Exit 1
+test `wc -l <configure.in` -gt 1
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 
 # Expect Autoconf to complain about each of the macros in obs.
-$AUTOCONF -Wobsolete >stderr 2>&1
+$AUTOCONF -Wobsolete >output 2>&1 || { cat output; Exit 1; }
+cat output
 . ./obs.1
 # Make sure Autoupdate remove each of these macros.
-$AUTOUPDATE || Exit 1
+$AUTOUPDATE
 . ./obs.2
 
 # Autoconf should be able to grok the updated configure.in.
-$AUTOCONF || Exit 1
+$AUTOCONF
 
-Exit 0
+:
diff --git a/tests/oldvars.test b/tests/oldvars.test
new file mode 100755 (executable)
index 0000000..242056e
--- /dev/null
@@ -0,0 +1,35 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Use of these variables is deprecated:
+# LISP, HEADERS, DATA, SCRIPTS, LTLIBRARIES, LIBRARIES, PROGRAMS, MANS.
+
+. ./defs || Exit 1
+
+cat >Makefile.am <<\EOF
+DATA =
+HEADERS =
+LIBRARIES =
+LISP =
+LTLIBRARIES =
+MANS =
+PROGRAMS =
+SCRIPTS =
+EOF
+
+$ACLOCAL
+AUTOMAKE_fails
+test `grep -c anachronism stderr` -eq 8
index 0f39b79..b1030fa 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 jm_TEST
 FOO
diff --git a/tests/outdir.test b/tests/outdir.test
deleted file mode 100755 (executable)
index 4bafb4e..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1996, 2001, 2002  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/>.
-
-# Test to ensure that --output-dir works.  Bug report from Joshua
-# Cowan.
-
-. ./defs || Exit 1
-
-cat > Makefile.am <<'END'
-pkgdata_DATA =
-END
-
-mkdir zardir
-
-$ACLOCAL || Exit 1
-$AUTOMAKE -Wno-obsolete --output-dir=zardir || Exit 1
-
-test -f Makefile.in && Exit 1
-test -f zardir/Makefile.in
index cb9ffff..259b34d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_OUTPUT
 END
index 4f6a7cd..260dfcb 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2000, 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
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile frob/zardoz)
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_OUTPUT([Makefile frob/zardoz])
 END
 
 : > Makefile.am
@@ -29,5 +30,7 @@ END
 mkdir frob
 : > frob/zardoz.in
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
index a973559..b20cae2 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << END
 AC_SUBST([FOO], [top])
 AC_SUBST([BAR], [bot])
index 9d5328b..e8e2c80 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005  Free Software Foundation, Inc.
+# Copyright (C) 2005, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << \END
 AC_SUBST([FOO], [foo])
 file1=this.in
index 2f8027c..4297373 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005  Free Software Foundation, Inc.
+# Copyright (C) 2005, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << \END
 AC_SUBST([FOO], [foo])
 AC_SUBST([file1], [this.in])
index c862f07..810c280 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << \END
 AC_SUBST([FOO], [foo])
 if $create; then
index c9bdbc3..28850a4 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2000, 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
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile intl/intlh.inst po/Makefile.in misc/gettextize)
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_OUTPUT([Makefile intl/intlh.inst po/Makefile.in misc/gettextize])
 END
 
 : > Makefile.am
@@ -31,8 +32,8 @@ mkdir intl po misc
 : > po/Makefile.in.am
 : > misc/gettextize.in
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^gettextize' Makefile.in && Exit 1
 Exit 0
index 02d7e6f..2626113 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2000, 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
@@ -18,9 +19,9 @@
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
 AC_OUTPUT([Makefile
 tests/Makefile tests/defs],
 [blah])
@@ -32,5 +33,7 @@ mkdir tests
 : > tests/Makefile.am
 : > tests/defs.in
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
index fc5a022..41fabf9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2000, 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
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(tests/Makefile tests/defs)
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_OUTPUT([tests/Makefile tests/defs])
 END
 
 mkdir tests
 : > tests/defs.in
 : > tests/Makefile.am
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep tests/defs.in tests/Makefile.in && Exit 1
 Exit 0
index 4323f62..c46ccf2 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2000, 2001, 2002, 2003, 2004  Free Software
-#   Foundation, Inc.
+# Copyright (C) 1997, 2000, 2001, 2002, 2003, 2004, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([foo], [bar], [baz])
 AM_INIT_AUTOMAKE
index 88daa74..898697d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # 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 support for colon separated input files in AC_CONFIG_FILES
+# Check for support for colon-separated input files in AC_CONFIG_FILES.
 
-required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
-AC_CONFIG_FILES(foo:a.in:b.in:c.in:d.in)
+AC_CONFIG_FILES([foo:a.in:b.in:c.in:d.in])
 AC_OUTPUT
 END
 
@@ -45,8 +42,11 @@ cat >c.am <<'EOF'
 c = C
 d = C
 
-print:
-       @echo $a$b$c$d
+.PHONY: test1 test2
+test1:
+       test $(a)$(b)$(c)$(d) = ABCD
+test2:
+       test $(a)$(b)$(c)$(d) = GFCD
 EOF
 
 echo 'd = D' > d.in
@@ -56,7 +56,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 ./configure
-$MAKE -f foo print | grep 'ABCD'
+$MAKE -f foo test1
 
 $sleep
 cat >b.in <<'EOF'
@@ -66,5 +66,7 @@ c = F
 d = F
 EOF
 
-# This involves the rebuild rule, hence it requires GNUmake
-$MAKE -f foo print | grep 'GFCD'
+using_gmake || $MAKE -f foo
+$MAKE -f foo test2
+
+:
index 878c091..a49632f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
index 1c11a16..4e610a9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir testdir
 cd testdir
 
index d4cf15a..98572be 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << END
 AC_CONFIG_FILES([a/mid.in:a/input.in.in])
 AC_CONFIG_FILES([b/out:a/mid.in])
diff --git a/tests/overrid.test b/tests/overrid.test
deleted file mode 100755 (executable)
index df453ca..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2003, 2004, 2006  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 automake -Woverride suggests using TARGET-local instead
-# of TARGET when possible.
-
-. ./defs || Exit 1
-
-set -e
-
-cat >> configure.in << 'END'
-AM_CONDITIONAL([COND], [:])
-END
-
-cat > Makefile.am << 'END'
-install:
-       :
-installcheck:
-       :
-html:
-       :
-clean-am:
-       :
-
-if COND
-ps: mine
-       :
-endif
-END
-
-$ACLOCAL
-$AUTOMAKE -Wno-override
-AUTOMAKE_fails
-grep ':.*install-local' stderr && Exit 1 # There is no such thing as install-local
-grep ':.*installcheck-local' stderr
-grep ':.*html-local' stderr
-# Make sure overriding *-am targets suggest using *-local, not *-am.
-grep ':.*clean-am-local' stderr && Exit 1
-grep ':.*clean-local' stderr
-
-# Conditional overrides ought to be diagnosed, but it can't be done yet.
-# See the FIXME in Automake::Rule::define.  Once this is fixed, the grep below
-# will fail.  If you see the failure, it means you fixed Automake.  Well done!
-# Just strip out the next '&& Exit 1' and this comment.
-grep ':.*overrides.*ps' stderr && Exit 1
-
-# Test for another issue.  Overriding html: should cause only one
-# html: rule to be output.
-test `grep '^html:' Makefile.in | wc -l` = 1
-
-# ps: should be output in two conditions
-test `grep '[^-]ps:' Makefile.in | wc -l` = 2
-grep '@COND_TRUE@ps: mine' Makefile.in
-grep '@COND_FALSE@ps: ps-am' Makefile.in
diff --git a/tests/override-conditional-1.test b/tests/override-conditional-1.test
new file mode 100755 (executable)
index 0000000..54c2ca5
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test for conditionally-defined overrides.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+foobar:
+       : > $@
+if COND
+ps: foobar
+       :
+endif
+END
+
+$ACLOCAL
+$AUTOMAKE -Wno-override
+
+# "ps:" should be output in two conditions
+test `grep '[^-]ps:' Makefile.in | wc -l` = 2
+grep '@COND_TRUE@ps: *foobar' Makefile.in
+grep '@COND_FALSE@ps: *ps-am' Makefile.in
+
+$AUTOCONF
+
+./configure cond=no
+$MAKE ps
+test ! -r foobar
+
+./configure cond=yes
+$MAKE ps
+test -f foobar
+
+:
diff --git a/tests/override-conditional-2.test b/tests/override-conditional-2.test
new file mode 100755 (executable)
index 0000000..0fc88c2
--- /dev/null
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that conditional overrides are diagnosed.
+# This test is still xfailing; see the FIXME in Automake::Rule::define.
+# Once that is fixed, the test should succeed.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([COND], [:])
+END
+
+cat > Makefile.am << 'END'
+if COND
+all:
+       :
+endif
+END
+
+$ACLOCAL
+
+AUTOMAKE_fails
+grep ':.*overrides.*all' stderr
+
+:
similarity index 70%
rename from tests/ansi8.test
rename to tests/override-html.test
index bcf99b1..c2c5ec6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 that AM_C_PROTOTYPES is required by ansi2knr
+# Test that overriding `html' target causes only one "html:" rule to
+# be output.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
-bin_PROGRAMS = hello
+html:
+       :
 END
 
 $ACLOCAL
-AUTOMAKE_fails -Wno-obsolete -a
-grep AM_C_PROTOTYPES stderr
+$AUTOMAKE -Wno-override
+
+# Overriding `html' should cause only one "html:" rule to be output.
+test `grep '^html:' Makefile.in | wc -l` = 1
+
+:
diff --git a/tests/override-suggest-local.test b/tests/override-suggest-local.test
new file mode 100755 (executable)
index 0000000..535ccd0
--- /dev/null
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 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 automake -Woverride suggests using TARGET-local instead
+# of TARGET when possible.
+
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+install:
+       :
+installcheck:
+       :
+html:
+       :
+clean-am:
+       :
+END
+
+$ACLOCAL
+$AUTOMAKE -Wno-override
+AUTOMAKE_fails
+# There is no such thing as `install-local'.
+grep ':.*install-local' stderr && Exit 1
+grep ':.*installcheck-local' stderr
+grep ':.*html-local' stderr
+# Make sure overriding *-am targets suggest using *-local, not *-am.
+grep ':.*clean-am-local' stderr && Exit 1
+grep ':.*clean-local' stderr
+
+:
index 4aef628..453f7a5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 #
 # This test checks (0), (1), and (2).  See sister tests for further coverage.
 
+required=perl-threads
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([parallel-am], [1.0])
 AC_CONFIG_AUX_DIR([build-aux])
@@ -82,7 +81,7 @@ $ACLOCAL
 
 # Generate expected output using the non-threaded code.
 unset AUTOMAKE_JOBS || :
-AUTOMAKE_run --add-missing
+AUTOMAKE_run --add-missing
 mv stderr expected
 Makefile_ins=`find . -name Makefile.in`
 for file in $Makefile_ins; do
@@ -94,7 +93,7 @@ export AUTOMAKE_JOBS
 
 for run in 1 2 3 4 5 6 7; do
   rm -f build-aux/* sub*/Makefile.in
-  AUTOMAKE_run --add-missing
+  AUTOMAKE_run --add-missing
   diff stderr expected
   for file in $Makefile_ins; do
     diff $file $file.exp
index 20225a0..b51bd1f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 
 # This tests:
 # 4) warning and normal error output should be identical, in that duplicate
-#    warnings should be omitted in the same way as without threads,
+#    warnings should be omitted in the same way as without threads.
 
+required=perl-threads
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat > Makefile.am << 'END'
@@ -38,10 +37,10 @@ for i in $list; do
   echo "AC_CONFIG_FILES([sub$i/Makefile])" >> configure.in
   echo "SUBDIRS += sub$i" >> Makefile.am
   mkdir sub$i sub$i/sub
-  cat > sub$i/Makefile.am << END
-AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS = sub$i
-sub${i}_SOURCES = sub/main$i.c
+  unindent > sub$i/Makefile.am << END
+    AUTOMAKE_OPTIONS = subdir-objects
+    bin_PROGRAMS = sub$i
+    sub${i}_SOURCES = sub/main$i.c
 END
 done
 
index 5db9c67..732bd41 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 # This tests:
 # 3) normal automake output should be identical and ordered in the same way
 #    with --add-missing, even with concurrent file requirements, and the
-#    installation of aux files should be race-free,
+#    installation of aux files should be race-free.
 
+required=perl-threads
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([parallel-am], [1.0])
 AC_CONFIG_AUX_DIR([build-aux])
@@ -44,10 +43,10 @@ for i in $list; do
   echo "AC_CONFIG_FILES([sub$i/Makefile])" >> configure.in
   echo "SUBDIRS += sub$i" >> Makefile.am
   mkdir sub$i
-  cat > sub$i/Makefile.am <<END
-python_PYTHON = foo$i.py
-lisp_LISP = foo$i.el
-bin_PROGRAMS = p$i
+  unindent > sub$i/Makefile.am <<END
+    python_PYTHON = foo$i.py
+    lisp_LISP = foo$i.el
+    bin_PROGRAMS = p$i
 END
 done
 
@@ -58,7 +57,7 @@ $ACLOCAL
 
 # Generate expected output using the non-threaded code.
 unset AUTOMAKE_JOBS || :
-AUTOMAKE_run --add-missing
+AUTOMAKE_run --add-missing
 mv stderr expected
 mv Makefile.in Makefile.in.exp
 
@@ -67,7 +66,7 @@ export AUTOMAKE_JOBS
 
 for run in 1 2 3 4 5 6 7; do
   rm -f build-aux/* sub*/Makefile.in
-  AUTOMAKE_run --add-missing
+  AUTOMAKE_run --add-missing
   diff stderr expected
   diff Makefile.in Makefile.in.exp
 done
diff --git a/tests/parallel-tests-cmdline-override.test b/tests/parallel-tests-cmdline-override.test
new file mode 100755 (executable)
index 0000000..c12156e
--- /dev/null
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that we can use indirections when overriding TESTS and
+# TEST_LOGS from the command line.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .test .t
+TEST_LOG_COMPILER = cat
+T_LOG_COMPILER = cat
+TESTS = bad.test
+var1 = b.test $(var2)
+var2 = c.test
+var3 = d.d
+var4 = e
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+rm -f config.log # Do not create false positives below.
+
+cat > exp-log <<'END'
+a.log
+b.log
+c.log
+d.log
+e.log
+test-suite.log
+END
+
+cat > exp-out <<'END'
+PASS: a.t
+PASS: b.test
+PASS: c.test
+PASS: d.t
+PASS: e.test
+END
+
+do_check ()
+{
+  env "$@" $MAKE -e check >stdout || { cat stdout; Exit 1; }
+  cat stdout
+  grep '^PASS:' stdout | LC_ALL=C sort > got-out
+  cat got-out
+  ls . | grep '\.log$' | LC_ALL=C sort > got-log
+  cat got-log
+  st=0
+  diff exp-out got-out || st=1
+  diff exp-log got-log || st=1
+  return $st
+}
+
+tests='a.t $(var1) $(var3:.d=.t) $(var4:=.test)'
+test_logs='a.log $(var1:.test=.log) $(var3:.d=.log) $(var4:=.log)'
+
+touch a.t b.test c.test d.t e.test
+
+do_check TESTS="$tests"
+do_check TEST_LOGS="$test_logs"
+
+:
diff --git a/tests/parallel-tests-console-output.test b/tests/parallel-tests-console-output.test
new file mode 100755 (executable)
index 0000000..93c2429
--- /dev/null
@@ -0,0 +1,104 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# parallel-tests: some checks on console output about testsuite
+# progress.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+XFAIL_TESTS = sub/xpass.test xfail.test error.test
+TESTS = $(XFAIL_TESTS) fail.test pass.test a/b/skip.test sub/error2.test
+pass.log: fail.log
+error.log: pass.log
+sub/xpass.log: error.log
+sub/error2.log: xfail.log
+a/b/skip.log: sub/error2.log
+END
+
+cat > exp <<'END'
+FAIL: fail.test
+PASS: pass.test
+ERROR: error.test
+XPASS: sub/xpass.test
+XFAIL: xfail.test
+ERROR: sub/error2.test
+SKIP: a/b/skip.test
+END
+
+mkdir sub a a/b
+
+cat > pass.test << 'END'
+#!/bin/sh
+exit 0
+END
+cp pass.test sub/xpass.test
+
+cat > fail.test << 'END'
+#!/bin/sh
+exit 1
+END
+
+cat > xfail.test << 'END'
+#!/bin/sh
+# The sleep should ensure expected execution order of tests
+# even when make is run in parallel mode.
+# Creative quoting below to plase maintainer-check.
+sleep '10'
+exit 1
+END
+
+cat > error.test << 'END'
+#!/bin/sh
+exit 99
+END
+cp error.test sub/error2.test
+
+cat > a/b/skip.test << 'END'
+#!/bin/sh
+exit 77
+END
+
+chmod a+x pass.test fail.test xfail.test sub/xpass.test \
+          a/b/skip.test error.test sub/error2.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+for vpath in : false; do
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+  $srcdir/configure
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  LC_ALL=C grep '^[A-Z][A-Z]*:' stdout > got
+  cat got
+  diff $srcdir/exp got
+  cd $srcdir
+done
+
+:
diff --git a/tests/parallel-tests-driver-install.test b/tests/parallel-tests-driver-install.test
new file mode 100755 (executable)
index 0000000..4fa6dfd
--- /dev/null
@@ -0,0 +1,93 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that auxiliary script 'test-driver' gets automatically installed
+# in the correct directory by 'parallel-tests' option.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+: Try first with parallel-tests defined in AM_INIT_AUTOMAKE.
+
+mkdir am-init-automake
+cd am-init-automake
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([my_aux_dir])
+AM_INIT_AUTOMAKE([parallel-tests])
+AC_CONFIG_FILES([Makefile sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub my_aux_dir
+
+cat > Makefile.am <<END
+SUBDIRS = sub
+TESTS = foo.test
+END
+
+cat > sub/Makefile.am <<END
+TESTS = bar.test
+END
+
+$ACLOCAL
+$AUTOMAKE -a 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+ls -l . sub my_aux_dir # For debugging.
+test -f my_aux_dir/test-driver
+test ! -r test-driver
+test ! -r sub/test-driver
+
+grep '^configure\.in:3:.*installing.*my_aux_dir/test-driver' stderr
+
+cd ..
+
+: Now try with parallel-tests defined in AUTOMAKE_OPTIONS.
+
+mkdir automake-options
+cd automake-options
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([dir/GNUmakefile])
+AC_OUTPUT
+END
+
+mkdir build-aux dir
+
+cat > dir/GNUmakefile.am <<END
+TESTS = foo.test
+AUTOMAKE_OPTIONS = parallel-tests
+TESTS += bar.test
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing --copy dir/GNUmakefile 2>stderr \
+  || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+ls -l . dir build-aux # For debugging.
+test -f build-aux/test-driver
+test ! -r test-driver
+test ! -r dir/test-driver
+
+grep '^dir/GNUmakefile\.am:2:.*installing.*build-aux/test-driver' stderr
+
+:
similarity index 77%
rename from tests/parallel-tests-dryrun.test
rename to tests/parallel-tests-dry-run-1.test
index c79a293..27e62a0 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check parallel-tests interactions with "make -n".
+# See also sister test 'parallel-tests-dry-run-2.test'.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am <<'END'
@@ -38,8 +37,6 @@ $AUTOMAKE -a
 rm -f config.log
 
 log_files='test-suite.log foo.log bar.log'
-html_files='test-suite.html foo.html bar.html'
-the_files="$log_files $html_files"
 
 all_exist ()
 {
@@ -54,22 +51,25 @@ none_exist ()
 {
   st=0
   for i in $*; do
-    { test -r $i || test -f $i; } && { echo File $i found; st=1; }
+    if test -r $i || test -f $i; then
+      echo File $i found
+      st=1
+    fi
   done
   test $st -eq 0
 }
 
-for targ in check recheck check-html recheck-html $the_files; do
+for targ in check recheck $log_files; do
   $MAKE -n "$targ"
-  none_exist $the_files
+  none_exist $log_files
 done
 
-touch $the_files
+touch $log_files
 
 $MAKE -n mostlyclean
-all_exist $the_files
+all_exist $log_files
 $MAKE -n clean
-all_exist $the_files
+all_exist $log_files
 
 cat > foo.test <<'END'
 #! /bin/sh
@@ -85,9 +85,9 @@ chmod a+x foo.test bar.test
 
 $MAKE check && Exit 1
 
-for targ in recheck recheck-html clean mostlyclean distclean; do
+for targ in recheck clean mostlyclean distclean; do
   $MAKE -n "$targ"
-  all_exist $the_files
+  all_exist $log_files
 done
 
 :
diff --git a/tests/parallel-tests-dry-run-2.test b/tests/parallel-tests-dry-run-2.test
new file mode 100755 (executable)
index 0000000..1181689
--- /dev/null
@@ -0,0 +1,113 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check parallel-tests interactions with "make -n".
+# See also sister test 'parallel-tests-dry-run-1.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+TESTS = foo.test bar.test
+TEST_LOG_COMPILER = $(SHELL)
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+./configure
+
+make_n_ ()
+{
+  st=0
+  $MAKE -n "$@" >output 2>&1 || { cat output; ls -l; Exit 1; }
+  cat output
+  # Look out for possible errors from common tools used by recipes.
+  $EGREP -i ' (exist|permission|denied|no .*(such|file))' output && Exit 1
+  $EGREP '(mv|cp|rm|cat|grep|sed|awk): ' output && Exit 1
+  :
+}
+
+: > output
+
+files='foo.log bar.log foo.trs bar.trs'
+
+for target in check recheck test-suite.log; do
+  test ! -f foo.log
+  test ! -f foo.trs
+  test ! -f bar.log
+  test ! -f bar.trs
+  test ! -f test-suite.log
+done
+
+# Creative quoting below to please maintainer-check.
+echo exit '0' > foo.test
+echo exit '1' > bar.test
+
+$MAKE check && Exit 1
+
+chmod a-w .
+
+make_n_ clean
+test -f foo.log
+test -f foo.trs
+test -f foo.log
+test -f bar.trs
+
+# Creative quoting below to please maintainer-check.
+cat > foo.test <<END
+echo this is bad
+exit 1
+END
+echo exit '0' > bar.test
+
+for target in check recheck test-suite.log; do
+  make_n_ $target
+  grep '^:test-result: *FAIL' bar.trs
+  grep 'this is bad' foo.log test-suite.log && Exit 1
+  : For shells with busted 'set -e'.
+done
+
+chmod a-rw $files
+if test -r foo.log; then
+  : You can still read unreadable files!  Skip these checks.
+else
+  for target in check recheck test-suite.log; do
+    make_n_ $target
+    for f in $files; do
+      test -f $f && test ! -r $f || Exit 1
+    done
+  done
+fi
+chmod u+r $files
+
+chmod u+w .
+rm -f foo.log bar.trs
+chmod a-w .
+for target in check recheck test-suite.log $files; do
+  make_n_ $target
+  test ! -f foo.log
+  test -f foo.trs
+  test ! -f bar.trs
+  test -f bar.log
+done
+
+:
diff --git a/tests/parallel-tests-empty-testlogs.test b/tests/parallel-tests-empty-testlogs.test
new file mode 100755 (executable)
index 0000000..ea8e705
--- /dev/null
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check parallel-tests features:
+# - empty TESTS
+# - empty TEST_LOGS
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub1 sub2
+END
+
+mkdir sub1 sub2
+
+cat > sub1/Makefile.am << 'END'
+TESTS =
+check-local:
+       echo $(TEST_LOGS) | grep . && exit 1; exit 0
+END
+
+cat > sub2/Makefile.am << 'END'
+TESTS = foo.test
+END
+
+cat > sub2/foo.test <<'END'
+#! /bin/sh
+exit 0
+END
+chmod a+x sub2/foo.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+no_test_has_run ()
+{
+  ls -1 *.log | grep -v '^test-suite\.log$' | grep . && Exit 1
+  grep '^# TOTAL: *0$' test-suite.log
+  :
+}
+
+for vpath in : false; do
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+  $srcdir/configure
+  cd sub1
+  VERBOSE=yes $MAKE check
+  no_test_has_run
+  cd ../sub2
+  VERBOSE=yes TESTS='' $MAKE -e check
+  no_test_has_run
+  VERBOSE=yes TEST_LOGS='' $MAKE -e check
+  no_test_has_run
+  cd ..
+  $MAKE check
+  cat sub2/foo.log
+  $MAKE distclean
+  cd $srcdir
+done
+
+:
diff --git a/tests/parallel-tests-exeext.test b/tests/parallel-tests-exeext.test
new file mode 100755 (executable)
index 0000000..9275a56
--- /dev/null
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# parallel-tests:
+#   - check2.am and interaction with $(EXEEXT)
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+dnl We need to fool the init.m4 internals a little.
+AC_DEFUN([_AM_FOO],
+  [m4_provide([_AM_COMPILER_EXEEXT])
+  AC_SUBST([CC], [false])
+  AC_SUBST([EXEEXT])])
+_AM_FOO
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = x y a.test b.test
+LOG_COMPILER = true
+TEST_LOG_COMPILER = true
+## We also need to fool the automake internals a little.
+EXTRA_PROGRAMS = y
+y_SOURCES =
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+$EGREP 'EXEEXT|\.log|\.test' Makefile.in # For debugging.
+
+./configure EXEEXT=
+touch x y a.test b.test
+$MAKE check
+
+$MAKE distclean
+rm -f x y a.test b.test *.log *.trs
+
+./configure EXEEXT=.bin
+touch x y.bin a.test b.test.bin
+$MAKE check
+ls -l # For debugging.
+test -f y.log
+test ! -r y.bin.log
+test -f b.log
+test ! -r b.test.log
+
+$EGREP '^y\.log: y(\$\(EXEEXT\)|\.bin)' Makefile
+$EGREP '^\.test(\$\(EXEEXT\)|\.bin)\.log:' Makefile
+
+:
diff --git a/tests/parallel-tests-exit-statuses.test b/tests/parallel-tests-exit-statuses.test
new file mode 100755 (executable)
index 0000000..a2e56a4
--- /dev/null
@@ -0,0 +1,102 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check parallel-tests features: normal and special exit statuses
+# in the test scripts.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+# $failure_statuses should be defined to the list of all integers between
+# 1 and 255 (inclusive), excluded 77 and 99.
+failure_statuses=`seq_ 1 255 | $EGREP -v '^(77|99)$' | tr "$nl" ' '`
+# For debugging.
+echo "failure_statuses: $failure_statuses"
+# Sanity check.
+test `for st in $failure_statuses; do echo $st; done | wc -l` -eq 253 \
+  || fatal_ "initializing list of exit statuses for simple failures"
+
+cat > Makefile.am <<END
+LOG_COMPILER = ./do-exit
+fail_tests = $failure_statuses
+TESTS = 0 77 99 $failure_statuses
+\$(TESTS):
+END
+
+cat > do-exit <<'END'
+#!/bin/sh
+echo "$0: $1"
+case $1 in
+  [0-9]|[0-9][0-9]|[0-9][0-9][0-9]) st=$1;;
+  */[0-9]|*/[0-9][0-9]|*/[0-9][0-9][0-9]) st=`echo x"$1" | sed 's|.*/||'`;;
+  *) st=99;;
+esac
+exit $st
+END
+chmod a+x do-exit
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+{
+  echo PASS: 0
+  echo SKIP: 77
+  echo ERROR: 99
+  for st in $failure_statuses; do
+    echo "FAIL: $st"
+  done
+} | LC_ALL=C sort > exp-fail
+
+sed 's/^FAIL:/XFAIL:/' exp-fail | LC_ALL=C sort > exp-xfail-1
+sed '/^ERROR:/d' exp-xfail-1 > exp-xfail-2
+
+sort exp-fail
+sort exp-xfail-1
+sort exp-xfail-2
+
+./configure
+
+st=1
+$MAKE check >stdout && st=0
+cat stdout
+cat test-suite.log
+test $st -gt 0 || Exit 1
+LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-fail
+diff exp-fail got-fail
+
+st=1
+XFAIL_TESTS="$failure_statuses 99" $MAKE -e check >stdout && st=0
+cat stdout
+cat test-suite.log
+test $st -gt 0 || Exit 1
+LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-xfail-1
+diff exp-xfail-1 got-xfail-1
+
+st=0
+XFAIL_TESTS="$failure_statuses" TESTS="0 77 $failure_statuses" \
+  $MAKE -e check >stdout || st=$?
+cat stdout
+cat test-suite.log
+test $st -eq 0 || Exit 1
+LC_ALL=C grep '^[A-Z][A-Z]*:' stdout | LC_ALL=C sort > got-xfail-2
+diff exp-xfail-2 got-xfail-2
+
+:
diff --git a/tests/parallel-tests-extra-programs.test b/tests/parallel-tests-extra-programs.test
new file mode 100755 (executable)
index 0000000..aa99cb3
--- /dev/null
@@ -0,0 +1,174 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Parallel test harness: check that $(TESTS) can lazily depend on
+# (or even be) $(EXTRA_PROGRAMS).
+
+required='cc native'
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+# Will be extended later.
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .bin .test
+EXTRA_PROGRAMS =
+TESTS =
+END
+
+#
+# Now try various kinds of test dependencies ...
+#
+
+# 1. A program that is also a test, and whose source files
+#    already exist.
+
+cat >> Makefile.am <<'END'
+EXTRA_PROGRAMS += foo.bin
+TESTS += foo.bin
+foo_bin_SOURCES = foo.c
+END
+
+cat > foo.c <<'END'
+#include <stdio.h>
+int main (void)
+{
+  printf ("foofoofoo\n");
+  return 0;
+}
+END
+
+# 2. A program that is also a test, and whose source files
+#    are buildable by make.
+cat >> Makefile.am <<'END'
+EXTRA_PROGRAMS += bar.bin
+TESTS += bar.bin
+bar_bin_SOURCES = bar.c
+bar.c: foo.c
+       sed -e 's/foofoofoo/barbarbar/' foo.c > $@
+END
+
+# 3. A test script that already exists, whose execution depends
+#    on a program whose source files already exist and which is
+#    not itself a test.
+cat >> Makefile.am <<'END'
+EXTRA_PROGRAMS += y
+TESTS += baz.test
+baz.log: y$(EXEEXT)
+END
+
+cat > baz.test <<'END'
+#!/bin/sh
+$srcdir/y "$@" | sed 's/.*/&ep&ep&ep/'
+END
+chmod a+x baz.test
+
+cat > y.c <<'END'
+#include <stdio.h>
+int main (void)
+{
+  printf ("y\n");
+  return 0;
+}
+END
+
+# 4. A program that is also a test, but whose source files
+#    do not exit and are not buildable by make.
+
+cat >> Makefile.am <<'END'
+EXTRA_PROGRAMS += none.bin
+TESTS += none.bin
+none_bin_SOURCES = none.c
+END
+
+#
+# Setup done, go with the tests.
+#
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+# What we check now:
+#  1. even if we cannot build the `none.bin' program, all the other
+#     test programs should be built, and all the other tests should
+#     be run;
+#  2. still, since we cannot create the `none.log' file, the
+#    `test-suite.log' file shouldn't be created (as it depends
+#     on *all* the test logs).
+
+st=0
+$MAKE check >stdout 2>stderr || st=$?
+cat stdout
+cat stderr >&2
+ls -l
+test $st -gt 0 || Exit 1
+
+# Files that should have been created, with the expected content.
+cat bar.c
+grep foofoofoo foo.log
+grep barbarbar bar.log
+grep yepyepyep baz.log
+# Files that shouldn't have been created.
+test ! -f none.log
+test ! -f test-suite.log
+# Expected testsuite progress output.
+grep '^PASS: baz\.test$' stdout
+# Don't anchor the end of the next two patterns, to allow for non-empty
+# $(EXEEXT).
+grep '^PASS: foo\.bin' stdout
+grep '^PASS: bar\.bin' stdout
+# Expected error messages from make.
+$EGREP 'none\.(bin|o|c)' stderr
+
+# What we check now:
+#  1. if we make the last EXTRA_PROGRAM buildable, the failed tests
+#     pass;
+#  2. on a lazy re-run, the passed tests are not re-run, and
+#  3. their log files are not updated or touched.
+
+: > stamp
+$sleep
+
+echo 'int main (void) { return 0; }' > none.c
+
+st=0
+RECHECK_LOGS= $MAKE -e check >stdout || st=$?
+cat stdout
+ls -l
+test $st -eq 0 || Exit 1
+
+# For debugging.
+stat stamp foo.log bar.log baz.log || :
+
+# Files that shouldn't have been updated or otherwise touched.
+is_newest stamp foo.log bar.log baz.log
+# Files that should have been created now.
+test -f none.log
+test -f test-suite.log
+# Tests that shouldn't have been re-run.
+$EGREP '(foo|bar)\.bin|baz\.test$' stdout && Exit 1
+# Tests that should have been run.  Again, we don't anchor the end
+# of the next pattern, to allow for non-empty $(EXEEXT).
+grep '^PASS: none\.bin' stdout
+
+:
diff --git a/tests/parallel-tests-fd-redirect-exeext.test b/tests/parallel-tests-fd-redirect-exeext.test
new file mode 100755 (executable)
index 0000000..4426604
--- /dev/null
@@ -0,0 +1,118 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# parallel-tests support: redirection of file descriptors with
+# AM_TESTS_FD_REDIRECT, for tests which are binary executables
+# We use some tricks to ensure that all code paths in `lib/am/check2.am'
+# are covered, even on platforms where $(EXEEXT) would be naturally empty.
+# See also the more generic test 'check-fd-redirect.test', and
+# sister test 'parallel-tests-fd-redirect.test'.
+
+required='cc native'
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+# Calls like "write(9, ...)" are unlikely to work for MinGW-compiled
+# programs.  We must skip this test if this is the case.
+am__ok=no
+AC_LINK_IFELSE(
+    [AC_LANG_PROGRAM([[#include <unistd.h>]],
+                     [[write (9, "foobar\n", 7); return 0;]])],
+    [AM_RUN_LOG([./conftest$EXEEXT 9>&1]) \
+dnl Leading ":;" required to avoid having two nested subshells starting
+dnl with '((' in the generated configure: that is unportable and could
+dnl confuse some shells (e.g., NetBSD 5.1 /bin/ksh) into thinking we are
+dnl trying to perform an arithmetic operation.
+       && AM_RUN_LOG([:; (./conftest$EXEEXT 9>&1) | grep "^foobar"]) \
+       && am__ok=yes])
+test $am__ok = yes || AS_EXIT([63])
+AM_CONDITIONAL([real_EXEEXT], [test -n "$EXEEXT"])
+test -n "$EXEEXT" || EXEEXT=.bin
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_TESTS_FD_REDIRECT = 9>&1
+TESTS = $(check_PROGRAMS)
+check_PROGRAMS = baz qux.test
+qux_test_SOURCES = zardoz.c
+
+## Sanity check.
+if !real_EXEEXT
+check-local:
+       test -f baz.bin
+       test -f qux.test.bin
+endif
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+cat > baz.c <<'END'
+#include <stdio.h>
+#include <unistd.h>
+int main (void)
+{
+  ssize_t res = write (9, " bazbazbaz\n", 11);
+  if (res < 0)
+    perror("write failed");
+  return res != 11;
+}
+END
+
+cat > zardoz.c <<'END'
+#include <stdio.h>
+#include <unistd.h>
+int main (void)
+{
+  ssize_t res = write (9, " quxquxqux\n", 11);
+  if (res < 0)
+    perror("write failed");
+  return res != 11;
+}
+END
+
+st=0; ./configure || st=$?
+cat config.log # For debugging, as we do tricky checks in configure.
+if test $st -eq 63; then
+  skip_ "fd redirect in compiled program unsupported"
+elif test $st -eq 0; then
+  : Continue.
+else
+  fatal_ "unexpected error in ./configure"
+fi
+
+# Sanity checks.
+st=0
+grep '^baz\.log:.*baz\$(EXEEXT)' Makefile || st=1
+grep '^\.test\$(EXEEXT)\.log:' Makefile || st=1
+grep '^qux\.log:' Makefile && st=1
+test $st -eq 0 || fatal_ "doesn't cover expected code paths"
+
+st=0
+$MAKE check >stdout || st=1
+cat stdout
+cat baz.log
+cat qux.log
+test $st -eq 0
+grep "^ bazbazbaz$" stdout
+grep "^ quxquxqux$" stdout
+$EGREP '(bazbazbaz|quxquxqux)' *.log && Exit 1
+
+:
diff --git a/tests/parallel-tests-fd-redirect.test b/tests/parallel-tests-fd-redirect.test
new file mode 100755 (executable)
index 0000000..f22b31a
--- /dev/null
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# parallel-tests support: redirection of file descriptors with
+# AM_TESTS_FD_REDIRECT, even when using tests without suffix.
+# The sister `parallel-tests-fd-redirect-exeext.test' do a similar
+# check for tests that are binary executables.
+# See also the more generic test 'check-fd-redirect.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_TESTS_FD_REDIRECT = 9>&1
+TEST_EXTENSIONS = .test .sh
+TESTS = foo.sh bar
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+cat > foo.sh <<'END'
+#!/bin/sh
+echo " foofoofoo" >&9
+END
+chmod a+x foo.sh
+
+cat > bar <<'END'
+#!/bin/sh
+echo " barbarbar" >&9
+END
+
+chmod a+x foo.sh bar
+
+./configure
+
+# Sanity checks.
+st=0
+grep '^bar\.log:.*bar' Makefile || st=1
+grep '^foo\.log:' Makefile && st=1
+test $st -eq 0 || fatal_ "doesn't cover expected code paths"
+
+st=0; $MAKE check >stdout || st=1
+cat stdout
+cat foo.log
+cat bar.log
+test $st -eq 0
+grep "^ foofoofoo$" stdout
+grep "^ barbarbar$" stdout
+$EGREP '(foofoofoo|barbarbar)' *.log && Exit 1
+
+:
diff --git a/tests/parallel-tests-fork-bomb.test b/tests/parallel-tests-fork-bomb.test
new file mode 100755 (executable)
index 0000000..5180ada
--- /dev/null
@@ -0,0 +1,144 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check parallel-tests features:
+#  - If $(TEST_SUITE_LOG) is in $(TEST_LOGS), we get a diagnosed
+#    error, not a make hang or a system freeze.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+# The tricky part of this test is to avoid that make hangs or even
+# freezes the system in case infinite recursion (which is the bug we
+# are testing against) is encountered.  The following hacky makefile
+# should minimize the probability of that happening.
+cat > Makefile.am << 'END'
+TEST_LOG_COMPILER = true
+TESTS =
+
+errmsg = ::OOPS:: Recursion too deep
+
+if IS_GNU_MAKE
+
+ is_too_deep := $(shell test $(MAKELEVEL) -lt 10 && echo no)
+
+## Indenteation here required to avoid confusing Automake.
+ ifeq ($(is_too_deep),no)
+ else
+ $(error $(errmsg), $(MAKELEVEL) levels)
+ endif
+
+else !IS_GNU_MAKE
+
+# We use mkdir to detect the level of recursion, since it is easy
+# to use and assured to be portably atomical.  Also use an higher
+# number than with GNU make above, since the level used here can
+# be incremented by tow or more per recursion.
+recursion-not-too-deep:
+       @ok=no; \
+       for i in 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 \
+                18 19 20 21 22 23 24 25 26 27 28 29; \
+       do \
+         echo " mkdir rec-$$i.d"; \
+         if mkdir rec-$$i.d; then \
+           ok=yes; break; \
+         else :; fi; \
+       done; \
+       test $$ok = yes || { echo '$(errmsg)' >&2; exit 1; }
+.PHONY: recursion-not-too-deep
+clean-local:
+       rmdir rec-[0-9].d
+
+targets = all check recheck $(TESTS) $(TEST_LOGS) $(TEST_SUITE_LOG)
+$(targets): recursion-not-too-deep
+
+# For BSD make.
+.BEGIN: recursion-not-too-deep
+
+endif !IS_GNU_MAKE
+END
+
+if using_gmake; then
+  cond=:
+else
+  cond=false
+fi
+
+cat >> configure.in << END
+AM_CONDITIONAL([IS_GNU_MAKE], [$cond])
+AC_OUTPUT
+END
+
+# Another helpful idiom to avoid hanging on capable systems.  The subshell
+# is needed since `ulimit' might be a special shell builtin.
+if (ulimit -t 8); then ulimit -t 8; fi
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a -Wno-portability
+
+./configure
+
+do_check ()
+{
+  st=0
+  log=$1; shift
+  env "$@" $MAKE -e check >output 2>&1 || st=$?
+  cat output
+  $FGREP '::OOPS::' output && Exit 1 # Possible infinite recursion.
+  # Check that at least we don't create a botched global log file.
+  test ! -f "$log"
+  if using_gmake; then
+    grep "[Cc]ircular.*dependency" output | $FGREP "$log"
+    test $st -gt 0
+  else
+    # Look for possible error messages about circular dependencies from
+    # either make or our own recipes.  At least one such a message must
+    # be present.  OTOH, some make implementations (e.g., NetBSD's), while
+    # smartly detecting the circular dependency early and diagnosing it,
+    # still exit with a successful exit status (yikes!).  So don't check
+    # the exit status of non-GNU make, to avoid spurious failures.
+    # this case.
+    err_seen=no
+    for err_rx in \
+      'circular.* depend' \
+      'depend.* circular' \
+      'graph cycle' \
+      'infinite (loop|recursion)' \
+      'depend.* on itself' \
+    ; do
+      $EGREP -i "$err_rx" output | $FGREP "$log" || continue
+      err_seen=yes
+      break
+    done
+    test $err_seen = yes || Exit 1
+  fi
+}
+
+: > test-suite.test
+do_check test-suite.log TESTS=test-suite.test
+rm -f *.log *.test
+
+: > 0.test
+: > 1.test
+: > 2.test
+: > 3.test
+: > foobar.test
+do_check foobar.log TEST_LOGS='0.log 1.log foobar.log 2.log 3.log' \
+                    TEST_SUITE_LOG=foobar.log
+rm -f *.log *.test
+
+:
index 8680e29..3d453d2 100755 (executable)
 
 # Check parallel-tests features: DISABLE_HARD_ERRORS
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
@@ -69,13 +67,13 @@ DISABLE_HARD_ERRORS=x $MAKE check
 
 $MAKE check DISABLE_HARD_ERRORS='' && Exit 1
 cat test-suite.log
-grep '^FAIL: foo\.test .*exit.*99' test-suite.log
+grep '^ERROR: foo$' test-suite.log
 
 cd sub
 # The `-e' is wanted here.
 DISABLE_HARD_ERRORS='' $MAKE -e check && Exit 1
 cat test-suite.log
-grep '^FAIL: bar\.test .*exit.*99' test-suite.log
+grep '^ERROR: bar$' test-suite.log
 cd ..
 
 # Check the distributions.
@@ -90,7 +88,7 @@ $AUTOMAKE Makefile
 ./config.status Makefile
 VERBOSE=yes $MAKE check && Exit 1
 grep '^FAIL' test-suite.log && Exit 1
-grep '^FAIL: bar\.test .*exit.*99' sub/test-suite.log
+grep '^ERROR: bar$' sub/test-suite.log
 
 echo 'DISABLE_HARD_ERRORS = zardoz' >> sub/Makefile
 VERBOSE=yes $MAKE check
diff --git a/tests/parallel-tests-interrupt.tap b/tests/parallel-tests-interrupt.tap
new file mode 100755 (executable)
index 0000000..74b418d
--- /dev/null
@@ -0,0 +1,117 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check that the parallel-tests driver removed incomplete log files
+# when interrupt upon some signal.  This test is definitely too hacky,
+# but we couldn't find a better way to deal with inter-processes
+# signals and the whole process-synchronization mess.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+plan_ 16
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = foo.test
+## Provide more debugging info.
+TEST_LOG_COMPILER = $(SHELL) -x
+## Required by foo.test; see below.
+AM_TESTS_FD_REDIRECT = 9>&1
+END
+
+# This is hacky and ugly, but has the great advantage of avoiding us a lot
+# of pain with background processes and related synchronization issues.
+
+cat - "$am_scriptdir"/test-driver > test-driver <<'END'
+#!/bin/sh
+echo $$ > pid
+END
+
+cat > foo.test << 'END'
+#!/bin/sh -e
+
+# We expect the test driver to be terminated by a signal, and so
+# to exit with non-zero status, thus causing "make check" to fail.
+# Exiting with status 0 from this test script is thus a good way to
+# make unexpected behaviours more evident, since this will likely
+# cause and unexpected success in "make check".
+trap 'exit 0' 0;
+stop_test () { exit 0; }
+
+# We need the "foo is starting to run" string flushed to standard output
+# ASAP, because we are soon going to grep for that string in the log file
+# where the test driver is redirecting this script's stdout.  The safest
+# way force this flushing portably is to rely on perl I/O capabilities.
+$PERL -e 'BEGIN { $| = 1 }; print "foo is starting to run\n"' || stop_test
+
+ls -l >&9 || stop_test
+
+bailout ()
+{
+  # Print this to the original stdout (saved in the fd 9), so that the
+  # emitted "Bail out!" directive will be interpreted by the test driver
+  # running the Automake testsuite.
+  echo "Bail out! $*" >&9
+  stop_test
+}
+
+test $sig -gt 0 || bailout "\$sig not exported to test script"
+
+res=ok; cat foo.log >&9 || res="not ok"
+echo "$res - logfile created and readable [SIG $sig]" >&9
+
+res=ok; grep '^foo is starting to run$' foo.log >&9 || res='not ok'
+echo "$res - logfile contains output from test script [SIG $sig]" >&9
+
+cat pid >&9 || bailout "cannot get PID of test driver"
+kill -$sig `cat pid` || bailout "cannot send signal $sig to test driver"
+
+stop_test
+END
+chmod a+x foo.test
+
+$ACLOCAL  || fatal_ "aclocal failed"
+$AUTOCONF || fatal_ "autoconf failed"
+$AUTOMAKE || fatal_ "automake failed"
+
+./configure || fatal_ "./configure failed"
+
+# The only signals that can be trapped portable are 1 "SIGHUP",
+# 2 "SIGINT", 13 "SIGPIPE" and 15 "SIGTERM".
+trapped_signals='1 2 13 15'
+
+for sig in $trapped_signals; do
+  if is_blocked_signal $sig; then
+    for i in 1 2 3 4; do echo "ok # SKIP signal $sig is blocked"; done
+    continue
+  fi
+  rm -f pid fail *.log
+  r=ok; env PERL="$PERL" sig="$sig" $MAKE check && r='not ok'
+  echo "$r - signal $sig to test driver causes \"make check\" to fail"
+  ls -l
+  # These files shouldn't exist, but in case they do, their content might
+  # provide helpful information about the causes of the failure(s).
+  cat foo.log || :
+  cat test-suite.log || :
+  r=ok; ls | $EGREP 'foo.*\.(log|tmp)' && r='not ok'
+  echo "$r - test driver clean up log and tmp files after signal $sig"
+done
+
+:
diff --git a/tests/parallel-tests-log-compiler-1.test b/tests/parallel-tests-log-compiler-1.test
new file mode 100755 (executable)
index 0000000..2618177
--- /dev/null
@@ -0,0 +1,126 @@
+#! /bin/sh
+# Copyright (C) 2009, 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/>.
+
+# Check parallel-tests features:
+# - per-extension "test runners" a.k.a. "log compilers" (xxx_LOG_COMPILER
+#   and xxx_LOG_FLAGS), also with AC_SUBST'd stuff.
+# See also related test 'parallel-tests-log-compiler-2.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_SUBST([acsubst_compiler], [t-compiler])
+AC_CONFIG_LINKS([chk-compiler:chk-compiler])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# Note that automake should not match the '/test' part of 'sub/test'
+# as '.test' suffix.
+TESTS = foo.chk bar.test baz bla.t bli.suff sub/test
+
+TEST_EXTENSIONS = .chk .test .t
+
+CHK_LOG_COMPILER = ./chk-compiler
+TEST_LOG_COMPILER = $(SHELL) $(srcdir)/test-compiler
+T_LOG_COMPILER = @acsubst_compiler@
+LOG_COMPILER = @SHELL@ -x $(srcdir)/noext-compiler
+
+CHK_LOG_FLAGS = --chk
+
+AM_TEST_LOG_FLAGS = --am-test
+
+T_LOG_FLAGS = --t
+AM_T_LOG_FLAGS = --am-t
+
+AM_LOG_FLAGS = -a
+LOG_FLAGS = -b
+
+# `t-compiler' is deliberately not distributed; it should be available
+# in PATH also from "make distcheck".
+EXTRA_DIST = $(TESTS) chk-compiler test-compiler noext-compiler
+END
+
+mkdir sub
+
+cat > chk-compiler <<'END'
+#! /bin/sh
+test x"$1" = x"--chk" || {
+  echo "$0: invalid command line: $*" >&2
+  exit 1
+}
+shift
+exec "$@"
+exit 127
+END
+sed 's/--chk/--am-test/' chk-compiler > test-compiler
+
+mkdir bin
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+
+cat > bin/t-compiler <<'END'
+#! /bin/sh
+if test x"$1,$2" != x"--am-t,--t"; then
+  echo "$0: invalid command line: $*" >&2
+  exit 1
+fi
+shift; shift
+exec "$@"
+exit 127
+END
+sed 's/--am-t,--t/-a,-b/' bin/t-compiler > noext-compiler
+
+chmod a+x chk-compiler chk-compiler test-compiler bin/t-compiler noext-compiler
+
+cat >foo.chk << 'END'
+#! /bin/sh
+exit 0
+END
+chmod a+x foo.chk
+cp foo.chk bar.test
+cp foo.chk baz
+cp foo.chk bla.t
+cp foo.chk bli.suff
+cp foo.chk sub/test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE check || { cat test-suite.log; Exit 1; }
+ls -l . sub
+cat test-suite.log
+test -f foo.log
+test -f bar.log
+test -f baz.log
+test -f bla.log
+test -f bli.suff.log
+test -f sub/test.log
+
+T_LOG_FLAGS=--bad $MAKE -e check && Exit 1
+cat test-suite.log
+cat bla.log
+# With the above flag overridden, bla.t should fail ...
+$EGREP '(^ *|/)t-compiler:.* invalid .*--bad' bla.log
+# ... but no other test should.
+grep -v '^FAIL: bla\.t ' bla.log | grep 'FAIL:' && Exit 1
+
+# Try also with a VPATH build.
+$MAKE distcheck
+
+:
similarity index 63%
rename from tests/parallel-tests7.test
rename to tests/parallel-tests-log-compiler-2.test
index d01ada1..a279abd 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check parallel-tests features:
-# - per-extension test drivers
+# - per-extension "test runners" a.k.a. "log compilers" (xxx_LOG_COMPILER
+#   and xxx_LOG_FLAGS), when some tests are PROGRAMS.
+# See also related test 'parallel-tests-log-compiler-1.test'.
 
-parallel_tests=yes
+am_parallel_tests=yes
+required='cc native'
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
@@ -32,9 +34,9 @@ cat > Makefile.am << 'END'
 TESTS = foo.chk bar.test $(check_PROGRAMS) sub/test
 check_PROGRAMS = baz bla.test bli.suff
 TEST_EXTENSIONS = .chk .test
-CHK_LOG_COMPILER = ./chk-driver
-TEST_LOG_COMPILER = ./test-driver
-LOG_COMPILER = ./noext-driver
+CHK_LOG_COMPILER = ./chk-compiler
+TEST_LOG_COMPILER = ./test-compiler
+LOG_COMPILER = ./noext-compiler
 AM_CHK_LOG_FLAGS = 1
 CHK_LOG_FLAGS = 2
 AM_TEST_LOG_FLAGS = 3
@@ -45,7 +47,7 @@ END
 
 mkdir sub
 
-cat >chk-driver <<'END'
+cat >chk-compiler <<'END'
 #! /bin/sh
 echo $0 "$@"
 shift
@@ -53,9 +55,9 @@ shift
 exec "$@"
 exit 127
 END
-chmod a+x chk-driver
-cp chk-driver test-driver
-cp chk-driver noext-driver
+chmod a+x chk-compiler
+cp chk-compiler test-compiler
+cp chk-compiler noext-compiler
 
 cat >foo.chk << 'END'
 #! /bin/sh
@@ -79,12 +81,16 @@ $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
+
 $MAKE
-$MAKE check
-grep 'chk-driver  *1  *2' foo.log
-grep 'test-driver  *3  *4' bar.log
-grep 'noext-driver  *5  *6' baz.log
-grep 'test-driver  *3  *4' bla.log
-grep 'noext-driver  *5  *6' bli.suff.log
-grep 'noext-driver  *5  *6' sub/test.log
+$MAKE check || { cat test-suite.log; Exit 1; }
+ls -l . sub
+cat test-suite.log
+grep 'chk-compiler  *1  *2' foo.log
+grep 'test-compiler  *3  *4' bar.log
+grep 'noext-compiler  *5  *6' baz.log
+grep 'test-compiler  *3  *4' bla.log
+grep 'noext-compiler  *5  *6' bli.suff.log
+grep 'noext-compiler  *5  *6' sub/test.log
+
 :
index 746c128..91fe5b5 100755 (executable)
 # Test the example of usage of generic and extension-specific
 # LOG_COMPILER and LOG_FLAGS given in the manual.
 
-parallel_tests=yes
+am_parallel_tests=yes
 required=python
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<END
 AC_SUBST([PERL], ['$PERL'])
 AM_PATH_PYTHON
index 6e98380..1b007d7 100755 (executable)
 
 # Check parallel-tests features: runtime redefinition of $(TEST_SUITE_LOG).
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
index 649360c..da7366b 100755 (executable)
 #  - $(TEST_SUITE_LOG) and $(TESTS)
 #  - $(TEST_SUITE_LOG) and $(TEST_LOGS)
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
@@ -67,6 +65,7 @@ do
     $MAKE -e check >stdout || { cat stdout; Exit 1; }
   cat stdout
   ls -l
+  count_test_results total=2 pass=1 fail=0 skip=1 xfail=0 xpass=0 error=0
   cat pass.log
   cat skip.log
   cat partial.log
@@ -74,14 +73,12 @@ do
   test ! -f pass2.log
   test ! -f skip2.log
   test ! -f fail.log
-  grep '^PASS: .*pass\.test' stdout
-  grep '^SKIP: .*skip\.test' stdout
-  $FGREP 'skip.test' partial.log
+  grep '^PASS: pass\.test$' stdout
+  grep '^SKIP: skip\.test$' stdout
+  $FGREP 'SKIP: skip' partial.log
   $FGREP '% skipped test %' partial.log
-  for t in pass2 skip2 fail; do
-    $FGREP "$t.test" stdout && Exit 1
-    $FGREP "$t.test" partial.log && Exit 1
-  done
+  $EGREP '(pass2|skip2|fail)\.test' stdout && Exit 1
+  $EGREP '(pass2|skip2|fail)' partial.log && Exit 1
   rm -f *.log
 done
 
index 8a50d29..b969906 100755 (executable)
 # Check parallel-tests features: runtime redefinition of $(TEST_SUITE_LOG)
 # for the recheck target.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
-TESTS = foo.test bar.test baz.test
+TESTS = foofoo.test barbar.test bazbaz.test
 END
 
-cat > foo.test <<'END'
+cat > foofoo.test <<'END'
 #! /bin/sh
 echo "this is $0"
 exit 0
 END
 
-cat > bar.test <<'END'
+cat > barbar.test <<'END'
 #! /bin/sh
 echo "this is $0"
 exit 99
 END
 
-cat > baz.test <<'END'
+cat > bazbaz.test <<'END'
 #! /bin/sh
 echo "this is $0"
 exit ${BAZ_EXIT_STATUS-1}
@@ -56,6 +54,13 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
+# Filter make output before grepping it, for make implementations that,
+# like Solaris' one, print the whole of the failed recipe on failure.
+filter_stdout ()
+{
+  grep -v 'bases=.*;' stdout > t && mv -f t stdout
+}
+
 ./configure
 $MAKE check >stdout && { cat stdout; Exit 1; }
 cat stdout
@@ -65,11 +70,12 @@ TEST_SUITE_LOG=my.log $MAKE -e recheck >stdout \
   && { cat stdout; Exit 1; }
 cat stdout
 ls -l
-grep '^2 of 2 .*failed' stdout
+filter_stdout
+count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
 for x in stdout my.log; do
-  $FGREP foo.test $x && Exit 1
-  $FGREP bar.test $x
-  $FGREP baz.test $x
+  $FGREP foofoo $x && Exit 1
+  $FGREP barbar $x
+  $FGREP bazbaz $x
 done
 
 chmod a-rw my.log
@@ -77,16 +83,17 @@ BAZ_EXIT_STATUS=0 TEST_SUITE_LOG=my2.log $MAKE -e recheck >stdout \
   && { cat stdout; Exit 1; }
 cat stdout
 ls -l
-grep '^1 of 2 .*failed' stdout
-$FGREP foo.test stdout && Exit 1
-$FGREP bar.test stdout
-$FGREP baz.test stdout
-$FGREP foo.test my2.log && Exit 1
-$FGREP bar.test my2.log
-$FGREP baz.test my2.log && Exit 1
+count_test_results total=2 pass=1 fail=0 skip=0 xfail=0 xpass=0 error=1
+filter_stdout
+$FGREP foofoo stdout && Exit 1
+$FGREP barbar stdout
+$FGREP bazbaz stdout
+$FGREP foofoo my2.log && Exit 1
+$FGREP barbar my2.log
+$FGREP bazbaz my2.log && Exit 1
 
 chmod u+r test-suite.log my.log
-$FGREP baz.test test-suite.log
-$FGREP baz.test my.log
+$FGREP bazbaz test-suite.log
+$FGREP bazbaz my.log
 
 :
diff --git a/tests/parallel-tests-no-color-in-log.test b/tests/parallel-tests-no-color-in-log.test
new file mode 100755 (executable)
index 0000000..b69d6e1
--- /dev/null
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Colorized output from the testsuite report shouldn't end up in log files.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+esc='\e'
+
+# Check that grep can parse nonprinting characters.
+# BSD 'grep' works from a pipe, but not a seekable file.
+# GNU or BSD 'grep -a' works on files, but is not portable.
+case `echo "$esc" | $FGREP "$esc"` in
+  "$esc") ;;
+# Creative quoting below to please maintainer-check.
+  *) echo "$me: f""grep can't parse nonprinting characters" >&2; Exit 77;;
+esac
+
+TERM=ansi; export TERM
+
+cat >>configure.in <<END
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+LOG_COMPILER = $(SHELL)
+AUTOMAKE_OPTIONS = color-tests parallel-tests
+TESTS = pass fail skip xpass xfail error
+XFAIL_TESTS = xpass xfail
+END
+
+# Creative quoting to please maintainer-check.
+echo exit '0' > pass
+echo exit '0' > xpass
+echo exit '1' > fail
+echo exit '1' > xfail
+echo exit '77' > skip
+echo exit '99' > error
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+mv config.log config-log # Avoid possible false positives below.
+AM_COLOR_TESTS=always $MAKE -e check && Exit 1
+$FGREP "$esc" *.log && Exit 1
+
+:
diff --git a/tests/parallel-tests-no-spurious-summary.test b/tests/parallel-tests-no-spurious-summary.test
new file mode 100755 (executable)
index 0000000..70d9cb7
--- /dev/null
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (C) 2009, 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/>.
+
+# Check that `:test-results:' directives in test scripts' output doesn't
+# originate spurious results in the testsuite summary.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = foo.test bar.test
+END
+
+cat > foo.test <<'END'
+#! /bin/sh
+echo :test-result:XFAIL
+echo :test-result: SKIP
+echo :test-result:ERROR
+exit 0
+END
+cat > bar.test <<'END'
+#! /bin/sh
+echo :test-result: ERROR
+echo :test-result:FAIL
+echo :test-result: XPASS
+exit 0
+END
+chmod a+x foo.test bar.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+st=0
+$MAKE check >stdout || st=$?
+cat stdout
+cat test-suite.log
+cat foo.log
+cat bar.log
+test $st -eq 0 || Exit $st
+
+grep '^:test-result:XFAIL$'  foo.log
+grep '^:test-result: SKIP$'  foo.log
+grep '^:test-result:FAIL$'   bar.log
+grep '^:test-result: XPASS$' bar.log
+
+count_test_results total=2 pass=2 fail=0 skip=0 xfail=0 xpass=0 error=0
+
+:
similarity index 62%
rename from tests/distcom7.test
rename to tests/parallel-tests-once.test
index 3ea5096..5f00715 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure that Automake complains when an auxfile (here depcomp)
-# is installed, but the Makefile that distributes it is not processed.
+# Tests shouldn't be run multiple times by a simple "make check" in a
+# clean directory.  An early implementation of the `.trs' intermediate
+# files incurred a similar problem.
 
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_CONFIG_FILES([subdir/Makefile])
-AC_PROG_CC
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-SUBDIRS = subdir
+TESTS = foo.test
 END
 
-rm -f depcomp
-mkdir subdir
-
-cat > subdir/Makefile.am << 'END'
-bin_PROGRAMS = foo
+cat > foo.test <<'END'
+#! /bin/sh
+test -f foo.run && Exit 1
+: > foo.run
 END
-
-: > subdir/foo.c
+chmod a+x foo.test
 
 $ACLOCAL
-AUTOMAKE_fails --add-missing subdir/Makefile
-grep 'full run' stderr
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE check
+test -f foo.run # Sanity check.
 
 :
diff --git a/tests/parallel-tests-reset-term.test b/tests/parallel-tests-reset-term.test
new file mode 100755 (executable)
index 0000000..0b3b6d9
--- /dev/null
@@ -0,0 +1,89 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that the parallel-tests driver correctly handle overrides of the
+# TERM variable by either TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+esc='\e['
+
+# Check that grep can parse nonprinting characters.
+# BSD 'grep' works from a pipe, but not a seekable file.
+# GNU or BSD 'grep -a' works on files, but is not portable.
+case `echo "$esc" | $FGREP "$esc"` in
+  "$esc") ;;
+  *) skip_ "$FGREP can't parse nonprinting characters" ;;
+esac
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_COLOR_TESTS = always
+AUTOMAKE_OPTIONS = color-tests
+TESTS = foobar
+END
+
+cat > foobar << 'END'
+#!/bin/sh
+echo "TERM='$TERM'"
+echo "expected_term='$expected_term'"
+test x"$TERM" = x"$expected_term"
+END
+chmod a+x foobar
+
+mkcheck ()
+{
+  if env AM_COLOR_TESTS=always $* $MAKE check > stdout; then
+    rc=0
+  else
+    rc=1
+  fi
+  cat stdout
+  cat foobar.log
+  cat test-suite.log
+  return $rc
+}
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+
+TERM=ansi; export TERM
+expected_term=dumb; export expected_term
+mkcheck TESTS_ENVIRONMENT='TERM=dumb'
+cat stdout | grep "PASS.*foobar" | $FGREP "$esc"
+
+TERM=dumb; export TERM
+expected_term=ansi; export expected_term
+mkcheck TESTS_ENVIRONMENT='TERM=ansi'
+cat stdout | $FGREP "$esc" && Exit 1
+
+TERM=ansi; export TERM
+expected_term=dumb; export expected_term
+mkcheck AM_TESTS_ENVIRONMENT='TERM=dumb'
+cat stdout | grep "PASS.*foobar" | $FGREP "$esc"
+
+TERM=dumb; export TERM
+expected_term=ansi; export expected_term
+mkcheck AM_TESTS_ENVIRONMENT='TERM=ansi'
+cat stdout | $FGREP "$esc" && Exit 1
+
+:
index 18695fe..caae230 100755 (executable)
 # Check that the parallel-tests driver creates parent directories for
 # the log files when needed.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
diff --git a/tests/parallel-tests-suffix-prog.test b/tests/parallel-tests-suffix-prog.test
new file mode 100755 (executable)
index 0000000..cbdd833
--- /dev/null
@@ -0,0 +1,77 @@
+#! /bin/sh
+# Copyright (C) 2009, 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/>.
+
+# Check parallel-tests features:
+# - suffix rules, with PROGRAMS involved
+# See also sister test 'parallel-tests-suffix.test'.
+
+am_parallel_tests=yes
+required='cc native'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+## Note that automake should not match the '/test' part of 'sub/test' as
+## '.test' suffix, nor the '/chk' part of 'sub/chk' as '.chk' suffix.
+TESTS = $(dist_TESTS) $(check_PROGRAMS)
+dist_TESTS = foo.chk bar.test sub/test
+check_PROGRAMS = baz bla.test bli.suff sub/chk
+TEST_EXTENSIONS = .chk .test
+EXTRA_DIST = $(dist_TESTS)
+END
+
+mkdir sub
+
+cat >foo.chk << 'END'
+#! /bin/sh
+exit 0
+END
+chmod a+x foo.chk
+cp foo.chk bar.test
+cp foo.chk sub/test
+
+cat >baz.c << 'END'
+int main (void)
+{
+  return 0;
+}
+END
+cp baz.c bla.c
+cp baz.c bli.c
+cp baz.c sub/chk.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE check
+ls -l . sub
+test -f foo.log
+test -f bar.log
+test -f baz.log
+test -f bla.log
+test -f bli.suff.log
+test -f sub/chk.log
+test -f sub/test.log
+
+$MAKE distcheck
+
+:
similarity index 79%
rename from tests/parallel-tests4.test
rename to tests/parallel-tests-suffix.test
index efe7e8d..f20704a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 
 # Check parallel-tests features:
 # - suffix rules
+# See also sister test 'parallel-tests-suffix-prog.test'.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
-AC_PROG_CC
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 ## Note that automake should not match the '/test' part
 ## of 'sub/test' as '.test' suffix.
-TESTS = foo.chk bar.test $(check_PROGRAMS) sub/test
-check_PROGRAMS = baz bla.test bli.suff
+TESTS = foo.chk bar.test baz bli.suff sub/test
 TEST_EXTENSIONS = .chk .test
+EXTRA_DIST = $(TESTS)
 END
 
 mkdir sub
@@ -42,28 +41,23 @@ exit 0
 END
 chmod a+x foo.chk
 cp foo.chk bar.test
+cp foo.chk baz
+cp foo.chk bli.suff
 cp foo.chk sub/test
 
-cat >baz.c << 'END'
-int main (void)
-{
-  return 0;
-}
-END
-cp baz.c bla.c
-cp baz.c bli.c
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-$MAKE
 $MAKE check
+ls -l . sub
 test -f foo.log
 test -f bar.log
 test -f baz.log
-test -f bla.log
 test -f bli.suff.log
 test -f sub/test.log
+
+$MAKE distcheck
+
 :
diff --git a/tests/parallel-tests-trailing-bslash.test b/tests/parallel-tests-trailing-bslash.test
new file mode 100755 (executable)
index 0000000..418b722
--- /dev/null
@@ -0,0 +1,114 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Check that the new testsuite harness do not generate recipes that can
+# have a trailing `\', since that can cause spurious syntax errors with
+# older bash versions (e.g., bash 2.05b).
+# See automake bug#10436.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am <<'END'
+TESTS = foo.test
+EXTRA_DIST = $(TESTS)
+am__backslash = \\ # foo
+.PHONY: bad-recipe
+bad-recipe:
+       @printf '%s\n' $(am__backslash)
+END
+
+cat > foo.test <<'END'
+#!/bin/sh
+exit 0
+END
+chmod +x foo.test
+
+am__SHELL=$SHELL; export am__SHELL
+am__PERL=$PERL; export am__PERL
+
+cat > my-shell <<'END'
+#!/bin/sh -e
+set -u
+tab='  '
+nl='
+'
+am__shell_flags=
+am__shell_command=; unset am__shell_command
+while test $# -gt 0; do
+  case $1 in
+    # If the shell is invoked by make e.g. as "sh -ec" (seen on
+    # GNU make in POSIX mode) or "sh -ce" (seen on Solaris make).
+    -*c*)
+        flg=`echo x"$1" | sed -e 's/^x-//' -e 's/c//g'`
+        if test x"$flg" != x; then
+          am__shell_flags="$am__shell_flags -$flg"
+        fi
+        am__shell_command=$2
+        shift
+        ;;
+    -?*)
+        am__shell_flags="$am__shell_flags $1"
+        ;;
+      *)
+        break
+        ;;
+  esac
+  shift
+done
+if test x${am__shell_command+"set"} != x"set"; then
+  # Some make implementations, like *BSD's, pass the recipes to the shell
+  # through its standard input.  Trying to run our extra checks in this
+  # case would be too tricky, so we just skip them.
+  exec $am__SHELL $am__shell_flags ${1+"$@"}
+else
+  am__tweaked_shell_command=`printf '%s\n' "$am__shell_command" \
+    | tr -d " $tab$nl"`
+  case ${am__tweaked_shell_command-} in
+    *\\)
+      echo "my-shell: recipe ends with backslash character" >&2
+      printf '%s\n' "=== BEGIN recipe" >&2
+      printf '%s\n' "${am__shell_command-}" >&2
+      printf '%s\n' "=== END recipe" >&2
+      exit 99
+      ;;
+  esac
+  exec $am__SHELL $am__shell_flags -c "$am__shell_command" ${1+"$@"}
+fi
+END
+chmod a+x my-shell
+
+cat my-shell
+
+CONFIG_SHELL=`pwd`/my-shell; export CONFIG_SHELL
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure CONFIG_SHELL="$CONFIG_SHELL"
+
+st=0
+$MAKE bad-recipe 2>stderr && st=1
+cat stderr >&2
+$FGREP "my-shell: recipe ends with backslash character" stderr || st=1
+test $st -eq 0 || skip_ "can't catch trailing backslashes in make recipes"
+
+$MAKE check
+
+:
diff --git a/tests/parallel-tests-unreadable.test b/tests/parallel-tests-unreadable.test
new file mode 100755 (executable)
index 0000000..425c31a
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check that the testsuite driver copes well with unreadable `.log'
+# and `.trs' files.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+: > t
+chmod a-r t && test ! -r t || skip_ "you can still read unreadable files"
+rm -f t
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = foo.test bar.test
+END
+
+cat > foo.test << 'END'
+#! /bin/sh
+echo foofoofoo
+exit 0
+END
+
+cat > bar.test << 'END'
+#! /bin/sh
+echo barbarbar
+exit 77
+END
+
+chmod a+x foo.test bar.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+for files in \
+  'foo.log bar.log' \
+  'foo.trs bar.trs' \
+  'foo.trs bar.log' \
+  'foo.log bar.trs' \
+; do
+  $MAKE check
+  rm -f test-suite.log
+  chmod a-r $files
+  $MAKE test-suite.log || { ls -l; Exit 1; }
+  ls -l
+  grep '^foofoofoo$' foo.log
+  grep '^:test-result: PASS' foo.trs
+  grep '^barbarbar$' bar.log
+  grep '^:test-result: SKIP' bar.trs
+  grep '^SKIP: bar' test-suite.log
+  grep '^barbarbar$' test-suite.log
+  $EGREP ':.*foo|foofoofoo' test-suite.log && Exit 1
+  : For shells with busted 'set -e'.
+done
+
+:
index 54f0cd5..1b03710 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # 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 parallel-tests features:
-# - VERBOSE
-# - clean
-# - TEST_SUITE_LOG
-# - dependencies between tests
-# - TESTS
-# - TEST_LOGS
-# - RECHECK_LOGS
+# Basic checks on parallel-tests support:
+#  - console output
+#  - log files, and what goes in 'test-suite.log'
+#  - make clean
+#  - dependencies between tests
+#  - TESTS redefinition at runtime
+#  - TEST_LOGS redefinition at runtime
+#  - RECHECK_LOGS redefinition at runtime
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TEST_SUITE_LOG = mylog.log
 TESTS = foo.test bar.test baz.test
 XFAIL_TESTS = bar.test
 foo.log: bar.log
@@ -43,19 +40,19 @@ END
 # foo.test and bar.test sleep to ensure their logs are always strictly newer
 # than the logs of their prerequisites, for HP-UX make.  The quoting pleases
 # maintainer-check.
-cat >>foo.test <<'END'
+cat > foo.test <<'END'
 #! /bin/sh
 echo "this is $0"
 sleep '1'
 exit 0
 END
-cat >>bar.test <<'END'
+cat > bar.test <<'END'
 #! /bin/sh
 echo "this is $0"
 sleep '1'
 exit 99
 END
-cat >>baz.test <<'END'
+cat > baz.test <<'END'
 #! /bin/sh
 echo "this is $0"
 exit 1
@@ -70,35 +67,36 @@ $AUTOMAKE -a
 
 $MAKE check >stdout && { cat stdout; Exit 1; }
 cat stdout
-# There should be two errors: bar.test is a hard error.
-test `grep -c '^FAIL' stdout` -eq 2
-test -f mylog.log
-test `grep -c '^FAIL' mylog.log` -eq 2
+count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
+test -f test-suite.log
+cat test-suite.log
+test `grep -c '^FAIL:' test-suite.log` -eq 1
+test `grep -c '^ERROR:' test-suite.log` -eq 1
+$EGREP '^(X?PASS|XFAIL|SKIP)' test-suite.log && Exit 1
 test -f baz.log
 test -f bar.log
 test -f foo.log
-# The summary should be formatted correctly.
-grep 'failedn' stdout && Exit 1
 
-# clean should remove all log files (but not more).
-: > unrelated.log
 $MAKE clean
 test ! -f baz.log
 test ! -f bar.log
 test ! -f foo.log
-test ! -f mylog.log
-test -f unrelated.log
+test ! -f test-suite.log
 
 # Check dependencies: baz.test needs to run before bar.test,
 # but foo.test is not needed.
 # Note that this usage has a problem: the summary will only
 # take bar.log into account, because the $(TEST_SUITE_LOG) rule
 # does not "see" baz.log.  Hmm.
-env TESTS='bar.test' $MAKE -e check && Exit 1
+env TESTS='bar.test' $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^FAIL: baz\.test$' stdout
+grep '^ERROR: bar\.test$' stdout
+
 test -f baz.log
 test -f bar.log
 test ! -f foo.log
-test -f mylog.log
+test -f test-suite.log
 
 # Upon a lazy rerun, foo.test should be run, but the others shouldn't.
 # Note that the lazy rerun still exits with a failure, due to the previous
@@ -109,10 +107,12 @@ test -f mylog.log
 env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
 cat stdout
 test -f foo.log
-grep foo.test stdout
+grep '^PASS: foo\.test$' stdout
 grep bar.test stdout && Exit 1
 grep baz.test stdout && Exit 1
-grep '2.*tests.*failed' stdout
+grep '^# PASS: *1$' stdout
+grep '^# FAIL: *1$' stdout
+grep '^# ERROR: *1$' stdout
 
 # Now, explicitly retry with all test logs already updated, and ensure
 # that the summary is still displayed.
@@ -121,7 +121,9 @@ cat stdout
 grep foo.test stdout && Exit 1
 grep bar.test stdout && Exit 1
 grep baz.test stdout && Exit 1
-grep '2.*tests.*failed' stdout
+grep '^# PASS: *1$' stdout
+grep '^# FAIL: *1$' stdout
+grep '^# ERROR: *1$' stdout
 
 # Lazily rerunning only foo should only rerun this one test.
 env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
@@ -129,13 +131,9 @@ cat stdout
 grep foo.test stdout
 grep bar.test stdout && Exit 1
 grep baz.test stdout && Exit 1
-grep '2.*tests.*failed' stdout
-
-# Test VERBOSE.
-env VERBOSE=yes $MAKE -e check > stdout && { cat stdout; Exit 1; }
-cat stdout
-grep 'this is.*bar.test' stdout
-grep 'this is.*baz.test' stdout
+grep '^# PASS: *1$' stdout
+grep '^# FAIL: *1$' stdout
+grep '^# ERROR: *1$' stdout
 
 $MAKE clean
 env TEST_LOGS=baz.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
index 5cd3310..eca57f8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -18,9 +18,8 @@
 # - trailing whitespace in TESTS
 # GNU make 3.80 may expand trailing white space to `.log'.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
 AC_OUTPUT
@@ -45,4 +44,4 @@ $AUTOMAKE -a
 ./configure
 $MAKE check
 
-Exit 0
+:
index 78d5a76..ab0eee2 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check parallel-tests features:
-# - check-html
-# - recheck-html
+#  - check-html
+#  - recheck-html
+# FIXME: the features tested by this script has been moved in contrib.
+# FIXME: We should move this script accordingly.
 
-parallel_tests=yes
-required=rst2html
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
+# Try the variants that are tried in check-html.am.
+while :; do
+  for r2h in $RST2HTML rst2html rst2html.py; do
+    echo "$me: running $r2h --version"
+    # Don't use "&&" here, or a bug of 'set -e' present in some
+    # versions of the BSD shell will be triggered.  We add the
+    # dummy "else" branch for extra safety.
+    if $r2h --version; then break 2; else :; fi
+  done
+  skip_all_ "no proper rst2html program found"
+done
+unset r2h
+
+cp "$top_testsrcdir"/contrib/check-html.am . \
+  || fatal_ "cannot fetch 'check-html.am' from contrib"
 
 cat >> configure.in << 'END'
 AC_OUTPUT
@@ -35,24 +50,28 @@ check_SCRIPTS = bla
 bla:
        echo bla > $@
 CLEANFILES = bla
+include $(srcdir)/check-html.am
 END
 
-cat >>foo.test <<'END'
+cat > foo.test <<'END'
 #! /bin/sh
 echo "this is $0"
 test -f bla || exit 1
 exit 0
 END
-cat >>bar.test <<'END'
+
+cat > bar.test <<'END'
 #! /bin/sh
 echo "this is $0"
 exit 99
 END
-cat >>baz.test <<'END'
+
+cat > baz.test <<'END'
 #! /bin/sh
 echo "this is $0"
 exit 1
 END
+
 chmod a+x foo.test bar.test baz.test
 
 $ACLOCAL
@@ -60,20 +79,25 @@ $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-$MAKE check-html >stdout && { cat stdout; Exit 1; }
-cat stdout
+
+$MAKE check-html && Exit 1
 test -f mylog.html
+# check-html should cause check_SCRIPTS to be created.
+test -f bla
+
+# "make clean" should remove HTML files.
+$MAKE clean
+test ! -f mylog.html
+test ! -f bla
 
 # Always create the HTML output, even if there were no failures.
 rm -f mylog.html
-env TESTS=foo.test $MAKE -e check-html >stdout || { cat stdout; Exit 1; }
-cat stdout
+env TESTS=foo.test $MAKE -e check-html
 test -f mylog.html
 
-# Create HTML output also with recheck-html
+# Create summarizing HTML output also with recheck-html.
 rm -f mylog.html
-env TESTS=foo.test $MAKE -e recheck-html >stdout || { cat stdout; Exit 1; }
-cat stdout
+env TESTS=foo.test $MAKE -e recheck-html
 test -f mylog.html
 
 # Create HTML output for an individual test.
@@ -101,11 +125,12 @@ test ! -f mylog.html
 
 $MAKE clean
 test ! -f mylog.html
-env TESTS=foo.test $MAKE -e check-html
+env TEST_LOGS=foo.log $MAKE -e check-html
 test -f bla
 test -f foo.log
 test ! -f bar.log
 test ! -f baz.log
+test -f mylog.html
 
 $MAKE clean
 env TESTS=foo.test $MAKE -e recheck-html
index 69ba1d0..d5275a8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # Check parallel-tests features:
 # - concurrent parallel execution
 
-parallel_tests=yes
+am_parallel_tests=yes
 required=GNUmake
 . ./defs || Exit 1
 
-# This test does not work well if $MAKE contains -j.
 case $MAKE in
-*\ -j*) Exit 77 ;;
+  *\ -j*) skip_ "\$MAKE contains \`-j'";;
 esac
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -38,13 +35,12 @@ END
 
 for i in 1 2 3 4 5 6 7 8; do
   echo "TESTS += foo$i.test" >> Makefile.am
-  cat >foo$i.test <<'END'
-#! /bin/sh
-echo "this is $0"
-# hack around maintainer-check check:
-sleep='sleep '1
-$sleep
-exit 0
+  unindent >foo$i.test <<'END'
+    #! /bin/sh
+    echo "this is $0"
+    # Creative quoting below to please maintainer-check.
+    sleep '1'
+    exit 0
 END
   chmod a+x foo$i.test
 done
@@ -75,7 +71,7 @@ cd ..
 # still be ongoing when the parallel one has terminated.
 kill -0 $!
 cat parallel/stdout
-test `grep -c PASS parallel/stdout` -eq 8
+test `grep -c '^PASS:' parallel/stdout` -eq 8
 
 # Wait long enough so that there are no open files any more when the
 # post-test cleanup runs.  But exit after we've waited for two minutes
index c4ff5b9..cd062bd 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # Actually, this test doesn't ensure that things happen concurrently.
 # It merely serves as demonstration.  :-)
 
-parallel_tests=yes
-required=GNUmake
+am_parallel_tests=yes
+required='cc native GNUmake'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_OUTPUT
@@ -43,16 +41,16 @@ END
 for i in 1 2 3 4 5 6 7 8; do
   echo "scripts += foo$i.test" >> Makefile.am
   echo "programs += foo$i.prog" >> Makefile.am
-  cat >foo$i.test <<'END'
-#! /bin/sh
-echo "this is $0"
-exit 0
+  unindent >foo$i.test <<'END'
+    #! /bin/sh
+    echo "this is $0"
+    exit 0
 END
   cat >foo$i.c <<'END'
-int main()
-{
-  return 0;
-}
+    int main (void)
+    {
+      return 0;
+    }
 END
   chmod a+x foo$i.test
 done
@@ -64,4 +62,5 @@ $AUTOMAKE -a
 ./configure
 $MAKE -j4 check
 $MAKE distcheck
+
 :
index 44caf0c..eac4cf1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # BSD make will expand `$(TESTS:=.log)' to `.log' unless overridden.
 # See parallel-tests10.test for a similar issue.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -38,6 +36,8 @@ $AUTOMAKE -a
 ./configure
 $MAKE check >stdout || { cat stdout; Exit 1; }
 cat stdout
-grep '0 tests' stdout
+for x in TOTAL PASS FAIL XPASS FAIL SKIP ERROR; do
+  grep "^# $x: *0$" stdout
+done
 
 Exit 0
index 524b82b..560f9d4 100755 (executable)
 #       manual for the ugliness in this area, when VPATH comes into
 #       play.  :-/
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -46,7 +44,7 @@ EXTRA_DIST = foo.in foo.test
 DISTCLEANFILES = foo.test
 END
 
-cat >>foo.in <<'END'
+cat > foo.in <<'END'
 #! /bin/sh
 echo "this is $0"
 exit 0
@@ -55,8 +53,8 @@ END
 $ACLOCAL
 $AUTOCONF
 AUTOMAKE_fails -a
-grep '(srcdir.*bar' stderr
-grep 'top_srcdir.*baz' stderr
+grep '$(srcdir).*TESTS.*bar\.test' stderr
+grep '$(top_srcdir).*TESTS.*baz\.test' stderr
 
 sed '/^TESTS +=.*srcdir/d' < Makefile.am > t
 mv -f t Makefile.am
index 337328f..bef1674 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 # Check parallel-tests features:
 # - recheck
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -35,18 +33,18 @@ bla:
        echo bla > $@
 END
 
-cat >>foo.test <<'END'
+cat > foo.test <<'END'
 #! /bin/sh
 echo "this is $0"
 test -f bla || exit 1
 exit 0
 END
-cat >>bar.test <<'END'
+cat > bar.test <<'END'
 #! /bin/sh
 echo "this is $0"
 exit 99
 END
-cat >>baz.test <<'END'
+cat > baz.test <<'END'
 #! /bin/sh
 echo "this is $0"
 exit 1
@@ -60,21 +58,14 @@ $AUTOMAKE -a
 ./configure
 $MAKE check >stdout && { cat stdout; Exit 1; }
 cat stdout
+count_test_results total=3 pass=1 fail=1 skip=0 xfail=0 xpass=0 error=1
 
 $MAKE recheck >stdout && { cat stdout; Exit 1; }
 cat stdout
-grep foo.test stdout && Exit 1
-grep bar.test stdout || Exit 1
-grep baz.test stdout || Exit 1
-grep '2 of 2.*failed' stdout
-
-# If we cannot read the log file, then redo it as well.
-chmod a-r foo.log
-if test ! -r foo.log; then
-   $MAKE recheck >stdout && { cat stdout; Exit 1; }
-   cat stdout
-   grep foo.test stdout || Exit 1
-fi
+count_test_results total=2 pass=0 fail=1 skip=0 xfail=0 xpass=0 error=1
+grep 'foo\.test' stdout && Exit 1
+grep '^ERROR: bar\.test$' stdout
+grep '^FAIL: baz\.test$' stdout
 
 # Ensure that recheck builds check_SCRIPTS, and that
 # recheck reruns nothing if check has not been run.
@@ -85,4 +76,5 @@ test ! -f foo.log
 test ! -f bar.log
 test ! -f baz.log
 test -f mylog.log
+
 :
index e7dcbe5..8a97cd1 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2000, 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
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat >> configure.in << 'END'
 AC_PROG_CC
-AC_PROG_RANLIB
-AC_OUTPUT(Makefile)
 END
 
 cat > Makefile.am << 'END'
@@ -33,8 +30,8 @@ zar.c\
 doz.c
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 $FGREP zar.cdoz Makefile.in && Exit 1
 Exit 0
index dfb48ae..492d0e0 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_PROG_CC
 EOF
index 09e4f84..33cbe9c 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>Makefile.am << 'EOF'
 ${ARCH}/%.$(OBJEXT): %.S
        test -d ${ARCH} || mkdir ${ARCH}
index 9c9f3d3..2eba535 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >Makefile.am << 'EOF'
 .PHONY: foo
 .PHONY: bar
diff --git a/tests/plain-functions.sh b/tests/plain-functions.sh
new file mode 100644 (file)
index 0000000..233f65d
--- /dev/null
@@ -0,0 +1,40 @@
+# -*- shell-script -*-
+#
+# Copyright (C) 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/>.
+
+# Helper functions used by "plain" tests of the Automake testsuite
+# (i.e., tests that don't use any test protocol).
+
+# Print warnings (e.g., about skipped and failed tests) to this file
+# number.  Override by putting, say:
+#   AM_TESTS_ENVIRONMENT = stderr_fileno_=9; export stderr_fileno_;
+#   AM_TESTS_FD_REDIRECT = 9>&2
+# in your Makefile.am.
+# This is useful when using automake's parallel tests mode, to print the
+# reason for skip/failure to console, rather than to the *.log files.
+: ${stderr_fileno_=2}
+
+# Copied from Gnulib's `tests/init.sh'.
+warn_ () { echo "$@" 1>&$stderr_fileno_; }
+fail_ () { warn_ "$me: failed test: $@"; Exit 1; }
+skip_ () { warn_ "$me: skipped test: $@"; Exit 77; }
+fatal_ () { warn_ "$me: hard error: $@"; Exit 99; }
+framework_failure_ () { warn_ "$me: set-up failure: $@"; Exit 99; }
+
+# For compatibility with TAP functions.
+skip_all_ () { skip_ "$@"; }
+
+:
index 66eec8f..bd6da5b 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
index 9273415..2b0079b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << 'END'
 AM_CONDITIONAL([A], [true])
 AM_CONDITIONAL([B], [false])
index 12ec4d7..d619d3d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_OUTPUT
 END
index f9db345..14d6e7f 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 1999, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([CHECK], [true])
 END
index 755002c..394e6d3 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 1999, 2001, 2002, 2004, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1998, 1999, 2001, 2002, 2004, 2010, 2011, 2012 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([CHECK], [true])
 END
@@ -46,7 +44,7 @@ $ACLOCAL
 $AUTOMAKE
 
 grep '^@CHECK_TRUE@data_DATA = zarrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr \\$' Makefile.in
-grep '^@CHECK_TRUE@    doz$' Makefile.in
+grep "^@CHECK_TRUE@${tab}doz$" Makefile.in
 
 grep '^@CHECK_FALSE@data_DATA = dog$' Makefile.in
 
index 744b489..831a3a9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 4e03d37..ea3c360 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([CHECK], [true])
 END
@@ -37,10 +35,10 @@ AUTOMAKE_fails
 
 # We expect the following diagnostic:
 #
-# Makefile.am:4: Cannot apply `+=' because `INCLUDES' is not defined in
+# Makefile.am:4: cannot apply `+=' because `INCLUDES' is not defined in
 # Makefile.am:4: the following conditions:
 # Makefile.am:4:   !CHECK
-# Makefile.am:4: Either define `INCLUDES' in these conditions, or use
+# Makefile.am:4: either define `INCLUDES' in these conditions, or use
 # Makefile.am:4: `+=' in the same conditions as the definitions.
 
 # Is !CHECK mentioned?
index af05239..68710cf 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_SUBST([ZZZ])
 END
index 0716462..f8ceefa 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
@@ -34,7 +32,8 @@ AR += qq
 END
 
 $ACLOCAL
-AUTOMAKE_fails
-grep 'Makefile.am:3:.*AR' stderr
+AUTOMAKE_fails -Wno-portability
+q="[\`'\"]"
+grep "^Makefile\.am:3:.* AR .* with $q=$q before .*$q+=$q" stderr
 
 :
index 901f8b6..52e9854 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2004, 2006, 2010 Free Software
+# Copyright (C) 1999, 2001, 2002, 2004, 2006, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 VAR = \
     one \
index fb30a1d..7f72654 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << 'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [true])
@@ -55,10 +53,10 @@ AUTOMAKE_fails
 
 # We expect the following diagnostic:
 #
-# Makefile.am:19: Cannot apply `+=' because `B' is not defined in
+# Makefile.am:19: cannot apply `+=' because `B' is not defined in
 # Makefile.am:19: the following conditions:
 # Makefile.am:19:   !COND1 and !COND3
-# Makefile.am:19: Either define `B' in these conditions, or use
+# Makefile.am:19: either define `B' in these conditions, or use
 # Makefile.am:19: `+=' in the same conditions as the definitions.
 #
 # It would be nice if Automake could print only COND3_FALSE and
diff --git a/tests/pm/Cond2.pl b/tests/pm/Cond2.pl
new file mode 100644 (file)
index 0000000..94caa89
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright (C) 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/>.
+
+# Catch common programming error:
+# A Condition passed as a string to 'new'.
+
+use Automake::Condition;
+
+my $cond = new Automake::Condition ('TRUE');
+new Automake::Condition ($cond);
diff --git a/tests/pm/Cond3.pl b/tests/pm/Cond3.pl
new file mode 100644 (file)
index 0000000..e010e4f
--- /dev/null
@@ -0,0 +1,22 @@
+# Copyright (C) 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/>.
+
+# Catch common programming error:
+# A Condition passed as a string to 'new'.
+
+use Automake::Condition;
+
+my $cond = new Automake::Condition ("COND1_TRUE");
+new Automake::Condition ("$cond");
index 06eb34e..752d340 100644 (file)
@@ -1,13 +1,12 @@
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2008, 2009, 2011 Free Software
+# Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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.
@@ -18,7 +17,8 @@
 BEGIN {
   use Config;
   if (eval { require 5.007_002; }      # for CLONE support
-      && $Config{useithreads})
+      && $Config{useithreads}
+      && !$ENV{WANT_NO_THREADS})
     {
       require threads;
       import threads;
@@ -32,15 +32,15 @@ use Automake::Condition qw/TRUE FALSE/;
 
 sub test_basics ()
 {
-  my @tests = (# [[Conditions], is_true?, is_false?, string, subst-string]
-              [[], 1, 0, 'TRUE', ''],
-              [['TRUE'], 1, 0, 'TRUE', ''],
-              [['FALSE'], 0, 1, 'FALSE', '#'],
-              [['A_TRUE'], 0, 0, 'A_TRUE', '@A_TRUE@'],
+  my @tests = (# [[Conditions], is_true?, is_false?, string, subst-string, human]
+              [[], 1, 0, 'TRUE', '', 'TRUE'],
+              [['TRUE'], 1, 0, 'TRUE', '', 'TRUE'],
+              [['FALSE'], 0, 1, 'FALSE', '#', 'FALSE'],
+              [['A_TRUE'], 0, 0, 'A_TRUE', '@A_TRUE@', 'A'],
               [['A_TRUE', 'B_FALSE'],
-               0, 0, 'A_TRUE B_FALSE', '@A_TRUE@@B_FALSE@'],
-              [['B_TRUE', 'FALSE'], 0, 1, 'FALSE', '#'],
-              [['B_TRUE', 'B_FALSE'], 0, 1, 'FALSE', '#']);
+               0, 0, 'A_TRUE B_FALSE', '@A_TRUE@@B_FALSE@', 'A and !B'],
+              [['B_TRUE', 'FALSE'], 0, 1, 'FALSE', '#', 'FALSE'],
+              [['B_TRUE', 'B_FALSE'], 0, 1, 'FALSE', '#', 'FALSE']);
 
   for (@tests)
     {
@@ -53,6 +53,7 @@ sub test_basics ()
          return 1 if $_->[2] != ($a == FALSE);
          return 1 if $_->[3] ne $a->string;
          return 1 if $_->[4] ne $a->subst_string;
+         return 1 if $_->[5] ne $a->human;
        })->join;
     }
   return 0;
@@ -281,7 +282,33 @@ sub test_reduce_or ()
   return $failed;
 }
 
-exit (test_basics || test_true_when || test_reduce_and || test_reduce_or);
+sub test_merge ()
+{
+  my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
+  return threads->new(sub {
+      my $other = new Automake::Condition "COND3_FALSE";
+      return threads->new(sub {
+       my $both = $cond->merge ($other);
+       return threads->new(sub {
+         my $both2 = $cond->merge_conds ("COND3_FALSE");
+         return threads->new(sub {
+           $cond = $both->strip ($other);
+           my @conds = $cond->conds;
+           return 1 if $both->string ne "COND1_TRUE COND2_FALSE COND3_FALSE";
+           return 1 if $cond->string ne "COND1_TRUE COND2_FALSE";
+           return 1 if $both != $both2;
+         })->join;
+       })->join;
+      })->join;
+    })->join;
+  return 0;
+}
+
+exit (test_basics
+      || test_true_when
+      || test_reduce_and
+      || test_reduce_or
+      || test_merge);
 
 ### Setup "GNU" style for perl-mode and cperl-mode.
 ## Local Variables:
index 86f1745..1c65484 100644 (file)
@@ -1,13 +1,12 @@
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2008, 2009, 2011 Free Software
+# Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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.
@@ -19,15 +18,15 @@ use Automake::Condition qw/TRUE FALSE/;
 
 sub test_basics ()
 {
-  my @tests = (# [[Conditions], is_true?, is_false?, string, subst-string]
-              [[], 1, 0, 'TRUE', ''],
-              [['TRUE'], 1, 0, 'TRUE', ''],
-              [['FALSE'], 0, 1, 'FALSE', '#'],
-              [['A_TRUE'], 0, 0, 'A_TRUE', '@A_TRUE@'],
+  my @tests = (# [[Conditions], is_true?, is_false?, string, subst-string, human]
+              [[], 1, 0, 'TRUE', '', 'TRUE'],
+              [['TRUE'], 1, 0, 'TRUE', '', 'TRUE'],
+              [['FALSE'], 0, 1, 'FALSE', '#', 'FALSE'],
+              [['A_TRUE'], 0, 0, 'A_TRUE', '@A_TRUE@', 'A'],
               [['A_TRUE', 'B_FALSE'],
-               0, 0, 'A_TRUE B_FALSE', '@A_TRUE@@B_FALSE@'],
-              [['B_TRUE', 'FALSE'], 0, 1, 'FALSE', '#'],
-              [['B_TRUE', 'B_FALSE'], 0, 1, 'FALSE', '#']);
+               0, 0, 'A_TRUE B_FALSE', '@A_TRUE@@B_FALSE@', 'A and !B'],
+              [['B_TRUE', 'FALSE'], 0, 1, 'FALSE', '#', 'FALSE'],
+              [['B_TRUE', 'B_FALSE'], 0, 1, 'FALSE', '#', 'FALSE']);
 
   for (@tests)
     {
@@ -38,6 +37,7 @@ sub test_basics ()
       return 1 if $_->[2] != ($a == FALSE);
       return 1 if $_->[3] ne $a->string;
       return 1 if $_->[4] ne $a->subst_string;
+      return 1 if $_->[5] ne $a->human;
     }
   return 0;
 }
@@ -240,7 +240,25 @@ sub test_reduce_or ()
   return $failed;
 }
 
-exit (test_basics || test_true_when || test_reduce_and || test_reduce_or);
+sub test_merge ()
+{
+  my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
+  my $other = new Automake::Condition "COND3_FALSE";
+  my $both = $cond->merge ($other);
+  my $both2 = $cond->merge_conds ("COND3_FALSE");
+  $cond = $both->strip ($other);
+  my @conds = $cond->conds;
+  return 1 if $both->string ne "COND1_TRUE COND2_FALSE COND3_FALSE";
+  return 1 if $cond->string ne "COND1_TRUE COND2_FALSE";
+  return 1 if $both != $both2;
+  return 0;
+}
+
+exit (test_basics
+      || test_true_when
+      || test_reduce_and
+      || test_reduce_or
+      || test_merge);
 
 ### Setup "GNU" style for perl-mode and cperl-mode.
 ## Local Variables:
diff --git a/tests/pm/DisjCon2.pl b/tests/pm/DisjCon2.pl
new file mode 100644 (file)
index 0000000..37d886a
--- /dev/null
@@ -0,0 +1,24 @@
+# Copyright (C) 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/>.
+
+# Catch common programming error:
+# A non-Condition reference passed to new.
+
+use Automake::Condition;
+use Automake::DisjConditions;
+
+my $cond = new Automake::Condition ('TRUE');
+my $cond2 = new Automake::DisjConditions ($cond);
+new Automake::DisjConditions ($cond2);
diff --git a/tests/pm/DisjCon3.pl b/tests/pm/DisjCon3.pl
new file mode 100644 (file)
index 0000000..c0e840d
--- /dev/null
@@ -0,0 +1,23 @@
+# Copyright (C) 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/>.
+
+# Catch common programming error:
+# A non-reference passed to new.
+
+use Automake::Condition qw/TRUE FALSE/;
+use Automake::DisjConditions;
+
+my $cond = new Automake::Condition ("COND1_TRUE");
+new Automake::DisjConditions ("$cond");
index 2fe275b..4acaed8 100644 (file)
@@ -1,13 +1,12 @@
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2008, 2009, 2011 Free Software
+# Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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.
@@ -18,7 +17,8 @@
 BEGIN {
   use Config;
   if (eval { require 5.007_002; }      # for CLONE support
-      && $Config{useithreads})
+      && $Config{useithreads}
+      && !$ENV{WANT_NO_THREADS})
     {
       require threads;
       import threads;
@@ -33,18 +33,44 @@ use Automake::DisjConditions;
 
 sub test_basics ()
 {
+  my $true = new Automake::DisjConditions TRUE;
+  my $false = new Automake::DisjConditions FALSE;
   my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
   return threads->new (sub {
     my $other = new Automake::Condition "COND3_FALSE";
+    my $another = new Automake::Condition "COND3_TRUE", "COND4_FALSE";
     return threads->new (sub {
       my $set1 = new Automake::DisjConditions $cond, $other;
       return threads->new (sub {
        my $set2 = new Automake::DisjConditions $other, $cond;
+       my $set3 = new Automake::DisjConditions FALSE, $another;
        return 1 unless $set1 == $set2;
        return 1 if $set1->false;
        return 1 if $set1->true;
        return 1 unless (new Automake::DisjConditions)->false;
        return 1 if (new Automake::DisjConditions)->true;
+       return 1 unless $true->human eq 'TRUE';
+       return 1 unless $false->human eq 'FALSE';
+       return 1 unless $set1->human eq "(COND1 and !COND2) or (!COND3)";
+       return 1 unless $set2->human eq "(COND1 and !COND2) or (!COND3)";
+       my $one_cond_human = $set1->one_cond->human;
+       return 1 unless $one_cond_human eq "!COND3"
+                       || $one_cond_human eq "COND1 and !COND2";
+       return 1 unless $set1->string eq "COND1_TRUE COND2_FALSE | COND3_FALSE";
+
+       my $merged1 = $set1->merge ($set2);
+       my $merged2 = $set1->merge ($cond);
+       my $mult1 = $set1->multiply ($set3);
+       return threads->new (sub {
+         my $mult2 = $set1->multiply ($another);
+         return threads->new (sub {
+           return 1 unless $merged1->simplify->string eq "COND1_TRUE COND2_FALSE | COND3_FALSE";
+           return 1 unless $merged2->simplify->string eq "COND1_TRUE COND2_FALSE | COND3_FALSE";
+           return 1 unless $mult1->string eq "COND1_TRUE COND2_FALSE COND3_TRUE COND4_FALSE";
+           return 1 unless $mult1 == $mult2;
+           return 0;
+         })->join;
+       })->join;
       })->join;
     })->join;
   })->join;
index 47dea83..b60907b 100644 (file)
@@ -1,13 +1,12 @@
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2008, 2009, 2011 Free Software
+# Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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.
@@ -20,15 +19,38 @@ use Automake::DisjConditions;
 
 sub test_basics ()
 {
+  my $true = new Automake::DisjConditions TRUE;
+  my $false = new Automake::DisjConditions FALSE;
   my $cond = new Automake::Condition "COND1_TRUE", "COND2_FALSE";
   my $other = new Automake::Condition "COND3_FALSE";
+  my $another = new Automake::Condition "COND3_TRUE", "COND4_FALSE";
   my $set1 = new Automake::DisjConditions $cond, $other;
   my $set2 = new Automake::DisjConditions $other, $cond;
+  my $set3 = new Automake::DisjConditions FALSE, $another;
   return 1 unless $set1 == $set2;
   return 1 if $set1->false;
   return 1 if $set1->true;
   return 1 unless (new Automake::DisjConditions)->false;
   return 1 if (new Automake::DisjConditions)->true;
+  return 1 unless $true->human eq 'TRUE';
+  return 1 unless $false->human eq 'FALSE';
+  return 1 unless $set1->human eq "(COND1 and !COND2) or (!COND3)";
+  return 1 unless $set2->human eq "(COND1 and !COND2) or (!COND3)";
+  my $one_cond_human = $set1->one_cond->human;
+  return 1 unless $one_cond_human eq "!COND3"
+                  || $one_cond_human eq "COND1 and !COND2";
+  return 1 unless $set1->string eq "COND1_TRUE COND2_FALSE | COND3_FALSE";
+
+  my $merged1 = $set1->merge ($set2);
+  my $merged2 = $set1->merge ($cond);
+  my $mult1 = $set1->multiply ($set3);
+  my $mult2 = $set1->multiply ($another);
+  return 1 unless $merged1->simplify->string eq "COND1_TRUE COND2_FALSE | COND3_FALSE";
+  return 1 unless $merged2->simplify->string eq "COND1_TRUE COND2_FALSE | COND3_FALSE";
+  return 1 unless $mult1->string eq "COND1_TRUE COND2_FALSE COND3_TRUE COND4_FALSE";
+  return 1 unless $mult1 == $mult2;
+
+  return 0;
 }
 
 sub build_set (@)
index e496435..eec0c8e 100644 (file)
@@ -1,13 +1,11 @@
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2009, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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.
@@ -42,6 +40,29 @@ sub test_version_compare
     print "compare (\"$left\", \"$right\") = $res! (not $result?)\n";
     $failed = 1;
   }
+
+  my $check_expected = ($result == 0 || $result == 1) ? 0 : 1;
+  # Exception for 'foo' fork.
+  $check_expected = 1
+    if ($right =~ /foo/ && !($left =~ /foo/));
+
+  my $check = Automake::Version::check ($left, $right);
+  if ($check != $check_expected)
+  {
+    print "check (\"$left\", \"$right\") = $check! (not $check_expected?)\n";
+    $failed = 1;
+  }
+}
+
+sub test_bad_versions
+{
+  my ($ver) = @_;
+  my @version = Automake::Version::split ($ver);
+  if ($#version != -1)
+  {
+    print "shouldn't grok \"$ver\"\n";
+    $failed = 1;
+  }
 }
 
 my @tests = (
@@ -69,15 +90,24 @@ my @tests = (
   ['1.5a', '1.5.1f', 1],
   ['1.5', '1.5.1a', -1],
   ['1.5.1a', '1.5.1f', -1],
+  ['1.5.1f', '1.5.1a', 1],
+  ['1.5.1f', '1.5.1f', 0],
 # special exceptions
   ['1.6-p5a', '1.6.5a', 0],
   ['1.6', '1.6-p5a', -1],
   ['1.6-p4b', '1.6-p5a', -1],
   ['1.6-p4b', '1.6-foo', 1],
-  ['1.6-p4b', '1.6a-foo', -1]
+  ['1.6-p4b', '1.6a-foo', -1],
+  ['1.6-p5', '1.6.5', 0],
+  ['1.6a-foo', '1.6a-foo', 0],
+);
+
+my @bad_versions = (
+  '', 'a', '1', '1a', '1.2.3.4', '-1.2'
 );
 
 test_version_compare (@{$_}) foreach @tests;
+test_bad_versions ($_) foreach @bad_versions;
 
 exit $failed;
 
diff --git a/tests/pm/Version2.pl b/tests/pm/Version2.pl
new file mode 100644 (file)
index 0000000..c1981a0
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright (C) 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/>.
+
+# prog_error due to invalid $VERSION.
+
+use Automake::Version;
+
+Automake::Version::check ('', '1.2.3');
diff --git a/tests/pm/Version3.pl b/tests/pm/Version3.pl
new file mode 100644 (file)
index 0000000..7c45dc9
--- /dev/null
@@ -0,0 +1,20 @@
+# Copyright (C) 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/>.
+
+# prog_error due to invalid $REQUIRED.
+
+use Automake::Version;
+
+Automake::Version::check ('1.2.3', '');
index 8d840fc..79b8d32 100644 (file)
@@ -1,13 +1,11 @@
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2009, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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.
@@ -15,7 +13,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-use Automake::Wrap 'wrap';
+use Automake::Wrap qw/wrap makefile_wrap/;
 
 my $failed = 0;
 
@@ -31,6 +29,18 @@ sub test_wrap
     }
 }
 
+sub test_makefile_wrap
+{
+  my ($in, $exp_out) = @_;
+
+  my $out = &makefile_wrap (@$in);
+  if ($out ne $exp_out)
+    {
+      print STDERR "For: @$in\nGot:\n$out\nInstead of:\n$exp_out\n---\n";
+      ++$failed;
+    }
+}
+
 my @tests = (
   [["HEAD:", "NEXT:", "CONT", 13, "v" ,"a", "l", "ue", "s", "values"],
 "HEAD:v aCONT
@@ -55,10 +65,32 @@ big continuation:diag3
 "big header: END
 cont: word1 END
 cont: word2
+"],
+  [["big header:", "", " END", 16, "w1", "w2 ", "w3"],
+"big header: END
+w1 w2 w3
 "]);
 
+my @makefile_tests = (
+  [["target:"],
+"target:
+"],
+  [["target:", "\t"],
+"target:
+"],
+  [["target:", "\t", "prereq1", "prereq2"],
+"target: prereq1 prereq2
+"],
+  [["target: ", "\t", "this is a long list of prerequisites ending in space",
+    "so that there is no need for another space before the backslash",
+    "unlike in the second line"],
+"target: this is a long list of prerequisites ending in space \\
+\tso that there is no need for another space before the backslash \\
+\tunlike in the second line
+"]);
 
 test_wrap (@{$_}) foreach @tests;
+test_makefile_wrap (@{$_}) foreach @makefile_tests;
 
 exit $failed;
 
diff --git a/tests/posixsubst-data.test b/tests/posixsubst-data.test
new file mode 100755 (executable)
index 0000000..49547e1
--- /dev/null
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works
+# in when used with the DATA primary.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+foodir = $(prefix)
+
+t1 = foo1 foo2
+t2 = barx
+t3 = baz.y
+
+bar.data bazzardoz:
+       : > $@
+CLEANFILES = bar.data bazzardoz
+
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+dist_foo_DATA = $(t1:=.txt)
+foo_DATA = $(t2:x=.data)
+nodist_foo_DATA = $(t3:.y=zardoz)
+
+check-local: test
+.PHONY: test
+test: distdir
+       ls -l $(distdir)
+       test ! -r $(distdir)/foo.data
+       test ! -r $(distdir)/bazzardoz
+
+installcheck-local:
+       ls -l $(prefix)
+       test -f $(prefix)/foo1.txt
+       test -f $(prefix)/foo2.txt
+       test -f $(prefix)/bar.data
+       test -f $(prefix)/bazzardoz
+END
+
+: > foo1.txt
+: > foo2.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE install
+test -f bar.data
+test -f bazzardoz
+$MAKE test
+$MAKE installcheck
+$MAKE distcheck
+
+:
similarity index 56%
rename from tests/ansi.test
rename to tests/posixsubst-extradist.test
index 0aa000e..36f0a31 100755 (executable)
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2010 Free
-# Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test for bug where ansi2knr.c is not included in distribution.
-# From François Pinard.
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# in EXTRA_DIST.
 
 . ./defs || Exit 1
 
-set -e
-
-cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = ansi2knr
-.PHONY: test1 test2
-test1:
-       echo ' $(DISTFILES) ' | grep ' ansi2knr\.c '
-       echo ' $(DISTFILES) ' | grep ' ansi2knr\.1 '
-test2: distdir
-       test -f $(distdir)/ansi2knr.c
-       test -f $(distdir)/ansi2knr.1
-END
-
 cat >> configure.in << 'END'
-AM_C_PROTOTYPES
 AC_OUTPUT
 END
 
-: > ansi2knr.c
-: > ansi2knr.1
+cat > Makefile.am << 'END'
+t1 = foo1 foo2
+t2 = bar.x
+t3 = baz-y
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+EXTRA_DIST = $(t1:=.c) $(t2:.x=.f) $(t3:-y=ar)
+bazar bar.f:
+       : > $@
+.PHONY: test
+test: distdir
+       ls -l $(distdir)
+       test -f $(distdir)/foo1.c
+       test -f $(distdir)/foo2.c
+       test -f $(distdir)/bar.f
+       test -f $(distdir)/bazar
+END
+
+: > foo1.c
+: > foo2.c
 
 $ACLOCAL
-$AUTOCONF -Wno-obsolete
-$AUTOMAKE -Wno-obsolete
+$AUTOCONF
+$AUTOMAKE
 
 ./configure
-
-$MAKE test1
-$MAKE test2
+$MAKE test
 
 :
diff --git a/tests/posixsubst-ldadd.test b/tests/posixsubst-ldadd.test
new file mode 100755 (executable)
index 0000000..4fb7df9
--- /dev/null
@@ -0,0 +1,78 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works
+# when used in LDADD.
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AM_PROG_AR
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+u = libquux1.lib libquux2.lib
+v = libquux1
+w = none
+
+zardozdir = $(prefix)/zardoz
+zardoz_PROGRAMS = foo bar
+
+noinst_LIBRARIES = libquux1.a libquux2.a libquux3.a
+
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+LDADD = $(u:.lib=.a)
+bar_LDADD = $(v:=.a) libquux2.a $(w:none=libquux3.a)
+
+libquux1.c:
+       echo 'int quux1(void) { return 0; }' > $@
+CLEANFILES = libquux1.c # For FreeBSD make.
+END
+
+cat > foo.c <<'END'
+int main(void)
+{
+  int quux1(void), quux2(void);
+  return quux1() + quux2();
+}
+END
+
+cat > bar.c <<'END'
+int main(void)
+{
+  int quux1(void), quux2(void), quux3(void);
+  return quux1() + quux2() + quux3();
+}
+END
+
+echo 'int quux2(void) { return 0; }' > libquux2.c
+echo 'int quux3(void) { return 0; }' > libquux3.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+test -f libquux1.c
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-libraries.test b/tests/posixsubst-libraries.test
new file mode 100755 (executable)
index 0000000..f6d1b86
--- /dev/null
@@ -0,0 +1,65 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the LIBRARIES primary in a "simple" way.
+# Keep this in sync with sister test `posixsubst-ltlibraries.test'.
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AM_PROG_AR
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+foolibs = libfoo1 libfoo2
+barlibs = libbaz
+
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+lib_LIBRARIES = $(foolibs:=.a) $(barlibs:z=r.a)
+
+libbar.c:
+       echo 'int bar(void) { return 0; }' > $@
+CLEANFILES = libbar.c # For FreeBSD make.
+
+installcheck-local:
+       ls -l $(prefix)/lib
+       test -f $(prefix)/lib/libfoo1.a
+       test -f $(prefix)/lib/libfoo2.a
+       test -f $(prefix)/lib/libbar.a
+END
+
+echo 'int bar1(void) { return 0; }' > libfoo1.c
+echo 'int bar2(void) { return 0; }' > libfoo2.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE
+test -f libfoo2.c
+$MAKE install
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-ltlibraries.test b/tests/posixsubst-ltlibraries.test
new file mode 100755 (executable)
index 0000000..ffd09ae
--- /dev/null
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the LTLIBRARIES primary in a "simple" way.
+# Keep this in sync with sister test `posixsubst-libraries.test'.
+
+required='cc libtool libtoolize'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+foolibs = libfoo1 libfoo2
+barlibs = libbaz
+
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+lib_LTLIBRARIES = $(foolibs:=.la) $(barlibs:z=r.la)
+
+libbar.c:
+       echo 'int bar(void) { return 0; }' > $@
+CLEANFILES = libbar.c # For FreeBSD make.
+
+installcheck-local:
+       ls -l $(prefix)/lib
+       test -f $(prefix)/lib/libfoo1.la
+       test -f $(prefix)/lib/libfoo2.la
+       test -f $(prefix)/lib/libbar.la
+END
+
+echo 'int bar1(void) { return 0; }' > libfoo1.c
+echo 'int bar2(void) { return 0; }' > libfoo2.c
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE
+test -f libfoo2.c
+$MAKE install
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-programs.test b/tests/posixsubst-programs.test
new file mode 100755 (executable)
index 0000000..2b50e36
--- /dev/null
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the PROGRAMS primary.
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+t1 = foo1 foo2
+t2 = barx bar2
+
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+bin_PROGRAMS = $(t1:=-p) $(t2:2=y)
+
+installcheck-local:
+       ls -l $(prefix)/bin
+       test -f $(prefix)/bin/foo1-p$(EXEEXT)
+       test -x $(prefix)/bin/foo1-p$(EXEEXT)
+       test -f $(prefix)/bin/foo2-p$(EXEEXT)
+       test -x $(prefix)/bin/foo2-p$(EXEEXT)
+       test -f $(prefix)/bin/barx$(EXEEXT)
+       test -x $(prefix)/bin/barx$(EXEEXT)
+       test -f $(prefix)/bin/bary$(EXEEXT)
+       test -x $(prefix)/bin/bary$(EXEEXT)
+END
+
+for f in foo1-p.c foo2-p.c barx.c bary.c; do
+  echo 'int main(void) { return 0; }' > $f
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE
+$MAKE install
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-scripts.test b/tests/posixsubst-scripts.test
new file mode 100755 (executable)
index 0000000..73babc9
--- /dev/null
@@ -0,0 +1,99 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the SCRIPTS primary.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+# We have to be careful with 'test -x' commands on MinGW/MSYS, because
+# the file system does not actually have execute permission information.
+# Instead, that is emulated by looking at the file content, and returning
+# 0 if the file starts with, e.g., a COFF header or with '#!'.
+# So we need to create actual scripts in the make rules and in the file
+# creation below.
+
+cat > Makefile.am << 'END'
+t1 = foo1 foo2
+t2 = bar1x bar2
+t3 = quu-baz
+
+bar1 bar2:
+       (echo '#!/bin/sh' && echo 'exit 0') > $@
+quux.pl:
+       (echo '#!/bin/perl' && echo '1;') > $@
+CLEANFILES = bar1 bar2 quux.pl
+
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+dist_sbin_SCRIPTS = $(t1:=.sh)
+libexec_SCRIPTS = $(t2:x=)
+nodist_bin_SCRIPTS = $(t3:-baz=x.pl)
+
+check-local: test1 test2
+.PHONY: test1 test2
+test1:
+       ls -l
+       test -f bar1
+       test -f bar2
+       test -f quux.pl
+test2: distdir
+       ls -l $(distdir)
+## The scripts foo1.sh and foo2.sh should be distributed.
+       test -f $(distdir)/foo1.sh
+       test -f $(distdir)/foo2.sh
+## The scripts bar1, bar2 and quux.pl shouldn't be distributed.
+       test ! -r $(distdir)/bar1
+       test ! -r $(distdir)/bar2
+       test ! -r $(distdir)/quux.pl
+
+installcheck-local:
+       ls -l $(prefix)/libexec $(prefix)/bin $(prefix)/sbin
+       test -f $(prefix)/sbin/foo1.sh
+       test -x $(prefix)/sbin/foo1.sh
+       test -f $(prefix)/sbin/foo2.sh
+       test -x $(prefix)/sbin/foo2.sh
+       test -f $(prefix)/libexec/bar1
+       test -x $(prefix)/libexec/bar1
+       test -f $(prefix)/libexec/bar2
+       test -x $(prefix)/libexec/bar2
+       test -f $(prefix)/bin/quux.pl
+       test -x $(prefix)/bin/quux.pl
+END
+
+cat > foo1.sh <<'END'
+#!/bin/sh
+exit 0
+END
+cp foo1.sh foo2.sh
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cwd=`pwd` || Exit 1
+./configure --prefix="$cwd/_inst"
+$MAKE
+$MAKE test1 test2
+$MAKE install
+$MAKE installcheck
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-sources.test b/tests/posixsubst-sources.test
new file mode 100755 (executable)
index 0000000..557428e
--- /dev/null
@@ -0,0 +1,81 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the SOURCES primary.
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+
+FOO = foo.cxx
+BAR = bar__
+BAZ = baz.
+
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+foo_SOURCES = main.c $(FOO:.cxx=.c)
+dist_foo_SOURCES = $(BAR:__=.c)
+nodist_foo_SOURCES = $(BAZ:=c)
+
+bar.c baz.c:
+       echo 'int $@ (void) { return 0; }' | sed 's/\.c //' > $@
+CLEANFILES = baz.c
+CLEANFILES += bar.c # For FreeBSD make.
+
+.PHONY: test test2
+check-local: test1 test2
+test1:
+       ls -l . $(srcdir)
+       test -f $(srcdir)/bar.c
+       test -f baz.c
+test2: distdir
+       ls -l $(distdir)
+## These sources should be distributed ...
+       test -f $(distdir)/bar.c
+       test -f $(distdir)/foo.c
+       test -f $(distdir)/main.c
+## ... and this shouldn't.
+       test ! -r $(distdir)/baz.c
+END
+
+cat > main.c <<'END'
+int main(void)
+{
+  int foo(void), bar(void), baz(void);
+  return foo() + bar() + baz();
+}
+END
+
+echo 'int foo(void) { return 0; }' > foo.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+$MAKE test1 test2
+$MAKE distcheck
+
+:
diff --git a/tests/posixsubst-tests.test b/tests/posixsubst-tests.test
new file mode 100755 (executable)
index 0000000..68eaa46
--- /dev/null
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that POSIX variable expansion `$(var:str=rpl)' works when used
+# with the TESTS special variable.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+t1 = foo1 foo2
+t2 = barx
+t3 = bar2
+
+foo2.test barz:
+       (echo '#!/bin/sh' && echo 'exit 0') > $@ && chmod a+x $@
+CLEANFILES = foo2.test barz # For FreeBSD make.
+
+# Also try an empty match suffix, to ensure that the `:=' in there is
+# not confused by the parser with an unportable assignment operator.
+TESTS = $(t1:=.test) $(t2:x=y) $(t3:2=z)
+
+EXTRA_DIST = $(TESTS)
+MOSTLYCLEANFILES = *.out
+END
+
+cat > foo1.test <<'END'
+#!/bin/sh
+touch foo1.out
+test x"${TESTSUITE_OK-no}" = x"yes"
+END
+sed 's/foo1/bary/g' foo1.test > bary
+chmod +x foo1.test bary
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE check >out 2>&1 && { cat out; Exit 1; }
+cat out
+ls -l
+grep '^FAIL: foo1\.test *$' out
+grep '^PASS: foo2\.test *$' out
+grep '^FAIL: bary *$' out
+grep '^PASS: barz *$' out
+test -f foo1.out
+test -f bary.out
+
+TESTSUITE_OK=yes $MAKE distcheck
+
+:
index 44570fe..2208d66 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2004, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2009, 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
 # Check to make sure we recognize a Makefile.in, even if post-processed
 # and renamed.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >configure.in <<END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -42,7 +42,7 @@ mv myMakefile.in myMakefile.old
 echo '# Post-processed by post-processor 3.14.' > myMakefile.in
 cat myMakefile.old >> myMakefile.in
 
-./configure || Exit $?
+./configure
 
 test -f .deps/fred.Po || test -f _deps/fred.Po || Exit 1
 
index 6c61a2e..301ba4c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -28,8 +29,7 @@ bin_PROGRAMS = ppf
 ppf_SOURCES = foo.F q.r
 END
 
-: > foo.F
-: > q.r
-
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
index ceb2729..cbddea0 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2006, 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
@@ -30,8 +30,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # Please keep this underquoted and old-style.
 cat > configure.in << 'END'
 AC_INIT
index 6778f7a..5ed79dd 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -30,8 +31,6 @@
 required=libtoolize
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -47,7 +46,7 @@ END
 
 libtoolize
 $ACLOCAL
-AUTOMAKE_fails -a
+AUTOMAKE_fails -Wnone -a
 $FGREP 'foo.$(OBJEXT)' stderr
 
 :
index 95212ab..b068c10 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2008, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2002, 2004, 2008, 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
 # to debug the problem.
 # Note that this should be also in the documentation.
 
-required=gcc
 . ./defs || Exit 1
 
-set -e
-
-cat > main.c <<'EOF'
-int main() { return 0; }
-EOF
-
 cat > Makefile.am << 'EOF'
 if NEVER_TRUE
-NEVER_DEFINED = missingfile.c
+NEVER_DEFINED = foo.txt
 endif
-
-bin_PROGRAMS = main
-main_SOURCES = main.c $(NEVER_DEFINED)
+data_DATA = $(NEVER_DEFINED)
 EOF
 
 cat >> configure.in << 'EOF'
-AC_PROG_CC
-AC_ARG_ENABLE(foo,
+AC_ARG_ENABLE([foo],
 [  --enable-foo          Enable foo],
 [ if test "foo" = "bar" ; then
-    AM_CONDITIONAL(NEVER_TRUE, true)
+    AM_CONDITIONAL([NEVER_TRUE], [true])
   else
-    AM_CONDITIONAL(NEVER_TRUE, false)
+    AM_CONDITIONAL([NEVER_TRUE], [false])
   fi
 ])
 AC_OUTPUT
index 00a7aad..bf24935 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # `$(top_srcdir)/build', the location of the `.deps' directory
 # should be `$(top_builddir)/bar/.deps'.
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 mkdir foo
 
 cat >foo/main.c <<'EOF'
-int main() { return 0; }
+int main (void)
+{
+  return 0;
+}
 EOF
 
 cat >Makefile.am <<'EOF'
index 0d3f153..09130cc 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<EOF
 AC_CYGWIN
 EOF
index 58fb2a8..2b11fb7 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2009, 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 AM_OUTPUT_DEPENDENCY_COMMANDS macro cannot cope with
 # the colon in the CONFIG_FILES variable.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -51,8 +51,7 @@ END
 $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
-# FIXME: require compiler in $required rather than skipping here
-./configure || Exit $?
+./configure
 
 test -f .deps/fx64.Po
 
index 2bace6f..cff6bca 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2009, 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
 # Test for PR 266.
 # Dependency tracking -vs- nonstandard Makefile names
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE
@@ -40,8 +40,7 @@ END
 $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
-# FIXME: require compiler in $required rather than skipping here
-./configure --enable-dependency-tracking || Exit $?
+./configure --enable-dependency-tracking
 
 test -f .deps/fx64.Po
 
index f4e6fb2..6142930 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -26,8 +26,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_CONDITIONAL([FOOTEST], [false])
index d658668..5f3b064 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -26,8 +26,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_CONDITIONAL([FOOTEST], [false])
index 3a6f902..fc987f6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_PROG_CC
 AC_OUTPUT
 END
 
index 8f96db1..673845e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007, 2010, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 2010, 2011, 2012 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
 # Make sure that installing subdirectory libraries works.
 # PR/300
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AC_PROG_CC
@@ -45,7 +44,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --copy --add-missing
+$AUTOMAKE -Wno-extra-portability --copy --add-missing
 
 # We pass '--libdir' explicitly, to avoid spurious failures due to users
 # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE
index 06d3c32..24584e3 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007, 2008, 2009, 2010, 2012 Free Software
+# Copyright (C) 2002, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # Make sure that installing subdirectory libtool libraries works.
 # PR/300
 
-required='libtoolize gcc'
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -41,13 +39,10 @@ cat > a.c << 'END'
 int i = 3;
 END
 
-## A rule in the Makefile should create subdir
-# mkdir subdir
-
 libtoolize
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --copy --add-missing
+$AUTOMAKE -Wno-extra-portability --copy --add-missing
 
 # We pass '--libdir' explicitly, to avoid spurious failures due to users
 # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE
@@ -56,8 +51,11 @@ $AUTOMAKE --copy --add-missing
 cwd=`pwd` || Exit 99
 ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib"
 
-$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+# A rule in the Makefile should create subdir.
+test ! -d subdir
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
+test -d subdir
 
 grep 'liba.la .*-rpath .*lib' stdout
 grep 'liba.la .*-rpath .*lib/subdir' stdout && Exit 1
index 917a8a2..7a2aa99 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2007, 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
 # Make sure that installing subdirectory programs works.
 # PR/300
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_OUTPUT
index 7676c4b..24dd021 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 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
@@ -35,8 +35,6 @@
 required='libtoolize gcc'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -59,19 +57,19 @@ END
 : >foo.h
 
 for i in a b c d e f g h; do
-  cat >$i.c <<EOF
-#include "foo.h"
-int $i() { return 0; }
+  unindent >$i.c <<EOF
+    #include "foo.h"
+    int $i () { return 0; }
 EOF
 done
 
 libtoolize --force
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-extra-portability -a
 
 # Sanity check: make sure the variable we are attempting to force
-# is used by configure
+# is indeed used by configure.
 grep am_cv_CC_dependencies_compiler_type configure
 
 ./configure am_cv_CC_dependencies_compiler_type=dashmstdout
@@ -81,14 +79,14 @@ test -f librace.la && Exit 1
 $MAKE check
 
 # The failure we check usually occurs during the above build,
-# with an output such as
+# with an output such as:
 #
-# mv -f .libs/f.lo f.lo
-# mv: cannot stat `.libs/f.lo': No such file or directory
+#   mv -f .libs/f.lo f.lo
+#   mv: cannot stat `.libs/f.lo': No such file or directory
 #
 # (This may happen on `f' or on some other files.)
 
 test -f librace.la
-test -f tst # a proof that check-local was run
+test -f tst # A proof that check-local was run.
 
 :
index 88f7733..cef770b 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006, 2007, 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
 # Check support for AC_CONFIG_LIBOBJ_DIR vs LIBOBJS.
 # (pr401b.test and pr401c.test do the same for LTLIBOBJS and ALLOCA)
 
-parallel_tests=no
-required=gcc
+am_parallel_tests=no
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 mkdir lib src
 
 cat >lib/feep.c <<'EOF'
-char *
-feep ()
+const char *feep (void)
 {
   return "feep";
 }
@@ -36,10 +34,9 @@ EOF
 cat >src/main.c <<'EOF'
 #include <stdio.h>
 
-extern char *feep ();
+extern const char *feep (void);
 
-int
-main (int argc, char **argv)
+int main (void)
 {
   puts (feep ());
   return 0;
@@ -55,6 +52,7 @@ AC_LIBOBJ([feep])
 AC_LIBSOURCE([feep.c])
 AC_PROG_RANLIB
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
+AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])
 AC_OUTPUT
 EOF
 
@@ -76,12 +74,14 @@ cat >src/Makefile.am <<'EOF'
 check_PROGRAMS = main
 main_LDADD = ../lib/libfeep.a
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
@@ -97,7 +97,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -108,7 +108,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @LIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-extra-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -134,12 +134,14 @@ libfeep_a_LIBADD = $(LIBOBJS)
 check_PROGRAMS = main
 main_LDADD = libfeep.a
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
 ./configure
 test ! -d src/lib
 test ! -d 'src/$(top_builddir)'
@@ -166,7 +168,9 @@ check_PROGRAMS = src/main
 src_main_SOURCES = src/main.c
 src_main_LDADD = lib/libfeep.a
 
+if !CROSS_COMPILING
 TESTS = src/main
+endif
 
 check-local:
        test -f src/main.$(OBJEXT)
@@ -176,7 +180,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
index 0af4646..961f638 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006, 2007, 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
 # Check support for AC_CONFIG_LIBOBJ_DIR vs LTLIBOBJS.
 # (pr401.test and pr401c.test do the same for LIBOBJS and ALLOCA)
 
-parallel_tests=no
-required='gcc libtoolize'
+am_parallel_tests=no
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 mkdir lib src
 
 cat >lib/feep.c <<'EOF'
-char *
-feep ()
+const char *feep (void)
 {
   return "feep";
 }
@@ -36,10 +34,9 @@ EOF
 cat >src/main.c <<'EOF'
 #include <stdio.h>
 
-extern char *feep ();
+extern const char *feep (void);
 
-int
-main (int argc, char **argv)
+int main (void)
 {
   puts (feep ());
   return 0;
@@ -55,6 +52,7 @@ AC_LIBOBJ([feep])
 AC_LIBSOURCE([feep.c])
 AC_PROG_LIBTOOL
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
+AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])
 AC_OUTPUT
 EOF
 
@@ -76,20 +74,21 @@ cat >src/Makefile.am <<'EOF'
 check_PROGRAMS = main
 main_LDADD = ../lib/libfeep.la
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 libtoolize
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-extra-portability -a
 ./configure
 $MAKE distcheck
 
-
-## ------------------------------------------ ##
-## Traditional LIBOBJS with LIBOBJDIR set.    ##
-## ------------------------------------------ ##
+## ----------------------------------------- ##
+## Traditional LTLIBOBJS with LIBOBJDIR set. ##
+## ----------------------------------------- ##
 
 # Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons
 # unrelated to Automake or Makefile.am layout.
@@ -99,7 +98,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-extra-portability -a
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -110,7 +109,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-extra-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -135,12 +134,14 @@ libfeep_la_LIBADD = $(LTLIBOBJS)
 check_PROGRAMS = main
 main_LDADD = libfeep.la
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
 ./configure
 test ! -d src/lib
 test ! -d 'src/$(top_builddir)'
@@ -167,7 +168,9 @@ check_PROGRAMS = src/main
 src_main_SOURCES = src/main.c
 src_main_LDADD = lib/libfeep.la
 
+if !CROSS_COMPILING
 TESTS = src/main
+endif
 
 check-local:
        test -f src/main.$(OBJEXT)
@@ -177,7 +180,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
index b94bc16..ee38cb2 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2005, 2006, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2005, 2006, 2007, 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
 # Check support for AC_CONFIG_LIBOBJ_DIR vs ALLOCA.
 # (pr401.test and pr401b.test do the same for LIBOBJS and LTLIBOBJS)
 
-parallel_tests=no
-required=gcc
+am_parallel_tests=no
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 mkdir lib src
 
 ac_cv_func_alloca_works=no
 export  ac_cv_func_alloca_works
 
 cat >lib/alloca.c <<'EOF'
-char *
-feep ()
+const char *feep (void)
 {
   return "feep";
 }
@@ -39,10 +37,9 @@ EOF
 cat >src/main.c <<'EOF'
 #include <stdio.h>
 
-extern char *feep ();
+extern const char *feep (void);
 
-int
-main (int argc, char **argv)
+int main (void)
 {
   puts (feep ());
   return 0;
@@ -50,13 +47,14 @@ main (int argc, char **argv)
 EOF
 
 cat >>configure.in << 'EOF'
-## These lines are activated for later tests
+## These lines are activated for later tests.
 #: AC_CONFIG_LIBOBJ_DIR([lib])
 AC_PROG_CC
 #x AM_PROG_CC_C_O
 AC_PROG_RANLIB
 AC_FUNC_ALLOCA
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
+AM_CONDITIONAL([CROSS_COMPILING], [test $cross_compiling = yes])
 AC_OUTPUT
 EOF
 
@@ -78,19 +76,21 @@ cat >src/Makefile.am <<'EOF'
 check_PROGRAMS = main
 main_LDADD = ../lib/libfeep.a
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
 
-## ------------------------------------------ ##
-## Traditional LIBOBJS with LIBOBJDIR set.    ##
-## ------------------------------------------ ##
+## --------------------------------------- ##
+## Traditional ALLOCA with LIBOBJDIR set.  ##
+## --------------------------------------- ##
 
 # Invocation of AC_CONFIG_LIBOBJ_DIR may be necessary for reasons
 # unrelated to Automake or Makefile.am layout.
@@ -100,7 +100,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -111,7 +111,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @ALLOCA@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-extra-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -132,17 +132,19 @@ AUTOMAKE_OPTIONS = subdir-objects
 
 noinst_LIBRARIES = libfeep.a
 libfeep_a_SOURCES =
-libfeep_a_LIBADD = $(ALLOCA) $(LIBOBJS) # Add LIBOBJS for fun
+libfeep_a_LIBADD = $(ALLOCA) $(LIBOBJS) # Add LIBOBJS for fun.
 
 check_PROGRAMS = main
 main_LDADD = libfeep.a
 
+if !CROSS_COMPILING
 TESTS = main
+endif
 EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
 ./configure
 $MAKE
 test ! -d src/lib
@@ -169,7 +171,9 @@ check_PROGRAMS = src/main
 src_main_SOURCES = src/main.c
 src_main_LDADD = lib/libfeep.a
 
+if !CROSS_COMPILING
 TESTS = src/main
+endif
 
 check-local:
        test -f src/main.$(OBJEXT)
@@ -179,7 +183,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
index ab911ad..20db128 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
@@ -20,8 +21,6 @@
 required=libtool
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -39,7 +38,7 @@ END
 : > config.sub
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 
 grep '^LINK =' Makefile.in
 
index 079b0c0..1b5d7a7 100755 (executable)
@@ -24,8 +24,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # We'll use calls to stat to get debugging information.
 if stat /dev/null; then stat=stat; else stat=:; fi
 
@@ -44,7 +42,8 @@ $AUTOCONF
 
 ./configure
 $MAKE Makefile
-$EGREP 'FOOBAR|zardoz' Makefile && Exit 99 # Sanity check.
+# Sanity check.
+$EGREP 'FOOBAR|zardoz' Makefile && fatal_ 'unexpected AC_SUBST in Makefile'
 
 echo 'AC_SUBST([FOOBAR])' >> configure.in
 
@@ -67,14 +66,12 @@ $stat config.status Makefile configure.in
 # Makefile & config.status.  To reproduce this race consistently, we
 # need the following hackish wrappers.
 
-save_AUTOCONF=$AUTOCONF
-
 cat > aclocal-wrap <<END
 #!/bin/sh
 set -ex
 # aclocal shouldn't use our autoconf wrapper when extracting
 # the races from configure.in.
-AUTOCONF='$save_AUTOCONF'; export AUTOCONF
+AUTOCONF='$AUTOCONF'; export AUTOCONF
 $ACLOCAL "\$@"
 touch -r config.status aclocal.m4
 $stat aclocal.m4
@@ -85,7 +82,7 @@ cat > automake-wrap <<END
 set -ex
 # automake shouldn't use our autoconf wrapper when extracting
 # the races from configure.in.
-AUTOCONF='$save_AUTOCONF'; export AUTOCONF
+AUTOCONF='$AUTOCONF'; export AUTOCONF
 $AUTOMAKE "\$@"
 touch -r config.status Makefile.in
 $stat Makefile.in
index 31e6482..9c92c71 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
 # Test for PR automake/87.
 # "make distcheck" fails when two source dirs exist.
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 subdirs="foo bar"
 
 for i in $subdirs; do
     mkdir $i
-    cat >$i/$i.c <<EOF
-int main() { return 0; }
+    unindent >$i/$i.c <<EOF
+      int main (void)
+      {
+        return 0;
+      }
 EOF
-    cat >$i/Makefile.am <<EOF
-bin_PROGRAMS = $i
-${i}_SOURCES = $i.c
+    unindent >$i/Makefile.am <<EOF
+      bin_PROGRAMS = $i
+      ${i}_SOURCES = $i.c
 EOF
 done
 
@@ -44,10 +46,6 @@ AC_PROG_CC
 AC_OUTPUT(Makefile `echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g'`)
 EOF
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
 mkdir build
 
 $ACLOCAL
@@ -61,7 +59,7 @@ $AUTOMAKE -a
        if test -z "$next"; then
          Exit 1
        else
-          : # for shells with broken 'set -e'
+          : # For shells with broken 'set -e'.
        fi
        break
     fi
index 1f27f69..f8fa7ac 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -25,8 +26,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([support])
@@ -52,9 +51,9 @@ gzip -d $distdir.tar.gz
 tar tf $distdir.tar | $FGREP support
 
 tar xf $distdir.tar
-ls -l . $distdir # for debugging
+ls -l . $distdir # For debugging.
 test -d $distdir/support
-ls -l $distdir/support # for debugging
+ls -l $distdir/support # For debugging.
 test -f $distdir/support/install-sh
 
 :
index 8ba92ef..482e717 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 645f318..5bd9160 100755 (executable)
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_PROG_LIBTOOL
 AM_PROG_GCJ
index 315ee4e..9270023 100755 (executable)
 required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
@@ -48,9 +47,9 @@ installcheck-local: test
 .PHONY: test
 test:
        (cd '$(prefix)' && find .);: For debugging.
-       ls -l '$(libdir)/foo'
-       test -f '$(libdir)/foo'
-       test -x '$(libdir)/foo'
+       ls -l '$(libdir)/foo$(EXEEXT)'
+       test -f '$(libdir)/foo$(EXEEXT)'
+       test -x '$(libdir)/foo$(EXEEXT)'
        ls -l '$(bindir)/libquux.a'
        test -f '$(bindir)/libquux.a'
        ls -l '$(libexecdir)/bar.h'
@@ -75,7 +74,7 @@ END
 : > bar.h
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -a
 $AUTOCONF
 
 cwd=`pwd` || fatal_ "cannot get current working directory"
similarity index 91%
rename from tests/primary-prefix-invalid-couples.test
rename to tests/primary-prefix-invalid-couples.tap
index c3d6471..5f6ccb4 100755 (executable)
 
 . ./defs || Exit 1
 
-set -e
+plan_ "later"
 
 oIFS=$IFS # Saved for later.
 
+: > ar-lib
 : > ltmain.sh
 : > texinfo.tex
 : > elisp-comp
@@ -35,6 +36,7 @@ oIFS=$IFS # Saved for later.
 
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_SUBST([LIBTOOL], [:]) dnl So that we don't have to require Libtool.
 AM_PROG_GCJ
@@ -42,7 +44,7 @@ AM_PATH_PYTHON
 AM_PATH_LISPDIR
 END
 
-$ACLOCAL
+$ACLOCAL || fatal_ "aclocal failure"
 
 # Please keep this list in sync with the list of "Directory Variables"
 # in the GNU Coding Standards and with the list additional directory
@@ -165,14 +167,18 @@ cat Makefile.am
 
 set -x # Restore shell xtraces from now on.
 
-AUTOMAKE_fails -a
+AUTOMAKE_fails \
+  -d "'automake -a' error out on mismatched prefix/primary couples" \
+  -- --add-missing
 
 while read lineno prefix primary; do
   test -n "$prefix" && test -n "$primary" && test 0 -lt $lineno \
     || fatal_ "internal error in 'all.list'"
   grep "^${prefix}_${primary}$" allow.list >/dev/null && continue
   errmsg_rx=".*${prefix}dir.* not a legitimate directory .*$primary"
-  grep "^Makefile\\.am:$lineno: $errmsg_rx" stderr || Exit 1
+  command_ok_ \
+    "mismatched prefix/primary in ${prefix}_${primary}" \
+    grep "^Makefile\\.am:$lineno: $errmsg_rx" stderr
 done <all.list
 
 # Check that automake really failed only for the expected reason(s).
@@ -181,7 +187,8 @@ grep -v 'dir.* not a legitimate directory' stderr && Exit 1
 # Check that the same failures are present without the `--add-missing'
 # option.
 mv stderr stderr.old
-AUTOMAKE_fails
-diff stderr.old stderr
+AUTOMAKE_fails -d "automake error out on mismatched prefix/primary couples"
+command_ok_ "... and with the same diagnostic of 'automake -a'" \
+            diff stderr.old stderr
 
 :
index 6eb4149..8d03030 100755 (executable)
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_PROG_LIBTOOL
 AM_PATH_PYTHON
@@ -43,6 +42,7 @@ echo '@setfilename foo' > foo.texi
 : > texinfo.tex
 : > py-compile
 : > elisp-comp
+: > ar-lib
 
 # Setup Makefile.am.
 
index a866f8f..acf1c3a 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 bin_PROGRAMS = @programs@
 END
index 2fb3a60..63e9467 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003, 2010 Free Software
+# Copyright (C) 1996, 1997, 2001, 2002, 2003, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >> configure.in
 
 cat > Makefile.am << 'END'
index afccd0c..024b308 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
 
 # Make sure we can build programs ending in `.la'
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_PROG_CC
 AC_OUTPUT
@@ -29,6 +27,9 @@ EOF
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo.la
 foo_la_SOURCES = foo.c
+.PHONY: test
+test: all
+       test -f foo.la$(EXEEXT)
 END
 
 echo 'int main () { return 0; }' > foo.c
@@ -37,6 +38,6 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 ./configure
-$MAKE
+$MAKE test
 
 :
index 31745b7..045ddba 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1998, 2001, 2002, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 bin_SCRIPTS = zardoz qbert brownie
 END
similarity index 51%
rename from tests/subst2.test
rename to tests/programs-primary-rewritten.test
index 2bbabdd..2328bb6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2011, 2012 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
 # 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 a multi-line definition cannot be terminated by an empty
-# line (when there are @substitutions@ inside).
-. ./defs || Exit 1
+# Make sure xxx_PROGRAMS gets properly rewritten where needed.  These
+# checks have been introduced in commit `Release-1-9-254-g9d0eaef' into
+# the former test `subst2.test'.
 
-set -e
+. ./defs || Exit 1
 
 cat >> configure.in << 'END'
-AC_PROG_CC
-AC_SUBST([ABCDEFGHIJKLMNOPQRSTUVWX])
-AC_SUBST([ABCDEFGHIJKLMNOPQRSTUVWXY])
-AC_SUBST([ABCDEFGHIJKLMNOPQRSTUVWXYZ])
+AC_SUBST([FOO], [c])
 AC_OUTPUT
 END
 
 cat >Makefile.am <<'END'
-bin_PROGRAMS = x @ABCDEFGHIJKLMNOPQRSTUVWX@ @ABCDEFGHIJKLMNOPQRSTUVWXY@ @ABCDEFGHIJKLMNOPQRSTUVWXYZ@
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+EXEEXT = .bin
+
+check_PROGRAMS = a
+bin_PROGRAMS = b @FOO@
+noinst_PROGRAMS = $(bar) $(baz:=de)
 EXTRA_PROGRAMS =
 
-EXEEXT = .bin
+bar = zardoz
+baz = mau
 
-print-programs:
-       @echo BEG: $(bin_PROGRAMS) :END
+.PHONY: test
+test:
+       is $(check_PROGRAMS) == a.bin
+       is $(bin_PROGRAMS) == b.bin c
+       is $(noinst_PROGRAMS) == zardoz.bin maude.bin
 END
 
 $ACLOCAL
-$AUTOCONF
 $AUTOMAKE
+
+grep PROGRAMS Makefile.in # For debugging.
+
+# Check that no useless indirections are used.
+grep '^check_PROGRAMS = a$(EXEEXT)$' Makefile.in
+grep '^bin_PROGRAMS = b$(EXEEXT) @FOO@$' Makefile.in
+
+$AUTOCONF
 ./configure
-EXEEXT=.bin $MAKE print-programs >foo
-cat foo
-grep 'BEG: x.bin :END' foo
-EXEEXT=.bin am__empty=X $MAKE -e print-programs >foo
-cat foo
-grep 'BEG: x.bin X :END' foo
-
-# Test for another bug, where EXTRA_PROGRAMS was removed because it was empty.
-grep EXTRA_PROGRAMS Makefile.in
+$MAKE test
+
+:
diff --git a/tests/prove-runner b/tests/prove-runner
new file mode 100755 (executable)
index 0000000..e687c0a
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Helper script to run the automake testsuite through the `prove' utility.
+# See the "prove" and "installprove" targets in tests/Makefile.am.
+
+set -u
+
+nl='
+'
+
+tst=$1
+shift
+
+case $tst in
+  *.test)
+    echo 1..1
+    # Protect the output contents of the test script, since it might
+    # sometimes contain TAP lines that would confuse `prove'.  This
+    # has already happened in practice, especially for the tests
+    # checking TAP support in automake-generated test harnesses.
+    (${TEST_RUNNER-} "$tst" ${1+"$@"}; echo exit status: $?) 2>&1 | awk '
+      BEGIN { lastine = "exit status: 255"; }
+      { print " " $0; lastline = $0; }
+      END { st = lastline; sub("^exit status: *", "", st); exit st; }
+    '
+    st=$?
+    if test $st -eq 99; then
+      echo "not ok - $tst: hard failure (exit status $st)"
+    elif test $st -eq 77; then
+      echo "ok - $tst # SKIP"
+    else
+      case " ${XFAIL_TESTS-} " in
+        *" $tst "*) xs=' # TODO';;
+        *) xs='';;
+      esac
+      if test $st -eq 0; then
+        echo "ok - test script $tst passed$xs"
+      else
+        echo "not ok - test script $tst failed (exit status $st)$xs"
+      fi
+    fi
+    exit 0
+    ;;
+  *.tap)
+    ${TAP_RUNNER-} "$tst" ${1+"$@"} 2>&1
+    exit $?
+    ;;
+esac
+
+echo "Bail out! Invalid test script name '$tst'"
+exit 99
index a277639..1eee980 100755 (executable)
 required=python
 . ./defs || Exit 1
 
-set -e
-
 # We'll need to create files in `..', so we need one more subdirectory
 # level in order not to clutter up the top-level tests directory.
 mkdir sandbox
 cd sandbox
 
-cp "$testsrcdir/../lib/py-compile" .
+cp "$am_scriptdir/py-compile" . \
+  || fatal_ "failed to fetch auxiliary script py-compile"
 
 f=__init__
 for d in foo foo/bar "`pwd`/foo" . .. ../foo ''; do
index a7a3f89..f8d083e 100755 (executable)
@@ -21,9 +21,8 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir/../lib/py-compile" .
+cp "$am_scriptdir/py-compile" . \
+  || fatal_ "failed to fetch auxiliary script py-compile"
 
 cat > foo.py <<'END'
 # Try out some non-trivial syntax in here.
index 0da0d42..cbb5890 100755 (executable)
@@ -21,8 +21,6 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
 ocwd=`pwd` || Exit 99
 
 pyfiles="
@@ -55,7 +53,8 @@ lst='
 
 mkdir dir
 cd dir
-cp "$testsrcdir/../lib/py-compile" .
+cp "$am_scriptdir/py-compile" . \
+  || fatal_ "failed to fetch auxiliary script py-compile"
 mkdir sub sub/subsub
 touch $pyfiles
 ./py-compile $pyfiles
index 3d122e6..1bcd17b 100755 (executable)
@@ -19,9 +19,8 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir/../lib/py-compile" .
+cp "$am_scriptdir/py-compile" . \
+  || fatal_ "failed to fetch auxiliary script py-compile"
 
 # Should not give false positives when grepping for it, so use
 # an "uncommon" string (with ugly CamelCase).
index a72d173..df6b737 100755 (executable)
@@ -18,9 +18,8 @@
 
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir/../lib/py-compile" .
+cp "$am_scriptdir/py-compile" . \
+  || fatal_ "failed to fetch auxiliary script py-compile"
 
 cat > my-py <<'END'
 #!/bin/sh
index 69f9bb5..74bf638 100755 (executable)
@@ -20,9 +20,8 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir/../lib/py-compile" .
+cp "$am_scriptdir/py-compile" . \
+  || fatal_ "failed to fetch auxiliary script py-compile"
 
 : > ./-o.py
 : > ./--foo.py
index 7e8c786..0e2088d 100755 (executable)
@@ -19,9 +19,8 @@
 
 . ./defs || Exit 1
 
-set -e
-
-cp "$testsrcdir/../lib/py-compile" .
+cp "$am_scriptdir/py-compile" . \
+  || fatal_ "failed to fetch auxiliary script py-compile"
 
 # --help
 
@@ -47,6 +46,7 @@ LC_ALL=C $EGREP "^py-compile $year-$month-$day\.$hour" stdout
 test `wc -l <stdout` -eq 1
 
 # Unknown option.
+
 for opt in -b -d --foo; do
   ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
   cat stderr >&2
diff --git a/tests/python-dist.test b/tests/python-dist.test
new file mode 100755 (executable)
index 0000000..d66ee80
--- /dev/null
@@ -0,0 +1,78 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test distribution of *_PYTHON files.
+
+# This test does not require python.
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AM_PATH_PYTHON([], [:], [:])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+python_PYTHON = python.py
+dist_python_PYTHON = python-dist.py
+nodist_python_PYTHON = python-nodist.py
+
+pkgpython_PYTHON = pkgpython.py
+dist_pkgpython_PYTHON = pkgpython-dist.py
+nodist_pkgpython_PYTHON = pkgpython-nodist.py
+
+mydir = $(prefix)/my
+my_PYTHON = my.py
+dist_my_PYTHON = my-dist.py
+nodist_my_PYTHON = my-nodist.py
+
+my.py my-dist.py my-nodist.py:
+       : > $@
+
+.PHONY: disttest
+disttest: distdir
+       ls -l $(distdir)
+       test -f $(distdir)/python.py
+       test -f $(distdir)/python-dist.py
+       test ! -f $(distdir)/python-nodist.py
+       test -f $(distdir)/pkgpython.py
+       test -f $(distdir)/pkgpython-dist.py
+       test ! -f $(distdir)/pkgpython-nodist.py
+       test -f $(distdir)/my.py
+       test -f $(distdir)/my-dist.py
+       test ! -f $(distdir)/my-nodist.py
+END
+
+: > python.py
+: > python-dist.py
+: > python-nodist.py
+
+: > pkgpython.py
+: > pkgpython-dist.py
+: > pkgpython-nodist.py
+
+: > py-compile
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE disttest
+# It's not distributed, hence it shouldn't be needlessly generated.
+test ! -f my-nodist.py
+
+:
diff --git a/tests/python-vars.test b/tests/python-vars.test
new file mode 100755 (executable)
index 0000000..8e38d1f
--- /dev/null
@@ -0,0 +1,107 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that AM_PATH_PYTHON correctly sets all the output variables
+# advertised in the manual.
+
+required=python
+. ./defs || Exit 1
+
+# In case the user's config.site defines pythondir or pyexecdir.
+CONFIG_SITE=/dev/null; export CONFIG_SITE
+
+PYTHON=python
+
+# Update the definition below if the documentation changes.
+# Note that the value of the `pythondir' and `pyexecdir' variables can
+# vary among different python installations, so we need more relaxed
+# and ad-hoc checks for them.  Also, more proper "functional" checks
+# on them should be done in the `python-virtualenv.test' test.
+PYTHON_VERSION=`$PYTHON -c 'import sys; print(sys.version[:3])'` || Exit 1
+PYTHON_PLATFORM=`$PYTHON -c 'import sys; print(sys.platform)'` || Exit 1
+PYTHON_EXEC_PREFIX='${exec_prefix}'
+PYTHON_PREFIX='${prefix}'
+pkgpythondir="\${pythondir}/$me"
+pkgpyexecdir="\${pyexecdir}/$me"
+
+pyvars='PYTHON_VERSION PYTHON_PLATFORM PYTHON_PREFIX PYTHON_EXEC_PREFIX
+        pkgpythondir pkgpyexecdir'
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([vars-got pythondir pyexecdir])
+AM_PATH_PYTHON
+AC_OUTPUT
+END
+
+cat > my.py << 'END'
+def my():
+    return 1
+END
+
+cat > Makefile.am << 'END'
+
+python_PYTHON = my.py
+
+EXTRA_DIST = vars-exp
+
+check-local: test-in test-am
+.PHONY: test-in test-am
+
+test-in:
+       cat pythondir
+       case `cat pythondir` in '$${prefix}'/*);; *) exit 1;; esac
+       cat pyexecdir
+       case `cat pyexecdir` in '$${exec_prefix}'/*);; *) exit 1;; esac
+       cat $(srcdir)/vars-exp
+       cat $(builddir)/vars-got
+       diff $(srcdir)/vars-exp $(builddir)/vars-got
+
+## Note: this target's rules will be extended in the "for" loop below.
+test-am:
+       case '$(pythondir)' in '$(prefix)'/*);; *) exit 1;; esac
+       case '$(pyexecdir)' in '$(exec_prefix)'/*);; *) exit 1;; esac
+END
+
+echo @pythondir@ > pythondir.in
+echo @pyexecdir@ > pyexecdir.in
+
+: > vars-exp
+: > vars-got.in
+
+for var in $pyvars; do
+  eval val=\$$var
+  echo "var=$val" >> vars-exp
+  echo "var=@$var@" >> vars-got.in
+  echo "${tab}test x'\$($var)' = x'$val'" >> Makefile.am
+done
+
+cat Makefile.am
+cat vars-got.in
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+for var in pythondir pyexecdir $pyvars; do
+  grep "^$var *=" Makefile.in
+done
+
+$AUTOCONF
+./configure PYTHON="$PYTHON"
+
+$MAKE test-in test-am
+$MAKE distcheck
+
+:
diff --git a/tests/python-virtualenv.test b/tests/python-virtualenv.test
new file mode 100755 (executable)
index 0000000..7004446
--- /dev/null
@@ -0,0 +1,187 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that python support can work well with virtualenvs.
+# This test also works as a mild stress-test on the python support.
+
+required='cc python virtualenv'
+. ./defs || Exit 1
+
+# In case the user's config.site defines pythondir or pyexecdir.
+CONFIG_SITE=/dev/null; export CONFIG_SITE
+
+# Skip the test if a proper virtualenv cannot be created.
+virtualenv --verbose virtenv && test -f virtenv/bin/activate \
+  || skip_ "coulnd't create python virtual environment"
+
+# Activate the virtualenv.
+. ./virtenv/bin/activate
+# Sanity check.
+if test -z "$VIRTUAL_ENV"; then
+  framework_failure_ "can't activate python virtual environment"
+fi
+
+cwd=`pwd`
+py_version=`python -c 'import sys; print("%u.%u" % tuple(sys.version_info[:2]))'`
+py_site=$VIRTUAL_ENV/lib/python$py_version/site-packages
+
+# We need control over the package name.
+cat > configure.in << END
+AC_INIT([am_virtenv], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_SUBST([MY_VIRTENV], ['$cwd/virtenv'])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AM_PATH_PYTHON
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+python_PYTHON = am_foo.py
+pkgpython_PYTHON = __init__.py
+pyexec_LIBRARIES = libquux.a
+libquux_a_SOURCES = foo.c
+pkgpyexec_LIBRARIES = libzardoz.a
+libzardoz_a_SOURCES = foo.c
+
+py_site = $(MY_VIRTENV)/lib/python$(PYTHON_VERSION)/site-packages
+
+.PYTHON: debug test-run test-install test-uninstall
+debug:
+       @echo PYTHON: $(PYTHON)
+       @echo PYTHON_VERSION: $(PYTHON_VERSION)
+       @echo prefix: $(prefix)
+       @echo pythondir: $(pythondir)
+       @echo pkgpythondir: $(pkgpythondir)
+       @echo pyexecdir: $(pyexecdir)
+       @echo pkgpyexecdir: $(pkgpyexecdir)
+test-run:
+       ## In a virtualenv, the default python must be the custom
+       ## virtualenv python.
+       @: \
+         && py1=`python -c 'import sys; print(sys.executable)'` \
+         && py2=`$(PYTHON) -c 'import sys; print(sys.executable)'` \
+         && echo "py1: $$py1" \
+         && echo "py2: $$py2" \
+         && test -n "$$py1" \
+         && test -n "$$py2" \
+         && test x"$$py1" = x"$$py2"
+       ## Check that modules installed in the virtualenv are readily
+       ## available.
+       python -c 'from am_foo import foo_func; assert (foo_func () == 12345)'
+       python -c 'from am_virtenv import old_am; assert (old_am () == "AutoMake")'
+test-install:
+       test -f $(py_site)/am_foo.py
+       test -f $(py_site)/am_foo.pyc
+       test -f $(py_site)/am_foo.pyo
+       test -f $(py_site)/am_virtenv/__init__.py
+       test -f $(py_site)/am_virtenv/__init__.pyc
+       test -f $(py_site)/am_virtenv/__init__.pyo
+       test -f $(py_site)/libquux.a
+       test -f $(py_site)/am_virtenv/libzardoz.a
+test-uninstall:
+       test ! -f $(py_site)/am_foo.py
+       test ! -f $(py_site)/am_foo.pyc
+       test ! -f $(py_site)/am_foo.pyo
+       test ! -f $(py_site)/am_virtenv/__init__.py
+       test ! -f $(py_site)/am_virtenv/__init__.pyc
+       test ! -f $(py_site)/am_virtenv/__init__.pyo
+       test ! -f $(py_site)/libquux.a
+       test ! -f $(py_site)/am_virtenv/libzardoz.a
+all-local: debug
+END
+
+cat > am_foo.py << 'END'
+def foo_func ():
+    return 12345
+END
+
+cat > __init__.py << 'END'
+def old_am ():
+    return 'AutoMake'
+END
+
+cat > foo.c << 'END'
+int foo (void)
+{
+  return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Try a VPATH build.
+mkdir build
+cd build
+../configure --prefix="$VIRTUAL_ENV"
+$MAKE install
+$MAKE test-install
+$MAKE test-run
+$MAKE uninstall
+$MAKE test-uninstall
+cd ..
+
+# Try an in-tree build.
+./configure --prefix="$VIRTUAL_ENV"
+$MAKE install
+$MAKE test-install
+$MAKE test-run
+$MAKE uninstall
+$MAKE test-uninstall
+
+$MAKE distclean
+
+# Overriding pythondir and pyexecdir with cache variables should work.
+./configure am_cv_python_pythondir="$py_site" \
+            am_cv_python_pyexecdir="$py_site"
+$MAKE install
+$MAKE test-install
+$MAKE test-run
+$MAKE uninstall
+$MAKE test-uninstall
+
+$MAKE distclean
+
+# Overriding pythondir and pyexecdir at make time should be enough.
+./configure --prefix="$cwd/bad-prefix"
+pythondir=$py_site pyexecdir=$py_site
+export pythondir pyexecdir
+$MAKE -e install
+test ! -d bad-prefix
+$MAKE -e test-install
+$MAKE test-run
+$MAKE -e uninstall
+$MAKE -e test-uninstall
+unset pythondir pyexecdir
+
+# Also check that the distribution is self-contained, for completeness.
+$MAKE distcheck
+
+# Finally, check that if we disable the virtualenv, we shouldn't be
+# able to access to the installed modules anymore.
+cd build
+$MAKE install
+python -c 'import am_foo; print(am_foo.__file__)'
+python -c 'import am_virtenv; print(am_virtenv.__file__)'
+deactivate "nondestructive"
+python -c 'import am_foo' && Exit 1
+python -c 'import am_virtenv' && Exit 1
+
+:
index 8102ca0..07072da 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo 'AM_PATH_PYTHON' >> configure.in
 
 cat > Makefile.am << 'END'
@@ -27,7 +25,12 @@ python_PYTHON = foo.py
 END
 
 $ACLOCAL
-$AUTOMAKE -a
 
-grep '^py_compile =' Makefile.in
+AUTOMAKE_fails
+grep '^Makefile\.am:1:.* required file.*py-compile' stderr
+
+$AUTOMAKE -a
+grep '^py_compile *=' Makefile.in
 test -f py-compile
+
+:
index ff0ee15..a585cb7 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2007, 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
@@ -19,8 +19,6 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AM_PATH_PYTHON
 AM_CONDITIONAL([ONE], [test "x$one" = x1])
@@ -41,7 +39,9 @@ one.py:
 two.py:
        echo 'def two(): return 1' >$@
 
+.PHONY: disttest
 disttest: distdir
+       ls -l $(distdir)
        test -f $(distdir)/one.py
        test -f $(distdir)/two.py
 END
@@ -81,3 +81,5 @@ test ! -f "$inst/my/one.pyc"
 test ! -f "$inst/my/one.pyo"
 
 $MAKE disttest
+
+:
index 6a14368..969a461 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2004, 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006, 2008, 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
@@ -19,8 +20,6 @@
 # Python is not required for this test.
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 m4_define([_AM_PYTHON_INTERPRETER_LIST], [IShouldNotExist1 IShouldNotExist2])
 AM_PATH_PYTHON
@@ -53,3 +52,5 @@ $AUTOCONF --force
 ./configure PYTHON=foo >stdout && { cat stdout; Exit 1; }
 cat stdout
 grep 'PYTHON = foo' stdout
+
+:
index 2f52dfc..378a0dc 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
@@ -19,8 +19,6 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AM_PATH_PYTHON
 AC_OUTPUT
@@ -44,14 +42,14 @@ instdir=`pwd`/inst
 mkdir build
 cd build
 ../configure --prefix="/usr"
-DESTDIR=$instdir $MAKE -e install
+$MAKE install DESTDIR=$instdir
 
-# Perfunctory test that the files were created
+# Perfunctory test that the files were created.
 test -f "$instdir/usr/share/my/my.py"
 test -f "$instdir/usr/share/my/my.pyc"
 test -f "$instdir/usr/share/my/my.pyo"
 
-# If DESTDIR has made it into the byte compiled files, fail the test
+# If DESTDIR has made it into the byte compiled files, fail the test.
 $FGREP "$instdir" "$instdir/usr/share/my/my.pyo" \
                   "$instdir/usr/share/my/my.pyc" && Exit 1
 
index 3e14fa2..4403dda 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -18,8 +18,7 @@
 
 . ./defs || Exit 1
 
-set -e
-
+$ACLOCAL
 
 echo 1. pythondir not defined
 
@@ -28,8 +27,8 @@ PYTHON = x
 python_PYTHON = foo.py
 END
 
-$ACLOCAL
 AUTOMAKE_fails -a
+grep 'pythondir.*undefined' stderr
 grep AM_PATH_PYTHON stderr
 
 
@@ -40,8 +39,8 @@ PYTHON = x
 pkgpython_PYTHON = foo.py
 END
 
-$ACLOCAL
 AUTOMAKE_fails -a
+grep 'pkgpythondir.*undefined' stderr
 grep AM_PATH_PYTHON stderr
 
 
@@ -52,8 +51,8 @@ PYTHON = x
 pyexec_PYTHON = foo.py
 END
 
-$ACLOCAL
 AUTOMAKE_fails -a
+grep 'pyexecdir.*undefined' stderr
 grep AM_PATH_PYTHON stderr
 
 
@@ -64,8 +63,8 @@ PYTHON = x
 pkgpyexec_PYTHON = foo.py
 END
 
-$ACLOCAL
 AUTOMAKE_fails -a
+grep 'pkgpyexecdir.*undefined' stderr
 grep AM_PATH_PYTHON stderr
 
 
@@ -76,8 +75,8 @@ pkgpyexecdir = /here/we/go
 pkgpyexec_PYTHON = foo.py
 END
 
-$ACLOCAL
 AUTOMAKE_fails -a
+grep 'PYTHON.*undefined' stderr
 grep AM_PATH_PYTHON stderr
 
 
@@ -89,7 +88,7 @@ pkgpyexecdir = /here/we/go
 pkgpyexec_PYTHON = foo.py
 END
 
-$ACLOCAL
+rm -f py-compile
 $AUTOMAKE -a
 test -f py-compile
 
@@ -102,5 +101,6 @@ fubardir = /here/we/go
 fubar_PYTHON = foo.py
 END
 
-$ACLOCAL
 $AUTOMAKE -a
+
+:
index f01ad31..a5e12bd 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 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
@@ -19,8 +19,6 @@
 required=python
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AM_PATH_PYTHON
 AC_OUTPUT
@@ -47,3 +45,5 @@ $MAKE install
 test -f "$inst/my/one.py"
 test -f "$inst/my/one.pyc"
 test -f "$inst/my/one.pyo"
+
+:
index 11bb3ed..cd9e4d6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2008, 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
@@ -19,8 +19,6 @@
 # Python is not required for this test.
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AM_PATH_PYTHON
 AC_OUTPUT
@@ -32,7 +30,14 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-# Simulate no Python
+# Simulate no Python.
 ./configure PYTHON=: 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'no suitable Python interpreter found' stderr
+
+# Again, but from the environment this time.
+env PYTHON=: ./configure 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'no suitable Python interpreter found' stderr
+
+:
index 86f5863..c67d92b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2008, 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
 # Python is not required for this test.
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 # Hopefully the Python team will never release such a version.
-AM_PATH_PYTHON(9999.9)
+AM_PATH_PYTHON([9999.9])
 AC_OUTPUT
 EOF
 
@@ -34,6 +32,14 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure 2>stderr && { cat stderr >&2; Exit 1; }
+./configure >stdout 2>stderr && {
+  cat stdout
+  cat stderr >&2
+  Exit 1
+}
+cat stdout
 cat stderr >&2
+$EGREP 'checking for a Python interpreter with version >= 9999\.9\.\.\. no(ne)? *$' stdout
 grep 'no suitable Python interpreter found' stderr
+
+:
diff --git a/tests/python5b.test b/tests/python5b.test
new file mode 100755 (executable)
index 0000000..b0f76e6
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 2003, 2008, 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/>.
+
+# Test detection of missing Python.
+# Same as python5.test, but with the user forcing the python to use.
+
+required=python
+. ./defs || Exit 1
+
+cat >>configure.in << 'END'
+# Hopefully the Python team will never release such a version.
+AM_PATH_PYTHON([9999.9])
+AC_OUTPUT
+END
+
+mkdir bin
+cat > bin/my-python << 'END'
+#! /bin/sh
+exec python ${1+"$@"}
+END
+chmod a+x bin/my-python
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure PYTHON=my-python >stdout 2>stderr && {
+  cat stdout
+  cat stderr >&2
+  Exit 1
+}
+cat stdout
+cat stderr >&2
+grep 'whether my-python version is >= 9999\.9\.\.\. no *$' stdout
+grep '[Pp]ython interpreter is too old' stderr
+
+:
index 86dcfbb..8b3c6f3 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # Python is not required for this test.
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<\EOF
-AM_PATH_PYTHON(,, [echo "GREP ME$PYTHON" >&2])
+AM_PATH_PYTHON(,, [echo "$PYTHON" > py])
 AC_OUTPUT
 EOF
 
@@ -33,9 +31,8 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-# Simulate no Python
-./configure PYTHON=: 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep 'GREP ME:' stderr
+# Simulate no Python.
+./configure PYTHON=:
+test x"`cat py`" = x:
 
 :
index 27b2e79..1390a4e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # Python is not required for this test.
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<\EOF
 # Hopefully the Python team will never release such a version.
-AM_PATH_PYTHON(9999.9,, [echo "GREP ME$PYTHON" >&2])
+AM_PATH_PYTHON([9999.9], [], [echo "$PYTHON" > py])
 AC_OUTPUT
 EOF
 
@@ -34,8 +32,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep 'GREP ME:' stderr
+./configure
+test x"`cat py`" = x:
 
 :
index 51d02ad..981e64d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 required=python
 . ./defs || Exit 1
 
-set -e
-
-cat >>configure.in <<EOF
-AM_PATH_PYTHON(, [echo 'GREP ME' >&2])
+cat >>configure.in <<'EOF'
+# $PYTHON is supposed to be properly set in ACTION-IF-TRUE.
+AM_PATH_PYTHON(, [$PYTHON -V >py-version 2>&1])
 AC_OUTPUT
 EOF
 
@@ -32,8 +31,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep 'GREP ME' stderr
+./configure
+grep '^Python [0-9]\.[0-9][0-9]*\.[0-9]' py-version
 
 :
index 6a91e9f..da95884 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test ACTION-IF-TRUE in AM_PATH_PYTHON.
-# Same as python8.test, but requiring a version.
+# Similar to python8.test, but requiring a version.
 
 required=python
 . ./defs || Exit 1
 
-set -e
-
-cat >>configure.in <<EOF
-AM_PATH_PYTHON(0.0, [echo 'GREP ME' >&2])
+cat >>configure.in <<'EOF'
+# $PYTHON is supposed to be properly set in ACTION-IF-TRUE.
+AM_PATH_PYTHON([0.0], [$PYTHON -c 'print("%u:%u" % (1-1, 2**0))' > py.out])
 AC_OUTPUT
 EOF
 
@@ -33,8 +32,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing
 
-./configure 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-grep 'GREP ME' stderr
+./configure
+test x"`cat py.out`" = x0:1
 
 :
index 4937f4f..d20482c 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_CONDITIONAL(ONE, true)
index c025984..ef85475 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2010 Free Software Foundation, Inc.
+# 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 man_MANS = chgrp.1
 man_aux = $(man_MANS:.1=.x)
diff --git a/tests/remake-all-1.test b/tests/remake-all-1.test
new file mode 100755 (executable)
index 0000000..670b46a
--- /dev/null
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that the "all" target triggers rebuilt of outdated Makefiles.
+# See also sister test `remake-all-2.test'.
+
+. ./defs || Exit 1
+
+mkfile=Makefile
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+magic3=%%MagicStringThree%%
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([$mkfile sub/$mkfile])
+FOO='$magic1'
+AC_OUTPUT
+END
+
+mkdir sub
+echo SUBDIRS = sub > $mkfile.am
+: > sub/$mkfile.am
+
+$ACLOCAL
+$AUTOMAKE
+
+$EGREP "^all-am:.* $mkfile( |$)" $mkfile.in sub/$mkfile.in
+
+$AUTOCONF
+./configure
+
+$FGREP "$magic1" mkfile.in && Exit 1 # Sanity check.
+
+# Two code paths in configure.am:
+
+# - either a file in $(am__configure_deps) has been updated ...
+$sleep
+echo "AC_SUBST([FOO])" >> configure.in
+$MAKE
+$FGREP FOO $mkfile # For debugging.
+$FGREP $magic1 $mkfile
+
+# - ... or not; i.e., Makefile.am or an included file has.
+$sleep
+echo "# $magic2" >> $mkfile.am
+echo "# $magic3" >> sub/$mkfile.am
+$MAKE
+$FGREP $magic2 $mkfile
+$FGREP $magic3 sub/$mkfile
+
+:
diff --git a/tests/remake-all-2.test b/tests/remake-all-2.test
new file mode 100755 (executable)
index 0000000..395ef69
--- /dev/null
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that the "all" target triggers rebuilt of outdated makefiles.
+# This handle the case in which the makefiles are not called `Makefile'.
+# See also sister test `remake-all-1.test'.
+
+. ./defs || Exit 1
+
+mkfile=foobar
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+magic3=%%MagicStringThree%%
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([$mkfile sub/$mkfile])
+FOO='$magic1'
+AC_OUTPUT
+END
+
+mkdir sub
+
+cat > $mkfile.am <<END
+SUBDIRS = sub
+AM_MAKEFLAGS = -f $mkfile
+END
+
+cat > sub/$mkfile.am <<END
+AM_MAKEFLAGS = -f $mkfile
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+$EGREP "^all-am:.* $mkfile( |$)" $mkfile.in sub/$mkfile.in
+
+$AUTOCONF
+./configure
+
+$FGREP "$magic1" mkfile.in && Exit 1 # Sanity check.
+
+# Two code paths in configure.am:
+
+# - either a file in $(am__configure_deps) has been updated ...
+$sleep
+echo "AC_SUBST([FOO])" >> configure.in
+$MAKE -f $mkfile
+$FGREP FOO $mkfile # For debugging.
+$FGREP $magic1 $mkfile
+
+# - ... or not; i.e., Makefile.am or an included file has.
+$sleep
+echo "# $magic2" >> $mkfile.am
+echo "# $magic3" >> sub/$mkfile.am
+$MAKE -f $mkfile
+$FGREP $magic2 $mkfile
+$FGREP $magic3 sub/$mkfile
+
+:
index 888c9dd..064cfe5 100755 (executable)
@@ -24,8 +24,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
index 07142f6..07a419d 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 $ACLOCAL
index 9ed1078..32b6f37 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
 AC_OUTPUT
index fa5a672..3af9c0c 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 $ACLOCAL
diff --git a/tests/remake-deleted-m4-file.test b/tests/remake-deleted-m4-file.test
new file mode 100755 (executable)
index 0000000..f71d882
--- /dev/null
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when an m4 file gets removed and the macros it
+# defined get inlined into the caller.  Try with both an indirect
+# call and a direct one.  This can be seen as testing the "deleted
+# header file" issue w.r.t. aclocal.m4 dependencies.  See also related
+# test `acloca22.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+FOO_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+macro_value='the_answer=42; AC_SUBST([the_answer])'
+
+mkdir m4
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([FOO_MACRO], [BAR_MACRO])
+END
+
+cat > m4/bar.m4 <<END
+AC_DEFUN([BAR_MACRO], [$macro_value])
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+$sleep
+
+sed -e "s|BAR_MACRO|$macro_value|" m4/foo.m4 > t
+mv -f t m4/foo.m4
+rm -f m4/bar.m4
+
+using_gmake || $MAKE Makefile
+$MAKE test
+
+$sleep
+
+sed -e "s|FOO_MACRO|$macro_value|" configure.in > t
+mv -f t configure.in
+rm -f m4/foo.m4
+
+using_gmake || $MAKE Makefile
+$MAKE test
+
+:
diff --git a/tests/remake-gnulib-add-acsubst.test b/tests/remake-gnulib-add-acsubst.test
new file mode 100755 (executable)
index 0000000..5bfa6e4
--- /dev/null
@@ -0,0 +1,133 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when a new AC_SUBST'd variable is added, and C header
+# files are involved.
+# This test overlaps with others, and is not strictly necessary per se,
+# but it exercises a real use case (from gnulib, see:
+#  <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00005.html>
+# for more info).
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+MY_MACROS
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+BUILT_SOURCES = foo.h
+edit_h = sed -e 's|[@]foovar@|@foovar@|g'
+foo.h: foo.in.h
+       $(edit_h) < $(srcdir)/foo.in.h > $@-t
+       cat $@-t;: For debugging.
+       mv -f $@-t $@
+EXTRA_DIST = foo.in.h
+MOSTLYCLEANFILES = foo.h foo.h-t
+END
+
+mkdir m4
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([MY_MACROS], [
+     FOO_MACRO
+dnl: ZAP_MACRO
+])
+END
+
+cat > m4/bar.m4 <<'END'
+AC_DEFUN([FOO_MACRO], [
+     foovar=42; AC_SUBST([foovar])
+dnl: barvar=47; AC_SUBST([barvar])
+])
+END
+
+cat > foo.in.h <<'END'
+#define foo @foovar@
+END
+
+cat > foo.c <<'END'
+#include "foo.h"
+int main (void) { return 0; }
+typedef int checkfoo[1 - 2 * (foo != 42)];
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+
+: AC_SUBST @barvar@ and add it to foo.h.
+
+$sleep
+
+sed -e 's/^dnl:/   /' m4/bar.m4 > t
+mv -f t m4/bar.m4
+cat m4/bar.m4
+
+cat >> foo.in.h <<'END'
+#define bar @barvar@
+END
+
+cat >> foo.c <<'END'
+typedef int checkbar[1 - 2 * (bar != 47)];
+END
+
+cat >> Makefile.am <<'END'
+edit_h += -e 's|[@]barvar@|@barvar@|g'
+END
+
+using_gmake || $MAKE Makefile
+$MAKE
+
+: AC_SUBST @zapvar@ and add it to foo.h.
+# Do it in a slightly different way from how it was done for @barvar@.
+
+$sleep
+
+cat >> Makefile.am <<'END'
+edit_h += -e 's|[@]zapvar@|$(zapvar)|g'
+END
+
+cat >> foo.c <<'END'
+typedef int checkzap[1 - 2 * (zap != 163)];
+END
+
+sed -e 's/^dnl://' m4/foo.m4 > t
+mv -f t m4/foo.m4
+cat m4/foo.m4
+
+cat >> foo.in.h <<'END'
+#define zap @zapvar@
+END
+
+cat >> m4/bar.m4 <<'END'
+AC_DEFUN([ZAP_MACRO], [zapvar=163; AC_SUBST([zapvar])])
+END
+
+using_gmake || $MAKE Makefile
+$MAKE
+
+$MAKE distcheck
+
+:
diff --git a/tests/remake-gnulib-add-header.test b/tests/remake-gnulib-add-header.test
new file mode 100755 (executable)
index 0000000..7b0110c
--- /dev/null
@@ -0,0 +1,109 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when a new C header "guarded" by AC_SUBST'd
+# variables is added.
+# This test overlaps with others, and is not strictly necessary per se,
+# but it exercises a real use case (from gnulib, see:
+#  <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00005.html>
+# for more info).
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_CONFIG_HEADERS([config.h])
+AC_PROG_CC
+MY_MACROS
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I .
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+BUILT_SOURCES = $(STDIO_H)
+stdio.h: stdio.in.h
+       cp $(srcdir)/stdio.in.h $@
+MOSTLYCLEANFILES = stdio.h
+EXTRA_DIST = stdio.in.h
+check-local:
+       ls -l . $(srcdir)
+       if test -n '$(STDIO_H)'; then \
+           test -f stdio.h || exit 1; \
+       else \
+           test ! -f stdio.h || exit 1; \
+       fi
+END
+
+cat > macros.m4 <<'END'
+AC_DEFUN([MY_MACROS], [
+  override_stdio=false
+  if $override_stdio; then
+    STDIO_H=stdio.h
+    use_dummies=1
+  else
+    STDIO_H=
+    use_dummies=0
+  fi
+  AC_SUBST([STDIO_H])
+  AC_DEFINE_UNQUOTED([USE_DUMMIES], [$use_dummies],
+    [Whether to use dummy types.])
+])
+END
+
+cat > stdio.in.h <<'END'
+typedef struct dummyfile { void *p; } DUMMYFILE;
+END
+
+cat > foo.c <<'END'
+#include <config.h>
+#include <stdio.h>
+#if USE_DUMMIES
+DUMMYFILE *f;
+#else
+FILE *f;
+#endif
+int main () { return 0; }
+END
+
+$ACLOCAL -I .
+$AUTOHEADER
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+$MAKE
+ls -l
+test ! -f stdio.h
+# Also try our build rules in a VPATH build.
+$MAKE distcheck
+
+# No need to sleep here: "./configure" and "make distcheck" above
+# have already slept enough.
+
+sed -e 's/^\( *override_stdio\)=.*$/\1=:/' macros.m4 > t
+mv -f t macros.m4
+
+using_gmake || $MAKE Makefile
+$MAKE
+ls -l
+test -f stdio.h
+# Also try our build rules in a VPATH build.
+$MAKE distcheck
+
+:
diff --git a/tests/remake-gnulib-remove-header.test b/tests/remake-gnulib-remove-header.test
new file mode 100755 (executable)
index 0000000..9e9b4e2
--- /dev/null
@@ -0,0 +1,136 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when a C header "guarded" by AC_SUBST'd variables
+# is not needed anymore, or when it's needed again.
+# This test requires some user-level machinery, overlaps with other tests,
+# and is not strictly necessary per se, but it exercises a real, important
+# use case (from gnulib, see:
+#  <http://lists.gnu.org/archive/html/bug-gnulib/2011-04/msg00005.html>
+# for more info).
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_CONFIG_HEADERS([config.h])
+AC_PROG_CC
+MY_MACROS
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I .
+noinst_PROGRAMS = foo
+foo_SOURCES = foo.c
+BUILT_SOURCES = $(STDIO_H)
+if REPLACE_STDIO_H
+stdio.h: stdio.in.h $(top_builddir)/config.status
+       cp $(srcdir)/stdio.in.h $@
+else
+stdio.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES = stdio.h
+END
+
+cat > macros.m4 <<'END'
+AC_DEFUN([MY_MACROS], [
+  override_stdio=:
+  if $override_stdio; then
+    STDIO_H=stdio.h
+    use_dummies=1
+  else
+    STDIO_H=
+    use_dummies=0
+  fi
+  AC_SUBST([STDIO_H])
+  AC_DEFINE_UNQUOTED([USE_DUMMIES], [$use_dummies],
+    [Whether to use dummy types.])
+  AM_CONDITIONAL([REPLACE_STDIO_H], [test -n "$STDIO_H"])
+])
+END
+
+cat > stdio.in.h <<'END'
+typedef struct dummyfile { void *p; } DUMMYFILE;
+END
+
+cat > foo.c <<'END'
+#include <config.h>
+#include <stdio.h>
+#if USE_DUMMIES
+DUMMYFILE *f;
+#else
+FILE *f;
+#endif
+int main () { return 0; }
+END
+
+$ACLOCAL -I .
+$AUTOHEADER
+$AUTOMAKE
+$AUTOCONF
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  # Do not reject slow dependency extractors: we need dependency tracking.
+  $srcdir/configure --enable-dependency-tracking
+  if $FGREP 'depmode=none' Makefile; then
+    skip_ "automatic dependency tracking couldn't be activated"
+  fi
+
+  $MAKE
+  ls -l
+  test -f stdio.h
+
+  # Simulate that we don't need our custom stdio.h anymore.
+
+  $sleep
+  sed -e 's/^\( *override_stdio\)=.*$/\1=false/' $srcdir/macros.m4 > t
+  diff $srcdir/macros.m4 t && fatal_ "failed to edit macros.m4"
+  mv -f t $srcdir/macros.m4
+
+  using_gmake || $MAKE Makefile
+  $MAKE
+  ls -l
+  test ! -f stdio.h
+
+  # And now simulate that we want our custom stdio.h back.
+
+  $sleep
+  sed -e 's/^\( *override_stdio\)=.*$/\1=:/' $srcdir/macros.m4 > t
+  diff $srcdir/macros.m4 t && fatal_ "failed to edit macros.m4"
+  mv -f t $srcdir/macros.m4
+
+  using_gmake || $MAKE Makefile
+  $MAKE
+  ls -l
+  test -f stdio.h
+
+  $MAKE distclean
+  cd $srcdir
+
+done
+
+:
index 2d89c25..5aa57ba 100755 (executable)
@@ -24,8 +24,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 m4_include([foobar.m4])
 AC_OUTPUT
diff --git a/tests/remake-moved-m4-file.test b/tests/remake-moved-m4-file.test
new file mode 100755 (executable)
index 0000000..4af4fdd
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when m4 files get moved among different "include
+# dirs" (i.e. those passed to aclocal with `-I' option).
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+MY_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I d1 -I d2 -I d3
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+mkdir d1 d2 d3
+
+cat > d1/macros.m4 <<'END'
+AC_DEFUN([MY_MACRO], [FOO])
+END
+
+cat > d1/foo.m4 <<'END'
+AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])])
+END
+
+$ACLOCAL -I d1
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+# Move one file.
+mv d1/foo.m4 d2/foo.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/d2/foo.m4
+test ! -f $distdir/d1/foo.m4
+test -f $distdir/d1/macros.m4
+test ! -f $distdir/d2/macros.m4
+
+# Move both files at once.
+mv d1/macros.m4 d3/macros.m4
+mv d2/foo.m4 d3/foo.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/d3/foo.m4
+test -f $distdir/d3/macros.m4
+test ! -f $distdir/d1/foo.m4
+test ! -f $distdir/d2/foo.m4
+test ! -f $distdir/d1/macros.m4
+test ! -f $distdir/d2/macros.m4
+
+:
index b3a7a41..6c04135 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am <<'END'
diff --git a/tests/remake-renamed-m4-file.test b/tests/remake-renamed-m4-file.test
new file mode 100755 (executable)
index 0000000..3378fab
--- /dev/null
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when m4 files get renamed.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+MY_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+mkdir m4
+
+cat > m4/macros.m4 <<'END'
+AC_DEFUN([MY_MACRO], [FOO])
+END
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([FOO], [the_answer=42; AC_SUBST([the_answer])])
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+# Rename one file at the time.
+
+mv m4/foo.m4 m4/bar.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/bar.m4
+test ! -f $distdir/m4/foo.m4
+
+mv m4/macros.m4 m4/defs.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/defs.m4
+test ! -f $distdir/m4/macros.m4
+
+# Rename both files at once.
+
+mv m4/bar.m4 m4/quux.m4
+mv m4/defs.m4 acinclude.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/quux.m4
+test -f $distdir/acinclude.m4
+test ! -f $distdir/m4/foo.m4
+test ! -f $distdir/m4/bar.m4
+test ! -f $distdir/m4/macros.m4
+test ! -f $distdir/m4/defs.m4
+
+:
diff --git a/tests/remake-renamed-m4-macro-and-file.test b/tests/remake-renamed-m4-macro-and-file.test
new file mode 100755 (executable)
index 0000000..3c1f867
--- /dev/null
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when an m4 file gets renamed and *simultaneously*
+# an m4 macro in it gets renamed.  Kudos to Bruno Haible for thinking
+# about this situation.  See also related test `acloca22.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+MY_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+mkdir m4
+
+cat > m4/macros.m4 <<'END'
+AC_DEFUN([MY_MACRO], [FOO_MACRO])
+END
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([FOO_MACRO], [the_answer=42; AC_SUBST([the_answer])])
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+# Rename only one file and one macro.
+
+$sleep
+sed -e 's/FOO_MACRO/BAR_MACRO/' m4/foo.m4 > m4/bar.m4
+rm -f m4/foo.m4
+sed -e 's/FOO_MACRO/BAR_MACRO/' m4/macros.m4 > t
+mv -f t m4/macros.m4
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/bar.m4
+test -f $distdir/m4/macros.m4
+test ! -f $distdir/m4/foo.m4
+
+# Rename both at once.
+
+$sleep
+sed -e 's/BAR_MACRO/QUUX_MACRO/' \
+  m4/bar.m4 > m4/quux.m4
+sed -e 's/BAR_MACRO/QUUX_MACRO/' -e 's/MY_MACRO/A_MACRO/' \
+  m4/macros.m4 > m4/defs.m4
+rm -f m4/macros.m4 m4/bar.m4
+sed -e 's/BAR_MACRO/QUUX_MACRO/' -e 's/MY_MACRO/A_MACRO/' configure.in > t
+mv -f t configure.in
+using_gmake || $MAKE Makefile
+$MAKE test
+$MAKE distdir
+ls -l $distdir $distdir/*
+test -f $distdir/m4/quux.m4
+test -f $distdir/m4/defs.m4
+test ! -f $distdir/m4/bar.m4
+test ! -f $distdir/m4/macros.m4
+
+:
diff --git a/tests/remake-renamed-m4-macro.test b/tests/remake-renamed-m4-macro.test
new file mode 100755 (executable)
index 0000000..82fcf45
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when the name of an m4 macro change.  Try both with
+# and without indirection.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+MY_MACRO
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: test
+test:
+       test '$(the_answer)' -eq 42
+END
+
+mkdir m4
+
+cat > m4/macros.m4 <<'END'
+AC_DEFUN([MY_MACRO], [FOO_1])
+END
+
+cat > m4/foo.m4 <<'END'
+AC_DEFUN([FOO_1], [the_answer=42
+                   AC_SUBST([the_answer])])
+END
+
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE test
+
+$sleep
+
+for x in macros foo; do
+  sed -e 's/FOO_1/FOO_2/' m4/$x.m4 > t
+  mv -f t m4/$x.m4
+done
+
+using_gmake || $MAKE Makefile
+$MAKE test
+
+$sleep
+
+for f in m4/macros.m4 configure.in; do
+  sed -e 's/MY_MACRO/YOUR_MACRO/' $f > t
+  mv -f t $f
+done
+
+using_gmake || $MAKE Makefile
+$MAKE test
+
+:
index 1e369f8..8f4a180 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 
 # Check that remake rules works for adding a new subdirectory from a
 # pre-existing subdirectory.
+# See also the other similar tests `remake-subdir*.test', and the
+# related test `aclocal5.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 m4_include([subdirs.m4])
 AC_SUBST([MAGIC], [magic])
index cc683f3..bda1ac7 100755 (executable)
 # Check that remake rules works from subdirectories, even using
 # `GNUmakefile' as makefiles name.  This obviously requires GNU
 # make.
+# See also the other similar tests `remake-subdir*.test', and the
+# related test `aclocal5.test'
 
 required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 magic1='::MagicString::One::'
 magic2='__MagicString__Two__'
 
index 18ba732..40f3e5f 100755 (executable)
@@ -23,8 +23,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in <<END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
index 5bbc345..b4cd656 100755 (executable)
 
 # Check that remake rules works from subdirectories, even with non-GNU
 # make implementations.
+# See also the other similar tests `remake-subdir*.test', and the
+# related test `aclocal5.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 if using_gmake; then
   remake=$MAKE
 else
index 09d1a36..a70b5f9 100755 (executable)
 
 # Check that remake rules works from subdirectories, even when makefiles
 # are not named "Makefile".
+# See also the other similar tests `remake-subdir*.test', and the
+# related test `aclocal5.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 magic1='::MagicString::One::'
 magic2='__MagicString__Two__'
 
index 9c86b1b..236649d 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2000, 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
 # 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 remaking rules in subdir are correctly generated.
+# Weak "grepping" test trying to ensure that remaking rules in a subdir
+# are correctly generated.
+# See also sister functional test `remake1a.test'.
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(sub/Makefile)
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
 END
 
 mkdir sub
 : > sub/Makefile.am
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^Makefile' sub/Makefile.in
+
+:
diff --git a/tests/remake10a.test b/tests/remake10a.test
new file mode 100755 (executable)
index 0000000..0521860
--- /dev/null
@@ -0,0 +1,112 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules for m4 files included (also recursively) by
+# configure.ac.
+# Keep in sync with sister tests `remake10b.test' and `remake10c.test'.
+
+. ./defs || Exit 1
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+magic3=%%MagicStringThree%%
+
+if using_gmake; then
+  remake="$MAKE nil"
+else
+  remake="$MAKE Makefile"
+fi
+
+cat >> configure.in <<END
+m4_include([foo.m4])
+AC_SUBST([FINGERPRINT], [my_fingerprint])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+.PHONY: nil
+nil:
+## Used by "make distcheck" later.
+check-local:
+       test -f $(top_srcdir)/foo.m4
+       test ! -r $(top_srcdir)/bar.m4
+       test x'$(FINGERPRINT)' = x'DummyValue'
+END
+
+echo 'm4_define([my_fingerprint], [BadBadBad])' > foo.m4
+
+$sleep # So that generated autotools files will be newer than prerequisites.
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    top_srcdir=..
+  else
+    top_srcdir=.
+  fi
+
+  $top_srcdir/configure
+  $MAKE # Should be a no-op.
+
+  $sleep
+  echo "m4_define([my_fingerprint], [$magic1])" > $top_srcdir/foo.m4
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile
+
+  $sleep
+  echo "m4_define([my_fingerprint], [$magic2])" > $top_srcdir/foo.m4
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile
+
+  $sleep
+  echo "m4_include([bar.m4])" > $top_srcdir/foo.m4
+  echo "m4_define([my_fingerprint], [$magic3])" > $top_srcdir/bar.m4
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile && Exit 1
+  $FGREP $magic3 Makefile
+
+  $sleep
+  echo "m4_define([my_fingerprint], [$magic1])" > $top_srcdir/bar.m4
+  $remake
+  $FGREP $magic2 Makefile && Exit 1
+  $FGREP $magic3 Makefile && Exit 1
+  $FGREP $magic1 Makefile
+
+  $sleep
+  echo "m4_define([my_fingerprint], [DummyValue])" > $top_srcdir/foo.m4
+  using_gmake || $remake
+  $MAKE distcheck
+  $FGREP $magic1 Makefile && Exit 1 # Sanity check.
+  $FGREP $magic2 Makefile && Exit 1 # Likewise.
+  $FGREP $magic3 Makefile && Exit 1 # Likewise.
+
+  $MAKE distclean
+
+  cd $top_srcdir
+
+done
+
+:
diff --git a/tests/remake10b.test b/tests/remake10b.test
new file mode 100755 (executable)
index 0000000..8637c4b
--- /dev/null
@@ -0,0 +1,111 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules for am files included (also recursively) by
+# Makefile.am.
+# Keep in sync with sister tests `remake10a.test' and `remake10c.test'.
+
+. ./defs || Exit 1
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+magic3=%%MagicStringThree%%
+
+if using_gmake; then
+  remake="$MAKE nil"
+else
+  remake="$MAKE Makefile"
+fi
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+.PHONY: nil
+nil:
+include foo.am
+## Used by "make distcheck" later.
+check-local:
+       test -f $(top_srcdir)/foo.am
+       test ! -r $(top_srcdir)/bar.am
+       test x'$(FINGERPRINT)' = x'DummyValue'
+END
+
+echo 'FINGERPRINT = BadBadBad' > foo.am
+
+$sleep # So that generated autotools files will be newer than prerequisites.
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    top_srcdir=..
+  else
+    top_srcdir=.
+  fi
+
+  $top_srcdir/configure
+  $MAKE # Should be a no-op.
+
+  $sleep
+  echo "FINGERPRINT = $magic1" > $top_srcdir/foo.am
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile
+
+  $sleep
+  echo "FINGERPRINT = $magic2" > $top_srcdir/foo.am
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile
+
+  $sleep
+  echo 'include $(top_srcdir)/bar.am' > $top_srcdir/foo.am
+  echo "FINGERPRINT = $magic3" > $top_srcdir/bar.am
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile && Exit 1
+  $FGREP $magic3 Makefile
+
+  $sleep
+  echo "FINGERPRINT = $magic1" > $top_srcdir/bar.am
+  $remake
+  $FGREP $magic2 Makefile && Exit 1
+  $FGREP $magic3 Makefile && Exit 1
+  $FGREP $magic1 Makefile
+
+  $sleep
+  echo "FINGERPRINT = DummyValue" > $top_srcdir/foo.am
+  using_gmake || $remake
+  $MAKE distcheck
+  $FGREP $magic1 Makefile && Exit 1 # Sanity check.
+  $FGREP $magic2 Makefile && Exit 1 # Likewise.
+  $FGREP $magic3 Makefile && Exit 1 # Likewise.
+
+  $MAKE distclean
+
+  cd $top_srcdir
+
+done
+
+:
diff --git a/tests/remake10c.test b/tests/remake10c.test
new file mode 100755 (executable)
index 0000000..2e062a1
--- /dev/null
@@ -0,0 +1,115 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules for m4 files included (also recursively) by
+# aclocal.m4.
+# Keep in sync with sister tests `remake10a.test' and `remake10b.test'.
+
+. ./defs || Exit 1
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+magic3=%%MagicStringThree%%
+
+if using_gmake; then
+  remake="$MAKE nil"
+else
+  remake="$MAKE Makefile"
+fi
+
+cat >> configure.in <<END
+FINGERPRINT='my_fingerprint'
+AC_SUBST([FINGERPRINT])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: nil
+nil:
+## Used by "make distcheck" later.
+check-local:
+       test -f $(top_srcdir)/m4/foo.m4
+       test ! -r $(top_srcdir)/m4/bar.m4
+       test x'$(FINGERPRINT)' = x'DummyValue'
+END
+
+mkdir m4
+echo 'AC_DEFUN([my_fingerprint], [BadBadBad])' > m4/foo.m4
+
+$sleep # So that generated autotools files will be newer than prerequisites.
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    top_srcdir=..
+  else
+    top_srcdir=.
+  fi
+
+  $top_srcdir/configure
+  $MAKE # Should be a no-op.
+
+  $sleep
+  echo "AC_DEFUN([my_fingerprint], [$magic1])" > $top_srcdir/m4/foo.m4
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile
+
+  $sleep
+  echo "AC_DEFUN([my_fingerprint], [$magic2])" > $top_srcdir/m4/foo.m4
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile
+
+  $sleep
+  echo "m4_include([m4/bar.m4])" > $top_srcdir/m4/foo.m4
+  echo "AC_DEFUN([my_fingerprint], [$magic3])" > $top_srcdir/m4/bar.m4
+  $remake
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile && Exit 1
+  $FGREP $magic3 Makefile
+
+  $sleep
+  echo "AC_DEFUN([my_fingerprint], [$magic1])" > $top_srcdir/m4/bar.m4
+  $remake
+  $FGREP $magic2 Makefile && Exit 1
+  $FGREP $magic3 Makefile && Exit 1
+  $FGREP $magic1 Makefile
+
+  $sleep
+  echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $top_srcdir/m4/foo.m4
+  echo "AC_DEFUN([AM_UNUSED], [NoSuchMacro])" > $top_srcdir/m4/bar.m4
+  using_gmake || $remake
+  $MAKE distcheck
+  $FGREP $magic1 Makefile && Exit 1 # Sanity check.
+  $FGREP $magic2 Makefile && Exit 1 # Likewise.
+  $FGREP $magic3 Makefile && Exit 1 # Likewise.
+
+  $MAKE distclean
+
+  cd $top_srcdir
+
+done
+
+:
diff --git a/tests/remake11.test b/tests/remake11.test
new file mode 100755 (executable)
index 0000000..b00e562
--- /dev/null
@@ -0,0 +1,81 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules in deeply nested subdirectories, and with a lot
+# of files.  This is basically a mild stress test, ensuring that rebuild
+# rules don't break in obvious ways in a slightly "heavier than usual"
+# setup.
+
+. ./defs || Exit 1
+
+ocwd=`pwd` || Exit 1
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+
+echo "AC_SUBST([FOO], [$magic1])" >> configure.in
+
+echo "@FOO@" > bar.in
+echo "AC_CONFIG_FILES([bar])" >> configure.in
+for i in 0 1 2 3 4 5 6 7 8 9; do
+  d=${d+"$d/"}sub$i
+  echo "SUBDIRS = sub$i" > Makefile.am
+  echo "AC_CONFIG_FILES([$d/Makefile])" >> "$ocwd"/configure.in
+  echo "AC_CONFIG_FILES([$d/bar])" >> "$ocwd"/configure.in
+  mkdir sub$i
+  cd sub$i
+  echo "$d: @FOO@" > bar.in
+done
+echo AC_OUTPUT >> "$ocwd"/configure.in
+: > Makefile.am
+unset d i
+bottom=`pwd`
+
+cd "$ocwd"
+
+makefiles_am_list=`find . -name Makefile.am | LC_ALL=C sort`
+makefiles_list=`echo "$makefiles_am_list" | sed 's/\.am$//'`
+bar_in_list=`find . -name bar.in | LC_ALL=C sort`
+bar_list=`echo "$bar_in_list" | sed 's/\.in$//'`
+
+cat configure.in # For debugging.
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+for f in configure config.status $makefiles_list $bar_list; do
+  $FGREP "$magic1" $f
+done
+
+$sleep
+sed "s/$magic1/$magic2/" configure.in >configure.tmp
+mv -f configure.tmp configure.in
+
+cd "$bottom"
+$MAKE
+cd "$ocwd"
+
+for f in configure config.status $makefiles_list $bar_list; do
+  $FGREP "$magic2" $f
+done
+$FGREP "$magic1" configure config.status $makefiles_list $bar_list && Exit 1
+
+$MAKE distcheck
+
+:
diff --git a/tests/remake12.test b/tests/remake12.test
new file mode 100755 (executable)
index 0000000..883fe71
--- /dev/null
@@ -0,0 +1,146 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test basic remake rules for Makefiles with non-default names
+# and/or with multiple sources.
+
+. ./defs || Exit 1
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+magic3=%%MagicStringThree%%
+
+# See if the user's make implementation support an include directive.
+# We need it in this test.
+echo 'all:; @echo include is supported' > incl.mk
+echo 'include incl.mk' > gnu-style.mk
+echo '.include "incl.mk"' > bsd-style.mk
+if $MAKE -f gnu-style.mk | grep 'include is supported'; then
+  echo "$me: GNU make include style supported"
+  include_zardoz='include zardoz'
+elif $MAKE -f bsd-style.mk | grep 'include is supported'; then
+  echo "$me: BSD make include style supported"
+  include_zardoz='.include "zardoz"'
+else
+  skip_ "make doesn't support any \"include\" directive"
+fi
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([zardoz])
+AC_CONFIG_LINKS([Makefile:Makefile])
+AC_OUTPUT
+END
+
+cat > zardoz.am <<END
+EXTRA_DIST = Makefile
+#H: $magic1
+END
+
+cat > Makefile <<END
+$include_zardoz
+nil:
+.PHONY: nil
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+if using_gmake; then
+  $MAKE nil
+else
+  $MAKE Makefile
+fi
+grep '^#H:' zardoz.in # For debugging.
+$FGREP $magic1 zardoz
+$FGREP $magic1 zardoz.in
+$MAKE distcheck
+$MAKE distclean # This shouldn't remove Makefile.
+ls -l
+test -f Makefile
+
+./configure
+
+$sleep
+sed "s/%MAGIC3%/$magic3/" >> Makefile <<'END'
+my-check:
+       ls -l . $(srcdir) ;: For debugging.
+       test -f $(srcdir)/quux.am
+       test -f $(srcdir)/quux.in
+       test -f $(srcdir)/bot.in
+       test -f $(srcdir)/top.in
+       test ! -r $(srcdir)/zardoz.am
+       test ! -r $(srcdir)/zardoz.in
+       grep FOO zardoz ;: For debugging.
+       test x'$(FOO)' = x'%MAGIC3%'
+test:
+       ls -l ;: For debugging.
+       test x'$(FOO)' = x'dummy'
+.PHONY: test my-check
+END
+sed "s/^#H:.*/#H: $magic2/" zardoz.am > t
+cat >> t <<'END'
+# Used by "make distcheck" below.
+check-local: my-check
+END
+mv -f t zardoz.am
+cat zardoz.am # For debugging.
+if using_gmake; then
+  $MAKE nil
+else
+  $MAKE zardoz
+fi
+$FGREP my-check zardoz # Sanity check.
+$FGREP $magic1 zardoz zardoz.in && Exit 1
+$FGREP $magic2 zardoz
+$FGREP $magic2 zardoz.in
+
+./configure
+
+$sleep
+sed 's/^\(AC_CONFIG_FILES\)(.*/\1([zardoz:top.in:quux.in:bot.in])/' \
+  <configure.in >t
+mv -f t configure.in
+cat configure.in # For debugging.
+sed '/^#H:/d' zardoz.am > quux.am
+echo 'FOO = dummy' >> quux.am
+echo 'BAR = $(BAZ)' > top.in
+echo "BAZ = $magic3" > bot.in
+is_gmake || $MAKE zardoz
+$MAKE test
+$FGREP my-check zardoz # Sanity check.
+$FGREP $magic3 quux.in && Exit 1
+$FGREP $magic3 zardoz
+$FGREP $magic1 zardoz && Exit 1
+$FGREP $magic2 zardoz && Exit 1
+# After the remake above, the files `zardoz.am' and `zardoz.in'
+# should be no more needed.
+echo 'endif' > zardoz.am # Put in a syntax error.
+is_gmake || $MAKE zardoz
+$MAKE test
+rm -f zardoz.in zardoz.am # Get rid of them.
+is_gmake || $MAKE zardoz
+$MAKE test
+
+echo 'FOO = $(BAR)' >> quux.am
+is_gmake || $MAKE zardoz
+$MAKE distcheck
+
+:
diff --git a/tests/remake1a.test b/tests/remake1a.test
new file mode 100755 (executable)
index 0000000..c55ffb6
--- /dev/null
@@ -0,0 +1,55 @@
+#! /bin/sh
+# Copyright (C) 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 remaking rules in subdir are correctly generated.
+# See also sister "grepping" test `remake.test'.
+
+. ./defs || Exit 1
+
+fingerprint='=/FiNgErPrInT/='
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+# Rebuild rules should work even if there is no top-level
+# makefiles, if we are careful enough to trigger them only
+# in proper subdirs.
+$sleep
+echo "# $fingerprint" > sub/Makefile.am
+cd sub
+$MAKE Makefile
+cd ..
+# Check that no spurious Makefile has been created in the
+# top-level directory.
+test ! -r Makefile
+# Check that the Makefile in the subdirectory has been properly
+# updated.
+$FGREP "$fingerprint" sub/Makefile
+
+:
index 3b63dea..486da34 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2000, 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
 # 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 remaking rules in subdir are correct.
+# Weak "grepping" test trying to ensure that remaking rules in subdir
+# are correct even when there is no upper-level Makefile.
+# TODO: we should really add also functional tests for this!
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(sub/Makefile)
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
 END
 
 mkdir sub
 : > sub/Makefile.am
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
-grep 'AUTOMAKE.*sub/Makefile' sub/Makefile.in
+grep '\$(AUTOMAKE).*sub/Makefile' sub/Makefile.in
+
+:
index 08ec16a..b32235b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 remaking rules work when there is no subdir Makefile.
+# Weak "grepping" test trying to ensure that remake rules work for files
+# in a subdirectory even when there is no Makefile for that subdirectory.
+# See also sister functional test `remake3a.test'.
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile sub/foo)
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/foo])
+AC_OUTPUT
 END
 
 : > Makefile.am
@@ -29,7 +30,9 @@ END
 mkdir sub
 : > sub/foo.in
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^sub/foo' Makefile.in
+
+:
diff --git a/tests/remake3a.test b/tests/remake3a.test
new file mode 100755 (executable)
index 0000000..33b9174
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Ensure that remake rules work for files in a subdirectory even when
+# there is no Makefile for that subdirectory.
+# See also sister "grepping" test `remake3.test'.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/foo])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+all-local: sub/foo
+END
+
+mkdir sub
+: > sub/foo.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# First a VPATH build.
+mkdir build
+cd build
+../configure
+$sleep
+test -f sub/foo
+test ! -s sub/foo
+echo '#GrepMe#' > ../sub/foo.in
+$MAKE
+grep '#GrepMe#' sub/foo
+
+cd ..
+
+# Now try an in-tree build.
+: > sub/foo.in # Restore its original (empty) content.
+./configure
+$sleep
+test -f sub/foo
+test ! -s sub/foo
+echo '#GrepMe#' > sub/foo.in
+$MAKE
+grep '#GrepMe#' sub/foo
+
+# Finally try to check the distribution.
+$sleep
+echo '%GrepMe%' > sub/foo.in
+cat >>Makefile.am <<END
+check-local:
+       grep '%GrepMe%' sub/foo
+END
+$MAKE
+grep "grep '%GrepMe%' sub/foo" Makefile.in # Sanity check.
+$MAKE distcheck
+
+:
index d6dbed7..c4c21ad 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -27,8 +27,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 # Rebuild rule are ok until make dist, but not afterwards.
 if test ! -f rebuild_ok; then
@@ -50,7 +48,9 @@ $MAKE
 $sleep
 touch aclocal.m4
 $MAKE distdir
-cd remake4-1.0
+cd $me-1.0
 test ! -f rebuild_ok
 ./configure
 $MAKE
+
+:
index d353632..2c4571f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
 # but not all.
 # Report from Ralf Corsepius.
 
-required=GNUmake
 . ./defs || Exit 1
 
-set -e
+if using_gmake; then
+  remake="$MAKE"
+else
+  remake="$MAKE Makefile"
+fi
 
 cat >>configure.in <<'EOF'
 AM_MAINTAINER_MODE
-m4_include(foo.m4)
+m4_include([foo.m4])
 if test ! -f rebuild_ok; then
   ACLOCAL=false
   AUTOMAKE=false
@@ -48,12 +51,12 @@ $MAKE
 # tools are set to false.)
 $sleep
 touch aclocal.m4 Makefile.am configure.in foo.m4
-$MAKE
+$remake
 
 # Make sure the rebuild rule for Makefile is triggered.
 $sleep
 echo '# GrEpMe' >>Makefile.in
-$MAKE
+$remake
 grep GrEpMe Makefile
 
 # Make sure the rebuild rule for config.status is triggered.
@@ -61,12 +64,17 @@ $sleep
 grep 'AUTOCONF.*=.*false' Makefile
 : > rebuild_ok
 ./configure --no-create
-$MAKE
+$remake
 grep 'AUTOCONF.*=.*false' Makefile && Exit 1
 
 # Make sure rebuild rules do work if --enable-maintainer-mode is given.
 ./configure --enable-maintainer-mode
 $sleep
 echo 'AC_SUBST([YIPPY_YIPPY_YEAH])' >foo.m4
-$MAKE
+$remake
 grep YIPPY_YIPPY_YEAH Makefile
+
+# Try the distribution, for completeness.
+$MAKE distcheck
+
+:
index a25e486..c7d01e1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
 # Make sure remaking rules work when subdir Makefile.in has been removed.
 
 . ./defs || Exit 1
-set -e
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile sub/Makefile)
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
@@ -42,23 +40,25 @@ $MAKE
 # only.
 
 rm -f Makefile.in
-$MAKE >stdout
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test `grep -c " --run " stdout` -eq 1
 
 rm -f sub/Makefile.in
-$MAKE >stdout
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test `grep -c " --run " stdout` -eq 1
 
 $sleep  # Let touched files appear newer.
 
 touch Makefile.am
-$MAKE >stdout
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test `grep -c " --run " stdout` -eq 1
 
 touch sub/Makefile.am
-$MAKE >stdout
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test `grep -c " --run " stdout` -eq 1
+
+:
index 670f60b..39f7ca9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
 # Make sure remaking rules fail when they should.
 
 . ./defs || Exit 1
-set -e
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile sub/Makefile)
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
@@ -67,4 +65,5 @@ $MAKE && Exit 1
 
 rm -f Makefile.in
 $MAKE && Exit 1
+
 :
diff --git a/tests/remake8a.test b/tests/remake8a.test
new file mode 100755 (executable)
index 0000000..d1c3d76
--- /dev/null
@@ -0,0 +1,190 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test basic remake rules for Makefiles, for an *in-tree build*.
+# This testcase checks dependency of generated Makefile from Makefile.am,
+# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered
+# by aclocal.
+# Keep this in sync with sister test `remake8b.test', which performs the
+# same checks for a VPATH build.
+
+. ./defs || Exit 1
+
+mv -f configure.in configure.stub
+
+cat > Makefile.am <<'END'
+all-local: foo
+foo:
+       echo '!Foo!' >$@
+check-local:
+       cat foo
+       grep '!Foo!' foo
+CLEANFILES = foo
+END
+
+cat configure.stub - > configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+srcdir='.' # To make syncing with remake8b.test easier.
+
+$srcdir/configure
+
+$MAKE
+cat foo
+grep '!Foo!' foo
+$MAKE distcheck
+
+rm -f foo
+
+# Modify just Makefile.am.
+
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+all-local: bar
+bar:
+       echo '!Baz!' >$@
+check-local:
+       cat bar
+       grep '!Baz!' bar
+       test ! -r $(srcdir)/foo
+       test ! -r foo
+CLEANFILES = bar
+END
+
+using_gmake || $MAKE Makefile
+$MAKE
+cat bar
+grep '!Baz!' bar
+test ! -r foo
+$MAKE distcheck
+
+rm -f bar
+
+# Modify Makefile.am and configure.in.
+
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+check-local:
+       cat quux
+       grep '!Zardoz!' quux
+       test ! -r $(srcdir)/bar
+       test ! -r bar
+END
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+AC_SUBST([QUUX], [Zardoz])
+AC_OUTPUT
+END
+
+cat > $srcdir/quux.in <<'END'
+!@QUUX@!
+END
+
+using_gmake || $MAKE Makefile
+$MAKE
+cat quux
+grep '!Zardoz!' quux
+test ! -r bar
+$MAKE distcheck
+
+rm -f quux
+
+# Modify Makefile.am to add a directory of extra m4 files
+# considered by aclocal.
+
+$sleep
+
+mkdir $srcdir/m4
+
+cat > $srcdir/Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+check-local:
+       cat quux
+       grep '%Foo%' quux
+       test x'$(QUUX)' = x'%Foo%'
+END
+
+$MAKE # This should place aclocal flags in Makefile.
+grep '.*-I m4' Makefile # Sanity check.
+
+# Modify configure.in and aclocal.m4.
+
+$sleep
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+MY_CUSTOM_MACRO
+AC_OUTPUT
+END
+
+cat >> $srcdir/aclocal.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
+END
+
+$MAKE
+cat quux
+grep '%Foo%' quux
+$MAKE distcheck
+
+# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to
+# the directory of extra m4 files considered by aclocal.  This new
+# file should now provide a macro required by configure.in and that
+# was previously provided by aclocal.m4.
+
+$sleep
+
+sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t
+mv -f t $srcdir/Makefile.am
+cat $srcdir/Makefile.am
+rm -f $srcdir/aclocal.m4
+cat > $srcdir/m4/blah.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Bar%])])
+END
+
+$MAKE
+cat quux
+grep '%Bar%' quux
+$MAKE distcheck
+
+# Modify Makefile.am, remove all the extra m4 files to considered
+# by aclocal, and add an acinclude.m4 file.  This last file should
+# now provide a macro required by configure.in, and that was
+# previously provided by the extra m4 files considered by aclocal.
+
+$sleep
+
+rm -f $srcdir/m4/*.m4
+sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t
+mv -f t $srcdir/Makefile.am
+cat $srcdir/Makefile.am
+cat > $srcdir/acinclude.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Quux%])])
+END
+
+$MAKE
+cat quux
+grep '%Quux%' quux
+$MAKE distcheck
+
+:
diff --git a/tests/remake8b.test b/tests/remake8b.test
new file mode 100755 (executable)
index 0000000..8c11a15
--- /dev/null
@@ -0,0 +1,192 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test basic remake rules for Makefiles, for a *VPATH build*.
+# This testcase checks dependency of generated Makefile from Makefile.am,
+# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered
+# by aclocal.
+# Keep this in sync with sister test `remake8a.test', which performs the
+# same checks for a in-tree build.
+
+. ./defs || Exit 1
+
+mv -f configure.in configure.stub
+
+cat > Makefile.am <<'END'
+all-local: foo
+foo:
+       echo '!Foo!' >$@
+check-local:
+       cat foo
+       grep '!Foo!' foo
+CLEANFILES = foo
+END
+
+cat configure.stub - > configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+mkdir build
+cd build
+srcdir='..' # To make syncing with remake8a.test easier.
+
+$srcdir/configure
+
+$MAKE
+cat foo
+grep '!Foo!' foo
+$MAKE distcheck
+
+rm -f foo
+
+# Modify just Makefile.am.
+
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+all-local: bar
+bar:
+       echo '!Baz!' >$@
+check-local:
+       cat bar
+       grep '!Baz!' bar
+       test ! -r $(srcdir)/foo
+       test ! -r foo
+CLEANFILES = bar
+END
+
+using_gmake || $MAKE Makefile
+$MAKE
+cat bar
+grep '!Baz!' bar
+test ! -r foo
+$MAKE distcheck
+
+rm -f bar
+
+# Modify Makefile.am and configure.in.
+
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+check-local:
+       cat quux
+       grep '!Zardoz!' quux
+       test ! -r $(srcdir)/bar
+       test ! -r bar
+END
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+AC_SUBST([QUUX], [Zardoz])
+AC_OUTPUT
+END
+
+cat > $srcdir/quux.in <<'END'
+!@QUUX@!
+END
+
+using_gmake || $MAKE Makefile
+$MAKE
+cat quux
+grep '!Zardoz!' quux
+test ! -r bar
+$MAKE distcheck
+
+rm -f quux
+
+# Modify Makefile.am to add a directory of extra m4 files
+# considered by aclocal.
+
+$sleep
+
+mkdir $srcdir/m4
+
+cat > $srcdir/Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+check-local:
+       cat quux
+       grep '%Foo%' quux
+       test x'$(QUUX)' = x'%Foo%'
+END
+
+$MAKE # This should place aclocal flags in Makefile.
+grep '.*-I m4' Makefile # Sanity check.
+
+# Modify configure.in and aclocal.m4.
+
+$sleep
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+MY_CUSTOM_MACRO
+AC_OUTPUT
+END
+
+cat >> $srcdir/aclocal.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
+END
+
+$MAKE
+cat quux
+grep '%Foo%' quux
+$MAKE distcheck
+
+# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to
+# the directory of extra m4 files considered by aclocal.  This new
+# file should now provide a macro required by configure.in and that
+# was previously provided by aclocal.m4.
+
+$sleep
+
+sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t
+mv -f t $srcdir/Makefile.am
+cat $srcdir/Makefile.am
+rm -f $srcdir/aclocal.m4
+cat > $srcdir/m4/blah.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Bar%])])
+END
+
+$MAKE
+cat quux
+grep '%Bar%' quux
+$MAKE distcheck
+
+# Modify Makefile.am, remove all the extra m4 files to considered
+# by aclocal, and add an acinclude.m4 file.  This last file should
+# now provide a macro required by configure.in, and that was
+# previously provided by the extra m4 files considered by aclocal.
+
+$sleep
+
+rm -f $srcdir/m4/*.m4
+sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t
+mv -f t $srcdir/Makefile.am
+cat $srcdir/Makefile.am
+cat > $srcdir/acinclude.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Quux%])])
+END
+
+$MAKE
+cat quux
+grep '%Quux%' quux
+$MAKE distcheck
+
+:
diff --git a/tests/remake9a.test b/tests/remake9a.test
new file mode 100755 (executable)
index 0000000..026eac8
--- /dev/null
@@ -0,0 +1,110 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when configure.in or its prerequisites change.
+# Keep in sync with the other sister tests `remake9*.test'.
+
+. ./defs || Exit 1
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+
+if using_gmake; then
+  remake_() { $MAKE nil; }
+else
+  remake_() { $MAKE Makefile && $MAKE foo.sh; }
+fi
+
+cat >> configure.in <<END
+FINGERPRINT=BadBadBad
+AC_SUBST([FINGERPRINT])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+nil:
+.PHONY: nil
+
+$(srcdir)/configure.in: $(srcdir)/tweak-configure-in
+       $(SHELL) $(srcdir)/tweak-configure-in <$@ >$@-t
+       mv -f $@-t $@
+EXTRA_DIST = $(srcdir)/tweak-configure-in
+
+# Used by "make distcheck" later.
+check-local:
+       test x'$(FINGERPRINT)' = x'DummyValue'
+       test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@FINGERPRINT@'
+END
+
+echo cat > tweak-configure-in # It is a no-op by default.
+
+$sleep # So that generated autotools files will be newer than prerequisites.
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE # Should be a no-op.
+
+  $sleep
+  sed "s/^\\(FINGERPRINT\\)=.*/\\1=$magic1/" $srcdir/configure.in >t
+  mv -f t $srcdir/configure.in
+  remake_
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile
+  test x"`./foo.sh`" = x"$magic1"
+
+  $sleep
+  echo 'sed "s/^\\(FINGERPRINT\\)=.*/\\1='$magic2'/"' \
+    > $srcdir/tweak-configure-in
+  remake_
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile
+  test x"`./foo.sh`" = x"$magic2"
+
+  $sleep
+  echo cat > $srcdir/tweak-configure-in # Make it a no-op again.
+  sed "s/^\\(FINGERPRINT\\)=.*/\\1=DummyValue/" $srcdir/configure.in >t
+  mv -f t $srcdir/configure.in
+  using_gmake || remake_
+  $MAKE distcheck
+  $FGREP $magic1 Makefile && Exit 1 # Sanity check.
+  $FGREP $magic2 Makefile && Exit 1 # Likewise.
+
+  $MAKE distclean
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9b.test b/tests/remake9b.test
new file mode 100755 (executable)
index 0000000..ab886ac
--- /dev/null
@@ -0,0 +1,112 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when Makefile.am or its prerequisites change.
+# Keep in sync with the other sister tests `remake9*.test'.
+
+. ./defs || Exit 1
+
+if using_gmake; then
+  remake_() { $MAKE nil; }
+else
+  remake_() { $MAKE Makefile && $MAKE foo.sh; }
+fi
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+FINGERPRINT = BadBadBad
+
+all-local: nil
+nil: foo.sh
+.PHONY: nil
+
+$(srcdir)/Makefile.am: $(srcdir)/tweak-makefile-am
+       $(SHELL) $(srcdir)/tweak-makefile-am <$@ >$@-t
+       mv -f $@-t $@
+EXTRA_DIST = $(srcdir)/tweak-makefile-am
+
+foo.sh: Makefile
+       rm -f $@ $@-t
+       echo '#!/bin/sh' > $@-t
+       echo "echo '$(FINGERPRINT)'" >> $@-t
+       chmod a+x $@-t && mv -f $@-t $@
+CLEANFILES = foo.sh
+
+# Used by "make distcheck" later.
+check-local:
+       test x'$(FINGERPRINT)' = x'DummyValue'
+       test x"`./foo.sh`" = x"DummyValue"
+END
+
+echo cat > tweak-makefile-am # It is a no-op by default.
+
+$sleep # So that generated autotools files will be newer than prerequisites.
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE # Should be a no-op.
+
+  $sleep
+  sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = $magic1/" $srcdir/Makefile.am >t
+  mv -f t $srcdir/Makefile.am
+  remake_
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile
+  test x"`./foo.sh`" = x"$magic1"
+
+  $sleep
+  echo 'sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = '$magic2'/"' \
+    > $srcdir/tweak-makefile-am
+  remake_
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile
+  test x"`./foo.sh`" = x"$magic2"
+
+  $sleep
+  echo cat > $srcdir/tweak-makefile-am # Make it a no-op again.
+  sed "s/^\\(FINGERPRINT\\) *=.*/\\1 = DummyValue/" $srcdir/Makefile.am >t
+  mv -f t $srcdir/Makefile.am
+  using_gmake || remake_
+  $MAKE distcheck
+  $FGREP $magic1 Makefile && Exit 1 # Sanity check.
+  $FGREP $magic2 Makefile && Exit 1 # Likewise.
+
+  $MAKE distclean
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9c.test b/tests/remake9c.test
new file mode 100755 (executable)
index 0000000..e0acd95
--- /dev/null
@@ -0,0 +1,113 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when acinclude.m4 or its prerequisites change.
+# Keep in sync with the other sister tests `remake9*.test'.
+
+. ./defs || Exit 1
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+
+if using_gmake; then
+  remake_() { $MAKE nil; }
+else
+  remake_() { $MAKE Makefile && $MAKE foo.sh; }
+fi
+
+cat >> configure.in <<END
+FINGERPRINT='my_fingerprint'
+AC_SUBST([FINGERPRINT])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+nil:
+.PHONY: nil
+
+# The right way to extend an autogenerated aclocal.m4 is to provide
+# an acinclude.m4 file.
+$(srcdir)/acinclude.m4: $(srcdir)/tweak-acinclude-m4
+       $(SHELL) $(srcdir)/tweak-acinclude-m4 <$@ >$@-t
+       mv -f $@-t $@
+       touch $@
+EXTRA_DIST = $(srcdir)/tweak-acinclude-m4
+
+# Used by "make distcheck" later.
+check-local:
+       test x'$(FINGERPRINT)' = x'DummyValue'
+       test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@FINGERPRINT@'
+END
+
+echo "AC_DEFUN([my_fingerprint], [BadBadBad])" > acinclude.m4
+
+echo : > tweak-acinclude-m4 # It is a no-op by default.
+
+$sleep # So that generated autotools files will be newer than prerequisites.
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE # Should be a no-op.
+
+  $sleep
+  echo "AC_DEFUN([my_fingerprint], [$magic1])" > $srcdir/acinclude.m4
+  remake_
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile
+  test x"`./foo.sh`" = x"$magic1"
+
+  $sleep
+  echo "echo 'AC_DEFUN([my_fingerprint], [$magic2])'" \
+    > $srcdir/tweak-acinclude-m4
+  remake_
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile
+  test x"`./foo.sh`" = x"$magic2"
+
+  $sleep
+  echo : > $srcdir/tweak-acinclude-m4 # Make it a no-op again.
+  echo "AC_DEFUN([my_fingerprint], [DummyValue])" > $srcdir/acinclude.m4
+  using_gmake || remake_
+  $MAKE distcheck
+  $FGREP $magic1 Makefile && Exit 1 # Sanity check.
+  $FGREP $magic2 Makefile && Exit 1 # Likewise.
+
+  $MAKE distclean
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9d.test b/tests/remake9d.test
new file mode 100755 (executable)
index 0000000..ae61835
--- /dev/null
@@ -0,0 +1,113 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test remake rules when aclocal.m4 or its prerequisites change.
+# Keep in sync with the other sister tests `remake9*.test'.
+
+. ./defs || Exit 1
+
+magic1=::MagicStringOne::
+magic2=__MagicStringTwo__
+
+if using_gmake; then
+  remake_() { $MAKE nil; }
+else
+  remake_() { $MAKE Makefile && $MAKE foo.sh; }
+fi
+
+cat >> configure.in <<END
+FINGERPRINT='my_fingerprint'
+AC_SUBST([FINGERPRINT])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+nil:
+.PHONY: nil
+
+# A non-autogenerated aclocal.m4 can be extended by hand.
+$(srcdir)/aclocal.m4: $(srcdir)/tweak-aclocal-m4
+       $(SHELL) $(srcdir)/tweak-aclocal-m4 <$@ >$@-t
+       mv -f $@-t $@
+       touch $@
+EXTRA_DIST = $(srcdir)/tweak-aclocal-m4
+
+# Used by "make distcheck" later.
+check-local:
+       test x'$(FINGERPRINT)' = x'DummyValue'
+       test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@FINGERPRINT@'
+END
+
+echo cat > tweak-aclocal-m4 # It is a no-op by default.
+
+$sleep # So that generated autotools files will be newer than prerequisites.
+$ACLOCAL
+# Cheatingly mark aclocal.m4 as non auto-generated.
+sed '/^ *#.*generated automatically/d' aclocal.m4 > t
+mv -f t aclocal.m4
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE # Should be a no-op.
+
+  $sleep
+  echo "AC_DEFUN([my_fingerprint], [$magic1])dnl %%%" >> $srcdir/aclocal.m4
+  remake_
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile
+  test x"`./foo.sh`" = x"$magic1"
+
+  $sleep
+  echo "sed 's/.*dnl *%%%.*/AC_DEFUN([my_fingerprint], [$magic2])/'" \
+    > $srcdir/tweak-aclocal-m4
+  remake_
+  $FGREP FINGERPRINT Makefile # For debugging.
+  $FGREP $magic1 Makefile && Exit 1
+  $FGREP $magic2 Makefile
+  test x"`./foo.sh`" = x"$magic2"
+
+  $sleep
+  echo cat > $srcdir/tweak-aclocal-m4 # Make it a no-op again.
+  echo 'AC_DEFUN([my_fingerprint], [DummyValue])' >> $srcdir/aclocal.m4
+  using_gmake || remake_
+  $MAKE distcheck
+  $FGREP $magic1 Makefile && Exit 1 # Sanity check.
+  $FGREP $magic2 Makefile && Exit 1 # Likewise.
+
+  $MAKE distclean
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/repeated-options.test b/tests/repeated-options.test
new file mode 100755 (executable)
index 0000000..dcdcbb3
--- /dev/null
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that automake does not complain on repeated options, nor
+# generate broken or incorrect makefiles.
+
+required='cc bzip2'
+. ./defs || Exit 1
+
+cat >configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip no-dist-gzip dist-bzip2])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = parallel-tests subdir-objects subdir-objects
+AUTOMAKE_OPTIONS += dist-bzip2 parallel-tests
+TESTS = foo.test
+EXTRA_DIST = $(TESTS)
+TESTS_ENVIRONMENT = EXEEXT='$(EXEEXT)'
+bin_PROGRAMS = sub/foo
+.PHONY: test-build
+test-build:
+       ls -l . sub
+       test -f sub/foo.$(OBJEXT)
+       test -f sub/foo$(EXEEXT)
+END
+
+mkdir sub
+
+cat > foo.test <<'END'
+#!/bin/sh
+test -f sub/foo$EXEEXT && test -x sub/foo$EXEEXT
+END
+chmod a+x foo.test
+
+cat > sub/foo.c <<'END'
+int main (void)
+{
+  return 0;
+}
+END
+
+cp "$am_scriptdir"/compile "$am_scriptdir"/test-driver .
+
+$ACLOCAL
+$AUTOMAKE --foreign --foreign -Wall 2>stderr || { cat stderr >&2; Exit 1; }
+test -s stderr && { cat stderr >&2; Exit 1; }
+rm -f stderr
+$AUTOCONF
+
+./configure
+$MAKE
+$MAKE test-build
+$MAKE check
+ls -l
+test -f foo.log
+test -f test-suite.log
+$MAKE clean
+$MAKE distcheck
+ls -l
+test -f $me-1.0.tar.bz2
+test ! -r $me-1.0.tar.gz
+
+:
index 39bf349..ef25099 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -32,6 +33,8 @@ module=[$1]
 AC_SUBST(module)])
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 
 grep 'DEFUN.*INIT_AUTOMAKE' aclocal.m4
+
+:
index 58a8839..aa723cc 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<EOF
 AC_CONFIG_FILES([one/Makefile two/Makefile])
 AC_OUTPUT
index b47ef15..236e521 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
 required='libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([req2], [1.0])
 AC_CONFIG_AUX_DIR([autoconf])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_CONFIG_FILES([autoconf/Makefile main/Makefile])
 AC_OUTPUT
@@ -45,6 +44,7 @@ lib_LTLIBRARIES = lib0.la
 lib0_la_SOURCES = 0.c
 END
 
+: > ar-lib
 libtoolize --force --copy
 $ACLOCAL
 $AUTOCONF
@@ -52,4 +52,6 @@ $AUTOCONF
 test -f autoconf/ltmain.sh # Sanity check.
 rm -f autoconf/ltmain.sh
 AUTOMAKE_fails --add-missing --copy
-grep 'autoconf/ltmain.sh' stderr
+grep '^configure\.in:7:.* required file.*autoconf/ltmain\.sh' stderr
+
+:
diff --git a/tests/rst-formatting.test b/tests/rst-formatting.test
new file mode 100755 (executable)
index 0000000..ad80aff
--- /dev/null
@@ -0,0 +1,93 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Parallel testsuite harness: check APIs for the registering the
+# "global test result" in `*.trs' files, as documented in the automake
+# manual.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+sed -n '/^am__rst_[a-z_][a-z_]* =/p' "$am_amdir"/check.am > Makefile \
+  || framework_failure_ "fetching definitions from check.am"
+
+cat >> Makefile << 'END'
+test:
+       printf '%s\n' "$$in" | $(am__rst_title) > title-got
+       printf '%s\n' "$$in" | $(am__rst_section) > section-got
+       cat title-exp
+       cat title-got
+       diff title-exp title-got
+       cat section-exp
+       cat section-got
+       diff section-exp section-got
+END
+
+# -------------------------------------------------------------------------
+
+cat > title-exp <<'END'
+==============
+   ab cd ef
+==============
+
+END
+
+cat > section-exp <<'END'
+ab cd ef
+========
+
+END
+
+env in='ab cd ef' $MAKE test
+
+# -------------------------------------------------------------------------
+
+cat > title-exp <<'END'
+============================================================================
+   0123456789012345678901234567890123456789012345678901234567890123456789
+============================================================================
+
+END
+
+cat > section-exp <<'END'
+0123456789012345678901234567890123456789012345678901234567890123456789
+======================================================================
+
+END
+
+in=0123456789012345678901234567890123456789012345678901234567890123456789
+env in=$in $MAKE test
+
+# -------------------------------------------------------------------------
+
+cat > title-exp <<'END'
+=======
+   x
+=======
+
+END
+
+cat > section-exp <<'END'
+x
+=
+
+END
+
+env in=x $MAKE test
+
+# -------------------------------------------------------------------------
+
+:
index c15e910..3d939c9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -22,7 +23,9 @@ cat > Makefile.am << 'END'
 $(srcdir)/Makefile.am:
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^$(srcdir)/Makefile\.am' Makefile.in
+
+:
index ed7fe28..7dd31eb 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2008, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir 'unsafe$'
 cd 'unsafe$'
 
index b9aed7f..7501fff 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2010 Free Software
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 noinst_SCRIPTS = foo
 END
index 3bfac37..de8bcc4 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 1998, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 dnl AC_PROG_CC and AC_PROG_CXX missing on purpose
 AC_LIBOBJ([fsusage])
@@ -37,5 +36,9 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-$FGREP CC stderr
-$FGREP CXX stderr
+grep ' C source.*CC.* undefined' stderr
+grep 'define .*CC.* add .*AC_PROG_CC' stderr
+grep ' C++ source.*CXX.* undefined' stderr
+grep 'define .*CXX.* add .*AC_PROG_CXX' stderr
+
+:
diff --git a/tests/self-check-cleanup.tap b/tests/self-check-cleanup.tap
new file mode 100755 (executable)
index 0000000..e403dde
--- /dev/null
@@ -0,0 +1,174 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Check creation/removal of temporary test working directory by `./defs'.
+
+. ./defs || Exit 1
+
+if test x"$sh_errexit_works" != x"yes"; then
+  skip_all_ "$me: no working exit trap with 'set -e'"
+fi
+
+plan_ 42
+
+# We still need a little hack to make ./defs work outside automake's
+# tree `tests' subdirectory.  Not a big deal.
+sed "s|^testbuilddir=.*|testbuilddir='`pwd`'|" ../defs-static >defs-static
+diff ../defs-static defs-static && fatal_ "failed to edit defs-static"
+cp ../defs .
+
+AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+
+if ln -s defs foo && test -h foo; then
+  have_symlinks=yes
+else
+  have_symlinks=no
+fi
+export have_symlinks # Is used also by spawned shells.
+
+dir=dummy.dir
+
+# Don't let a failure poison all subsequent tests.
+do_clean ()
+{
+  test -d $dir || return 0
+  find $dir -type d -exec chmod u+rwx '{}' ';' || :
+  rm -rf $dir
+}
+
+# Check that pre-test cleanup works also with directories with
+# "null" permissions, and containing broken symlinks.
+mkdir $dir $dir/sub
+cd $dir
+touch file sub/file
+if test $have_symlinks = yes; then
+  ln -s file symlink
+  ln -s none brokenlink
+fi
+cd ..
+chmod 000 $dir/sub/* $dir/file
+test $have_symlinks = yes && chmod 000 $dir/symlink
+chmod 000 $dir/sub $dir
+command_ok_ "pre-cleanup can deal with null-perms testdir" \
+            $SHELL -c  '. ./defs' dummy.test
+command_ok_ "pre-cleanup removed null-perms testdir" \
+            eval 'test ! -f $dir && test ! -d $dir && test ! -r $dir'
+
+do_clean
+
+# Check that post-test cleanup works also with directories with
+# "null" permissions, and containing broken symlinks.
+command_ok_ "post-cleanup can deal with null-perms testdir" \
+            $SHELL -c  '
+  stderr_fileno_=2
+  . ./defs || Exit 1
+  set -e
+  mkdir dir dir/sub
+  cd dir
+  touch file sub/file
+  if test $have_symlinks = yes; then
+    ln -s file symlink
+    ln -s none brokenlink
+  fi
+  cd ..
+  chmod 000 dir/sub/* dir/file
+  test $have_symlinks = yes && chmod 000 dir/symlink
+  chmod 000 dir/sub dir
+  :
+' dummy.test
+command_ok_ "post-cleanup removed null-perms testdir" \
+            eval 'test ! -f $dir && test ! -d $dir && test ! -r $dir'
+
+do_clean
+
+# Check that pre-test cleanup does not unduly change the permissions of
+# files to which symlinks in the temporary test directory point to.
+if test $have_symlinks = yes; then
+
+  mkdir dir
+  chmod 000 dir
+  : > file
+  chmod 000 file
+
+  mkdir $dir
+  cd $dir
+  ln -s ../dir ../file .
+  cd ..
+
+  command_ok_ "pre-cleanup with testdir with zero-perms symlinks" \
+               $SHELL -c '. ./defs' dummy.test
+  ls -l # For debugging.
+  command_ok_ "pre-cleanup chmod doesn't follow symlinks to files" \
+               eval 'ls -l file | grep "^----------.*file"'
+  command_ok_ "pre-cleanup chmod doesn't follow symlinks to dirs" \
+              eval 'ls -ld dir | grep "^d---------.*dir"'
+
+  command_ok_ "post-cleanup with testdir with zero-perms symlinks" \
+              $SHELL -c '
+    ocwd=`pwd` || exit 1
+    stderr_fileno_=2
+    . ./defs || Exit 1
+    ln -s "$ocwd/dir" "$ocwd/file" .
+  ' dummy.test
+  ls -l # For debugging.
+  command_ok_ "post-cleanup chmod doesn't follow symlinks to files" \
+               eval 'ls -l file | grep "^----------.*file"'
+  command_ok_ "post-cleanup chmod doesn't follow symlinks to dirs" \
+              eval 'ls -ld dir | grep "^d---------.*dir"'
+
+  rmdir dir
+  rm -f file
+
+else # $have_symlinks = no
+  skip_row_ 6 "symlinks not supported"
+fi
+
+do_clean
+
+# Check that the cleanup trap does not remove the temporary
+# test directory in case of test failure, skip, hard-error,
+# or when receiving a signal.
+
+for st in 1 2 3 10 77 99 126 127 130 255; do
+  command_ok_ "exit trap doesn't clobber exit status $st" not $SHELL -c "
+    stderr_fileno_=2
+    . ./defs
+    : > foo
+    Exit $st
+  " dummy.test
+  command_ok_ "testdir not removed if exiting with status $st" \
+              test -f dummy.dir/foo
+  do_clean
+done
+
+for sig in 1 2 3 9 13 15; do
+  if is_blocked_signal $sig; then
+    skip_row_ 2 -r "signal $sig seems blocked"
+    continue
+  fi
+  command_ok_ "exit trap doesn't clobber signal $sig" not $SHELL -c "
+    stderr_fileno_=2
+    . ./defs
+    : > foo
+    kill -$sig \$\$
+  " dummy.test
+  command_ok_ "testdir not removed if getting signal $sig" \
+              test -f dummy.dir/foo
+  do_clean
+done
+
+:
diff --git a/tests/self-check-configure-help.test b/tests/self-check-configure-help.test
new file mode 100755 (executable)
index 0000000..16f4b50
--- /dev/null
@@ -0,0 +1,274 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check on the function used by the automake testsuite to
+# analyze output of "configure --help".
+
+. ./defs || Exit 1
+
+# FIXME: this test is a good candidate for a conversion to TAP.
+
+# Prefer real-world data.  This is from the help screen of the
+# configure script from GNU coreutils, with small adaptations.
+cat > help <<'END'
+`configure' configures GNU coreutils 8.14a to adapt to many kinds of systems.
+
+Usage: ./configure [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print `checking ...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for `--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or `..']
+
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [/usr/local]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, `make install' will install all the files in
+`/usr/local/bin', `/usr/local/lib' etc.  You can specify
+an installation prefix other than `/usr/local' using `--prefix',
+for instance `--prefix=$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR            user executables [EPREFIX/bin]
+  --sbindir=DIR           system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR        program executables [EPREFIX/libexec]
+  --sysconfdir=DIR        read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data [PREFIX/var]
+  --libdir=DIR            object code libraries [EPREFIX/lib]
+  --includedir=DIR        C header files [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc [/usr/include]
+  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR           info documentation [DATAROOTDIR/info]
+  --localedir=DIR         locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR            man documentation [DATAROOTDIR/man]
+  --docdir=DIR            documentation root [DATAROOTDIR/doc/coreutils]
+  --htmldir=DIR           html documentation [DOCDIR]
+  --dvidir=DIR            dvi documentation [DOCDIR]
+  --pdfdir=DIR            pdf documentation [DOCDIR]
+  --psdir=DIR             ps documentation [DOCDIR]
+
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+
+Optional Features:
+  --disable-option-checking  ignore unrecognized --enable/--with options
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-silent-rules          less verbose build output (undo: `make V=1')
+  --disable-silent-rules         verbose build output (undo: `make V=0')
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
+  --disable-largefile     omit support for large files
+  --enable-threads={posix|solaris|pth|win32}
+                          specify multithreading API
+  --disable-threads       build without multithread safety
+  --disable-acl           do not support ACLs
+  --disable-assert        turn off assertions
+  --disable-rpath         do not hardcode runtime library paths
+  --disable-xattr         do not support extended attributes
+  --disable-libcap        disable libcap support
+  --enable-gcc-warnings   turn on lots of GCC warnings (for developers)
+  --enable-install-program=PROG_LIST
+                          install the programs in PROG_LIST (comma-separated,
+                          default: none)
+  --enable-no-install-program=PROG_LIST
+                          do NOT install the programs in PROG_LIST
+                          (comma-separated, default: arch,hostname,su)
+  --disable-nls           do not use Native Language Support
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-gnu-ld           assume the C compiler uses GNU ld default=no
+  --with-libiconv-prefix[=DIR]  search for libiconv in DIR/include and DIR/lib
+  --without-libiconv-prefix     don't search for libiconv in includedir and libdir
+  --with-libpth-prefix[=DIR]  search for libpth in DIR/include and DIR/lib
+  --without-libpth-prefix     don't search for libpth in includedir and libdir
+  --without-included-regex
+                          don't compile regex; this is the default on systems
+                          with recent-enough versions of the GNU C Library
+                          (use with caution on other systems).
+  --without-selinux       do not use SELinux, even on systems with SELinux
+  --with-packager         String identifying the packager of this software
+  --with-packager-version Packager-specific version information
+  --with-packager-bug-reports
+                          Packager info for bug reports (URL/e-mail/...)
+  --with-tty-group[=NAME]
+                          group used by system for TTYs, "tty" when not
+                          specified (default: do not rely on any group used
+                          for TTYs)
+  --without-gmp           do not use the GNU MP library for arbitrary
+                          precision calculation (default: use it if available)
+  --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
+  --without-libintl-prefix     don't search for libintl in includedir and libdir
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+  YACC        The `Yet Another C Compiler' implementation to use. Defaults to
+              `bison -y'. Values other than `bison -y' will most likely break
+              on most systems.
+  YFLAGS      YFLAGS contains the list arguments that will be passed by
+              default to Bison. This script will default YFLAGS to the empty
+              string to avoid a default value of `-d' given by some make
+              applications.
+  DEFAULT_POSIX2_VERSION
+              POSIX version to default to; see 'config.hin'.
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <bug-automake@gnu.org>.
+General help using GNU software: <http://www.gnu.org/gethelp/>.
+END
+
+compare_extracted_help ()
+{
+  cat > exp || Exit 99
+  extract_configure_help "$1" help > got || Exit 1
+  cat exp
+  cat got
+  diff exp got || Exit 1
+}
+
+compare_extracted_help --disable-libcap <<'END'
+  --disable-libcap        disable libcap support
+END
+
+compare_extracted_help --disable-nls <<'END'
+  --disable-nls           do not use Native Language Support
+END
+
+compare_extracted_help --disable-option-checking <<'END'
+  --disable-option-checking  ignore unrecognized --enable/--with options
+END
+
+compare_extracted_help --build= <<'END'
+  --build=BUILD     configure for building on BUILD [guessed]
+END
+
+compare_extracted_help --host= <<'END'
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+END
+
+compare_extracted_help '--with-libintl-prefix[=]' <<'END'
+  --with-libintl-prefix[=DIR]  search for libintl in DIR/include and DIR/lib
+END
+
+compare_extracted_help --without-included-regex <<'END'
+  --without-included-regex
+                          don't compile regex; this is the default on systems
+                          with recent-enough versions of the GNU C Library
+                          (use with caution on other systems).
+END
+
+compare_extracted_help --enable-threads= <<'END'
+  --enable-threads={posix|solaris|pth|win32}
+                          specify multithreading API
+END
+
+compare_extracted_help '--with-tty-group[=]' <<'END'
+  --with-tty-group[=NAME]
+                          group used by system for TTYs, "tty" when not
+                          specified (default: do not rely on any group used
+                          for TTYs)
+END
+
+compare_extracted_help '--prefix=' <<'END'
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [/usr/local]
+END
+
+compare_extracted_help '--exec-prefix=' <<'END'
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+END
+
+compare_extracted_help CC <<'END'
+  CC          C compiler command
+END
+
+compare_extracted_help CPP <<'END'
+  CPP         C preprocessor
+END
+
+compare_extracted_help CPPFLAGS <<'END'
+  CPPFLAGS    (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
+END
+
+compare_extracted_help YACC <<'END'
+  YACC        The `Yet Another C Compiler' implementation to use. Defaults to
+              `bison -y'. Values other than `bison -y' will most likely break
+              on most systems.
+END
+
+compare_extracted_help DEFAULT_POSIX2_VERSION <<'END'
+  DEFAULT_POSIX2_VERSION
+              POSIX version to default to; see 'config.hin'.
+END
+
+for o in \
+  '--nonesuch' \
+  '--nonesuch=' \
+  '--nonesuch[=]' \
+  '--disable-nls=' \
+  '--disable-nls[=]' \
+  '--without-included-regex=' \
+  '--without-included-regex[=]' \
+  '--prefix' \
+  '--prefix[=]' \
+  '--build' \
+  '--build[=]' \
+  '--with-tty-group' \
+  '--with-tty-group=' \
+  'NO_SUCH_VAR' \
+  'NOSUCHVAR' \
+; do
+  compare_extracted_help "$o" </dev/null
+done
+
+:
diff --git a/tests/self-check-dir.tap b/tests/self-check-dir.tap
new file mode 100755 (executable)
index 0000000..e698b0c
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Check that tests using `./defs' create a proper temporary directory,
+# and run in it.  Also check that we can prevent the pre-population
+# and the creation of such directory if we want.
+
+am_create_testdir=no
+. ./defs || Exit 99
+
+plan_ 5
+
+AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+
+# This needs to be consistent with what $SHELL deems to be the
+# current working directory.
+cwd=`$SHELL -c 'pwd'` || fatal_ "can't get current working directory"
+echo "$cwd"
+
+do_check ()
+{
+  test ! -d _self.dir || rm -rf _self.dir \
+    || framework_failure_ "cleaning up _self.dir"
+  command_ok_ "$1 [$2]" $SHELL -c "
+    $2
+    . ./defs || Exit 99
+    pwd; ls -l; # For debugging.
+    $3
+  " _self.test
+}
+
+do_check 'testdir has the expected path' \
+         'unset am_create_testdir' \
+         'case `pwd` in '"$cwd"'/_self.dir);; *) Exit 1;; esac'
+
+do_check 'fully pre-populated testdir' \
+         'unset am_create_testdir' \
+         'test -f install-sh || Exit 1
+          test -f configure.in || Exit 1
+          case `pwd` in '"$cwd"'/_self.dir) : ;; *) Exit 1;; esac'
+
+do_check 'testdir has the expected path' \
+         'am_create_testdir=empty' \
+         'case `pwd` in '"$cwd"'/_self.dir) : ;; *) Exit 1;; esac'
+
+do_check 'do not pre-populate testdir' \
+         'am_create_testdir=empty' \
+         'ls -a | grep -v "^\\.\\{1,2\\}$" | grep . && Exit 1; :'
+
+do_check 'do not create nor chdir in testdir' \
+         'am_create_testdir=no' \
+         'test ! -d _self.dir || Exit 1
+          test ! -f _self.dir || Exit 1
+          test ! -r _self.dir || Exit 1
+          test -f self-check-dir.tap || Exit 1
+          case `pwd` in '"$cwd"') : ;; *) Exit 1;; esac'
+
+:
diff --git a/tests/self-check-env-sanitize.tap b/tests/self-check-env-sanitize.tap
new file mode 100755 (executable)
index 0000000..8736c54
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Make sure that the testsuite initialization code complains when
+# some testsuite-influential variables are set in the environment.
+
+am_create_testdir=no
+. ./defs || Exit 1
+
+set -x
+exec 5>&1
+
+plan_ 18 # Two times the number of variable names in $vars.
+
+vars='
+  me
+  required
+  am_parallel_tests
+  am_using_tap
+  am_create_testdir
+  am_tap_implementation
+  am_test_prefer_config_shell
+  am_original_AUTOMAKE
+  am_original_ACLOCAL
+'
+
+do_run ()
+{
+  env "$1=foo" $SHELL -c '. ./defs' foo.test
+}
+
+do_grep ()
+{
+  env "$1=foo" $SHELL -c '. ./defs' foo.test 2>&1 1>&5 \
+    | grep "foo\.test:.* variable \`$1'.* in the environment.*unsafe"
+}
+
+for var in $vars; do
+  command_ok_ "$var [err status]" not do_run $var
+  command_ok_ "$var [err message]" do_grep $var
+done
+
+:
diff --git a/tests/self-check-exit.tap b/tests/self-check-exit.tap
new file mode 100755 (executable)
index 0000000..9fe2905
--- /dev/null
@@ -0,0 +1,108 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Check that, in case of failing commands, the correct exit status is
+# passed to the exit trap installed by the `./defs' script.
+# Also check that the `errexit' shell flag is active.
+
+am_create_testdir=no
+. ./defs || Exit 99
+
+plan_ 34
+
+# This test becomes more cumbersome if we keep the `errexit' shell flag
+# set.  And removing it is no big deal, as this test is a TAP-based one,
+# so that false positives remain very unlikely.
+set +e
+
+AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+
+# It's especially important that the `unset' is done before sourcing
+# ./defs, i.e., when `set -e' is not active yet, for the benefit of shells
+# (like Bash 2.05 and Solaris 10 /bin/ksh) that returns a non-zero status
+# when unsetting an already-unset variable.
+init='stderr_fileno_=2; unset am_explicit_skips; . ./defs'
+
+for st in 1 2 3 4 5 77 99 126 127 128 129 130 255; do
+  for exit_cmd in "Exit $st" "sh -c 'exit $st'"; do
+    $SHELL -c  "$init; $exit_cmd; :"
+    command_ok_ "$exit_cmd" test $? -eq $st
+  done
+done
+
+for sig in 1 2 13 15; do
+  if is_blocked_signal $sig; then
+    skip_ -r "signal $sig seems blocked"
+    continue
+  fi
+  if test $sig -eq 2; then
+    # Some Korn shells might otherwise get a spurious SIGINT signal when
+    # one is sent to the child $SHELL.  For more details, see:
+    # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
+    trap : 2
+  fi
+  $SHELL -c  "$init; kill -$sig \$\$; :"
+  rc=$?
+  if test $sig -eq 2; then
+    # Reset default SIGINT handler as portably as possible.
+    trap 2 || trap - 2
+  fi
+  if test x"$sh_errexit_works" = x"yes"; then
+    # The exit trap should turn into an hard errors any failure
+    # caused by signals.
+    command_ok_ "kill -$sig" test $rc -eq 99
+  else
+    # The exit trap is not installed, so that the shell should exit
+    # with status 128+n when receiving signal number n.  But don't
+    # be too strict in the check, as POSIX only says that "The exit
+    # status of a command that terminated because it received a
+    # signal shall be reported as greater than 128".
+    command_ok_ "kill -$sig" test $rc -gt 128
+  fi
+  unset rc
+done
+
+: Non-existent program.
+# Solaris 10 /bin/sh erroneously exit with success right away when the
+# following three conditions are met at the same time:
+#   1. the `errexit' flag is active,
+#   2. an exit trap is installed, and
+#   3. a non-existing command is issued.
+# Note that the non-existent command is issued as the last command to
+# the shell in the next line; this is deliberate.
+if $SHELL -c 'set -e; trap "exit \$?" 0; non-existent-program'; then
+  maybe_todo=TODO reason="known Solaris /bin/sh bug"
+else
+  maybe_todo="" reason=""
+fi
+$SHELL -c  "$init; non-existent-program; :"
+command_ok_ "command not found" -D "$maybe_todo" -r "$reason" \
+            -- test $? -gt 0
+
+: Non-executable command.
+test -f Makefile && test ! -x Makefile || \
+  framowork_failure_ "no proper Makefile in the current directory"
+$SHELL -c  "$init; ./Makefile; :"
+command_ok_ "permission denied" test $? -gt 0
+
+: Syntax errors in the test code.
+$SHELL -c  "$init; if :; then"
+command_ok_ "syntax error 1" test $? -gt 0
+$SHELL -c  "$init; fi"
+command_ok_ "syntax error 2" test $? -gt 0
+
+:
diff --git a/tests/self-check-explicit-skips.test b/tests/self-check-explicit-skips.test
new file mode 100755 (executable)
index 0000000..530048d
--- /dev/null
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Check creation/removal of temporary test working directory by `./defs'.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+test x"$sh_errexit_works" = x"yes" || skip_ "no working shell exit trap"
+
+# We still need a little hack to make ./defs work outside automake's
+# tree `tests' subdirectory.  Not a big deal.
+sed "s|^testbuilddir=.*|testbuilddir='`pwd`'|" ../defs-static >defs-static
+diff ../defs-static defs-static && Exit 99
+cp ../defs .
+
+set +e
+
+unset am_explicit_skips stderr_fileno_
+AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+
+$SHELL -c '. ./defs; (exit 77); exit 77' dummy.test
+test $? -eq 77 || Exit 1
+
+am_explicit_skips=no $SHELL -c '. ./defs; sh -c "exit 77"' dummy.test
+test $? -eq 77 || Exit 1
+
+am_explicit_skips=yes $SHELL -c '. ./defs; (exit 77); exit 77' dummy.test
+test $? -eq 78 || Exit 1
+
+am_explicit_skips=y $SHELL -c '. ./defs; sh -c "exit 77"' dummy.test
+test $? -eq 78 || Exit 1
+
+am_explicit_skips=yes $SHELL -c '. ./defs; Exit 77' dummy.test
+test $? -eq 77 || Exit 1
+
+am_explicit_skips=y $SHELL -c '. ./defs; skip_ "foo"' dummy.test
+test $? -eq 77 || Exit 1
+
+:
diff --git a/tests/self-check-is-blocked-signal.tap b/tests/self-check-is-blocked-signal.tap
new file mode 100755 (executable)
index 0000000..ba20488
--- /dev/null
@@ -0,0 +1,29 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite: the `signal_is_blocked'
+# shell function.
+
+am_create_testdir=no
+. ./defs || Exit 99
+
+plan_ 2
+
+command_ok_ "unblockable signal 9" not is_blocked_signal 9
+trap "" 13
+command_ok_ "blocked signal 13" is_blocked_signal 13
+
+:
diff --git a/tests/self-check-is_newest.tap b/tests/self-check-is_newest.tap
new file mode 100755 (executable)
index 0000000..a41765d
--- /dev/null
@@ -0,0 +1,80 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite: the `is_newest' subroutine.
+
+. ./defs || Exit 1
+
+plan_ 21
+
+# I'm a lazy typist.
+Y () { command_ok_ "is_newest $*" is_newest "$@"; }
+N () { command_ok_ "not is_newest $*" not is_newest "$@"; }
+
+: > a
+$sleep
+: > b
+: > c
+
+stat a b c || : # For debugging.
+
+Y c a
+Y b a
+N a b
+Y c b
+Y c c
+Y c a b c
+
+touch -r c d
+
+stat c d || : # For debugging.
+
+Y c d
+
+# Should work on directories too, both empty and not-empty.  An older
+# implementation of `is_newest' failed if the first argument was a
+# directory containing files newer than itself (see automake bug#9147).
+mkdir u x
+touch x/foo
+$sleep
+touch x/foo
+$sleep
+mkdir v y
+touch y/foo
+$sleep
+touch y/foo
+
+stat u v x y x/foo y/foo || : # For debugging.
+
+for older in u x; do
+  for newer in v y; do
+    Y $newer $older
+    N $older $newer
+  done
+done
+
+Y x/foo x
+N x x/foo
+
+touch -r x u
+Y x u
+Y u x
+
+# A couple of mild "stress" tests.
+Y y x u v
+Y y u x/foo a b c
+
+:
diff --git a/tests/self-check-me.tap b/tests/self-check-me.tap
new file mode 100755 (executable)
index 0000000..f681f06
--- /dev/null
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Make sure that $me gets automatically defined by `./defs', and that it
+# can be overridden by the test script.
+
+am_create_testdir=no
+. ./defs || Exit 1
+
+plan_ 9
+
+AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+
+# This test becomes cumbersome if we keep the `errexit' shell flag set.
+# And removing it is no big deal, as this test is a TAP-based one, so
+# that false positives remain very unlikely.
+set +e
+
+do_check ()
+{
+  $SHELL -c '. ./defs && echo me=$me' "$1" | grep "^me=$2$"
+  command_ok_ "me=$1" test $? -eq 0
+}
+
+do_check foo-bar-.test 'foo-bar-'
+do_check _foo__bar.test '_foo__bar'
+do_check 012.test '012'
+do_check foo.bar 'foo\.bar'
+do_check a.b.c.test 'a\.b\.c'
+
+# If we override $me, ./defs should not modify it.
+
+s=`$SHELL -c 'me=foo.test && . ./defs && echo me=$me' bad.test`
+command_ok_ "override of \$me before ./defs causes no error" \
+            test $? -eq 0
+
+r='ok'
+printf '%s\n' "$s" | grep '^me=foo\.test$' || r='not ok'
+printf '%s\n' "$s" | grep 'me=bad'         && r='not ok'
+result_ "$r" "override of \$me before ./defs is honored"
+unset r
+
+# Overriding $me after sourcing ./defs-static should work.
+s=`$SHELL -c '. ./defs-static && me=zardoz &&
+              . ./defs && echo me=$me' bad.test`
+command_ok_ "override of \$me after ./defs-static causes no error" \
+            test $? -eq 0
+
+r='ok'
+printf '%s\n' "$s" | grep '^me=zardoz$' || r='not ok'
+printf '%s\n' "$s" | grep 'me=bad'      && r='not ok'
+result_ "$r" "override of \$me after ./defs-static is honored"
+unset r
+
+:
diff --git a/tests/self-check-reexec.tap b/tests/self-check-reexec.tap
new file mode 100755 (executable)
index 0000000..0982719
--- /dev/null
@@ -0,0 +1,205 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Check that automatic re-execution of test script with the
+# configure-time $SHELL.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+plan_ 32
+
+unset AM_TESTS_REEXEC BASH_VERSION || :
+
+cwd=`pwd` || fatal_ "cannot get current working directory"
+cp ../defs .
+
+#
+# Search for required bash and non-bash shells.
+#
+
+for bash_shell in "$SHELL" bash bash3 bash4 :; do
+  test "$bash_shell" = : && break
+  $bash_shell --version || continue
+  $bash_shell -c 'test -n "$BASH_VERSION"' || continue
+  break
+done
+
+# This might not be optimal, but it's much better than writing wrapper
+# scripts acting as "fake" shells.
+for non_bash_shell in /bin/sh /bin/ksh "$SHELL" sh ksh ash dash pdksh :; do
+  test "$non_bash_shell" = : && break
+  $non_bash_shell -c 'exit 0' || continue
+  $non_bash_shell -c 'test -n "$BASH_VERSION"' && continue
+  break
+done
+
+echo "bash_shell='$bash_shell'"
+echo "non_bash_shell='$non_bash_shell'"
+
+# This would denote an internal error.
+if test "$bash_shell" = : && test "$non_bash_shell" = :; then
+  fatal_ "we couldn't find a bash shell nor a non-bash one"
+fi
+
+#
+# Functions used throughout the test.
+#
+
+get_ddata ()
+{
+  case $1 in
+    ""|*/) dsep=;;
+        *) dsep=/;;
+  esac
+  case $1 in
+    "") dname="no dir";;
+    /*) dname="absolute dir";;
+     *) dname="dir '$1'";;
+  esac
+}
+
+get_sh ()
+{
+  case $1 in
+    bash) sh=$bash_shell;;
+    non-bash) sh=$non_bash_shell;;
+    *) fatal_ "get_sh: invalid shell type '$1'";;
+  esac
+}
+
+#
+# Check how to default, force or prevent a re-execution.
+#
+
+cat > need-bash.test <<'END'
+#!/bin/false
+. ./defs
+# Ensure that the script gets re-executed with bash.  Also ensure that
+# non-standard syntax used after the inclusion of `./defs' doesn't cause
+# non-bash shells to fail.
+# Subshell required to prevent some shells (e.g., Solaris 10 /bin/sh)
+# from only complaining on stderr but then exiting with exit status 0.
+(foo=abac && test xbxc = ${foo//a/x} && test -n "$BASH_VERSION")
+END
+
+sed -e "s|^testbuilddir=.*|testbuilddir='$cwd'|" \
+    -e 's|^SHELL=.*$|SHELL=bash; export SHELL|' \
+    < ../defs-static >defs-static
+
+do_reexec ()
+{
+  command_ok_ "re-exec if AM_TESTS_REEXEC=$1" \
+              env AM_TESTS_REEXEC="$1" $non_bash_shell need-bash.test
+}
+
+dont_reexec ()
+{
+  command_ok_ "don't re-exec if AM_TESTS_REEXEC=$1" \
+              not env AM_TESTS_REEXEC="$1" $non_bash_shell need-bash.test
+}
+
+if test "$bash_shell" = :; then
+  skip_row_ 10 -r "no bash shell found" AM_TESTS_REEXEC
+elif test "$non_bash_shell" = :; then
+  skip_row_ 10 -r "no non-bash shell found" AM_TESTS_REEXEC
+else
+  command_ok_ "re-exec if AM_TESTS_REEXEC unset" \
+              $non_bash_shell need-bash.test
+  do_reexec ''
+  do_reexec yes
+  do_reexec y
+  do_reexec true
+  do_reexec 1
+  dont_reexec no
+  dont_reexec n
+  dont_reexec false
+  dont_reexec 0
+fi
+
+#
+# Check message about the re-execution.  Also check that arguments passed
+# to a test script are preserved by a re-exec, even in "corner" cases.
+#
+
+cat > dummy.test <<'END'
+#!/bin/sh
+. ./defs
+:
+END
+
+cat > checkargs.test <<'END'
+. ./defs
+test $# -eq 3 && test x"$1" = x'a' && test x"$2" = x && test x"$3" = x"-e"
+END
+
+chmod a+x dummy.test checkargs.test
+
+mkdir sub
+cp dummy.test checkargs.test defs sub
+sed -e "s|^testbuilddir=.*|testbuilddir='$cwd'|" \
+    < ../defs-static > defs-static
+sed -e "s|^testbuilddir=.*|testbuilddir='$cwd/sub'|" \
+    < ../defs-static > sub/defs-static
+
+check_preserve_args ()
+{
+  dir=$1; shift
+  get_ddata "$dir"
+  $sh "${dir}${dsep}checkargs.test" a '' -e && r='ok' || r='not ok'
+  result_ "$r" "$sh re-exec preserving args [$dname]"
+}
+
+check_reexec_message ()
+{
+  dir=$1; shift
+  get_ddata "$dir"
+  $sh "${dir}${dsep}dummy.test" "$@" \
+    | grep "^dummy: exec $SHELL ${dir}${dsep}dummy\\.test $*\$" \
+    && r='ok' || r='not ok'
+  result_ "$r" "$sh display re-exec message [$dname] [args: $*]"
+}
+
+./dummy.test a b | grep "^dummy: exec $SHELL \\./dummy\\.test a b$" \
+  && r='ok' || r='not ok'
+result_ "$r" "direct run display re-exec message [args: a b]"
+
+./checkargs.test a '' -e && r='ok' || r='not ok'
+result_ "$r" "direct re-exec preserving args"
+
+for sh_type in non-bash bash; do
+  get_sh $sh_type
+  if test "$sh" = :; then
+    skip_row_ 5 -r "no $sh_type shell available" "re-exec message"
+    skip_row_ 5 -r "no $sh_type shell available" "re-exec preserving args"
+    continue
+  fi
+  check_preserve_args ''
+  check_reexec_message '' a b c
+  check_preserve_args .
+  check_reexec_message .  a b c
+  cd sub
+  check_preserve_args ..
+  check_reexec_message .. a b c
+  cd ..
+  check_preserve_args "$cwd"
+  check_reexec_message "$cwd" a -b c-
+  check_preserve_args sub
+  check_reexec_message sub 1 2 3 4
+done
+
+:
index 639319a..ae90e9f 100755 (executable)
@@ -18,6 +18,9 @@
 # Test subroutines to report warnings, and to signal failures, skips
 # and hard errors.
 
+unset stderr_fileno_ || :
+
+am_create_testdir=empty
 . ./defs || Exit 1
 
 set +e
@@ -29,6 +32,8 @@ exec 5>&1
 (fail_ foo) 2>&1 1>&5 | grep "^$me: failed test: foo"  || Exit 1
 (skip_ foo); test $? -eq 77                            || Exit 1
 (skip_ foo) 2>&1 1>&5 | grep "^$me: skipped test: foo" || Exit 1
+(fatal_ foo); test $? -eq 99                           || Exit 1
+(fatal_ foo) 2>&1 1>&5 | grep "^$me: hard error: foo"  || Exit 1
 (framework_failure_ foo); test $? -eq 99               || Exit 1
 (framework_failure_ foo) 2>&1 1>&5 \
   | grep "^$me: set-up failure: foo"                   || Exit 1
@@ -40,6 +45,8 @@ stderr_fileno_=6
 (fail_ foo) 6>&1 1>&5 | grep "^$me: failed test: foo"  || Exit 1
 (skip_ foo); test $? -eq 77                            || Exit 1
 (skip_ foo) 6>&1 1>&5 | grep "^$me: skipped test: foo" || Exit 1
+(fatal_ foo); test $? -eq 99                           || Exit 1
+(fatal_ foo) 6>&1 1>&5 | grep "^$me: hard error: foo"  || Exit 1
 (framework_failure_ foo); test $? -eq 99               || Exit 1
 (framework_failure_ foo) 6>&1 1>&5 \
   | grep "^$me: set-up failure: foo"                   || Exit 1
diff --git a/tests/self-check-sanity.test b/tests/self-check-sanity.test
new file mode 100755 (executable)
index 0000000..8626914
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Test the sanity checks performed by the `defs' script.  Also check
+# that we can use `defs' elsewhere, when we duplicate some of the
+# infrastructure from the automake/tests subdirectory.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+# Avoid to confuse traces from child processed with our own traces.
+show_stderr ()
+{
+  sed 's/^/ | /' stderr >&2
+}
+
+AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC
+
+if $SHELL -c '. ../defs' dummy.test 2>stderr; then
+  show_stderr
+  Exit 1
+else
+  show_stderr
+  grep 'defs-static: not found in current directory' stderr
+fi
+
+sed 's|^testsrcdir=.*|testsrcdir=foo|' ../defs-static > defs-static
+if $SHELL -c '. ../defs' dummy.test 2>stderr; then
+  show_stderr
+  Exit 1
+else
+  show_stderr
+  grep 'foo/defs-static\.in not found.*check \$testsrcdir' stderr
+fi
+
+sed 's|^testbuilddir=.*|testbuilddir=foo|' ../defs-static > defs-static
+if $SHELL -c '. ../defs' dummy.test 2>stderr; then
+  show_stderr
+  Exit 1
+else
+  show_stderr
+  grep 'foo/defs-static not found.*check \$testbuilddir' stderr
+fi
+
+# We still need a little hack to make ./defs work outside automake's
+# tree `tests' subdirectory.  Not a big deal.
+sed "s|^testbuilddir=.*|testbuilddir='`pwd`'|" ../defs-static >defs-static
+# Redefining *srcdir and *builddir variables in the environment shouldn't
+# cause problems
+env \
+  builddir=bad-dir srcdir=bad-dir \
+  top_builddir=bad-dir top_srcdir=bad-dir \
+  abs_builddir=bad-dir abs_srcdir=bad-dir \
+  abs_top_builddir=bad-dir abs_top_srcdir=bad-dir \
+  $SHELL -c  '. ../defs && echo "!OK!" > ../foo' dummy.test
+$FGREP '!OK!' foo
+
+:
diff --git a/tests/self-check-seq.tap b/tests/self-check-seq.tap
new file mode 100755 (executable)
index 0000000..e643c34
--- /dev/null
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Check the `seq_' subroutine.
+
+. ./defs || Exit 1
+
+plan_ 14
+
+unset stderr_fileno_ || :
+
+check_work ()
+{
+  desc=$1 args=$2 exp=$3
+  st=0; got=`seq_ $args` || st=$?
+  command_ok_ "$desc [exit status = 0]" test $st -eq 0
+  command_ok_ "$desc [output]" test x"$exp" = x"$got"
+}
+
+check_work 'one-argument form' '5' "\
+1
+2
+3
+4
+5"
+
+check_work 'two-arguments form' '7 11' "\
+7
+8
+9
+10
+11"
+
+check_work 'three-arguments form (1)' '120 5 135' "\
+120
+125
+130
+135"
+
+check_work 'three-arguments form (1)' '13 4 23' "\
+13
+17
+21"
+
+check_err ()
+{
+  desc=$1 args=$2 err=$3
+  (seq_ $args) >output || st=$?
+  # Protect content emitted on stdout/stderr, to avoid sending to the
+  # TAP driver possible "Bail out!" directives generated by `seq_'.
+  # Use `grep -c' below for the same reason.
+  sed 's/^/: /' output
+  command_ok_ "$desc [exit status = 99]" test $st -eq 99
+  command_ok_ "$desc [error message]" grep -c "seq_: $err" output
+}
+
+check_err 'no argument is an error' '' 'missing argument'
+check_err 'four arguments is an error' '1 1 2 1' 'too many arguments'
+check_err 'six arguments is an error' '1 1 1 1 1 1' 'too many arguments'
+
+:
diff --git a/tests/self-check-tap.test b/tests/self-check-tap.test
new file mode 100755 (executable)
index 0000000..29350ef
--- /dev/null
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Make sure that $am_using_tap gets automatically defined by
+# `./defs-static', but can be overridden by the individual tests.
+
+. ./defs-static || exit 1
+
+set -ex
+
+$SHELL -c '. ./defs-static && test $am_using_tap = yes' foo.tap
+$SHELL -c '. ./defs-static && test $am_using_tap = no'  foo.test
+$SHELL -c '. ./defs-static && test $am_using_tap = no'  tap
+$SHELL -c '. ./defs-static && test $am_using_tap = no'  tap.test
+$SHELL -c '. ./defs-static && test $am_using_tap = no'  foo-tap
+
+$SHELL -c '
+  am_using_tap=no
+  . ./defs-static
+  test $am_using_tap = no
+' foo.tap
+
+$SHELL -c '
+  am_using_tap=yes
+  . ./defs-static
+  test $am_using_tap = yes
+' foo.test
+
+:
diff --git a/tests/self-check-unindent.tap b/tests/self-check-unindent.tap
new file mode 100755 (executable)
index 0000000..517224a
--- /dev/null
@@ -0,0 +1,255 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Sanity check for the automake testsuite.
+# Check the `unindent' subroutine.
+
+. ./defs || Exit 1
+
+plan_ 22
+
+#------------------------------------------------------------------
+
+will_test () { tst=$*; }
+
+do_check ()
+{
+  command_ok_ "$tst [simple, exit status]" \
+              eval 'unindent input > got'
+  command_ok_ "$tst [simple, output]" \
+              diff exp got
+  command_ok_ "$tst [parallel, exit status]" \
+              eval 'unindent input | unindent > got'
+  command_ok_ "$tst [parallel, output]" \
+              diff exp got
+}
+
+#------------------------------------------------------------------
+
+will_test 'leading spaces'
+
+cat > input <<END
+  1
+   2
+3
+ 4
+${tab}5
+${tab}  6
+  6${sp}
+7${sp}
+  8${sp}${sp}
+9${sp}${sp}
+  10${tab}
+11${tab}
+  12${sp}${tab}
+13${sp}${tab}
+  14 this${tab}with${tab}multiple fields${sp}
+15 and   ${tab}${tab}this too${tab}
+ 16 and also this
+${sp}${sp}
+${sp}
+${tab}
+
+last line
+END
+
+cat > exp <<END
+1
+ 2
+3
+ 4
+${tab}5
+${tab}  6
+6${sp}
+7${sp}
+8${sp}${sp}
+9${sp}${sp}
+10${tab}
+11${tab}
+12${sp}${tab}
+13${sp}${tab}
+14 this${tab}with${tab}multiple fields${sp}
+15 and   ${tab}${tab}this too${tab}
+ 16 and also this
+
+${sp}
+${tab}
+
+last line
+END
+
+do_check
+
+#------------------------------------------------------------------
+
+will_test 'leading tab'
+
+cat > input <<END
+${tab}1
+${tab} 2
+3
+ 4
+  5
+    6
+        7
+ ${tab}8
+${tab}${tab}9
+${tab}10${tab}
+${tab}11${sp}
+12${tab}
+13${sp}
+${tab}14 this  with${tab}multiple fields${sp}
+15 and   ${tab}${tab}this too${tab}
+ 16 and also this
+${tab}
+${sp}
+${sp}${tab}
+
+last line
+END
+
+cat > exp <<END
+1
+ 2
+3
+ 4
+  5
+    6
+        7
+ ${tab}8
+${tab}9
+10${tab}
+11${sp}
+12${tab}
+13${sp}
+14 this  with${tab}multiple fields${sp}
+15 and   ${tab}${tab}this too${tab}
+ 16 and also this
+
+${sp}
+${sp}${tab}
+
+last line
+END
+
+do_check "leading tab"
+
+#------------------------------------------------------------------
+
+will_test 'no leading whitespace'
+
+cat > input <<END
+1
+ 2
+  3
+        4
+${tab}5
+${tab} 6
+ ${tab}7
+${tab}${tab}8
+9${sp}
+ 10${tab}
+${tab}10${sp}${sp}
+14 this with${tab}multiple  fields${sp}
+ 15 and this too${tab}
+${tab}16 and also this
+${tab}
+${sp}
+
+last line
+END
+
+cp input exp
+
+do_check
+
+#------------------------------------------------------------------
+
+will_test 'leading empty lines ignored (1)'
+
+cat > input <<END
+
+
+ foo
+ bar
+   quux
+END
+
+cat > exp <<END
+
+
+foo
+bar
+  quux
+END
+
+do_check
+
+#------------------------------------------------------------------
+
+will_test 'leading empty lines ignored (2)'
+
+cat > input <<END
+
+
+foo
+bar
+   quux
+END
+
+cat > exp <<END
+
+
+foo
+bar
+   quux
+END
+
+do_check
+
+#------------------------------------------------------------------
+
+will_test 'more elaborated parallel use'
+
+cat > input <<END
+  x
+  ${tab}y
+  z
+  ${tab}a
+  ${tab} b
+${tab}c
+   ${tab}d
+ ${tab}e
+  ${tab}${tab}f
+END
+
+cat > exp <<END
+y
+z
+a
+ b
+c
+ ${tab}d
+ ${tab}e
+${tab}f
+END
+
+command_ok_ "$tst [exit status]" \
+            eval 'unindent input | sed 1d | unindent > got'
+
+command_ok_ "$tst [output]" diff exp got
+
+:
index a0255f5..a3348e9 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AM_SILENT_RULES
 AC_OUTPUT
diff --git a/tests/silent-lex-gcc.test b/tests/silent-lex-gcc.test
deleted file mode 100755 (executable)
index 6545752..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-#!/bin/sh
-# Copyright (C) 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/>.
-
-# Check silent-rules mode for Lex, forcing gcc depmode.
-# Keep this in sync with sister test `silent-lex-generic.test'.
-
-required='flex gcc'
-. ./defs || Exit 1
-
-set -e
-
-mkdir sub
-
-cat >>configure.in <<'EOF'
-AM_SILENT_RULES
-AM_PROG_CC_C_O
-AC_PROG_LEX
-AC_CONFIG_FILES([sub/Makefile])
-AC_OUTPUT
-EOF
-
-cat > Makefile.am <<'EOF'
-# Need generic and non-generic rules.
-bin_PROGRAMS = foo1 foo2
-foo1_SOURCES = foo.l
-foo2_SOURCES = $(foo1_SOURCES)
-foo2_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
-LDADD = $(LEXLIB)
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.l
-bar2_SOURCES = $(bar1_SOURCES)
-bar2_CFLAGS = $(AM_CFLAGS)
-LDADD = $(LEXLIB)
-EOF
-
-cat > foo.l <<'EOF'
-%%
-"END"   return EOF;
-.
-%%
-/* Avoid possible link errors. */
-int yywrap (void) { return 1; }
-int   main (void) { return 0; }
-EOF
-cp foo.l sub/bar.l
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-$AUTOCONF
-
-# Force gcc ("fast") depmode.
-# This apparently useless "for" loop is here to simplify the syncing
-# with sister test `silent-lex-gcc.test'.
-for config_args in \
-  am_cv_CC_dependencies_compiler_type=gcc
-do
-  ./configure $config_args --enable-silent-rules
-
-  $MAKE >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  $EGREP '(mv|ylwrap) ' stdout && Exit 1
-
-  grep 'LEX .*foo\.' stdout
-  grep 'LEX .*bar\.' stdout
-  grep ' CC .*foo\.' stdout
-  grep ' CC .*bar\.' stdout
-  grep 'CCLD .*foo1' stdout
-  grep 'CCLD .*bar1' stdout
-  grep 'CCLD .*foo2' stdout
-  grep 'CCLD .*bar2' stdout
-
-  # Cleaning and then rebuilding with the same V flag (and without
-  # removing the generated sources in between) shouldn't trigger a
-  # different set of rules.
-  $MAKE clean
-
-  $MAKE >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  $EGREP '(mv|ylwrap) ' stdout && Exit 1
-
-  # Don't look for LEX, as probably lex hasn't been re-run.
-  grep ' CC .*foo\.' stdout
-  grep ' CC .*bar\.' stdout
-  grep 'CCLD .*foo1' stdout
-  grep 'CCLD .*bar1' stdout
-  grep 'CCLD .*foo2' stdout
-  grep 'CCLD .*bar2' stdout
-
-  # Ensure a truly clean rebuild.
-  $MAKE clean
-  rm -f foo.c sub/bar.c
-
-  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  grep ' -c ' stdout
-  grep ' -o ' stdout
-  grep 'ylwrap ' stdout
-
-  $EGREP '(LEX|CC|CCLD) ' stdout && Exit 1
-
-  # Cleaning and then rebuilding with the same V flag (and without
-  # removing the generated sources in between) shouldn't trigger a
-  # different set of rules.
-  $MAKE clean
-
-  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  # Don't look for ylwrap, as probably lex hasn't been re-run.
-  grep ' -c ' stdout
-  grep ' -o ' stdout
-
-  $EGREP '(LEX|CC|CCLD) ' stdout && Exit 1
-
-  # Ensure a truly clean reconfiguration/rebuild.
-  $MAKE clean
-  $MAKE maintainer-clean
-  rm -f foo.c sub/bar.c
-
-done
-
-:
diff --git a/tests/silent-lex-generic.test b/tests/silent-lex-generic.test
deleted file mode 100755 (executable)
index f1b1ce2..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/bin/sh
-# Copyright (C) 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/>.
-
-# Check silent-rules mode for Lex.
-# Keep this in sync with sister test `silent-lex-gcc.test'.
-
-required='flex'
-. ./defs || Exit 1
-
-set -e
-
-mkdir sub
-
-cat >>configure.in <<'EOF'
-AM_SILENT_RULES
-AM_PROG_CC_C_O
-AC_PROG_LEX
-AC_CONFIG_FILES([sub/Makefile])
-AC_OUTPUT
-EOF
-
-cat > Makefile.am <<'EOF'
-# Need generic and non-generic rules.
-bin_PROGRAMS = foo1 foo2
-foo1_SOURCES = foo.l
-foo2_SOURCES = $(foo1_SOURCES)
-foo2_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
-LDADD = $(LEXLIB)
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.l
-bar2_SOURCES = $(bar1_SOURCES)
-bar2_CFLAGS = $(AM_CFLAGS)
-LDADD = $(LEXLIB)
-EOF
-
-cat > foo.l <<'EOF'
-%{
-/* avoid non-ANSI #include of unistd.h */
-#define YY_NO_UNISTD_H 1
-%}
-%%
-"END"   return EOF;
-.
-%%
-/* Avoid possible link errors. */
-int yywrap (void) { return 1; }
-int   main (void) { return 0; }
-EOF
-cp foo.l sub/bar.l
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-$AUTOCONF
-
-# Force dependency tracking explicitly, so that slow dependency
-# extractors are not rejected.  Try also with dependency tracking
-# explicitly disabled.
-for config_args in \
-  --enable-dependency-tracking --disable-dependency-tracking
-do
-  ./configure $config_args --enable-silent-rules
-
-  $MAKE >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  $EGREP '(mv|ylwrap) ' stdout && Exit 1
-
-  grep 'LEX .*foo\.' stdout
-  grep 'LEX .*bar\.' stdout
-  grep ' CC .*foo\.' stdout
-  grep ' CC .*bar\.' stdout
-  grep 'CCLD .*foo1' stdout
-  grep 'CCLD .*bar1' stdout
-  grep 'CCLD .*foo2' stdout
-  grep 'CCLD .*bar2' stdout
-
-  # Cleaning and then rebuilding with the same V flag (and without
-  # removing the generated sources in between) shouldn't trigger a
-  # different set of rules.
-  $MAKE clean
-
-  $MAKE >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  $EGREP '(mv|ylwrap) ' stdout && Exit 1
-
-  # Don't look for LEX, as probably lex hasn't been re-run.
-  grep ' CC .*foo\.' stdout
-  grep ' CC .*bar\.' stdout
-  grep 'CCLD .*foo1' stdout
-  grep 'CCLD .*bar1' stdout
-  grep 'CCLD .*foo2' stdout
-  grep 'CCLD .*bar2' stdout
-
-  # Ensure a truly clean rebuild.
-  $MAKE clean
-  rm -f foo.c sub/bar.c
-
-  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  grep ' -c ' stdout
-  grep ' -o ' stdout
-  grep 'ylwrap ' stdout
-
-  $EGREP '(LEX|CC|CCLD) ' stdout && Exit 1
-
-  # Cleaning and then rebuilding with the same V flag (and without
-  # removing the generated sources in between) shouldn't trigger a
-  # different set of rules.
-  $MAKE clean
-
-  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  # Don't look for ylwrap, as probably lex hasn't been re-run.
-  grep ' -c ' stdout
-  grep ' -o ' stdout
-
-  $EGREP '(LEX|CC|CCLD) ' stdout && Exit 1
-
-  # Ensure a truly clean reconfiguration/rebuild.
-  $MAKE clean
-  $MAKE maintainer-clean
-  rm -f foo.c sub/bar.c
-
-done
-
-:
diff --git a/tests/silent-lex.test b/tests/silent-lex.test
new file mode 100755 (executable)
index 0000000..ce1dc5b
--- /dev/null
@@ -0,0 +1,138 @@
+#!/bin/sh
+# Copyright (C) 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/>.
+
+# Check silent-rules mode for Lex.
+
+required=lex
+. ./defs || Exit 1
+
+set -e
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AM_PROG_CC_C_O
+AC_PROG_LEX
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+bin_PROGRAMS = foo1 foo2
+foo1_SOURCES = foo.l
+foo2_SOURCES = $(foo1_SOURCES)
+foo2_LFLAGS = -n
+foo2_CFLAGS = $(AM_CFLAGS)
+SUBDIRS = sub
+LDADD = $(LEXLIB)
+EOF
+
+cat > sub/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+# Need generic and non-generic rules.
+bin_PROGRAMS = bar1 bar2
+bar1_SOURCES = bar.l
+bar2_SOURCES = $(bar1_SOURCES)
+bar2_LFLAGS = -n
+bar2_CFLAGS = $(AM_CFLAGS)
+LDADD = $(LEXLIB)
+EOF
+
+cat > foo.l <<'EOF'
+%%
+"END"   return EOF;
+.
+%%
+/* Avoid possible link errors. */
+int yywrap (void) { return 1; }
+int   main (void) { return 0; }
+EOF
+cp foo.l sub/bar.l
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# Ensure per-target rules are used, to ensure their coverage below.
+$FGREP 'foo2-foo.c' Makefile.in || Exit 99
+$FGREP 'bar2-bar.c' sub/Makefile.in || Exit 99
+
+./configure --enable-silent-rules
+
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP ' (-c|-o)' stdout && Exit 1
+$EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+grep 'LEX .*foo\.' stdout
+grep 'LEX .*bar\.' stdout
+grep ' CC .*foo\.' stdout
+grep ' CC .*bar\.' stdout
+grep 'CCLD .*foo1' stdout
+grep 'CCLD .*bar1' stdout
+grep 'CCLD .*foo2' stdout
+grep 'CCLD .*bar2' stdout
+
+# Cleaning and then rebuilding with the same V flag (and without
+# removing the generated sources in between) shouldn't trigger a
+# different set of rules.
+$MAKE clean
+
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP ' (-c|-o)' stdout && Exit 1
+$EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+# Don't look for LEX, as probably lex hasn't been re-run.
+grep ' CC .*foo\.' stdout
+grep ' CC .*bar\.' stdout
+grep 'CCLD .*foo1' stdout
+grep 'CCLD .*bar1' stdout
+grep 'CCLD .*foo2' stdout
+grep 'CCLD .*bar2' stdout
+
+# Ensure a truly clean rebuild.
+$MAKE clean
+rm -f *foo.c sub/*bar.c
+
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep ' -c ' stdout
+grep ' -o ' stdout
+grep 'ylwrap ' stdout
+
+$EGREP '(LEX|CC|CCLD) ' stdout && Exit 1
+
+# Cleaning and then rebuilding with the same V flag (and without
+# removing the generated sources in between) shouldn't trigger a
+# different set of rules.
+$MAKE clean
+
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+# Don't look for ylwrap, as probably lex hasn't been re-run.
+grep ' -c ' stdout
+grep ' -o ' stdout
+
+$EGREP '(LEX|CC|CCLD) ' stdout && Exit 1
+
+:
index 9101675..3598969 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012 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
 # This test requires the GNU compilers; keep it in sync with sister test
 # `silent-many-generic.test', which should work with generic compilers.
 
-required='gcc g++ gfortran flex bison'
+required='gcc g++ gfortran lex yacc'
 . ./defs || Exit 1
 
-set -e
-
 # Avoids too much code duplication.
 do_and_check_silent_build ()
 {
@@ -73,7 +71,6 @@ do_and_check_silent_build ()
 # Avoids too much code duplication.
 do_and_check_verbose_build ()
 {
-
   case $1 in
     --rebuild) rebuild=true;;
             *) rebuild=false;;
@@ -118,6 +115,8 @@ fo2_SOURCES = $(foo_SOURCES)
 fo2_CPPFLAGS = $(AM_CPPFLAGS)
 fo2_FFLAGS = $(AM_FFLAGS)
 fo2_FCFLAGS = $(AM_FCFLAGS)
+fo2_YFLAGS = -v
+fo2_LFLAGS = -n
 SUBDIRS = sub
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
@@ -134,6 +133,8 @@ ba2_SOURCES = $(baz_SOURCES)
 ba2_CPPFLAGS = $(AM_CPPFLAGS)
 ba2_FFLAGS = $(AM_FFLAGS)
 ba2_FCFLAGS = $(AM_FCFLAGS)
+ba2_YFLAGS = -v
+ba2_LFLAGS = -n
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
 BUILT_SOURCES = baz6.h
@@ -187,11 +188,23 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
+# Sanity check: make sure the cache variables we force are really
+# used by configure.
+$FGREP am_cv_CC_dependencies_compiler_type configure
+$FGREP am_cv_CXX_dependencies_compiler_type configure
+# Ensure per-target rules are used, to ensure their coverage below.
+# (We do not do an exhaustive check, that wouldn't be practical).
+$FGREP 'bar-bar.o' Makefile.in
+$FGREP 'fo2-foo5.c' Makefile.in
+$FGREP 'fo2-foo6.c' Makefile.in
+
 # Force gcc ("fast") depmode.
+depmodes="am_cv_CC_dependencies_compiler_type=gcc \
+          am_cv_CXX_dependencies_compiler_type=gcc"
 # This apparently useless "for" loop is here to simplify the syncing
 # with sister test `silent-many-generic.test'.
 for config_args in \
-  am_cv_CC_dependencies_compiler_type=gcc
+  "$depmodes"
 do
 
   ./configure $config_args --enable-silent-rules
@@ -207,7 +220,7 @@ do
   $MAKE clean
   # This is required, since these files are not removed by `make clean'
   # (as dictated by the GNU Coding Standards).
-  rm -f foo5.c foo6.[ch] sub/baz5.c sub/baz6.[ch]
+  rm -f *foo5.c *foo6.[ch] sub/*baz5.c sub/*baz6.[ch]
 
   do_and_check_verbose_build
   # Cleaning and then rebuilding with the same V flag (and without
index 4a234c1..ebbacda 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2010, 2011, 2012 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
 # sister test `silent-many-gcc.test', which requires the GNU compilers
 # and forces the use of gcc depmode.
 
-# FIXME: generic C++/Fortran compilers should suffice here
-required='g++ gfortran flex bison'
+required='cc c++ fortran fortran77 lex yacc'
 . ./defs || Exit 1
 
-set -e
-
 # Avoids too much code duplication.
 do_and_check_silent_build ()
 {
@@ -75,7 +72,6 @@ do_and_check_silent_build ()
 # Avoids too much code duplication.
 do_and_check_verbose_build ()
 {
-
   case $1 in
     --rebuild) rebuild=true;;
             *) rebuild=false;;
@@ -102,11 +98,33 @@ mkdir sub
 cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AM_PROG_CC_C_O
-AC_PROG_CXX
 AC_PROG_F77
 AC_PROG_FC
 AC_PROG_LEX
 AC_PROG_YACC
+AC_PROG_CXX
+
+# FIXME: remove this hack once the requirements c++, fortran and fortran77
+# are implemented correctly.
+test -n "`echo $CXX`" || AC_MSG_ERROR([C++ compiler not found], [77])
+test -n "`echo $FC`"  || AC_MSG_ERROR([Fortran compiler not found], [77])
+test -n "`echo $F77`" || AC_MSG_ERROR([Fortran 77 compiler not found], [77])
+
+# The SunStudio C++ compiler is unfortunately named `CC' (yuck!),
+# and this can cause problems with our grepping checks on the
+# output from make.  Avoid these problems by invoking a wrapper
+# script, as filtering the make output proved too fragile.
+case " $CXX " in
+  *' CC '*|*'/CC '*)
+    AC_MSG_WARN([the C++ compiler '$CXX' seems to be named 'CC'])
+    AC_MSG_WARN([it will be wrapped with the custom script 'am--cxx'])
+    echo '#!/bin/sh' > bin/am--cxx
+    echo 'PATH=$saved_PATH; export PATH' >> bin/am--cxx
+    echo "exec $CXX \${1+"\$@"}" >> bin/am--cxx
+    chmod a+x bin/am--cxx
+    CXX=am--cxx
+esac
+
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
@@ -120,6 +138,8 @@ fo2_SOURCES = $(foo_SOURCES)
 fo2_CPPFLAGS = $(AM_CPPFLAGS)
 fo2_FFLAGS = $(AM_FFLAGS)
 fo2_FCFLAGS = $(AM_FCFLAGS)
+fo2_YFLAGS = -v
+fo2_LFLAGS = -n
 SUBDIRS = sub
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
@@ -136,6 +156,8 @@ ba2_SOURCES = $(baz_SOURCES)
 ba2_CPPFLAGS = $(AM_CPPFLAGS)
 ba2_FFLAGS = $(AM_FFLAGS)
 ba2_FCFLAGS = $(AM_FCFLAGS)
+ba2_YFLAGS = -v
+ba2_LFLAGS = -n
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
 BUILT_SOURCES = baz6.h
@@ -185,10 +207,20 @@ cp foo3.f sub/baz3.f
 cp foo5.l sub/baz5.l
 cp foo6.y sub/baz6.y
 
+mkdir bin
+saved_PATH=$PATH; export saved_PATH
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+
 $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
+# Ensure per-target rules are used, to ensure their coverage below.
+# (We do not do an exhaustive check, that wouldn't be practical).
+$FGREP 'bar-bar.o' Makefile.in
+$FGREP 'fo2-foo5.c' Makefile.in
+$FGREP 'fo2-foo6.c' Makefile.in
+
 # Force dependency tracking explicitly, so that slow dependency
 # extractors are not rejected.  Try also with dependency tracking
 # explicitly disabled.
@@ -209,7 +241,7 @@ do
   $MAKE clean
   # This is required, since these files are not removed by `make clean'
   # (as dictated by the GNU Coding Standards).
-  rm -f foo5.c foo6.[ch] sub/baz5.c sub/baz6.[ch]
+  rm -f *foo5.c *foo6.[ch] sub/*baz5.c sub/*baz6.[ch]
 
   do_and_check_verbose_build
   # Cleaning and then rebuilding with the same V flag (and without
index 0024b5d..4e5d73e 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_PROG_CC
diff --git a/tests/silent-nowarn.test b/tests/silent-nowarn.test
new file mode 100755 (executable)
index 0000000..f0f5e70
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Copyright (C) 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/>.
+
+# Check that the 'silent-rules' mode suppresses the warnings for recursive
+# make variable expansions.  This should happen regardless of whether and
+# where these warnings are requested.
+
+. ./defs || Exit 1
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+# Yes, we repeat the warnings two times, both before and after
+# 'silent-rules'.  This is deliberate.
+AM_INIT_AUTOMAKE([gnu -Wall -Wportability-recursive
+                      silent-rules
+                      -Wall -Wportability-recursive])
+AC_CONFIG_FILES([Makefile])
+END
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = gnu -Wall -Wportability-recursive
+foo = $($(v)) $(x$(v)) $($(v)x) $(y$(v)z)
+END
+
+# Files required bu gnu strictness.
+touch AUTHORS ChangeLog COPYING INSTALL NEWS README THANKS
+
+$ACLOCAL
+$AUTOMAKE --gnu -Wall -Wportability-recursive
+
+:
diff --git a/tests/silent-yacc-gcc.test b/tests/silent-yacc-gcc.test
deleted file mode 100755 (executable)
index 33ae8ae..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2010 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/>.
-
-# Check silent-rules mode for Yacc, forcing gcc depmode.
-# Keep this in sync with sister test `silent-yacc-generic.test'.
-
-required='gcc bison'
-. ./defs || Exit 1
-
-set -e
-
-mkdir sub
-
-cat >>configure.in <<'EOF'
-AM_SILENT_RULES
-AM_PROG_CC_C_O
-AC_PROG_YACC
-AC_CONFIG_FILES([sub/Makefile])
-AC_OUTPUT
-EOF
-
-cat > Makefile.am <<'EOF'
-# Need generic and non-generic rules.
-bin_PROGRAMS = foo1 foo2
-foo1_SOURCES = foo.y
-foo2_SOURCES = $(foo1_SOURCES)
-foo2_CFLAGS = $(AM_CPPFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.y
-bar2_SOURCES = $(bar1_SOURCES)
-bar2_CFLAGS = $(AM_CPPFLAGS)
-EOF
-
-cat > foo.y <<'EOF'
-%{
-void yyerror (char *s) {}
-int yylex (void) {return 0;}
-int main(void) {return 0;}
-%}
-%token EOF
-%%
-fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
-EOF
-cp foo.y sub/bar.y
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-$AUTOCONF
-
-# Force gcc ("fast") depmode.
-# This apparently useless "for" loop is here to simplify the syncing
-# with sister test `silent-yacc-gcc.test'.
-for config_args in \
-  am_cv_CC_dependencies_compiler_type=gcc
-do
-  ./configure $config_args --enable-silent-rules
-
-  $MAKE >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  $EGREP '(mv|ylwrap) ' stdout && Exit 1
-
-  grep 'YACC .*foo\.' stdout
-  grep 'YACC .*bar\.' stdout
-  grep ' CC .*foo\.' stdout
-  grep ' CC .*bar\.' stdout
-  grep 'CCLD .*foo1' stdout
-  grep 'CCLD .*bar1' stdout
-  grep 'CCLD .*foo2' stdout
-  grep 'CCLD .*bar2' stdout
-
-  # Cleaning and then rebuilding with the same V flag (and without
-  # removing the generated sources in between) shouldn't trigger a
-  # different set of rules.
-  $MAKE clean
-
-  $MAKE >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  $EGREP '(mv|ylwrap) ' stdout && Exit 1
-
-  # Don't look for YACC, as probably yacc hasn't been re-run.
-  grep ' CC .*foo\.' stdout
-  grep ' CC .*bar\.' stdout
-  grep 'CCLD .*foo1' stdout
-  grep 'CCLD .*bar1' stdout
-  grep 'CCLD .*foo2' stdout
-  grep 'CCLD .*bar2' stdout
-
-  # Ensure a truly clean rebuild.
-  $MAKE clean
-  rm -f foo.[ch] sub/bar.[ch]
-
-  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  grep ' -c ' stdout
-  grep ' -o ' stdout
-  grep 'ylwrap ' stdout
-
-  $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
-
-  # Cleaning and then rebuilding with the same V flag (and without
-  # removing the generated sources in between) shouldn't trigger a
-  # different set of rules.
-  $MAKE clean
-
-  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  # Don't look for ylwrap, as probably lex hasn't been re-run.
-  grep ' -c ' stdout
-  grep ' -o ' stdout
-
-  $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
-
-  # Ensure a truly clean reconfiguration/rebuild.
-  $MAKE clean
-  $MAKE maintainer-clean
-  rm -f foo.[ch] sub/bar.[ch]
-
-done
-
-:
diff --git a/tests/silent-yacc-generic.test b/tests/silent-yacc-generic.test
deleted file mode 100755 (executable)
index b7489da..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2010 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/>.
-
-# Check silent-rules mode for Yacc.
-# Keep this in sync with sister test `silent-yacc-gcc.test'.
-
-required='bison'
-. ./defs || Exit 1
-
-set -e
-
-mkdir sub
-
-cat >>configure.in <<'EOF'
-AM_SILENT_RULES
-AM_PROG_CC_C_O
-AC_PROG_YACC
-AC_CONFIG_FILES([sub/Makefile])
-AC_OUTPUT
-EOF
-
-cat > Makefile.am <<'EOF'
-# Need generic and non-generic rules.
-bin_PROGRAMS = foo1 foo2
-foo1_SOURCES = foo.y
-foo2_SOURCES = $(foo1_SOURCES)
-foo2_CFLAGS = $(AM_CPPFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.y
-bar2_SOURCES = $(bar1_SOURCES)
-bar2_CFLAGS = $(AM_CPPFLAGS)
-EOF
-
-cat > foo.y <<'EOF'
-%{
-void yyerror (char *s) {}
-int yylex (void) {return 0;}
-int main(void) {return 0;}
-%}
-%token EOF
-%%
-fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
-EOF
-cp foo.y sub/bar.y
-
-$ACLOCAL
-$AUTOMAKE --add-missing
-$AUTOCONF
-
-# Force dependency tracking explicitly, so that slow dependency
-# extractors are not rejected.  Try also with dependency tracking
-# explicitly disabled.
-for config_args in \
-  --enable-dependency-tracking --disable-dependency-tracking
-do
-  ./configure $config_args --enable-silent-rules
-
-  $MAKE >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  $EGREP '(mv|ylwrap) ' stdout && Exit 1
-
-  grep 'YACC .*foo\.' stdout
-  grep 'YACC .*bar\.' stdout
-  grep ' CC .*foo\.' stdout
-  grep ' CC .*bar\.' stdout
-  grep 'CCLD .*foo1' stdout
-  grep 'CCLD .*bar1' stdout
-  grep 'CCLD .*foo2' stdout
-  grep 'CCLD .*bar2' stdout
-
-  # Cleaning and then rebuilding with the same V flag (and without
-  # removing the generated sources in between) shouldn't trigger a
-  # different set of rules.
-  $MAKE clean
-
-  $MAKE >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  $EGREP ' (-c|-o)' stdout && Exit 1
-  $EGREP '(mv|ylwrap) ' stdout && Exit 1
-
-  # Don't look for YACC, as probably yacc hasn't been re-run.
-  grep ' CC .*foo\.' stdout
-  grep ' CC .*bar\.' stdout
-  grep 'CCLD .*foo1' stdout
-  grep 'CCLD .*bar1' stdout
-  grep 'CCLD .*foo2' stdout
-  grep 'CCLD .*bar2' stdout
-
-  # Ensure a truly clean rebuild.
-  $MAKE clean
-  rm -f foo.[ch] sub/bar.[ch]
-
-  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  grep ' -c ' stdout
-  grep ' -o ' stdout
-  grep 'ylwrap ' stdout
-
-  $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
-
-  # Cleaning and then rebuilding with the same V flag (and without
-  # removing the generated sources in between) shouldn't trigger a
-  # different set of rules.
-  $MAKE clean
-
-  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
-  cat stdout
-
-  # Don't look for ylwrap, as probably lex hasn't been re-run.
-  grep ' -c ' stdout
-  grep ' -o ' stdout
-
-  $EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
-
-  # Ensure a truly clean reconfiguration/rebuild.
-  $MAKE clean
-  $MAKE maintainer-clean
-  rm -f foo.[ch] sub/bar.[ch]
-
-done
-
-:
diff --git a/tests/silent-yacc-headers.test b/tests/silent-yacc-headers.test
new file mode 100755 (executable)
index 0000000..f8dd99e
--- /dev/null
@@ -0,0 +1,175 @@
+#!/bin/sh
+# Copyright (C) 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/>.
+
+# Check silent-rules mode for Yacc, when yacc-generated headers are
+# involved (i.e., the `-d' option is in *YFLAGS).
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AC_PROG_YACC
+AC_PROG_CC
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+AM_YFLAGS = -d
+bin_PROGRAMS = foo bar
+foo_SOURCES = parse.y
+bar_SOURCES = $(foo_SOURCES)
+bar_YFLAGS = $(AM_YFLAGS)
+EOF
+
+cat > parse.y <<'EOF'
+%{
+void yyerror (char *s) { return; }
+int yylex (void) { return 0; }
+int main (void) { return 0; }
+%}
+%token EOF
+%%
+fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
+EOF
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# Check that the expected non-generic rules has been truly generated.
+# Otherwise, the coverage offered by this test will be weaker then
+# expected and planned.
+$FGREP 'bar-parse.c' Makefile.in
+$FGREP '$(bar_YFLAGS)' Makefile.in
+
+./configure --enable-silent-rules
+
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP ' (-c|-d|-o)' stdout && Exit 1
+$EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+grep 'YACC  *parse\.c' stdout
+grep 'updating  *parse\.h' stdout
+grep 'YACC  *bar-parse\.c' stdout
+grep 'updating  *bar-parse\.h' stdout
+
+grep ' CC  *parse\.' stdout
+grep ' CC  *bar-parse\.' stdout
+grep 'CCLD  *foo' stdout
+grep 'CCLD  *bar' stdout
+
+# Check recovering from header removal.
+rm -f parse.h bar-parse.h
+$MAKE parse.h bar-parse.h >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP ' (-c|-d|-o)' stdout && Exit 1
+$EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+grep 'YACC  *parse\.c' stdout
+grep 'updating  *parse\.h' stdout
+grep 'YACC  *bar-parse\.c' stdout
+grep 'updating  *bar-parse\.h' stdout
+
+# Cleaning and then rebuilding with the same V flag (and without
+# removing the generated sources in between) shouldn't trigger a
+# different set of rules.
+$MAKE clean
+
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP ' (-c|-d|-o)' stdout && Exit 1
+$EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+# Don't look for "YACC *.c" and "updating *.h", as yacc shouldn't
+# have been re-run.
+grep ' CC  *parse\.' stdout
+grep ' CC  *bar-parse\.' stdout
+grep 'CCLD  *foo' stdout
+grep 'CCLD  *bar' stdout
+
+# Check recovering from header removal.
+rm -f parse.h bar-parse.h
+$MAKE parse.h bar-parse.h >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP ' (-c|-d|-o)' stdout && Exit 1
+$EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+grep 'YACC  *parse\.c' stdout
+grep 'updating  *parse\.h' stdout
+grep 'YACC  *bar-parse\.c' stdout
+grep 'updating  *bar-parse\.h' stdout
+
+# Ensure a truly clean rebuild.
+$MAKE maintainer-clean
+
+./configure --enable-silent-rules
+
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep ' -c ' stdout
+grep ' -o ' stdout
+grep ' -d ' stdout
+grep 'ylwrap ' stdout
+
+$EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
+
+# Check recovering from header removal.
+rm -f parse.h bar-parse.h
+$MAKE V=1 parse.h bar-parse.h >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep ' -d ' stdout
+grep 'ylwrap ' stdout
+
+grep 'YACC' stdout && Exit 1
+
+# Cleaning and then rebuilding with the same V flag (and without
+# removing the generated sources in between) shouldn't trigger a
+# different set of rules.
+$MAKE clean
+
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+# Don't look for ylwrap, as probably lex hasn't been re-run.
+grep ' -c ' stdout
+grep ' -o ' stdout
+
+$EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
+
+# Check recovering from header removal.
+rm -f parse.h bar-parse.h
+$MAKE V=1 parse.h bar-parse.h >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep ' -d ' stdout
+grep 'ylwrap ' stdout
+
+grep 'YACC' stdout && Exit 1
+
+:
diff --git a/tests/silent-yacc.test b/tests/silent-yacc.test
new file mode 100755 (executable)
index 0000000..4a5e46a
--- /dev/null
@@ -0,0 +1,138 @@
+#!/bin/sh
+# Copyright (C) 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/>.
+
+# Check silent-rules mode for Yacc.
+# Keep this in sync with sister test `silent-yacc-gcc.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AM_PROG_CC_C_O
+AC_PROG_YACC
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+bin_PROGRAMS = foo1 foo2
+foo1_SOURCES = foo.y
+foo2_SOURCES = $(foo1_SOURCES)
+foo2_YFLAGS = -v
+foo2_CFLAGS = $(AM_CPPFLAGS)
+SUBDIRS = sub
+EOF
+
+cat > sub/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+# Need generic and non-generic rules.
+bin_PROGRAMS = bar1 bar2
+bar1_SOURCES = bar.y
+bar2_SOURCES = $(bar1_SOURCES)
+bar2_YFLAGS = -v
+bar2_CFLAGS = $(AM_CPPFLAGS)
+EOF
+
+cat > foo.y <<'EOF'
+%{
+void yyerror (char *s) { return; }
+int yylex (void) { return 0; }
+int main (void) { return 0; }
+%}
+%token EOF
+%%
+fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
+EOF
+cp foo.y sub/bar.y
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# Ensure per-target rules are used, to ensure their coverage below.
+$FGREP 'foo2-foo.c' Makefile.in || Exit 99
+$FGREP 'bar2-bar.c' sub/Makefile.in || Exit 99
+
+./configure --enable-silent-rules
+
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP ' (-c|-o)' stdout && Exit 1
+$EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+grep 'YACC .*foo\.' stdout
+grep 'YACC .*bar\.' stdout
+grep ' CC .*foo\.' stdout
+grep ' CC .*bar\.' stdout
+grep 'CCLD .*foo1' stdout
+grep 'CCLD .*bar1' stdout
+grep 'CCLD .*foo2' stdout
+grep 'CCLD .*bar2' stdout
+
+# Cleaning and then rebuilding with the same V flag (and without
+# removing the generated sources in between) shouldn't trigger a
+# different set of rules.
+$MAKE clean
+
+$MAKE >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP ' (-c|-o)' stdout && Exit 1
+$EGREP '(mv|ylwrap) ' stdout && Exit 1
+
+# Don't look for YACC, as probably yacc hasn't been re-run.
+grep ' CC .*foo\.' stdout
+grep ' CC .*bar\.' stdout
+grep 'CCLD .*foo1' stdout
+grep 'CCLD .*bar1' stdout
+grep 'CCLD .*foo2' stdout
+grep 'CCLD .*bar2' stdout
+
+# Ensure a truly clean rebuild.
+$MAKE clean
+rm -f *foo.[ch] sub/*bar.[ch]
+
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep ' -c ' stdout
+grep ' -o ' stdout
+grep 'ylwrap ' stdout
+
+$EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
+
+# Cleaning and then rebuilding with the same V flag (and without
+# removing the generated sources in between) shouldn't trigger a
+# different set of rules.
+$MAKE clean
+
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+# Don't look for ylwrap, as probably lex hasn't been re-run.
+grep ' -c ' stdout
+grep ' -o ' stdout
+
+$EGREP '(YACC|CC|CCLD) ' stdout && Exit 1
+
+:
index 97d881e..b958727 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 
 # Please keep this file in sync with silent2.test.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'EOF'
index aed8546..fc97697 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -22,8 +22,6 @@
 required=gcc
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'EOF'
index 17f1959..7f4322b 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 
 # Please keep this file in sync with silent4.test and silent9.test.
 
-required=libtoolize
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 AC_OUTPUT
index 9c343c0..9618791 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 required="libtoolize gcc"
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 AC_OUTPUT
index 0e474af..b4759cb 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_OUTPUT
@@ -84,7 +82,7 @@ $ACLOCAL
 AUTOMAKE_fails
 $AUTOMAKE -Wno-error
 
-# AM_SILENT_RULES should turn off the warning
+# AM_SILENT_RULES should turn off the warning.
 $sleep
 echo 'AM_SILENT_RULES' >> configure.in
 $ACLOCAL
index 5ae8ac0..39a267a 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_OUTPUT
diff --git a/tests/silent8.test b/tests/silent8.test
new file mode 100755 (executable)
index 0000000..b016ad2
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Copyright (C) 2009, 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/>.
+
+# Check texinfo rules in silent-rules mode.
+
+required='makeinfo-html tex texi2dvi-o dvips'
+. ./defs || Exit 1
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+info_TEXINFOS = foo.texi
+EOF
+
+cat > foo.texi <<'EOF'
+\input texinfo
+@c %**start of header
+@setfilename foo.info
+@settitle foo manual
+@c %**end of header
+@bye
+EOF
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+./configure --disable-silent-rules
+
+# Make sure that all labels work in silent-mode.
+$MAKE V=0 dvi html info ps pdf >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'DVIPS    foo.ps' stdout || Exit 1
+grep 'MAKEINFO foo.html' stdout || Exit 1
+# NetBSD make will print `./foo.info' instead of `foo.info'.
+grep 'MAKEINFO.*foo.info' stdout || Exit 1
+grep 'TEXI2DVI foo.dvi' stdout || Exit 1
+grep 'TEXI2PDF foo.pdf' stdout || Exit 1
+
+# Now make sure the labels don't appear in verbose mode.
+$MAKE clean || Exit 1
+$MAKE V=1 dvi html info ps pdf >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'DVIPS    foo.ps' stdout && Exit 1
+grep 'MAKEINFO foo.html' stdout && Exit 1
+grep 'MAKEINFO.*foo.info' stdout && Exit 1
+grep 'TEXI2DVI foo.dvi' stdout && Exit 1
+grep 'TEXI2PDF foo.pdf' stdout && Exit 1
+
+:
index f0abb29..a8c71cd 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2009, 2010  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
 
 # Please keep this file in sync with silent3.test and silent4.test.
 
-required="libtoolize"
+required='cc libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'EOF'
@@ -30,6 +28,7 @@ AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
diff --git a/tests/silentcxx-gcc.test b/tests/silentcxx-gcc.test
new file mode 100755 (executable)
index 0000000..8d23a38
--- /dev/null
@@ -0,0 +1,109 @@
+#!/bin/sh
+# Copyright (C) 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/>.
+
+# Check silent-rules mode for C++.
+# This test requires the GNU C++ compiler; keep it in sync with sister
+# test `silentcxx.test', which should work with generic compilers.
+
+required=g++
+. ./defs || Exit 1
+
+mkdir sub
+
+cat >>configure.in <<'EOF'
+AM_SILENT_RULES
+AC_PROG_CXX
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+# Need generic and non-generic rules.
+bin_PROGRAMS = foo1 foo2
+foo1_SOURCES = foo.cpp baz.cxx quux.cc
+foo2_SOURCES = $(foo1_SOURCES)
+foo2_CXXFLAGS = $(AM_CXXFLAGS)
+SUBDIRS = sub
+EOF
+
+cat > sub/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = subdir-objects
+# Need generic and non-generic rules.
+bin_PROGRAMS = bar1 bar2
+bar1_SOURCES = bar.cpp
+bar2_SOURCES = $(bar1_SOURCES)
+bar2_CXXFLAGS = $(AM_CXXFLAGS)
+EOF
+
+cat > foo.cpp <<'EOF'
+using namespace std; /* C compilers fail on this. */
+int main() { return 0; }
+EOF
+
+# Let's try out other extensions too.
+echo 'class Baz  { public: int i;  };' > baz.cxx
+echo 'class Quux { public: bool b; };' > quux.cc
+
+cp foo.cpp sub/bar.cpp
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+
+# Sanity check: make sure the cache variable we force is really used
+# by configure.
+$FGREP am_cv_CXX_dependencies_compiler_type configure
+
+# Force gcc ("fast") depmode.
+# This apparently useless "for" loop is here to simplify the syncing
+# with sister test `silentcxx.test'.
+for config_args in \
+  am_cv_CXX_dependencies_compiler_type=gcc
+do
+  ./configure $config_args --enable-silent-rules
+  $MAKE >stdout || { cat stdout; Exit 1; }
+  cat stdout
+
+  $EGREP ' (-c|-o)' stdout && Exit 1
+  grep 'mv ' stdout && Exit 1
+
+  grep 'CXX .*foo\.'  stdout
+  grep 'CXX .*baz\.'  stdout
+  grep 'CXX .*quux\.' stdout
+  grep 'CXX .*bar\.'  stdout
+  grep 'CXXLD .*foo1' stdout
+  grep 'CXXLD .*bar1' stdout
+  grep 'CXXLD .*foo2' stdout
+  grep 'CXXLD .*bar2' stdout
+
+  # Ensure a clean rebuild.
+  $MAKE clean
+
+  $MAKE V=1 >stdout || { cat stdout; Exit 1; }
+  cat stdout
+
+  grep ' -c ' stdout
+  grep ' -o ' stdout
+
+  $EGREP '(CC|CXX|LD) ' stdout && Exit 1
+
+  # Ensure a clean reconfiguration/rebuild.
+  $MAKE clean
+  $MAKE maintainer-clean
+
+done
+
+:
index 40fc92e..f6eab3d 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check silent-rules mode for C++.
+# This test should work with generic C++ compilers; keep it in sync with
+# sister test `silentcxx-gcc.test', which requires the GNU C++ compiler
+# and forces the use of gcc depmode.
 
-required='g++' # FIXME: any decent C++ compiler should be OK
+required=c++
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'EOF'
@@ -49,11 +50,11 @@ bar2_CXXFLAGS = $(AM_CXXFLAGS)
 EOF
 
 cat > foo.cpp <<'EOF'
-using namespace std; /* C compilers fail on this */
-int main() { return 0; }
+using namespace std; /* C compilers fail on this. */
+int main (void) { return 0; }
 EOF
 
-# let's try out other extensions too
+# Let's try out other extensions too.
 echo 'class Baz  { public: int i;  };' > baz.cxx
 echo 'class Quux { public: bool b; };' > quux.cc
 
@@ -63,11 +64,15 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-# configure once for fastdep, once for non-fastdep, once for nodep
+# Sanity check: make sure the cache variable we force is really used
+# by configure.
+$FGREP am_cv_CXX_dependencies_compiler_type configure
+
+# Force dependency tracking explicitly, so that slow dependency
+# extractors are not rejected.  Try also with dependency tracking
+# explicitly disabled.
 for config_args in \
-  '' \
-  am_cv_CC_dependencies_compiler_type=gcc \
-  --disable-dependency-tracking
+  --enable-dependency-tracking --disable-dependency-tracking
 do
   ./configure $config_args --enable-silent-rules
   $MAKE >stdout || { cat stdout; Exit 1; }
@@ -94,7 +99,7 @@ do
   grep ' -c ' stdout
   grep ' -o ' stdout
 
-  $EGREP '(CC|CXX|LD) ' stdout && Exit 1
+  $EGREP '(CXX|LD) ' stdout && Exit 1
 
   # Ensure a clean reconfiguration/rebuild.
   $MAKE clean
index cfdb186..90a8208 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # Check silent-rules mode for Fortran 77.
 # Keep this ins sync with the sister test silentf90.test.
 
-required='gfortran' # FIXME: any working Fortran compiler should be OK!
+required=fortran77
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'EOF'
index 4fe1c3f..6a56175 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # Check silent-rules mode for Fortran 90.
 # Keep this ins sync with the sister test silentf77.test.
 
-required='gfortran' # FIXME: any working Fortran compiler should be OK!
+required=fortran
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >>configure.in <<'EOF'
index a4ab5a8..c0ed869 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
@@ -25,5 +26,5 @@ cat > Makefile.am << 'END'
 foo_SOURCES = foo.c
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
index 614d6c2..ce71b68 100755 (executable)
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 # Disable shell globbing if possible.
 (set +f) >/dev/null 2>&1 && set +f
 
@@ -61,6 +59,7 @@ AC_PROG_LEX
 AC_PROG_F77
 AC_PROG_FC
 AM_PROG_GCJ
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_PROG_LIBTOOL
 AM_PROG_UPC
index b9b2e10..04c9153 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index efe13f5..eaac391 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 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
 
 # AM_DEFAULT_SOURCE_EXT
 
-required=g++
+required='cc c++'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
index 0dc7fcc..e246a2b 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -35,6 +35,8 @@ libfoo_a_CFLAGS = -DBAR
 libfoo_a_CXXFLAGS = -DZOT
 END
 
+: > ar-lib
+
 # Make sure `compile' is required.
 $ACLOCAL
 AUTOMAKE_fails
index 60006a5..71cf8e5 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2004, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2004, 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
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(test, 0.1)
+cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
-AC_OUTPUT(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -35,14 +33,12 @@ END
 
 : > compile
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
-$FGREP -e '-o foo-foo' Makefile.in || Exit 1
+$FGREP ' -o foo-foo' Makefile.in
+$FGREP 'foo.o.o' Makefile.in && Exit 1
+$FGREP 'foo.$(OBJEXT).$(OBJEXT)' Makefile.in && Exit 1
+$FGREP '$(foo_CFLAGS)' Makefile.in
 
-$FGREP 'foo.o.o' Makefile.in                       && Exit 1
-$FGREP 'foo.$(OBJEXT).$(OBJEXT)' Makefile.in       && Exit 1
-
-$FGREP '$(foo_CFLAGS)' Makefile.in || Exit 1
-
-Exit 0
+:
index d858769..3e8d648 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
 
 # Regression test for multiple rules being generated for each target when
 # conditionals are present.
-# From Richard Boulton
+# From Richard Boulton.
 
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
-AM_CONDITIONAL(BAR, true)
+AM_CONDITIONAL([BAR], [true])
 END
 
 cat > Makefile.am << 'END'
@@ -38,8 +39,8 @@ END
 
 : > compile
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 uncondval=`$FGREP 'foo-foo.o: foo.c' Makefile.in`
 
@@ -47,8 +48,10 @@ cat >> Makefile.am << 'END'
 foo_SOURCES += $(BAR_SRCS)
 END
 
-$AUTOMAKE || Exit 1
+$AUTOMAKE
 
 condval=`$FGREP 'foo-foo.o: foo.c' Makefile.in`
 
 test "x$uncondval" = "x$condval"
+
+:
index e41b316..da062d9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2004, 2012 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2011, 2012 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 true/false example from the manual, plus a check for _SHORTNAME.
 
-required=gcc
+required='cc native'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -59,6 +57,9 @@ $AUTOMAKE -a
 $MAKE
 ./true | grep true
 ./false | grep false
+
 objext=`sed -n -e 's/^OBJEXT = //p' < Makefile`
 test -f ./t-false.$objext
 test -f ./f-false.$objext
+
+:
index c5a30d7..99b9151 100755 (executable)
 # with one extra indirection in the sources (PR/315), and
 # use of _CPPFLAGS (PR/337).
 
-required=gcc
+required='cc native'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index 7f92046..42f6fff 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index d880a62..0e06e7f 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 bin_PROGRAMS = zardoz foo
 zardoz_SOURCES = x.c
index 54298f1..9002136 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >> configure.in
 
 cat > Makefile.am << 'END'
index 399328f..a415cf2 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -25,5 +26,7 @@ TAGS_DEPENDENCIES = joe
 ETAGS_ARGS = joe
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
index ad1e232..7112f89 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -22,8 +23,9 @@ cat > Makefile.am << 'EOF'
 bni_PROGRAMS = zot
 EOF
 
-if $ACLOCAL || Exit 1
-$AUTOMAKE; then
-   Exit 1
-fi
-Exit 0
+$ACLOCAL
+AUTOMAKE_fails
+grep 'bni_PROGRAMS' stderr
+grep 'bnidir.*undefined' stderr
+
+:
index 5f1a87b..1a97ae7 100755 (executable)
@@ -69,8 +69,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >Makefile <<\EOF
 a :: b
        echo rule1 >> $@
index 2f38312..0265af1 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index 494d0f6..6eb3e54 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
index cb96d27..3330f0f 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
 # Make sure stamp-h* files are created where we expect
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << END
-AM_CONFIG_HEADER(1.h
-                 2.h:config.hin
-                 3.h:sdir1/config1.hin)
+AM_CONFIG_HEADER([1.h
+                  2.h:config.hin
+                  3.h:sdir1/config1.hin])
 # AM_CONFIG_HEADER and AC_CONFIG_HEADERS should be synonyms.
-AC_CONFIG_HEADERS(sdir1/4.h
-                  sdir1/5.h:config.hin
-                  sdir1/6.h:sdir1/config1.hin
-                  sdir1/7.h:sdir2/config2.hin)
+AC_CONFIG_HEADERS([sdir1/4.h
+                   sdir1/5.h:config.hin
+                   sdir1/6.h:sdir1/config1.hin
+                   sdir1/7.h:sdir2/config2.hin])
 AC_OUTPUT
 END
 
@@ -68,4 +67,4 @@ test ! -f sdir1/stamp-h5
 test ! -f sdir1/stamp-h6
 test -f sdir1/stamp-h7
 
-Exit 0
+:
index ff914f3..1a0b485 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2007  Free Software Foundation, Inc.
+# Copyright (C) 2007, 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
 # Test to make sure the standard include order is stable.
 # Report by Kent Boortz.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_CONFIG_HEADERS([sub/config.h])
index 48f56fc..0d986da 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2003, 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = sub/foo
+include $(srcdir)/foo.mk
+END
+
+cat > foo.mk << 'END'
+## A dummy automake comment.
+a = x \
+    y
+# A dummy make comment.
+lib_LIBRARIES = zardoz.a
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
+q="[\`'\"]"
+badname='not a standard library name'
 # We're specifically testing for line-number information.
-grep 'Makefile.am:1:.*sub/foo.*standard library name' stderr
-grep 'Makefile.am:1:.*sub/libfoo.a.*' stderr
+grep "^Makefile\\.am:1:.*${q}sub/foo${q}.*$badname" stderr
+grep "^Makefile\\.am:1:.*sub/libfoo\\.a" stderr
+grep "^foo\\.mk:5:.*${q}zardoz\\.a${q}.*$badname" stderr
+grep "^foo\\.mk:5:.*libzardoz\\.a" stderr
+
+:
index c5d543c..7ee99e2 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 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
@@ -19,8 +19,6 @@
 required=libtool
 . ./defs || Exit 1
 
-set -e
-
 : > README
 : > NEWS
 : > AUTHORS
@@ -32,6 +30,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/strictness-override.test b/tests/strictness-override.test
new file mode 100755 (executable)
index 0000000..34ceae0
--- /dev/null
@@ -0,0 +1,123 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# The strictness specified in Makefile.am:AUTOMAKE_OPTIONS should
+# override that specified in configure.in:AM_INIT_AUTOMAKE, and both
+# should override the strictness specified on the command line.
+# NOTE: the current semantics might not be the best one (even if it has
+# been in place for quite a long time); see also Automake bug #7673.
+# Update this test if the semantics are changed.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$am_original_AUTOMAKE
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS =
+END
+
+set_strictness ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+ok ()
+{
+  $AUTOMAKE -Werror $*
+}
+
+ko ()
+{
+  AUTOMAKE_fails $*
+  grep 'required file.*README' stderr
+}
+
+$ACLOCAL
+
+# Leave out only one of the required files, to avoid too much
+# repetition in the error messages.
+touch INSTALL NEWS AUTHORS ChangeLog COPYING
+
+rm -rf autom4te*.cache
+set_strictness '' Makefile.am
+set_strictness '' configure.in
+ko --gnu
+ko
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'gnu' Makefile.am
+set_strictness '' configure.in
+ko --gnu
+ko
+ko --foreign
+
+rm -rf autom4te*.cache
+set_strictness '' Makefile.am
+set_strictness 'gnu' configure.in
+ko --gnu
+ko
+ko --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'foreign' Makefile.am
+set_strictness '' configure.in
+ok --gnu
+ok
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness '' Makefile.am
+set_strictness 'foreign' configure.in
+ok --gnu
+ok
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'gnu' Makefile.am
+set_strictness 'gnu' configure.in
+ko --gnu
+ko
+ko --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'foreign' Makefile.am
+set_strictness 'foreign' configure.in
+ok --gnu
+ok
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'foreign' Makefile.am
+set_strictness 'gnu' configure.in
+ok --gnu
+ok
+ok --foreign
+
+rm -rf autom4te*.cache
+set_strictness 'gnu' Makefile.am
+set_strictness 'foreign' configure.in
+ko --gnu
+ko
+ko --foreign
+
+:
diff --git a/tests/strictness-precedence.test b/tests/strictness-precedence.test
new file mode 100755 (executable)
index 0000000..0198fa6
--- /dev/null
@@ -0,0 +1,77 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# On the command line, in AM_INIT_AUTOMAKE, and in AUTOMAKE_OPTIONS,
+# strictness specified later should take precedence over strictness
+# specified earlier.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$am_original_AUTOMAKE
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS =
+END
+
+set_strictness ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+ok ()
+{
+  $AUTOMAKE -Werror $*
+}
+
+ko ()
+{
+  AUTOMAKE_fails $*
+  grep 'required file.*README' stderr
+}
+
+# Leave out only one of the required files, to avoid too much
+# repetition in the error messages.
+touch INSTALL NEWS AUTHORS ChangeLog COPYING
+
+$ACLOCAL
+ko --foreign --gnu
+ok --gnu --foreign
+
+set_strictness '' Makefile.am
+set_strictness 'gnu foreign' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+ok
+set_strictness 'foreign gnu' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+ko
+
+set_strictness '' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+set_strictness 'gnu foreign' Makefile.am
+ok
+set_strictness 'foreign gnu' Makefile.am
+ko
+
+:
index 12fe6b4..84ae5e9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2007, 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
 
 # Test for install-strip.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_OUTPUT
index 5786ded..2938304 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # Ensure install-strip works when STRIP consists of more than one word.
 # This test needs GNU binutils strip.  See sister test strip3.
 
-required=strip
+required='cc strip'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
index b159673..46c1303 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # Ensure install-strip works when STRIP consists of more than one word.
 # This test needs GNU binutils strip.  Libtool variant.
 
-required='libtoolize strip'
+required='cc libtoolize strip'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
index 0269cac..dea041d 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2006, 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
@@ -19,8 +20,6 @@
 required=gettext
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_GNU_GETTEXT
 AM_CONDITIONAL(MAUDE, true)
index 5086cd3..5cece05 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AM_CONDITIONAL([COND_OPT], [test "$want_opt" = yes])
 AC_CONFIG_FILES([src/Makefile opt/Makefile])
index 3506d05..e0c9e13 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 if test "$want_opt" = yes; then
   MAYBE_OPT=opt
index edad4ca..a78d74d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2010 Free Software
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir zot
 
 cat >> configure.in << 'END'
index eabd1a9..b6daff5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >> configure.in <<'END'
index 9412054..3547758 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2010 Free Software
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2010, 2011 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir one
 mkdir one/two
 
index 3da2cc8..bcf6acb 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 bin_PROGRAMS = zardoz widdershins
 zardoz_SOURCES = y.c x/z.c
index 7ea10f8..a298415 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir lib src
 
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AC_PROG_CC
+AM_PROG_AR
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
 AC_OUTPUT
 END
@@ -56,6 +56,8 @@ cat > src/Makefile.am << 'END'
 pkgdata_DATA =
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE --gnu
 
index 3f4dfa3..e3af205 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure that adding a new directory works.
-# This test runs `make' from the top-level directory, subdir8.test
-# do it from a subdirectory.
+# This test runs `make' from the top-level directory, the sister test
+# `subdir8.test' do it from a subdirectory.
 # PR automake/46
 
-# This test assumes that the `make' utility is able to start
-# over and reload Makefiles which have been remade (a non-POSIX feature).
-# See also the related test subdir8.test.
-required='GNUmake gcc'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
 AC_OUTPUT
 END
 
-cat > Makefile.am << 'END'
-bin_PROGRAMS = wish
-wish_SOURCES = a.c
-END
-
-cat > a.c << 'END'
-#include <stdio.h>
-int main ()
-{
-   printf ("hi liver!\n");
-   return 0;
-}
-END
+: > Makefile.am
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --include-deps --copy --add-missing
+$AUTOMAKE
 ./configure
 $MAKE
 
@@ -66,10 +46,10 @@ $sleep
 sed <configure.in >configure.tmp -e '/^AC_OUTPUT$/i\
 AC_CONFIG_FILES([maude/Makefile])\
 m4_include([confile.m4])\
-' # last newline required by older OpenBSD sed
+' # Last newline required by older OpenBSD sed.
 mv -f configure.tmp configure.in
 
-cat configure.in # might be useful for debugging
+cat configure.in # For debugging.
 
 : > confile.m4
 
index f3a2107..80ae138 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONFIG_HEADER([sub/config.h:sub/config.hin])
 AC_OUTPUT
index b50b250..28fe024 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir obj
 
 cat >>configure.in << 'END'
index b39dfe4..502c9e4 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure that adding a new directory works, even from
-# subdirectories.  (subdir5.test makes sure it works when make
-# is run from the top-level directory.)
+# subdirectories.  The sister test `subdir5.test' makes sure it works
+# when make is run from the top-level directory.
 # PR automake/46
 
-# This test assumes that the `make' utility is able to start
-# over and reload Makefiles which have been remade (a non-POSIX feature).
-# See also the related test subdir5.test.
-required='GNUmake gcc'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
 m4_include([confiles.m4])
 MORE_DEFS
 AC_OUTPUT
@@ -45,26 +37,14 @@ END
 
 mkdir sub
 
-cat > sub/Makefile.am << 'END'
-bin_PROGRAMS = wish
-wish_SOURCES = a.c
-END
-
-cat > sub/a.c << 'END'
-#include <stdio.h>
-int main ()
-{
-   printf ("hi liver!\n");
-   return 0;
-}
-END
+: > sub/Makefile.am
 
 mkdir m4
 echo 'AC_DEFUN([MORE_DEFS], [])' > m4/moredefs.m4
 
 $ACLOCAL -I m4
 $AUTOCONF
-$AUTOMAKE --copy --add-missing
+$AUTOMAKE
 ./configure
 $MAKE
 
index 403a376..dd7799f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([src/subdir/Makefile src/subdir2/Makefile])
 AC_OUTPUT
index a84f28e..ea48109 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # A bug occurred where subdirs do not have all-recursive or
 # all-recursive-am which depended on BUILT_SOURCES.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 mkdir lib
 
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([lib/Makefile])
 AC_PROG_RANLIB
 AC_PROG_CC
+AM_PROG_AR
 AC_OUTPUT
 END
 
index 39dc1b9..1510493 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2004, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2004, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index dbddf29..db071d6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
 
 # PR 492: Test asm subdir-objects.
 
-required=gcc  # avoid compiler errors.
+required=gcc
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE([subdir-objects])
 
 AM_PROG_AS
+AM_PROG_AR
 AC_PROG_RANLIB
 
 AC_CONFIG_FILES([Makefile])
index 3bf3012..80406e3 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # See also sister "grepping" test `subobj11b.test', and related test
 # `subobj11c.test'.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -39,7 +38,7 @@ END
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = foo
-## the `.//' is meant
+## The `.//' below is meant.
 foo_SOURCES = .//src/foo.c
 END
 
index 1db5fab..275b2ca 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -28,8 +28,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index 9262d15..6e8d270 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # Automatic dependency tracking with subdir-objects option active:
 # check for a pathological case of slash-collapsing in the name of
 # included makefile fragments (containing dependency info).
-# See also related tests `subobj11a.test' and `subobj11b.test'
+# See also related tests `subobj11a.test' and `subobj11b.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index 87a4671..6c41a20 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXX
 END
index ead2305..0a29ad0 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index c857e73..730e3cf 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test of subdir make dist rules.
-# From Robert Collins
+# From Robert Collins.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([generic/Makefile])
 AC_PROG_CC
@@ -29,20 +29,43 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = wish
 wish_SOURCES = generic/a.c
+
+.PHONY: test-distdir test-build
+test-distdir: distdir
+       ls -l $(distdir) $(distdir)/* ;: For debugging.
+       test ! -r $(distdir)/a.c
+       test -f $(distdir)/generic/a.c
+test-build: all
+       ls -l . generic ;: For debugging.
+       test -f generic/a.$(OBJEXT)
+       test -f wish$(EXEEXT)
+       test ! -r a.$(OBJEXT)
+       test ! -r a$(EXEEXT)
+       test ! -r generic/wish$(EXEEXT)
+       test ! -r generic/a$(EXEEXT)
 END
 
 mkdir generic
-: > generic/a.c
 : > generic/Makefile.am
 
+cat > generic/a.c << 'END'
+int main (void)
+{
+  return 0;
+}
+END
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --include-deps --copy --add-missing
 
 ./configure
 
+$MAKE test-distdir
 $MAKE dist
+$MAKE test-build
 
 :
index 228a1e9..557a214 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test of subdir make distclean rules.
-# From Robert Collins
+# From Robert Collins.
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_PROG_CC_C_O
 AC_OUTPUT
index dd1a8fe..ff36d6c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index ae9b09b..b2fc0e5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([tools])
index 83f3a31..edc9e5f 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2004, 2005, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2005, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test for PR 312.
+#
+# == Report ==
+# When using non-recursive make to build a libtoolize-library from
+# sources in a subdirectory, 'make distcheck' fails because of incomplete
+# cleanup. "make clean" tries to remove `*.o' and `.../<file>.lo' but
+# forgets `.../<file>.o'.
 
-required='libtoolize g++'
+required='c++ libtoolize'
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE([subdir-objects])
 AC_PROG_CXX
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
@@ -32,7 +38,7 @@ END
 
 cat > Makefile.am << 'END'
 noinst_LTLIBRARIES = libfoo.la
-libfoo_la_SOURCES = src/foo.cc .//src/bar.cc  # the `.//' is meant.
+libfoo_la_SOURCES = src/foo.cc .//src/bar.cc  # The `.//' is meant.
 .PHONY: print
 print:
        @echo BEG1: "$(LTCXXCOMPILE)" :1END
@@ -61,8 +67,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-# Skip this test on configure errors (e.g., broken C++ compilers).
-./configure || Exit 77
+./configure
 
 # Ensure './libtool --help' will use the right tool versions.
 export AUTOCONF AUTOMAKE
index a8128bb..e585141 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2010, 2011, 2012 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_CONDITIONAL([FOO1], [some test])
@@ -62,12 +60,12 @@ grep '^am_d_OBJECTS = ' Makefile.in
 
 # Now the actual test.  Are both values equal?
 cobj=`sed -n '/^am_c_OBJECTS = / {
-               s/.* = \(.*\)$/\1/
-               p
+                s/.* = \(.*\)$/\1/
+                p
               }' Makefile.in`
 dobj=`sed -n '/^am_d_OBJECTS = / {
-               s/^.* = \(.*\)$/\1/
-               p
+                s/^.* = \(.*\)$/\1/
+                p
               }' Makefile.in`
 test "$cobj" = "$dobj"
 
index ee8af66..757e042 100755 (executable)
@@ -21,8 +21,6 @@
 required='cc yacc'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
 AC_CONFIG_SUBDIRS([lib])
@@ -57,6 +55,7 @@ AC_PROG_RANLIB
 AC_PROG_YACC
 dnl This comes after YACC and RANLIB checks, deliberately.
 AC_PROG_CC
+AM_PROG_AR
 AC_CONFIG_HEADERS([config.h:config.hin])
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
@@ -117,34 +116,15 @@ $AUTOHEADER
 $AUTOMAKE -Wno-override --add-missing
 cd ..
 
-# Some checks here are slightly more tricky than we'd like, but we cannot
-# simply use "make distcheck", to avoid triggering a spurious failure due
-# to issues with FreeBSD make and VPATH builds (see automake bug#7884).
-
 ./configure
-$MAKE
-$MAKE dist
-test -f lib-dist-hook-has-run
-test -f subpack-1.tar.gz
-test ! -d subpack-1 # Make sure "dist" cleans up after itself.
 
-mkdir workdir
-cd workdir
-gzip -c -d ../subpack-1.tar.gz | tar xf -
-test -d subpack-1
-mkdir build
-cd build
-../subpack-1/configure
-$MAKE
 $MAKE dist
 test -f lib-dist-hook-has-run
 test -f subpack-1.tar.gz
 test ! -d subpack-1 # Make sure "dist" cleans up after itself.
 
-# Don't trust non-GNU makes to do distcheck with a Yacc-using
-# package (see bug referenced above).
-if using_gmake; then
-  $MAKE distcheck || Exit 1
-fi
+rm -f lib-dist-hook-has-run subpack-1.tar.gz
+
+yl_distcheck
 
 :
index 579a0a4..d51e67e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2006, 2011, 2012 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
 
 # Check subpackage handling.
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 mkdir m4
 
 cat >m4/foo.m4 <<'EOF'
@@ -66,6 +65,7 @@ mkdir lib/src
 cat >lib/configure.ac <<'EOF'
 AC_INIT([lib], [2.3])
 AM_INIT_AUTOMAKE
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_HEADERS([config.h:config.hin])
 AC_CONFIG_FILES([Makefile])
index ebbc69b..67cc74a 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir m4
 
 cat >m4/foo.m4 <<'EOF'
index d57ee37..ea082c2 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
 # 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 different subpackages may share files and directories.
+# Make sure different subpackages may share files and directories.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >Makefile.am <<'END'
 SUBDIRS = subpkg
 EXTRA_DIST = subpkg/foobar
index 1a6835a..096b621 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2006, 2009, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >Makefile.am <<'END'
 SUBDIRS = subpkg
 test-distdir-is-readable:
diff --git a/tests/subst-no-trailing-empty-line.test b/tests/subst-no-trailing-empty-line.test
new file mode 100755 (executable)
index 0000000..c638b54
--- /dev/null
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Copyright (C) 2003, 2006, 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/>.
+
+# If the last line of a automake-rewritten definition is made only of
+# @substitutions@, automake should take care of appending an empty
+# variable to make sure that line cannot end up substituted as a blank
+# line (that would confuse HP-UX Make).
+# These checks have been introduced in commit `Release-1-9-254-g9d0eaef'
+# into the former test `subst2.test'.
+
+. ./defs || Exit 1
+
+# These are deliberately quite long, so that the xxx_PROGRAMS definition
+# in Makefile.am below will be split on multiple lines, with the last
+# line containing only @substituted@ stuff that expands to empty (this is
+# required to expose the bug we are testing).
+v1=ABCDEFGHIJKLMNOPQRSTUVWX
+v2=ABCDEFGHIJKLMNOPQRSTUVWXY
+v3=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+
+# Literal backslash for use by grep.
+bs='\\'
+
+cat >> configure.in <<END
+AC_SUBST([A], [''])
+AC_SUBST([$v1], [''])
+AC_SUBST([$v2], [''])
+AC_SUBST([$v3], [''])
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+EXEEXT =
+
+## The "x" and "zardoz" strings and the use of '+=' are there to ensure
+## that these variables get rewritten by Automake.
+noinst_PROGRAMS = x @$v1@ @$v2@ @$v3@
+bin_PROGRAMS = @A@
+bin_PROGRAMS += @$v1@ @$v2@ @$v3@
+check_PROGRAMS = zardoz \$(noinst_PROGRAMS)
+
+## Required whenever there are @substituted@ values in the
+## PROGRAMS primary, otherwise automake will complain.
+EXTRA_PROGRAMS =
+
+print-programs:
+       @echo BEG1: \$(noinst_PROGRAMS) :END1
+       @echo BEG2: \$(bin_PROGRAMS) :END2
+       @echo BEG3: \$(check_PROGRAMS) :END3
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+# For debugging.
+$EGREP -n 'ABCD|am__empty' Makefile.in
+# Sanity check.
+test `$EGREP -c "^[ $tab]*@$v2@ @$v3@[ $tab]*$bs?$" Makefile.in` -eq 3
+
+./configure
+{
+  sed -n '/^noinst_PROGRAMS *=/,/[^\\]$/p' Makefile
+  sed -n '/^bin_PROGRAMS *=/,/[^\\]$/p' Makefile
+  sed -n '/^check_PROGRAMS *=/,/[^\\]$/p' Makefile
+  sed -n '/^am__EXEEXT.*=/,/[^\\]$/p' Makefile
+} >t-programs
+cat t-programs
+grep '^ *$' t-programs && Exit 1
+
+$MAKE print-programs >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^BEG1: x :END1$' stdout
+grep '^BEG2: :END2$' stdout
+grep '^BEG3: zardoz x :END3$' stdout
+
+am__empty=X $MAKE -e print-programs >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^BEG1: x X :END1$' stdout
+grep '^BEG2: X :END2$' stdout
+grep '^BEG3: zardoz x X :END3$' stdout
+
+:
index ebc73ca..d1e832b 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2007, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 2001, 2002, 2007, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 dnl This test used to have the following lines, which cannot have
 dnl worked sensibly with Autoconf for years, however:
index 1bcb170..6780671 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008  Free Software
-# Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 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
 
 # Test installation with substitutions.  This test is based on nobase.test.
 
-required='gcc'
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 if test -n "$doit"; then
   AC_SUBST([basehdr], [sub/base.h])
@@ -175,3 +174,5 @@ test `find inst/foo -type f -print | wc -l` = 0
 $MAKE
 $MAKE test-install-nothing-data
 $MAKE test-install-nothing-exec
+
+:
index 5f3fdd6..b86a20e 100755 (executable)
@@ -1,6 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software
-# Foundation, Inc.
+# Copyright (C) 2008, 2011, 2012 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
@@ -19,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 myrule="\
 foo: bar
@@ -43,4 +40,5 @@ $AUTOMAKE
 ./configure
 $MAKE foo
 test -f foo
+
 :
diff --git a/tests/subst5.test b/tests/subst5.test
new file mode 100755 (executable)
index 0000000..097dfe3
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2009, 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 3 of the License, 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/>.
+
+# Complain about configure substitutions in EXTRA_PRIMARY variables.
+# Rationale: we need to know the literal values of, say, PROGRAMS.
+# Thus, we allow substitutions in bin_PROGRAMS, but then EXTRA_PROGRAMS
+# needs to list possible values of that substitution, literally.
+
+. ./defs || Exit 1
+
+cat >>configure.in <<'END'
+AC_PROG_CC
+AC_SUBST([substed1])
+AC_SUBST([substed2])
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = @substed1@
+EXTRA_PROGRAMS = @substed2@
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+grep 'bin_PROGRAMS.*contains configure substitution' stderr && Exit 1
+grep 'EXTRA_PROGRAMS.*contains configure substitution' stderr
+
+Exit 0
index ffe9e8b..1935622 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2010, 2011, 2012 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
 # Test for bug in variable substitution references, where
 # undefined variables break later substitutions.
 
-required=gcc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_PROG_CC
+AC_SUBST([CC], [whocares])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
 
 foo = foo.a foo.b $(doesnt_exist)
 bar = bar.a bar.b
@@ -38,16 +36,15 @@ bin_PROGRAMS = foo
 foo_SOURCES = $(var2)
 
 OBJEXT = obj
-echorule:
-       @echo BEG: $(foo_OBJECTS) :END
+.PHONY: test
+test:
+       is $(foo_OBJECTS) == foo1.obj foo4.obj bar3.obj bar4.obj
 END
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 ./configure
-$MAKE echorule >output || { cat output; Exit 1; }
-cat output
-$FGREP 'BEG: foo1.obj foo4.obj bar3.obj bar4.obj :END' output
+$MAKE test
 
 :
index 6bbe8b1..a3088b0 100755 (executable)
 
 # Test for bug in variable substitution references when left hand
 # pattern is null.
-# Report from Richard Boulton
+# Report from Richard Boulton.
 
-required=gcc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
-AC_PROG_CC
+AC_SUBST([CC], [whocares])
 AC_OUTPUT
 END
 
-cat > hello.c << 'END'
-END
+: > hello.c
 
 cat > Makefile.am << 'END'
-
+AUTOMAKE_OPTIONS = no-dependencies
 var1 = dlmain
-
 var2 = $(var1:=.)
-
 helldl_SOURCES = $(var2:=c)
-
 bin_PROGRAMS = helldl
-
-got:
-       @echo $(helldl_SOURCES) $(helldl_OBJECTS) >got
-
+.PHONY: test
+test:
+       is $(helldl_SOURCES) $(helldl_OBJECTS) == dlmain.c dlmain.$(OBJEXT)
 END
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
 ./configure
-
-objext=`sed -n -e 's/^OBJEXT = //p' < Makefile`
-echo dlmain.c dlmain.$objext >exp
-$MAKE got
-cat got
-diff exp got
+$MAKE test
 
 # This is unrelated to the rest of this test.  But while we are
 # at it, make sure we don't use am__helldl_SOURCES_DIST here, since
index d828954..1cd5af0 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_SOURCE([fakelib.c])
 AC_PROG_CC
+AM_PROG_AR
 RANLIB=:
 AC_SUBST([RANLIB])
 SUBST=hei
@@ -37,11 +36,13 @@ noinst_LIBRARIES = libfake@SUBST@.a
 
 libfake@SUBST@_a_SOURCES = abra.c kadabra.c
 
-# then we override the target rule:
+# Then we override the target rule:
 libfake@SUBST@.a: Makefile $(libfake@SUBST@_a_OBJECTS) $(libfake@SUBST@_a_DEPENDENCIES)
        @echo here we do some custom stuff, instead of invoking the linker
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
 grep 'overrid.*libfake@SUBST@.a' stderr
diff --git a/tests/suffix-chain.tap b/tests/suffix-chain.tap
new file mode 100755 (executable)
index 0000000..680d3f0
--- /dev/null
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 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/>.
+
+# Check that Automake can emit code that work round the inability of
+# some make implementations to automatically chain suffix rules.
+# See automake bug#7824 and bug#7670.
+
+required=cc
+. ./defs || Exit 1
+
+plan_ 8
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c1
+.c1.c0:
+       (echo 'int main (void)' && echo '{' && cat $<) > $@
+.c0.c:
+       (cat $< && echo '}') > $@
+CLEANFILES = foo.c0 foo.c
+END
+
+echo 'return 0;' > foo.c1
+
+command_ok_ "aclocal"   $ACLOCAL
+command_ok_ "automake"  $AUTOMAKE
+command_ok_ "autoconf"  $AUTOCONF
+command_ok_ "configure" ./configure
+
+directive=''; make_can_chain_suffix_rules || directive=TODO
+
+for target in all distcheck; do
+  command_ok_ "make $target" \
+              -D "$directive" -r "suffix rules not chained" \
+              $MAKE $target
+done
+
+command_ok_ "clean" $MAKE clean
+# Sanity check.
+cat >> Makefile <<'END'
+foo.c: foo.c0
+foo.c0: foo.c1
+END
+command_ok_ "make with explicit dependencies" $MAKE
+
+:
index c790c66..9f0a5ff 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
 # 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 a suffix rule for C compilation is produced.
+# Make sure proper suffix rules for C compilation are produced, and
+# only once.
+# See also related test `suffix2.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AC_PROG_RANLIB
 END
 
 cat > Makefile.am << 'END'
 noinst_PROGRAMS = foo
+noinst_LIBRARIES = libbar.a
 END
 
-$ACLOCAL
+for use_arlib in false :; do
+
+  if $use_arlib; then
+    am_warns=
+    echo AM_PROG_AR >> configure.in
+    : > ar-lib
+  else
+    am_warns=-Wno-extra-portability
+  fi
+
+  $ACLOCAL --force
+
+  $AUTOMAKE $am_warns -i
+  grep '^ *\.c' Makefile.in # For debugging.
+  test `grep -c '^\.c\.o:' Makefile.in` -eq 1
+  test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
 
-$AUTOMAKE -i
-grep '^\.c\.o' Makefile.in
+  $AUTOMAKE $am_warns
+  grep '^ *\.c' Makefile.in # For debugging.
+  test `grep -c '^\.c\.o:' Makefile.in` -eq 1
+  test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
 
-$AUTOMAKE
-grep '^\.c\.o' Makefile.in
+done
 
 :
diff --git a/tests/suffix10.tap b/tests/suffix10.tap
new file mode 100755 (executable)
index 0000000..1b812cb
--- /dev/null
@@ -0,0 +1,71 @@
+#! /bin/sh
+# Copyright (C) 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 that derivations work with .lo too.
+# (related to PR/37)
+
+required='cc libtoolize yacc'
+. ./defs || Exit 1
+
+plan_ 7
+
+cat >>configure.in <<EOF
+AC_PROG_CC
+AC_PROG_YACC
+AM_PROG_AR
+AC_PROG_LIBTOOL
+AC_OUTPUT
+EOF
+
+cat >Makefile.am << 'END'
+lib_LTLIBRARIES = libfoo.la
+libfoo_la_SOURCES = foo.x_
+.x_.y:
+       rm -f $@ $@-t
+## The leading `:;' works around a bug in bash <= 3.2.
+       :; { echo '/* autogenerated */' \
+         && echo '%{' \
+         && echo 'int yylex () {return 0;}' \
+         && echo 'void yyerror (char *s) {}' \
+         && echo '%}' \
+         && echo '%%' \
+         && echo 'foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};' \
+         && echo '%%' \
+## Account for VPATH issues on weaker make implementations.
+         && cat `test -f '$<' || echo $(srcdir)/`$<; \
+       } > $@-t
+       mv -f $@-t $@
+.PHONY: test
+test:
+       echo $(libfoo_la_OBJECTS) | grep '^foo\.lo$$'
+END
+
+cat > foo.x_ << 'END'
+int foo (void) { return yyparse(); }
+END
+
+command_ok_ "libtoolize" libtoolize --force
+command_ok_ "aclocal"    $ACLOCAL
+command_ok_ "autoconf"   $AUTOCONF
+command_ok_ "automake"   $AUTOMAKE --add-missing
+command_ok_ "configure"  ./configure
+command_ok_ "make test"  $MAKE test
+
+directive=''; make_can_chain_suffix_rules || directive=TODO
+command_ok_ "make all" -D "$directive" -r "suffix rules not chained" \
+            $MAKE all
+
+:
diff --git a/tests/suffix11.tap b/tests/suffix11.tap
new file mode 100755 (executable)
index 0000000..e740f6c
--- /dev/null
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 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/>.
+
+# Tests that Automake understands multiple suffix rules on the same line.
+# PR/371 and PR/372: Reported by Duncan Gibson.
+# We also check for suffixes containing `-'.
+
+required=cc
+. ./defs || Exit 1
+
+plan_ 10
+
+cat >>configure.in <<EOF
+AC_PROG_CC
+AC_OUTPUT
+EOF
+
+cat >Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz
+foo_SOURCES = foo.x_
+bar_SOURCES = bar.y-z
+baz_SOURCES = baz1.x_ baz2.y-z
+
+.y-z.c .x_.c:
+## Account for VPATH issues on weaker make implementations (e.g. IRIX 6.5).
+       sed 's/INTEGER/int/g' `test -f '$<' || echo $(srcdir)/`$< >$@
+
+CLEANFILES = foo.c bar.c baz1.c baz2.c
+
+.PHONY: test-real test-fake
+test-fake:
+       echo $(foo_OBJECTS) | grep '^foo\.foo$$'
+       echo $(bar_OBJECTS) | grep '^bar\.foo$$'
+       echo $(baz_OBJECTS) | grep '^baz1\.foo baz2\.foo$$'
+test-real:
+       echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT)$$'
+       echo $(bar_OBJECTS) | grep '^bar\.$(OBJEXT)$$'
+       echo $(baz_OBJECTS) | grep '^baz1\.$(OBJEXT) baz2\.$(OBJEXT)$$'
+check-local: test-real
+END
+
+echo 'INTEGER main(void) { return 0; }' > foo.x_
+echo 'INTEGER main(void) { return 0; }' > bar.y-z
+echo 'INTEGER main(void) { INTEGER baz(void); return baz(); }' > baz1.x_
+echo 'INTEGER baz(void) { return 0; }' > baz2.y-z
+
+command_ok_ "aclocal" $ACLOCAL
+command_ok_ "autoconf" $AUTOCONF
+
+# What we do is not portable.  Automake should warn.
+AUTOMAKE_fails -a
+command_ok_ "warn about unportable make usage" \
+  grep '[iI]nference rules can have only one target before the colon' stderr
+# But this should work anyway.
+command_ok_ "automake" $AUTOMAKE -a -Wno-portability
+
+command_ok_ "configure"  ./configure
+command_ok_ "make test-fake" env OBJEXT=foo $MAKE -e test-fake
+command_ok_ "make test-real" $MAKE test-real
+
+directive=''; make_can_chain_suffix_rules || directive=TODO
+
+for target in '' distcheck; do
+  command_ok_ "make $target" \
+              -D "$directive" -r "suffix rules not chained" \
+              $MAKE $target
+done
+
+:
diff --git a/tests/suffix11.test b/tests/suffix11.test
deleted file mode 100755 (executable)
index 91d2cf4..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002, 2003, 2010 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/>.
-
-# Tests that Automake understands multiple suffix rules on the same line.
-# PR/371 and PR/372: Reported by Duncan Gibson.
-# We also check for suffixes containing `-'.
-
-. ./defs || Exit 1
-
-set -e
-
-cat >>configure.in <<EOF
-AC_PROG_CC
-AC_OUTPUT
-EOF
-
-cat >Makefile.am << 'END'
-bin_PROGRAMS = foo bar baz
-foo_SOURCES = foo.x_
-bar_SOURCES = bar.y-z
-baz_SOURCES = baz1.x_ baz2.y-z
-.y-z.c .x_.c:
-       cp $< $@
-  .z_.c   .w_.x_ :
-       cp $< $@
-
-.PHONY: print
-print:
-       @echo BEGIN: $(foo_OBJECTS) :END
-       @echo BEGIN: $(bar_OBJECTS) :END
-       @echo BEGIN: $(baz_OBJECTS) :END
-END
-
-$ACLOCAL
-$AUTOCONF
-
-# What we do is not portable.  Automake should warn.
-AUTOMAKE_fails -a
-grep '[iI]nference rules can have only one target before the colon' stderr
-
-# But this should work anyway.
-$AUTOMAKE -a -Wno-portability
-
-./configure
-
-OBJEXT=foo $MAKE -e print >stdout || { cat stdout; Exit 1; }
-cat stdout
-$FGREP 'BEGIN: foo.foo :END' stdout
-$FGREP 'BEGIN: bar.foo :END' stdout
-$FGREP 'BEGIN: baz1.foo baz2.foo :END' stdout
-
-:
index 21089a5..430a350 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2006, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 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
 # Tests that Automake understands suffix rules with subdir objects.
 # Reported by John Ratliff.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_PROG_CC
 AC_OUTPUT
@@ -29,16 +29,19 @@ EOF
 cat >Makefile.am << 'END'
 AUTOMAKE_OPTIONS = subdir-objects
 SUFFIXES = .baz .o
-# we fake here:
+# We fake here:
 .baz.o:
-       cp $< $@
+## Account for VPATH issues on weaker make implementations.
+       cp `test -f '$<' || echo $(srcdir)/`$< $@
 
 bin_PROGRAMS = foo
 foo_SOURCES = foo.c sub/bar.baz
 
-.PHONY: print
-print:
-       @echo BEGIN: $(foo_OBJECTS) :END
+.PHONY: test-fake test-real
+test-fake:
+       echo $(foo_OBJECTS) | grep '^foo\.quux sub/bar\.quux$$'
+test-real:
+       echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT) sub/bar\.$(OBJEXT)$$'
 END
 
 mkdir sub
@@ -48,9 +51,10 @@ mkdir sub
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
+
 ./configure
-OBJEXT=OBJ $MAKE -e print >stdout || { cat stdout; Exit 1; }
-cat stdout
-$FGREP 'BEGIN: foo.OBJ sub/bar.OBJ :END' stdout
+
+OBJEXT=quux $MAKE -e test-fake
+$MAKE test-real
 
 :
index 8120024..3eaf8d2 100755 (executable)
@@ -2,31 +2,26 @@
 # Copyright (C) 2002, 2003, 2006, 2009, 2010, 2011 Free Software
 # Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Tests that Automake understands suffix rules with renamed objects
 # and subdir objects.
 # Reported by Florian Briegel.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<EOF
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -38,7 +33,7 @@ AUTOMAKE_OPTIONS = subdir-objects
 SUFFIXES = .baz .c
 .baz.c:
        case $@ in sub/*) $(MKDIR_P) sub;; *) :;; esac
-## Account for VPATH issues on weaker make implementations (e.g. IRIX 6.5)
+## Account for VPATH issues on weaker make implementations (e.g. IRIX 6.5).
        cp `test -f '$<' || echo $(srcdir)/`$< $@
 
 DISTCLEANFILES = sub/bar.c
@@ -66,11 +61,11 @@ $MAKE
 $MAKE distcheck
 $MAKE distclean
 
-# Should also work without subdir-objects
+# Should also work without subdir-objects.
 
 sed '/subdir-objects/d' < Makefile.am > t
 mv -f t Makefile.am
-$AUTOMAKE --force
+$AUTOMAKE
 ./configure
 $MAKE
 $MAKE distcheck
index 405ce90..513d017 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure .c.o rule is only included once.
+# Make sure proper suffix rules for C compilation are produced,
+# and only once, even for libtool libraries.
+# See also related test `suffix.test'.
 required=libtoolize
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = no-dependencies
 lib_LTLIBRARIES = libltdl.la
 libltdl_la_SOURCES = ltdl.c ltdl.h
 END
@@ -41,8 +41,14 @@ END
 : > config.sub
 
 $ACLOCAL
+
 $AUTOMAKE -a
+grep '^ *\.c' Makefile.in # For debugging.
+test `grep -c '^\.c\.o:' Makefile.in` -eq 1
+test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
 
+$AUTOMAKE -i
+grep '^ *\.c' Makefile.in # For debugging.
 test `grep -c '^\.c\.o:' Makefile.in` -eq 1
 test `grep -c '^\.c\.obj:' Makefile.in` -eq 1
 
diff --git a/tests/suffix3.tap b/tests/suffix3.tap
new file mode 100755 (executable)
index 0000000..f1596ce
--- /dev/null
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Copyright (C) 1999, 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/>.
+
+# Test to make sure that suffix rules chain.
+
+required=c++
+. ./defs || Exit 1
+
+plan_ 10
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUFFIXES = .zoo
+.zoo.cc:
+       sed 's/INTEGER/int/g' `test -f '$<' || echo $(srcdir)/`$< >$@
+bin_PROGRAMS = foo
+foo_SOURCES = foo.zoo
+# This is required by "make distcheck".  The useless indirection is
+# reequired to avoid false positives by the grepping checks below.
+FOO = foo
+CLEANFILES = $(FOO).cc
+END
+
+command_ok_ "aclocal" $ACLOCAL
+command_ok_ "automake" $AUTOMAKE
+
+# The foo.cc intermediate step is implicit, it's a mistake if
+# Automake requires this file somewhere.  Also, Automake should
+# not require the file `foo.c' anywhere.
+command_ok_ "intermediate files not mentioned" \
+  not $FGREP foo.c Makefile.in
+# However Automake must figure that foo.zoo is eventually
+# transformed into foo.o, and use this latter file (to link foo).
+command_ok_ "final object file figured out" \
+  $FGREP 'foo.$(OBJEXT)' Makefile.in
+
+command_ok_ "autoconf" $AUTOCONF
+command_ok_ "configure" ./configure
+
+# This is deliberately valid C++, but invalid C.
+cat > foo.zoo <<'END'
+#include <iostream>
+using namespace std;
+INTEGER main (void)
+{
+  return 0;
+}
+END
+
+directive=''; make_can_chain_suffix_rules || directive=TODO
+
+for target in all distcheck; do
+  command_ok_ "make $target"  \
+              -D "$directive" -r "suffix rules not chained" \
+              $MAKE $target
+done
+
+# FIXME: should we check that intermediate file `foo.cc' has
+# been removed?  Or is this requiring too much from the make
+# implementation?
+
+# Intermediate files should not be distributed.
+command_ok_ "make distdir" $MAKE distdir
+command_ok_ "intermediate file not distributed" test ! -r $me-1.0/foo.cc
+
+:
diff --git a/tests/suffix3.test b/tests/suffix3.test
deleted file mode 100755 (executable)
index fc445bf..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2010 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/>.
-
-# Test to make sure that suffix rules chain.
-
-. ./defs || Exit 1
-
-set -e
-
-cat >> configure.in << 'END'
-AC_PROG_CXX
-END
-
-cat > Makefile.am << 'END'
-SUFFIXES = .zoo
-.zoo.cc:
-       convert-zoo whatever
-bin_PROGRAMS = foo
-foo_SOURCES = foo.zoo
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-# The foo.cc intermediate step is implicit, it's a mistake if
-# Automake requires this file somewhere.
-$FGREP foo.cc Makefile.in && Exit 1
-# However Automake must figure that foo.zoo is eventually
-# transformed into foo.o, and use this latter file (to link foo).
-$FGREP 'foo.$(OBJEXT)' Makefile.in
-
-:
index e952283..4eae8e1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 .k.o:
        echo $< > $@
@@ -34,6 +32,8 @@ END
 
 $ACLOCAL
 $AUTOMAKE
-grep '.SUFFIXES:.*\.k' Makefile.in
+grep '^\.SUFFIXES:' Makefile.in | sed -e 's/$/ /' > suffixes
+cat suffixes
+$FGREP ' .k ' suffixes
 
 :
index b3b36aa..fcde0b6 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # from user-defined implicit rules.
 # Based on a report from Arkadiusz Miskiewicz <misiek@pld.ORG.PL>.
 
-required=libtool
+required='cc libtool'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
+AC_SUBST([LINK], [:])
+AM_PROG_AR
 AC_PROG_LIBTOOL
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 .k.lo:
-       echo $< > $@
+## Account for VPATH issues on weaker make implementations.
+       (echo $< && cat `test -f '$<' || echo $(srcdir)/`$<) > $@
 
 noinst_LTLIBRARIES = libfoo.la
 libfoo_la_SOURCES = foo.k
+
+.PHONY: test
+test: all
+       grep '^=GREP=ME=$$' foo.lo
+## Weaker regex to account for VPATH issues.
+       grep 'foo\.k$$' foo.lo
+check-local: test
 END
 
 : > ltmain.sh
-: > config.guess
-: > config.sub
+
+for auxscript in ar-lib config.guess config.sub; do
+  cp "$am_scriptdir/$auxscript" . \
+    || fatal_ "fetching auxiliary script \`$auxscript'"
+done
 
 $ACLOCAL
 $AUTOMAKE
 grep '_OBJECTS.*foo\.lo' Makefile.in
 
+$AUTOCONF
+./configure
+
+echo '=GREP=ME=' > foo.k
+
+$MAKE test
+$MAKE distcheck
+
 :
index ab7cf64..c50b442 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure Automake supports implicit rules with dot-less
-# extensions.  Also make sure that `.o' is handled like `.$(OBJEXT)'.
+# extensions.  Also make sure that `.o' and `.obj' are handled like
+# `.$(OBJEXT)'.  See also related "semantic" tests suffix6b.test
+# and suffix6c.test.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
-SUFFIXES = a b .$(OBJEXT) c .o
+SUFFIXES = a b .$(OBJEXT) c .o .obj
 bin_PROGRAMS = foo
-foo_SOURCES = fooa fuc
+foo_SOURCES = fooa barc bazc
 ab:
-        cp $< $@
+       dummy action 1
 b.$(OBJEXT):
-       cp $< $@
+       dummy action 2
 c.o:
-       cp $< $@
+       dummy action C
+c.obj:
+       dummy action C
 END
 
 $ACLOCAL
 $AUTOMAKE
 
+sed -n -e '/foo_OBJECTS *=.*\\$/ {
+  :loop
+  p
+  n
+  t clear
+  :clear
+  s/\\$/\\/
+  t loop
+  p
+  n
+}' -e 's/$/ /' -e 's/^.*foo_OBJECTS *= */ /p' Makefile.in > foo-objects
+cat foo-objects
+
 # Automake must figure that fooa translates to foo.$(OBJEXT) and
 # foo.$(OBJEXT) using the following rules:
 #  fooa --[ab]--> foob --[b.$(OBJEXT)]--> foo.$(OBJEXT)
-grep '_OBJECTS.* foo\.\$(OBJEXT)' Makefile.in
-#  fuc --[c.o]--> fu.$(OBJEXT)  ## This is really meant !
-grep '_OBJECTS.* fu\.\$(OBJEXT)' Makefile.in
+$FGREP ' foo.$(OBJEXT) ' foo-objects
+#  barc --[c.o]--> bar.$(OBJEXT)    ## This is really meant!
+$FGREP ' bar.$(OBJEXT) ' foo-objects
+#  bazc --[c.obj]--> baz.$(OBJEXT)  ## This is really meant!
+$FGREP ' baz.$(OBJEXT) ' foo-objects
 
 :
diff --git a/tests/suffix6b.test b/tests/suffix6b.test
new file mode 100755 (executable)
index 0000000..b4da6bb
--- /dev/null
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test to make sure Automake supports implicit rules with dot-less
+# extensions.  Se also related "grepping" test suffix6.test.
+
+required=GNUmake # Other makes might not grok dot-less suffix rules.
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+# $(LINK) is not defined automatically by Automake, since the *_SOURCES
+# variables don't contain any known extension (.c, .cc, .f, ...).
+# So we need this hack -- but since such an hack can also serve as a
+# mild stress test, that's ok.
+AC_SUBST([LINK], ['cat >$@'])
+AC_SUBST([OBJEXT], [oOo])
+AC_SUBST([EXEEXT], [.XxX])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUFFIXES = a b c .$(OBJEXT)
+bin_PROGRAMS = foo
+foo_SOURCES = fooa
+ab:
+       { echo '=ab=' && cat $<; } >$@
+bc:
+       { echo '=bc=' && cat $<; } >$@
+c.$(OBJEXT):
+       { echo '=b.obj=' && cat $<; } >$@
+test:
+       : For debugging.
+       ls -l
+       : Implicit intermediate files should be removed by GNU make ...
+       test ! -r foob
+       test ! -r fooc
+       : ... but object files should not.
+       cat foo.$(OBJEXT)
+       : For debugging.
+       cat foo.XxX
+       : Now check that the chain of implicit rules has been executed
+       : completely and in the correct order.
+       (echo =b.obj= && echo =bc= && echo =ab= && echo =src=) > exp
+       diff exp foo.XxX
+       rm -f exp
+.PHONY: test
+check-local: test
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+echo =src= > fooa
+
+$MAKE
+$MAKE test
+$MAKE distcheck
+
+:
diff --git a/tests/suffix6c.test b/tests/suffix6c.test
new file mode 100755 (executable)
index 0000000..7d1d7b5
--- /dev/null
@@ -0,0 +1,92 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test to make sure that `.o' and `.obj' are handled like `.$(OBJEXT)'.
+# See also related "grepping" test suffix6.test.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+# $(LINK) is not defined automatically by Automake, since the *_SOURCES
+# variables don't contain any known extension (.c, .cc, .f ...),
+# So we need this hack -- but since such an hack can also serve as a
+# mild stress test, that's ok.
+OBJEXT=${OBJEXT-oOo}
+AC_SUBST([LINK], ['cat >$@'])
+AC_SUBST([EXEEXT], [.XxX])
+AC_SUBST([OBJEXT])
+AC_OUTPUT
+END
+
+unset OBJEXT || :
+
+cat > Makefile.am << 'END'
+SUFFIXES = .zoo .o .obj .@OBJEXT@
+
+bin_PROGRAMS = foo
+foo_SOURCES = foo.zoo
+
+.zoo.o:
+       { echo '=.zoo.o=' && cat $<; } >$@
+.zoo.obj:
+       { echo '=.zoo.obj=' && cat $<; } >$@
+.zoo.@OBJEXT@:
+       { echo '=.zoo.@OBJEXT@=' && cat $<; } >$@
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+cat > foo.exp <<'END'
+=.zoo.oOo=
+%ONE%
+END
+echo %ONE% > foo.zoo
+$MAKE
+cat foo.oOo
+cat foo.XxX
+diff foo.XxX foo.exp
+
+rm -f foo.* exp
+
+cat > foo.exp <<'END'
+=.zoo.o=
+%TWO%
+END
+echo %TWO% > foo.zoo
+OBJEXT=o $MAKE -e
+cat foo.o
+cat foo.XxX
+diff foo.XxX foo.exp
+
+rm -f foo.* exp
+
+cat > foo.exp <<'END'
+=.zoo.obj=
+%THREE%
+END
+echo %THREE% > foo.zoo
+OBJEXT=obj $MAKE -e
+cat foo.obj
+cat foo.XxX
+diff foo.XxX foo.exp
+
+rm -f foo.* exp
+
+:
index eb67195..8d291bb 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 SUFFIXES = .idl S.cpp C.h
 SUFFIXES += C.cpp S.h
diff --git a/tests/suffix8.tap b/tests/suffix8.tap
new file mode 100755 (executable)
index 0000000..3e37ecc
--- /dev/null
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 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/>.
+
+# Test to make sure Automake supports multiple derivations for the
+# same suffix.
+# From PR/37.
+
+required='cc libtoolize'
+. ./defs || Exit 1
+
+plan_ 10
+
+cat >>configure.in <<'END'
+AM_PROG_AR
+AM_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat >Makefile.am << 'END'
+# $(LINK) is not defined automatically by Automake, since the *_SOURCES
+# variables don't contain any known extension (.c, .cc, .f ...),
+# So we need this hack.
+LINK = :
+
+bin_PROGRAMS = foo
+lib_LTLIBRARIES = libfoo.la
+
+foo_SOURCES = foo.x_
+libfoo_la_SOURCES = bar.x_
+
+# The elaborate cp commands below account for VPATH issues on
+# weaker make implementations (e.g. IRIX 6.5).
+.x_.y_:
+       cp `test -f '$<' || echo $(srcdir)/`$< $@
+.y_.o:
+       cp `test -f '$<' || echo $(srcdir)/`$< $@
+.y_.obj:
+       cp `test -f '$<' || echo $(srcdir)/`$< $@
+.y_.z_:
+       cp `test -f '$<' || echo $(srcdir)/`$< $@
+.z_.lo:
+       cp `test -f '$<' || echo $(srcdir)/`$< $@
+
+# Some make implementations don't remove intermediate files
+# automatically, thus causing "make distcheck" to fail if
+# this is not added.
+MOSTLYCLEANFILES = *.y_ *.z_
+
+.PHONY: test0 test1 test2
+test0:
+       echo $(foo_OBJECTS) | grep '^foo\.foo$$'
+       echo $(libfoo_la_OBJECTS) | grep '^bar\.lo$$'
+test1:
+       echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT)$$'
+       echo $(libfoo_la_OBJECTS) | grep '^bar\.lo$$'
+test2: $(foo_OBJECTS) $(libfoo_la_OBJECTS)
+       test -f foo.$(OBJEXT)
+       test -f bar.lo
+check-local: test1 test2
+END
+
+echo 'int main (void) { return 0; }' > foo.x_
+echo 'int bar (void) { return 0; }' > bar.x_
+
+command_ok_ "libtoolize" libtoolize
+command_ok_ "aclocal"    $ACLOCAL
+command_ok_ "autoconf"   $AUTOCONF
+command_ok_ "automake"   $AUTOMAKE -a
+command_ok_ "configure"  ./configure
+command_ok_ "make test0" env OBJEXT=foo $MAKE -e test0
+command_ok_ "make test1" $MAKE test1
+
+directive=''; make_can_chain_suffix_rules || directive=TODO
+
+for target in test2 all distcheck; do
+  command_ok_ "make $target"  \
+              -D "$directive" -r "suffix rules not chained" \
+              $MAKE $target
+done
+
+:
diff --git a/tests/suffix8.test b/tests/suffix8.test
deleted file mode 100755 (executable)
index 4279ad6..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2002, 2003, 2010, 2012 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/>.
-
-# Test to make sure Automake supports multiple derivations for the same suffix.
-# PR/37
-
-required='gcc libtoolize'
-. ./defs || Exit 1
-
-set -e
-
-cat >>configure.in <<'END'
-AM_PROG_LIBTOOL
-AC_OUTPUT
-END
-
-cat >Makefile.am << 'END'
-bin_PROGRAMS = foo
-lib_LTLIBRARIES = libfoo.la
-
-foo_SOURCES = foo.x_
-libfoo_la_SOURCES = bar.x_
-
-.x_.y_:
-       cp $< $@
-
-.y_.o:
-       cp $< $@
-
-.y_.obj:
-       cp $< $@
-
-.y_.z_:
-       cp $< $@
-
-.z_.lo:
-       cp $< $@
-
-# Add explicit dependencies to help make implementations that
-# don't otherwise chain implicit rules (e.g., Sun make).
-foo.$(OBJEXT): foo.y_
-bar.lo: bar.z_
-bar.z_: bar.y_
-
-print:
-       @echo BEGIN: $(foo_OBJECTS) :END
-       @echo BEGIN: $(libfoo_la_OBJECTS) :END
-
-test: $(foo_OBJECTS) $(libfoo_la_OBJECTS)
-       test -f foo.$(OBJEXT)
-       test -f bar.lo
-END
-
-echo 'int main() { return 0; }' > foo.x_
-cp foo.x_ bar.x_
-
-libtoolize
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-./configure
-
-OBJEXT=foo $MAKE -e print >stdout || { cat stdout; Exit 1; }
-cat stdout
-$FGREP 'BEGIN: foo.foo :END' stdout
-$FGREP 'BEGIN: bar.lo :END' stdout
-
-$MAKE test
-
-:
index 815ec56..8cd973b 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in << 'END'
 AC_PROG_CC
 END
index a9b12c5..790c566 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1999, 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1999, 2001, 2002, 2003, 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure we get an error if symlink creation fails.
-# Reported by Joerg-Martin Schwarz
+# Reported by Joerg-Martin Schwarz.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-set -e
-
-rm -f install-sh
-rm -f mkinstalldirs
-
 : > Makefile.am
 
 cat > configure.in << 'END'
 AC_INIT([symlink], [1.0])
-AC_CONFIG_AUX_DIR(sub)
+AC_CONFIG_AUX_DIR([subdir])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 END
 
 $ACLOCAL
 AUTOMAKE_fails --add-missing
-grep 'error while making link' stderr
+
+grep '^configure\.in:3: .*missing.*error while making link' stderr
+grep '^configure\.in:3: .*install-sh.*error while making link' stderr
+
+test `$FGREP -c 'error while making link' stderr` -eq 2
+
+:
index 97a3d26..413c60c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2000, 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
 
 . ./defs || Exit 1
 
-set -e
-
 rm -f install-sh
-ln -s Zardoz install-sh || {
-  echo "$me: cannot create broken symlinks" >&2
-  Exit 77
-}
+ln -s Zardoz install-sh || skip_ "cannot create broken symlinks"
 
 : > Makefile.am
 
index 505486f..4957b8e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 foo = q \
 
-lib_LTLIBRARIES = foo.la
+bin_SCRIPTS = foo.sh
 END
 
 $ACLOCAL
-AUTOMAKE_fails
-grep 'Makefile.am:2:.*blank line' stderr
+AUTOMAKE_fails -Wnone
+grep '^Makefile\.am:2:.*blank line following trailing backslash' stderr
+
+:
index 1eaf569..8d974db 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 noinst_HEADERS = iguana.h
 END
diff --git a/tests/tags2.test b/tests/tags2.test
new file mode 100755 (executable)
index 0000000..60e6f46
--- /dev/null
@@ -0,0 +1,42 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAGS_DEPENDENCIES only make sense if other tag-worthy things (such as
+# sources) exist.
+
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat >Makefile.am << 'END'
+TAGS_DEPENDENCIES = foo
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+grep 'define.*TAGS_DEPENDENCIES.*without' stderr
+
+cat >>Makefile.am << 'END'
+bin_PROGRAMS = bar
+END
+
+AUTOMAKE_run
+grep 'define.*TAGS_DEPENDENCIES.*without' stderr && Exit 1
+
+:
index bcf752d..7d449ea 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003
-#   Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 2000, 2001, 2002, 2003, 2011, 2012 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure tags and subdirs work correctly.  Bug report by
-# François Pinard, and later by Akim Demaille.
+# François Pinard, and later by Akim Demaille.
 
 required=etags
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
diff --git a/tests/tap-ambiguous-directive.test b/tests/tap-ambiguous-directive.test
new file mode 100755 (executable)
index 0000000..203fb8a
--- /dev/null
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - handling of "ambiguous" TODO and SKIP directives
+# See also related test 'tap-todo-skip-together.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+1..6
+ok 1 # foo SKIP
+not ok 2 # bar TODO
+ok 3 # :SKIP
+not ok 4 # :TODO
+ok 5 # SKIP SKIP
+not ok 6 # TODO TODO
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=6 pass=2 fail=2 xpass=0 xfail=1 skip=1 error=0
+
+cat > exp << 'END'
+PASS: all.test 1 # foo SKIP
+FAIL: all.test 2 # bar TODO
+PASS: all.test 3 # :SKIP
+FAIL: all.test 4 # :TODO
+SKIP: all.test 5 # SKIP SKIP
+XFAIL: all.test 6 # TODO TODO
+END
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-autonumber.test b/tests/tap-autonumber.test
new file mode 100755 (executable)
index 0000000..c0b6d5d
--- /dev/null
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - unnumbered tests are OK, as long as their final total number
+#    agrees with the plan
+#  - test results without number get automatically numbered in the
+#    console progress output
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+1..14
+ok
+ok foo
+ok - foo2
+not ok
+not ok bar
+not ok - bar2
+; See that we can intermingle different kind of results without
+; messing up the autonumbering
+ok
+ok # TODO
+not ok # TODO who cares?
+ok
+not ok
+ok muuu # SKIP
+not ok
+ok
+END
+
+TESTS=all.test $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=14 pass=6 fail=5 xpass=1 xfail=1 skip=1 error=0
+
+cat > exp <<'END'
+PASS: all.test 1
+PASS: all.test 2 foo
+PASS: all.test 3 - foo2
+FAIL: all.test 4
+FAIL: all.test 5 bar
+FAIL: all.test 6 - bar2
+PASS: all.test 7
+XPASS: all.test 8 # TODO
+XFAIL: all.test 9 # TODO who cares?
+PASS: all.test 10
+FAIL: all.test 11
+SKIP: all.test 12 muuu # SKIP
+FAIL: all.test 13
+PASS: all.test 14
+END
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-bad-prog.tap b/tests/tap-bad-prog.tap
new file mode 100755 (executable)
index 0000000..b02e51a
--- /dev/null
@@ -0,0 +1,113 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# TAP support:
+#  - missing, unreadable, or not-executable test scripts cause proper
+#    error reports
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+plan_ 6
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
+TESTS = none.test noread.test noexec.test
+none.test:
+END
+
+cat > noexec.test <<'END'
+#!/bin/sh
+echo 1..1
+echo ok 1
+END
+
+cp noexec.test noread.test
+chmod a-r noread.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+if $MAKE check >stdout; then
+  r='not ok'
+else
+  r='ok'
+fi
+cat stdout
+result_ "$r" '"make check" returns non-zero exit status'
+
+# FIXME: maybe grep for stricter error messages in the next checks?
+
+command_ok_ "non-existent test is reported" \
+            grep '^ERROR: none\.test' stdout
+
+desc="non-executable test is reported"
+# Redirect output to avoid confusing automake's testsuite own TAP driver.
+if ./noexec.test >/dev/null; then
+  skip_ -r "any file is executable" "$desc"
+else
+  command_ok_ "$desc" -- grep '^ERROR: noexec\.test' stdout
+fi
+
+desc="non-readable test is reported"
+if test -r noread.test; then
+  skip_ -r "any file is readable" "$desc"
+else
+  command_ok_ "$desc" -- grep '^ERROR: noread\.test' stdout
+fi
+
+# Check that no spurious test result is reported.  This is lower-priority
+# (and in fact the check currently fails for our awk-based driver).
+directive=
+if test $am_tap_implementation = shell; then
+  directive=TODO
+else
+  # Older versions of IPC::Open3 (e.g., version 1.05 on perl 5.12.4 or
+  # version 1.0103 on perl 5.6.2) fail to properly trap errors in exec(2)
+  # calls in the child process; hence, the TAP driver cannot be properly
+  # informed of such error.
+  if $PERL -w -e '
+    use IPC::Open3 qw/open3/;
+    $@ = "";
+    eval { open3(*STDIN, *STDOUT, *STDERR, "am--no-such-command") };
+    $@ =~ m/\bopen3:.*am--no-such-command/
+      or die "Bad \$@ value: \"$@\"\n";
+  '; then
+    : # OK. IPC::Open3 should be good enough.
+  else
+    for s in '"missing plan" message' 'results'; do
+      skip_ -r "IPC::Open3 not good enough" "no spurious $s"
+    done
+    Exit 0
+  fi
+fi
+
+command_ok_ 'no spurious "missing plan" message' \
+    -D "$directive" -- not grep 'missing.* plan' stdout
+command_ok_ 'no spurious results' \
+  -D "$directive" -r 'still get "missing plan"' \
+  count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=3
+
+:
diff --git a/tests/tap-bailout-and-logging.test b/tests/tap-bailout-and-logging.test
new file mode 100755 (executable)
index 0000000..65e2934
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - even after a "Bail out!" directive, all input is still copied in
+#    the log file
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+First line
+Bail out!
+non-TAP line after bailout
+# TAP diagnostic after bailout
+1..0 # SKIP TAP plan after bailout
+ok 1 - TAP result after bailout
+END
+
+$MAKE check && { cat all.log; Exit 1; }
+cat all.log
+
+for rx in \
+  'First line' \
+  'Bail out!' \
+  'non-TAP line after bailout' \
+  '# TAP diagnostic after bailout' \
+  '1\.\.0 # SKIP TAP plan after bailout' \
+  'ok 1 - TAP result after bailout' \
+; do
+  grep "^$rx$" all.log
+done
+
+:
diff --git a/tests/tap-bailout-leading-space.test b/tests/tap-bailout-leading-space.test
new file mode 100755 (executable)
index 0000000..1615c09
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Older versions of prove and TAP::Harness (e.g., 3.17) didn't recognize
+# a "Bail out!" directive that was preceded by whitespace, but more modern
+# versions (e.g., 3.23) do.  So we leave this behaviour undefined for the
+# perl implementation of the Automake TAP driver, but expect the latter,
+# "more modern" behaviour in our awk TAP driver.
+
+am_parallel_tests=yes
+am_tap_implementation=shell
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > a.test <<END
+1..1
+ok 1
+ Bail out!
+END
+
+cat > b.test <<END
+1..1
+ok 1 # SKIP
+${tab}Bail out!
+END
+
+cat > c.test <<END
+1..1
+  ${tab}  ${tab}${tab}Bail out!   FUBAR! $tab
+END
+
+cat >> exp <<END
+PASS: a.test 1
+ERROR: a.test - Bail out!
+SKIP: b.test 1
+ERROR: b.test - Bail out!
+ERROR: c.test - Bail out! FUBAR!
+END
+
+TESTS='a.test b.test c.test' $MAKE -e check >stdout \
+  && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=5 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=3
+
+LC_ALL=C sort exp > t
+mv -f t exp
+
+# We need the sort below to account for parallel make usage.
+grep ': [abcde]\.test' stdout \
+  | sed "s/[ $tab]*#[ $tab]*SKIP.*//" \
+  | LC_ALL=C sort > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-bailout-suppress-badexit.test b/tests/tap-bailout-suppress-badexit.test
new file mode 100755 (executable)
index 0000000..080557e
--- /dev/null
@@ -0,0 +1,65 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Basic TAP test protocol support:
+#  - A "Bail out!" directive causes the driver to ignore the exit
+#    status of the test script.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+tests='exit.test exit127.test sighup.test sigterm.test'
+
+cat > Makefile.am <<END
+TESTS = $tests
+END
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > exit.test << 'END'
+#!/bin/sh
+echo 'Bail out!'
+exit 1
+END
+
+cat > exit127.test << 'END'
+#!/bin/sh
+echo 'Bail out!'
+exit 127
+END
+
+cat > sighup.test << 'END'
+#!/bin/sh
+echo 'Bail out!'
+kill -1 $$
+END
+
+cat > sigterm.test << 'END'
+#!/bin/sh
+echo 'Bail out!'
+kill -15 $$
+END
+
+chmod a+x $tests
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=4 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=4
+for tst in $tests; do grep "^ERROR: $tst - Bail out!" stdout; done
+$EGREP "ERROR: .*(exit.*status|terminat.*signal)" stdout && Exit 1
+
+:
diff --git a/tests/tap-bailout-suppress-later-diagnostic.test b/tests/tap-bailout-suppress-later-diagnostic.test
new file mode 100755 (executable)
index 0000000..5389fed
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - A "Bail out!" directive causes the driver to ignore any TAP
+#    diagnostic message in the rest of the following TAP stream.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+echo AM_TEST_LOG_DRIVER_FLAGS = --comments >> Makefile
+
+cat > all.test <<END
+1..1
+# sanity check
+ok 1
+Bail out!
+# not seen
+END
+
+# Doing the sums above, we have:
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1
+grep '# all.test: sanity check' stdout
+grep 'not seen' stdout && Exit 1
+
+:
diff --git a/tests/tap-bailout-suppress-later-errors.test b/tests/tap-bailout-suppress-later-errors.test
new file mode 100755 (executable)
index 0000000..c636289
--- /dev/null
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - A "Bail out!" directive causes the driver to ignore any TAP
+#    result or error in the rest of the following TAP stream.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+# Various errors that can all be squashed into a single test script.
+cat > foo.test << 'END'
+1..5
+Bail out!
+# All possible test results.
+# Test out-of-order.
+ok 4
+# Extra TAP plan.
+1..2
+# Another bailout directive.
+Bail out! Not seen.
+# Stop now, with too few tests run.
+END
+
+# Tests run after a "SKIP" plan.
+cat > bar.test << 'END'
+1..0 # SKIP
+Bail out!
+ok 1
+END
+
+# Too many tests run.
+cat > baz.test << 'END'
+1..1
+ok 1
+Bail out!
+ok 2
+ok 3
+END
+
+TESTS='foo.test bar.test baz.test' $MAKE -e check >stdout \
+  && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=5 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=3
+
+grep '^ERROR: foo\.test - Bail out!$' stdout
+grep '^ERROR: bar\.test - Bail out!$' stdout
+grep '^SKIP: bar\.test'               stdout
+grep '^ERROR: baz\.test - Bail out!$' stdout
+grep '^PASS: baz\.test 1$'            stdout
+
+$FGREP 'Not seen' stdout && Exit 1
+
+test `$FGREP -c ': foo.test' stdout` -eq 1
+test `$FGREP -c ': bar.test' stdout` -eq 2
+test `$FGREP -c ': baz.test' stdout` -eq 2
+
+:
diff --git a/tests/tap-bailout.test b/tests/tap-bailout.test
new file mode 100755 (executable)
index 0000000..d5b6330
--- /dev/null
@@ -0,0 +1,138 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Basic TAP test protocol support:
+#  - "Bail out!" magic
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+: > exp
+
+#------------------------------------------------------------------
+
+# Bailout without explanation.
+
+cat > a.test <<END
+1..4
+ok 1
+not ok 2
+Bail out!
+not ok 3
+ok 4 # SKIP
+END
+
+cat >> exp <<END
+PASS: a.test 1
+FAIL: a.test 2
+ERROR: a.test - Bail out!
+END
+
+# pass += 1, fail +=1, error += 1
+
+#------------------------------------------------------------------
+
+# Bailout with explanation.
+
+cat > b.test <<END
+1..7
+ok 1 # SKIP
+ok 2 # TODO
+not ok 3 # TODO
+Bail out! We're out of disk space.
+ok 4
+not ok 5
+not ok 6 # TODO
+ok 7 # TODO
+END
+
+cat >> exp <<END
+SKIP: b.test 1 # SKIP
+XPASS: b.test 2 # TODO
+XFAIL: b.test 3 # TODO
+ERROR: b.test - Bail out! We're out of disk space.
+END
+
+# skip += 1, xpass += 1, xfail += 1, error += 1
+
+#------------------------------------------------------------------
+
+# Bail out before the test plan.
+
+cat > c.test <<END
+ok 1
+ok 2
+Bail out! BOOOH!
+1..2
+END
+
+cat >> exp <<END
+PASS: c.test 1
+PASS: c.test 2
+ERROR: c.test - Bail out! BOOOH!
+END
+
+# pass += 2, error += 1
+
+#------------------------------------------------------------------
+
+# Bailout on the first line.
+
+cat > d.test <<END
+Bail out! mktemp -d: Permission denied
+ok 1
+END
+
+echo 'ERROR: d.test - Bail out! mktemp -d: Permission denied' >> exp
+
+# error += 1
+
+#------------------------------------------------------------------
+
+# TAP input comprised only of a bailout directive.
+
+cat > e.test <<END
+Bail out!
+END
+
+echo "ERROR: e.test - Bail out!" >> exp
+
+# error += 1
+
+#------------------------------------------------------------------
+
+# Doing the sums above, we have:
+test_counts='total=12 pass=3 fail=1 xpass=1 xfail=1 skip=1 error=5'
+
+TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \
+  && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results $test_counts
+
+LC_ALL=C sort exp > t
+mv -f t exp
+
+# We need the sort below to account for parallel make usage.
+grep ': [abcde]\.test' stdout | LC_ALL=C sort > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-basic.test b/tests/tap-basic.test
new file mode 100755 (executable)
index 0000000..8e39161
--- /dev/null
@@ -0,0 +1,175 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Basic TAP support:
+#  - LOG_COMPILER support;
+#  - basic support for TODO and SKIP directives, and "Bail out!" magic;
+#  - testsuite progress output on console;
+#  - runtime overriding of TESTS and TEST_LOGS;
+#  - correct counts of test results (both in summary and in progress
+#    output on console).
+# Note that some of the features checked here are checked in other
+# test cases too, usually in a more thorough and detailed way.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
+## Defining LOG_COMPILER should work and not intefere with the
+## tap-driver script.
+TEST_LOG_COMPILER = cat
+TESTS = success.test
+
+ok.test:
+       echo '1..3' > $@-t
+       echo 'ok 1' >> $@-t
+       echo 'not ok 2 # TODO' >>$@-t
+       echo 'ok 3 # SKIP' >>$@-t
+       cat $@-t ;: For debugging.
+       mv -f $@-t $@
+END
+
+cat > success.test << 'END'
+1..20
+ok 1
+ok 2 two
+ok 3 - three
+ok 4 four four
+not ok 5
+not ok 6 six
+not ok 7 - seven
+not ok 8 eight eight
+ok 9 # TODO
+ok 10 ten # TODO
+ok 11 - eleven # TODO
+ok 12 twelve twelve # TODO
+not ok 13 # TODO
+not ok 14 fourteen # TODO
+not ok 15 - fifteen # TODO
+not ok 16 sixteen sixteen # TODO
+ok 17 # SKIP
+ok 18 eighteen # SKIP
+ok 19 - nineteen # SKIP
+ok 20 twenty twenty # SKIP
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+# Basilar usage and testsuite progress output.
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=20 pass=4 fail=4 xpass=4 xfail=4 skip=4 error=0
+
+test -f success.log
+test -f test-suite.log
+
+cat > exp << 'END'
+PASS: success.test 1
+PASS: success.test 2 two
+PASS: success.test 3 - three
+PASS: success.test 4 four four
+FAIL: success.test 5
+FAIL: success.test 6 six
+FAIL: success.test 7 - seven
+FAIL: success.test 8 eight eight
+XPASS: success.test 9 # TODO
+XPASS: success.test 10 ten # TODO
+XPASS: success.test 11 - eleven # TODO
+XPASS: success.test 12 twelve twelve # TODO
+XFAIL: success.test 13 # TODO
+XFAIL: success.test 14 fourteen # TODO
+XFAIL: success.test 15 - fifteen # TODO
+XFAIL: success.test 16 sixteen sixteen # TODO
+SKIP: success.test 17 # SKIP
+SKIP: success.test 18 eighteen # SKIP
+SKIP: success.test 19 - nineteen # SKIP
+SKIP: success.test 20 twenty twenty # SKIP
+END
+
+$FGREP ': success.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+# Override TESTS from the command line.
+
+rm -f *.log *.test
+
+cat > bail.test <<'END'
+1..1
+Bail out!
+ok 1
+END
+
+TESTS=bail.test $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
+
+test ! -f success.log
+test -f bail.log
+test -f test-suite.log
+
+grep '^ERROR: bail\.test - Bail out!' stdout
+grep '^PASS:' stdout && Exit 1
+test `$FGREP -c ': bail.test' stdout` -eq 1
+$FGREP 'success.test' stdout && Exit 1
+
+# Override TEST_LOGS from the command line, making it point to a test
+# (ok.test) that has to be generated at make time.
+
+rm -f *.log *.test
+
+TEST_LOGS=ok.log $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0
+
+test -f ok.test
+test -f ok.log
+test ! -f success.log
+test ! -f bail.log
+test -f test-suite.log
+
+$EGREP '(bail|success)\.test' stdout && Exit 1
+
+cat > exp << 'END'
+PASS: ok.test 1
+XFAIL: ok.test 2 # TODO
+SKIP: ok.test 3 # SKIP
+END
+
+$FGREP ': ok.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-color.test b/tests/tap-color.test
new file mode 100755 (executable)
index 0000000..5884a2b
--- /dev/null
@@ -0,0 +1,173 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - colorization of TAP results and diagnostic messages
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+TERM=ansi; export TERM
+
+esc='\e'
+# Escape `[' for grep, below.
+red="$esc\[0;31m"
+grn="$esc\[0;32m"
+lgn="$esc\[1;32m"
+blu="$esc\[1;34m"
+mgn="$esc\[0;35m"
+std="$esc\[m"
+
+# Check that grep can parse nonprinting characters.
+# BSD 'grep' works from a pipe, but not a seekable file.
+# GNU or BSD 'grep -a' works on files, but is not portable.
+case `echo "$std" | grep .` in
+  "$std") ;;
+  *) echo "$me: grep can't parse nonprinting characters" >&2; Exit 77;;
+esac
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = color-tests
+AM_TEST_LOG_DRIVER_FLAGS = --comments
+TEST_LOG_COMPILER = cat
+TESTS = all.test skip.test bail.test badplan.test noplan.test \
+        few.test many.test order.test afterlate.test
+END
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test << 'END'
+1..5
+ok 1 - foo
+# Hi! I shouldn't be colorized!
+not ok 2 - bar # TODO td
+ok 3 - baz # SKIP sk
+not ok 4 - quux
+ok 5 - zardoz # TODO
+END
+
+cat > skip.test << 'END'
+1..0 # SKIP whole script
+END
+
+cat > bail.test << 'END'
+1..1
+ok 1
+Bail out!
+END
+
+cat > badplan.test << 'END'
+1..2
+ok 1
+1..2
+ok 2
+END
+
+cat > noplan.test << 'END'
+ok 1
+END
+
+cat > few.test << 'END'
+1..2
+ok 1
+END
+
+cat > many.test << 'END'
+1..1
+ok 1
+ok 2
+END
+
+cat > order.test << 'END'
+1..1
+ok 5
+END
+
+cat > afterlate.test << 'END'
+ok 1
+1..2
+ok 2
+END
+
+AM_COLOR_TESTS=always $MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+test_color ()
+{
+  # Not a useless use of cat; see above comments about grep.
+  cat stdout | grep "^${grn}PASS${std}: all\.test 1 - foo$"
+  cat stdout | grep "^${lgn}XFAIL${std}: all\.test 2 - bar # TODO td$"
+  cat stdout | grep "^${blu}SKIP${std}: all\.test 3 - baz # SKIP sk$"
+  cat stdout | grep "^${red}FAIL${std}: all\.test 4 - quux$"
+  cat stdout | grep "^${red}XPASS${std}: all\.test 5 - zardoz # TODO$"
+  cat stdout | grep "^${blu}SKIP${std}: skip\.test - whole script$"
+  cat stdout | grep "^${grn}PASS${std}: bail\.test 1$"
+  cat stdout | grep "^${mgn}ERROR${std}: bail\.test - Bail out!$"
+  cat stdout | grep "^${mgn}ERROR${std}: badplan\.test - multiple test plans$"
+  cat stdout | grep "^${mgn}ERROR${std}: noplan\.test - missing test plan$"
+  cat stdout | grep "^${mgn}ERROR${std}: few.test - too few tests run (expected 2, got 1)$"
+  cat stdout | grep "^${mgn}ERROR${std}: many.test - too many tests run (expected 1, got 2)$"
+  cat stdout | grep "^${mgn}ERROR${std}: many.test 2 # UNPLANNED$"
+  cat stdout | grep "^${mgn}ERROR${std}: order.test 5 # OUT-OF-ORDER (expecting 1)$"
+  cat stdout | grep "^${mgn}ERROR${std}: afterlate\.test 2 # AFTER LATE PLAN$"
+  # Diagnostic messages shouldn't be colorized.
+  cat stdout | grep "^# all\.test: Hi! I shouldn't be colorized!$"
+  :
+}
+
+test_no_color ()
+{
+  # With make implementations that, like Solaris make, in case of errors
+  # print the whole failing recipe on standard output, we should content
+  # ourselves with a laxer check, to avoid false positives.
+  # Keep this in sync with lib/am/check.am:$(am__color_tests).
+  if $FGREP '= Xalways || test -t 1 ' stdout; then
+    # Extra verbose make, resort to laxer checks.
+    # But we also want to check that the testsuite summary is not unduly
+    # colorized.
+    (
+      set +e # In case some grepped regex below isn't matched.
+      # Not a useless use of cat; see above comments about grep.
+      cat stdout | grep "TOTAL.*:"
+      cat stdout | grep "PASS.*:"
+      cat stdout | grep "FAIL.*:"
+      cat stdout | grep "SKIP.*:"
+      cat stdout | grep "XFAIL.*:"
+      cat stdout | grep "XPASS.*:"
+      cat stdout | grep "ERROR.*:"
+      cat stdout | grep "^#"
+      cat stdout | grep 'test.*expected'
+      cat stdout | grep 'test.*not run'
+      cat stdout | grep '===='
+      cat stdout | grep '[Ss]ee .*test-suite\.log'
+      cat stdout | grep '[Tt]estsuite summary'
+    ) | grep "$esc" && Exit 1
+    : For shells with broken 'set -e'
+  else
+    cat stdout | grep "$esc" && Exit 1
+    : For shells with broken 'set -e'
+  fi
+}
+
+AM_COLOR_TESTS=always $MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+test_color
+
+$MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+test_no_color
+
+:
similarity index 71%
rename from tests/lzip.test
rename to tests/tap-common-setup.test
index ab62990..2bcd9e6 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 support for no-dist-gzip with lzip.
+# Auxiliary test to set up common data used by many tests on TAP support.
 
-required=lzip
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << 'END'
-AC_INIT([lzip], [1.0])
-AM_INIT_AUTOMAKE([no-dist-gzip dist-lzip])
-AC_CONFIG_FILES([Makefile])
+cat >> configure.in << END
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-test: distcheck
-       test $(DIST_ARCHIVES) = lzip-1.0.tar.lz
-       test -f $(DIST_ARCHIVES)
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
+TEST_LOG_COMPILER = cat
+TESTS = all.test
 END
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
+
 ./configure
-$MAKE test
+
+rm -rf autom4te*.cache
+
+# So that the data files we've created won't be removed at exit.
+keep_testdirs=yes
 
 :
diff --git a/tests/tap-deps.test b/tests/tap-deps.test
new file mode 100755 (executable)
index 0000000..dde1208
--- /dev/null
@@ -0,0 +1,87 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Basic TAP test protocol support:
+#  - dependencies between test scripts
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+# The tests are *deliberately* listed in inversed order here.
+TESTS = c.test b.test a.test
+b.log: a.log
+c.log: b.log
+END
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > a.test << 'END'
+#!/bin/sh
+echo 1..2
+echo ok 1
+# Creative quoting below to please maintainer-check.
+sleep '3'
+echo ok 2
+: > a.run
+END
+
+cat > b.test << 'END'
+#!/bin/sh
+echo 1..2
+if test -f a.run; then
+  echo ok 1
+else
+  echo not ok 1
+fi
+# Creative quoting below to please maintainer-check.
+sleep '3'
+echo ok 2
+: > b.run
+END
+
+cat > c.test << 'END'
+#!/bin/sh
+echo 1..1
+test -f b.run || { echo 'Bail out!'; exit 1; }
+echo ok 1
+rm -f a.run b.run
+END
+
+chmod a+x *.test
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=5 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+cat > exp << 'END'
+PASS: a.test 1
+PASS: a.test 2
+PASS: b.test 1
+PASS: b.test 2
+PASS: c.test 1
+END
+
+grep ': [abc]\.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+# TODO: it would be nice to also redo the checks forcing parallel make...
+
+:
diff --git a/tests/tap-diagnostic-custom.test b/tests/tap-diagnostic-custom.test
new file mode 100755 (executable)
index 0000000..05f0875
--- /dev/null
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - option '--diagnostic-string' to customize the string introducing
+#    TAP diagnostics
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+my_log_driver = $(srcdir)/tap-driver
+my_log_compiler = cat
+TEST_EXTENSIONS =
+TESTS =
+END
+
+: > later.mk
+
+# Quoting our comments below is an hack required to keep
+# comments near the things they refer to.
+i=0
+for string in \
+'## A letter' \
+    a \
+'## A number' \
+    1023 \
+'## A non-alphabetic character' \
+    @ \
+'## Some metacharacters (we need to repeat the "$" for make)' \
+    '^>;&*"|$$' \
+'## A whitespace character' \
+    " " \
+'## A tab character' \
+    "$tab" \
+'## A string with more whitespace' \
+    "  ${tab}a b${tab} c" \
+'## Note the we do not have the empty string here.  We prefer to' \
+'## leave its behaviour in this context undefined for the moment.'
+do
+  case $string in '##'*) continue;; esac
+  i=`expr $i + 1`
+  unindent >> Makefile.am << END
+    TEST_EXTENSIONS += .t$i
+    TESTS += foo$i.t$i
+    T${i}_LOG_COMPILER = \$(my_log_compiler)
+    T${i}_LOG_DRIVER = \$(my_log_driver)
+    AM_T${i}_LOG_DRIVER_FLAGS = \
+      --comments \
+      --diagnostic-string '$string'
+END
+  unindent > foo$i.t$i <<END
+    1..1
+    ok 1
+    $string blah blah $i
+END
+    echo "AM_T${i}_LOG_DRIVER_FLAGS = --no-comments" >> later.mk
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=$i pass=$i fail=0 xpass=0 xfail=0 skip=0 error=0
+
+cat later.mk >> Makefile
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP 'blah blah' stdout && Exit 1
+
+:
diff --git a/tests/tap-diagnostic.test b/tests/tap-diagnostic.test
new file mode 100755 (executable)
index 0000000..16101af
--- /dev/null
@@ -0,0 +1,124 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - diagnostic messages (TAP lines with leading "#")
+#  - flags '--comments' and '--no-comments' of the TAP test driver
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+metacharacters=\''"\$!&()[]<>#;^?*'
+
+cat > all.test <<END
+1..4
+# Hi! I'm a comment.
+# Tests begin.
+ok 1
+not ok 2 - foo # TODO
+ok 3 - bar # SKIP
+# Tests end.
+ok - zardoz
+# Shell metacharacters here: $metacharacters
+.# Leading characters before "#", not a TAP diagnostic line.
+x # Leading characters before "#", not a TAP diagnostic line.
+ # Leading whitespace before "#", not a TAP diagnostic line.
+${tab}# Leading whitespace before "#", not a TAP diagnostic line.
+ ${tab}  # Leading whitespace before "#", not a TAP diagnostic line.
+END
+
+cat > exp <<END
+# all.test: Hi! I'm a comment.
+# all.test: Tests begin.
+PASS: all.test 1
+XFAIL: all.test 2 - foo # TODO
+SKIP: all.test 3 - bar # SKIP
+# all.test: Tests end.
+PASS: all.test 4 - zardoz
+# all.test: Shell metacharacters here: $metacharacters
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
+count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
+
+echo 'AM_TEST_LOG_DRIVER_FLAGS = --comments' >> Makefile
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+$FGREP ' all.test' stdout > got
+cat exp
+cat got
+diff exp got
+count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
+
+TEST_LOG_DRIVER_FLAGS="--no-comments" $MAKE -e check >stdout \
+  || { cat stdout; Exit 1; }
+cat stdout
+$EGREP -i "#.*all\\.test|a comment|(Tests|Shell) " stdout && Exit 1
+count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
+
+# The "#"-prepended lines here shouldn't be parsed as test results.
+cat > all.test <<END
+1..1
+ok
+# ok
+#ok
+# not ok
+#not ok
+# Bail out!
+#Bail out!
+# SKIP
+#SKIP
+# TODO
+#TODO
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+# Diagnostic without leading whitespace, or with extra leading whitespace,
+# is ok.  Be laxer in the grepping checks, to allow for whitespace
+# normalization by the TAP driver.
+
+ws="[ $tab]"
+ws0p="${ws}*"
+ws1p="${ws}${ws0p}"
+
+cat > all.test <<END
+1..1
+ok 1
+#foo
+#bar${tab}
+#   zardoz  ${tab}
+#  ${tab} ${tab}${tab}foo  bar${tab}baz  ${tab}
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+grep "^# all.test:${ws0p}foo$" stdout
+grep "^# all.test:${ws0p}bar${ws0p}$" stdout
+grep "^# all.test:${ws1p}zardoz${ws0p}$" stdout
+grep "^# all.test:${ws1p}foo  bar${tab}baz${ws0p}$" stdout
+
+test `grep -c '^# all\.test:' stdout` -eq 4
+
+:
diff --git a/tests/tap-doc.test b/tests/tap-doc.test
new file mode 100755 (executable)
index 0000000..94ced61
--- /dev/null
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check that an example given in the documentation really works.
+# See section "Simple Tests" subsection "Script-based Testsuites".
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+cat >> configure.in <<END
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = foo.sh zardoz.tap bar.sh mu.tap
+TEST_EXTENSIONS = .sh .tap
+TAP_LOG_DRIVER = $(srcdir)/tap-driver
+## Ensure the test scripts are run in the correct order.
+mu.log: bar.log
+bar.log: zardoz.log
+zardoz.log: foo.log
+END
+
+cat > foo.sh <<'END'
+#!/bin/sh
+exit 0
+END
+
+cat > bar.sh <<'END'
+#!/bin/sh
+exit 77
+END
+
+cat > zardoz.tap << 'END'
+#!/bin/sh
+echo 1..4
+echo 'ok 1 - Daemon started'
+echo 'ok 2 - Daemon responding'
+echo 'ok 3 - Daemon uses /proc # SKIP /proc is not mounted'
+echo 'ok 4 - Daemon stopped'
+END
+
+cat > mu.tap << 'END'
+#!/bin/sh
+echo 1..2
+echo 'ok'
+echo 'not ok # TODO frobnication not yet implemented'
+END
+
+chmod a+x *.sh *.tap
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+cat > exp <<'END'
+PASS: foo.sh
+PASS: zardoz.tap 1 - Daemon started
+PASS: zardoz.tap 2 - Daemon responding
+SKIP: zardoz.tap 3 - Daemon uses /proc # SKIP /proc is not mounted
+PASS: zardoz.tap 4 - Daemon stopped
+SKIP: bar.sh
+PASS: mu.tap 1
+XFAIL: mu.tap 2 # TODO frobnication not yet implemented
+END
+
+sed -n '/^PASS: foo\.sh/,/^XFAIL: mu\.tap/p' stdout > t
+cat t
+# Strip extra "informative" lines that could be printed by Solaris
+# Distributed Make.
+LC_ALL=C $EGREP -v ' --> ([0-9][0-9]* job|[Jj]ob output)' t > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-doc2.test b/tests/tap-doc2.test
new file mode 100755 (executable)
index 0000000..c844f79
--- /dev/null
@@ -0,0 +1,141 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check that an example given in the documentation really works.
+# See section "Using the TAP test protocol", subsection "Use TAP
+# with the Automake test harness".
+
+am_create_testdir=empty
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > Makefile.am <<'END'
+TEST_LOG_DRIVER = $(PERL) $(srcdir)/build-aux/tap-driver.pl
+TESTS = foo.test bar.test baz.test
+EXTRA_DIST = $(TESTS)
+END
+
+cat > configure.ac <<'END'
+AC_INIT([GNU Try Tap], [1.0], [bug-automake@gnu.org])
+AC_CONFIG_AUX_DIR([build-aux])
+AM_INIT_AUTOMAKE([foreign parallel-tests -Wall -Werror])
+AC_CONFIG_FILES([Makefile])
+AC_REQUIRE_AUX_FILE([tap-driver.pl])
+AC_PATH_PROG([PERL], [perl])
+test -n "$PERL" || AC_MSG_ERROR([perl not found])
+$PERL -MTAP::Parser -e 1 || AC_MSG_ERROR([TAP::Parser not found])
+AC_OUTPUT
+END
+
+cat > foo.test <<'END'
+#!/bin/sh
+echo 1..4 # Number of tests to be executed.
+echo 'ok 1 - Swallows fly'
+echo 'not ok 2 - Caterpillars fly # TODO metamorphosis in progress'
+echo 'ok 3 - Pigs fly # SKIP not enough acid'
+echo '# I just love word plays...'
+echo 'ok 4 - Flies fly too :-)'
+END
+
+cat > bar.test <<'END'
+#!/bin/sh
+echo 1..3
+echo 'not ok 1 - Bummer, this test has failed.'
+echo 'ok 2 - This passed though.'
+echo 'Bail out! Ennui kicking in, sorry...'
+echo 'ok 3 - This will not be seen.'
+END
+
+cat > baz.test <<'END'
+#!/bin/sh
+echo 1..1
+echo ok 1
+# Exit with error, even if all the test case has been successful.
+exit 7
+END
+
+chmod a+x *.test
+
+# Strip extra "informative" lines that could be printed by Solaris
+# Distributed Make.
+mkdir build-aux
+cp "$am_scriptdir"/tap-driver.pl build-aux \
+  || framework_failure_ "fetching the perl TAP driver"
+
+(export AUTOMAKE ACLOCAL AUTOCONF && $AUTORECONF -vi) || Exit 1
+
+./configure --help # Sanity check.
+./configure || skip_ "configure failed"
+
+case $MAKE in *\ -j*) skip_ "can't work easily with concurrent make";; esac
+
+# Prevent Sun Distributed Make from trying to run in parallel.
+DMAKE_MODE=serial; export DMAKE_MODE
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+cat > exp <<'END'
+PASS: foo.test 1 - Swallows fly
+XFAIL: foo.test 2 - Caterpillars fly # TODO metamorphosis in progress
+SKIP: foo.test 3 - Pigs fly # SKIP not enough acid
+PASS: foo.test 4 - Flies fly too :-)
+FAIL: bar.test 1 - Bummer, this test has failed.
+PASS: bar.test 2 - This passed though.
+ERROR: bar.test - Bail out! Ennui kicking in, sorry...
+PASS: baz.test 1
+ERROR: baz.test - exited with status 7
+END
+
+sed -n '/^PASS: foo\.test/,/^ERROR: baz\.test/p' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+grep '^Please report to bug-automake@gnu\.org$' stdout
+
+env \
+  TESTS='foo.test baz.test' \
+  TEST_LOG_DRIVER_FLAGS='--comments --ignore-exit' \
+  $MAKE -e check >stdout || { cat stdout; Exit 1; }
+
+cat > exp <<'END'
+PASS: foo.test 1 - Swallows fly
+XFAIL: foo.test 2 - Caterpillars fly # TODO metamorphosis in progress
+SKIP: foo.test 3 - Pigs fly # SKIP not enough acid
+# foo.test: I just love word plays...
+PASS: foo.test 4 - Flies fly too :-)
+PASS: baz.test 1
+END
+
+sed -n '/^PASS: foo\.test/,/^PASS: baz\.test/p' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+# Sanity check the distribution.
+cat > bar.test <<'END'
+#!/bin/sh
+echo 1..1
+echo ok 1
+END
+echo AM_TEST_LOG_DRIVER_FLAGS = --ignore-exit >> Makefile.in
+./config.status Makefile
+$MAKE distcheck
+
+:
diff --git a/tests/tap-driver-stderr.test b/tests/tap-driver-stderr.test
new file mode 100755 (executable)
index 0000000..5938baf
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Unit test on TAP driver:
+#  - error messages from awk/shell/perl goes to the console
+
+required=non-root
+am_parallel_tests=yes
+am_create_testdir=empty
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+tst=zardoz
+
+for suf in trs log; do
+
+  rm -f $tst.log $tst.trs
+  touch $tst.$suf
+  chmod a-w $tst.$suf
+
+  st=0
+  ./tap-driver --test-name $tst --log-file $tst.log --trs-file $tst.trs \
+    -- sh -c 'echo 1..1; echo ok 1; echo "Hello, World!"' \
+    >stdout 2>stderr && st=1
+  cat stdout
+  cat stderr >&2
+  cat $tst.log || :
+  cat $tst.trs || :
+  test $st -eq 0
+
+  $FGREP 'Hello, World!' stderr stdout && Exit 1
+  $FGREP $tst.$suf stderr
+
+done
+
+:
diff --git a/tests/tap-empty-diagnostic.test b/tests/tap-empty-diagnostic.test
new file mode 100755 (executable)
index 0000000..78b95ba
--- /dev/null
@@ -0,0 +1,41 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - empty diagnostic messages are discarder
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+sed 's/\$$//' > all.test <<END
+1..1$
+ok 1$
+#$
+# $
+#${tab}$
+#   ${tab} $tab${tab}$
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep '^PASS:.*all\.test' stdout # Sanity check.
+grep '#.*all\.test' stdout && Exit 1
+grep "all\.test[ $tab]*:[ $tab]*$" stdout && Exit 1
+
+:
diff --git a/tests/tap-empty.test b/tests/tap-empty.test
new file mode 100755 (executable)
index 0000000..3d7a0a1
--- /dev/null
@@ -0,0 +1,55 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support: the following situations should be flagged as errors:
+#  - empty TAP input
+#  - blank TAP input
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+# Empty TAP input.
+: > empty.test
+
+# Blank TAP input (one empty line).
+echo > blank.test
+
+# Blank TAP input (one whitespace-only line).
+cat > white.test  <<END
+  ${tab}
+END
+
+# Blank TAP input (few blank and whitespace-only lines).
+cat > white2.test  <<END
+
+
+ ${tab}  ${tab}${tab}
+
+${tab}
+
+END
+
+for input in empty blank white white2; do
+  cp $input.test all.test
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
+  grep '^ERROR: all\.test - missing test plan$' stdout
+done
+
+:
diff --git a/tests/tap-escape-directive-2.test b/tests/tap-escape-directive-2.test
new file mode 100755 (executable)
index 0000000..41c4e74
--- /dev/null
@@ -0,0 +1,55 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - "escape" TODO and SKIP directives (by escaping the "#" character)
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+1..8
+
+not ok \ # TODO
+ok \ # SKIP
+
+not ok \\# TODO
+ok \\# SKIP
+
+ok \\\# TODO
+ok \\\# SKIP
+
+not ok \\\\\\\\\\# TODO
+ok     \\\\\\\\\\# SKIP
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=8 pass=2 fail=0 xpass=0 xfail=3 skip=3 error=0
+
+grep '^XFAIL: all\.test 1 .*# TODO' stdout
+grep '^SKIP: all\.test 2 .*# SKIP' stdout
+grep '^XFAIL: all\.test 3 .*# TODO' stdout
+grep '^SKIP: all\.test 4 .*# SKIP' stdout
+grep '^PASS: all\.test 5 .*# TODO' stdout
+grep '^PASS: all\.test 6 .*# SKIP' stdout
+grep '^XFAIL: all\.test 7 .*# TODO' stdout
+grep '^SKIP: all\.test 8 .*# SKIP' stdout
+
+:
diff --git a/tests/tap-escape-directive.test b/tests/tap-escape-directive.test
new file mode 100755 (executable)
index 0000000..4bcec59
--- /dev/null
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - "escape" TODO and SKIP directives (by escaping the "#" character)
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+1..2
+ok \# TODO
+ok \# SKIP
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=2 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+grep '^PASS: all\.test 1 .*# TODO' stdout
+grep '^PASS: all\.test 2 .*# SKIP' stdout
+
+:
diff --git a/tests/tap-exit.test b/tests/tap-exit.test
new file mode 100755 (executable)
index 0000000..6cb3053
--- /dev/null
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - an exit status != 0 of a test script causes an hard error
+#  - the `--ignore-exit' option causes the TAP test driver to ignore
+#    exit statuses of the test scripts.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+echo TESTS = > Makefile.am
+for st in 1 2 77 99; do
+  unindent > exit${st}.test <<END
+    #!/bin/sh
+    echo 1..1
+    echo ok 1
+    exit $st
+END
+  echo TESTS += exit${st}.test >> Makefile.am
+done
+
+chmod a+x *.test
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=8 pass=4 fail=0 xpass=0 xfail=0 skip=0 error=4
+
+grep '^ERROR: exit1\.test - exited with status 1$' stdout
+grep '^ERROR: exit2\.test - exited with status 2$' stdout
+grep '^ERROR: exit77\.test - exited with status 77$' stdout
+grep '^ERROR: exit99\.test - exited with status 99$' stdout
+
+echo TEST_LOG_DRIVER_FLAGS = --ignore-exit >> Makefile
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=4 pass=4 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+:
diff --git a/tests/tap-fancy.test b/tests/tap-fancy.test
new file mode 100755 (executable)
index 0000000..b89aa09
--- /dev/null
@@ -0,0 +1,133 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support: some unusual forms for valid TAP input.
+# See also related test 'tap-fancy2.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+#
+# From manpage Test::Harness::TAP(3):
+#
+# ``Lines written to standard output matching /^(not )?ok\b/ must be
+#   interpreted as test lines. All other lines must not be considered
+#   test output.''
+#
+# Unfortunately, the exact format of TODO and SKIP directives is not as
+# clearly described in that manpage; but a simple reverse-engineering of
+# the prove(1) utility shows that it is probably given by the perl regex
+# /#\s*(TODO|SKIP)\b/.
+#
+
+cat > all.test <<END
+1..21
+
+ok? a question
+not ok? a question
+
+ok+plus
+not ok+plus
+
+ok-minus
+not ok-minus
+
+ok#55
+not ok#55
+
+ok${tab}  ${tab}9
+ok ${tab}${tab}          10
+
+not ok${tab}  ${tab}11
+not ok ${tab}${tab}          12
+
+ok# SKIP
+ok${tab}#SKIP--who cares?
+ok?#SKIP!
+ok!#SKIP?
+
+not ok# TODO
+not ok${tab}#TODO--who cares?
+not ok?#TODO!
+not ok!#TODO?
+
+ok~#TODO
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=21 pass=6 fail=6 xfail=4 xpass=1 skip=4 error=0
+
+#
+# "Weird" characters support.
+#
+
+# The "#" character might cause confusion w.r.t. TAP directives (TODO,
+# SKIP), so we don't attempt to use it.
+weirdchars=\''"$!&()[]<>;^?*/@%=,.:'
+
+cat > all.test <<END
+1..6
+ok $weirdchars
+not ok $weirdchars
+ok $weirdchars # TODO
+not ok $weirdchars # TODO
+ok $weirdchars # SKIP
+Bail out! $weirdchars
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=6 pass=1 fail=1 xfail=1 xpass=1 skip=1 error=1
+$FGREP "PASS: all.test 1 $weirdchars" stdout
+$FGREP "FAIL: all.test 2 $weirdchars" stdout
+$FGREP "XPASS: all.test 3 $weirdchars" stdout
+$FGREP "XFAIL: all.test 4 $weirdchars" stdout
+$FGREP "SKIP: all.test 5 $weirdchars" stdout
+$FGREP "ERROR: all.test - Bail out! $weirdchars" stdout
+
+#
+# Trailing backslashes does not confuse the parser.
+#
+
+bs='\'
+
+cat > all.test <<END
+1..6
+ok $bs
+not ok $bs
+ok # TODO $bs
+not ok # TODO $bs
+ok # SKIP $bs
+Bail out! $bs
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=6 pass=1 fail=1 xfail=1 xpass=1 skip=1 error=1
+grep '^PASS: all\.test 1 \\$' stdout
+grep '^FAIL: all\.test 2 \\$' stdout
+grep '^XPASS: all\.test 3 # TODO \\$' stdout
+grep '^XFAIL: all\.test 4 # TODO \\$' stdout
+grep '^SKIP: all\.test 5 # SKIP \\$' stdout
+grep '^ERROR: all\.test - Bail out! \\$' stdout
+
+:
diff --git a/tests/tap-fancy2.test b/tests/tap-fancy2.test
new file mode 100755 (executable)
index 0000000..8080861
--- /dev/null
@@ -0,0 +1,138 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support: more unusual forms for valid TAP input.
+# See also related test 'tap-fancy.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+#
+# From manpage Test::Harness::TAP(3):
+#
+# ``Lines written to standard output matching /^(not )?ok\b/ must be
+#   interpreted as test lines. All other lines must not be considered
+#   test output.''
+#
+# Unfortunately, the exact format of TODO and SKIP directives is not as
+# clearly described in that manpage; but a simple reverse-engineering of
+# the prove(1) utility shows that it is probably given by the perl regex
+# /#\s*(TODO|SKIP)\b/.
+#
+
+# To avoid problems with backslashes in echo arguments.
+xecho () { printf '%s\n' "$*"; }
+
+# There are 34 values for $str ...
+for str in \
+  \'  \
+  '"' \
+  '`' \
+  '#' \
+  '$' \
+  '!' \
+  '\' \
+  '/' \
+  '&' \
+  '%' \
+  '(' \
+  ')' \
+  '|' \
+  '^' \
+  '~' \
+  '?' \
+  '*' \
+  '+' \
+  '-' \
+  ',' \
+  ':' \
+  ';' \
+  '=' \
+  '<' \
+  '>' \
+  '@' \
+  '[' \
+  ']' \
+  '{' \
+  '}' \
+  '\\' \
+  '...' \
+  '?[a-zA-Z0-9]*' \
+  '*.*' \
+; do
+  # ... each of them add 1 pass, 1 fail, ...
+  xecho "ok${str}"
+  xecho "not ok${str}"
+  # ... and (generally) 4 skips, 4 xfails, and 4 xpasses ...
+  for settings in \
+    'result="ok" directive=SKIP' \
+    'result="not ok" directive=TODO' \
+    'result="ok" directive=TODO' \
+  ; do
+    eval "$settings"
+    xecho "${result}# ${directive}${str}"
+    # ... but 6 skips, 6 xpasses and 6 xfails are to be removed, since
+    # they might not work with $str = '#' or $str = '\' ...
+    if test x"$str" != x'#' && test x"$str" != x'\'; then
+      xecho "${result}${str}#${directive}"
+      xecho "${result}${str}#   ${tab}${tab} ${directive}"
+      xecho "${result}${str}#${directive}${str}"
+    fi
+  done
+done > all.test
+
+# Sanity check against a previous use of unportable usages of backslashes
+# with the "echo" builtin.
+if grep '[^\\]\\#' all.test; then
+  framework_failure_ "writing backslashes in all.test"
+fi
+
+# ... so that we finally have:
+pass=34
+fail=34
+xfail=130 # = 4 * 34 - 6
+xpass=130 # = 4 * 34 - 6
+skip=130  # = 4 * 34 - 6
+error=0
+total=`expr $pass + $fail + $xfail + $xpass + $skip`
+
+# Even nastier!  But accordingly to the specifics, it should still work.
+for result in 'ok' 'not ok'; do
+  echo "${result}{[(<#${tab}TODO>)]}" >> all.test
+done
+echo "ok{[(<#${tab}SKIP>)]}" >> all.test
+
+# We have to update some test counts.
+xfail=`expr $xfail + 1`
+xpass=`expr $xpass + 1`
+skip=`expr $skip + 1`
+total=`expr $total + 3`
+
+# And add the test plan!
+echo 1..$total >> all.test
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+$EGREP '^(PASS|FAIL|SKIP).*#.*TODO' stdout && Exit 1
+$EGREP '^X?(PASS|FAIL).*#.*SKIP' stdout && Exit 1
+
+count_test_results total=$total pass=$pass fail=$fail skip=$skip \
+                   xpass=$xpass xfail=$xfail error=$error
+
+:
diff --git a/tests/tap-functions.sh b/tests/tap-functions.sh
new file mode 100644 (file)
index 0000000..e8ce876
--- /dev/null
@@ -0,0 +1,236 @@
+# -*- shell-script -*-
+#
+# Copyright (C) 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/>.
+
+# Helper functions used by TAP-producing tests of the Automake testsuite.
+
+#
+# IMPORTANT: All the functions defined in this file can *not* be used
+#            from within a subshell, unless explicitly noted otherwise.
+#
+
+# The counts of the TAP test results seen so far: total count and
+# per-result counts.
+tap_count_=0
+tap_pass_count_=0
+tap_skip_count_=0
+tap_fail_count_=0
+tap_xfail_count_=0
+tap_xpass_count_=0
+
+# The first "test -n" tries to avoid extra forks when possible.
+if test -n "${ZSH_VERSION}${BASH_VERSION}" \
+     || (eval 'test $((1 + 1)) = 2') >/dev/null 2>&1
+then
+  # Outer use of 'eval' needed to protect dumber shells from parsing
+  # errors.
+  eval 'incr_ () { eval "$1=\$((\${$1} + 1))"; }'
+else
+  incr_ () { eval "$1=\`expr \${$1} + 1\`"; }
+fi
+
+# not COMMAND [ARGS...]
+# ---------------------
+# Run the given command and invert its exit status.
+not ()
+{
+  if "$@"; then return 1; else return 0; fi
+}
+
+# plan_ [unknown|later|lazy|now|NUMBER-OF-PLANNED-TESTS]
+# ------------------------------------------------------
+# Print a TAP plan for the given number of tests.  This must be called
+# before reporting any test result.  If called with the special argument
+# "unknown" or "later", it will do nothing, expecting the calling script
+# to declare the plan later.  If called with the special argument "lazy"
+# or "now", it will print a TAP plan that accounts for the number of tests
+# seen so far.
+plan_ ()
+{
+  if test $# -eq 0; then
+    bailout_ "plan_: missing argument"
+  elif test $# -ge 2; then
+    bailout_ "plan_: too many arguments"
+  elif test x"$1" = x"unknown" || test x"$1" = x"later"; then
+    : No-op.
+  elif test x"$1" = x"lazy" || test x"$1" = x"now"; then
+    echo "1..$tap_count_" # Number of test results seen so far.
+    have_tap_plan_=yes
+  elif test $1 -ge 0; then
+    echo "1..$1"
+    have_tap_plan_=yes
+  else
+    bailout_ "plan_: invalid argument '$1'"
+  fi
+}
+have_tap_plan_=no # Avoid interferences from the environment.
+
+# diag_ [EXPLANATION]
+# ------------------
+# Report the given text as TAP diagnostic.  Assumes the string denoting
+# TAP diagnostic lines is stored in the `$diag_string_' variable; this is
+# done to allow better interplay with TAP drivers that allow such a string
+# to be configured.
+diag_ ()
+{
+  test $# -eq 0 || echo "$diag_string_ $*"
+}
+
+# Used by the `diag_' function above.  User-overridable.
+diag_string_="#"
+
+# warn_ [EXPLANATION]
+# ------------------
+# Give a warning (using TAP diagnostic).
+warn_ ()
+{
+  case $# in
+    0) diag_ "WARNING: (unknown warning)";;
+    *) diag_ "WARNING: $*";;
+  esac
+}
+
+# result_ RESULT [-D DIRECTIVE] [-r REASON] [--] [DESCRIPTION...]
+# ---------------------------------------------------------------
+# Report a test case with the given RESULT (valid values are "ok" and
+# "not ok") and the given DESCRIPTION (if any).  If DIRECTIVE is given
+# and non-empty (valid values being "TODO" and "SKIP"), it will be
+# reported too, with the REASON (if given) appended.
+result_ ()
+{
+  set +x # Don't pollute the log files.
+  test $# -gt 0 || bailout_ "result_: missing argument"
+  tap_result_=$1; shift
+  case $tap_result_ in
+    "ok"|"not ok") ;;
+    *) bailout_ "result_: invalid result '$tap_result'" ;;
+  esac
+  tap_directive_= tap_reason_=
+  while test $# -gt 0; do
+    case $1 in
+      -D|--directive) tap_directive_=$2; shift;;
+      -r|--reason) tap_reason_=$2; shift;;
+      --) shift; break;;
+      -*) bailout_ "result_: invalid option '$1'";;
+       *) break;;
+    esac
+    shift
+  done
+  case $tap_directive_ in
+    ""|TODO|SKIP) ;;
+    *) bailout_ "result_: invalid directive '$directive_'" ;;
+  esac
+  incr_ tap_count_
+  case $tap_result_,$tap_directive_ in
+    ok,) incr_ tap_pass_count_;;                # Passed.
+    not\ ok,TODO) incr_ tap_xfail_count_;;      # Expected failure.
+    not\ ok,*) incr_ tap_fail_count_ ;;         # Failed.
+    ok,TODO) incr_ tap_xpass_count_ ;;          # Unexpected pass.
+    ok,SKIP) incr_ tap_skip_count_ ;;           # Skipped.
+    *) bailout_ "internal error in 'result_'";; # Can't happen.
+  esac
+  tap_text_="$tap_result_ $tap_count_"
+  if test x"$*" != x; then
+    tap_text_="$tap_text_ - $*"
+  fi
+  if test x"$tap_directive_" != x; then
+    tap_text_="$tap_text_ # $tap_directive_"${tap_reason_:+" $tap_reason_"}
+  fi
+  printf '%s\n' "$tap_text_"
+  set -x # Restore shell xtraces.
+}
+
+#  Shorthands for common usages of `result_'.
+ok_ () { result_ 'ok' ${1+"$@"}; }
+not_ok_ () { result_ 'not ok' ${1+"$@"}; }
+skip_ () { result_ 'ok' -D SKIP ${1+"$@"}; }
+
+# skip_row_ COUNT [-r REASON] [--] [DESCRIPTION...]
+# -------------------------------------------------
+# Report a COUNT of skipped test, with the given reason and descriptions
+# (if any).  Useful to avoid cascade failures in case a fair number of
+# tests depend on an earlier one that failed.
+skip_row_ ()
+{
+  skip_count_=$1; shift
+  for i_ in `seq_ $skip_count_`; do skip_ ${1+"$@"}; done
+}
+
+# skip_all_ [REASON ...]
+# ----------------------
+# Skip all the tests in a test script.  Must be used before calling `plan_'
+# or reporting any test result.  Can't be used from within a subshell.
+skip_all_ ()
+{
+  echo "1..0 # SKIP" ${1+"$@"}
+  have_tap_plan_=yes
+  Exit 0
+}
+
+# bailout_ [REASON ...]
+# ---------------------
+# Stop the execution of the current test suite right now, due to an
+# unrecoverable error.  Can be called at any point, but cannot be used
+# from within a subshell.
+bailout_ ()
+{
+  echo 'Bail out!' ${1+"$@"}
+  Exit 99
+}
+
+# fatal_ [REASON ...]
+# -------------------
+# Same as `bailout_'; for compatibility with `plain-functions.sh'.
+fatal_ ()
+{
+  bailout_ ${1+"$@"}
+}
+
+# framework_failure_ [REASON ...]
+# -------------------------------
+# Stop the execution of the current test suite right now, due to an
+# unrecoverable error in the set-up of the test case.  Can be called
+# at any point, but cannot be used from within a subshell.
+framework_failure_ ()
+{
+  bailout_ "set-up failure"${1+": $*"}
+}
+
+# command_ok_ TEST-DESCRIPTION [OPTIONS..] [--] CMD [ARGS...]
+# -----------------------------------------------------------
+# Helper subroutine for when a TAP result must be determined by the
+# outcome of a command.
+command_ok_ ()
+{
+  tap_directive_= tap_reason_=
+  test $# -gt 0 || bailout_ "command_ok_: missing argument"
+  tap_description_=$1; shift
+  while test $# -gt 0; do
+    case $1 in
+      -D|--directive) tap_directive_=$2; shift;;
+      -r|--reason) tap_reason_=$2; shift;;
+      --) shift; break;;
+      -*) bailout_ "command_ok_: invalid option '$1'";;
+       *) break;;
+    esac
+    shift
+  done
+  tap_result_="ok"; "$@" || tap_result_="not ok"
+  result_ "$tap_result_" -D "$tap_directive_" -r "$tap_reason_" \
+          -- "$tap_description_"
+}
+
+:
diff --git a/tests/tap-global-log.test b/tests/tap-global-log.test
new file mode 100755 (executable)
index 0000000..a442602
--- /dev/null
@@ -0,0 +1,122 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - which log files get copied in the global log?
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > ok.test << 'END'
+1..5
+ok 1
+ok 2
+ok 3
+not seen in global log
+ok 4
+ok 5
+END
+
+cat > top << 'END'
+1..6
+ok 1
+ok 2
+ok 3
+END
+
+cat > bot << 'END'
+ok 5
+ok 6
+END
+
+cat top - bot > skip.test << 'END'
+ok # SKIP
+::skip::
+END
+
+cat top - bot > todo.test << 'END'
+not ok # TODO
+::todo::
+END
+
+cat top - bot > fail.test << 'END'
+not ok
+::fail::
+END
+
+cat top - bot > xpass.test << 'END'
+ok # TODO
+::xpass::
+END
+
+cat top - bot > bail.test << 'END'
+::bail::
+Bail out!
+END
+
+cat top - bot > error.test << 'END'
+::error::
+1..7
+END
+
+# Created with "dd if=/dev/urandom count=1 | base64-encode"
+cat > hodgepodge <<'END'
+1+0 records in
+1+0 records out
+512 bytes (512 B) copied, 0.000241092 s, 2.1 MB/s
+gdivnV4VhL4DOzhE3zULJuun3PwqqQqMdATVcZbIQkNgyRvNBoqqHMBQEs7QsjDbp2nK+Szz
+EcelGyvXmHrW7yImaom6Yrg95k31VCmp/pGDRnTDwDrcOPJiv9jDReEmTAQkPuqLO+mFNly+
+DDHM9fNbzGumstsQ3wq3DOXz1pCV3JXwhjeaHSboeEbmr55bX0XHLSKaecctA0rXDXEyZWZ/
+ODlawSrAXzw0H7a+xBwjnNXZ3zYiwk3x+WQrPqNjb+qXiLLTxAKzx2/KnaFhxkPlte5jPRNB
+FciDolL+H/10LsCdSzLOrGnY2zH6vL2JMZfxjnb73zWFcdWWE01LTD7wpN5O1MP3+N47lcVe
+lWbkD04cJvhwxLElYSO24B743GG5EyGYt9SeZRE6xbgwq3fVOS8KqjwGxwi4adSBTtw0CV8W
+S/6n8dck1vBvjA+qpk0zMSYSqc3+jzW9UiGTmTEIwfw80p/lGNsfjcNBJ86nFkWUnHmrsi8k
+Dv57sK70mTg239g08f5Uvdga/5UreMBSgB0hUj5sbq57r7B1fsVr0Kag468la8zKy3ZEZ0gX
+++sbaJ9WGHhnKvjooeH+4Y6HwAFsdINde++FlCmp4EuNKKEEuXbSKLaOTy3+6pJ2DYdvRCL+
+frZwxH4hcrw8qh+8IakB02viewZS/qT57v4=
+END
+
+exec 5>misc.test
+echo 'ok # SKIP' >&5
+cat hodgepodge >&5
+echo 'not ok # TODO' >&5
+echo 'ok' >&5
+exec 5>&-
+
+cat > skipall.test << 'END'
+1..0 # SKIP all
+END
+
+# We don't care about the exit status of "make check" here.
+TESTS="`echo *.test`" $MAKE -e check || :
+cat test-suite.log
+
+grep ':.*ok|not seen' test-suite.log && Exit 1
+
+for s in skip todo fail xpass bail error; do
+  $FGREP "::$s::" test-suite.log
+done
+
+grep '^1\.\.0 # SKIP all$' test-suite.log
+
+case `cat test-suite.log` in
+  *"`cat hodgepodge`"*) ;;
+  *) Exit 1;;
+esac
+
+:
diff --git a/tests/tap-global-result.test b/tests/tap-global-result.test
new file mode 100755 (executable)
index 0000000..ff825da
--- /dev/null
@@ -0,0 +1,187 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - which global test result derives from different test results
+#    mixed in a single script?
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > ok.test <<END
+1..3
+ok 1
+not ok 2 # TODO
+ok 3 # SKIP
+END
+
+cat > skip.test <<'END'
+1..3
+ok 1 # SKIP
+ok 2 # SKIP
+ok 3 # SKIP
+END
+
+cat > skipall.test <<'END'
+1..0 # SKIP
+foo
+# bar
+END
+
+cat > fail.test <<'END'
+1..1
+not ok 1
+END
+
+(sed '1s/.*/1..4/' ok.test && echo 'not ok 4') > fail2.test
+
+cat > xpass.test <<'END'
+1..1
+ok 1 # TODO
+END
+
+(sed '1s/.*/1..4/' ok.test && echo 'ok 4 # TODO') > xpass2.test
+
+echo 'Bail out!' > bail.test
+
+(cat ok.test && echo 'Bail out!') > bail2.test
+
+cat > bail3.test <<'END'
+1..0 # SKIP
+Bail out!
+END
+
+# Too many tests.
+cat > error.test <<'END'
+1..2
+ok 1
+ok 2 # SKIP
+not ok 3
+not ok 4 # TODO
+END
+
+# Too few tests.
+cat > error2.test <<'END'
+1..4
+ok 1
+not ok 2 # TODO
+ok 3 # SKIP
+END
+
+# Repeated plan.
+cat > error3.test <<'END'
+1..2
+1..2
+ok 1
+ok 2
+END
+
+# Too many tests, after a "SKIP" plan.
+cat > error4.test <<'END'
+1..0 # SKIP
+ok 1
+ok 2
+END
+
+# Tests out of order.
+cat > error5.test <<'END'
+1..4
+not ok 1 # TODO
+ok 3
+ok 2
+ok 4
+END
+
+# Wrong test number.
+cat > error6.test <<'END'
+1..2
+ok 1 # SKIP
+ok 7
+END
+
+# No plan.
+cat > error7.test <<'END'
+ok 1 # SKIP
+ok 2 # TODO
+not ok 3 # TODO
+ok 4
+END
+
+cat > hodgepodge.test <<'END'
+1..2
+not ok 1
+ok 2 # TODO
+Bail out!
+END
+
+cat > hodgepodge-all.test <<'END'
+1..4
+ok 1
+ok 2 # SKIP
+not ok 2 # TODO
+not ok 3
+ok 4 # TODO
+Bail out!
+END
+
+tests=`echo *.test` # Also required later.
+
+TESTS="$tests" $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+# Dirty trick required here.
+for tst in `echo " $tests " | sed 's/.test / /'`; do
+  echo :copy-in-global-log: yes >> $tst.trs
+done
+
+rm -f test-suite.log
+TESTS="$tests" $MAKE -e test-suite.log && Exit 1
+cat test-suite.log
+
+have_rst_section ()
+{
+  eqeq=`echo "$1" | sed 's/./=/g'`
+  # Assume $1 contains no RE metacharacters.
+  sed -n "/^$1$/,/^$eqeq$/p" test-suite.log > got
+  (echo "$1" && echo "$eqeq") > exp
+  cat exp
+  cat got
+  diff exp got
+}
+
+have_rst_section 'PASS: ok'
+have_rst_section 'SKIP: skip'
+have_rst_section 'SKIP: skipall'
+have_rst_section 'FAIL: fail'
+have_rst_section 'FAIL: fail2'
+have_rst_section 'FAIL: xpass'
+have_rst_section 'FAIL: xpass2'
+have_rst_section 'ERROR: bail'
+have_rst_section 'ERROR: bail2'
+have_rst_section 'ERROR: bail3'
+have_rst_section 'ERROR: error'
+have_rst_section 'ERROR: error2'
+have_rst_section 'ERROR: error3'
+have_rst_section 'ERROR: error4'
+have_rst_section 'ERROR: error5'
+have_rst_section 'ERROR: error6'
+have_rst_section 'ERROR: error7'
+have_rst_section 'ERROR: hodgepodge'
+have_rst_section 'ERROR: hodgepodge-all'
+
+:
diff --git a/tests/tap-log.test b/tests/tap-log.test
new file mode 100755 (executable)
index 0000000..ff832f2
--- /dev/null
@@ -0,0 +1,164 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - log file creation
+#  - log file removal
+#  - stdout and stderr of a script go in its log file
+#  - TEST_SUITE_LOG redefinition, at either automake or make time
+#  - VERBOSE environment variable support
+# Keep in sync with 'test-log.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+TESTS = pass.test skip.test xfail.test fail.test xpass.test error.test
+TEST_SUITE_LOG = global.log
+END
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+# Custom markers, for use in grepping checks.
+cmarker=::: # comment marker
+pmarker=%%% # plain maker
+
+cat > pass.test <<END
+#! /bin/sh -e
+echo 1..1
+echo   "$pmarker pass $pmarker" >&2
+echo "# $cmarker pass $cmarker" >&2
+echo "ok 1"
+END
+
+cat > skip.test <<END
+#! /bin/sh -e
+echo 1..1
+echo   "$pmarker skip $pmarker"
+echo "# $cmarker skip $cmarker"
+echo "ok 1 # SKIP"
+END
+
+cat > xfail.test <<END
+#! /bin/sh -e
+echo 1..1
+echo   "$pmarker xfail $pmarker" >&2
+echo "# $cmarker xfail $cmarker" >&2
+echo "not ok 1 # TODO"
+END
+
+cat > fail.test <<END
+#! /bin/sh -e
+echo 1..1
+echo   "$pmarker fail $pmarker"
+echo "# $cmarker fail $cmarker"
+echo "not ok 1"
+END
+
+cat > xpass.test <<END
+#! /bin/sh -e
+echo 1..1
+echo   "$pmarker xpass $pmarker" >&2
+echo "# $cmarker xpass $cmarker" >&2
+echo "ok 1 # TODO"
+END
+
+cat > error.test <<END
+#! /bin/sh -e
+echo 1..1
+echo   "$pmarker error $pmarker"
+echo "# $cmarker error $cmarker"
+echo 'Bail out!'
+END
+
+chmod a+x *.test
+
+TEST_SUITE_LOG=my.log $MAKE -e check && Exit 1
+ls -l # For debugging.
+test ! -f test-suite.log
+test ! -f global.log
+test -f my.log
+st=0
+for result in pass fail xfail xpass skip error; do
+  cat $result.log # For debugging.
+  $FGREP "$pmarker $result $pmarker" $result.log || st=1
+  $FGREP "$cmarker $result $cmarker" $result.log || st=1
+done
+test $st -eq 0 || Exit 1
+cat my.log # For debugging.
+for result in xfail fail xpass skip error; do
+  cat $result.log # For debugging.
+  $FGREP "$pmarker $result $pmarker" my.log || st=1
+  $FGREP "$cmarker $result $cmarker" my.log || st=1
+done
+test `$FGREP -c "$pmarker" my.log` -eq 5
+test `$FGREP -c "$cmarker" my.log` -eq 5
+
+# Passed test scripts shouldn't be mentioned in the global log.
+$EGREP '(^pass|[^x]pass)\.test' my.log && Exit 1
+# But failing (expectedly or not) and skipped ones should.
+$FGREP 'xfail.test' my.log
+$FGREP 'skip.test' my.log
+$FGREP 'fail.test' my.log
+$FGREP 'xpass.test' my.log
+$FGREP 'error.test' my.log
+
+touch error2.log test-suite.log global.log
+TEST_SUITE_LOG=my.log $MAKE -e mostlyclean
+ls -l # For debugging.
+test ! -f my.log
+test ! -f pass.log
+test ! -f fail.log
+test ! -f xfail.log
+test ! -f xpass.log
+test ! -f skip.log
+test ! -f error.log
+# "make mostlyclean" shouldn't remove unrelated log files.
+test -f error2.log
+test -f test-suite.log
+test -f global.log
+
+rm -f *.log
+
+VERBOSE=yes $MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+cat global.log
+test ! -f my.log
+test ! -f test-suite.log
+# Check that VERBOSE causes the global testsuite log to be
+# emitted on stdout.
+out=`cat stdout`
+log=`cat global.log`
+case $out in *"$log"*) ;; *) Exit 1;; esac
+
+touch error2.log test-suite.log my.log
+$MAKE clean
+ls -l # For debugging.
+test ! -f global.log
+test ! -f pass.log
+test ! -f fail.log
+test ! -f xfail.log
+test ! -f xpass.log
+test ! -f skip.log
+test ! -f error.log
+# "make clean" shouldn't remove unrelated log files.
+test -f error2.log
+test -f test-suite.log
+test -f my.log
+
+rm -f *.log
+
+:
diff --git a/tests/tap-merge-stdout-stderr.test b/tests/tap-merge-stdout-stderr.test
new file mode 100755 (executable)
index 0000000..6c07048
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - The Automake TAP driver has an option that instruct it to read TAP
+#    input also from the stderr of the test command, not only its stdout.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+cat > Makefile.am << 'END'
+AM_TEST_LOG_DRIVER_FLAGS = --comments --merge
+TESTS = all.test
+END
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+#!/bin/sh
+echo 1..4
+echo ok 1 >&2
+echo ok 2
+echo "not ok 3 # TODO" >&2
+echo "ok 4 # SKIP"
+echo "# foo foo foo" >&2
+END
+chmod a+x all.test
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=4 pass=2 fail=0 xpass=0 xfail=1 skip=1 error=0
+grep '^# all\.test: foo foo foo' stdout
+
+cat > all.test <<END
+#!/bin/sh
+echo 1..1
+echo ok 1
+echo 'Bail out!' >&2
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1
+
+# See that the option `--no-merge' can override the effect of `--merge'.
+
+TEST_LOG_DRIVER_FLAGS=--no-merge $MAKE -e check >stdout \
+  || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+
+
+:
diff --git a/tests/tap-missing-plan-and-bad-exit.test b/tests/tap-missing-plan-and-bad-exit.test
new file mode 100755 (executable)
index 0000000..8a0c40f
--- /dev/null
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - if a test script exits with non-zero status before printing the TAP
+#    plan, then the driver reports both "missing plan" and "exited with
+#    non-zero status" errors.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > foo.test <<END
+#!/bin/sh
+exit 123
+END
+
+echo TESTS = foo.test > Makefile.am
+
+chmod a+x foo.test
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=2
+
+grep '^ERROR: foo\.test - exited with status 123$' stdout
+grep '^ERROR: foo\.test - missing test plan$' stdout
+
+:
diff --git a/tests/tap-more.test b/tests/tap-more.test
new file mode 100755 (executable)
index 0000000..fcad2fc
--- /dev/null
@@ -0,0 +1,162 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# More on TAP support:
+#  - more than one TAP-generating test script in $(TESTS)
+#  - VPATH builds
+#  - use with parallel make (if supported)
+#  - basic use of diagnostic messages (lines beginning with "#")
+#  - flags for TAP driver defined through AC_SUBST in configure.ac
+#  - messages generated by the testsuite harness reference the
+#    correct test script(s)
+#  - "make distcheck" works
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+cat >> configure.in <<END
+AC_SUBST([AM_TEST_LOG_DRIVER_FLAGS], ['--comments'])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
+TESTS = 1.test 2.test 3.test
+EXTRA_DIST = $(TESTS) tap-driver
+END
+
+cat > 1.test <<'END'
+#! /bin/sh
+echo 1..2
+echo ok 1 - mu
+if test -f not-skip; then
+  echo "not ok 2 zardoz"
+else
+  echo "ok 2 zardoz # SKIP"
+fi
+END
+
+cat > 2.test <<'END'
+#! /bin/sh
+echo 1..3
+echo "ok"
+echo "not ok # TODO not implemented"
+echo "ok 3"
+END
+
+cat > 3.test <<END
+#! /bin/sh
+echo 1..1
+echo ok - blah blah blah
+echo '# Some diagnostic'
+if test -f bail-out; then
+  echo 'Bail out! Kernel Panic'
+else
+  :
+fi
+END
+
+chmod a+x [123].test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# Try a VPATH and by default serial build first, and then an in-tree
+# and by default parallel build.
+for try in 0 1; do
+
+  if test $try -eq 0; then
+    # VPATH serial build.
+    mkdir build
+    cd build
+    srcdir=..
+    run_make=$MAKE
+  elif test $try -eq 1; then
+    # In-tree parallel build.
+    srcdir=.
+    case $MAKE in
+      *\ -j*)
+        # Degree of parallelism already specified by the user: do
+        # not override it.
+        run_make=$MAKE
+        ;;
+      *)
+        # Some make implementations (e.g., HP-UX) don't grok `-j',
+        # some require no space between `-j' and the number of jobs
+        # (e.g., older GNU make versions), and some *do* require a
+        # space between `-j' and the number of jobs (e.g., Solaris
+        # dmake).  We need a runtime test to see what works.
+        echo 'all:' > Makefile
+        for run_make in "$MAKE -j3" "$MAKE -j 3" "$MAKE"; do
+          $run_make && break
+        done
+        rm -f Makefile
+        ;;
+    esac
+  else
+    fatal_ "internal error, invalid value of '$try' for \$try"
+  fi
+
+  $srcdir/configure
+  ls -l # For debugging.
+
+  # Success.
+
+  $run_make check >stdout || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=6 pass=4 fail=0 xpass=0 xfail=1 skip=1 error=0
+  grep '^PASS: 1\.test 1 - mu$' stdout
+  grep '^SKIP: 1\.test 2 zardoz # SKIP$' stdout
+  test `$FGREP -c '1.test' stdout` -eq 2
+  grep '^PASS: 2\.test 1$' stdout
+  grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout
+  grep '^PASS: 2\.test 3$' stdout
+  test `$FGREP -c '2.test' stdout` -eq 3
+  grep '^PASS: 3\.test 1 - blah blah blah$' stdout
+  grep '^# 3\.test: Some diagnostic$' stdout
+  test `$FGREP -c '3.test' stdout` -eq 2
+
+  # Failure.
+
+  # Use `echo' here, since Solaris 10 /bin/sh would try to optimize
+  # a `:' away after the first iteration, even if it is redirected.
+  echo dummy > not-skip
+  echo dummy > bail-out
+  $run_make check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=7 pass=4 fail=1 xpass=0 xfail=1 skip=0 error=1
+  grep '^PASS: 1\.test 1 - mu$' stdout
+  grep '^FAIL: 1\.test 2 zardoz$' stdout
+  test `$FGREP -c '1.test' stdout` -eq 2
+  grep '^PASS: 2\.test 1$' stdout
+  grep '^XFAIL: 2\.test 2 # TODO not implemented$' stdout
+  grep '^PASS: 2\.test 3$' stdout
+  test `$FGREP -c '2.test' stdout` -eq 3
+  grep '^PASS: 3\.test 1 - blah blah blah$' stdout
+  grep '^# 3\.test: Some diagnostic$' stdout
+  grep '^ERROR: 3\.test - Bail out! Kernel Panic$' stdout
+  test `$FGREP -c '3.test' stdout` -eq 3
+
+  cd $srcdir
+
+done
+
+$MAKE distcheck
+
+:
diff --git a/tests/tap-more2.test b/tests/tap-more2.test
new file mode 100755 (executable)
index 0000000..b1031f2
--- /dev/null
@@ -0,0 +1,91 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# More on TAP support:
+#  - more LOG_COMPILER at once for TAP tests
+#  - binary programs in $(TESTS)
+#  - interactions with `check_*' variables
+
+required='cc native'
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+cat >> configure.in <<END
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .sh .tap
+
+tap_driver = $(srcdir)/tap-driver
+
+LOG_DRIVER = $(tap_driver)
+SH_LOG_DRIVER = $(tap_driver)
+TAP_LOG_DRIVER = $(tap_driver)
+
+TAP_LOG_COMPILER = cat
+SH_LOG_COMPILER = $(SHELL)
+LOG_COMPILER =
+
+EXTRA_DIST = baz.tap
+
+check_SCRIPTS = bar.sh
+bar.sh: Makefile
+       echo '#!/bin/sh' > $@-t
+       echo 'echo 1..1' >> $@-t
+       echo 'echo "not ok 1 # TODO"' >> $@-t
+       chmod a-w $@-t && mv -f $@-t $@
+CLEANFILES = bar.sh
+
+check_PROGRAMS = foo-test
+foo_test_SOURCES = foo.c
+
+TESTS = foo-test $(check_SCRIPTS) baz.tap
+
+EXTRA_DIST += tap-driver
+END
+
+cat > foo.c <<'END'
+#include <stdio.h>
+int main (void)
+{
+  printf ("1..1\n");
+  printf ("ok 1\n");
+  return 0;
+}
+END
+
+cat > baz.tap << 'END'
+1..1
+ok 1 # SKIP
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+for target in check distcheck; do
+  $MAKE $target >stdout || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=3 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=0
+done
+
+:
diff --git a/tests/tap-msg0-bailout.test b/tests/tap-msg0-bailout.test
new file mode 100755 (executable)
index 0000000..9e326b4
--- /dev/null
@@ -0,0 +1,38 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - literal strings "0" and "0.0" as a test description in the message
+#    of a "plan with skip" TAP plan
+# generally true!
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+echo 'Bail out! 0' > a.test
+echo 'Bail out! 0.0' > b.test
+
+TESTS='a.test b.test' $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=2
+
+grep '^ERROR: a.test - Bail out! 0$' stdout
+grep '^ERROR: b.test - Bail out! 0\.0$' stdout
+
+:
diff --git a/tests/tap-msg0-directive.test b/tests/tap-msg0-directive.test
new file mode 100755 (executable)
index 0000000..a61cbf8
--- /dev/null
@@ -0,0 +1,41 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - literal string "0" as a TODO or SKIP message
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test << 'END'
+1..3
+ok 1 # TODO 0
+not ok 2 # TODO 0
+ok 3 # SKIP 0
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=3 pass=0 fail=0 xpass=1 xfail=1 skip=1 error=0
+
+grep '^XPASS: all\.test 1 # TODO 0$' stdout
+grep '^XFAIL: all\.test 2 # TODO 0$' stdout
+grep '^SKIP: all\.test 3 # SKIP 0$' stdout
+
+:
diff --git a/tests/tap-msg0-misc.test b/tests/tap-msg0-misc.test
new file mode 100755 (executable)
index 0000000..6202689
--- /dev/null
@@ -0,0 +1,82 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - literal "0" and "0.0" in a test description and a TODO/SKIP message
+#    at the same time
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test << 'END'
+1..14
+
+ok 1 0
+ok 2 0.0
+
+ok 3 0   # TODO 0
+ok 4 0.0 # TODO 0
+ok 5 0   # TODO 0.0
+ok 6 0.0 # TODO 0.0
+
+not ok 7 0   # TODO 0
+not ok 8 0.0 # TODO 0
+not ok 9 0   # TODO 0.0
+not ok 10 0.0 # TODO 0.0
+
+ok 11 0   # SKIP 0
+ok 12 0.0 # SKIP 0
+ok 13 0   # SKIP 0.0
+ok 14 0.0 # SKIP 0.0
+
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=14 pass=2 fail=0 xpass=4 xfail=4 skip=4 error=0
+
+sed '/^ *$/d' > exp << 'END'
+
+PASS: all.test 1 0
+PASS: all.test 2 0.0
+
+XPASS: all.test 3 0 # TODO 0
+XPASS: all.test 4 0.0 # TODO 0
+XPASS: all.test 5 0 # TODO 0.0
+XPASS: all.test 6 0.0 # TODO 0.0
+
+XFAIL: all.test 7 0 # TODO 0
+XFAIL: all.test 8 0.0 # TODO 0
+XFAIL: all.test 9 0 # TODO 0.0
+XFAIL: all.test 10 0.0 # TODO 0.0
+
+SKIP: all.test 11 0 # SKIP 0
+SKIP: all.test 12 0.0 # SKIP 0
+SKIP: all.test 13 0 # SKIP 0.0
+SKIP: all.test 14 0.0 # SKIP 0.0
+
+END
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-msg0-planskip.test b/tests/tap-msg0-planskip.test
new file mode 100755 (executable)
index 0000000..d10acc3
--- /dev/null
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - literal strings "0" and "0.0" as the reason of the skip in a "TAP
+#    plan with skip" (i.e., "1..0 # SKIP ...").
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+echo '1..0 # SKIP 0' > a.test
+echo '1..0 # SKIP 0.0' > b.test
+
+TESTS='a.test b.test' $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=0
+
+grep '^SKIP: a.test - 0$' stdout
+grep '^SKIP: b.test - 0\.0$' stdout
+
+:
diff --git a/tests/tap-msg0-result.test b/tests/tap-msg0-result.test
new file mode 100755 (executable)
index 0000000..c616a8a
--- /dev/null
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - the string "0" as a test description
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test << 'END'
+1..10
+ok 1 0
+ok - 0
+not ok 3 0
+not ok - 0
+ok 5 0 # TODO
+ok - 0 # TODO
+not ok 7 0 # TODO
+not ok - 0 # TODO
+ok 9 0 # SKIP
+ok - 0 # SKIP
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=10 pass=2 fail=2 xpass=2 xfail=2 skip=2 error=0
+
+cat > exp << 'END'
+PASS: all.test 1 0
+PASS: all.test 2 - 0
+FAIL: all.test 3 0
+FAIL: all.test 4 - 0
+XPASS: all.test 5 0 # TODO
+XPASS: all.test 6 - 0 # TODO
+XFAIL: all.test 7 0 # TODO
+XFAIL: all.test 8 - 0 # TODO
+SKIP: all.test 9 0 # SKIP
+SKIP: all.test 10 - 0 # SKIP
+END
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-negative-numbers.test b/tests/tap-negative-numbers.test
new file mode 100755 (executable)
index 0000000..944803d
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - don't spuriously recognize negative TAP result numbers, but correctly
+#    interpret them as test descriptions instead
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+1..7
+ok -1
+not ok -3
+ok -2 # SKIP
+not ok -5 # TODO
+ok -04 # TODO
+ok -121
+not ok -50000
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=7 pass=2 fail=2 xpass=1 xfail=1 skip=1 error=0
+
+cat > exp <<'END'
+PASS: all.test 1 -1
+FAIL: all.test 2 -3
+SKIP: all.test 3 -2 # SKIP
+XFAIL: all.test 4 -5 # TODO
+XPASS: all.test 5 -04 # TODO
+PASS: all.test 6 -121
+FAIL: all.test 7 -50000
+END
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-no-disable-hard-error.test b/tests/tap-no-disable-hard-error.test
new file mode 100755 (executable)
index 0000000..0ea4409
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - "Bail out!" magic and TAP parse errors are not disabled nor turned
+#    into simple failures by the definition DISABLE_HARD_ERRORS.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+DISABLE_HARD_ERRORS = yes
+TEST_LOG_COMPILER = cat
+TESTS = bail.test few.test noplan.test
+END
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > bail.test <<END
+1..1
+Bail out!
+END
+
+cat > few.test <<END
+1..1
+END
+
+cat > noplan.test <<END
+# nothing here
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=3
+
+:
diff --git a/tests/tap-no-merge-stdout-stderr.test b/tests/tap-no-merge-stdout-stderr.test
new file mode 100755 (executable)
index 0000000..a7a0da0
--- /dev/null
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - By default, TAP input is only from the stdout (and not the stderr)
+#    of the test command.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER_FLAGS = --comments
+TESTS = all.test
+END
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+#!/bin/sh
+echo 1..2
+echo 'not ok' >&2
+echo 'not ok 1 # TODO' >&2
+echo 'ok 1'
+echo '# foo foo foo'
+echo '# bar bar bar' >&2
+echo 'ok 44 # TODO' >&2
+echo 'Bail out!' >&2
+echo 'ok 2 # SKIP'
+END
+
+chmod a+x all.test
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 skip=1 error=0
+$FGREP 'foo foo foo' stdout
+$FGREP 'bar bar bar' stdout && Exit 1
+
+:
diff --git a/tests/tap-no-spurious-numbers.test b/tests/tap-no-spurious-numbers.test
new file mode 100755 (executable)
index 0000000..0c49995
--- /dev/null
@@ -0,0 +1,99 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - we shouldn't spuriously recognize as TAP result numbers what it
+#    not, even if it seems pretty close
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > prefixes <<'END'
+A
+a
+_
++
+-
+=
+/
+*
+.
+:
+,
+;
+$
+@
+%
+&
+#
+?
+!
+|
+\
+"
+`
+'
+(
+)
+[
+]
+{
+}
+<
+>
+END
+
+n=`wc -l <prefixes`
+
+# See the loop below to understand this initialization.
+pass=`expr $n '*' 3`
+fail=$pass
+skip=`expr $pass - 3`
+xfail=$skip
+xpass=$xfail
+error=0
+total=`expr $pass + $fail + $skip + $xfail + $xpass`
+
+echo 1..$total > all.test
+
+highno=1000
+
+for result in 'ok' 'not ok'; do
+  for spacing in "" " " "$tab"; do
+    subst="$result &$spacing$higno"
+    sed -e "s|.*|$subst|" prefixes
+    for directive in TODO SKIP; do
+      test "$result $directive" != "not ok SKIP" || continue
+      sed -e '/^#$/d' -e "s|.*|$subst # $directive|" prefixes
+    done
+  done
+done >> all.test
+
+cat all.test # For debugging.
+
+# Sanity checks.
+grep '#.*#' all.test && framework_failure_ "creating all.test"
+test `wc -l <all.test` -lt $highno || framework_failure_ "creating all.test"
+
+$MAKE check >stdout || :
+cat stdout
+
+count_test_results total=$total pass=$pass fail=$fail skip=$skip \
+                   xpass=$xpass xfail=$xfail error=$error
+
+:
diff --git a/tests/tap-no-spurious-summary.test b/tests/tap-no-spurious-summary.test
new file mode 100755 (executable)
index 0000000..12b54b5
--- /dev/null
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - `:test-results:' directives in test scripts' output doesn't
+#    originate spurious results in the testsuite summary
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+1..1
+:test-result: PASS
+:test-result: FAIL
+:test-result: XPASS
+:test-result: XFAIL
+:test-result: SKIP
+:test-result: ERROR
+:test-result: UNKNOWN
+ok 1
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+for result in PASS FAIL XPASS XFAIL SKIP ERROR UNKNOWN; do
+  grep "^ *:test-result: $result$" all.log
+done
+
+:
diff --git a/tests/tap-no-spurious.test b/tests/tap-no-spurious.test
new file mode 100755 (executable)
index 0000000..c2d5bc5
--- /dev/null
@@ -0,0 +1,114 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - don't spuriously recognize lines that are "almost" TAP lines as
+#    real TAP lines
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+echo 1..5 > all.test
+
+# The only recognized directives are "TODO" and "SKIP".
+# So the following should count as passed tests.
+cat >> all.test <<END
+ok 1 # XFAIL
+ok 2 # SKIPPED
+ok 3 # TO DO
+ok 4 # TODOALL
+ok 5 # FIXME
+END
+
+# According to documentation of Test::Harness::TAP(3):
+#
+#  ``Lines written to standard output matching /^(not )?ok\b/
+#    must be interpreted as test lines. All other lines must
+#    not be considered test output.''
+
+cat >> all.test <<END
+ ok
+ ok 1
+${tab}ok
+${tab}ok 1
+ not ok
+ not ok 1
+${tab}not ok
+${tab}not ok 1
+notok
+notok 1
+not${tab}ok
+not${tab}ok 1
+not  ok
+not  ok 1
+no ok
+no ok 1
+# ok
+# not ok
+# ok 1
+# not ok 1
+#ok
+#not ok
+#ok 1
+#not ok 1
+END
+
+set +x # Don't pollute logs too much.
+for r in 'ok' 'not ok'; do
+  for s1 in \
+    a b c d e f g h i j k l m n o p q r s t u v w x y z \
+    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
+    0 1 2 3 4 5 6 7 8 9 _ ab 0a 23 a1B2c _o _x_y_
+  do
+    for s2 in '' @ % + - = / . : \; \* \? \& \! \# \$ \< \> \\; do
+      printf '%s\n' "$r$s1$s2"
+    done
+  done
+done >> all.test
+set -x # Reset shell xtraces.
+
+# The prove(1) utility doesn't bail out on these, so our driver
+# shouldn't either.
+# See comments in `tap-bailout-leading-space.test' for an explanation
+# of why we don't have a whitespace-prepended "Bail out!" line here.
+cat >> all.test <<'END'
+bailout
+bailout!
+bail out
+bail out!
+Bailout
+Bailout!
+Bail out
+ Bail out
+#Bail out!
+# Bail out!
+END
+
+cat all.test # For debugging.
+
+# Minor sanity check.
+test `grep -c '^ok1$' all.test` -eq 1 \
+  && test `grep -c '^not ok1$' all.test` -eq 1 \
+  || framework_failure_ "creating all.test"
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=5 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+:
diff --git a/tests/tap-not-ok-skip.test b/tests/tap-not-ok-skip.test
new file mode 100755 (executable)
index 0000000..10597ef
--- /dev/null
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - a "not ok # SKIP" line should count as a failure, for consistency
+#    with the prove(1) utility.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+1..4
+not ok # SKIP
+not ok 2 # SKIP
+not ok - foo # SKIP
+not ok 4 - bar # SKIP
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=4 pass=0 fail=4 skip=0 xpass=0 xfail=0 error=0
+
+:
diff --git a/tests/tap-number-wordboundary.test b/tests/tap-number-wordboundary.test
new file mode 100755 (executable)
index 0000000..63c04e6
--- /dev/null
@@ -0,0 +1,112 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - TAP result numbers terminated by a non-whitespace "word boundary"
+#    character are recognized
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+1..5
+ok 1: foo1
+not ok 2- foo2
+ok 3@ foo3 # SKIP
+not ok 4?&%$ foo4 # TODO
+ok 5"`!! foo5 # TODO
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=5 pass=1 fail=1 skip=1 xpass=1 xfail=1 error=0
+
+$EGREP '^PASS: all\.test 1 ?: foo1$' stdout
+$EGREP '^FAIL: all\.test 2 ?- foo2$' stdout
+$EGREP '^SKIP: all\.test 3 ?@ foo3 # SKIP$' stdout
+$EGREP '^XFAIL: all\.test 4 ?\?&%\$ foo4 # TODO$' stdout
+$EGREP '^XPASS: all\.test 5 ?"`!! foo5 # TODO$' stdout
+
+cat > all.test <<'END'
+1..3
+ok 2: quux
+not ok 1!
+ok 476$ # SKIP
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=3 pass=0 fail=0 skip=0 xpass=0 xfail=0 error=3
+
+$EGREP '^ERROR: all\.test 2 ?: quux # OUT-OF-ORDER \(expecting 1\)$' stdout
+$EGREP '^ERROR: all\.test 1 ?! # OUT-OF-ORDER \(expecting 2\)$' stdout
+$EGREP '^ERROR: all\.test 476 ?\$ # OUT-OF-ORDER \(expecting 3\)$' stdout
+
+cat > punctuation <<'END'
+'
+"
+`
+#
+$
+!
+\
+/
+&
+%
+(
+)
+|
+^
+~
+?
+*
++
+-
+,
+:
+;
+=
+<
+>
+@
+[
+]
+{
+}
+\
+END
+
+# Strip any extra whitespace, for Solaris' wc.
+planned=`wc -l <punctuation | tr -d " $tab"`
+
+echo 1..$planned > all.test
+awk '{print "ok " NR $0 }' punctuation >> all.test
+# For debugging.
+cat all.test
+# Sanity check.
+grep "^ok 1'$" all.test || framework_failure_ "creating all.test"
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=$planned pass=$planned \
+                   fail=0 skip=0 xpass=0 xfail=0 error=0
+
+:
diff --git a/tests/tap-numbers-leading-zero.test b/tests/tap-numbers-leading-zero.test
new file mode 100755 (executable)
index 0000000..a58132e
--- /dev/null
@@ -0,0 +1,109 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - how does TAP result numbers with leading zero fares?
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+do_checks ()
+{
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results "$@"
+  # Allow some normalization of leading zeros, without forcing it.
+  LC_ALL=C sed -n 's/: all\.test 0*\([0-9]\)/: all.test \1/p' stdout > got
+  cat exp
+  cat got
+  diff exp got
+}
+
+cat > all.test <<END
+1..15
+
+ok 01
+ok 0002
+
+not ok 03
+not ok 0004
+
+ok 05 # SKIP
+ok 0006 # SKIP
+
+not ok 07 # TODO
+not ok 0008 # TODO
+
+ok 009
+ok 010
+
+ok 00000011
+not ok 0012
+ok 00000013 # SKIP
+not ok 0014 # TODO
+ok 00000015 # TODO
+END
+
+cat > exp <<END
+PASS: all.test 1
+PASS: all.test 2
+FAIL: all.test 3
+FAIL: all.test 4
+SKIP: all.test 5 # SKIP
+SKIP: all.test 6 # SKIP
+XFAIL: all.test 7 # TODO
+XFAIL: all.test 8 # TODO
+PASS: all.test 9
+PASS: all.test 10
+PASS: all.test 11
+FAIL: all.test 12
+SKIP: all.test 13 # SKIP
+XFAIL: all.test 14 # TODO
+XPASS: all.test 15 # TODO
+END
+
+do_checks total=15 pass=5 fail=3 xpass=1 xfail=3 skip=3 error=0
+
+cat > all.test <<END
+1..8
+
+ok 010
+not ok 003
+ok 0001 # SKIP
+not ok 010 # TODO
+ok 00100 # TODO
+
+ok 06
+ok 00007
+ok 8
+END
+
+cat > exp <<END
+ERROR: all.test 10 # OUT-OF-ORDER (expecting 1)
+ERROR: all.test 3 # OUT-OF-ORDER (expecting 2)
+ERROR: all.test 1 # OUT-OF-ORDER (expecting 3)
+ERROR: all.test 10 # OUT-OF-ORDER (expecting 4)
+ERROR: all.test 100 # OUT-OF-ORDER (expecting 5)
+PASS: all.test 6
+PASS: all.test 7
+PASS: all.test 8
+END
+
+do_checks total=8 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=5
+
+:
diff --git a/tests/tap-numeric-description.test b/tests/tap-numeric-description.test
new file mode 100755 (executable)
index 0000000..7fcb685
--- /dev/null
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP result lines whose description is a number.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+# Some random numbers to be used as test names.  The definitions below are
+# selected so that $x<n> != <n> for every n >= 1.  We can't use positional
+# parameters for this unfortunately, since Solaris 10 /bin/sh doesn't allow
+# the dereferencing of parameters from ${10} onwards.
+x1=5 x2=7 x3=45 x4=11 x5=7 x6=3 x7=6 x8=9 x9=1000 x10=1
+
+cat > all.test <<END
+1..10
+ok 1 ${x1}
+ok - ${x2}
+not ok 3 ${x3}
+not ok - ${x4}
+ok 5 ${x5} # SKIP
+ok - ${x6} # SKIP
+not ok 7 ${x7} # TODO
+not ok - ${x8} # TODO
+ok 9 ${x9} # TODO
+ok - ${x10} # TODO
+END
+
+cat > exp <<END
+PASS: all.test 1 ${x1}
+PASS: all.test 2 - ${x2}
+FAIL: all.test 3 ${x3}
+FAIL: all.test 4 - ${x4}
+SKIP: all.test 5 ${x5} # SKIP
+SKIP: all.test 6 - ${x6} # SKIP
+XFAIL: all.test 7 ${x7} # TODO
+XFAIL: all.test 8 - ${x8} # TODO
+XPASS: all.test 9 ${x9} # TODO
+XPASS: all.test 10 - ${x10} # TODO
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=10 pass=2 fail=2 xpass=2 xfail=2 skip=2 error=0
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+
+:
diff --git a/tests/tap-out-of-order.test b/tests/tap-out-of-order.test
new file mode 100755 (executable)
index 0000000..0e3beba
--- /dev/null
@@ -0,0 +1,81 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - out-of-order test results
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > a.test <<END
+1..3
+ok
+not ok 2 # TODO
+ok 71
+END
+
+cat > b.test <<END
+1..5
+ok 1
+ok 2
+ok 4 foo # SKIP mu
+not ok 2 bar # TODO um
+ok 5
+END
+
+cat > c.test <<END
+1..4
+ok 1
+ok foo
+ok 4 - zardoz
+not ok 3
+END
+
+# This is documented as an "test out of sequence" error in the
+# TAP::Parser documentation.  Keep it in sync with the example
+# there.
+cat > d.test <<'END'
+1..5
+ok 1
+ok 2
+ok 15
+ok 16
+ok 17
+END
+
+TESTS='a.test b.test c.test d.test' $MAKE -e check >stdout \
+  && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=17 pass=8 fail=0 xpass=0 xfail=1 skip=0 error=8
+
+test `$FGREP -c ': a.test' stdout` -eq 3
+test `$FGREP -c ': b.test' stdout` -eq 5
+test `$FGREP -c ': c.test' stdout` -eq 4
+test `$FGREP -c ': d.test' stdout` -eq 5
+
+grep '^ERROR: a\.test 71 # OUT-OF-ORDER (expecting 3)$' stdout
+grep '^ERROR: b\.test 4 foo # OUT-OF-ORDER (expecting 3)$' stdout
+grep '^ERROR: b\.test 2 bar # OUT-OF-ORDER (expecting 4)$' stdout
+grep '^ERROR: c\.test 4 - zardoz # OUT-OF-ORDER (expecting 3)$' stdout
+grep '^ERROR: c\.test 3 # OUT-OF-ORDER (expecting 4)$' stdout
+grep '^ERROR: d\.test 15 # OUT-OF-ORDER (expecting 3)$' stdout
+grep '^ERROR: d\.test 16 # OUT-OF-ORDER (expecting 4)$' stdout
+grep '^ERROR: d\.test 17 # OUT-OF-ORDER (expecting 5)$' stdout
+
+:
diff --git a/tests/tap-passthrough-exit.test b/tests/tap-passthrough-exit.test
new file mode 100755 (executable)
index 0000000..a232601
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - non-success exit status of a test script is reported in the
+#    log file
+# See also related test 'tap-passthrough.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+TEST_LOG_COMPILER = $(SHELL)
+TESTS =
+END
+
+exit_statuses='1 2 77 99'
+
+for e in $exit_statuses; do
+  unindent > exit-$e.test <<END
+    #!/bin/sh
+    echo 1..1
+    echo ok 1
+    exit $e
+END
+  echo TESTS += exit-$e.test >> Makefile.am
+done
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+st=0
+$MAKE check || st=$?
+for e in $exit_statuses; do cat exit-$e.log; done
+cat test-suite.log
+test $st -gt 0 || Exit 1
+
+for e in $exit_statuses; do
+  for log in exit-$e.log test-suite.log; do
+    grep "^ERROR: exit-$e\\.test - exited with status $e$" $log
+  done
+done
+
+env TEST_LOG_DRIVER_FLAGS='--ignore-exit' $MAKE -e check
+$FGREP ".test - exited with status" *.log && Exit 1
+
+:
diff --git a/tests/tap-passthrough.test b/tests/tap-passthrough.test
new file mode 100755 (executable)
index 0000000..28501cd
--- /dev/null
@@ -0,0 +1,166 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - all input (valid TAP lines, invalid TAP lines, non-TAP lines)
+#    are passed through in the log file
+#  - TAP errors are reported in the log file too
+# See also related test 'tap-passthrough-exit.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+weirdchars=\''"\$@!&()[]<>#;,:.^?*/'
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+#
+# Only successful tests.
+#
+
+# The whitespace in this test might be normalized in the testsuite
+# progress output, but should be copied verbatim in the log files.
+cat > ok.test <<END
+1..6
+TAP plan in the previous line.
+ok${tab}
+ok     2
+ok - foo
+ok 4 - x
+  This is not a TAP line, but should still be copied in the log file!
+# some diagnostic${tab}
+not ok # TODO low priority
+ok # SKIP who cares?
+$weirdchars
+END
+
+TESTS=ok.test $MAKE -e check || { cat ok.log; Exit 1; }
+cat ok.log
+
+for rx in \
+  '1\.\.6' \
+  'TAP plan in the previous line\.' \
+  "ok${tab}" \
+  'ok     2' \
+  'ok - foo' \
+  'ok 4 - x' \
+  '  This is not a TAP line, but should still be copied in the log file!' \
+  "# some diagnostic${tab}" \
+  'not ok # TODO low priority' \
+  'ok # SKIP who cares?' \
+; do
+  grep "^$rx$" ok.log
+done
+$FGREP "$weirdchars" ok.log
+
+#
+# Mixed failing/successful tests.
+#
+
+cat > tiny.test <<END
+1..1
+ok
+END
+
+cat > ok.test <<END
+1..1
+ok
+only one success here
+END
+
+cat > ko.test <<END
+1..5
+foo foo foo
+ok${tab}
+ok     2
+not ok - foo
+not ok 4 - x
+# diagnostic ko
+  bar${tab}bar${tab}bar
+ok # TODO dunno
+$weirdchars
+END
+
+cat > bail.test <<END
+Bail out! Test is taking too long!
+END
+
+cat > skip.test <<END
+1..0 # Skipped: WWW::Mechanize not installed
+END
+
+cat > err.test <<END
+1..3
+ok 1
+Invalid test count
+ok 23
+Misplaced plan
+1..13
+ok
+Extra test
+ok
+Last line
+END
+
+st=0
+env TESTS='tiny.test ok.test ko.test bail.test skip.test err.test' \
+  $MAKE -e check || st=$?
+cat tiny.log
+cat ok.log
+cat ko.log
+cat bail.log
+cat skip.log
+cat err.log
+test $st -gt 0 || Exit 1
+
+grep '^1\.\.1$' tiny.log
+grep '^ok$' tiny.log
+grep '^only one success here$' ok.log
+
+for rx in \
+  '1\.\.5' \
+  'foo foo foo' \
+  "ok${tab}" \
+  'ok     2' \
+  'not ok - foo' \
+  'not ok 4 - x' \
+  '# diagnostic ko' \
+  "  bar${tab}bar${tab}bar" \
+  'ok # TODO dunno' \
+; do
+  grep "^$rx$" ko.log
+done
+$FGREP "$weirdchars" ko.log
+
+grep '^Bail out! Test is taking too long!$' bail.log
+grep '^1\.\.0 # Skipped: WWW::Mechanize not installed$' skip.log
+
+for rx in \
+  '^1\.\.3$' \
+  '^Invalid test count$' \
+  '^ok 23$' \
+  '^Misplaced plan$' \
+  '^1\.\.13$' \
+  '^ERROR:.* multiple test plans' \
+   '^Extra test$' \
+  '^Last line$' \
+  '^ERROR:.* [tT]oo many tests run.*expected 3, got 4' \
+  '^ERROR:.* err\.test 23 .*OUT[ -]OF[ -]ORDER.*expecting 2' \
+; do
+  grep "$rx" err.log
+done
+
+:
diff --git a/tests/tap-plan-corner.test b/tests/tap-plan-corner.test
new file mode 100755 (executable)
index 0000000..7718930
--- /dev/null
@@ -0,0 +1,198 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - some corner cases for TAP plan
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+# -------------------------------------------------------------------------
+
+cat > leading-repeated.test <<END
+1..1
+1..1
+ok 1
+END
+
+cat > trailing-repeated.test <<END
+ok 1
+1..1
+1..1
+END
+
+for pos in leading trailing; do
+  TESTS="$pos-repeated.test" $MAKE -e check >stdout \
+    && { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1
+  grep "^ERROR: $pos-repeated\\.test - multiple test plans$" stdout
+done
+
+# -------------------------------------------------------------------------
+
+cat > leading-repeated.test <<END
+1..2
+ok 1
+1..2
+ok 2
+END
+
+cat > trailing-repeated.test <<END
+ok 1
+1..2
+ok 2
+1..2
+END
+
+env TESTS="leading-repeated.test trailing-repeated.test" \
+  $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=6 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=3
+grep "^ERROR: leading-repeated\\.test - multiple test plans$" stdout
+grep "^ERROR: trailing-repeated\\.test - multiple test plans$" stdout
+grep "^ERROR: trailing-repeated\\.test 2 # AFTER LATE PLAN$" stdout
+grep "leading .*AFTER LATE PLAN" stdout && Exit 1
+
+# -------------------------------------------------------------------------
+
+cat > 1.test <<END
+1..0
+1..0
+END
+
+cat > 2.test <<END
+1..0 # SKIP
+1..0
+END
+
+cat > 3.test <<END
+1..0
+1..0 # SKIP
+END
+
+cat > 4.test <<END
+1..0 # SKIP
+1..0 # SKIP
+END
+
+env TESTS="1.test 2.test 3.test 4.test" \
+  $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=8 pass=0 fail=0 xpass=0 xfail=0 skip=4 error=4
+for i in 1 2 3 4; do
+  grep "^ERROR: $i\\.test - multiple test plans$" stdout
+done
+
+# -------------------------------------------------------------------------
+
+cat > all.test <<END
+1..5
+ok 1
+ok 2
+1..5
+ok 3
+1..5
+ok 4
+1..5
+ok 5
+END
+
+$MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=8 pass=5 fail=0 xpass=0 xfail=0 skip=0 error=3
+
+cat > exp <<'END'
+PASS: all.test 1
+PASS: all.test 2
+ERROR: all.test - multiple test plans
+PASS: all.test 3
+ERROR: all.test - multiple test plans
+PASS: all.test 4
+ERROR: all.test - multiple test plans
+PASS: all.test 5
+END
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+# -------------------------------------------------------------------------
+
+cat > all.test <<END
+1..2
+ok 1
+ok 2
+1..3
+ok 3
+END
+
+$MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=5 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=3
+
+cat > exp <<'END'
+PASS: all.test 1
+PASS: all.test 2
+ERROR: all.test - multiple test plans
+ERROR: all.test 3 # UNPLANNED
+ERROR: all.test - too many tests run (expected 2, got 3)
+END
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+# -------------------------------------------------------------------------
+
+cat > all.test <<END
+ok 1
+ok 2
+ok 3
+1..5
+1..5
+ok 4
+1..5
+ok 5
+END
+
+$MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=7 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=4
+
+cat > exp <<'END'
+PASS: all.test 1
+PASS: all.test 2
+PASS: all.test 3
+ERROR: all.test - multiple test plans
+ERROR: all.test 4 # AFTER LATE PLAN
+ERROR: all.test - multiple test plans
+ERROR: all.test 5 # AFTER LATE PLAN
+END
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-plan-errors.test b/tests/tap-plan-errors.test
new file mode 100755 (executable)
index 0000000..e3c02c8
--- /dev/null
@@ -0,0 +1,114 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support: the following situations should be flagged as errors:
+#  - unmatched test plan (too few tests run)
+#  - multiple test plans
+#  - missing test plan
+#  - misplaced test plan (tests run after a late plan)
+# Checks about unplanned tests are performed in 'tap-unplanned.test'
+# and 'tap-skip-whole-badcount.test'.  More checks about corner-cases
+# in TAP plans are performed in 'tap-plan-corner.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+my_check ()
+{
+  cat > all.test
+  test -n "$err" || fatal_ "\$err not set before calling my_check"
+  cat all.test # For debugging.
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results "$@"
+  grep "^ERROR: all\\.test $err$" stdout
+  unset err
+}
+
+err='- too few tests run (expected 2, got 1)'
+my_check total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1 <<END
+1..2
+ok 1
+END
+
+err='- too few tests run (expected 12, got 3)'
+my_check total=4 pass=2 fail=0 xpass=0 xfail=1 skip=0 error=1 <<END
+ok 1
+ok 2
+not ok 3 # TODO
+1..12
+END
+
+err='- too few tests run (expected 1, got 0)'
+my_check total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1 <<END
+1..1
+END
+
+err='2 # AFTER LATE PLAN'
+my_check total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1 <<END
+ok 1
+1..2
+ok 2
+END
+
+err='5 # AFTER LATE PLAN'
+my_check total=5 pass=4 fail=0 xpass=0 xfail=0 skip=0 error=1 <<END
+ok 1
+ok 2
+ok 3
+ok 4
+1..5
+ok 5
+END
+
+err='- missing test plan'
+my_check total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1 <<END
+ok 1
+END
+
+
+# The two test plans here are deliberately equal.
+err='- multiple test plans'
+my_check total=3 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=1 <<END
+1..2
+ok 1
+ok 2
+1..2
+END
+
+# The second plan is diagnosed as extra, and only the first one is
+# relevant w.r.t. the number of the expected test.
+err='- multiple test plans'
+my_check total=4 pass=3 fail=0 xpass=0 xfail=0 skip=0 error=1 <<END
+1..3
+ok 1
+ok 2
+1..2
+ok 3
+END
+
+# As above, in a slightly different situation.
+err='- multiple test plans'
+my_check total=3 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=1 <<END
+1..2
+ok 1
+ok 2
+1..4
+END
+
+:
diff --git a/tests/tap-plan-leading-zero.test b/tests/tap-plan-leading-zero.test
new file mode 100755 (executable)
index 0000000..14bf439
--- /dev/null
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - TAP plans with numbers having leading zeroes, as in "1..01"
+#  - TAP "SKIP" plans with multiple zeroes, as in "1..00 # SKIP"
+# This is consistent with the behaviour of the `prove' utility.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > a.test <<END
+1..01
+ok 1
+END
+
+cat > b.test <<END
+1..0002
+ok 1
+ok 2
+END
+
+echo 1..010 > c.test
+for i in 1 2 3 4 5 6 7 8 9 10; do echo ok $i; done >> c.test
+
+echo 1..00100 > d.test
+for i in 1 2 3 4 5 6 7 8 9 10; do
+  for j in 1 2 3 4 5 6 7 8 9 10; do
+    echo ok
+  done
+done >> d.test
+
+echo 1..00 > e.test
+echo '1..000 # SKIP' > f.test
+
+env TESTS='a.test b.test c.test d.test e.test f.test' \
+  $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=115 pass=113 xfail=0 skip=2 fail=0 xpass=0 error=0
+
+:
diff --git a/tests/tap-plan-malformed.test b/tests/tap-plan-malformed.test
new file mode 100755 (executable)
index 0000000..8b0fa8a
--- /dev/null
@@ -0,0 +1,60 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support: a malformed TAP plan is not recognized.  The checks in
+# here should be consistent with the behaviour of the `prove' utility.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > a.test <<END
+1..1 foo
+END
+
+cat > b.test <<END
+ 1..2
+ok 1
+ok 2
+END
+
+cat > c.test <<END
+1..1 # SKIP
+END
+
+cat > d.test <<END
+1..2 # foo bar
+not ok 1 # TODO
+not ok 2 # TODO
+END
+
+cat > e.test <<END
+0..0
+END
+
+tests_list=`echo *.test`
+
+TESTS="$tests_list" $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=9 pass=2 fail=0 xpass=0 xfail=2 skip=0 error=5
+
+for tst in $tests_list; do
+  grep "^ERROR: $tst - missing test plan$" stdout
+done
+
+:
diff --git a/tests/tap-plan-middle.test b/tests/tap-plan-middle.test
new file mode 100755 (executable)
index 0000000..7e90944
--- /dev/null
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - test plan preceding and/or following non-result TAP lines
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > top1.test <<END
+non-TAP line, ignored
+1..1
+ok 1
+END
+
+cat > top2.test <<END
+some
+non-TAP
+lines
+are
+ignored
+# and a TAP comment won't cause problems either
+1..2
+ok 1
+ok 2
+END
+
+# Try with a blank line too, just to be sure.
+cat > top3.test <<END
+
+1..1
+ok 1
+END
+
+cat > bot1.test <<END
+ok 1 # SKIP
+1..1
+bla blah blah ...
+END
+
+cat > bot2.test <<END
+ok 1
+ok 2
+not ok 3 # TODO
+1..3
+#@$%! (a cursing comment :-)
+END
+
+# Try with a blank line too, just to be sure.
+cat > bot3.test <<END
+ok 1
+not ok 2 # TODO
+ok 3 # SKIP
+ok 4 # SKIP
+1..4
+
+END
+
+tests=`echo *.test`
+
+for tap_flags in "" "--comments"; do
+  env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS="$tests" \
+    $MAKE -e check >stdout || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=12 pass=7 xfail=2 skip=3 fail=0 xpass=0 error=0
+done
+
+:
similarity index 60%
rename from tests/help-regex.test
rename to tests/tap-plan-whitespace.test
index 3eff5f9..c62f751 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 that obsolescent macro `AM_WITH_REGEX' adds proper text to
-# the configure help screen.
+# TAP support:
+#  - plan line with trailing whitespace is recognized and handled correctly
 
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
 
-cat > configure.in <<END
-AC_INIT([$me], [1.0])
-AM_WITH_REGEX
+sed 's/\$$//' > foo.test <<END
+1..2 $
+ok 1$
+ok 2$
 END
 
-$ACLOCAL
-$AUTOCONF
+cat > bar.test <<END
+1..1$tab   $tab$tab
+ok 1
+END
 
-./configure --help >stdout || { cat stdout; Exit 1; }
+TESTS='foo.test bar.test' $MAKE -e check >stdout || { cat stdout; Exit 1; }
 cat stdout
 
-$FGREP ' --without-regex ' stdout
-$FGREP ' use GNU rx ' stdout
+count_test_results total=3 pass=3 fail=0 error=0 xpass=0 xfail=0 skip=0
 
 :
diff --git a/tests/tap-plan.test b/tests/tap-plan.test
new file mode 100755 (executable)
index 0000000..6b0513a
--- /dev/null
@@ -0,0 +1,52 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - test scripts with the test plan at the beginning
+#  - test scripts with the test plan at the end
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > top.test <<END
+1..3
+ok 1
+ok 2 # SKIP
+ok 3
+# a trailing comment
+END
+
+cat > bot.test <<END
+ok 1
+# a comment
+ok 2
+not ok 3 # TODO
+# another comment
+ok
+1..4
+END
+
+for tap_flags in "" "--comments"; do
+  env TEST_LOG_DRIVER_FLAGS="$tap_flags" TESTS='top.test bot.test' \
+    $MAKE -e check >stdout || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=7 pass=5 xfail=1 skip=1 fail=0 xpass=0 error=0
+done
+
+
+:
diff --git a/tests/tap-planskip-and-logging.test b/tests/tap-planskip-and-logging.test
new file mode 100755 (executable)
index 0000000..9059a38
--- /dev/null
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - interactions between "TAP plan with SKIP" and logging of earlier or
+#    later TAP or non-TAP text
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+echo TEST_LOG_DRIVER_FLAGS = --comments >> Makefile
+
+cat > foo.test <<END
+1..0
+a non-TAP line
+# a comment
+END
+
+cat > foo2.test <<END
+a non-TAP line 2
+# a comment 2
+1..0
+END
+
+cat > bar.test <<END
+# an early comment
+an early non-TAP line
+ $tab
+1..0 # SKIP
+# a later comment
+a later non-TAP line
+END
+
+TESTS='foo.test foo2.test bar.test' $MAKE -e check >stdout \
+  || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=3 error=0
+
+grep '^# foo\.test: a comment$' stdout
+grep '^# foo2\.test: a comment 2$' stdout
+grep '^# bar\.test: an early comment$' stdout
+grep '^# bar\.test: a later comment$' stdout
+
+cat foo.log
+cat foo2.log
+cat bar.log
+
+grep '^a non-TAP line$' foo.log
+grep '^# a comment$' foo.log
+grep '^a non-TAP line 2$' foo2.log
+grep '^# a comment 2$' foo2.log
+grep '^# an early comment' bar.log
+grep '^an early non-TAP line$' bar.log
+grep '^# a later comment' bar.log
+grep '^a later non-TAP line$' bar.log
+grep "^ $tab$" bar.log
+
+:
diff --git a/tests/tap-planskip-badexit.test b/tests/tap-planskip-badexit.test
new file mode 100755 (executable)
index 0000000..9638867
--- /dev/null
@@ -0,0 +1,52 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - an exit status != 0 of a test script causes an hard error, even if
+#    the last line of output is a "SKIP plan" (e.g., "1..0 # SKIP").
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+echo TESTS = one.test two.test > Makefile.am
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > one.test <<'END'
+#!/bin/sh
+echo '1..0 # SKIP'
+exit 1
+END
+
+cat > two.test <<'END'
+#!/bin/sh
+echo '1..0'
+exit 22
+END
+
+chmod a+x one.test two.test
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+# The 'prove' utility reports both the skip and the non-zero exit status,
+# so we do the same.
+count_test_results total=4 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=2
+
+grep '^ERROR: one\.test - exited with status 1$' stdout
+grep '^ERROR: two\.test - exited with status 22$' stdout
+
+:
diff --git a/tests/tap-planskip-bailout.test b/tests/tap-planskip-bailout.test
new file mode 100755 (executable)
index 0000000..039de23
--- /dev/null
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - a "Bail out!" directive causes an hard error, even if coming after
+#    a "SKIP plan" (e.g., "1..0 # SKIP").
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+1..0 # SKIP
+Bail out!
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=1
+grep '^ERROR: all\.test - Bail out!' stdout
+
+:
diff --git a/tests/tap-planskip-case-insensitive.test b/tests/tap-planskip-case-insensitive.test
new file mode 100755 (executable)
index 0000000..6ae8b63
--- /dev/null
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - "SKIP" keyword in a TAP plan is case-insensitive
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+# These nested loops are clearer without indentation.
+
+i=0
+for c1 in s S; do
+for c2 in k K; do
+for c3 in i I; do
+for c4 in p P; do
+  i=`expr $i + 1`
+  case $i in ?) i=0$i; esac
+  echo "1..0 # $c1$c2$c3$c4 foobar" > $i.test
+done; done; done; done
+
+TESTS="`echo *.test`" $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=16 pass=0 fail=0 xpass=0 xfail=0 skip=16 error=0
+
+for tst in *.test; do
+  grep "^SKIP: $tst .* foobar$" stdout
+done
+
+:
diff --git a/tests/tap-planskip-late.test b/tests/tap-planskip-late.test
new file mode 100755 (executable)
index 0000000..a246bb9
--- /dev/null
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - the special "plan with SKIP" can also be used "late" in the TAP
+#    stream, i.e., preceded by non-TAP output or TAP diagnostic.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > foo.test <<END
+some non-TAP text, will be copied in the global log
+1..0 # SKIP from the last line
+END
+
+cat > bar.test <<END
+# some TAP diagnostic, will go to console
+1..0
+END
+
+TESTS='foo.test bar.test' $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+grep '^SKIP: foo\.test .* from the last line$' stdout
+grep '^SKIP: bar\.test$' stdout
+test `grep -c ': .*\.test' stdout` -eq 2
+count_test_results total=2 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=0
+
+:
diff --git a/tests/tap-planskip-later-errors.test b/tests/tap-planskip-later-errors.test
new file mode 100755 (executable)
index 0000000..cf935a1
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - TAP errors following a "TAP plan with SKIP" are still diagnosed.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+1..0
+a non-TAP line
+1..3
+1..5
+# a comment
+1..1
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=4 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=3
+test `grep -c '^ERROR: all\.test - multiple test plans' stdout` -eq 3
+
+:
diff --git a/tests/tap-planskip-unplanned-corner.test b/tests/tap-planskip-unplanned-corner.test
new file mode 100755 (executable)
index 0000000..a2ee90a
--- /dev/null
@@ -0,0 +1,48 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - test results seen in a TAP stream that has a "plan with SKIP" are
+#    flagged as errors, even if all of them are "SKIP" results.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > foo.test <<END
+1..0 # SKIP
+ok 1 # SKIP
+END
+
+cat > bar.test <<END
+ok 1 # SKIP
+1..0 # SKIP
+END
+
+TESTS='foo.test bar.test' $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=2 error=3
+
+# Don't be too strict w.r.t. the format of the "skip whole test" message.
+grep '^SKIP: foo\.test$' stdout || grep '^SKIP: foo\.test [^0-9]' stdout
+grep '^ERROR: foo\.test 1 # UNPLANNED$' stdout
+grep '^ERROR: foo\.test - too many tests run (expected 0, got 1)$' stdout
+grep '^SKIP: bar\.test 1 # SKIP$' stdout
+grep '^ERROR: bar\.test - too many tests run (expected 0, got 1)$' stdout
+
+:
diff --git a/tests/tap-planskip-unplanned.test b/tests/tap-planskip-unplanned.test
new file mode 100755 (executable)
index 0000000..c5e3ccb
--- /dev/null
@@ -0,0 +1,73 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - a "plan with skip" given after one or more test result have already
+#    been seen is an error
+#  - any test result following a "plan with skip" is an error.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+ok 1
+1..0 # SKIP too late
+END
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=2 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=1
+grep '^ERROR: all\.test - too many tests run (expected 0, got 1)$' stdout
+
+cat > all.test <<END
+ok 1
+ok 2 # SKIP
+not ok 3 # TODO
+1..0 # SKIP too late
+END
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=4 pass=1 fail=0 xpass=0 xfail=1 skip=1 error=1
+grep '^ERROR: all\.test - too many tests run (expected 0, got 3)$' stdout
+
+cat > all.test <<END
+1..0 # SKIP falsified later
+ok 1
+END
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=2
+grep '^ERROR: all\.test 1 # UNPLANNED$' stdout
+grep '^ERROR: all\.test - too many tests run (expected 0, got 1)$' stdout
+
+cat > all.test <<END
+1..0 # SKIP falsified later
+ok 1
+ok 2 # SKIP
+not ok 3
+not ok 4 # TODO
+END
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=5
+grep '^ERROR: all\.test 1 # UNPLANNED$' stdout
+grep '^ERROR: all\.test 2 # UNPLANNED$' stdout
+grep '^ERROR: all\.test 3 # UNPLANNED$' stdout
+grep '^ERROR: all\.test 4 # UNPLANNED$' stdout
+grep '^ERROR: all\.test - too many tests run (expected 0, got 4)$' stdout
+
+:
diff --git a/tests/tap-planskip-whitespace.test b/tests/tap-planskip-whitespace.test
new file mode 100755 (executable)
index 0000000..7962e19
--- /dev/null
@@ -0,0 +1,48 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - normalization of whitespace in console testsuite progress associated
+#    with a SKIP directive in the TAP plan
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > foo.test <<END
+1..0${tab}${tab}   #${tab}SKIP  ${tab}Strip leading & trailing ${tab}${tab}
+END
+
+cat > bar.test <<END
+1..0 #SKIP Preserve ${tab}  middle${tab}${tab}space
+END
+
+cat > baz.test <<END
+1..0 #  SKIP${tab}  Strip${tab}external  preserve ${tab}middle  ${tab}${sp}
+END
+
+TESTS='foo.test bar.test baz.test' $MAKE -e check > stdout \
+  || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=3 pass=0 fail=0 error=0 xpass=0 xfail=0 skip=3
+
+grep "SKIP: foo\\.test - Strip leading & trailing$" stdout
+grep "SKIP: bar\\.test - Preserve ${tab}  middle${tab}${tab}space" stdout
+grep "SKIP: baz\\.test - Strip${tab}external  preserve ${tab}middle" stdout
+
+:
diff --git a/tests/tap-planskip.test b/tests/tap-planskip.test
new file mode 100755 (executable)
index 0000000..0f24462
--- /dev/null
@@ -0,0 +1,78 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Basic TAP test protocol support:
+#  - special plan format to skip all the tests in a script
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+weirdchars=\''"$!&()[]<>#;^?*/@%=,.:'
+
+cat > foo.test <<END
+1..0
+END
+
+cat > bar.test <<END
+blah
+# blah
+1..0$tab $tab
+END
+
+# It is undefined whether the comment after the plan below should
+# count as an explanation; still, the test should be skipped.
+cat > baz.test <<END
+1..0 # WWW::Mechanize not installed
+other
+    junk
+       lines
+END
+
+cat > wget.test <<END
+1..0 # SKIP wget(1) not installed
+# See also curl.test
+END
+
+cat > curl.test <<END
+1..0 # SKIP: Can't connect to gnu.org!
+# See also wget.test
+END
+
+cat > mu.test <<END
+1..0 # SKIP $weirdchars
+END
+
+env TESTS='foo.test bar.test baz.test wget.test curl.test mu.test' \
+  $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=6 pass=0 fail=0 xpass=0 xfail=0 skip=6 error=0
+
+# Look for a regression where the "1..0" wasn't being stripped from the
+# SKIP message.
+$FGREP '1..0' stdout && Exit 1
+
+grep '^SKIP: foo\.test$' stdout
+grep '^SKIP: bar\.test$' stdout
+grep '^SKIP: baz\.test' stdout # Deliberately laxer, see above for why.
+grep '^SKIP: wget\.test .* wget(1) not installed$' stdout
+grep '^SKIP: curl\.test .* Can'\''t connect to gnu\.org!$' stdout
+grep '^SKIP: mu\.test' stdout | $FGREP "$weirdchars" stdout
+test `grep -c ': .*\.test' stdout` -eq 6
+
+:
diff --git a/tests/tap-realtime.test b/tests/tap-realtime.test
new file mode 100755 (executable)
index 0000000..d30af2e
--- /dev/null
@@ -0,0 +1,126 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# TAP support:
+#  - testsuite progress on console should happen mostly "in real time";
+#    i.e., it's not acceptable for the driver to wait the end of the
+#    script to start displaying results from it.
+# FIXME: this test uses expect(1) to ensure line buffering from make and
+# children, and is pretty hacky and complex; is there a better way to
+# accomplish the checks done here?
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >expect-check <<'END'
+eval spawn $env(SHELL) -c ":"
+expect eof
+END
+expect -f expect-check || {
+    echo "$me: failed to find a working expect program" >&2
+    Exit 77
+}
+rm -f expect-check
+
+# Unfortunately, some make implementations (among them, FreeBSD make,
+# NetBSD make, and Solaris Distributed make), when run in parallel mode,
+# serialize the output from their targets' recipes unconditionally.  In
+# such a situation, there's no way the partial results of a TAP test can
+# be displayed until the test has terminated.  And this is not something
+# our TAP driver script can work around; in fact, the driver *is* sending
+# out its output progressively and "in sync" with test execution -- it is
+# make that is stowing such output away instead of presenting it to the
+# user as soon as it gets it.
+if using_gmake; then :; else
+  case $MAKE in
+    *\ -j*) skip_ "doesn't with non-GNU concurrent make";;
+  esac
+  # Prevent Sun Distributed Make from trying to run in parallel.
+  DMAKE_MODE=serial; export DMAKE_MODE
+fi
+
+cat > Makefile.am << 'END'
+TESTS = all.test
+END
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+#! /bin/sh
+echo 1..3
+
+# Creative quoting to placate maintainer-check.
+sleep="sleep "3
+
+# The awk+shell implementation of the TAP driver must "read ahead" of one
+# line in order to catch the exit status of the test script it runs.  So
+# be sure to echo one "dummy" line after each result line in order not to
+# cause false positives.
+
+echo ok 1 - foo
+echo DUMMY
+$sleep
+test -f ok-1 || { echo 'Bail out!'; exit 1; }
+
+echo ok 2 - bar
+echo DUMMY
+$sleep
+test -f ok-2 || { echo 'Bail out!'; exit 1; }
+
+echo ok 3 - baz
+echo DUMMY
+$sleep
+test -f ok-3 || { echo 'Bail out!'; exit 1; }
+
+: > all-is-well
+END
+
+chmod a+x all.test
+
+cat > expect-make <<'END'
+eval spawn $env(MAKE) check
+expect {
+  "PASS: all.test 1 - foo" {
+    open "ok-1" "w"
+    exp_continue
+  }
+  "PASS: all.test 2 - bar" {
+    open "ok-2" "w"
+    exp_continue
+  }
+  "PASS: all.test 3 - baz" {
+    open "ok-3" "w"
+    exp_continue
+  }
+  "Testsuite summary" {
+    exit 0
+  }
+  timeout {
+    puts "expect timed out"
+    exit 1
+  }
+  default {
+    puts "expect error"
+    exit 1
+  }
+}
+END
+
+# Expect should simulate a tty as stdout, which should ensure a
+# line-buffered output.
+MAKE=$MAKE expect -f expect-make
+test -f all-is-well
+
+:
diff --git a/tests/tap-recheck-logs.test b/tests/tap-recheck-logs.test
new file mode 100755 (executable)
index 0000000..d7852c6
--- /dev/null
@@ -0,0 +1,119 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+# - RECHECK_LOGS
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+TEST_LOG_COMPILER = cat
+TESTS = foo.test bar.test baz.test
+baz.log: zardoz
+END
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+: > zardoz
+
+cat > foo.test <<'END'
+1..2
+ok 1
+ok 2
+END
+
+cat > bar.test <<'END'
+1..1
+not ok 1
+END
+
+cat > baz.test <<'END'
+1..1
+Bail out!
+END
+
+# Even the tests that are not re-run should contribute to the testsuite
+# summary when obtained by "make check RECHECK_LOGS=".
+grep_summary ()
+{
+  grep '^# TOTAL: *4$' stdout
+  grep '^# PASS: *2$' stdout
+  grep '^# XPASS: *0$' stdout
+  grep '^# FAIL: *1$' stdout
+  grep '^# XFAIL: *0$' stdout
+  grep '^# SKIP: *0$' stdout
+  grep '^# ERROR: *1$' stdout
+}
+
+$MAKE -e check && Exit 1
+test -f foo.log
+test -f bar.log
+test -f baz.log
+
+rm -f foo.log bar.log
+
+env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
+cat stdout
+test -f foo.log
+test -f bar.log
+grep '^PASS: foo\.test 1$' stdout
+grep '^PASS: foo\.test 2$' stdout
+grep '^FAIL: bar\.test 1$' stdout
+grep 'baz\.test' stdout && Exit 1
+grep_summary
+
+$sleep
+touch foo.test
+# We re-run only a successful test, but the tests that failed in the
+# previous run should still be taken into account, and cause an overall
+# failure.
+env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^PASS: foo\.test 1$' stdout
+grep '^PASS: foo\.test 2$' stdout
+grep 'ba[rz]\.test' stdout && Exit 1
+is_newest foo.log foo.test
+grep_summary
+
+$sleep
+touch zardoz
+env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^ERROR: baz\.test' stdout
+$EGREP '(foo|bar)\.test' stdout && Exit 1
+is_newest baz.log zardoz
+grep_summary
+
+# Now, explicitly retry with all test logs already updated, and ensure
+# that the summary is still displayed.
+env RECHECK_LOGS= $MAKE -e check > stdout && { cat stdout; Exit 1; }
+cat stdout
+$EGREP '(foo|bar|baz)\.test' stdout && Exit 1
+grep_summary
+
+# The following should re-run foo.test (and only foo.test), even if its
+# log file is up-to-date.
+: > older
+env RECHECK_LOGS=foo.log $MAKE -e check > stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^PASS: foo\.test 1$' stdout
+grep '^PASS: foo\.test 2$' stdout
+grep 'ba[rz]\.test' stdout && Exit 1
+is_newest foo.log older
+grep_summary
+
+:
diff --git a/tests/tap-recheck.test b/tests/tap-recheck.test
new file mode 100755 (executable)
index 0000000..09c17f4
--- /dev/null
@@ -0,0 +1,215 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test the 'recheck' target for TAP test protocol.
+# Keep in sync with 'test-driver-custom-multitest-recheck.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
+TESTS = a.test b.test c.test d.test
+END
+
+cat > a.test << 'END'
+#! /bin/sh
+echo 1..2
+echo ok 1
+echo ok 2
+: > a.run
+END
+
+cat > b.test << 'END'
+#! /bin/sh
+: > b.run
+echo 1..2
+echo ok 1
+if test -f b.ok; then
+  echo ok 2
+else
+  echo 'Bail out!'
+fi
+END
+
+cat > c.test << 'END'
+#! /bin/sh
+echo 1..3
+if test -f c.pass; then
+  echo 'ok - c is ok :-)'
+else
+  echo 'not ok - c is ko :-('
+fi
+if test -f c.xfail; then
+  echo 'not ok 2 # TODO'
+else
+  echo 'ok 2 # TODO'
+fi
+echo 'not ok 3 - blah blah # TODO need better diagnostic'
+: > c.run
+END
+
+cat > d.test << 'END'
+#! /bin/sh
+test -f ./d.count && . ./d.count
+echo 1..${test_count-2}
+echo ok 1 '# SKIP: who cares ...'
+(. ./d.extra) || echo 'not ok 2 - d.extra failed'
+: > d.run
+END
+
+chmod a+x *.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+do_recheck ()
+{
+  case $* in
+    --fail) on_bad_rc='&&';;
+    --pass) on_bad_rc='||';;
+         *) fatal_ "invalid usage of function 'do_recheck'";;
+  esac
+  rm -f *.run
+  eval "\$MAKE recheck >stdout $on_bad_rc { cat stdout; ls -l; Exit 1; }; :"
+  cat stdout; ls -l
+}
+
+for vpath in : false; do
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+
+  : A "make recheck" in a clean tree should run no tests.
+  do_recheck --pass
+  cat test-suite.log
+  test ! -r a.run
+  test ! -r a.log
+  test ! -r b.run
+  test ! -r b.log
+  test ! -r c.run
+  test ! -r c.log
+  test ! -r d.run
+  test ! -r d.log
+  count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+  : Run the tests for the first time.
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  ls -l
+  # All the test scripts should have run.
+  test -f a.run
+  test -f b.run
+  test -f c.run
+  test -f d.run
+  count_test_results total=9 pass=3 fail=2 xpass=1 xfail=1 skip=1 error=1
+
+  : Let us make b.test pass.
+  echo OK > b.ok
+  do_recheck --fail
+  # a.test has been successful the first time, so no need to re-run it.
+  # Similar considerations apply to similar checks, below.
+  test ! -r a.run
+  test -f b.run
+  test -f c.run
+  test -f d.run
+  count_test_results total=7 pass=2 fail=2 xpass=1 xfail=1 skip=1 error=0
+
+  : Let us make the first part of c.test pass.
+  echo OK > c.pass
+  do_recheck --fail
+  test ! -r a.run
+  test ! -r b.run
+  test -f c.run
+  test -f d.run
+  count_test_results total=5 pass=1 fail=1 xpass=1 xfail=1 skip=1 error=0
+
+  : Let us make also the second part of c.test pass.
+  echo KO > c.xfail
+  do_recheck --fail
+  test ! -r a.run
+  test ! -r b.run
+  test -f c.run
+  test -f d.run
+  count_test_results total=5 pass=1 fail=1 xpass=0 xfail=2 skip=1 error=0
+
+  : Nothing changed, so only d.test should be run.
+  for i in 1 2; do
+    do_recheck --fail
+    test ! -r a.run
+    test ! -r b.run
+    test ! -r c.run
+    test -f d.run
+    count_test_results total=2 pass=0 fail=1 xpass=0 xfail=0 skip=1 error=0
+  done
+
+  : Let us make d.test run more testcases, and experience _more_ failures.
+  echo 'test_count=9' > d.count
+  unindent > d.extra <<'END'
+    echo 'ok # SKIP s'
+    echo 'not ok - f 1'
+    echo 'ok - p 1'
+    echo 'not ok - f 2'
+    echo 'ok # TODO xp'
+    echo 'not ok - f 3'
+    echo 'not ok - f 4'
+    echo 'ok - p 2'
+    echo 'ok' # Extra test.
+    echo 'Bail out!'
+END
+  do_recheck --fail
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+  test -f d.run
+  count_test_results total=11 pass=2 fail=4 xpass=1 xfail=0 skip=2 error=2
+
+  : Let us finally make d.test pass.
+  echo 'test_count=1' > d.count
+  echo : > d.extra
+  do_recheck --pass
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+  test -f d.run
+  count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=0
+
+  : All tests have been successful or skipped, nothing should be re-run.
+  do_recheck --pass
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+  test ! -r d.run
+  count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/tap-result-comment.test b/tests/tap-result-comment.test
new file mode 100755 (executable)
index 0000000..ef7fc11
--- /dev/null
@@ -0,0 +1,54 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - non-directive comments in TAP results are kept verbatim
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+1..5
+ok 1 # TDO
+not ok 2 # SKP
+ok #SIKP${tab}${sp}
+not ok #    TOD${tab}
+ok 5 # ${tab}${tab}TOOD${tab}${sp}${sp}
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=5 pass=3 fail=2 xpass=0 xfail=0 skip=0 error=0
+
+# Don't be too strict about trailing white space.
+$FGREP ': all.test' stdout | sed "s/[$sp$tab]*$//" > got
+
+cat > exp <<END
+PASS: all.test 1 # TDO
+FAIL: all.test 2 # SKP
+PASS: all.test 3 #SIKP
+FAIL: all.test 4 #    TOD
+PASS: all.test 5 # ${tab}${tab}TOOD
+END
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-setup.sh b/tests/tap-setup.sh
new file mode 100755 (executable)
index 0000000..00397e0
--- /dev/null
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Auxiliary shell script that copies the common data and files used by
+# many tests on TAP support into the current directory.  It should be
+# sourced by client test scripts, and assumes the auxiliary test
+# `tap-common-setup.test' has been run beforehand (it will error out
+# if this is not the case).
+
+# Check that we are running from a proper directory: last thing we want
+# is to overwrite some random user files.
+test -f ../defs-static && test -f ../defs \
+  || fatal_ "running from a wrong directory"
+
+test ! -f Makefile.am || mv Makefile.am Makefile.am~ \
+  || fatal_ "failed to save Makefile.am"
+
+test -d ../tap-common-setup.dir && cp -Rp ../tap-common-setup.dir/* . \
+  || fatal_ "couldn't get precomputed data files"
+
+fetch_tap_driver
+
+if test -f Makefile.am~; then
+  mv -f Makefile.am~ Makefile.am \
+    || fatal_ "failed to restore Makefile.am"
+  echo 'TEST_LOG_DRIVER = $(PERL) $(srcdir)/tap-driver' >> Makefile.am \
+    || fatal_ "failed to update Makefile.am"
+  $AUTOMAKE Makefile \
+    || fatal_ "failed to remake Makefile.in"
+  ./config.status Makefile \
+    || fatal_ "failed to remake Makefile"
+fi
+
+:
diff --git a/tests/tap-signal.tap b/tests/tap-signal.tap
new file mode 100755 (executable)
index 0000000..b84993a
--- /dev/null
@@ -0,0 +1,131 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# TAP support:
+#  - a test script terminated by a signal causes an hard error
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+fetch_tap_driver
+
+plan_ 10
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << END
+TEST_LOG_DRIVER = \$(srcdir)/tap-driver
+TEST_LOG_COMPILER = $PERL -w
+## Will be updated later.
+TESTS =
+END
+
+all_signals='1 2 3 9 13 15'
+blocked_signals=''
+for sig in $all_signals; do
+  # Ignore blocked signals
+  if is_blocked_signal $sig; then
+    blocked_signals="$blocked_signals $sig"
+    continue
+  fi
+  # Write the dummy test scripts in perl, not as shell scripts, to work
+  # around unportabilities in the handling of signals (in fact, even
+  # with bash, the older script were unable to properly deliver a SIGQUIT
+  # to themselves consistently).  The shebang is dummy here, as we prefer
+  # to rely on the definition of TEST_LOG_COMPILER instead.
+  unindent > signal-$sig.test <<END
+    #! perl
+    # We need autoflush to avoid losing output, which could cause spurious
+    # "no test plan seen" in the TAP driver.
+    BEGIN { $| = 1 }
+    use warnings FATAL => "all";
+    print "1..1\\n";
+    print "ok 1\\n";
+    kill $sig, \$\$;
+    print "Bail out! \$0 not killed?\\n";
+END
+  echo TESTS += signal-$sig.test >> Makefile.am
+done
+results_count=`ls *.test | wc -l | tr -d "$tab$sp"`
+
+chmod a+x *.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+signal_caught ()
+{
+  numeric=$1
+  case $numeric in
+     1) symbolic=HUP;;
+     2) symbolic=INT;;
+     3) symbolic=QUIT;;
+     9) symbolic=KILL;;
+    13) symbolic=PIPE;;
+    15) symbolic=TERM;;
+     *) fatal_ "unexpected signal number '$numeric'"
+  esac
+  sig_re="((SIG)?$symbolic|$numeric)"
+  wbound_re="($|[^a-zA-Z0-9_-])"
+  pfx_re="^ERROR: signal-$numeric\\.test"
+  case $am_tap_implementation in
+    perl) rx="$pfx_re - terminated by signal $sig_re$";;
+    shell) rx="$pfx_re .*terminated by signal $sig_re$wbound_re";;
+    *) fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'";;
+  esac
+  desc="TAP driver catch test termination by signal SIG$symbolic"
+  case " $blocked_signals " in
+    *" $numeric "*) skip_ -r "SIG$symbolic is blocked" "$desc" ;;
+    *) command_ok_ "$desc" env LC_ALL=C $EGREP "$rx" stdout ;;
+  esac
+}
+
+command_ok_ '"make check" fails' eval '
+  (
+    st=0; $MAKE check >stdout || st=$?
+    # Extra "echo" and silencing of xtraces required to avoid possible
+    # garbled output with NetBSD make, which would miss some final
+    # newlines in the expected places and thus mess up our TAP output.
+    set +x; echo
+    test $st -gt 0
+  )
+'
+cat stdout # For debugging.
+
+command_ok_ "count of test results" count_test_results \
+  total=`expr $results_count '*' 2` \
+  pass=$results_count error=$results_count \
+  fail=0 xpass=0 xfail=0 skip=0
+
+for sig in $all_signals; do
+  signal_caught $sig
+done
+
+echo 'TEST_LOG_DRIVER_FLAGS = --ignore-exit' >> Makefile
+
+command_ok_ '"make check" passes [--ignore-exit]' eval '$MAKE check >stdout'
+cat stdout # For debugging.
+
+command_ok_ "count of test results [--ignore-exit]" count_test_results \
+  total=$results_count pass=$results_count \
+  fail=0 xpass=0 xfail=0 skip=0 error=0
+
+:
diff --git a/tests/tap-summary-aux.sh b/tests/tap-summary-aux.sh
new file mode 100755 (executable)
index 0000000..f98f4e3
--- /dev/null
@@ -0,0 +1,359 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Auxiliary script for tests on TAP support: checking testsuite summary.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+br='============================================================================'
+
+case $use_colors in
+  yes|no) ;;
+  *) fatal_ "invalid \$use_colors value '$use_colors'"
+esac
+
+fetch_tap_driver
+
+cat > configure.in <<END
+AC_INIT([GNU AutoTAP], [5.12], [bug-automake@gnu.org])
+AM_INIT_AUTOMAKE([parallel-tests])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(srcdir)/tap-driver
+TEST_LOG_COMPILER = cat
+TESTS = all.test
+END
+
+# The following shell variables are influential for this function:
+#  - expect_failure
+#  - use_colors
+do_check ()
+{
+  case $#,$1 in
+    1,--pass) expect_failure=no;;
+    1,--fail) expect_failure=yes;;
+           *) fatal_ "invalid usage of 'do_check'";;
+  esac
+  shift
+  cat > summary.exp
+  cat all.test
+  st=0
+  if test $use_colors = yes; then
+    make_cmd="env AM_COLOR_TESTS=always $MAKE -e"
+  else
+    make_cmd=$MAKE
+  fi
+  $make_cmd check > stdout || st=$?
+  cat stdout
+  if test $expect_failure = yes; then
+    test $st -gt 0 || Exit 1
+  else
+    test $st -eq 0 || Exit 1
+  fi
+  $PERL -w "$testsrcdir"/extract-testsuite-summary stdout > summary.got \
+    || fatal_ "cannot extract testsuite summary"
+  cat summary.exp
+  cat summary.got
+  if test $use_colors = yes; then
+    # Use cmp, not diff, because the files might contain binary data.
+    compare=cmp
+  else
+    compare=diff
+  fi
+  $compare summary.exp summary.got || Exit 1
+}
+
+if test $use_colors = yes; then
+  red='\e[0;31m'
+  grn='\e[0;32m'
+  lgn='\e[1;32m'
+  blu='\e[1;34m'
+  mgn='\e[0;35m'
+  brg='\e[1m'
+  std='\e[m'
+  echo AUTOMAKE_OPTIONS = color-tests >> Makefile.am
+else
+  red= grn= lgn= blu= mgn= brg= std=
+fi
+
+  success_header="\
+${grn}${br}${std}
+${grn}Testsuite summary for GNU AutoTAP 5.12${std}
+${grn}${br}${std}"
+
+  success_footer=${grn}${br}${std}
+
+  failure_header="\
+${red}${br}${std}
+${red}Testsuite summary for GNU AutoTAP 5.12${std}
+${red}${br}${std}"
+
+  failure_footer="\
+${red}${br}${std}
+${red}See ./test-suite.log${std}
+${red}Please report to bug-automake@gnu.org${std}
+${red}${br}${std}"
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+# 1 pass.
+{ echo 1..1 && echo ok; } > all.test
+do_check --pass <<END
+$success_header
+${brg}# TOTAL: 1${std}
+${grn}# PASS:  1${std}
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+# 1 skip.
+{ echo 1..1 && echo 'ok # SKIP'; } > all.test
+do_check --pass <<END
+$success_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+${blu}# SKIP:  1${std}
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+# 1 xfail.
+{ echo 1..1 && echo 'not ok # TODO'; } > all.test
+do_check --pass <<END
+$success_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+# SKIP:  0
+${lgn}# XFAIL: 1${std}
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+# 1 fail.
+{ echo 1..1 && echo not ok; } > all.test
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+${red}# FAIL:  1${std}
+# XPASS: 0
+# ERROR: 0
+$failure_footer
+END
+
+# 1 xpass.
+{ echo 1..1 && echo 'ok # TODO'; } > all.test
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+${red}# XPASS: 1${std}
+# ERROR: 0
+$failure_footer
+END
+
+# 1 hard error.
+{ echo 1..1 && echo 'Bail out!'; } > all.test
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+${mgn}# ERROR: 1${std}
+$failure_footer
+END
+
+# 3 non-failing results.
+cat > all.test <<END
+1..3
+ok
+not ok # TODO
+ok # SKIP
+END
+do_check --pass <<END
+$success_header
+${brg}# TOTAL: 3${std}
+${grn}# PASS:  1${std}
+${blu}# SKIP:  1${std}
+${lgn}# XFAIL: 1${std}
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+# 1 pass, 1 skip, 1 fail.
+cat > all.test <<END
+1..3
+ok
+ok # SKIP
+not ok
+END
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 3${std}
+${grn}# PASS:  1${std}
+${blu}# SKIP:  1${std}
+# XFAIL: 0
+${red}# FAIL:  1${std}
+# XPASS: 0
+# ERROR: 0
+$failure_footer
+END
+
+# 1 pass, 1 xfail, 1 xpass.
+cat > all.test <<END
+1..3
+ok
+ok # TODO
+not ok # TODO
+END
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 3${std}
+${grn}# PASS:  1${std}
+# SKIP:  0
+${lgn}# XFAIL: 1${std}
+# FAIL:  0
+${red}# XPASS: 1${std}
+# ERROR: 0
+$failure_footer
+END
+
+# 1 skip, 1 xfail, 1 error.
+cat > all.test <<END
+1..3
+ok # SKIP
+not ok # TODO
+Bail out!
+END
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 3${std}
+# PASS:  0
+${blu}# SKIP:  1${std}
+${lgn}# XFAIL: 1${std}
+# FAIL:  0
+# XPASS: 0
+${mgn}# ERROR: 1${std}
+$failure_footer
+END
+
+# 1 of each kind
+cat > all.test <<END
+1..6
+ok
+not ok
+ok # TODO
+not ok # TODO
+ok # SKIP
+Bail out!
+END
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 6${std}
+${grn}# PASS:  1${std}
+${blu}# SKIP:  1${std}
+${lgn}# XFAIL: 1${std}
+${red}# FAIL:  1${std}
+${red}# XPASS: 1${std}
+${mgn}# ERROR: 1${std}
+$failure_footer
+END
+
+# Prepare some common data for later.
+for i in 0 1 2 3 4 5 6 7 8 9; do
+  for j in 0 1 2 3 4 5 6 7 8 9; do
+    echo "ok"
+    echo "not ok # TODO"
+    echo "ok # SKIP"
+  done
+done > tap
+
+# Lots of non-failures (300 per kind).
+(cat tap && cat tap && cat tap) > all.test
+test `wc -l <all.test` -eq 900 || Exit 99 # Sanity check.
+echo 1..900 >> all.test # Test plan.
+do_check --pass <<END
+$success_header
+${brg}# TOTAL: 900${std}
+${grn}# PASS:  300${std}
+${blu}# SKIP:  300${std}
+${lgn}# XFAIL: 300${std}
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+# 1 failure and lots of non-failures means failure.
+(cat tap && echo "not ok" && cat tap) > all.test
+test `wc -l <all.test` -eq 601 || Exit 99 # Sanity check.
+echo 1..601 >> all.test # Test plan.
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 601${std}
+${grn}# PASS:  200${std}
+${blu}# SKIP:  200${std}
+${lgn}# XFAIL: 200${std}
+${red}# FAIL:  1${std}
+# XPASS: 0
+# ERROR: 0
+$failure_footer
+END
+
+# 1 error and lots of non-failures means failure.
+(cat tap && sed 30q tap && echo 'Bail out!') > all.test
+test `wc -l <all.test` -eq 331 || Exit 99 # Sanity check.
+echo 1..331 >> all.test # Test plan.
+do_check --fail <<END
+$failure_header
+${brg}# TOTAL: 331${std}
+${grn}# PASS:  110${std}
+${blu}# SKIP:  110${std}
+${lgn}# XFAIL: 110${std}
+# FAIL:  0
+# XPASS: 0
+${mgn}# ERROR: 1${std}
+$failure_footer
+END
+
+:
diff --git a/tests/tap-summary-color.test b/tests/tap-summary-color.test
new file mode 100755 (executable)
index 0000000..2dacb54
--- /dev/null
@@ -0,0 +1,23 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - colorized testsuite summary
+
+. ./defs-static
+
+use_colors=yes
+. "$testsrcdir"/tap-summary-aux.sh
diff --git a/tests/tap-summary.test b/tests/tap-summary.test
new file mode 100755 (executable)
index 0000000..b49aba7
--- /dev/null
@@ -0,0 +1,23 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - colorized testsuite summary
+
+. ./defs-static
+
+use_colors=no
+. "$testsrcdir"/tap-summary-aux.sh
diff --git a/tests/tap-test-number-0.test b/tests/tap-test-number-0.test
new file mode 100755 (executable)
index 0000000..6e77a5d
--- /dev/null
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# TAP support:
+#  - a test result numbered as 0 is to be considered out-of-order
+# This is consistent with the behaviour of the `prove' utility.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+if test $am_tap_implementation = perl; then
+  $PERL -MTAP::Parser -e 1 \
+    || skip_ "cannot import TAP::Parser perl module"
+  if $PERL -w -e '
+    use warnings FATAL => "all"; use strict;
+    use TAP::Parser;
+    my $parser = TAP::Parser->new({tap => "1..1\n" . "ok 0\n"});
+    my $result = $parser->next;
+    $result->is_plan or die "first line is not TAP plan";
+    $result = $parser->next;
+    $result->is_test or die "second line is not TAP test result";
+    my $testno = $result->number;
+    $parser->next and die "unexpected further TAP stream";
+    exit ($testno == 0 ? 0 : 77);
+  '; then
+    : # Nothing to do.
+  elif test $? -eq 77; then
+    skip_ 'TAP::Parser bug: test number 0 gets relabelled as 1'
+  else
+    fatal_ "error analyzing TAP::Parser module for bugs"
+  fi
+fi
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > a.test <<END
+1..1
+ok 0
+END
+
+cat > b.test <<END
+1..1
+not ok 0
+END
+
+cat > c.test <<END
+1..1
+ok 0 foo # SKIP
+END
+
+cat > d.test <<END
+1..1
+not ok 0 bar # TODO
+END
+
+cat > e.test <<END
+1..1
+ok 0 # TODO
+END
+
+TESTS='a.test b.test c.test d.test e.test' $MAKE -e check >stdout \
+  && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=5 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=5
+
+grep '^ERROR: a\.test 0 # OUT-OF-ORDER (expecting 1)$' stdout
+grep '^ERROR: b\.test 0 # OUT-OF-ORDER (expecting 1)$' stdout
+grep '^ERROR: c\.test 0 foo # OUT-OF-ORDER (expecting 1)$' stdout
+grep '^ERROR: d\.test 0 bar # OUT-OF-ORDER (expecting 1)$' stdout
+grep '^ERROR: e\.test 0 # OUT-OF-ORDER (expecting 1)$' stdout
+
+:
diff --git a/tests/tap-todo-skip-together.test b/tests/tap-todo-skip-together.test
new file mode 100755 (executable)
index 0000000..39a0177
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - TODO and SKIP directives on the same line: the first one wins
+# See also related test 'tap-ambiguous-directive.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+1..2
+ok 1 # SKIP TODO
+not ok 2 # TODO SKIP
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=2 pass=0 fail=0 xpass=0 xfail=1 skip=1 error=0
+
+grep '^SKIP: all\.test 1 ' stdout
+grep '^XFAIL: all\.test 2 ' stdout
+
+:
diff --git a/tests/tap-todo-skip-whitespace.test b/tests/tap-todo-skip-whitespace.test
new file mode 100755 (executable)
index 0000000..12e621f
--- /dev/null
@@ -0,0 +1,100 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - normalization of whitespace in console testsuite progress associated
+#    with TODO and SKIP directives
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > stub.tap <<END
+1 # TODO
+2 # TODO foo?
+3 # TODO: bar!
+4 aa # TODO
+5 bb # TODO       fnord 5
+6 cc # TODO:${tab}fnord 6
+7 - x # TODO
+8 - y # TODO fnord $tab  8
+9 - z # TODO: fnord 9  $tab
+10# TODO x0
+11$tab# TODO x1
+12 $tab$tab   # TODO x2
+13 asd# TODO x3
+14 sad$tab# TODO x4
+15 das$tab$tab   # TODO x5
+END
+
+cat > stub.exp <<END
+1 # TODO
+2 # TODO foo?
+3 # TODO: bar!
+4 aa # TODO
+5 bb # TODO fnord 5
+6 cc # TODO:${tab}fnord 6
+7 - x # TODO
+8 - y # TODO fnord $tab  8
+9 - z # TODO: fnord 9
+10 # TODO x0
+11 # TODO x1
+12 # TODO x2
+13 asd # TODO x3
+14 sad # TODO x4
+15 das # TODO x5
+END
+
+plan=1..15
+
+my_make_check ()
+{
+  xpass=0 xfail=0 skip=0
+  case $1 in
+    xpass|xfail|skip) eval $1=15;;
+    *) fatal_ "bad argument '$1' for my_make_check";;
+  esac
+  cat all.test
+  $MAKE check >stdout || : # Don't care about the exit status in this test.
+  cat stdout
+  count_test_results total=15 pass=0 fail=0 error=0 \
+                     xpass=$xpass xfail=$xfail skip=$skip
+  # Don't be too strict w.r.t. possible normalization of "TODO: foo" into
+  # "TODO : foo" (as is done by, e.g., the 'TAP::Parser' perl module).
+  LC_ALL=C grep '^[A-Z][A-Z]*:' stdout \
+    | sed -e 's/# TODO *:/# TODO:/' -e 's/# SKIP *:/# SKIP:/' > got
+  cat exp
+  cat got
+  diff exp got
+}
+
+# For "TODO" directives leading to XPASS results.
+(echo $plan && sed -e 's/^/ok /' stub.tap) > all.test
+sed -e 's/^/XPASS: all.test /' stub.exp > exp
+my_make_check xpass
+
+# For "TODO" directives leading to XFAIL results.
+(echo $plan && sed -e 's/^/not ok /' stub.tap) > all.test
+sed -e 's/^/XFAIL: all.test /' stub.exp > exp
+my_make_check xfail
+
+# For "SKIP" directives.
+(echo $plan && sed -e 's/^/ok /' -e 's/TODO/SKIP/' stub.tap) > all.test
+sed -e 's/TODO/SKIP/' -e 's/^/SKIP: all.test /' stub.exp > exp
+my_make_check skip
+
+:
diff --git a/tests/tap-todo-skip.test b/tests/tap-todo-skip.test
new file mode 100755 (executable)
index 0000000..7bd894b
--- /dev/null
@@ -0,0 +1,91 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - TODO and SKIP directives are case-insensitive
+#  - TODO and SKIP directives can be followed optionally by a colon ":"
+#    and by an optional explanation.
+#  - our driver isn't fooled into recognizing TODO and SKIP directives
+#    spuriously
+#  - the reasons for TODO and SKIP, if present, are nicely printed in
+#    the testsuite progress output
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+# ----------------------------------------------------- #
+#  Check all possible combinations of:                  #
+#    - uppercase/lowercase                              #
+#    - with/without colon character ":"                 #
+#    - with/without explanatory message                 #
+#  in TODO and SKIP directives.                         #
+# ----------------------------------------------------- #
+
+# There are 2 * 2^6 + 2 * 2^6 = 256 tests.
+echo 1..256 > all.test
+
+# These nested loops are clearer without indentation.
+
+for c1 in t T; do
+for c2 in o O; do
+for c3 in d D; do
+for c4 in o O; do
+for ex in '' ':' ' foo' ': foo'; do
+  echo "not ok # $c1$c2$c3$c4$ex"
+  echo "not ok# $c1$c2$c3$c4$ex"
+done; done; done; done; done >> all.test
+
+for c1 in s S; do
+for c2 in k K; do
+for c3 in i I; do
+for c4 in p P; do
+for ex in '' ':' ' foo' ': foo'; do
+  echo "ok # $c1$c2$c3$c4$ex"
+  echo "ok# $c1$c2$c3$c4$ex"
+done; done; done; done; done >> all.test
+
+cat all.test # For debugging.
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=256 pass=0 fail=0 xpass=0 xfail=128 skip=128 error=0
+
+# -------------------------------------------------------- #
+#  TODO ans SKIP directives aren't recognized spuriously.  #
+# -------------------------------------------------------- #
+
+cat > all.test <<'END'
+1..9
+ok TODO
+ok - TODO
+ok 3 TODO
+ok 4 - TODO
+ok SKIP
+ok - SKIP
+ok 7 SKIP
+ok 8 - SKIP
+ok 9
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=9 pass=9 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+:
diff --git a/tests/tap-unplanned.test b/tests/tap-unplanned.test
new file mode 100755 (executable)
index 0000000..7d131d4
--- /dev/null
@@ -0,0 +1,159 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - unplanned tests are properly reported as errors
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<END
+1..1
+ok 1
+ok 2
+END
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=3 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=2
+grep '^ERROR: all\.test - too many tests run (expected 1, got 2)$' stdout
+grep '^ERROR: all\.test 2 # UNPLANNED$' stdout
+
+cat > all.test <<END
+1..2
+ok 1
+ok 2
+ok 3
+END
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=4 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=2
+grep '^ERROR: all\.test - too many tests run (expected 2, got 3)$' stdout
+grep '^ERROR: all\.test 3 # UNPLANNED$' stdout
+
+# Interaction with XFAIL_TESTS.
+cat > all.test <<END
+1..2
+not ok 1
+ok 2 # SKIP
+ok 3
+not ok 4
+ok 5 # SKIP
+END
+XFAIL_TESTS=all.test $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=6 pass=0 fail=0 xpass=0 xfail=1 skip=1 error=4
+grep '^ERROR: all\.test - too many tests run (expected 2, got 5)$' stdout
+grep '^ERROR: all\.test 3 # UNPLANNED$' stdout
+grep '^ERROR: all\.test 4 # UNPLANNED$' stdout
+grep '^ERROR: all\.test 5 # UNPLANNED$' stdout
+
+cat > all.test <<END
+1..1
+ok 1
+
+ok
+ok 3
+ok foo
+ok 5 - bar bar
+
+not ok
+not ok 7
+not ok foo
+not ok 9 - bar bar
+
+ok # TODO
+ok 11 # TODO
+ok foo # TODO
+ok 13 - bar bar # TODO
+
+not ok # TODO
+not ok 15 # TODO
+not ok foo # TODO
+not ok 17 - bar bar # TODO
+
+ok # SKIP
+ok 19 # SKIP
+ok foo # SKIP
+ok 21 - bar bar # SKIP
+END
+
+cat > t <<END
+
+2
+3
+4 foo
+5 - bar bar
+
+6
+7
+8 foo
+9 - bar bar
+
+10
+11
+12 foo
+13 - bar bar
+
+14
+15
+16 foo
+17 - bar bar
+
+18
+19
+20 foo
+21 - bar bar
+
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=22 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=21
+
+echo 'PASS: all.test 1' > exp
+sed -e '/^$/d' -e 's/.*/ERROR: all.test & # UNPLANNED/' t >> exp
+echo 'ERROR: all.test - too many tests run (expected 1, got 21)' >> exp
+
+$FGREP ': all.test' stdout > got
+
+cat exp
+cat got
+diff exp got
+
+# Note that, if the TAP input has a trailing plan, it is not possible
+# to flag unplanned tests as such, since we do not know they're unplanned
+# until the plan is reached; still, we should give at least an error
+# message about the unmatched number of tests once we've got the plan.
+
+for x in 'ok' 'ok 3' 'not ok' 'not ok # TODO' 'ok # TODO' 'ok # SKIP'; do
+  unindent > all.test <<END
+    ok 1
+    ok 2 # SKIP
+    $x
+    1..2
+END
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  test `$FGREP -c ': all.test' stdout` -eq 4
+  $EGREP '^PASS: all\.test 1($| )' stdout
+  $EGREP '^SKIP: all\.test 2($| )' stdout
+  $EGREP ': all\.test 3($| )' stdout
+  grep '^ERROR: all\.test - too many tests run (expected 2, got 3)$' stdout
+done
+
+:
diff --git a/tests/tap-whitespace-normalization.test b/tests/tap-whitespace-normalization.test
new file mode 100755 (executable)
index 0000000..e44a659
--- /dev/null
@@ -0,0 +1,165 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support: whitespace normalization (or lack thereof) in the testsuite
+# progress output on console.  We keep all these checks here in a single
+# script so that a potential cosmetic change in the output format won't
+# force us to tweak dozens of other tests (hopefully).
+# See also related test 'tap-todo-skip-whitespace.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+TEST_LOG_COMPILER = cat
+TESTS =
+END
+
+: > exp
+
+spaces_a=${sp}${tab}${tab}${sp}${sp}${tab}
+spaces_b=${tab}${tab}${sp}${tab}${sp}${sp}${sp}
+
+#-----------------------------------------------------------------------
+
+echo TESTS += numbers.test >> Makefile.am
+
+cat > numbers.test <<END
+1..6
+ok${spaces_a}1
+ok 2${spaces_b}
+ok${spaces_a}3${spaces_b}
+not ok${spaces_b}4
+not ok 5${spaces_a}
+not ok${spaces_b}6${spaces_a}
+END
+
+cat >> exp <<END
+PASS: numbers.test 1
+PASS: numbers.test 2
+PASS: numbers.test 3
+FAIL: numbers.test 4
+FAIL: numbers.test 5
+FAIL: numbers.test 6
+END
+
+#-----------------------------------------------------------------------
+
+echo TESTS += description.test >> Makefile.am
+
+cat > description.test <<END
+1..8
+ok${spaces_a}+foo
+ok +bar${spaces_b}
+ok${spaces_a}+baz${spaces_b}
+not ok${spaces_b}-foo
+not ok -bar${spaces_a}
+not ok${spaces_b}-baz${spaces_a}
+ok  u${spaces_b}v${spaces_a}w${sp}
+not ok${spaces_a}x${spaces_a}y${tab}z${tab}
+END
+
+cat >> exp <<END
+PASS: description.test 1 +foo
+PASS: description.test 2 +bar
+PASS: description.test 3 +baz
+FAIL: description.test 4 -foo
+FAIL: description.test 5 -bar
+FAIL: description.test 6 -baz
+PASS: description.test 7 u${spaces_b}v${spaces_a}w
+FAIL: description.test 8 x${spaces_a}y${tab}z
+END
+
+#-----------------------------------------------------------------------
+
+# "Bail out!" magic.
+
+echo TESTS += bailout.test >> Makefile.am
+
+cat > bailout.test <<END
+1..1
+Bail out!${tab}${sp}${sp}${tab}We're out of disk space.
+ok 1
+END
+
+cat >> exp <<END
+ERROR: bailout.test - Bail out! We're out of disk space.
+END
+
+echo TESTS += bailout2.test >> Makefile.am
+
+cat > bailout2.test <<END
+1..1
+Bail out!foo${tab}${sp}
+ok 1
+END
+
+cat >> exp <<END
+ERROR: bailout2.test - Bail out! foo
+END
+
+#-----------------------------------------------------------------------
+
+# Diagnostic lines.
+
+echo AM_TEST_LOG_DRIVER_FLAGS = --comments >> Makefile.am
+echo TESTS += cmnt.test >> Makefile.am
+
+cat > cmnt.test <<END
+1..1
+ok 1
+#Leading whitespace gets added
+#   ${tab}${tab} ${tab}Extra leading whitespace is stripped
+# Trailing whitespace is stripped ${tab}   ${tab}${tab}
+# Middle${tab}whitespace  is${tab}  ${tab}${tab}    kept
+# ${tab} And  only${tab}middle ${tab}whitespace  ${tab}${tab} ${tab}
+END
+
+cat >> exp <<END
+PASS: cmnt.test 1
+# cmnt.test: Leading whitespace gets added
+# cmnt.test: Extra leading whitespace is stripped
+# cmnt.test: Trailing whitespace is stripped
+# cmnt.test: Middle${tab}whitespace  is${tab}  ${tab}${tab}    kept
+# cmnt.test: And  only${tab}middle ${tab}whitespace
+END
+
+#-----------------------------------------------------------------------
+
+# TODO: we should have more checks here ... (but let's not over-do FTM).
+
+#-----------------------------------------------------------------------
+
+chmod a+x *.test
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+# Don't care about exit status or number of test results, they should be
+# checked for in many other tests.
+$MAKE check >stdout || :
+cat stdout
+
+LC_ALL=C sort exp > t
+mv -f t exp
+
+# We need the sort below to account for parallel make usage.
+LC_ALL=C grep '[a-z0-9][a-z0-9]*\.test' stdout | LC_ALL=C sort > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/tap-with-and-without-number.test b/tests/tap-with-and-without-number.test
new file mode 100755 (executable)
index 0000000..0865a6e
--- /dev/null
@@ -0,0 +1,50 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP support:
+#  - numbered and unnumbered test results can coexist
+#  - tests without explicit number get automatically numbered in the
+#    testsuite progress output on console
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+cat > all.test <<'END'
+1..7
+ok 1 foo
+ok 2 - foo2
+ok - bar
+not ok baz # TODO
+not ok 5 - asd # TODO
+ok 6 # SKIP
+ok zardoz
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+count_test_results total=7 pass=4 fail=0 xpass=0 xfail=2 skip=1 error=0
+
+grep '^PASS: all\.test 1 foo$' stdout
+grep '^PASS: all\.test 2 - foo2$' stdout
+grep '^PASS: all\.test 3 - bar$' stdout
+grep '^XFAIL: all\.test 4 baz # TODO$' stdout
+grep '^XFAIL: all\.test 5 - asd # TODO$' stdout
+grep '^SKIP: all\.test 6 # SKIP$' stdout
+grep '^PASS: all\.test 7 zardoz$' stdout
+
+:
diff --git a/tests/tap-xfail-tests.test b/tests/tap-xfail-tests.test
new file mode 100755 (executable)
index 0000000..3b98dd2
--- /dev/null
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# TAP and $(XFAIL_TESTS): test results without directives are turned from
+# PASS to XPASS and from FAIL to XFAIL; other results are unchanged.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+. "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
+
+echo 'XFAIL_TESTS = $(TESTS)' >> Makefile
+
+cat > all.test <<END
+1..6
+ok 1
+not ok 2
+ok 3 # TODO
+not ok 4 # TODO
+ok 5 # SKIP
+# The next should count as a failure (and thus will be
+# rendered into an expected failure by XFAIL_TESTS).
+not ok 6 # SKIP
+Bail out!
+END
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=7 pass=0 fail=0 xpass=2 xfail=3 skip=1 error=1
+
+grep '^XPASS: all\.test 1$' stdout
+grep '^XFAIL: all\.test 2$' stdout
+grep '^XPASS: all\.test 3 # TODO' stdout
+grep '^XFAIL: all\.test 4 # TODO' stdout
+grep '^SKIP: all\.test 5 # SKIP' stdout
+grep '^XFAIL: all\.test 6 # SKIP' stdout
+grep '^ERROR: all\.test - Bail out!' stdout
+
+# Check that the exit status of the testsuite is indeed 0 when we
+# would expect success.
+
+cat > all.test <<END
+1..3
+not ok 1
+ok 2 # SKIP
+not ok 3 # TODO
+END
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+count_test_results total=3 pass=0 fail=0 xpass=0 xfail=2 skip=1 error=0
+
+:
index b08c9f8..3dd4180 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012 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
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cwd=`pwd` || fatal_ "couldn't get current working directory"
 
 echo AC_OUTPUT >> configure.in
index dc5353c..22fdcb9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2008, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([tar], [1.0])
 AM_INIT_AUTOMAKE([tar-ustar])
@@ -34,7 +32,9 @@ $AUTOCONF
 $AUTOMAKE
 ./configure
 
-grep 'am__tar.*false' Makefile && Exit 77
+if grep 'am__tar.*false' Makefile; then
+  skip_ "cannot find proper archiver program"
+fi
 
 $MAKE distcheck
 test -f tar-1.0.tar.gz
index e62f0cc..205a37e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([tar2], [1.0])
 AM_INIT_AUTOMAKE([tar-pax])
@@ -34,7 +32,9 @@ $AUTOCONF
 $AUTOMAKE
 ./configure
 
-grep 'am__tar.*false' Makefile && Exit 77
+if grep 'am__tar.*false' Makefile; then
+  skip_ "cannot find proper archiver program"
+fi
 
 $MAKE distcheck
 test -f tar2-1.0.tar.gz
index de66754..a08bb70 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004  Free Software Foundation, Inc.
+# Copyright (C) 2004, 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT([tar2], [1.0])
 AM_INIT_AUTOMAKE([tar-pax tar-v7])
index b324568..cbb5e33 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2000, 2001, 2002, 2004, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 2000, 2001, 2002, 2004, 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
 # Test to make sure target specific CFLAGS work
 # Assar Westerlund <assar@sics.se>
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT(foo.c)
-AM_INIT_AUTOMAKE(target-cflags,0.0)
+cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
-AC_OUTPUT(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -39,7 +37,8 @@ END
 cat > foo.c << 'END'
 #include <stdio.h>
 #ifdef FOO
-int main(void) {
+int main(void)
+{
   return 0;
 }
 #endif
@@ -54,8 +53,6 @@ int main(void)
 #endif
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
@@ -64,11 +61,17 @@ mkdir build
 cd build
 ../configure
 $MAKE
-./foo
-./bar
+if cross_compiling; then :; else
+  ./foo
+  ./bar
+fi
 cd ..
 
 ./configure
 $MAKE
-./foo
-./bar
+if cross_compiling; then :; else
+  ./foo
+  ./bar
+fi
+
+:
index 0433b41..c712fd5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
 
 # Check that target clashes are diagnosed.
 
-required=gcc
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 END
@@ -30,6 +27,7 @@ bin_PROGRAMS = ctags
 END
 
 $ACLOCAL
-$AUTOCONF
 AUTOMAKE_fails -a
 grep 'redefinition.*ctags' stderr
+
+:
diff --git a/tests/test-driver-acsubst.test b/tests/test-driver-acsubst.test
new file mode 100755 (executable)
index 0000000..9c29ac9
--- /dev/null
@@ -0,0 +1,88 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# parallel-tests:
+#  - LOG_DRIVER variables can be AC_SUBST'd
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+mkdir test-drivers
+
+cp "$testsrcdir"/trivial-test-driver test-drivers/triv \
+  || fatal_ "failed to fetch auxiliary script trivial-test-driver"
+cp "$am_scriptdir"/test-driver test-drivers/dflt \
+  || fatal_ "failed to fetch auxiliary script test-driver"
+
+cat >> configure.in <<'END'
+AC_SUBST([LOG_DRIVER],      ['${SHELL} test-drivers/triv'])
+AC_SUBST([TEST_LOG_DRIVER], ['${SHELL} test-drivers/dflt'])
+AC_SUBST([SH_LOG_DRIVER],   ['${my_drv}'])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+TEST_EXTENSIONS = .test .sh
+my_drv = $(SHELL) test-drivers/dflt
+TESTS = foo bar.test baz.sh
+XFAIL_TESTS = baz.sh
+.PHONY: check-autodefs
+check-autodefs:
+### For debugging.
+       @echo      LOG_DRIVER = $(LOG_DRIVER)
+       @echo TEST_LOG_DRIVER = $(TEST_LOG_DRIVER)
+       @echo   SH_LOG_DRIVER = $(SH_LOG_DRIVER)
+### Checks here.
+       @echo ' ' $(LOG_DRIVER)      ' ' | grep ' test-drivers/triv '
+       @echo ' ' $(TEST_LOG_DRIVER) ' ' | grep ' test-drivers/dflt '
+       @echo ' ' $(SH_LOG_DRIVER)   ' ' | grep ' test-drivers/dflt '
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+cat > foo <<'END'
+#!/bin/sh
+echo "PASS: from $0"
+exit 1 # Exit status should be ignored by the trivial-test-driver.
+END
+
+cat > bar.test <<'END'
+#!/bin/sh
+exit 77
+END
+
+cat > baz.sh <<'END'
+#!/bin/sh
+exit 1
+END
+
+chmod a+x foo bar.test baz.sh
+
+$MAKE check-autodefs
+st=0; $MAKE check >stdout || st=$?
+cat stdout
+cat test-suite.log
+cat foo.log
+cat bar.log
+cat baz.log
+test $st -eq 0 || Exit 1
+count_test_results total=3 pass=1 fail=0 skip=1 xfail=1 xpass=0 error=0
+
+:
diff --git a/tests/test-driver-cond.test b/tests/test-driver-cond.test
new file mode 100755 (executable)
index 0000000..46986ff
--- /dev/null
@@ -0,0 +1,119 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# parallel-tests:
+#   - Automake can correctly handle conditionals contents for the
+#     LOG_DRIVER variables.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cp "$testsrcdir"/trivial-test-driver . \
+  || fatal_ "failed to fetch auxiliary script trivial-test-driver"
+cp "$am_scriptdir"/tap-driver.pl . \
+  || fatal_ "failed to fetch auxiliary script tap-driver.pl"
+
+cat >> configure.in << END
+AM_CONDITIONAL([COND1], [:])
+AM_CONDITIONAL([COND2], [false])
+AM_CONDITIONAL([COND3], [false])
+AC_SUBST([PERL], ['$PERL'])
+AC_SUBST([my_LOG_DRIVER], ['\${SHELL} \${top_srcdir}/trivial-test-driver'])
+AM_SUBST_NOTMAKE([my_LOG_DRIVER])
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+
+cat > Makefile.am << 'END'
+TESTS = foo bar.test baz.sh
+EXTRA_DIST = $(TESTS) tap-driver.pl trivial-test-driver
+TEST_EXTENSIONS = .test .sh
+LOG_DRIVER =
+SH_LOG_DRIVER = $(tap_rulez)
+if COND1
+LOG_DRIVER += @my_LOG_DRIVER@
+if COND2
+tap_rulez = false
+else !COND2
+tap_rulez = $(PERL) $(srcdir)/tap-driver.pl
+endif !COND2
+endif COND1
+END
+
+cat > foo <<'END'
+#!/bin/sh
+echo "PASS: from $0"
+echo "SKIP: from $0"
+exit 1 # Exit status should be ignored by the trivial-test-driver.
+END
+
+cat > bar.test <<'END'
+#!/bin/sh
+exit 0
+END
+
+cat > baz.sh <<'END'
+#!/bin/sh
+echo 1..3
+echo 'ok 1'
+echo 'not ok 2 # TODO'
+echo 'not ok 3 # TODO'
+END
+
+chmod a+x foo bar.test baz.sh
+
+$AUTOMAKE -a
+test -f test-driver
+
+grep DRIVER Makefile.in || Exit 99 # For debugging.
+
+grep '^my_LOG_DRIVER *=' Makefile.in \
+  && fatal_ 'unexpected $(my_LOG_DRIVER) in Makefile.in'
+
+grep '^TEST_LOG_DRIVER =.*\$(SHELL).*/test-driver' Makefile.in
+
+$PERL -MTAP::Parser -e 1 \
+  || skip_ "cannot import TAP::Parser perl module"
+
+./configure
+
+do_count ()
+{
+  count_test_results total=6 pass=3 fail=0 skip=1 xfail=2 xpass=0 error=0
+  grep '^PASS: foo, testcase 1 *$' stdout
+  grep '^SKIP: foo, testcase 2 *$' stdout
+  grep '^PASS: bar\.test *$' stdout
+  $EGREP 'PASS: baz\.sh 1( |$)' stdout
+  $EGREP 'XFAIL: baz\.sh 2( |$)' stdout
+  $EGREP 'XFAIL: baz\.sh 3( |$)' stdout
+}
+
+st=0; $MAKE check >stdout || st=$?
+cat stdout
+cat test-suite.log
+cat foo.log
+cat bar.log
+cat baz.log
+test $st -eq 0 || Exit 1
+do_count
+
+$MAKE distcheck >stdout || { cat stdout; Exit 1; }
+cat stdout
+do_count
+
+:
diff --git a/tests/test-driver-create-log-dir.test b/tests/test-driver-create-log-dir.test
new file mode 100755 (executable)
index 0000000..902ae7c
--- /dev/null
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Custom test drivers: if a log file has a directory component (as in
+# e.g., `sub/foo.log'), the Automake test harness must ensure that
+# directory exists before calling any custom test driver.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# The extra `.' components below are meant.
+TESTS = sub/foo sub/subsub/bar.test ././sub1/./baz
+$(TESTS):
+LOG_DRIVER = $(srcdir)/checkdir-driver
+TEST_LOG_DRIVER = $(LOG_DRIVER)
+EXTRA_DIST = checkdir-driver
+
+check-local: $(TEST_SUITE_LOG)
+       test -d sub
+       test -d sub1
+       test -d sub/subsub
+       test -f sub/foo.log
+       test -f sub/subsub/bar.log
+       test -f sub1/baz.log
+       test -f sub/foo.trs
+       test -f sub/subsub/bar.trs
+       test -f sub1/baz.trs
+END
+
+cat > checkdir-driver <<'END'
+#! /bin/sh
+set -e; set -u
+while test $# -gt 0; do
+  case $1 in
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    --test-name|--expect-failure|--color-tests|--enable-hard-errors) shift;;
+    --) shift; break;;
+     *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+echo "log: $log_file" # For debugging.
+echo "trs: $trs_file" # Ditto.
+case $log_file in */*);; *) exit 1;; esac
+dir_log=`expr "$log_file" : '\(.*\)/[^/]*'`
+dir_trs=`expr "$trs_file" : '\(.*\)/[^/]*'`
+echo "dir_log: $dir_log" # For debugging.
+echo "dir_trs: $dir_trs" # Likewise.
+test x"$dir_trs" = x"$dir_log" || exit 1
+test -d "$dir_log" || exit 1
+echo dummy1 > "$log_file"
+echo dummy2 > "$trs_file"
+END
+chmod a+x checkdir-driver
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE check
+$MAKE distcheck
+
+:
diff --git a/tests/test-driver-custom-multitest-recheck.test b/tests/test-driver-custom-multitest-recheck.test
new file mode 100755 (executable)
index 0000000..bd9e9d6
--- /dev/null
@@ -0,0 +1,214 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Custom test drivers: try the "recheck" functionality with test protocols
+# that allow multiple testcases in a single test script.  This test not
+# only checks implementation details in Automake's custom test drivers
+# support, but also serves as a "usability test" for our APIs.
+# See also related tests `test-driver-custom-multitest-recheck2.test'
+# and `parallel-tests-recheck-override.test'.
+# Keep in sync with 'tap-recheck.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cp "$testsrcdir"/trivial-test-driver . \
+  || fatal_ "failed to fetch auxiliary script trivial-test-driver"
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(SHELL) $(srcdir)/trivial-test-driver
+TESTS = a.test b.test c.test d.test
+END
+
+cat > a.test << 'END'
+#! /bin/sh
+echo PASS: aa
+echo PASS: AA
+: > a.run
+END
+
+cat > b.test << 'END'
+#! /bin/sh
+echo PASS:
+if test -f b.ok; then
+  echo PASS:
+else
+  echo ERROR:
+fi
+: > b.run
+END
+
+cat > c.test << 'END'
+#! /bin/sh
+if test -f c.pass; then
+  echo PASS: c0
+else
+  echo FAIL: c0
+fi
+if test -f c.xfail; then
+  echo XFAIL: c1
+else
+  echo XPASS: c1
+fi
+echo XFAIL: c2
+: > c.run
+END
+
+cat > d.test << 'END'
+#! /bin/sh
+echo SKIP: who cares ...
+(. ./d.extra) || echo FAIL: d.extra failed
+: > d.run
+END
+
+chmod a+x *.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+do_recheck ()
+{
+  case $* in
+    --fail) on_bad_rc='&&';;
+    --pass) on_bad_rc='||';;
+         *) fatal_ "invalid usage of function 'do_recheck'";;
+  esac
+  rm -f *.run
+  eval "\$MAKE recheck >stdout $on_bad_rc { cat stdout; ls -l; Exit 1; }; :"
+  cat stdout; ls -l
+}
+
+for vpath in : false; do
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+
+  : A "make recheck" in a clean tree should run no tests.
+  do_recheck --pass
+  cat test-suite.log
+  test ! -r a.run
+  test ! -r a.log
+  test ! -r b.run
+  test ! -r b.log
+  test ! -r c.run
+  test ! -r c.log
+  test ! -r d.run
+  test ! -r d.log
+  count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+  : Run the tests for the first time.
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  ls -l
+  # All the test scripts should have run.
+  test -f a.run
+  test -f b.run
+  test -f c.run
+  test -f d.run
+  count_test_results total=9 pass=3 fail=2 xpass=1 xfail=1 skip=1 error=1
+
+  : Let us make b.test pass.
+  echo OK > b.ok
+  do_recheck --fail
+  # a.test has been successful the first time, so no need to re-run it.
+  # Similar considerations apply to similar checks, below.
+  test ! -r a.run
+  test -f b.run
+  test -f c.run
+  test -f d.run
+  count_test_results total=7 pass=2 fail=2 xpass=1 xfail=1 skip=1 error=0
+
+  : Let us make the first part of c.test pass.
+  echo OK > c.pass
+  do_recheck --fail
+  test ! -r a.run
+  test ! -r b.run
+  test -f c.run
+  test -f d.run
+  count_test_results total=5 pass=1 fail=1 xpass=1 xfail=1 skip=1 error=0
+
+  : Let us make also the second part of c.test pass.
+  echo KO > c.xfail
+  do_recheck --fail
+  test ! -r a.run
+  test ! -r b.run
+  test -f c.run
+  test -f d.run
+  count_test_results total=5 pass=1 fail=1 xpass=0 xfail=2 skip=1 error=0
+
+  : Nothing changed, so only d.test should be run.
+  for i in 1 2; do
+    do_recheck --fail
+    test ! -r a.run
+    test ! -r b.run
+    test ! -r c.run
+    test -f d.run
+    count_test_results total=2 pass=0 fail=1 xpass=0 xfail=0 skip=1 error=0
+  done
+
+  : Let us make d.test run more testcases, and experience _more_ failures.
+  unindent > d.extra <<'END'
+    echo SKIP: s
+    echo FAIL: f 1
+    echo PASS: p 1
+    echo FAIL: f 2
+    echo XPASS: xp
+    echo FAIL: f 3
+    echo FAIL: f 4
+    echo ERROR: e 1
+    echo PASS: p 2
+    echo ERROR: e 2
+END
+  do_recheck --fail
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+  test -f d.run
+  count_test_results total=11 pass=2 fail=4 xpass=1 xfail=0 skip=2 error=2
+
+  : Let us finally make d.test pass.
+  echo : > d.extra
+  do_recheck --pass
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+  test -f d.run
+  count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=1 error=0
+
+  : All tests have been successful or skipped, nothing should be re-run.
+  do_recheck --pass
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+  test ! -r d.run
+  count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/test-driver-custom-multitest-recheck2.test b/tests/test-driver-custom-multitest-recheck2.test
new file mode 100755 (executable)
index 0000000..e7c183d
--- /dev/null
@@ -0,0 +1,188 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Custom test drivers: try the "recheck" functionality with test protocols
+# that allow multiple testcases in a single test script.  In particular,
+# check that this still works when we override $(TESTS) and $(TEST_LOGS)
+# at make runtime.
+# See also related tests `test-driver-custom-multitest-recheck.test' and
+# `parallel-tests-recheck-override.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cp "$testsrcdir"/trivial-test-driver . \
+  || fatal_ "failed to fetch auxiliary script trivial-test-driver"
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(SHELL) $(srcdir)/trivial-test-driver
+TESTS = a.test b.test c.test
+END
+
+cat > a.test << 'END'
+#! /bin/sh
+echo PASS: 1
+echo PASS: 2
+: > a.run
+END
+
+cat > b.test << 'END'
+#! /bin/sh
+echo SKIP: b0
+if test -f b.ok; then
+  echo XFAIL: b1
+else
+  echo FAIL: b2
+fi
+: > b.run
+END
+
+cat > c.test << 'END'
+#! /bin/sh
+if test -f c.err; then
+  echo ERROR: xxx
+elif test -f c.ok; then
+  echo PASS: ok
+else
+  echo XPASS: xp
+fi
+: > c.run
+END
+
+chmod a+x *.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+
+  : Run the tests for the first time.
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  # All the test scripts should have run.
+  test -f a.run
+  test -f b.run
+  test -f c.run
+  count_test_results total=5 pass=2 fail=1 xpass=1 xfail=0 skip=1 error=0
+
+  rm -f *.run
+
+  : An empty '$(TESTS)' or '$(TEST_LOGS)' means that no test should be run.
+  for var in TESTS TEST_LOGS; do
+    env "$var=" $MAKE -e recheck >stdout || { cat stdout; Exit 1; }
+    cat stdout
+    count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+    test ! -r a.run
+    test ! -r b.run
+    test ! -r c.run
+  done
+  unset var
+
+  : a.test was successful the first time, no need to re-run it.
+  env TESTS=a.test $MAKE -e recheck >stdout \
+    || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+
+  : b.test failed, it should be re-run.  And make it pass this time.
+  echo OK > b.ok
+  TEST_LOGS=b.log $MAKE -e recheck >stdout \
+    || { cat stdout; Exit 1; }
+  cat stdout
+  test ! -r a.run
+  test -f b.run
+  test ! -r c.run
+  count_test_results total=2 pass=0 fail=0 xpass=0 xfail=1 skip=1 error=0
+
+  rm -f *.run
+
+  : No need to re-run a.test or b.test anymore.
+  TEST_LOGS=b.log $MAKE -e recheck >stdout \
+    || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+  TESTS='a.test b.test' $MAKE -e recheck >stdout \
+    || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+
+  : No need to re-run a.test anymore, but c.test should be rerun,
+  : as it contained an XPASS.  And this time, make it fail with
+  : an hard error.
+  # Use `echo' here, since Solaris 10 /bin/sh would try to optimize
+  # a `:' away after the first iteration, even if it is redirected.
+  echo dummy > c.err
+  env TEST_LOGS='a.log c.log' $MAKE -e recheck >stdout \
+    && { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=1 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=1
+  test ! -r a.run
+  test ! -r b.run
+  test -f c.run
+
+  rm -f *.run *.err
+
+  : c.test contained and hard error the last time, so it should be re-run.
+  : This time, make it pass
+  # Use `echo', not `:'; see comments above for why.
+  echo dummy > c.ok
+  env TESTS='c.test a.test' $MAKE -e recheck >stdout \
+    || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
+  test ! -r a.run
+  test ! -r b.run
+  test -f c.run
+
+  rm -f *.run *.err *.ok
+
+  : Nothing should be rerun anymore, as all tests have been eventually
+  : successful.
+  $MAKE recheck >stdout || { cat stdout; Exit 1; }
+  cat stdout
+  count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+  test ! -r a.run
+  test ! -r b.run
+  test ! -r c.run
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/test-driver-custom-multitest.test b/tests/test-driver-custom-multitest.test
new file mode 100755 (executable)
index 0000000..1380ea7
--- /dev/null
@@ -0,0 +1,172 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Custom test drivers: check that we can easily support test protocols
+# that allow multiple testcases in a single test script.  This test not
+# only checks implementation details in Automake's custom test drivers
+# support, but also serves as a "usability test" for our APIs.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cp "$testsrcdir"/trivial-test-driver . \
+  || fatal_ "failed to fetch auxiliary script trivial-test-driver"
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .t
+T_LOG_DRIVER = $(SHELL) $(srcdir)/trivial-test-driver
+
+TESTS = \
+  pass.t \
+  fail.t \
+  fail2.t \
+  pass-fail.t \
+  pass4-skip.t \
+  pass3-skip2-xfail.t \
+  pass-xpass-fail-xfail-skip-error.t
+END
+
+cat > pass.t << 'END'
+echo %% pass %%
+echo PASS: pass
+END
+
+cat > fail.t << 'END'
+echo %% fail %%
+echo FAIL: fail
+END
+
+cat > fail2.t << 'END'
+echo %% fail2 %%
+echo FAIL: stdout >&1
+echo FAIL: stderr >&2
+echo :PASS: this should be ignored
+END
+
+cat > pass-fail.t << 'END'
+echo %% pass-fail %%
+echo 'FAIL: this fails :-('
+echo 'some randome message'
+echo 'some randome warning' >&2
+echo 'PASS: this passes :-)'
+echo 'INFO: blah'
+echo 'WARNING: blah blah' >&2
+END
+
+cat > pass4-skip.t << 'END'
+echo %% pass4-skip %%
+echo PASS: on stdout >&1
+echo PASS: on stderr >&2
+echo PASS: 3
+echo PASS: 4
+echo SKIP: 1
+echo this FAIL: should be ignored
+echo FAIL as should this
+exit 99
+END
+
+cat > pass3-skip2-xfail.t << 'END'
+echo %% pass4-skip2-xfail %%
+echo 'PASS: -v'
+echo 'PASS: --verbose'
+echo 'SKIP: Oops, unsupported system.'
+echo 'PASS: -#-#-#-'
+cp || echo "SKIP: cp cannot read users' mind" >&2
+mv || echo "XFAIL: mv cannot read users' mind yet"
+exit 127
+END
+
+cat > pass-xpass-fail-xfail-skip-error.t << 'END'
+echo PASS:
+echo FAIL:
+echo XFAIL:
+echo XPASS:
+echo SKIP:
+echo ERROR:
+echo %% pass-xpass-fail-xfail-skip-error %%
+END
+
+chmod a+x *.t
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+
+  $MAKE check >stdout && { cat stdout; cat test-suite.log; Exit 1; }
+  cat stdout
+  cat test-suite.log
+  # Couple of sanity checks.  These might need to be updated if the
+  # `trivial-test-driver' script is changed.
+  $FGREP INVALID.NAME stdout test-suite.log && Exit 1
+  test -f BAD.LOG && Exit 1
+  test -f BAD.TRS && Exit 1
+  # These log files must all have been created by the testsuite.
+  cat pass.log
+  cat fail.log
+  cat fail2.log
+  cat pass-fail.log
+  cat pass4-skip.log
+  cat pass3-skip2-xfail.log
+  cat pass-xpass-fail-xfail-skip-error.log
+
+  count_test_results total=23 pass=10 fail=5 skip=4 xfail=2 xpass=1 error=1
+
+  tst=pass-xpass-fail-xfail-skip-error
+  grep  "^PASS: $tst\.t, testcase 1" stdout
+  grep  "^FAIL: $tst\.t, testcase 2" stdout
+  grep "^XFAIL: $tst\.t, testcase 3" stdout
+  grep "^XPASS: $tst\.t, testcase 4" stdout
+  grep  "^SKIP: $tst\.t, testcase 5" stdout
+  grep "^ERROR: $tst\.t, testcase 6" stdout
+
+  # Check that the content of, and only of, the test logs with at least
+  # one failing test case has been copied into `test-suite.log'.  Note
+  # that test logs containing skipped or xfailed test cases are *not*
+  # copied into `test-suite.log' -- a behaviour that deliberately differs
+  # from the one of the built-in Automake test drivers.
+  grep '%%' test-suite.log # For debugging.
+  grep '%% fail %%' test-suite.log
+  grep '%% fail2 %%' test-suite.log
+  grep '%% pass-fail %%' test-suite.log
+  grep '%% pass-xpass-fail-xfail-skip-error %%' test-suite.log
+  test `grep -c '%% ' test-suite.log` -eq 4
+
+  TESTS='pass.t pass3-skip2-xfail.t' $MAKE -e check >stdout \
+    || { cat stdout; cat test-suite.log; Exit 1; }
+  cat test-suite.log
+  cat stdout
+  count_test_results total=7 pass=4 fail=0 skip=2 xfail=1 xpass=0 error=0
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/test-driver-custom-no-extra-driver.test b/tests/test-driver-custom-no-extra-driver.test
new file mode 100755 (executable)
index 0000000..18a94e4
--- /dev/null
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check that auxiliary script 'test-driver' doesn't get needlessly
+# installed or referenced if it's not used, i.e., if the user has
+# defined his own `*LOG_DRIVER' variables.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_SUBST([X_LOG_DRIVER], [none])
+AC_OUTPUT
+END
+
+mkdir sub1 sub2
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub1 sub2
+LOG_DRIVER =
+TEST_LOG_DRIVER = :
+TESTS = foo bar.test
+END
+
+cat > sub1/Makefile.am <<'END'
+TEST_EXTENSIONS = .x .sh .pl
+SH_LOG_DRIVER = dummy1
+PL_LOG_DRIVER = dummy2
+TESTS = a.pl b.sh c.x
+END
+
+cat > sub2/Makefile.am <<'END'
+TEST_EXTENSIONS = .bar
+LOG_DRIVER = x
+BAR_LOG_DRIVER = y
+TESTS = 1 2.bar 3.test 4.t 5.tt $(check_PROGRAMS)
+check_PROGRAMS = p1 p2$(EXEEXT) p3.bar p4.suf
+END
+
+$ACLOCAL
+
+for opts in '' '--add-missing' '-a -c'; do
+  $AUTOMAKE $opts
+  $FGREP test-driver Makefile.in sub[12]/Makefile.in && Exit 1
+  find . | $FGREP test-driver && Exit 1
+  : For shells with busted 'set -e'.
+done
+
+:
diff --git a/tests/test-driver-custom-xfail-tests.test b/tests/test-driver-custom-xfail-tests.test
new file mode 100755 (executable)
index 0000000..3c46237
--- /dev/null
@@ -0,0 +1,166 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Custom test drivers: "abstract" XFAIL_TESTS support.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_SUBST([nihil], [])
+AC_SUBST([ac_xfail_tests], ['x5.test x6$(test_suffix)'])
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = . sub1 sub2
+TEST_LOG_DRIVER = $(srcdir)/td
+TESTS = pass.test xfail.test
+XFAIL_TESTS = xfail.test
+END
+
+mkdir sub1 sub2
+
+cat > sub1/Makefile.am <<END
+empty =
+
+TEST_LOG_DRIVER = \$(top_srcdir)/td
+
+# XFAIL_TESTS should gracefully handle TAB characters, and multiple
+# whitespaces.
+XFAIL_TESTS =\$(empty)${tab}x1.test x2.test${tab}x3.test${tab}\
+x4.test ${tab} x5.test              x6.test${tab}\$(empty)
+
+TESTS = pass.test x1.test x2.test x3.test x4.test x5.test x6.test
+END
+
+cat > sub2/Makefile.am <<'END'
+AUTOMAKE_OPTIONS = -Wno-portability-recursive
+
+TEST_LOG_DRIVER = $(srcdir)/../td
+
+# XFAIL_TESTS should gracefully AC_SUBST @substitution@ and
+# make variables indirections.
+an_xfail_test = x1.test
+test_suffix = .test
+v0 = x3.test
+v1 = v
+v2 = 0
+XFAIL_TESTS = $(an_xfail_test) x2.test @nihil@ x3${test_suffix}
+XFAIL_TESTS += $($(v1)$(v2)) x4.test @ac_xfail_tests@
+
+TESTS = pass.test x1.test x2.test x3.test x4.test x5.test x6.test
+END
+
+cat > pass.test <<'END'
+#!/bin/sh
+exit 0
+END
+
+cat > xfail.test <<'END'
+#!/bin/sh
+exit 1
+END
+
+chmod a+x pass.test xfail.test
+
+cp pass.test sub1/pass.test
+cp pass.test sub2/pass.test
+
+for i in 1 2 3 4 5 6; do
+  cp xfail.test sub1/x$i.test
+  cp xfail.test sub2/x$i.test
+done
+
+cat > td <<'END'
+#! /bin/sh
+set -e; set -u
+test_name=INVALID
+log_file=/dev/null
+trs_file=/dev/null
+expect_failure=no
+while test $# -gt 0; do
+  case $1 in
+    --test-name) test_name=$2; shift;;
+    --expect-failure) expect_failure=$2; shift;;
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    # Ignored.
+    --color-tests) shift;;
+    --enable-hard-errors) shift;;
+    # Explicitly terminate option list.
+    --) shift; break;;
+    # Shouldn't happen
+    *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+st=0
+"$@" || st=$?
+case $st,$expect_failure in
+  0,no)
+    echo "PASS: $test_name" | tee "$log_file"
+    echo ":test-result: PASS" > "$trs_file"
+    ;;
+  1,no)
+    echo "FAIL: $test_name" | tee "$log_file"
+    echo ":test-result: FAIL" > "$trs_file"
+    ;;
+  0,yes)
+    echo "XPASS: $test_name" | tee "$log_file"
+    echo ":test-result: XPASS" > "$trs_file"
+    ;;
+  1,yes)
+    echo "XFAIL: $test_name" | tee "$log_file"
+    echo ":test-result: XFAIL" > "$trs_file"
+    ;;
+  *)
+    echo "INTERNAL ERROR" >&2
+    exit 99
+    ;;
+esac
+END
+chmod a+x td
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE check >stdout || { cat stdout; Exit 1; }
+cat stdout
+test `grep -c '^PASS:'  stdout` -eq 3
+test `grep -c '^XFAIL:' stdout` -eq 13
+
+for dir in sub1 sub2; do
+  cd $dir
+  cp pass.test x1.test
+  cp x2.test pass.test
+  $MAKE check >stdout && { cat stdout; Exit 1; }
+  cat stdout
+  test "`cat pass.trs`" = ":test-result: FAIL"
+  test "`cat x1.trs`"   = ":test-result: XPASS"
+  test "`cat x2.trs`"   = ":test-result: XFAIL"
+  grep '^FAIL: pass\.test$' stdout
+  grep '^XPASS: x1\.test$'  stdout
+  grep '^XFAIL: x2\.test$'  stdout
+  count_test_results total=7 pass=0 xpass=1 fail=1 xfail=5 skip=0 error=0
+  cd ..
+done
+
+:
diff --git a/tests/test-driver-custom.test b/tests/test-driver-custom.test
new file mode 100755 (executable)
index 0000000..a6f8deb
--- /dev/null
@@ -0,0 +1,144 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Custom test drivers: per-extension test drivers.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# Automake shouldn't match the '/test' in 'sub/test' as '.test' suffix.
+TESTS = 1.chk 2.test 3 4.c.chk 5.suf sub/test
+
+TEST_EXTENSIONS = .chk .test
+
+CHK_LOG_DRIVER = ./chk-wrapper
+TEST_LOG_DRIVER = $(SHELL) $(srcdir)/test-wrapper
+LOG_DRIVER = noext-wrapper
+
+AM_CHK_LOG_DRIVER_FLAGS = --am-chk
+CHK_LOG_DRIVER_FLAGS = --chk
+AM_TEST_LOG_DRIVER_FLAGS = -am-test
+TEST_LOG_DRIVER_FLAGS = -test
+AM_LOG_DRIVER_FLAGS = am
+LOG_DRIVER_FLAGS = _
+END
+
+mkdir sub bin
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+
+cat > wrapper.skel <<'END'
+#! /bin/sh
+set -e
+
+me=`echo "$0" | sed 's,^.*/,,'`
+if test -z "$me"; then
+  echo "$0: cannot determine program name" >&2
+  exit 99
+fi
+
+am_log_wflags='@am_log_wflags@'
+log_wflags='@log_wflags@'
+
+test_name=INVALID
+log_file=BAD.log
+trs_file=BAD.trs
+extra_opts=
+while test $# -gt 0; do
+  case $1 in
+    --test-name) test_name=$2; shift;;
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    # Ignored.
+    --expect-failure) shift;;
+    --color-tests) shift;;
+    --enable-hard-errors) shift;;
+    # Remembered in the same order they're passed in.
+    $am_log_wflags|$log_wflags) extra_opts="$extra_opts $1";;
+    # Explicitly terminate option list.
+    --) shift; break;;
+    # Shouldn't happen
+    *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+
+echo "$me" "$test_name" $extra_opts > "$log_file"
+: > "$trs_file"
+
+exec "$@"
+exit 127
+END
+
+sed -e 's|@am_log_wflags@|--am-chk|' \
+    -e 's|@log_wflags@|--chk|' \
+    < wrapper.skel > chk-wrapper
+
+sed -e 's|@am_log_wflags@|-am-test|' \
+    -e 's|@log_wflags@|-test|' \
+    < wrapper.skel > test-wrapper
+
+sed -e 's|@am_log_wflags@|am|' \
+    -e 's|@log_wflags@|_|' \
+    < wrapper.skel > bin/noext-wrapper
+
+# `test-wrapper' is deliberately not made executable.
+chmod a+x chk-wrapper bin/noext-wrapper
+
+# Not needed anymore.
+rm -f wrapper.skel
+
+cat > 1.chk << 'END'
+#! /bin/sh
+exit 0
+END
+chmod a+x 1.chk
+cp 1.chk 2.test
+cp 1.chk 3
+cp 1.chk 4.c.chk
+cp 1.chk 5.suf
+cp 1.chk sub/test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+VERBOSE=yes $MAKE check
+ls -l . sub
+
+test ! -r BAD.log
+test ! -r BAD.trs
+
+echo 'chk-wrapper 1.chk --am-chk --chk' > 1.exp
+echo 'test-wrapper 2.test -am-test -test' > 2.exp
+echo 'noext-wrapper 3 am _' > 3.exp
+echo 'chk-wrapper 4.c.chk --am-chk --chk' > 4.c.exp
+echo 'noext-wrapper 5.suf am _' > 5.suf.exp
+echo 'noext-wrapper sub/test am _' > sub/test.exp
+
+st=0
+for x in 1 2 3 4.c 5.suf sub/test; do
+  cat $x.log
+  diff $x.exp $x.log || st=1
+done
+
+Exit $st
diff --git a/tests/test-driver-fail.test b/tests/test-driver-fail.test
new file mode 100755 (executable)
index 0000000..fdc7251
--- /dev/null
@@ -0,0 +1,65 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Custom test drivers: what happens when a test driver fails?  Well,
+# "make check" should at least fail too, and the test-suite.log
+# shouldn't be created.  Unfortunately, we cannot truly control also
+# the (non-)creation of individual test logs, since those are expected
+# to be created by the drivers themselves, and an ill-behaved driver
+# (like our dummy one in this test) might leave around a test log even
+# in case of internal failures.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+TEST_LOG_DRIVER = ./oops
+TESTS = foo.test
+END
+
+cat > foo.test <<'END'
+#! /bin/sh
+exit 0
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+# The testsuite driver does not exist.
+$MAKE check && Exit 1
+test ! -f test-suite.log
+
+# The testsuite driver exists and create the test log files, but fails.
+
+cat > oops <<'END'
+#!/bin/sh
+: > foo.log
+echo 'Oops, I fail!' >&2
+exit 1
+END
+chmod a+x oops
+
+$MAKE check && Exit 1
+test ! -f test-suite.log
+
+:
diff --git a/tests/test-driver-is-distributed.test b/tests/test-driver-is-distributed.test
new file mode 100755 (executable)
index 0000000..ffe9d2a
--- /dev/null
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check regression of parallel-tests:
+#  - `test-driver' script not correctly distributed when TESTS is
+#    defined in a subdir Makefile
+
+am_create_testdir=empty
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+ocwd=`pwd` || fatal_ "getting current working directory"
+
+do_check ()
+{
+  whereopts=$1 auxdir=$2
+  case $#,$whereopts in
+    2,ac) ac_opts=parallel-tests am_code= ;;
+    2,am) am_opts=parallel-tests ac_code= ;;
+       *) fatal_ "do_check: bad usage";;
+  esac
+  mkdir $whereopts
+  cd $whereopts
+  mkdir tests
+  unindent > configure.in << END
+    AC_INIT([$me], [1.0])
+    AC_CONFIG_AUX_DIR([$auxdir])
+    AM_INIT_AUTOMAKE([$ac_opts])
+    AC_CONFIG_FILES([Makefile tests/Makefile])
+    AC_OUTPUT
+END
+  if test $auxdir = .; then
+    test_driver=test-driver
+  else
+    mkdir $auxdir
+    test_driver=$auxdir/test-driver
+  fi
+  # No 'AUTOMAKE_OPTIONS' in here -- purposely.
+  unindent > Makefile.am << END
+    SUBDIRS = tests
+    check-local: test-top
+    test-top: distdir
+       ls -l \$(distdir) \$(distdir)/* ;: For debugging.
+       test -f \$(distdir)/$test_driver
+    .PHONY: test-top
+END
+  unindent > tests/Makefile.am << END
+    AUTOMAKE_OPTIONS = $am_opts
+    check-local: test-sub
+    test-sub:
+       echo ' ' \$(DIST_COMMON) ' ' | grep '[ /]$test_driver '
+    TESTS = foo.test
+    EXTRA_DIST = \$(TESTS)
+END
+  unindent > tests/foo.test << 'END'
+    #!/bin/sh
+    exit 0
+END
+  chmod a+x tests/foo.test
+  $ACLOCAL
+  $AUTOCONF
+  $AUTOMAKE -a
+  ./configure
+  $MAKE test-top
+  cd tests
+  $MAKE test-sub
+  cd ..
+  $MAKE distcheck
+  # Try code path without automatic installation of required files.
+  mv -f Makefile.in Makefile.sav
+  mv -f tests/Makefile.in tests/Makefile.sav
+  $AUTOMAKE
+  diff Makefile.in Makefile.sav
+  diff tests/Makefile.in tests/Makefile.sav
+  :
+}
+
+do_check ac .
+do_check am build-aux
+
+:
diff --git a/tests/test-driver-strip-vpath.test b/tests/test-driver-strip-vpath.test
new file mode 100755 (executable)
index 0000000..3ba34ff
--- /dev/null
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Custom test drivers: check that the test name passed to the test
+# driver has any VPATH prefix stripped.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+
+mkdir src build
+mv install-sh missing configure.in src
+rm -f depcomp
+
+cd src
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# The directories of the `bar.test' and `baz.test' tests are deliberately
+# called as the source directory, to verify that the VPATH-stripping code
+# doesn't get too easily confused.
+# The $(empty) are for eliciting VPATH rewrites on make implementations
+# that support it (e.g., Solaris make), to improve coverage.
+empty =
+TESTS = $(empty) foo.test src/bar.test ./src/baz.test $(empty)
+$(TESTS):
+TEST_LOG_DRIVER = $(srcdir)/checkstrip-driver
+EXTRA_DIST = checkstrip-driver
+END
+
+cat > checkstrip-driver <<'END'
+#! /bin/sh
+set -e
+while test $# -gt 0; do
+  case $1 in
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    --test-name) test_name=$2; shift;;
+    --expect-failure|--color-tests|--enable-hard-errors) shift;;
+    --) shift; break;;
+     *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+echo "test name: $test_name" # For debugging.
+case $test_name in
+  foo.test|./foo.test|src/ba[rz].test|./src/ba[rz].test);;
+  *) exit 1;;
+esac
+echo dummy > "$log_file"
+echo dummy > "$trs_file"
+END
+chmod a+x checkstrip-driver
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cd ..
+
+mkdir build1
+cd build1
+../src/configure
+# "$MAKE -n" is for debugging, should highlight any VPATH rewrite.
+$MAKE -n check || :
+$MAKE check
+cd ..
+
+mkdir build2
+cd build2
+"$ocwd"/src/configure
+# "$MAKE -n" is for debugging, should highlight any VPATH rewrite.
+$MAKE -n check || :
+$MAKE check
+cd ..
+
+cd src
+./configure
+$MAKE distcheck
+
+:
diff --git a/tests/test-driver-trs-suffix-registered.test b/tests/test-driver-trs-suffix-registered.test
new file mode 100755 (executable)
index 0000000..4a5b195
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# parallel-tests support: the following are registered with `.SUFFIXES':
+#  - .log
+#  - .trs (used by files that store test results and metadata)
+#  - .test if $(TEST_EXTENSIONS) is not defined
+#  - stuff in $(TEST_EXTENSIONS) otherwise
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+: > Makefile.am
+
+cat > 1.am << 'END'
+TESTS =
+END
+
+cat > 2.am << 'END'
+TEST_EXTENSIONS = .SH .abcdef
+TESTS =
+END
+
+: > test-driver
+
+$ACLOCAL
+
+$AUTOMAKE 1
+$AUTOMAKE 2
+
+sed -e 's/$/ /' 1.in > mk.1
+sed -e 's/$/ /' 2.in > mk.2
+
+grep '^\.SUFFIXES:' mk.1
+grep '^\.SUFFIXES:' mk.2
+
+for suf in test log trs; do
+  grep "^\\.SUFFIXES:.* \\.$suf " mk.1
+done
+
+for suf in SH abcdef log trs; do
+  grep "^\\.SUFFIXES:.* \\.$suf " mk.2
+done
+
+:
index 26409a8..0f9708c 100755 (executable)
 
 # Expose bug in conditional definition of TEST_EXTENSIONS.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_CONDITIONAL([COND], [:])
 AM_CONDITIONAL([COND2], [:])
index 901d872..e9b7e02 100755 (executable)
 # and do not diagnose valid (albeit more unusual) ones.
 # See automake bug#9400.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
@@ -37,7 +35,7 @@ echo " $valid_extensions" \
   | sed -e 's/ / ./g' -e 's/^/TEST_EXTENSIONS =/' >> Makefile.am
 cat Makefile.am # For debugging.
 
-$AUTOMAKE
+$AUTOMAKE -a
 
 grep -i 'log' Makefile.in # For debugging.
 
diff --git a/tests/test-harness-vpath-rewrite.test b/tests/test-harness-vpath-rewrite.test
new file mode 100755 (executable)
index 0000000..9d61064
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that our concurrent test harness is not subject to spurious VPATH
+# rewrites.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+LOG_COMPILER = true
+TESTS = x0 foo bar baz x1
+EXTRA_DIST = $(TESTS)
+END
+
+: > x0
+: > foo
+: > bar
+: > baz
+: > x1
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir build
+cd build
+../configure
+$MAKE check
+test -f test-suite.log
+test -f foo.log
+test -f foo.trs
+test -f bar.log
+test -f bar.trs
+test -f baz.log
+test -f baz.trs
+# We don't want VPATH rewrites, really.
+$MAKE check -n | $EGREP '\.\./(foo|bar|baz)( |$)' && Exit 1
+$MAKE distcheck
+
+:
diff --git a/tests/test-log.test b/tests/test-log.test
new file mode 100755 (executable)
index 0000000..144c866
--- /dev/null
@@ -0,0 +1,178 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check parallel-tests features:
+#  - log file creation
+#  - log file removal
+#  - stdout and stderr of a test script go in its log file
+#  - TEST_SUITE_LOG redefinition, at either automake or make time
+#  - VERBOSE environment variable support
+# Keep in sync with 'tap-log.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = pass.test skip.test xfail.test fail.test xpass.test error.test
+XFAIL_TESTS = xpass.test xfail.test
+TEST_SUITE_LOG = global.log
+END
+
+# Custom markers, for use in grepping checks.
+cmarker=::: # comment marker
+pmarker=%%% # plain maker
+
+cat > pass.test <<END
+#! /bin/sh
+echo   "$pmarker pass $pmarker" >&2
+echo "# $cmarker pass $cmarker" >&2
+exit 0
+END
+
+cat > skip.test <<END
+#! /bin/sh
+echo   "$pmarker skip $pmarker"
+echo "# $cmarker skip $cmarker"
+exit 77
+END
+
+cat > xfail.test <<END
+#! /bin/sh
+echo   "$pmarker xfail $pmarker" >&2
+echo "# $cmarker xfail $cmarker" >&2
+exit 1
+END
+
+cat > fail.test <<END
+#! /bin/sh
+echo   "$pmarker fail $pmarker"
+echo "# $cmarker fail $cmarker"
+exit 1
+END
+
+cat > xpass.test <<END
+#! /bin/sh
+echo   "$pmarker xpass $pmarker" >&2
+echo "# $cmarker xpass $cmarker" >&2
+exit 0
+END
+
+cat > error.test <<END
+#! /bin/sh
+echo   "$pmarker error $pmarker"
+echo "# $cmarker error $cmarker"
+exit 99
+END
+
+chmod a+x *.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+TEST_SUITE_LOG=my.log $MAKE -e check && Exit 1
+ls -l # For debugging.
+test ! -f test-suite.log
+test ! -f global.log
+test -f my.log
+st=0
+for result in pass fail xfail xpass skip error; do
+  cat $result.log # For debugging.
+  $FGREP "$pmarker $result $pmarker" $result.log || st=1
+  $FGREP "$cmarker $result $cmarker" $result.log || st=1
+done
+test $st -eq 0 || Exit 1
+cat my.log # For debugging.
+for result in xfail fail xpass skip error; do
+  cat $result.log # For debugging.
+  $FGREP "$pmarker $result $pmarker" my.log || st=1
+  $FGREP "$cmarker $result $cmarker" my.log || st=1
+done
+test `$FGREP -c "$pmarker" my.log` -eq 5
+test `$FGREP -c "$cmarker" my.log` -eq 5
+
+have_rst_section ()
+{
+  eqeq=`echo "$1" | sed 's/./=/g'`
+  # Assume $1 contains no RE metacharacters.
+  sed -n "/^$1$/,/^$eqeq$/p" $2 > got
+  (echo "$1" && echo "$eqeq") > exp
+  cat exp
+  cat got
+  diff exp got
+}
+
+# Passed test scripts shouldn't be mentioned in the global log.
+$EGREP ':.*[^x]pass' my.log && Exit 1
+# But failing (expectedly or not) and skipped ones should.
+have_rst_section 'SKIP: skip'   my.log
+have_rst_section 'FAIL: fail'   my.log
+have_rst_section 'XFAIL: xfail' my.log
+have_rst_section 'XPASS: xpass' my.log
+have_rst_section 'ERROR: error' my.log
+
+touch error2.log test-suite.log global.log
+TEST_SUITE_LOG=my.log $MAKE -e mostlyclean
+ls -l # For debugging.
+test ! -f my.log
+test ! -f pass.log
+test ! -f fail.log
+test ! -f xfail.log
+test ! -f xpass.log
+test ! -f skip.log
+test ! -f error.log
+# "make mostlyclean" shouldn't remove unrelated log files.
+test -f error2.log
+test -f test-suite.log
+test -f global.log
+
+rm -f *.log
+
+VERBOSE=yes $MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+cat global.log
+test ! -f my.log
+test ! -f test-suite.log
+# Check that VERBOSE causes the global testsuite log to be
+# emitted on stdout.
+out=`cat stdout`
+log=`cat global.log`
+case $out in *"$log"*) ;; *) Exit 1;; esac
+
+touch error2.log test-suite.log my.log
+$MAKE clean
+ls -l # For debugging.
+test ! -f global.log
+test ! -f pass.log
+test ! -f fail.log
+test ! -f xfail.log
+test ! -f xpass.log
+test ! -f skip.log
+test ! -f error.log
+# "make clean" shouldn't remove unrelated log files.
+test -f error2.log
+test -f test-suite.log
+test -f my.log
+
+rm -f *.log
+
+:
diff --git a/tests/test-logs-repeated.test b/tests/test-logs-repeated.test
new file mode 100755 (executable)
index 0000000..0bec579
--- /dev/null
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check parallel-tests features:
+#  - $(TESTS_LOGS) can end up holding duplicated entries
+# Such behaviour can be useful for projects that want to verify that
+# different test scripts don't end up sharing the same log file.
+# (Automake itself is such a project, BTW ;-)
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .sh .test .bar
+TESTS = foo.sh mu.test foo.test foo.bar
+.PHONY: verify
+verify:
+       is $(TEST_LOGS) == foo.log mu.log foo.log foo.log
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE verify
+
+:
diff --git a/tests/test-metadata-global-log.test b/tests/test-metadata-global-log.test
new file mode 100755 (executable)
index 0000000..ab43802
--- /dev/null
@@ -0,0 +1,147 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Custom test drivers and parallel-tests harness: check the documented
+# semantics for deciding when the content of a test log file should be
+# copied in the global test-suite.log file.  Currently, this is done
+# with the use of the reStructuredText field `:copy-in-global-log:' in
+# the associated `.trs' files.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = ./passthrough-driver
+TEST_LOG_COMPILER = $(SHELL) -e
+END
+
+cat > passthrough-driver <<'END'
+#!/bin/sh
+set -e; set -u;
+while test $# -gt 0; do
+  case $1 in
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    --test-name) test_name=$2; shift;;
+    --expect-failure|--color-tests|--enable-hard-errors) shift;;
+    --) shift; break;;
+     *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+echo "$test_name: RUN"
+"$@" >$log_file 2>&1 5>$trs_file
+END
+chmod a+x passthrough-driver
+
+# The `:test-result:' and `:recheck:' fields and the first line of the
+# log file should be be irrelevant for the decision of whether a test
+# output is to be copied in the `test-suite.log'.
+
+cat > no-1.test <<END
+echo :test-result: SKIP >&5
+echo :copy-in-global-log: no >&5
+echo :test-result: FAIL >&5
+echo :test-result: XPASS >&5
+echo not seen 1
+END
+
+# In the last line, with leading and trailing whitespace in the value.
+cat > no-2.test <<END
+echo ":test-result: FAIL" >&5
+echo "not seen 2"
+echo ":recheck: yes" >&5
+echo ":copy-in-global-log:$tab $tab no   $tab" >&5
+END
+
+for RES in XPASS FAIL XFAIL SKIP ERROR UNKNOWN; do
+  unindent > $RES.test <<END
+    echo :test-result: $RES >&5
+    echo :copy-in-global-log: no >&5
+    echo not seen $RES
+END
+done
+
+# In the first line, with no whitespace.
+cat > no-3.test <<END
+echo :copy-in-global-log:no >&5
+echo ":test-result: FAIL" >&5
+echo "not seen 3"
+END
+
+# Leading whitespace before the field.
+cat > no-4.test <<END
+echo ":test-result: FAIL" >&5
+echo "  $tab $tab$tab   :copy-in-global-log: no" >&5
+echo "not seen 4"
+END
+
+cat > yes-1.test <<END
+echo :test-result: PASS >&5
+echo :copy-in-global-log: yes >&5
+echo seen yes 1
+END
+
+# A lacking `:copy-in-global-log:' implies that the content of
+# the log file should be copied.
+cat > yes-2.test <<END
+echo :test-result: PASS >&5
+echo seen yes 2
+END
+
+# Three corner cases.
+
+cat > corn-1.test <<END
+echo seen corn 1
+echo ':copy-in-global-log:' >&5
+END
+
+cat > corn-2.test <<END
+echo seen corn 2
+echo '$tab $tab$tab' >&5
+END
+
+cat > corn-3.test <<'END'
+echo seen corn 31
+echo ':copy-in-global-log:#@%!' >&5
+echo seen corn 32
+END
+
+echo TESTS = *.test >> Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+# We don't care about the exit status of "make check" here, that
+# should be checked in other tests.
+$MAKE check || :
+cat test-suite.log
+grep '^seen yes 1$' test-suite.log
+grep '^seen yes 2$' test-suite.log
+grep '^seen corn 1$' test-suite.log
+grep '^seen corn 2$' test-suite.log
+grep '^seen corn 31$' test-suite.log
+grep '^seen corn 32$' test-suite.log
+$FGREP 'not seen' test-suite.log && Exit 1
+
+:
diff --git a/tests/test-metadata-global-result.test b/tests/test-metadata-global-result.test
new file mode 100755 (executable)
index 0000000..f524328
--- /dev/null
@@ -0,0 +1,196 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Parallel testsuite harness: check APIs for the registering the
+# "global test result" in `*.trs' files, as documented in the automake
+# manual.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .test .x
+TEST_LOG_DRIVER = ./dummy-driver
+X_LOG_DRIVER = ./dummy-driver
+TESTS = foo.test zar-doz.test
+END
+
+cat > dummy-driver <<'END'
+#! /bin/sh
+set -e; set -u
+while test $# -gt 0; do
+  case $1 in
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    --test-name) test_name=$2; shift;;
+    --expect-failure|--color-tests|--enable-hard-errors) shift;;
+    --) shift; break;;
+     *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+echo logloglog > $log_file
+cp $1 $trs_file
+END
+chmod a+x dummy-driver
+
+# Do this in a subroutine to avoid quoting problem in the backticked
+# command substitution below.
+get_escaped_line()
+{
+   sed -e 's,[$^/\\\.],\\&,g' -e 1q "$@"
+}
+
+have_result ()
+{
+   cat > exp; echo >> exp; echo logloglog >> exp
+   eline=`get_escaped_line exp`
+   sed -n -e "/^$eline$/,/^logloglog$/p" test-suite.log > got
+   cat exp; cat got
+   diff exp got
+}
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+: Basic checks.
+
+echo :global-test-result: PASS > foo.test
+echo :global-test-result: ERROR > zar-doz.x
+
+$MAKE check
+cat test-suite.log
+
+have_result <<END
+PASS: foo
+=========
+END
+
+have_result <<END
+ERROR: zar-doz
+==============
+END
+
+: Try usage documented in the manual.
+
+echo :global-test-result: PASS/SKIP > foo.test
+echo :global-test-result: ALMOST PASSED > zar-doz.x
+
+$MAKE check
+cat test-suite.log
+
+have_result <<END
+PASS/SKIP: foo
+==============
+END
+
+have_result <<END
+ALMOST PASSED: zar-doz
+======================
+END
+
+: Fields ':test-result:' does not interfere with the global test result.
+
+cat > foo.test << 'END'
+:test-result: FAIL
+:global-test-result: PASS
+:test-result: ERROR
+END
+
+cat > zar-doz.x << 'END'
+:global-test-result: FAIL
+:test-result: SKIP
+:test-result: XFAIL
+END
+
+$MAKE check && Exit 1
+cat test-suite.log
+
+have_result <<END
+PASS: foo
+=========
+END
+
+have_result <<END
+FAIL: zar-doz
+=============
+END
+
+: What happens when ':global-test-result:' is absent.
+
+cat > foo.test << 'END'
+:test-result: PASS
+:test-result: ERROR
+END
+: > zar-doz.x
+
+$MAKE check && Exit 1
+cat test-suite.log
+
+have_result <<END
+RUN: foo
+========
+END
+
+have_result <<END
+RUN: zar-doz
+============
+END
+
+# Leading and trailing whitespace gets eaten/normalized.
+
+echo ":global-test-result:SKIP${tab}   ${tab}${tab}" > foo.test
+echo ":global-test-result:${tab}   ${tab}XFAIL  ${tab}   " > zar-doz.x
+
+$MAKE check
+cat test-suite.log
+
+have_result <<END
+SKIP: foo
+=========
+END
+
+have_result <<END
+XFAIL: zar-doz
+==============
+END
+
+# Whitespaces before and after `:global-test-result:' are handled OK.
+
+echo "   $tab:global-test-result:PASS" > foo.test
+echo "${tab}${tab}:global-test-result:${tab}   ${tab}SKIP" > zar-doz.x
+
+$MAKE check
+cat test-suite.log
+
+have_result <<END
+PASS: foo
+=========
+END
+
+have_result <<END
+SKIP: zar-doz
+=============
+END
+
+:
diff --git a/tests/test-metadata-recheck.test b/tests/test-metadata-recheck.test
new file mode 100755 (executable)
index 0000000..1d34ff1
--- /dev/null
@@ -0,0 +1,164 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test the "make recheck" semantics for custom test drivers, as documented
+# in the Automake manual.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+LOG_DRIVER = ./dummy-driver
+TEST_EXTENSIONS =
+TESTS =
+END
+
+#
+# Tests to be re-run by "make recheck"
+#
+
+: > y-1
+echo "foo bar" > y-2
+echo ":recheck:" > y-3
+echo ":recheck:yes" > y-4
+echo ":recheck: who cares" > y-5
+echo ":recheck: $tab   y" > y-6
+echo ":recheck: yeah!$tab$tab " > y-7
+cat > y-10 <<END
+:foo:
+:recheck: ???
+END
+cat > y-11 <<END
+:recheck: YES
+:foo:
+END
+cat > y-12 <<END
+foo
+:recheck:yes
+
+bar
+zardoz
+END
+
+echo "  $tab $tab$tab    :recheck: yes" > y-8
+
+# The :test-result: fields and the fist line of the log should be
+# irrelevant for the decision of whether "make recheck" should or
+# should not re-run a test.
+
+echo ":test-result: PASS" > y-100
+
+echo "PASS: y-101"
+
+cat > y-102 <<END
+PASS: y-102
+===========
+
+:test-result: PASS
+END
+
+#
+# Tests *not* to be re-run by "make recheck"
+#
+
+echo ":recheck:no" > n-1
+echo ":recheck: no " > n-2
+echo ":recheck: $tab   no" > n-3
+echo ":recheck: no $tab$tab " > n-4
+cat > n-5 <<END
+:foo:
+:recheck:no
+END
+cat > n-6 <<END
+:recheck: no
+:foo:
+END
+cat > n-7 <<END
+foo
+:recheck: no$tab$tab
+
+bar
+zardoz
+END
+
+echo "  $tab $tab$tab    :recheck: no" > n-8
+
+# The :test-result: fields should be irrelevant for the decision of
+# whether "make recheck" should or should not re-run a test.
+cat > n-100 <<END
+:test-result: FAIL
+:test-result: XPASS
+:test-result: ERROR
+:test-result: UNKNOWN
+:recheck: no
+END
+
+rechecked=`echo y-[0-9]*`
+
+for t in [yn]-[0-9]*; do echo $t; done \
+  | sed 's/.*/TESTS += &/' >> Makefile.am
+
+cat Makefile.am # For debugging.
+
+cat > dummy-driver <<'END'
+#!/bin/sh
+set -e; set -u
+while test $# -gt 0; do
+  case $1 in
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    --test-name) test_name=$2; shift;;
+    --expect-failure|--color-tests|--enable-hard-errors) shift;;
+    --) shift; break;;
+     *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+: > $test_name.run
+: > $log_file
+cp $1 $trs_file
+END
+chmod a+x dummy-driver
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+# The ':test-result:' fields should be ignored by "make recheck",
+# but should cause the testsuite report to detect errors.
+$MAKE check && Exit 1
+ls -l
+for t in $tests; do test -f $t.run; done
+rm -f *.run
+
+# But now the tests that actually get re-run have only ':test-result:'
+# fields indicating success, so "make recheck" must pass.  Still, the
+# next "make recheck" call should still re-run the same set of tests.
+for iteration in 1 2; do
+  $MAKE recheck
+  ls -l
+  for t in $rechecked; do test -f $t.run; done
+  find . -name 'n-*.run' | grep . && Exit 1
+  : For shells with busted 'set -e'.
+done
+
+:
diff --git a/tests/test-metadata-results.test b/tests/test-metadata-results.test
new file mode 100755 (executable)
index 0000000..11feea7
--- /dev/null
@@ -0,0 +1,176 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Parallel testsuite harness: check APIs for the registering of test
+# results in `*.trs' files, as documented in the automake manual.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = ./dummy-driver
+TESTS = foo.test bar.test
+END
+
+cat > dummy-driver <<'END'
+#! /bin/sh
+set -e; set -u
+while test $# -gt 0; do
+  case $1 in
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    --test-name) test_name=$2; shift;;
+    --expect-failure|--color-tests|--enable-hard-errors) shift;;
+    --) shift; break;;
+     *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+: > $log_file
+cp $1 $trs_file
+END
+chmod a+x dummy-driver
+
+mk_check ()
+{
+  st=0
+  $MAKE check >stdout || st=$?
+  cat stdout
+  # Our dummy driver make no testsuite progress report.
+  grep ': .*\.test' stdout && Exit 1
+  # Nor it writes to the log files.
+  test -s foo.log && Exit 1
+  test -s bar.log && Exit 1
+  return $st
+}
+
+# This must be different from the one defined in `test/defs', as that
+# assumes that the driver does proper testsuite progress reporting.
+count_test_results ()
+{
+  total=ERR pass=ERR fail=ERR xpass=ERR xfail=ERR skip=ERR error=ERR
+  eval "$@"
+  st=0
+  grep "^# TOTAL:  *$total$" stdout || rc=1
+  grep "^# PASS:  *$pass$"   stdout || rc=1
+  grep "^# XFAIL:  *$xfail$" stdout || rc=1
+  grep "^# SKIP:  *$skip$"   stdout || rc=1
+  grep "^# FAIL:  *$fail$"   stdout || rc=1
+  grep "^# XPASS:  *$xpass$" stdout || rc=1
+  grep "^# ERROR:  *$error$" stdout || rc=1
+  test $st -eq 0 || Exit 1
+}
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+# Basic checks.  Also that that `:global-test-result:' fields and
+# "old-style" directives with format "RESULT: test-name" are now ignored.
+
+: > foo.test
+echo blah blah blah > bar.test
+mk_check
+count_test_results total=0 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+cat > foo.test <<END
+:test-global-result: PASS
+:test-result: FAIL
+END
+cat > bar.test <<END
+:test-result: SKIP
+:test-global-result: ERROR
+END
+mk_check && Exit 1
+count_test_results total=2 pass=0 fail=1 xpass=0 xfail=0 skip=1 error=0
+
+cat > foo.test <<END
+FAIL: foo.test
+:test-result: PASS
+:test-global-result: XPASS
+END
+echo ERROR: bar.test > bar.test
+mk_check
+count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+cat > foo.test <<END
+:test-global-result: SKIP
+:test-result: FAIL
+END
+cat > bar.test <<END
+:test-global-result: PASS
+END
+mk_check && Exit 1
+count_test_results total=1 pass=0 fail=1 xpass=0 xfail=0 skip=0 error=0
+
+cat > foo.test <<END
+:test-result: XFAIL
+:test-result: PASS
+:test-result: SKIP
+END
+cat > bar.test <<END
+:test-result: SKIP
+:test-result: PASS
+:test-result: SKIP
+:test-result: PASS
+:test-result: PASS
+END
+mk_check
+count_test_results total=8 pass=4 fail=0 xpass=0 xfail=1 skip=3 error=0
+
+# Check that all results expected to be supported are *really* supported.
+
+cat > foo.test <<END
+:test-result: PASS
+:test-result: SKIP
+:test-result: XFAIL
+:test-result: FAIL
+:test-result: XPASS
+:test-result: ERROR
+END
+: > bar.test
+mk_check && Exit 1
+count_test_results total=6 pass=1 fail=1 xpass=1 xfail=1 skip=1 error=1
+
+cp foo.test bar.test
+mk_check && Exit 1
+count_test_results total=12 pass=2 fail=2 xpass=2 xfail=2 skip=2 error=2
+
+# Check that we are liberal w.r.t. whitespace use.
+
+: > foo.test
+: > bar.test
+for RESULT in PASS FAIL XPASS XFAIL SKIP ERROR; do
+  sed -e 's/^ *//' -e 's/|//g' >> foo.test <<END
+    |:test-result:$RESULT|
+    |:test-result: $tab  $RESULT|
+    |:test-result:$RESULT  $tab|
+    |:test-result:$tab$tab  $RESULT$tab  $tab |
+END
+  echo "  $tab $tab$tab   :test-result: $RESULT" >> bar.test
+done
+cat foo.test # For debugging.
+cat bar.test # Likewise.
+mk_check && Exit 1
+count_test_results total=30 pass=5 fail=5 xpass=5 xfail=5 skip=5 error=5
+
+:
diff --git a/tests/test-missing.test b/tests/test-missing.test
new file mode 100755 (executable)
index 0000000..4e9f286
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# parallel-tests:
+#  - non-existent scripts listed in TESTS get diagnosed
+# See also related test 'test-missing2.test'.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = ok.test zardoz.test
+TEST_LOG_COMPILER = true
+END
+
+: > ok.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE check >output 2>&1 && { cat output; Exit 1; }
+cat output
+test -f ok.log
+grep '^PASS: ok\.test' output
+$FGREP 'zardoz.log' output
+test ! -f test-suite.log
+
+TESTS='zardoz2.test' $MAKE -e check >output 2>&1 \
+  && { cat output; Exit 1; }
+cat output
+$FGREP 'zardoz2.log' output
+test ! -f test-suite.log
+
+TEST_LOGS='zardoz3.log' $MAKE -e check >output 2>&1 \
+  && { cat output; Exit 1; }
+cat output
+$FGREP 'zardoz3.log' output
+test ! -f test-suite.log
+
+# The errors should persist even after `test-suite.log'
+# has been created.
+
+: > zardoz.test
+$MAKE check
+rm -f zardoz.test
+
+$MAKE check >output 2>&1 && { cat output; Exit 1; }
+cat output
+$FGREP 'zardoz.log' output
+test ! -f test-suite.log
+
+:
similarity index 54%
rename from tests/parallel-tests-unreadable-log.test
rename to tests/test-missing2.test
index 572f03d..25d5173 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 that the testsuite driver copes well with unreadable test logs.
+# parallel-tests:
+#  - non-existent scripts listed in TESTS get diagnosed, even when
+#    all the $(TEST_LOGS) have a dummy dependency.
+# See also related test 'test-missing.test'.
 
-parallel_tests=yes
+am_parallel_tests=yes
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
@@ -24,37 +27,28 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-TESTS = foo.test bar.test
-XFAIL_TESTS = bar.test
+TESTS = foobar1.test foobar2.test
+$(TEST_LOGS):
 END
 
-cat > foo.test << 'END'
-#! /bin/sh
-exit 0
-END
-cat > bar.test << 'END'
-#! /bin/sh
-exit 1
-END
-chmod a+x foo.test bar.test
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-# The testsuite driver will use this variable, so ensure it sanitizes
-# it and do not allow in spurious values from the environment.
-line=PASS; export line
-
 ./configure
 
-$MAKE foo.log
-$MAKE bar.log
-chmod a-r foo.log bar.log
-test ! -r foo.log || Exit 77
-$MAKE test-suite.log >stdout && { cat stdout; Exit 1; }
-cat stdout
-grep '^2 of 2 tests failed *$' stdout
-grep '^2 of 2 tests failed\. *$' test-suite.log
+$MAKE foobar1.log foobar2.log || Exit 99
+test ! -f foobar1.log || Exit 99
+test ! -f foobar1.trs || Exit 99
+test ! -f foobar2.log || Exit 99
+test ! -f foobar2.trs || Exit 99
+
+$MAKE check >output 2>&1 && { cat output; Exit 1; }
+cat output
+grep 'test-suite\.log.*foobar1\.log' output
+grep 'test-suite\.log.*foobar1\.trs' output
+grep 'test-suite\.log.*foobar2\.log' output
+grep 'test-suite\.log.*foobar2\.trs' output
+test ! -f test-suite.log
 
 :
diff --git a/tests/test-trs-basic.test b/tests/test-trs-basic.test
new file mode 100755 (executable)
index 0000000..b615b18
--- /dev/null
@@ -0,0 +1,158 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check parallel harness features:
+#  - creation and removal of `.trs' auxiliary files
+#  - check some internals regarding the use of `.trs' files.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_EXTENSIONS = .sh .test
+TESTS = foo.test bar.sh sub/zardoz.test
+TEST_LOG_COMPILER = $(SHELL)
+SH_LOG_COMPILER = $(SHELL)
+
+## Used to check some internal details.  And yes, the quotes around
+## `$bases' are deliberate: they check for whitespace normalization.
+tb:
+       $(am__set_TESTS_bases); echo "$$bases" > $@
+END
+
+cat > foo.test << 'END'
+#! /bin/sh
+exit $FOO_STATUS
+END
+: > bar.sh
+mkdir sub
+: > sub/zardoz.test
+
+FOO_STATUS=0; export FOO_STATUS
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+
+#
+# Check some internal details first.
+#
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=..
+    mkdir build
+    cd build
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+
+  $MAKE tb
+  test x"`cat tb`" = x"foo bar sub/zardoz"
+  rm -f tb
+  # Please don't change the order of the stuff in TESTS, below.
+  TESTS='foo.test foo2.sh foo-log foolog.test a.log.b.sh 0.exe' $MAKE -e tb
+  test x"`cat tb`" = x"foo foo2 foo-log foolog a.log.b 0.exe"
+  rm -f tb
+
+  cd $srcdir
+
+done
+
+#
+# The `test-suite.stamp' file and the `.trs' files get created by
+# "make check" and removed by "make clean" and "make mostlyclean".
+#
+
+: > unrelated.trs
+: > sub/foo.trs
+
+$MAKE check
+test -f foo.trs
+test -f bar.trs
+test -f sub/zardoz.trs
+$MAKE clean
+test ! -f foo.trs
+test ! -f bar.trs
+test ! -f sub/zardoz.trs
+# Unrelated `.trs' files shouldn't be removed.
+test -f unrelated.trs
+test -f sub/foo.trs
+
+# The files should be properly created in case of testsuite failure too.
+FOO_STATUS=1 $MAKE check && Exit 1
+test -f foo.trs
+test -f bar.trs
+test -f sub/zardoz.trs
+$MAKE mostlyclean
+test ! -f foo.trs
+test ! -f bar.trs
+test ! -f sub/zardoz.trs
+# Unrelated `.trs' files shouldn't be removed.
+test -f unrelated.trs
+test -f sub/foo.trs
+
+#
+# Try with a subset of TESTS.
+#
+
+TESTS=foo.test $MAKE -e check
+test -f foo.trs
+test ! -f bar.trs
+test ! -f sub/zardoz.trs
+$MAKE clean
+test ! -f foo.trs
+TESTS='foo.test bar.sh' $MAKE -e check
+test -f foo.trs
+test -f bar.trs
+test ! -f sub/zardoz.trs
+# "make clean" shouldn't remove `.trs' files for tests not in $(TESTS).
+TESTS=bar.sh $MAKE -e clean
+test -f foo.trs
+test ! -f bar.trs
+
+$MAKE clean
+
+#
+# Try with a subset of TEST_LOGS.
+#
+
+TEST_LOGS=sub/zardoz.log $MAKE -e check
+test ! -f foo.trs
+test ! -f bar.trs
+test -f sub/zardoz.trs
+$MAKE clean
+test ! -f sub/zardoz.trs
+TEST_LOGS='foo.log bar.log' $MAKE -e check
+test -f foo.trs
+test -f bar.trs
+test ! -f sub/zardoz.trs
+# "make clean" shouldn't remove `.trs' files for tests whose log
+# is not in $(TEST_LOGS).
+TEST_LOGS=foo.log $MAKE -e clean
+test ! -f foo.trs
+test -f bar.trs
+test ! -f sub/zardoz.trs
+
+:
diff --git a/tests/test-trs-recover.test b/tests/test-trs-recover.test
new file mode 100755 (executable)
index 0000000..e498688
--- /dev/null
@@ -0,0 +1,167 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check parallel harness features:
+#  - recovery from deleted `.trs' files, in various scenarios
+# This test is complex and tricky, but that's acceptable since we are
+# testing semantics that are potentially complex and tricky.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = foo.test bar.test baz.test
+TEST_LOG_COMPILER = $(SHELL)
+END
+
+# Creative quoting below to please maintainer-check.
+echo exit '$TEST_STATUS' > foo.test
+echo exit '$TEST_STATUS' > bar.test
+: > baz.test
+
+TEST_STATUS=0; export TEST_STATUS
+
+# Slower and possible overkill in some situations, but also clearer
+# and safer.
+update_stamp () { $sleep && touch stamp && $sleep; }
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+: Create the required log files.
+$MAKE check
+
+: Recreate by hand.
+rm -f foo.trs bar.trs baz.trs
+$MAKE foo.trs
+test -f foo.trs
+test ! -f bar.trs
+test ! -f baz.trs
+
+: Recreate by hand, several at the same time.
+rm -f foo.trs bar.trs baz.trs
+$MAKE foo.trs bar.trs
+test -f foo.trs
+test -f bar.trs
+test ! -f baz.trs
+
+: Recreate by hand, with a failing test.
+rm -f foo.trs bar.trs
+TEST_STATUS=1 $MAKE bar.trs baz.trs >stdout || { cat stdout; Exit 1; }
+cat stdout
+test ! -f foo.trs
+test -f bar.trs
+test -f baz.trs
+grep '^FAIL: bar\.test' stdout
+$EGREP '^(baz|foo)\.test' stdout && Exit 1
+
+: Recreate with a sweeping "make check", and ensure that also up-to-date
+: '.trs' files are remade.
+update_stamp
+rm -f foo.trs bar.trs
+$MAKE check
+test -f foo.trs
+test -f bar.trs
+is_newest baz.trs stamp
+
+: Recreate with a sweeping "make check" with failing tests.  Again,
+: ensure that also up-to-date '.trs' files are remade -- this time we
+: grep the "make check" output verify that.
+rm -f foo.trs bar.trs
+TEST_STATUS=1 $MAKE check >stdout && { cat stdout; Exit 1; }
+test -f foo.trs
+test -f bar.trs
+grep '^FAIL: foo\.test' stdout
+grep '^FAIL: bar\.test' stdout
+grep '^PASS: baz\.test' stdout
+
+: Recreate with a "make check" with redefined TESTS.
+rm -f foo.trs bar.trs baz.trs
+TESTS=foo.test $MAKE -e check
+test -f foo.trs
+test ! -f bar.trs
+test ! -f baz.trs
+
+: Recreate with a "make check" with redefined TEST_LOGS.
+rm -f foo.trs bar.trs baz.trs
+TEST_LOGS=bar.log $MAKE -e check
+test ! -f foo.trs
+test -f bar.trs
+test ! -f baz.trs
+
+: Interactions with "make recheck" are OK.
+rm -f foo.trs bar.trs baz.log baz.trs
+$MAKE recheck >stdout || { cat stdout; Exit 1; }
+cat stdout
+test -f foo.trs
+test -f bar.trs
+test ! -f baz.trs
+test ! -f baz.log
+grep '^PASS: foo\.test' stdout
+grep '^PASS: bar\.test' stdout
+grep 'baz\.test' stdout && Exit 1
+count_test_results total=2 pass=2 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+: Setup for the next check.
+$MAKE check
+test -f foo.trs
+test -f bar.trs
+test -f baz.trs
+
+: Recreate by remaking the global test log, and ensure that up-to-date
+: '.trs' files are *not* remade.
+update_stamp
+rm -f foo.trs bar.trs test-suite.log
+$MAKE test-suite.log >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^PASS: foo\.test' stdout
+grep '^PASS: bar\.test' stdout
+grep 'baz\.test' stdout && Exit 1
+stat *.trs *.log stamp || : # For debugging.
+# Check that make has updated what it needed to, but no more.
+test -f foo.trs
+test -f bar.trs
+is_newest stamp baz.trs
+is_newest test-suite.log foo.trs bar.trs
+
+: Setup for the next check.
+$MAKE check
+test -f foo.trs
+test -f bar.trs
+test -f baz.trs
+
+: Interactions with lazy test reruns are OK.
+rm -f foo.trs
+update_stamp
+touch bar.test
+RECHECK_LOGS= $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+# Check that make has updated what it needed to, but no more.
+test -f foo.trs
+is_newest bar.trs bar.test
+is_newest stamp baz.trs
+grep '^PASS: foo\.test' stdout
+grep '^PASS: bar\.test' stdout
+grep 'baz\.test' stdout && Exit 1
+
+:
diff --git a/tests/test-trs-recover2.test b/tests/test-trs-recover2.test
new file mode 100755 (executable)
index 0000000..fb9f924
--- /dev/null
@@ -0,0 +1,133 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check parallel harness features:
+#  - recovery from unreadable `.trs' files, in various scenarios
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = foo.test bar.test
+TEST_LOG_COMPILER = true
+END
+
+: > foo.test
+: > bar.test
+
+TEST_STATUS=0; export TEST_STATUS
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+: > t
+chmod a-r t
+test ! -r t || Exit 77
+rm -f t
+
+: Create the required log files.
+$MAKE check
+test -f foo.trs
+test -f bar.trs
+
+: Recreate with a sweeping "make check".
+chmod a-r bar.trs
+$MAKE check
+test -f foo.trs
+test -r foo.trs
+test -f bar.trs
+test -r bar.trs
+
+: Again, this time with one .trs file missing and the other
+: one unreadable.
+rm -f foo.trs
+chmod a-r bar.trs
+$MAKE check
+test -f foo.trs
+test -r foo.trs
+test -f bar.trs
+test -r bar.trs
+
+: Again, but using "make recheck" this time.
+rm -f foo.trs
+chmod a-r bar.trs
+$MAKE recheck >stdout || { cat stdout; Exit 1; }
+cat stdout
+test -f foo.trs
+test -r foo.trs
+test -f bar.trs
+test -r bar.trs
+grep '^PASS: foo\.test' stdout
+grep '^PASS: bar\.test' stdout
+
+: More complex interactions with "make recheck" are OK.
+chmod a-r bar.log bar.trs
+$MAKE recheck >stdout || { cat stdout; Exit 1; }
+cat stdout
+test -f bar.trs
+test -r bar.trs
+grep '^PASS: bar\.test' stdout
+grep 'foo\.test' stdout && Exit 1
+count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
+
+: Recreate by remaking the global test log.
+chmod a-r foo.trs
+rm -f test-suite.log
+$MAKE test-suite.log >stdout || { cat stdout; Exit 1; }
+cat stdout
+test -f foo.trs
+test -r foo.trs
+grep '^PASS: foo\.test' stdout
+grep 'bar\.test' stdout && Exit 1
+# Also test that have only run before should be counted in the final
+# testsuite summary.
+grep '^# TOTAL:  *2$' stdout
+
+: Setup for the next check.
+: > baz.test
+sed 's/^TESTS =.*/& baz.test/' Makefile > t
+diff t Makefile && Exit 99
+mv -f t Makefile
+$MAKE check
+test -f foo.trs
+test -f bar.trs
+test -f baz.trs
+
+: Interactions with lazy test reruns are OK.
+chmod a-r foo.trs
+$sleep
+touch stamp
+$sleep
+touch bar.test
+RECHECK_LOGS= $MAKE -e check >stdout || { cat stdout; Exit 1; }
+cat stdout
+test -r foo.trs
+is_newest bar.trs bar.test
+grep '^PASS: foo\.test' stdout
+grep '^PASS: bar\.test' stdout
+grep 'baz\.test' stdout && Exit 1
+# Also test that have only run before should be counted in the final
+# testsuite summary.
+grep '^# TOTAL:  *3$' stdout
+
+:
diff --git a/tests/tests-environment-and-log-compiler.test b/tests/tests-environment-and-log-compiler.test
new file mode 100755 (executable)
index 0000000..c639355
--- /dev/null
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# parallel-tests: check that we can use variables and functions set
+# by TESTS_ENVIRONMENT and AM_TESTS_ENVIRONMENT in LOG_COMPILER and
+# LOG_FLAGS (for tests both with and without registered extensions).
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+unset v0 v1 v2 v3 v4 || :
+
+cat > Makefile.am << 'END'
+TESTS_ENVIRONMENT = am__f3 () { echo 3; }; v0='$(srcdir)' v1=1; :;
+AM_TESTS_ENVIRONMENT = v2=2; v4=4 && am__f5 () { echo 5; }; :;
+
+LOG_COMPILER = $$v0/log-compiler $$v1
+AM_LOG_FLAGS = $$v2 `am__f3`
+LOG_FLAGS = $$v4 `am__f5`
+
+TEST_LOG_COMPILER = $$v0/test-log-compiler $$v2
+AM_TEST_LOG_FLAGS = `am__f5` $$v1
+TEST_LOG_FLAGS = $$v4 `am__f3`
+
+EXTRA_DIST = log-compiler test-log-compiler
+
+TESTS = a b.test
+$(TESTS):
+END
+
+cat > log-compiler << 'END'
+#! /bin/sh
+echo "$0: $*"
+test x"$1$2$3$4$5" = x"12345"
+END
+
+cat > test-log-compiler << 'END'
+#! /bin/sh
+echo "$0: $*"
+test x"$1$2$3$4$5" = x"25143"
+END
+
+chmod a+x test-log-compiler log-compiler
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE -n check || : # For debugging.
+VERBOSE=yes $MAKE check
+cat a.log
+cat b.log
+
+VERBOSE=yes $MAKE distcheck
+
+:
index ecf1b16..36cc642 100755 (executable)
 # be run by (with the parallel-tests driver one should use LOG_COMPILER
 # for this).  The behaviour tested here is also documented in the manual.
 
-parallel_tests=no
+am_parallel_tests=no
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<END
 AC_SUBST([PERL], ['$PERL'])
 AC_OUTPUT
diff --git a/tests/tests-environment-fd-redirect.test b/tests/tests-environment-fd-redirect.test
new file mode 100755 (executable)
index 0000000..855e342
--- /dev/null
@@ -0,0 +1,94 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test for a behaviour of `TESTS_ENVIRONMENT' and `AM_TESTS_ENVIRONMENT'
+# w.r.t. file descriptor redirections which, although undocumented,
+# is nonetheless required by Gnulib's 'tests/init.sh' and by coreutils'
+# testsuite.
+# The checked behaviour is that we can portably do file descriptor
+# redirections by placing them at the end of a {AM_,}TESTS_ENVIRONMENT
+# definition without a following semicolon.  The need to support this
+# is detailedly motivated by coreutils bug#8846:
+#   <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846>
+# and the following CC:ed thread on bug-autoconf list:
+#   <http://lists.gnu.org/archive/html/bug-autoconf/2011-06/msg00002.html>
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+# Use both a shell script and a perl script as tests,
+# for better coverage.
+
+cat >foo.test <<'END'
+#! /bin/sh
+set -e
+echo " " $0: foofoofoo >&8
+echo " " $0: barbarbar >&9
+END
+
+echo "#! $PERL -w" > bar.test
+cat >>bar.test <<'END'
+use warnings FATAL => 'all';
+use strict;
+open(FD8, ">&=8") or die "$!";
+open(FD9, ">&=9") or die "$!";
+print FD8 "  $0: 8888\n";
+print FD9 "  $0: 9999\n";
+END
+
+chmod a+x foo.test bar.test
+
+$ACLOCAL
+$AUTOCONF
+
+# Korn Shells seem more vulnerable to the issue highlighted in coreutils
+# bug#8846 than other shells are.  In particular, the default Korn Shell
+# on Debian GNU/Linux is affected by the issue.  So let's try to run our
+# test with a system Korn Shell too, if that's available.
+bin_ksh=:
+case $SHELL in
+  ksh|*/ksh) ;;
+  *) for d in /bin /usr/bin; do
+       test -f $d/ksh && { bin_ksh=$d/ksh; break; }
+     done;;
+esac
+
+for sh in "$SHELL" "$bin_ksh"; do
+  test "$sh" = : && continue
+  for pfx in AM_ ''; do
+    unindent > Makefile.am <<END
+      TESTS = foo.test bar.test
+      ## No trailing semicolon here, *deliberately*.
+      ${pfx}TESTS_ENVIRONMENT = 8>&1 9>&8
+END
+    $AUTOMAKE -a
+    CONFIG_SHELL="$sh" $sh ./configure CONFIG_SHELL="$sh"
+    VERBOSE=y $MAKE check >stdout || { cat stdout; Exit 1; }
+    cat stdout
+    grep '[ /]foo\.test: foofoofoo$' stdout
+    grep '[ /]foo\.test: barbarbar$' stdout
+    grep '[ /]bar\.test: 8888$' stdout
+    grep '[ /]bar\.test: 9999$' stdout
+    $EGREP '(foofoofoo|barbarbar|8888|9999)' foo.log && Exit 1
+    : # For shells with buggy 'set -e'.
+  done
+done
+
+:
similarity index 99%
rename from tests/check-tests_environment.test
rename to tests/tests-environment.test
index a07ab95..e3dc76a 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
diff --git a/tests/testsuite-summary-checks.sh b/tests/testsuite-summary-checks.sh
new file mode 100755 (executable)
index 0000000..2a5685b
--- /dev/null
@@ -0,0 +1,106 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check the testsuite summary with the parallel-tests harness.  This
+# script is meant to be sourced by other test script, so that it can
+# be used to check different scenarios (colorized and non-colorized
+# testsuite output, packages with and without bug-report addresses,
+# testsuites in subdirectories, ...)
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+case $use_colors in
+  yes)
+    AM_COLOR_TESTS=always; export AM_COLOR_TESTS
+    TERM=ansi; export TERM
+    am_opts='parallel-tests color-tests'
+    ;;
+  no)
+    am_opts='parallel-tests'
+    ;;
+  *)
+    fatal_ "invalid use_colors='$use_colors'";;
+esac
+
+cat > configure.in <<END
+AC_INIT([GNU AutoFoo], [7.1], [bug-automake@gnu.org])
+AM_INIT_AUTOMAKE([$am_opts])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+TEST_EXTENSIONS = .t
+T_LOG_COMPILER = $(SHELL) $(srcdir)/log-compiler
+## Will be defined at runtime.
+TESTS =
+$(TESTS):
+END
+
+cat > log-compiler <<'END'
+#!/bin/sh
+case "$1" in
+  pass*|*/pass*|xpass*|*/xpass*) exit 0;;
+  fail*|*/fail*|xfail*|*/xfail*) exit 1;;
+  skip*|*/skip*) exit 77;;
+  error*|/error*) exit 99;;
+  copy*|*/copy*) cat "$1";;
+  *) exit 99;;
+esac
+END
+
+# Quite complexish, but allow the tests in client scripts to be written
+# in a "data-driven fashion".
+do_check ()
+{
+  cat > summary.exp
+  expect_failure=false
+  xfail_tests=''
+  tests="TESTS='$*'"
+  for t in $*; do
+    case $t in fail*|xpass*|error*) expect_failure=:;; esac
+    case $t in xfail*|xpass*) xfail_tests="$xfail_tests $t";; esac
+  done
+  test -z "$xfail_tests" || xfail_tests="XFAIL_TESTS='$xfail_tests'"
+  st=0
+  eval "env $tests $xfail_tests \$MAKE -e check > stdout || st=\$?"
+  cat stdout
+  if $expect_failure; then
+    test $st -gt 0 || Exit 1
+  else
+    test $st -eq 0 || Exit 1
+  fi
+  $PERL -w "$testsrcdir"/extract-testsuite-summary stdout > summary.got \
+   || fatal_ "cannot extract testsuite summary"
+  cat summary.exp
+  cat summary.got
+  if test $use_colors = yes; then
+    # Use cmp, not diff, because the files might contain binary data.
+    compare=cmp
+  else
+    compare=diff
+  fi
+  $compare summary.exp summary.got || Exit 1
+}
+
+br='============================================================================'
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+:
diff --git a/tests/testsuite-summary-color.test b/tests/testsuite-summary-color.test
new file mode 100755 (executable)
index 0000000..9493744
--- /dev/null
@@ -0,0 +1,199 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check coloring of the testsuite summary.
+
+. ./defs-static || Exit 1
+
+use_colors=yes
+use_vpath=no
+
+. "$testsrcdir"/testsuite-summary-checks.sh || Exit 99
+
+./configure
+
+# ANSI colors.
+red='\e[0;31m'
+grn='\e[0;32m'
+lgn='\e[1;32m'
+blu='\e[1;34m'
+mgn='\e[0;35m'
+brg='\e[1m';
+std='\e[m';
+
+success_header="\
+${grn}${br}${std}
+${grn}Testsuite summary for GNU AutoFoo 7.1${std}
+${grn}${br}${std}"
+
+success_footer=${grn}${br}${std}
+
+failure_header="\
+${red}${br}${std}
+${red}Testsuite summary for GNU AutoFoo 7.1${std}
+${red}${br}${std}"
+
+failure_footer="\
+${red}${br}${std}
+${red}See ./test-suite.log${std}
+${red}Please report to bug-automake@gnu.org${std}
+${red}${br}${std}"
+
+do_check '' <<END
+$success_header
+# TOTAL: 0
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+do_check pass.t <<END
+$success_header
+${brg}# TOTAL: 1${std}
+${grn}# PASS:  1${std}
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+do_check skip.t <<END
+$success_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+${blu}# SKIP:  1${std}
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+do_check xfail.t <<END
+$success_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+# SKIP:  0
+${lgn}# XFAIL: 1${std}
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+do_check fail.t <<END
+$failure_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+${red}# FAIL:  1${std}
+# XPASS: 0
+# ERROR: 0
+$failure_footer
+END
+
+do_check xpass.t <<END
+$failure_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+${red}# XPASS: 1${std}
+# ERROR: 0
+$failure_footer
+END
+
+do_check error.t <<END
+$failure_header
+${brg}# TOTAL: 1${std}
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+${mgn}# ERROR: 1${std}
+$failure_footer
+END
+
+do_check pass.t xfail.t skip.t <<END
+$success_header
+${brg}# TOTAL: 3${std}
+${grn}# PASS:  1${std}
+${blu}# SKIP:  1${std}
+${lgn}# XFAIL: 1${std}
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+do_check pass.t fail.t skip.t <<END
+$failure_header
+${brg}# TOTAL: 3${std}
+${grn}# PASS:  1${std}
+${blu}# SKIP:  1${std}
+# XFAIL: 0
+${red}# FAIL:  1${std}
+# XPASS: 0
+# ERROR: 0
+$failure_footer
+END
+
+do_check pass.t xfail.t xpass.t <<END
+$failure_header
+${brg}# TOTAL: 3${std}
+${grn}# PASS:  1${std}
+# SKIP:  0
+${lgn}# XFAIL: 1${std}
+# FAIL:  0
+${red}# XPASS: 1${std}
+# ERROR: 0
+$failure_footer
+END
+
+do_check skip.t xfail.t error.t <<END
+$failure_header
+${brg}# TOTAL: 3${std}
+# PASS:  0
+${blu}# SKIP:  1${std}
+${lgn}# XFAIL: 1${std}
+# FAIL:  0
+# XPASS: 0
+${mgn}# ERROR: 1${std}
+$failure_footer
+END
+
+do_check pass.t skip.t xfail.t fail.t xpass.t error.t <<END
+$failure_header
+${brg}# TOTAL: 6${std}
+${grn}# PASS:  1${std}
+${blu}# SKIP:  1${std}
+${lgn}# XFAIL: 1${std}
+${red}# FAIL:  1${std}
+${red}# XPASS: 1${std}
+${mgn}# ERROR: 1${std}
+$failure_footer
+END
+
+:
diff --git a/tests/testsuite-summary-count-many.test b/tests/testsuite-summary-count-many.test
new file mode 100755 (executable)
index 0000000..2621b29
--- /dev/null
@@ -0,0 +1,105 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check test counts in the testsuite summary, with test drivers allowing
+# multiple test results per test script, and for a huge number of tests.
+# Incidentally, this test also checks that the testsuite summary doesn't
+# give any bug-report address if it's not defined.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+for s in trivial-test-driver extract-testsuite-summary; do
+  cp "$testsrcdir/$s" . || fatal_ "failed to fetch auxiliary script $s"
+done
+
+br='============================================================================'
+
+header="\
+${br}
+Testsuite summary for $me 1.0
+${br}"
+
+footer="\
+${br}
+See ./test-suite.log
+${br}"
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+TEST_LOG_DRIVER = $(SHELL) $(srcdir)/trivial-test-driver
+TESTS = all.test
+# Without this, the test driver will be horrendously slow.
+END
+
+cat > all.test <<'END'
+#!/bin/sh
+cat results.txt || { echo ERROR: weird; exit 99; }
+END
+chmod a+x all.test
+
+$PERL -w -e '
+  use warnings FATAL => "all";
+  use strict;
+
+  # FIXME: we would like this to be 1000 or even 10000, but the current
+  # implementation is too slow to handle that :-(
+  my $base = 5;
+  my %count = (
+    TOTAL => $base * 1000,
+    PASS  => $base * 700,
+    SKIP  => $base * 200,
+    XFAIL => $base * 80,
+    FAIL  => $base * 10,
+    XPASS => $base * 7,
+    ERROR => $base * 3,
+  );
+  my @results = qw/PASS SKIP XFAIL FAIL XPASS ERROR/;
+
+  open (RES, ">results.txt") or die "opening results.txt: $!\n";
+  open (CNT, ">count.txt") or die "opening count.txt: $!\n";
+
+  printf CNT "# %-6s %d\n", "TOTAL:", $count{TOTAL};
+  for my $res (@results)
+    {
+      my $uc_res = uc $res;
+      print STDERR "Generating list of $res ...\n";
+      for (1..$count{$res})
+        {
+          print RES "$uc_res: $_\n";
+        }
+      printf CNT "# %-6s %d\n", $res . ":", $count{$res};
+    }
+'
+
+(echo "$header" && cat count.txt && echo "$footer") > summary.exp
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+./configure
+
+($MAKE check || : > make.fail) | tee stdout
+test -f make.fail
+
+$PERL -w extract-testsuite-summary stdout > summary.got
+cat summary.exp
+cat summary.got
+diff summary.exp summary.got || Exit 1
+
+:
diff --git a/tests/testsuite-summary-count.test b/tests/testsuite-summary-count.test
new file mode 100755 (executable)
index 0000000..090fabb
--- /dev/null
@@ -0,0 +1,161 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check test counts in the testsuite summary.
+
+. ./defs-static || Exit 1
+
+use_colors=no
+use_vpath=no
+
+. "$testsrcdir"/testsuite-summary-checks.sh || Exit 99
+
+./configure
+
+header="\
+${br}
+Testsuite summary for GNU AutoFoo 7.1
+${br}"
+
+success_footer=${br}
+
+failure_footer="\
+${br}
+See ./test-suite.log
+Please report to bug-automake@gnu.org
+${br}"
+
+# Corner cases.
+
+do_check '' <<END
+$header
+# TOTAL: 0
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+do_check pass.t <<END
+$header
+# TOTAL: 1
+# PASS:  1
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+do_check fail.t <<END
+$header
+# TOTAL: 1
+# PASS:  0
+# SKIP:  0
+# XFAIL: 0
+# FAIL:  1
+# XPASS: 0
+# ERROR: 0
+$failure_footer
+END
+
+# Some simpler checks, with low or moderate number of tests.
+
+do_check skip.t skip2.t skip3.t xfail.t xfail2.t <<END
+$header
+# TOTAL: 5
+# PASS:  0
+# SKIP:  3
+# XFAIL: 2
+# FAIL:  0
+# XPASS: 0
+# ERROR: 0
+$success_footer
+END
+
+do_check pass.t pass2.t xfail.t xpass.t error.t error2.t <<END
+$header
+# TOTAL: 6
+# PASS:  2
+# SKIP:  0
+# XFAIL: 1
+# FAIL:  0
+# XPASS: 1
+# ERROR: 2
+$failure_footer
+END
+
+pass_count=22
+skip_count=19
+xfail_count=21
+fail_count=18
+xpass_count=23
+error_count=17
+tests_count=120
+
+pass=` seq_ 1 $pass_count  | sed 's/.*/pass-&.t/'`
+skip=` seq_ 1 $skip_count  | sed 's/.*/skip-&.t/'`
+xfail=`seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/'`
+fail=` seq_ 1 $fail_count  | sed 's/.*/fail-&.t/'`
+xpass=`seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/'`
+error=`seq_ 1 $error_count | sed 's/.*/error-&.t/'`
+
+do_check $pass $skip $xfail $fail $xpass $error <<END
+$header
+# TOTAL: $tests_count
+# PASS:  $pass_count
+# SKIP:  $skip_count
+# XFAIL: $xfail_count
+# FAIL:  $fail_count
+# XPASS: $xpass_count
+# ERROR: $error_count
+$failure_footer
+END
+
+# Mild stress test with a lot of test scripts.
+
+tests_count=1888
+pass_count=1403
+skip_count=292
+xfail_count=41
+fail_count=126
+xpass_count=17
+error_count=9
+
+pass=` seq_ 1 $pass_count  | sed 's/.*/pass-&.t/'`
+skip=` seq_ 1 $skip_count  | sed 's/.*/skip-&.t/'`
+xfail=`seq_ 1 $xfail_count | sed 's/.*/xfail-&.t/'`
+fail=` seq_ 1 $fail_count  | sed 's/.*/fail-&.t/'`
+xpass=`seq_ 1 $xpass_count | sed 's/.*/xpass-&.t/'`
+error=`seq_ 1 $error_count | sed 's/.*/error-&.t/'`
+
+do_check $pass $skip $xfail $fail $xpass $error <<END
+$header
+# TOTAL: $tests_count
+# PASS:  $pass_count
+# SKIP:  $skip_count
+# XFAIL: $xfail_count
+# FAIL:  $fail_count
+# XPASS: $xpass_count
+# ERROR: $error_count
+$failure_footer
+END
+
+:
diff --git a/tests/testsuite-summary-reference-log.test b/tests/testsuite-summary-reference-log.test
new file mode 100755 (executable)
index 0000000..eb21f8c
--- /dev/null
@@ -0,0 +1,88 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that the global testsuite log file referenced in the testsuite
+# summary and in the global testsuite log itself is correct.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+mv configure.in configure.stub
+
+cat > fail << 'END'
+#!/bin/sh
+exit 1
+END
+chmod a+x fail
+
+cat configure.stub - > configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_SUITE_LOG = my_test_suite.log
+TESTS = fail
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir build
+cd build
+
+../configure
+
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^See \./my_test_suite\.log$' stdout
+
+mkdir bar
+TEST_SUITE_LOG=bar/bar.log $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^See \./bar/bar\.log$' stdout
+
+cd ..
+
+echo SUBDIRS = sub > Makefile.am
+mkdir sub
+echo TESTS = fail > sub/Makefile.am
+mv fail sub
+
+cat configure.stub - > configure.in <<'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+$ACLOCAL --force
+$AUTOCONF --force
+$AUTOMAKE
+
+./configure
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^See sub/test-suite\.log$' stdout
+cd sub
+$MAKE check >stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^See sub/test-suite\.log$' stdout
+cd ..
+
+TEST_SUITE_LOG=foo.log $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+grep '^See sub/foo\.log$' stdout
+
+:
index 02fdd61..fb15503 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2007, 2008  Free Software Foundation,
-# Inc.
+# Copyright (C) 2002, 2003, 2004, 2007, 2008, 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
 
 # Make sure that --program-transform works.
 
-required=gcc
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
 AC_OUTPUT
@@ -32,6 +30,7 @@ bin_PROGRAMS = h
 bin_SCRIPTS = h.sh
 man_MANS = h.1
 
+.PHONY: test-install
 test-install: install
        test -f inst/bin/gnu-h$(EXEEXT)
        test -f inst/bin/gnu-h.sh
@@ -39,8 +38,7 @@ test-install: install
 EOF
 
 cat >h.c <<'EOF'
-int
-main ()
+int main (void)
 {
   return 0;
 }
@@ -64,3 +62,5 @@ rm -rf inst
 $MAKE installdirs
 test -d inst/bin
 test -d inst/man/man1
+
+:
index 07943bc..a7dd9f9 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2007, 2008, 2012 Free Software
+# Copyright (C) 2002, 2003, 2004, 2007, 2008, 2011, 2012 Free Software
 # Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # Make sure that --program-transform works even when multiple files are
 # collapsed.
 
+required=cc
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<'END'
 AC_PROG_CC
 AC_OUTPUT
diff --git a/tests/trivial-test-driver b/tests/trivial-test-driver
new file mode 100644 (file)
index 0000000..7b3ef10
--- /dev/null
@@ -0,0 +1,102 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+#
+# Test driver for a very simple test protocol used by the Automake
+# testsuite to check support for custom test drivers allowing for more
+# test results per test script.
+#
+# The exit status of the wrapped script is ignored.  Lines in its stdout
+# and stderr beginning with `PASS', `FAIL', `XFAIL', `XPASS', `SKIP' or
+# `ERROR' count as a test case result with the obviously-corresponding
+# outcome.  Every other line is ignored for what concerns the testsuite
+# outcome.
+#
+# This script is used at least by the `driver-custom-multitest*.test'
+# tests.
+#
+
+# Help to avoid typo-related bugs.
+set -u
+
+## Option parsing.
+
+test_name=INVALID.NAME
+log_file=BAD.LOG
+trs_file=BAD.TRS
+while test $# -gt 0; do
+  case $1 in
+    --test-name) test_name=$2; shift;;
+    --log-file) log_file=$2; shift;;
+    --trs-file) trs_file=$2; shift;;
+    # Ignored.
+    --expect-failure) shift;;
+    --color-tests) shift;;
+    --enable-hard-errors) shift;;
+    # Explicitly terminate option list.
+    --) shift; break;;
+    # Shouldn't happen
+    *) echo "$0: invalid option/argument: '$1'" >&2; exit 2;;
+  esac
+  shift
+done
+
+## Log file header.
+{
+  echo "RUN: $test_name"
+  echo "RUN: $test_name" | sed 's/./=/g'
+  echo
+} > $log_file
+
+## Run the test script, get test cases results, display them on console.
+
+"$@" 2>&1 | tee -a $log_file | (
+  i=0 st=0
+  exec 5> $trs_file
+  while read line; do
+    result=
+    case $line in
+      PASS:*)  result=PASS  ;;
+      FAIL:*)  result=FAIL  ;;
+      XPASS:*) result=XPASS ;;
+      XFAIL:*) result=XFAIL ;;
+      SKIP:*)  result=SKIP  ;;
+      ERROR:*) result=ERROR ;;
+    esac
+    if test -n "$result"; then
+      case $result in FAIL|XPASS|ERROR) st=1;; esac
+      # Output testcase result to console.
+      echo "$result: $test_name"
+      # Register testcase outcome for the log file.
+      echo ":test-result: $line" >&5
+      echo >&5
+    fi
+  done
+  if test $st -eq 0; then
+    recheck=no
+    copy_in_global_log=no
+  else
+    recheck=yes
+    copy_in_global_log=yes
+  fi
+  echo ":recheck: $recheck" >&5
+  echo ":copy-in-global-log: $copy_in_global_log" >&5
+  exec 5>&-
+) | awk '{ print $0 ", testcase " NR }'
+
+## And we're done.
+
+exit 0
diff --git a/tests/txinfo-unrecognized-extension.test b/tests/txinfo-unrecognized-extension.test
new file mode 100755 (executable)
index 0000000..719f508
--- /dev/null
@@ -0,0 +1,38 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test that automake complains properly when the files with unrecognized
+# extensions are passed to the TEXINFOS primary.
+
+. ./defs || Exit 1
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = foobar.foo bazquux.tex zardoz.c
+END
+
+echo '@setfilename foobar.info'  > foobar.foo
+echo '@setfilename bazquux.info' > bazquux.tex
+echo '@setfilename zardoz.info'  > zardoz.c
+: > texinfo.tex
+
+$ACLOCAL
+AUTOMAKE_fails
+
+for x in 'foobar\.foo' 'bazquux\.tex' 'zardoz\.c'; do
+  grep "^Makefile\\.am:.* texinfo file .*$x.* unrecognized extension" stderr
+done
+
+:
index b764e53..3b7be76 100755 (executable)
@@ -21,8 +21,6 @@
 required=makeinfo
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_OUTPUT
 END
index 7432c7f..1c58739 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2004, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure dvi target recurses into subdir.
-# Reported by Pavel Roskin
+# Reported by Pavel Roskin.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 SUBDIRS = sub
 END
index 81b39e4..d50b8bd 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2006, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 2007, 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
 # 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 subdir Texinfo (PR/343)
+# Check for subdir Texinfo (PR/343).
 # Also make sure we do not distribute too much foo.info* files (Report
-# from Vincent Lefevre)
+# from Vincent Lefevre).
 
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
index 4c14aba..8ed8b11 100755 (executable)
@@ -20,8 +20,6 @@
 required='makeinfo tex texi2dvi'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index 62408be..92abcf5 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = texinfo.texi
 END
index 8dc8961..01e4c21 100755 (executable)
@@ -21,8 +21,6 @@
 required='makeinfo tex texi2dvi'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -66,10 +64,10 @@ $AUTOCONF
 ./configure
 
 $MAKE dvi
-ls -l           # for debugging
-test -f main.sa # sanity check
+ls -l           # For debugging.
+test -f main.sa # Sanity check.
 $MAKE clean
-ls -l           # for debugging
+ls -l           # For debugging.
 test x"`echo main.*`" = x"main.texi"
 
 TAR_OPTIONS= $MAKE distcheck
index aabe4be..80602fd 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2007, 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
@@ -19,8 +19,6 @@
 required='makeinfo tex'
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
index f51d0b6..39c404c 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index 5f6de57..b56cdef 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -19,8 +19,6 @@
 required=makeinfo
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
@@ -51,7 +49,7 @@ $MAKE
 : > main-1
 : > sub/main-1
 
-# Break main.texi
+# Break main.texi.
 $sleep
 cp main.texi main.old
 cat > main.texi << 'END'
@@ -68,7 +66,7 @@ $MAKE && Exit 1
 test -f main
 test -f main-1
 
-# Restore main.texi, and break sub/main.texi
+# Restore main.texi, and break sub/main.texi.
 cp main.texi sub/main.texi
 mv main.old main.texi
 $MAKE && Exit 1
index ae1d985..09ac0b2 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2006, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2006, 2008, 2011, 2012 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
 required='makeinfo-html tex texi2dvi'
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<\EOF
 AC_CONFIG_FILES([rec/Makefile])
 
 # At the time of writing, Autoconf does not supplies any of these
-# definitions (and those below are purposedly not those of the standard).
+# definitions (and those below are purposely not those of the standard).
 AC_SUBST([dvidir],  ['${datadir}/${PACKAGE}/dvi'])
 AC_SUBST([htmldir], ['${datadir}/${PACKAGE}/html'])
 AC_SUBST([pdfdir],  ['${datadir}/${PACKAGE}/pdf'])
@@ -133,44 +132,46 @@ test ! -f sub/main2.html
 test ! -d rec/main3.html
 
 $MAKE install-html
-test -f share/txinfo21/html/main.html
-test -f share/txinfo21/html/main2.html
-test -d share/txinfo21/html/main3.html
+test -f share/$me/html/main.html
+test -f share/$me/html/main2.html
+test -d share/$me/html/main3.html
 $MAKE uninstall
-test ! -f share/txinfo21/html/main.html
-test ! -f share/txinfo21/html/main2.html
-test ! -d share/txinfo21/html/main3.html
+test ! -f share/$me/html/main.html
+test ! -f share/$me/html/main2.html
+test ! -d share/$me/html/main3.html
 
 $MAKE install-dvi
-test -f share/txinfo21/dvi/main.dvi
-test -f share/txinfo21/dvi/main2.dvi
-test -f share/txinfo21/dvi/main3.dvi
+test -f share/$me/dvi/main.dvi
+test -f share/$me/dvi/main2.dvi
+test -f share/$me/dvi/main3.dvi
 $MAKE uninstall
-test ! -f share/txinfo21/dvi/main.dvi
-test ! -f share/txinfo21/dvi/main2.dvi
-test ! -f share/txinfo21/dvi/main3.dvi
+test ! -f share/$me/dvi/main.dvi
+test ! -f share/$me/dvi/main2.dvi
+test ! -f share/$me/dvi/main3.dvi
 
-(dvips --help 2>/dev/null >/dev/null) || Exit 77
+dvips --help || skip_ "dvips is missing"
 
 $MAKE install-ps
-test -f share/txinfo21/ps/main.ps
-test -f share/txinfo21/ps/main2.ps
-test -f share/txinfo21/ps/main3.ps
+test -f share/$me/ps/main.ps
+test -f share/$me/ps/main2.ps
+test -f share/$me/ps/main3.ps
 $MAKE uninstall
-test ! -f share/txinfo21/ps/main.ps
-test ! -f share/txinfo21/ps/main2.ps
-test ! -f share/txinfo21/ps/main3.ps
+test ! -f share/$me/ps/main.ps
+test ! -f share/$me/ps/main2.ps
+test ! -f share/$me/ps/main3.ps
 
-(pdfetex --help 2>/dev/null >/dev/null) ||
-  (pdftex --help 2>/dev/null >/dev/null) || Exit 77
+pdfetex --help || pdftex --help \
+  || skip_ "pdftex and pdfetex are both missing"
 
 $MAKE install-pdf
-test -f share/txinfo21/pdf/main.pdf
-test -f share/txinfo21/pdf/main2.pdf
-test -f share/txinfo21/pdf/main3.pdf
-test -f share/txinfo21/pdf/hello
+test -f share/$me/pdf/main.pdf
+test -f share/$me/pdf/main2.pdf
+test -f share/$me/pdf/main3.pdf
+test -f share/$me/pdf/hello
 $MAKE uninstall
-test ! -f share/txinfo21/pdf/main.pdf
-test ! -f share/txinfo21/pdf/main2.pdf
-test ! -f share/txinfo21/pdf/main3.pdf
-test ! -f share/txinfo21/pdf/hello
+test ! -f share/$me/pdf/main.pdf
+test ! -f share/$me/pdf/main2.pdf
+test ! -f share/$me/pdf/main3.pdf
+test ! -f share/$me/pdf/hello
+
+:
index c2f23e1..07f0573 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2003, 2004, 2007, 2008, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 2003, 2004, 2007, 2008, 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
@@ -22,8 +22,6 @@
 required='makeinfo tex texi2dvi'
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([aux1])
@@ -52,7 +50,7 @@ END
 
 mkdir aux1
 mkdir tex
-cp "$testsrcdir/../lib/texinfo.tex" tex
+cp "$am_pkgvdatadir/texinfo.tex" tex
 
 $ACLOCAL
 $AUTOMAKE --add-missing
index 660487d..de82f81 100755 (executable)
 
 # Check that info files are built in builddir when needed.
 # Test with subdir Texinfo.
-# (Similar to txinfo13.test, plus DISTCLEANFILES.)
-# (See also txinfo24.test and txinfo25.test)
+# (Similar to txinfo13.test, plus DISTCLEANFILES).
+# (See also txinfo24.test and txinfo25.test).
 
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index fc9f9d1..d2bacc8 100755 (executable)
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check that info files are built in builddir when needed.
-# (Similar to txinfo16.test, plus CLEANFILES.)
-# (See also txinfo23.test and txinfo25.test)
+# (Similar to txinfo16.test, plus CLEANFILES).
+# (See also txinfo23.test and txinfo25.test).
 
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -60,7 +58,7 @@ $MAKE
 test -f main.info
 
 # Make sure stamp-vti is older that version.texi.
-# (A common situation in a real tree.)
+# (A common situation in a real tree).
 test -f stamp-vti
 test -f version.texi
 $sleep
@@ -74,7 +72,7 @@ mkdir build
 cd build
 ../configure
 $MAKE
-# main.info should be rebuilt in the current directory
+# main.info should be rebuilt in the current directory.
 test -f main.info
 test ! -f ../main.info
 $MAKE dvi
index f80b035..b97b1a1 100755 (executable)
 # Check that info files are built in builddir and in srcdir can safely
 # co-exist.  This setup is obtained by having two info files, only one
 # of which being cleaned.
-# (Similar to txinfo16.test, plus CLEANFILES.)
-# (See also txinfo23.test and txinfo24.test)
+# (Similar to txinfo16.test, plus CLEANFILES).
+# (See also txinfo23.test and txinfo24.test).
 
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
@@ -75,7 +73,7 @@ test -f main.info
 test -f other.info
 
 # Make sure stamp-vti is older that version.texi.
-# (A common situation in a real tree.)
+# (A common situation in a real tree).
 # This is needed to test the "subtle" issue described below.
 test -f stamp-vti
 test -f version.texi
index e5e8f84..46bb322 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2007, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2007, 2008, 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
@@ -20,8 +20,6 @@
 required='makeinfo'
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
@@ -48,9 +46,9 @@ $AUTOCONF
 $MAKE
 $MAKE distclean
 
-# We do not require this to work with a directory that contains white space.
 case `pwd` in
-  *\ * | *\    *) Exit 77;;
+  *\ * | *\    *)
+    skip_ "this test might fail in a directory containing white spaces";;
 esac
 
 mkdir build
@@ -65,5 +63,5 @@ $MAKE uninstall
 test ! -f _inst/info/main.info
 test -f ../main.info
 
-# multiple uninstall should not fail.
+# Multiple uninstall should not fail.
 $MAKE uninstall
index 0769fa5..368707f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2007  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2007, 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
@@ -19,8 +19,6 @@
 required='makeinfo'
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT >> configure.in
 
 cat > Makefile.am << 'END'
index 1fd702b..808affe 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check that info files are built in builddir when needed.
-# Similar to txinfo24.test, but obfuscating filenames with variable references.
+# Similar to txinfo24.test, but obfuscating filenames with variable
+# references.
 # Report from Ralf Corsepius.
 
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
-set -e
-
 # This setting, when honored by GNU ls, used to cause an infinite loop
 # in mdate-sh.
 TIME_STYLE="+%Y-%m-%d %H:%M:%S"
@@ -67,7 +66,7 @@ $MAKE
 test -f main.info
 
 # Make sure stamp-vti is older that version.texi.
-# (A common situation in a real tree.)
+# (A common situation in a real tree).
 test -f stamp-vti
 test -f version.texi
 $sleep
@@ -81,7 +80,7 @@ mkdir build
 cd build
 ../configure
 $MAKE
-# main.info should be rebuilt in the current directory
+# main.info should be rebuilt in the current directory.
 test -f main.info
 test ! -f ../main.info
 $MAKE dvi
index 42dd3ab..9243e38 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 INFO_DEPS = foo.info
 info_TEXINFOS = bar.texi
@@ -35,9 +33,9 @@ grep 'overrides Automake variable.*INFO_DEPS' stderr
 
 $AUTOMAKE -Wno-override
 
-# There is only one definition of INFO_DEPS
+# There is only one definition of INFO_DEPS ...
 test 1 = `grep '^INFO_DEPS.*=' Makefile.in | wc -l`
-# and it is the right one.
+# ... and it is the right one.
 grep '^INFO_DEPS *= *foo.info *$' Makefile.in
 
 # Likewise with AC_SUBST.
@@ -56,9 +54,9 @@ grep 'overrides Automake variable.*INFO_DEPS' stderr
 
 $AUTOMAKE -Wno-override
 
-# There is only one definition of INFO_DEPS
+# There is only one definition of INFO_DEPS ...
 test 1 = `grep '^INFO_DEPS.*=' Makefile.in | wc -l`
-# and it is the right one.
+# ... and it is the right one.
 grep '^INFO_DEPS *= *@INFO_DEPS@ *$' Makefile.in
 
 :
index 6af712f..57ebd71 100755 (executable)
@@ -20,8 +20,6 @@
 required='makeinfo tex texi2dvi'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index 296180d..ee6976f 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2005, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo info_TEXINFOS = bar.texi >Makefile.am
 echo grepme >bar.info
 $sleep
index cb8df94..d657f22 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo info_TEXINFOS = bar.texi >Makefile.am
 cat >bar.texi <<EOF
 @setfilename bar-1.9.info
index 6b63ad8..6c7c751 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2009  Free Software Foundation, Inc.
+# Copyright (C) 2009, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 cat >>configure.in <<'END'
 AC_CONFIG_FILES([sub/Makefile])
index 4657a94..38bea68 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2009, 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
@@ -20,8 +20,6 @@
 required='makeinfo tex texi2dvi-o dvips'
 . ./defs || Exit 1
 
-set -e
-
 mkdir sub
 
 cat >> configure.in << 'END'
index 0c55a1c..93acdba 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
 END
index 0b3ea68..e9c43fd 100755 (executable)
@@ -23,8 +23,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_MAINTAINER_MODE
 END
index f14eadb..be52e0b 100755 (executable)
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AM_MAINTAINER_MODE
 END
index f5b8c0b..e6af70c 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = foo.txi
 END
index 9a1dd5c..2a3f171 100755 (executable)
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
 END
index 13c8e31..74acc33 100755 (executable)
@@ -21,8 +21,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << END
 AC_INIT([$me], [1.0])
 AC_CONFIG_AUX_DIR([auxdir])
index 71b5efb..29635b2 100755 (executable)
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = maude.texi liver.txi heart.texinfo
 END
@@ -36,7 +34,7 @@ $AUTOMAKE
 # we only want them to appear once.  But grepping them all would be
 # overkill.
 for t in info dist-info dvi-am install-html uninstall-pdf-am; do
-  $EGREP "(^| )$t*.:" Makefile.in # help in debugging
+  $EGREP "(^| )$t*.:" Makefile.in # For debugging.
   test `$EGREP -c "(^| )$t(:| *.:)" Makefile.in` -eq 1
 done
 
index 529d8f3..19b9e53 100755 (executable)
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 mkdir d
 : > d/f
 chmod a-w d || skip "cannot make directories unwritable"
index 9aea52d..f9122ce 100755 (executable)
@@ -24,8 +24,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_OUTPUT
 END
index f406b43..d22643f 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2002, 2003, 2008, 2010 Free Software Foundation,
-# Inc.
+# Copyright (C) 1998, 2002, 2003, 2008, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 MACRO_1
 MACRO_1_2
index 3c55ccb..547aa79 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -17,7 +17,6 @@
 # A simple Hello World for UPC.
 
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
 AM_PROG_UPC
@@ -45,5 +44,7 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
-./configure
+./configure || Exit $?
 $MAKE distcheck
+
+:
index 6b717fd..616b2f4 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 echo AC_PROG_CC >>configure.in
 
 cat >Makefile.am <<'END'
index f575b9a..3c2acfd 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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
@@ -17,7 +17,6 @@
 # Test that C and Unified Parallel C link safely.
 
 . ./defs || Exit 1
-set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
@@ -60,5 +59,7 @@ $ACLOCAL
 $AUTOMAKE
 $AUTOCONF
 
-./configure
+./configure || Exit $?
 $MAKE distcheck
+
+:
index 73a07d9..b1d1baf 100755 (executable)
@@ -19,8 +19,6 @@
 required='valac cc GNUmake'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
index 8f2b677..c878c86 100755 (executable)
@@ -20,8 +20,6 @@
 required="valac GNUmake"
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_CONFIG_SRCDIR([hello.vala])
 AC_PROG_CC
index 70122c3..d027a6d 100755 (executable)
@@ -1,40 +1,35 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2012 Free Software
-# Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2011, 2012 Free
+# Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Basic "grepping" test on vala support.
 
 . ./defs || Exit 1
 
-set -e
-
 # So that we won't require libtool macros.
 cat > acinclude.m4 <<'END'
 AC_DEFUN([AC_PROG_LIBTOOL],
          [AC_SUBST([LIBTOOL], [:])])
 END
 
-cat >> configure.in <<'END'
+cat >> 'configure.in' << 'END'
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_LIBTOOL
+AM_PROG_AR
 AM_PROG_VALAC
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
index d0cc241..ab72025 100755 (executable)
@@ -1,23 +1,19 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2011 Free Software
+# Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure intermediate .c files are built from vala sources
 # in non-recursive automake mode.
 required="libtool"
 . ./defs || Exit 1
 
-set -e
-
 cat >> 'configure.in' << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AM_PROG_VALAC
 AC_OUTPUT
index a8a3d90..2a320dd 100755 (executable)
@@ -1,31 +1,25 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2011 Free Software
+# Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure compiling Vala code really works with recursive make.
 
 required="libtool libtoolize pkg-config valac gcc GNUmake"
 . ./defs || Exit 1
 
-set -e
-
 mkdir src
 
 cat >> 'configure.in' << 'END'
@@ -66,10 +60,10 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-./configure || Exit 77
+./configure || skip_ "configure failure"
 $MAKE
 
-# test rebuild rules
+# Test rebuild rules.
 rm -f src/zardoz.h
 $MAKE -C src zardoz.h
 
index 138e853..338ca60 100755 (executable)
@@ -1,31 +1,25 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2011 Free Software
+# Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test to make sure compiling Vala code really works with non-recursive make.
 
 required="libtool libtoolize pkg-config valac gcc GNUmake"
 . ./defs || Exit 1
 
-set -e
-
 mkdir src
 
 cat >> 'configure.in' << 'END'
@@ -60,7 +54,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-./configure || Exit 77
+./configure || skip_ "configure failure"
 $MAKE
 $MAKE distcheck
 $MAKE distclean
@@ -90,7 +84,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 
-./configure || Exit 77
+./configure || skip_ "configure failure"
 $MAKE
 $MAKE distcheck
 $MAKE distclean
index 7a15ebe..6924c04 100755 (executable)
@@ -1,30 +1,24 @@
 #! /bin/sh
-# Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2009, 2011 Free Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test AM_PROG_VALAC.
 
 required=libtoolize
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_LIBTOOL
@@ -52,7 +46,7 @@ libtoolize
 $ACLOCAL
 $AUTOMAKE -a
 $AUTOCONF
-./configure "VALAC=$cwd/valac"
+./configure "VALAC=$cwd/valac" || Exit $?
 
 sed 's/AM_PROG_VALAC.*/AM_PROG_VALAC([9999.9])/' < configure.in >t
 mv -f t configure.in
@@ -62,5 +56,6 @@ $AUTOCONF --force
 sed 's/AM_PROG_VALAC.*/AM_PROG_VALAC([1.2.3])/' < configure.in >t
 mv -f t configure.in
 $AUTOCONF --force
-./configure "VALAC=$cwd/valac"
+./configure "VALAC=$cwd/valac" || Exit $?
+
 :
index 2206b25..7633d48 100755 (executable)
@@ -1,31 +1,25 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2012 Free Software
-# Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 2008, 2009, 2011, 2012 Free
+# Software Foundation, Inc.
 #
-# This file is part of GNU Automake.
-#
-# GNU Automake is free software; you can redistribute it and/or modify
+# 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.
 #
-# GNU Automake is distributed in the hope that it will be useful,
+# 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 Automake; see the file COPYING.  If not, write to
-# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test per-target flags.
 
 required="pkg-config valac gcc GNUmake"
 . ./defs || Exit 1
 
-set -e
-
 mkdir src
 
 cat >> configure.in <<'END'
index 6163a8d..aa022af 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test various variable definitions that include an '=' sign
-# From Raja R Harinath
+# Test various variable definitions that include an '=' sign.
+# From Raja R Harinath.
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 MY_FLAGS_1=-DABC=345
 MY_FLAGS_2= -DABC=345
@@ -30,3 +28,9 @@ END
 
 $ACLOCAL
 $AUTOMAKE
+
+for i in 1 2 3 4; do
+  grep "^MY_FLAGS_$i *= *-DABC=345 *$" Makefile.in
+done
+
+:
index 6b738ab..29dd575 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >Makefile.am <<'EOF'
 L01 = $(shell echo *)
 L02 = $$(not an error)
@@ -30,7 +28,7 @@ L05 = "$(bad boy)"
 L06 = $(this:is= ok)
 L07 = ${three errors}${on this} $(long line)
 L08$(o u c h): $(wildcard *.c)
-       ${another error}
+       ${another Error}
        echo $${ok-this is}
 L11: $(thisis) $(ok)
        ${here}
@@ -45,36 +43,24 @@ cat stderr >&2
 # Lines number are printed in error message.
 # Use them to make sure errors are diagnosed against the right lines.
 
-# No error expected for these lines.
-grep 1: stderr
-grep 2: stderr && Exit 1
-grep 3: stderr && Exit 1
-grep 4: stderr
-grep 5: stderr
-grep 6: stderr && Exit 1
-grep 7: stderr
-grep 8: stderr
-grep 9: stderr
-grep 10: stderr && Exit 1
-grep 11: stderr && Exit 1
-grep 12: stderr && Exit 1
+# No error expected apart from those on these lines.
+grep -v '^Makefile\.am:[145789]:' stderr | grep . && Exit 1
 
 # Now check some individual values.
-grep 'shell echo' stderr
+grep ':1:.*shell echo' stderr
 grep 'nextvariableisbad' stderr && Exit 1
-grep 'addsuffix' stderr
-grep 'bad boy' stderr
-grep 'ok' stderr && Exit 1
-grep 'three errors' stderr
-grep 'on this' stderr
-grep 'long line' stderr
-grep 'o u c h' stderr
-grep 'wildcard' stderr
-grep 'another error' stderr
-grep 'thisis' stderr && Exit 1
-grep 'here' stderr && Exit 1
+grep ':4:.*addsuffix' stderr
+grep ':5:.*bad boy' stderr
+grep ':7:.*three errors' stderr
+grep ':7:.*on this' stderr
+grep ':7:.*long line' stderr
+grep ':8:.*o u c h' stderr
+grep ':8:.*wildcard' stderr
+grep ':9:.*another Error' stderr
+
+$EGREP 'ok|thisis|here' stderr && Exit 1
 
-# None of these errors be diagnosed with -Wno-portability
+# None of these errors be diagnosed with `-Wno-portability'.
 $AUTOMAKE -Wno-portability
 
 # Likewise if we add this in the Makefile.am
@@ -82,3 +68,5 @@ $AUTOMAKE -Wno-portability
 # processed far later).
 echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am
 $AUTOMAKE
+
+:
index 3a18d77..8fd7716 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 install = install
 install:
@@ -37,3 +36,5 @@ install:
 EOF
 sed -n '/^install:/,/^ /p' Makefile.in > target.value
 diff target.expected target.value
+
+:
diff --git a/tests/vartypo2.test b/tests/vartypo2.test
new file mode 100755 (executable)
index 0000000..624e86b
--- /dev/null
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 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 we warn about possible variable typos when we should,
+# Libtool variant.
+
+required=libtoolize
+. ./defs || Exit 1
+
+cat >>configure.in <<'END'
+AM_PROG_AR
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+libfoo_la_SOURCES = unused
+nodist_libfoo_la_SOURCES = unused
+EXTRA_libfoo_la_SOURCES = unused
+libfoo_la_LIBADD = unused
+libfoo_la_DEPENDENCIES = unused
+EXTRA_libfoo_la_DEPENDENCIES = unused
+END
+
+libtoolize
+$ACLOCAL
+AUTOMAKE_fails --add-missing
+# The expected diagnostic is:
+# automake: warnings are treated as errors
+# Makefile.am:3: warning: variable `EXTRA_libfoo_la_SOURCES' is defined but no program or
+# Makefile.am:3: library has `libfoo_la' as canonical name (possible typo)
+# Makefile.am:1: warning: variable `libfoo_la_SOURCES' is defined but no program or
+# Makefile.am:1: library has `libfoo_la' as canonical name (possible typo)
+# Makefile.am:2: warning: variable `nodist_libfoo_la_SOURCES' is defined but no program or
+# Makefile.am:2: library has `libfoo_la' as canonical name (possible typo)
+# Makefile.am:4: warning: variable `libfoo_la_LIBADD' is defined but no program or
+# Makefile.am:4: library has `libfoo_la' as canonical name (possible typo)
+# Makefile.am:6: warning: variable `EXTRA_libfoo_la_DEPENDENCIES' is defined but no program or
+# Makefile.am:6: library has `libfoo_la' as canonical name (possible typo)
+# Makefile.am:5: warning: variable `libfoo_la_DEPENDENCIES' is defined but no program or
+# Makefile.am:5: library has `libfoo_la' as canonical name (possible typo)
+
+
+grep 'as canonical' stderr | grep -v ' .libfoo_la. ' && Exit 1
+test `grep 'variable.*is defined but' stderr | wc -l` = 6
+
+# If we add a global -Wnone, all warnings should disappear.
+$AUTOMAKE -Wnone
+
+# Likewise, if matching programs or libraries are defined.
+cat >>Makefile.am <<'END'
+lib_LTLIBRARIES = libfoo.la
+END
+
+$AUTOMAKE
+
+:
diff --git a/tests/vartypos.test b/tests/vartypos.test
new file mode 100755 (executable)
index 0000000..cd8f718
--- /dev/null
@@ -0,0 +1,89 @@
+#! /bin/sh
+# Copyright (C) 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 we warn about possible variable typos when we should.
+
+. ./defs || Exit 1
+
+cat >>configure.in <<'END'
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+foo_SOURCES = unused
+nodist_foo_SOURCES = unused
+EXTRA_foo_SOURCES = unused
+foo_LDADD = unused
+foo_LDFLAGS = unused
+foo_DEPENDENCIES = unused
+EXTRA_foo_DEPENDENCIES = unused
+
+libfoo_a_SOURCES = unused
+nodist_libfoo_a_SOURCES = unused
+EXTRA_libfoo_a_SOURCES = unused
+libfoo_a_LIBADD = unused
+libfoo_a_DEPENDENCIES = unused
+EXTRA_libfoo_a_DEPENDENCIES = unused
+END
+
+$ACLOCAL
+AUTOMAKE_fails -Wno-extra-portability
+# The expected diagnostic is:
+# automake: warnings are treated as errors
+# Makefile.am:2: warning: variable `nodist_foo_SOURCES' is defined but no program or
+# Makefile.am:2: library has `foo' as canonical name (possible typo)
+# Makefile.am:1: warning: variable `foo_SOURCES' is defined but no program or
+# Makefile.am:1: library has `foo' as canonical name (possible typo)
+# Makefile.am:9: warning: variable `libfoo_a_SOURCES' is defined but no program or
+# Makefile.am:9: library has `libfoo_a' as canonical name (possible typo)
+# Makefile.am:10: warning: variable `nodist_libfoo_a_SOURCES' is defined but no program or
+# Makefile.am:10: library has `libfoo_a' as canonical name (possible typo)
+# Makefile.am:11: warning: variable `EXTRA_libfoo_a_SOURCES' is defined but no program or
+# Makefile.am:11: library has `libfoo_a' as canonical name (possible typo)
+# Makefile.am:3: warning: variable `EXTRA_foo_SOURCES' is defined but no program or
+# Makefile.am:3: library has `foo' as canonical name (possible typo)
+# Makefile.am:12: warning: variable `libfoo_a_LIBADD' is defined but no program or
+# Makefile.am:12: library has `libfoo_a' as canonical name (possible typo)
+# Makefile.am:4: warning: variable `foo_LDADD' is defined but no program or
+# Makefile.am:4: library has `foo' as canonical name (possible typo)
+# Makefile.am:5: warning: variable `foo_LDFLAGS' is defined but no program or
+# Makefile.am:5: library has `foo' as canonical name (possible typo)
+# Makefile.am:14: warning: variable `EXTRA_libfoo_a_DEPENDENCIES' is defined but no program or
+# Makefile.am:14: library has `libfoo_a' as canonical name (possible typo)
+# Makefile.am:7: warning: variable `EXTRA_foo_DEPENDENCIES' is defined but no program or
+# Makefile.am:7: library has `foo' as canonical name (possible typo)
+# Makefile.am:6: warning: variable `foo_DEPENDENCIES' is defined but no program or
+# Makefile.am:6: library has `foo' as canonical name (possible typo)
+# Makefile.am:13: warning: variable `libfoo_a_DEPENDENCIES' is defined but no program or
+# Makefile.am:13: library has `libfoo_a' as canonical name (possible typo)
+
+grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' .libfoo_a. ' \
+  && Exit 1
+test `grep 'variable.*is defined but' stderr | wc -l` = 13
+
+# If we add a global -Wnone, all warnings should disappear.
+$AUTOMAKE -Wnone
+
+# Likewise, if matching programs or libraries are defined.
+cat >>Makefile.am <<'END'
+bin_PROGRAMS = foo
+lib_LIBRARIES = libfoo.a
+END
+
+$AUTOMAKE -Wno-extra-portability
+
+:
index a894a75..48c0ff6 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE([sh-utils], [1.12o])
index a25b82b..86bc8d9 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1997, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE([sh-utils], [1.12o], [no])
index b7d356d..5423e7c 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2003, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = 9.9x
 END
index f8ceafe..1e5510d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -18,8 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = 1.4-p3
 END
index 6993c06..a7b6ca3 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
 
 . ./defs || Exit 1
 
-set -e
-
 amver=`$AUTOMAKE --version | sed -e 's/.* //;1q'`
 
+# Does the extracted version number seems legit?
+case $amver in
+  *[0-9].[0-9]*) ;;
+  *) fatal_ "couldn't extract version number from automake" ;;
+esac
+
 cat > Makefile.am << END
 AUTOMAKE_OPTIONS = $amver
 END
 
 $ACLOCAL
 $AUTOMAKE
+
+:
index 4df84ed..fe5dd02 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2008, 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
 # is to make sure Makefile.ins get rebuilt when a m4_included file
 # changes -- we don't support this feature on non-GNU Makes).
 
-required='makeinfo tex texi2dvi GNUmake'
+required='makeinfo tex texi2dvi'
 . ./defs || Exit 1
 
-set -e
-
-cat >configure.in <<'END'
+cat >configure.in <<END
 m4_include([version.m4])
-AC_INIT([version7], [THE_VERSION])
+AC_INIT([$me], [THE_VERSION])
 AM_INIT_AUTOMAKE
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
@@ -59,9 +57,11 @@ $AUTOMAKE --add-missing
 $MAKE
 grep '2\.718' version.texi
 
-
 $sleep
 echo 'm4_define([THE_VERSION], [3.141])' > version.m4
+using_gmake || $MAKE Makefile
 $MAKE distcheck
 ./configure --version | grep '3\.141'
 grep '3\.141' version.texi
+
+:
index 91b11a0..9552aff 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2005, 2008  Free Software Foundation, Inc.
+# Copyright (C) 2005, 2008, 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
@@ -18,7 +18,6 @@
 
 . ./defs || Exit 1
 
-set -e
 echo 'AM_AUTOMAKE_VERSION([1.9])' >>configure.in
 $ACLOCAL 2>stderr && { cat stderr >&2; Exit 0; }
 cat stderr >&2
index a95f5b2..76d3a53 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 VPATH = zardoz
 END
@@ -28,5 +27,8 @@ END
 $ACLOCAL
 $AUTOMAKE
 
+grep VPATH Makefile.in # For debugging.
+grep '^VPATH = zardoz$' Makefile.in
 grep 'VPATH.*@srcdir@' Makefile.in && Exit 1
-Exit 0
+
+:
index e9a4511..c0e49f9 100755 (executable)
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = textutils.texi
 END
index 00e4c1e..958de07 100755 (executable)
@@ -22,8 +22,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 info_TEXINFOS = zardoz.texi
 END
index 4b0f45d..b474ef6 100755 (executable)
 
 . ./defs || Exit 1
 
-set -e
-
 # We are going to override package version in AC_INIT, so we need
 # to redefine the name of the distdir as well.
 distdir=$me-7.45.3a
 
-# This should work without tex, texinfo or makeinfo
+# This should work without tex, texinfo or makeinfo.
 TEX=false TEXI2DVI=false MAKEINFO=false
 export TEX TEXI2DVI MAKEINFO
 
@@ -67,7 +65,7 @@ END
 
 # Required when using Texinfo.
 : > texinfo.tex
-cp "$testsrcdir/../lib/mdate-sh" .
+cp "$am_scriptdir"/mdate-sh .
 
 $ACLOCAL
 $AUTOCONF
index 3c8ab41..2bdcc35 100755 (executable)
@@ -24,8 +24,6 @@
 required='makeinfo tex texi2dvi-o'
 . ./defs || Exit 1
 
-set -e
-
 case `LC_ALL=C date '+%u'` in
   [1-7]) date_is_posix=:;;
       *) date_is_posx=false;;
@@ -34,14 +32,11 @@ $date_is_posix \
   && day=`LC_ALL=C date '+%d'` && test -n "$day" \
   && month=`LC_ALL=C date '+%B'` && test -n "$month" \
   && year=`LC_ALL=C date '+%Y'`&& test -n "$year" \
-  || { echo "$me: 'date' is not POSIX-compliant enough"; Exit 77; }
+  || skip_ "'date' is not POSIX-compliant enough"
 day=`echo "$day" | sed 's/^0//'`
 
-# This test requires a grep program that can work on non-text input.
-(echo '\ex\a' | grep x) || {
-  echo "$me: grep doesn't work on input that is not pure text" >&2
-  Exit 77
-}
+(echo '\ex\a' | grep x) \
+  || skip_ "grep doesn't work on input that is not pure text"
 
 cat > configure.in << END
 AC_INIT([$me], [123.456])
@@ -104,7 +99,7 @@ $AUTOMAKE -a
 ./configure
 $MAKE all dvi
 
-# debugging & sanity checks
+# Debugging & sanity checks.
 ls -l
 cat version.texi
 cat foo.info
diff --git a/tests/warning-groups-win-over-strictness.test b/tests/warning-groups-win-over-strictness.test
new file mode 100755 (executable)
index 0000000..7e3f526
--- /dev/null
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that explicitly-defined warning levels take precedence over
+# implicit strictness-implied warnings, even when these explicit warning
+# levels are "catch-all warnings" (such as `-Wall' and `-Wnone').
+# Since we are at it, also throw in *.am and *.m4 file inclusions.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$am_original_AUTOMAKE
+
+# Files required in gnu and/or gnits strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING THANKS
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+m4_include([am-init-automake.m4])
+AC_PROG_CC
+AC_CONFIG_FILES([Makefile])
+# Other similar tests do not use AC_OUTPUT, so we use it here,
+# for completeness and for better coverage.
+AC_OUTPUT
+END
+
+cat > Makefile.am <<END
+include automake-options.am
+FOO := bar
+END
+
+rm -rf autom4te*.cache
+: > automake-options.am
+echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
+$ACLOCAL
+AUTOMAKE_fails -Werror -Wall --foreign
+grep '^Makefile\.am:.*:=.*not portable' stderr
+
+rm -rf autom4te*.cache
+: > automake-options.am
+echo 'AM_INIT_AUTOMAKE([-Werror -Wnone gnu])' > am-init-automake.m4
+$ACLOCAL
+$AUTOMAKE
+
+rm -rf autom4te*.cache
+echo 'AUTOMAKE_OPTIONS = -Werror -Wnone gnits' > automake-options.am
+echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
+$ACLOCAL
+$AUTOMAKE
+
+:
diff --git a/tests/warnings-override.test b/tests/warnings-override.test
new file mode 100755 (executable)
index 0000000..aa7da67
--- /dev/null
@@ -0,0 +1,111 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# The warnings specified in Makefile.am:AUTOMAKE_OPTIONS should override
+# those specified in configure.in:AM_INIT_AUTOMAKE, and both should
+# override the warnings specified on the command line.
+# NOTE: the current semantics might not be the best one (even if it has
+# been in place for quite a long time); see also Automake bug #7673.
+# Update this test if the semantics are changed.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$am_original_AUTOMAKE -Werror"
+
+cat > Makefile.am <<'END'
+FOO := bar
+AUTOMAKE_OPTIONS =
+END
+
+set_warnings ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+ok ()
+{
+  $AUTOMAKE $*
+}
+
+ko ()
+{
+  AUTOMAKE_fails $*
+  grep '^Makefile\.am:1:.*:=.*not portable' stderr
+}
+
+$ACLOCAL
+
+# Files required in gnu strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+
+rm -rf autom4te*.cache
+set_warnings '-Wno-portability' Makefile.am
+set_warnings '' configure.in
+
+ok -Wportability
+ok
+
+rm -rf autom4te*.cache
+set_warnings '' Makefile.am
+set_warnings '-Wno-portability' configure.in
+
+ok -Wportability
+ok
+
+rm -rf autom4te*.cache
+set_warnings '-Wno-portability' Makefile.am
+set_warnings '-Wno-portability' configure.in
+
+ok -Wportability
+
+rm -rf autom4te*.cache
+set_warnings '-Wportability' Makefile.am
+set_warnings '' configure.in
+
+ko
+ko -Wno-portability
+
+rm -rf autom4te*.cache
+set_warnings '' Makefile.am
+set_warnings '-Wportability' configure.in
+
+ko
+ko -Wno-portability
+
+rm -rf autom4te*.cache
+set_warnings '-Wportability' Makefile.am
+set_warnings '-Wportability' configure.in
+ko -Wno-portability
+
+rm -rf autom4te*.cache
+set_warnings '-Wno-portability' Makefile.am
+set_warnings '-Wportability' configure.in
+ok
+ok -Wportability
+
+rm -rf autom4te*.cache
+set_warnings '-Wportability' Makefile.am
+set_warnings '-Wno-portability' configure.in
+ko
+ko -Wno-portability
+
+:
diff --git a/tests/warnings-precedence.test b/tests/warnings-precedence.test
new file mode 100755 (executable)
index 0000000..f191c1a
--- /dev/null
@@ -0,0 +1,77 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# On the command line, in AM_INIT_AUTOMAKE, and in AUTOMAKE_OPTIONS,
+# warnings specified later should take precedence over those specified
+# earlier.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$am_original_AUTOMAKE -Werror"
+
+cat > Makefile.am <<'END'
+FOO := bar
+AUTOMAKE_OPTIONS =
+END
+
+set_warnings ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+ok ()
+{
+  $AUTOMAKE $*
+}
+
+ko ()
+{
+  AUTOMAKE_fails $*
+  grep '^Makefile\.am:1:.*:=.*not portable' stderr
+}
+
+# Files required in gnu strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+
+$ACLOCAL
+ok -Wportability -Wno-portability
+ko -Wno-portability -Wportability
+
+set_warnings '' Makefile.am
+set_warnings '-Wportability -Wno-portability' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+ok
+set_warnings '-Wno-portability -Wportability' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+ko
+
+set_warnings '' configure.in
+rm -rf autom4te*.cache
+$ACLOCAL
+set_warnings '-Wportability -Wno-portability' Makefile.am
+ok
+set_warnings '-Wno-portability -Wportability' Makefile.am
+ko
+
+:
diff --git a/tests/warnings-strictness-interactions.test b/tests/warnings-strictness-interactions.test
new file mode 100755 (executable)
index 0000000..85669d7
--- /dev/null
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that the default warnings triggered by a strictness specified
+# in AUTOMAKE_OPTIONS take precedence over explicit warnings given in
+# AM_INIT_AUTOMAKE.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$am_original_AUTOMAKE -Werror"
+
+cat > Makefile.am <<END
+AUTOMAKE_OPTIONS =
+FOO := bar
+END
+
+set_am_opts ()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+set_am_opts '-Wportability' configure.in
+set_am_opts 'foreign' Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+
+rm -rf autom4te*.cache
+
+# Files required in gnu strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+
+set_am_opts '-Wno-portability' configure.in
+set_am_opts 'gnu' Makefile.am
+
+AUTOMAKE_fails
+$ACLOCAL
+grep '^Makefile\.am:2:.*:=.*not portable' stderr
+
+:
diff --git a/tests/warnings-unknown.test b/tests/warnings-unknown.test
new file mode 100755 (executable)
index 0000000..f1fa23e
--- /dev/null
@@ -0,0 +1,48 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that automake complains about unknown warnings.
+
+. ./defs || Exit 1
+
+# We want (almost) complete control over automake options.
+AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror"
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([-Wno-zardoz])
+AC_CONFIG_FILES([Makefile])
+END
+
+cat > Makefile.am <<END
+AUTOMAKE_OPTIONS = -Wfoobar
+END
+
+$ACLOCAL
+
+AUTOMAKE_fails -Wbazquux
+# FIXME: we could get rid of this once we improve our wrapper scripts.
+sed "s/^automake:/automake-$APIVERSION:/" stderr > t
+mv -f t stderr
+cat stderr >&2
+grep '^configure\.in:2:.* unknown warning category.*zardoz' stderr
+grep '^Makefile\.am:1:.* unknown warning category.*foobar' stderr
+grep "^automake-$APIVERSION:.* unknown warning category.*bazquux" stderr
+
+# Check that we can override warnings about unknown warning categories.
+$AUTOMAKE -Wno-unsupported -Wbazquux
+
+:
diff --git a/tests/warnings-win-over-strictness.test b/tests/warnings-win-over-strictness.test
new file mode 100755 (executable)
index 0000000..a577dfe
--- /dev/null
@@ -0,0 +1,90 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that, on the command line, explicitly-defined warnings take
+# precedence over implicit strictness-implied warnings.
+
+. ./defs || Exit 1
+
+# We want complete control over automake options.
+AUTOMAKE=$am_original_AUTOMAKE
+
+ok ()
+{
+  AUTOMAKE_run $*
+  test ! -s stderr
+}
+
+ko ()
+{
+  AUTOMAKE_run $*
+  grep '^Makefile\.am:.*:=.*not portable' stderr
+  test `wc -l <stderr` -eq 1
+}
+
+set_am_opts()
+{
+  set +x
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
+  mv -f $2-t $2
+  set -x
+  cat $2
+}
+
+# Files required in gnu strictness.
+touch README INSTALL NEWS AUTHORS ChangeLog COPYING
+
+cat > Makefile.am <<END
+AUTOMAKE_OPTIONS =
+FOO := bar
+END
+
+$ACLOCAL
+
+ko --foreign -Wportability
+ko -Wportability --foreign
+ok --gnu -Wno-portability
+ok -Wno-portability --gnu
+
+set_am_opts '' Makefile.am
+
+rm -rf autom4te*.cache
+set_am_opts 'foreign -Wportability' configure.in
+ko
+rm -rf autom4te*.cache
+set_am_opts '-Wportability foreign' configure.in
+ko
+rm -rf autom4te*.cache
+set_am_opts 'gnu -Wno-portability' configure.in
+ok
+rm -rf autom4te*.cache
+set_am_opts '-Wno-portability gnu' configure.in
+ok
+
+rm -rf autom4te*.cache
+set_am_opts '' configure.in
+
+set_am_opts 'foreign -Wportability' Makefile.am
+ko
+set_am_opts '-Wportability foreign' Makefile.am
+ko
+set_am_opts 'gnu -Wno-portability' Makefile.am
+ok
+set_am_opts '-Wno-portability gnu' Makefile.am
+ok
+
+:
index 6d96400..4efba48 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 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
@@ -18,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<END
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
@@ -46,21 +45,22 @@ END
 $ACLOCAL
 AUTOMAKE_fails
 # The expected diagnostic is
-#   Makefile.am:3: unused variable: `foo_SOURCES'
-#   sub/Makefile.am:2: `INCLUDES' is the old name for `AM_CPPFLAGS'
+#   Makefile.am:3: warning: variable `foo_SOURCES' is defined but no program or
+#                           library has `foo' as canonical name (possible typo)
+#   sub/Makefile.am:2: warning: `INCLUDES' is the old name for `AM_CPPFLAGS'
 grep '^Makefile.am:.*foo_SOURCES' stderr
 grep '^sub/Makefile.am:.*INCLUDES' stderr
 grep '^sub/Makefile.am:.*foo_SOURCES' stderr && Exit 1
 grep '^Makefile.am:.*INCLUDES' stderr && Exit 1
 # Only three lines of warnings.
-test `wc -l < stderr` = 3
+test `grep -v 'warnings are treated as errors' stderr | wc -l` = 3
 
 # On fast machines the autom4te.cache created during the above run of
 # $AUTOMAKE is likely to have the same time stamp as the configure.in
 # created below; thus causing traces for the old configure.in to be
 # used.  We could do `$sleep', but it's faster to erase the
 # directory.  (Erase autom4te*.cache, not autom4te.cache, because some
-# bogus installations of Autoconf use a versioned cache.)
+# bogus installations of Autoconf use a versioned cache).
 rm -rf autom4te*.cache
 
 # If we add a global -Wnone, all warnings should disappear.
index 355f9d2..8ea6c67 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure --Werror and --add-missing work together.
+# Test to make sure -Werror and --add-missing work together.
 
 . ./defs || Exit 1
 
-set -e
-
 : > Makefile.am
 
 rm -f install-sh depcomp missing mkinstalldirs
 
 $ACLOCAL
-$AUTOMAKE --Werror --add-missing
+$AUTOMAKE -Werror --add-missing
index 6b6d011..bb5851e 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2004, 2009  Free Software Foundation, Inc.
+# Copyright (C) 2004, 2009, 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
 # succeed if make is run a second time immediately afterwards.
 # Report from Harlan Stenn.
 
-required=GNUmake
 . ./defs || Exit 1
 
-set -e
-
 echo AC_OUTPUT>>configure.in
 
 : > Makefile.am
@@ -44,8 +41,8 @@ INCLUDES = -Ifoo
 foo_SOURCES = unused
 END
 
+# This repetition is deliberate; see heading comments.
 $MAKE && Exit 1
-
 $MAKE && Exit 1
 
 :
index 96b4ff3..86e39ec 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010  Free Software Foundation, Inc.
+# Copyright (C) 2010, 2011, 2012 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
@@ -19,8 +19,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >>configure.in <<\END
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
@@ -39,11 +37,12 @@ $ACLOCAL
 
 # The issue would not manifest with threaded execution.
 unset AUTOMAKE_JOBS || :
-AUTOMAKE_run -Wno-error
+AUTOMAKE_run -Wno-error
 grep 'VAR multiply defined' stderr
 
 AUTOMAKE_JOBS=2
 export AUTOMAKE_JOBS
-AUTOMAKE_run -Wno-error
+AUTOMAKE_run -Wno-error
 grep 'VAR multiply defined' stderr
+
 :
diff --git a/tests/werror4.test b/tests/werror4.test
new file mode 100755 (executable)
index 0000000..df41bdc
--- /dev/null
@@ -0,0 +1,66 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# -Werror and local -Werror settings should be flagged for the user.
+
+. ./defs || Exit 1
+
+cat >>configure.in <<\END
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub
+cat >sub/Makefile.am <<\END
+AUTOMAKE_OPTIONS = -Werror
+SUB = foo
+SUB = bar
+END
+cat >Makefile.am <<\END
+AUTOMAKE_OPTIONS = -Werror
+VAR = foo
+VAR = bar
+END
+
+$ACLOCAL
+
+AUTOMAKE_fails -Wno-error
+grep 'VAR multiply defined' stderr
+grep 'SUB multiply defined' stderr
+test `grep -c 'warnings are treated as errors' stderr` -eq 1
+
+sed '/AUTOMAKE_OPTIONS/d' sub/Makefile.am > t
+mv -f t sub/Makefile.am
+
+AUTOMAKE_fails -Wno-error
+grep 'VAR multiply defined' stderr
+grep 'SUB multiply defined' stderr
+test `grep -c 'warnings are treated as errors' stderr` -eq 1
+
+sed '/AUTOMAKE_OPTIONS/d' Makefile.am > t
+mv -f t Makefile.am
+
+AUTOMAKE_fails -Werror
+grep 'VAR multiply defined' stderr
+grep 'SUB multiply defined' stderr
+test `grep -c 'warnings are treated as errors' stderr` -eq 1
+
+AUTOMAKE_run -Wno-error
+grep 'VAR multiply defined' stderr
+grep 'SUB multiply defined' stderr
+grep 'warnings are treated as errors' stderr && Exit 1
+
+:
index 37bd81a..fa1b08d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 1998, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 WHO_AM_I=17
 END
index df140a5..5739413 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003
-#   Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 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
@@ -20,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat > Makefile.am << 'END'
 bin_PROGRAMS = zardoz
 zardoz_SOURCES = z.c x/z.c
similarity index 54%
rename from tests/subobj3.test
rename to tests/yacc-auxdir.test
index 4fe685c..700fcd8 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2010 Free
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 2010, 2011 Free
 # Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test of subdir objects with C++.
+# Test to make sure ylwrap is put in right location.
+# Report from Tim Van Holder.
 
-required=gcc
 . ./defs || Exit 1
 
 set -e
 
+mkdir aux1 sub
+
 cat > configure.in << END
 AC_INIT([$me], [1.0])
-dnl Prevent automake from looking in .. and ../..
-AC_CONFIG_AUX_DIR([.])
+# 'aux' is not an acceptable file/directory name on Windows systems
+AC_CONFIG_AUX_DIR([aux1])
 AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile sub/Makefile])
 AC_PROG_CC
-AC_PROG_CC_STDC
-AM_PROG_CC_C_O
-AM_C_PROTOTYPES
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
+AC_PROG_YACC
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-bin_PROGRAMS = hello
-hello_SOURCES = sub/hello.c
+SUBDIRS = sub
+bin_PROGRAMS = foo
+AM_YFLAGS = -d
+foo_SOURCES = foo.y
 END
 
-mkdir sub
-cat > sub/hello.c << 'END'
-#include <stdio.h>
-int
-main (int argc, char *argv[])
-{
-   printf ("yeah, yeah\n");
-   return 0;
-}
+cat > sub/Makefile.am << 'END'
+bin_PROGRAMS = bar
+AM_YFLAGS = -d
+bar_SOURCES = bar.y main.c
 END
 
-# Ignore user CFLAGS.
-CFLAGS=
-export CFLAGS
-
-# We use gcc and not gcc -traditional as the latter fails on some
-# Linux boxes (Red Hat 5.1 in particular).
 $ACLOCAL
-$AUTOCONF
 $AUTOMAKE -a
-./configure
-ANSI2KNR=./ansi2knr U=_ $MAKE -e
-./hello
+test -f aux1/ylwrap
+test ! -f ylwrap
+test ! -f sub/ylwrap
+grep -i 'ylwrap' Makefile.in sub/Makefile.in # For debugging.
+$FGREP '$(top_srcdir)/aux1/ylwrap' Makefile.in
+$FGREP '$(top_srcdir)/aux1/ylwrap' sub/Makefile.in
 
 :
diff --git a/tests/yacc-basic.test b/tests/yacc-basic.test
new file mode 100755 (executable)
index 0000000..48f76c9
--- /dev/null
@@ -0,0 +1,109 @@
+#! /bin/sh
+# Copyright (C) 2010, 2011, 2012 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/>.
+
+# Basic semantic checks on Yacc support (without yacc-generated headers).
+# Keep in sync with sister test `yacc-cxx.test'.
+
+required='cc yacc'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar
+foo_SOURCES = parse.y foo.c
+bar_SOURCES = $(foo_SOURCES)
+bar_YFLAGS = -v
+
+.PHONY: echo-distcom
+echo-distcom:
+       @echo ' ' $(DIST_COMMON) ' '
+END
+
+cat > parse.y << 'END'
+%{
+#include <stdio.h>
+#include <stdlib.h>
+int yylex () { return getchar (); }
+void yyerror (char *s) {}
+%}
+%%
+a : 'a' { exit(0); };
+END
+
+cat > foo.c << 'END'
+int main () { yyparse (); return 1; }
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+ls -l
+# The Yacc-derived C sources must be created, and not removed once
+# compiled (i.e., not treated like "intermediate files" in the GNU
+# make sense).
+test -f parse.c
+test -f bar-parse.c
+# Check that per-object flags are honored.
+test -f bar-parse.output
+
+if cross_compiling; then :; else
+  echo a | ./foo
+  echo b | ./foo && Exit 1
+  : For shells with busted 'set -e'.
+fi
+
+echo a | ./bar
+echo b | ./bar && Exit 1
+
+# The Yacc-derived C sources must be shipped.
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]parse\.c '
+$MAKE -s echo-distcom | grep '[ /]bar-parse\.c '
+$MAKE distdir
+ls -l $distdir
+test -f $distdir/parse.c
+test -f $distdir/bar-parse.c
+
+# Sanity check on distribution.
+# Note that, for this to succeed, bar-parse.output must either not
+# be distributed, or properly cleaned by automake-generated rules.
+# We don't want to set the exact semantics yet, but want to ensure
+# they are are consistent.
+yl_distcheck
+
+# Make sure that the Yacc-derived C sources are erased by
+# maintainer-clean, and not by distclean.
+test -f parse.c
+test -f bar-parse.c
+$MAKE distclean
+ls -l
+test -f parse.c
+test -f bar-parse.c
+./configure # We must re-create 'Makefile'.
+$MAKE maintainer-clean
+ls -l
+test ! -f parse.c
+test ! -f bar-parse.c
+
+:
diff --git a/tests/yacc-bison-skeleton-cxx.test b/tests/yacc-bison-skeleton-cxx.test
new file mode 100755 (executable)
index 0000000..b080441
--- /dev/null
@@ -0,0 +1,100 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test to make sure bison + bison's C++ skeleton + C++ works.
+# For Automake bug#7648 and PR automake/491.
+
+required=bison
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = zardoz.yy foo.cc
+
+# This is required even with %defines in zardoz.yy.
+AM_YFLAGS = -d
+
+BUILT_SOURCES = zardoz.hh
+EXTRA_DIST = stack.hh location.hh position.hh
+END
+
+cat > zardoz.yy << 'END'
+%skeleton "lalr1.cc"
+%defines
+
+%{
+#define YYSTYPE int
+int yylex(YYSTYPE* yylval_param);
+%}
+
+%%
+start :        /* empty */
+%%
+
+int
+yylex(YYSTYPE*)
+{
+    return 0;
+}
+
+void
+yy::parser::error(const yy::parser::location_type&, const std::string& m)
+{
+    return;
+}
+END
+
+cat > foo.cc << 'END'
+#include "zardoz.hh"
+
+using namespace std;
+
+int
+main(int argc, char** argv)
+{
+  yy::parser my_parser;
+  return my_parser.parse ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try a VPATH build first.
+mkdir build
+cd build
+../configure YACC='bison -y'
+$MAKE
+cd ..
+
+# Now try an in-tree build.
+./configure YACC='bison -y'
+$MAKE
+
+# Check that distribution is self-contained, and do not require
+# bison to be built.
+env YACC=false DISTCHECK_CONFIGURE_FLAGS='YACC=false' $MAKE -e distcheck
+
+:
diff --git a/tests/yacc-bison-skeleton.test b/tests/yacc-bison-skeleton.test
new file mode 100755 (executable)
index 0000000..cc89a3d
--- /dev/null
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Test to make sure bison + bison's skeleton works.
+# For Automake bug#7648 and PR automake/491.
+
+required=bison
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = zardoz.y foo.c
+AM_YFLAGS = -d --skeleton glr.c
+END
+
+# Parser.
+cat > zardoz.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (const char *s) { return; }
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+cat > foo.c << 'END'
+#include "zardoz.h"
+int main (void)
+{
+  return yyparse ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try a VPATH build first.
+mkdir build
+cd build
+../configure YACC='bison -y'
+$MAKE
+cd ..
+
+# Now try an in-tree build.
+./configure YACC='bison -y'
+$MAKE
+
+# Check that distribution is self-contained, and do not require
+# bison to be built.
+env YACC=false DISTCHECK_CONFIGURE_FLAGS='YACC=false' $MAKE -e distcheck
+
+:
diff --git a/tests/yacc-clean-cxx.test b/tests/yacc-clean-cxx.test
new file mode 100755 (executable)
index 0000000..81d43e7
--- /dev/null
@@ -0,0 +1,165 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that C++ source and header files derived from non-distributed
+# Yacc sources are cleaned by "make clean", while C++ source and
+# header files derived from distributed Yacc sources are cleaned by
+# "make maintainer-clean".
+# See also sister test `yacc-clean.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_YACC
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# Use two subdirectories, one to test with `-d' in YFLAGS, the
+# other one to test with empty YFLAGS.
+SUBDIRS = sub1 sub2
+END
+
+mkdir sub1 sub2
+
+cat > sub1/Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+
+foo_SOURCES = mainfoo.cc parsefoo.yxx
+
+bar_SOURCES = mainbar.cpp parsebar.yy
+bar_YFLAGS = $(AM_YFLAGS)
+
+baz_SOURCES = mainbaz.c++
+nodist_baz_SOURCES = parsebaz.y++
+
+qux_SOURCES = mainqux.cxx
+nodist_qux_SOURCES = parsequx.ypp
+qux_YFLAGS = $(AM_YFLAGS)
+
+parsebaz.y++ parsequx.ypp:
+       cp $(srcdir)/parsefoo.yxx $@
+
+CLEANFILES = parsebaz.y++ parsequx.ypp
+END
+
+cat > sub2/Makefile.am << 'END'
+include $(top_srcdir)/sub1/Makefile.am
+AM_YFLAGS = -d
+END
+
+cat > sub1/parsefoo.yxx << 'END'
+%{
+// This file should contain valid C++ but invalid C.
+#include <cstdio>
+int yylex (void) { return (getchar ()); }
+void yyerror (const char *s) { return; }
+%}
+%%
+x : 'x' { };
+END
+cp sub1/parsefoo.yxx sub1/parsebar.yy
+cp sub1/parsefoo.yxx sub2/parsefoo.yxx
+cp sub1/parsefoo.yxx sub2/parsebar.yy
+
+cat > sub1/mainfoo.cc << 'END'
+// This file should contain valid C++ but invalid C.
+using namespace std;
+int main (int argc, char **argv)
+{
+  extern int yyparse (void);
+  return yyparse ();
+}
+END
+cp sub1/mainfoo.cc sub1/mainbar.cpp
+cp sub1/mainfoo.cc sub1/mainbaz.c++
+cp sub1/mainfoo.cc sub1/mainqux.cxx
+cp sub1/main???.c* sub2
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+cp config.status config.sav
+
+$MAKE
+ls -l . sub1 sub2
+# Sanity checks.
+test -f sub1/parsefoo.cxx
+test -f sub1/bar-parsebar.cc
+test -f sub1/parsebaz.y++
+test -f sub1/parsebaz.c++
+test -f sub1/parsequx.ypp
+test -f sub1/qux-parsequx.cpp
+test -f sub2/parsefoo.cxx
+test -f sub2/parsefoo.hxx
+test -f sub2/bar-parsebar.cc
+test -f sub2/bar-parsebar.hh
+test -f sub2/parsebaz.y++
+test -f sub2/parsebaz.c++
+test -f sub2/parsebaz.h++
+test -f sub2/parsequx.ypp
+test -f sub2/qux-parsequx.cpp
+test -f sub2/qux-parsequx.hpp
+
+for target in clean distclean; do
+  $MAKE $target
+  ls -l . sub1 sub2
+  test -f sub1/parsefoo.cxx
+  test -f sub1/bar-parsebar.cc
+  test ! -r sub1/parsebaz.y++
+  test ! -r sub1/parsebaz.c++
+  test ! -r sub1/parsequx.ypp
+  test ! -r sub1/qux-parsequx.cpp
+  test -f sub2/parsefoo.cxx
+  test -f sub2/parsefoo.hxx
+  test -f sub2/bar-parsebar.cc
+  test -f sub2/bar-parsebar.hh
+  test ! -r sub2/parsebaz.y++
+  test ! -r sub2/parsebaz.c++
+  test ! -r sub2/parsebaz.h++
+  test ! -r sub2/parsequx.ypp
+  test ! -r sub2/qux-parsequx.cpp
+  test ! -r sub2/qux-parsequx.hpp
+done
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+$MAKE maintainer-clean
+ls -l . sub1 sub2
+test -f sub1/parsefoo.yxx
+test -f sub1/parsebar.yy
+test ! -r sub1/parsefoo.cxx
+test ! -r sub1/bar-parsebar.cc
+test -f sub2/parsefoo.yxx
+test -f sub2/parsebar.yy
+test ! -r sub2/parsefoo.cxx
+test ! -r sub2/parsefoo.hxx
+test ! -r sub2/bar-parsebar.cc
+test ! -r sub2/bar-parsebar.hh
+
+cp config.sav config.status
+./config.status # re-create Makefile
+
+:
diff --git a/tests/yacc-clean.test b/tests/yacc-clean.test
new file mode 100755 (executable)
index 0000000..9671b8c
--- /dev/null
@@ -0,0 +1,147 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check that .c and .h files derived from non-distributed .y sources
+# are cleaned by "make clean", while .c and .h files derived from
+# distributed .y sources are cleaned by "make maintainer-clean".
+# See also sister test `yacc-cxx-clean.test'.
+
+required='cc yacc'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# Use two subdirectories, one to test with `-d' in YFLAGS, the
+# other one to test with empty YFLAGS.
+SUBDIRS = sub1 sub2
+END
+
+mkdir sub1 sub2
+
+cat > sub1/Makefile.am << 'END'
+bin_PROGRAMS = foo bar baz qux
+
+foo_SOURCES = main.c parse.y
+
+bar_SOURCES = main.c parse.y
+bar_YFLAGS = $(AM_YFLAGS)
+
+baz_SOURCES = main.c
+nodist_baz_SOURCES = baz.y
+
+qux_SOURCES = main.c
+nodist_qux_SOURCES = baz.y
+qux_YFLAGS = $(AM_YFLAGS)
+
+baz.y:
+       cp $(srcdir)/parse.y $@
+
+CLEANFILES = baz.y
+END
+
+cat > sub2/Makefile.am << 'END'
+include $(top_srcdir)/sub1/Makefile.am
+AM_YFLAGS = -d
+END
+
+cat > sub1/parse.y << 'END'
+%{
+int yylex () { return (getchar ()); }
+void yyerror (char *s) {}
+%}
+%%
+x : 'x' { };
+END
+cp sub1/parse.y sub2/parse.y
+
+cat > sub1/main.c << 'END'
+int main ()
+{
+  return yyparse ();
+}
+END
+cp sub1/main.c sub2/main.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+cp config.status config.sav
+
+$MAKE
+ls -l . sub1 sub2
+# Sanity checks.
+test -f sub1/parse.y
+test -f sub1/parse.c
+test -f sub1/bar-parse.c
+test -f sub1/baz.y
+test -f sub1/baz.c
+test -f sub1/qux-baz.c
+test -f sub2/parse.y
+test -f sub2/parse.c
+test -f sub2/parse.h
+test -f sub2/bar-parse.c
+test -f sub2/bar-parse.h
+test -f sub2/baz.y
+test -f sub2/baz.c
+test -f sub2/baz.h
+test -f sub2/qux-baz.c
+test -f sub2/qux-baz.h
+
+for target in clean distclean; do
+  $MAKE $target
+  ls -l . sub1 sub2
+  test -f sub1/parse.y
+  test -f sub1/parse.c
+  test -f sub1/bar-parse.c
+  test ! -r sub1/baz.y
+  test ! -r sub1/baz.c
+  test ! -r sub1/qux-baz.c
+  test -f sub2/parse.y
+  test -f sub2/parse.c
+  test -f sub2/parse.h
+  test -f sub2/bar-parse.c
+  test -f sub2/bar-parse.h
+  test ! -r sub2/baz.y
+  test ! -r sub2/baz.c
+  test ! -r sub2/baz.h
+  test ! -r sub2/qux-baz.c
+  test ! -r sub2/qux-baz.h
+done
+
+cp config.sav config.status
+./config.status # Re-create `Makefile'.
+
+$MAKE maintainer-clean
+ls -l . sub1 sub2
+test -f sub1/parse.y
+test ! -r sub1/parse.c
+test ! -r sub1/bar-parse.c
+test -f sub2/parse.y
+test ! -r sub2/parse.c
+test ! -r sub2/parse.h
+test ! -r sub2/bar-parse.c
+test ! -r sub2/bar-parse.h
+
+:
diff --git a/tests/yacc-cxx.test b/tests/yacc-cxx.test
new file mode 100755 (executable)
index 0000000..430fe06
--- /dev/null
@@ -0,0 +1,139 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Basic semantic checks on Yacc + C++ support (when yacc-generated
+# headers are not involved).
+# Keep in sync with sister test `yacc-basic.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo1 foo2 foo3 foo4
+foo1_SOURCES = parse1.yy  foo.cc
+foo2_SOURCES = parse2.y++ bar.c++
+foo3_SOURCES = parse3.yxx foo.cc
+foo4_SOURCES = parse4.ypp bar2.cxx
+foo3_YFLAGS = -v
+foo4_YFLAGS = $(foo3_YFLAGS)
+
+.PHONY: echo-distcom
+echo-distcom:
+       @echo ' ' $(DIST_COMMON) ' '
+END
+
+cat > parse1.yy << 'END'
+%{
+// Valid C++, but deliberately invalid C.
+#include <cstdio>
+#include <cstdlib>
+int yylex (void) { return getchar (); }
+void yyerror (const char *s) { return; }
+%}
+%%
+a : 'a' { exit(0); };
+END
+cp parse1.yy parse2.y++
+cp parse1.yy parse3.yxx
+cp parse1.yy parse4.ypp
+
+cat > foo.cc << 'END'
+// Valid C++, but deliberately invalid C.
+using namespace std;
+int main (int argc, char **argv)
+{
+  int yyparse (void);
+  yyparse ();
+  return 1;
+}
+END
+cp foo.cc bar.c++
+cp foo.cc bar2.cxx
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE
+
+# The Yacc-derived C++ sources must be created, and not removed once
+# compiled (i.e., not treated like "intermediate files" in the GNU
+# make sense).
+test -f parse1.cc
+test -f parse2.c++
+test -f foo3-parse3.cxx
+test -f foo4-parse4.cpp
+# Check that per-object flags are honored.
+test -f foo3-parse3.output
+test -f foo4-parse4.output
+
+for i in 1 2 3 4; do
+  echo a | ./foo$i
+  echo b | ./foo$i && Exit 1
+  : For shells with busted 'set -e'.
+done
+
+# The Yacc-derived C++ sources must be shipped.
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]parse1\.cc '
+$MAKE -s echo-distcom | grep '[ /]parse2\.c++ '
+$MAKE -s echo-distcom | grep '[ /]foo3-parse3\.cxx '
+$MAKE -s echo-distcom | grep '[ /]foo4-parse4\.cpp '
+$MAKE distdir
+ls -l $distdir
+test -f $distdir/parse1.cc
+test -f $distdir/parse2.c++
+test -f $distdir/foo3-parse3.cxx
+test -f $distdir/foo4-parse4.cpp
+
+# Sanity check on distribution.
+# Note that, for this to succeed, foo3-parse3.output and foo4-parse4.output
+# must either not be distributed, or properly cleaned by automake-generated
+# rules.  We don't want to set the exact semantics yet, but want to ensure
+# they are are consistent.
+yl_distcheck
+
+# Make sure that the Yacc-derived C++ sources are erased by
+# maintainer-clean, and not by distclean.
+test -f parse1.cc
+test -f parse2.c++
+test -f foo3-parse3.cxx
+test -f foo4-parse4.cpp
+$MAKE distclean
+ls -l
+test -f parse1.cc
+test -f parse2.c++
+test -f foo3-parse3.cxx
+test -f foo4-parse4.cpp
+./configure # we must re-create `Makefile'
+$MAKE maintainer-clean
+ls -l
+test ! -f parse1.cc
+test ! -f parse2.c++
+test ! -f foo3-parse3.cxx
+test ! -f foo4-parse4.cpp
+
+:
diff --git a/tests/yacc-d-basic.test b/tests/yacc-d-basic.test
new file mode 100755 (executable)
index 0000000..f499bf0
--- /dev/null
@@ -0,0 +1,154 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Tests Yacc support with yacc-generated headers
+# (i.e., '-d' in *YFLAGS).
+# Keep in sync with sister test `yacc-d-cxx.test'.
+
+required='cc yacc'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_CONFIG_FILES([foo/Makefile bar/Makefile baz/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = foo bar baz
+END
+
+mkdir foo bar baz
+
+cat > foo/Makefile.am <<'END'
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = parse.y main.c
+.PHONY: echo-distcom
+echo-distcom:
+       @echo ' ' $(DIST_COMMON) ' '
+END
+cp foo/Makefile.am bar/Makefile.am
+cp foo/Makefile.am baz/Makefile.am
+
+cat > foo/parse.y << 'END'
+%{
+#include "parse.h"
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+x : 'x' {};
+%%
+END
+cp foo/parse.y bar/parse.y
+
+cat > foo/main.c << 'END'
+#include "parse.h"
+int main ()
+{
+  return yyparse ();
+}
+END
+cp foo/main.c bar/main.c
+
+# Even the generated header file is renamed when target-specific YFLAGS
+# are used.  This might not be the best behavior, but it has been in
+# place for quite a long time, so just go along with it for now.
+sed 's/"parse\.h"/"zardoz-parse.h"/' foo/parse.y > baz/parse.y
+sed 's/"parse\.h"/"zardoz-parse.h"/' foo/main.c > baz/main.c
+
+$ACLOCAL
+$AUTOCONF
+
+$AUTOMAKE -a
+$FGREP parse.h foo/Makefile.in bar/Makefile.in baz/Makefile.in && Exit 1
+
+cat >> foo/Makefile.am <<END
+BUILT_SOURCES = parse.h
+YFLAGS=\
+-d
+END
+$AUTOMAKE -Wno-gnu foo/Makefile
+
+sed 's/EOL$//' >> bar/Makefile.am <<END
+AM_YFLAGS${tab}=  -d EOL
+BUILT_SOURCES = parse.h
+END
+$AUTOMAKE bar/Makefile
+
+cat >> baz/Makefile.am <<END
+BUILT_SOURCES = zardoz-parse.h
+zardoz_YFLAGS =-d${tab}
+END
+$AUTOMAKE baz/Makefile
+
+./configure
+
+$MAKE
+
+test -f foo/parse.c
+test -f foo/parse.h
+test -f bar/parse.c
+test -f bar/parse.h
+test -f baz/zardoz-parse.c
+test -f baz/zardoz-parse.h
+
+# The generated C source and header files must be shipped.
+for dir in foo bar; do
+  cd $dir
+  $MAKE echo-distcom
+  $MAKE -s echo-distcom | grep '[ /]parse.c '
+  $MAKE -s echo-distcom | grep '[ /]parse.h '
+  cd ..
+done
+cd baz
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]zardoz-parse.c '
+$MAKE -s echo-distcom | grep '[ /]zardoz-parse.h '
+cd ..
+
+$MAKE distdir
+ls -l $distdir
+test -f $distdir/foo/parse.c
+test -f $distdir/foo/parse.h
+test -f $distdir/bar/parse.c
+test -f $distdir/bar/parse.h
+test -f $distdir/baz/zardoz-parse.c
+test -f $distdir/baz/zardoz-parse.h
+
+# Sanity check the distribution.
+yl_distcheck
+
+# While we are at it, make sure that `parse.c' and `parse.h' are erased
+# by maintainer-clean, and not by distclean.
+$MAKE distclean
+test -f foo/parse.c
+test -f foo/parse.h
+test -f bar/parse.c
+test -f bar/parse.h
+test -f baz/zardoz-parse.c
+test -f baz/zardoz-parse.h
+./configure # We must re-create `Makefile'.
+$MAKE maintainer-clean
+test ! -f foo/parse.c
+test ! -f foo/parse.h
+test ! -f bar/parse.c
+test ! -f bar/parse.h
+test ! -f baz/zardoz-parse.c
+test ! -f baz/zardoz-parse.h
+
+:
diff --git a/tests/yacc-d-cxx.test b/tests/yacc-d-cxx.test
new file mode 100755 (executable)
index 0000000..13bb094
--- /dev/null
@@ -0,0 +1,233 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Various tests on Yacc/C++ support with yacc-generated headers
+# (i.e., '-d' in *YFLAGS).
+# Keep in sync with sister test `yacc-d-basic.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+write_parse ()
+{
+  header=$1
+  sed 's/^ *//' <<END
+    %{
+    // Valid C++, but deliberately invalid C.
+    #include <cstdlib>
+    #include "$header"
+    int yylex (void) { return 0; }
+    void yyerror (const char *s) {}
+    %}
+    %%
+    x : 'x' {};
+    %%
+END
+}
+
+write_main ()
+{
+  header=$1
+  sed 's/^ *//' <<END
+    // Valid C++, but deliberately invalid C.
+    #include <cstdio>
+    #include "$header"
+    int main (int argc, char **argv)
+    {
+      int yyparse (void);
+      return yyparse ();
+    }
+END
+}
+
+cat >> configure.in << 'END'
+AC_PROG_CXX
+AC_PROG_YACC
+AC_CONFIG_FILES([foo/Makefile bar/Makefile baz/Makefile qux/Makefile])
+AC_OUTPUT
+END
+
+mkdir foo bar baz qux baz/sub
+
+# These makefiles will be extended later.
+cat > Makefile.am <<'END'
+.PHONY: echo-distcom
+echo-distcom:
+       @echo ' ' $(DIST_COMMON) ' '
+END
+cp Makefile.am foo/Makefile.am
+cp Makefile.am bar/Makefile.am
+cp Makefile.am baz/Makefile.am
+cp Makefile.am qux/Makefile.am
+
+cat >> Makefile.am <<'END'
+SUBDIRS = foo bar baz qux
+END
+
+$ACLOCAL
+$AUTOCONF
+
+cp $testsrcdir/../lib/ylwrap .
+
+$AUTOMAKE Makefile
+
+# Try with -d in $(YFLAGS) (don't do this in real life!).
+cat >> foo/Makefile.am <<END
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = parse.yy main.cc
+BUILT_SOURCES = parse.hh
+YFLAGS=\
+-d
+END
+
+$AUTOMAKE -Wno-gnu foo/Makefile
+
+write_parse parse.hh > foo/parse.yy
+write_main parse.hh > foo/main.cc
+
+# Try with -d in $(AM_YFLAGS).
+cat >> bar/Makefile.am <<END
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = parse.ypp main.cpp
+BUILT_SOURCES = parse.hpp
+AM_YFLAGS${tab}=  -d ${tab}
+END
+
+$AUTOMAKE bar/Makefile
+
+write_parse parse.hpp > bar/parse.ypp
+write_main parse.hpp > bar/main.cpp
+
+# Try with -d in $(AM_YFLAGS), and a subdir parser.
+cat >> baz/Makefile.am <<END
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = joe
+joe_SOURCES = sub/parse.y++ sub/main.c++
+BUILT_SOURCES = sub/parse.h++
+AM_YFLAGS = \
+${tab}-d
+END
+
+$AUTOMAKE baz/Makefile
+
+write_parse sub/parse.h++ > baz/sub/parse.y++
+write_main sub/parse.h++ > baz/sub/main.c++
+
+# Try with -d in $(xxx_YFLAGS) (per-object flag).
+cat >> qux/Makefile.am <<END
+bin_PROGRAMS = maude
+maude_SOURCES = parse.yxx main.cxx
+maude_YFLAGS=${tab}  -d${tab}
+BUILT_SOURCES = maude-parse.hxx
+END
+
+$AUTOMAKE qux/Makefile
+
+write_parse maude-parse.hxx > qux/parse.yxx
+write_main maude-parse.hxx > qux/main.cxx
+
+./configure
+
+$MAKE
+ls -l . foo bar baz baz/sub qux # For debugging.
+
+test -f foo/parse.cc
+test -f foo/parse.hh
+test -f bar/parse.cpp
+test -f bar/parse.hpp
+test -f baz/sub/parse.c++
+test -f baz/sub/parse.h++
+test -f qux/maude-parse.cxx
+test -f qux/maude-parse.hxx
+
+# The ylwrap script must be shipped.
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]ylwrap '
+
+# The generated C++ source and header files must be shipped.
+cd foo
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]parse\.cc '
+$MAKE -s echo-distcom | grep '[ /]parse\.hh '
+cd ..
+cd bar
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]parse\.cpp '
+$MAKE -s echo-distcom | grep '[ /]parse\.hpp '
+cd ..
+cd baz
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]sub/parse\.c++ '
+$MAKE -s echo-distcom | grep '[ /]sub/parse\.h++ '
+cd ..
+cd qux
+$MAKE echo-distcom
+$MAKE -s echo-distcom | grep '[ /]maude-parse\.cxx '
+$MAKE -s echo-distcom | grep '[ /]maude-parse\.hxx '
+cd ..
+
+$MAKE distdir
+find $distdir # For debugging.
+
+test -f $distdir/ylwrap
+test -f $distdir/foo/parse.cc
+test -f $distdir/foo/parse.hh
+test -f $distdir/bar/parse.cpp
+test -f $distdir/bar/parse.hpp
+test -f $distdir/baz/sub/parse.c++
+test -f $distdir/baz/sub/parse.h++
+test -f $distdir/qux/maude-parse.cxx
+test -f $distdir/qux/maude-parse.hxx
+
+# The Yacc-derived C++ sources must be created, and not removed once
+# compiled (i.e., not treated like "intermediate files" in the GNU
+# make sense).
+yl_distcheck
+
+# Check that we can recover from deleted headers.
+$MAKE clean
+rm -f foo/parse.hh bar/parse.hpp baz/sub/parse.h++ qux/maude-parse.hxx
+$MAKE
+test -f foo/parse.hh
+test -f bar/parse.hpp
+test -f baz/sub/parse.h++
+test -f qux/maude-parse.hxx
+
+# Make sure that the Yacc-derived C++ sources are erased by
+# maintainer-clean, and not by distclean.
+$MAKE distclean
+test -f foo/parse.cc
+test -f foo/parse.hh
+test -f bar/parse.cpp
+test -f bar/parse.hpp
+test -f baz/sub/parse.c++
+test -f baz/sub/parse.h++
+test -f qux/maude-parse.cxx
+test -f qux/maude-parse.hxx
+./configure # We must re-create `Makefile'.
+$MAKE maintainer-clean
+test ! -f foo/parse.cc
+test ! -f foo/parse.hh
+test ! -f bar/parse.cpp
+test ! -f bar/parse.hpp
+test ! -f baz/sub/parse.c++
+test ! -f baz/sub/parse.h++
+test ! -f qux/maude-parse.cxx
+test ! -f qux/maude-parse.hxx
+
+:
diff --git a/tests/yacc-d-vpath.test b/tests/yacc-d-vpath.test
new file mode 100755 (executable)
index 0000000..9c437aa
--- /dev/null
@@ -0,0 +1,108 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# This test checks that dependent files are updated before including
+# in the distribution. `parse.c' depends on `parse.y'.  The latter is
+# updated so that `parse.c' should be rebuilt.  Then we are running
+# `make' and `make distdir' and check whether the version of `parse.c'
+# to be distributed is up to date.
+
+# Please keep this in sync with sister test `yaccvpath.test'.
+
+required='cc yacc'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = parse.y foo.c
+AM_YFLAGS = -d
+END
+
+# Original parser, with `foobar'.
+cat > parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%token FOOBAR
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+cat > foo.c << 'END'
+#include "parse.h"
+int main () { return 0; }
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+$YACC -d parse.y
+mv y.tab.c parse.c
+mv y.tab.h parse.h
+# Sanity checks.
+grep foobar parse.c
+grep FOOBAR parse.h
+
+mkdir sub
+cd sub
+../configure
+
+$sleep
+
+# New parser, with `fubar'.
+cat > ../parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%token FUBAR
+%%
+fubar : 'f' 'u' 'b' 'a' 'r' {};
+END
+
+$MAKE
+$MAKE distdir
+$FGREP fubar $distdir/parse.c
+$FGREP FUBAR $distdir/parse.h
+
+# Now check to make sure that `make dist' will rebuild the parser.
+
+$sleep
+
+# New parser, with `maude'.
+cat > ../parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%token MAUDE
+%%
+maude : 'm' 'a' 'u' 'd' 'e' {};
+END
+
+$MAKE distdir
+$FGREP maude $distdir/parse.c
+$FGREP MAUDE $distdir/parse.h
+
+:
diff --git a/tests/yacc-deleted-headers.test b/tests/yacc-deleted-headers.test
new file mode 100755 (executable)
index 0000000..6d6a0a1
--- /dev/null
@@ -0,0 +1,165 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Tests that we can recover from deleted headers generated by `yacc -d'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = p1 p2 p3 p4
+# The order in which files are listed in the p*_SOURCES variables
+# below is significant, since it causes make failures whenever
+# the proper definition of BUILT_SOURCES or the declaration of
+# extra dependencies for `main3.o' are removed.
+p1_SOURCES = main1.c parse1.y
+p2_SOURCES = main2.c parse2.y
+p3_SOURCES = main3.c parse3.y parse3.h
+p4_SOURCES = parse4.y
+AM_YFLAGS = -d
+p2_YFLAGS = -d
+
+BUILT_SOURCES = parse1.h p2-parse2.h
+
+# When we know which files include a yacc-generated header, we
+# should be able to just declare dependencies directly instead
+# of relying on the BUILT_SOURCES hack, and things should still
+# work correctly.
+main3.@OBJEXT@: parse3.h
+
+.PHONY: clean-p3 build-p3
+build-p3: p3$(EXEEXT)
+clean-p3:
+       rm -f p3$(EXEEXT)
+END
+
+cat > parse1.y << 'END'
+%{
+#include "parse1.h"
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%token ZARDOZ
+%%
+x : 'x' {};
+%%
+END
+
+cat > main1.c << 'END'
+#include "parse1.h"
+int main (void)
+{
+  return ZARDOZ + yyparse ();
+}
+END
+
+sed 's/"parse1\.h"/"p2-parse2.h"/' parse1.y > parse2.y
+sed 's/"parse1\.h"/"p2-parse2.h"/' main1.c > main2.c
+
+sed 's/"parse1\.h"/"parse3.h"/' parse1.y > parse3.y
+sed 's/"parse1\.h"/"parse3.h"/' main1.c > main3.c
+
+cat > parse4.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%%
+x : 'x' {};
+%%
+int main (void)
+{
+  return 0;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+
+headers='parse1.h p2-parse2.h parse3.h parse4.h'
+
+# Check that we remake only the necessary headers.
+
+rm -f $headers
+$MAKE parse1.h
+test -f parse1.h
+test ! -r p2-parse2.h
+test ! -r parse3.h
+test ! -r parse4.h
+
+rm -f $headers
+$MAKE p2-parse2.h
+test ! -r parse1.h
+test -f p2-parse2.h
+test ! -r parse3.h
+test ! -r parse4.h
+
+rm -f $headers
+$MAKE parse3.h
+test ! -r parse1.h
+test ! -r p2-parse2.h
+test -f parse3.h
+test ! -r parse4.h
+# Since we declared parse3.h into $(p3_SOURCES), make should be
+# able to rebuild it automatically before remaking `p3'.
+rm -f $headers
+$MAKE clean-p3
+test ! -f parse3.h # Sanity check.
+$MAKE build-p3
+test -f parse3.h
+
+$MAKE
+
+rm -f $headers
+$MAKE parse4.h
+test ! -r parse1.h
+test ! -r p2-parse2.h
+test ! -r parse3.h
+test -f parse4.h
+
+# Now remake all the headers together.
+
+rm -f $headers
+$MAKE $headers
+test -f parse1.h
+test -f p2-parse2.h
+test -f parse3.h
+test -f parse4.h
+
+# Most headers should be remade by "make all".
+
+rm -f $headers
+$MAKE all
+test -f parse1.h
+test -f p2-parse2.h
+test -f parse3.h
+# parse4.h is not declared in any *_SOURCES variable, nor #included
+# by any C source file, so it shouldn't be rebuilt by "make all".
+test ! -r parse4.h
+
+:
diff --git a/tests/yacc-depend.test b/tests/yacc-depend.test
new file mode 100755 (executable)
index 0000000..2f708ec
--- /dev/null
@@ -0,0 +1,85 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 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 depcomp does not needlessly update headers for yacc rules.
+# Report from Paolo Bonzini.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+AM_YFLAGS = -d
+foo_SOURCES = foo.y main.c
+BUILT_SOURCES = foo.h
+END
+
+cat > foo.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%token TOKEN
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+
+cat > main.c << 'END'
+#include "foo.h"
+int main(void)
+{
+  return yyparse ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try to enable dependency tracking if possible, even if that means
+# using slow dependency extractors.
+./configure --enable-dependency-tracking
+$MAKE
+ls -l # For debugging.
+
+# Make sure foo.h is not updated if not really needed.
+$sleep
+: > my-timestamp
+$sleep
+touch foo.y
+$MAKE
+stat my-timestamp foo.* || : # For debugging.
+is_newest my-timestamp foo.h
+
+# Make sure foo.h is updated if needed.
+$sleep
+sed 's/TOKEN/TEKON/g' foo.y > t
+mv -f t foo.y
+$MAKE
+stat my-timestamp foo.* || : # For debugging.
+is_newest foo.h my-timestamp
+
+:
diff --git a/tests/yacc-depend2.test b/tests/yacc-depend2.test
new file mode 100755 (executable)
index 0000000..51c1fe1
--- /dev/null
@@ -0,0 +1,89 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 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 depcomp does not needlessly update headers and objects
+# for yacc rules.  This test still fails with FreeBSD make (but passes
+# with NetBSD make).
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+AM_YFLAGS = -d
+foo_SOURCES = foo.y main.c
+BUILT_SOURCES = foo.h
+.PHONY: debug-info test-time-unchanged test-time-changed
+debug-info:
+       ls -l
+       stat *.[ch] *.$(OBJEXT) my-timestamp || :
+test-time-unchanged: debug-info
+       test `ls -1t main.$(OBJEXT) my-timestamp | sed 1q` = my-timestamp
+test-time-changed: debug-info
+       test `ls -1t main.$(OBJEXT) my-timestamp | sed 1q` = main.$(OBJEXT)
+END
+
+cat > foo.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%token TOKEN
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+
+cat > main.c << 'END'
+#include "foo.h"
+int main(void)
+{
+  return yyparse ();
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try to enable dependency tracking if possible, even if that means
+# using slow dependency extractors.
+./configure --enable-dependency-tracking
+$MAKE
+ls -l # For debugging.
+
+$sleep
+: > my-timestamp
+$sleep
+touch foo.y
+$MAKE
+$MAKE test-time-unchanged
+$sleep
+sed 's/TOKEN/TEKON/g' foo.y > t
+mv -f t foo.y
+$MAKE
+$MAKE test-time-changed
+
+:
index b6811d7..de12d77 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# Copyright (C) 2011, 2012 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
@@ -21,9 +21,9 @@
 required=yacc
 . ./defs || Exit 1
 
-set -e
-
-distdir=$me-1.0
+# This test is bounded to fail for any implementation that
+# triggers automake bug#7884.
+useless_vpath_rebuild && skip_ "would trip on automake bug#7884"
 
 cat >> configure.in << 'END'
 AC_PROG_CC
@@ -64,7 +64,7 @@ $AUTOMAKE -a
 ./configure
 $MAKE distdir
 
-# Yacc-derived C source and header files must be built and distributed
+# Yacc-derived C source and header files must be built and distributed.
 
 test   -f sub/parse.c
 test   -f sub/parse.h
diff --git a/tests/yacc-dist-nobuild.test b/tests/yacc-dist-nobuild.test
new file mode 100755 (executable)
index 0000000..942bec5
--- /dev/null
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 2011, 2012 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/>.
+
+# Check that distributed Yacc-generated parsers are not uselessly
+# remade from an unpacked distributed tarball.
+# See automake bug#7884.
+
+required='cc yacc'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foobar zardoz
+foobar_SOURCES = parse.y main.c
+zardoz_SOURCES = $(foobar_SOURCES)
+zardoz_YFLAGS = -d
+END
+
+cat > parse.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+cat > main.c << 'END'
+int main () { return 0; }
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+
+$MAKE distdir
+chmod -R a-w $distdir
+
+mkdir bin
+cat > bin/yacc <<'END'
+#!/bin/sh
+echo "$0 invoked, shouldn't happen!" >&2
+exit 1
+END
+cp bin/yacc bin/bison
+chmod a+x bin/yacc bin/bison
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH
+
+YACC=yacc BISON=bison
+export YACC BISON
+
+mkdir build
+cd build
+../$distdir/configure
+$MAKE
+
+# Sanity check.
+chmod u+w ../$distdir
+rm -f ../$distdir/parse.c
+chmod a-w ../$distdir
+$MAKE >out 2>&1 && { cat out; Exit 1; }
+cat out
+$FGREP parse.c out
+
+:
diff --git a/tests/yacc-line.test b/tests/yacc-line.test
new file mode 100755 (executable)
index 0000000..f760b72
--- /dev/null
@@ -0,0 +1,116 @@
+#! /bin/sh
+# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007, 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/>.
+
+# Check that automake yacc support ensures that yacc-generated C
+# files use correct "#line" directives.  Try also with the
+# `subdir-object' option enabled.
+# See also sister test `lex-line.test'.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+mkdir dir sub sub/dir
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub
+bin_PROGRAMS = foo bar
+AM_YFLAGS = -d
+bar_YFLAGS =
+foo_SOURCES = zardoz.y
+bar_SOURCES = dir/quux.y
+## Avoid spurious failures with Solaris make.
+zardoz.@OBJEXT@: zardoz.c
+bar-quux.@OBJEXT@: bar-quux.c
+END
+
+cat > sub/Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+noinst_PROGRAMS = foo bar
+foo_YFLAGS = -d
+foo_SOURCES = zardoz.y
+bar_SOURCES = dir/quux.y
+## Avoid spurious failures with Solaris make.
+foo-zardoz.@OBJEXT@: foo-zardoz.c
+dir/quux.@OBJEXT@: dir/quux.c
+END
+
+cat > zardoz.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+%}
+%%
+x : 'x' {};
+%%
+int main(void)
+{
+  return yyparse ();
+}
+END
+
+cp zardoz.y dir/quux.y
+cp zardoz.y sub/zardoz.y
+cp zardoz.y sub/dir/quux.y
+
+c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=..
+    mkdir build
+    cd build
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE
+
+  # For debugging,
+  ls -l . sub sub/dir
+  $FGREP '.y' $c_outputs
+
+  # Adjusted "#line" should not contain reference to the builddir.
+  $EGREP '#.*line.*(build|\.\.).*\.y' $c_outputs && Exit 1
+  # Adjusted "#line" should not contain reference to the default
+  # output file names, e.g., `y.tab.c' and `y.tab.h'.
+  $EGREP '#.*line.*y\.tab\.' $c_outputs && Exit 1
+  # Don't be excessively strict in grepping, to avoid spurious failures.
+  grep '#.*line.*zardoz\.y' zardoz.c
+  grep '#.*line.*quux\.y' bar-quux.c
+  grep '#.*line.*zardoz\.y' sub/foo-zardoz.c
+  grep '#.*line.*quux\.y' sub/dir/quux.c
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/yacc-mix-c-cxx.test b/tests/yacc-mix-c-cxx.test
new file mode 100755 (executable)
index 0000000..4765b5c
--- /dev/null
@@ -0,0 +1,208 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that many different Yacc parsers (both C and C++) can co-exists
+# in the same directory.
+
+required=yacc
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = c1 c2 cxx1 cxx2 cxx3
+AM_YFLAGS = -d
+
+c1_SOURCES = p.y p.h 1.c
+c2_SOURCES = p.y 2.c
+c2_YFLAGS =
+
+cxx1_SOURCES = parse.yy main1.cc parse.hh
+
+cxx2_SOURCES = parse2.y++ main2.c++
+cxx2_YFLAGS =
+
+cxx3_SOURCES = parse3.yxx main3.cxx
+
+BUILT_SOURCES = p.h parse.hh parse3.hxx
+END
+
+# The content of all the .c and .y files created below is valid C but
+# deliberately invalid C++.
+# Vice versa, the content of all the .c++, .cxx, .cc, .y++, .yxx and
+# .yy files created below is valid C++ but deliberately invalid C.
+
+cat > p.y <<'END'
+%{
+int yylex (void) { int new = 0; return new; }
+void yyerror (char *s) { return; }
+%}
+%token ZARDOZ
+%%
+x : 'x' {};
+%%
+END
+
+cat > 1.c <<'END'
+#include "p.h"
+int main ()
+{
+    int new = ZARDOZ;
+    return yyparse () + new;
+}
+
+END
+
+cat > 2.c <<'END'
+int main ()
+{
+    int yyparse ();
+    int new = 0;
+    return yyparse () + new;
+}
+END
+
+cat > parse.yy <<'END'
+%{
+#include <cstdlib>
+#include "parse.hh"
+int yylex (void) { return 0; }
+void yyerror (const char *s) { return; }
+%}
+%token FOOBAR
+%%
+x : 'x' {};
+%%
+END
+
+cat > parse2.y++ <<'END'
+%{
+#include <cstdlib>
+int yylex (void) { return 0; }
+void yyerror (const char *s) { return; }
+%}
+%%
+x : 'x' {};
+%%
+END
+
+cat > main1.cc <<'END'
+using namespace std;
+#include "parse.hh"
+int main (int argc, char **argv)
+{
+    int yyparse (void);
+    return yyparse () + FOOBAR;
+}
+END
+
+cat > main2.c++ <<'END'
+using namespace std;
+int main (int argc, char **argv)
+{
+    int yyparse (void);
+    return yyparse ();
+}
+END
+
+edit () { sed -e 's/FOOBAR/BAZQUUX/' -e 's/"parse\.hh"/"parse3.hxx"/'; }
+edit <parse.yy >parse3.yxx
+edit <main1.cc >main3.cxx
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+# Try a VPATH and by default serial build first, and then an in-tree
+# and by default parallel build.
+
+for try in 0 1; do
+
+  if test $try -eq 0; then
+    # VPATH serial build.
+    mkdir build
+    cd build
+    srcdir=..
+    debug_info="ls -l . $srcdir"
+    run_make=$MAKE
+  elif test $try -eq 1; then
+    # In-tree parallel build.
+    srcdir=.
+    debug_info="ls -l"
+    case $MAKE in
+      *\ -j*)
+        # Degree of parallelism already specified by the user: do
+        # not override it.
+        run_make=$MAKE;;
+      *)
+        # Some make implementations (e.g., HP-UX) don't grok `-j',
+        # some require no space between `-j' and the number of jobs
+        # (e.g., older GNU make versions), and some *do* require a
+        # space between `-j' and the number of jobs (e.g., Solaris
+        # dmake).  We need a runtime test to see what works.
+        echo 'all:' > Makefile
+        for run_make in "$MAKE -j3" "$MAKE -j 3" "$MAKE"; do
+          $run_make && break
+        done
+        rm -f Makefile
+    esac
+  else
+    echo "$me: invalid value of \$try '$try'" >&2
+    Exit 99
+  fi
+
+  $srcdir/configure
+
+  $run_make
+  $debug_info
+
+  test -f p.c
+  test -f p.h
+  test -f c2-p.c
+  test ! -r c2-p.h
+
+  test -f parse.cc
+  test -f parse.hh
+  test -f parse3.cxx
+  test -f parse3.hxx
+
+  test -f cxx2-parse2.c++
+  test ! -r parse2.h++
+  test ! -r cxx2-parse2.h++
+
+  # Minimal checks about recovering from header removal.
+  rm -f p.h parse.hh parse3.hxx
+  $run_make p.h parse.hh
+  $debug_info
+  test -f p.h
+  test -f parse.hh
+  test ! -r parse3.hxx
+  $run_make
+  $debug_info
+  test -f parse3.hxx
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/yacc-nodist.test b/tests/yacc-nodist.test
new file mode 100755 (executable)
index 0000000..4b92c1e
--- /dev/null
@@ -0,0 +1,104 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Checks for .c and .h files derived from non-distributed yacc sources.
+# The test 'yacc-pr204.test' does similar check with AM_MAINTAINER_MODE
+# enabled.
+# The tests 'lex-nodist.test' and 'lex-pr204.test' does similar checks
+# for lex-generated .c files.
+
+required='cc yacc'
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub1 sub2
+.PHONY: test-build test-dist
+test-build: all
+       ls -l . sub1 sub2
+       test -f sub1/parse.y
+       test -f sub1/parse.c
+       test -f sub2/parse.y
+       test -f sub2/parse.c
+       test -f sub2/parse.h
+test-dist: distdir
+       ls -l $(distdir) $(distdir)/sub1 $(distdir)/sub2
+       test ! -r $(distdir)/sub1/parse.y
+       test ! -r $(distdir)/sub1/parse.c
+       test ! -r $(distdir)/sub1/parse.h
+       test ! -r $(distdir)/sub2/parse.y
+       test ! -r $(distdir)/sub2/parse.c
+       test ! -r $(distdir)/sub2/parse.h
+check-local: test-build test-dist
+END
+
+mkdir sub1 sub2
+
+cat > sub1/Makefile.am << 'END'
+parse.y:
+       rm -f $@ $@-t
+       :; { : \
+         && echo "%{" \
+         && echo "int yylex () { return 0; }" \
+         && echo "void yyerror (char *s) {}" \
+         && echo "%}" \
+         && echo "%%" \
+         && echo "maude : 'm' 'a' 'u' 'd' 'e' {}"; \
+       } > $@-t
+       chmod a-w $@-t && mv -f $@-t $@
+
+bin_PROGRAMS = prog
+prog_SOURCES = main.c
+nodist_prog_SOURCES = parse.y
+CLEANFILES = $(nodist_prog_SOURCES)
+END
+
+cat sub1/Makefile.am - > sub2/Makefile.am << 'END'
+AM_YFLAGS = -d
+BUILT_SOURCES = parse.h
+END
+
+cat > sub1/main.c << 'END'
+int main ()
+{
+  return yyparse ();
+}
+END
+cat - sub1/main.c > sub2/main.c << 'END'
+#include "parse.h"
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE
+$MAKE test-build
+$MAKE test-dist
+
+# But the distribution must work correctly, assuming the user has
+# the proper tools to process yacc files.  Do this check only with
+# GNU make, to avoid tripping on automake bug#7884.
+if using_gmake; then $MAKE distcheck; fi
+
+:
similarity index 76%
rename from tests/pr204.test
rename to tests/yacc-pr204.test
index 22a1e54..bab841a 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2004, 2010 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2010, 2011, 2012 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # For PR 204.
-# Sources derived from nodist_ sources should not be distributed.
+# C sources derived from nodist_ yacc sources should not be distributed.
+# See also related test `yacc-nodist.test'.
+# The tests 'lex-nodist.test' and 'lex-pr204.test' does similar checks
+# for lex-generated C files.
 
-required='bison gcc'
+required='cc yacc'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in <<'EOF'
 AM_MAINTAINER_MODE
 AC_PROG_CC
@@ -73,9 +75,11 @@ test -f parse2.c
 # Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
 # it's a nodist_ parser.
 $sleep
-touch parse.y
+touch parse.y parse2.y
 $sleep
 $MAKE parse.c parse2.c
-test `ls -1t parse.c parse.y | sed 1q` = parse.c
+stat parse.c parse.y parse2.c parse2.y || : # For debugging.
+test `ls -t parse.c parse.y | sed 1q` = parse.c
+test `ls -t parse2.c parse2.y | sed 1q` = parse2.c
 
 :
diff --git a/tests/yacc-weirdnames.test b/tests/yacc-weirdnames.test
new file mode 100755 (executable)
index 0000000..8f0424e
--- /dev/null
@@ -0,0 +1,56 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that yacc sources with many dots in their name are handled
+# correctly.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo bar foo2 bar2
+
+foo_SOURCES = parse.y.y
+bar_SOURCES = parse.s.f..y
+bar_YFLAGS = -d
+
+foo2_SOURCES = parse..5.y++
+bar2_SOURCES = parse.yxx.yy
+bar2_YFLAGS = -d
+END
+
+outputs=' parse.y.c      bar-parse.s.f..c   bar-parse.s.f..h
+          parse..5.c++   bar2-parse.yxx.cc  bar2-parse.yxx.hh '
+
+$ACLOCAL
+$AUTOMAKE -a
+
+$EGREP '(\.[ch]|parse)' Makefile.in # For debugging.
+
+# All expected files should be mentioned in the generated Makefile.in.
+for s in $outputs; do
+  $FGREP $s Makefile.in
+done
+
+:
index bf6782f..9a5db93 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2001, 2002, 2006, 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
@@ -19,8 +20,6 @@
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_YACC
@@ -34,4 +33,6 @@ END
 $ACLOCAL
 $AUTOMAKE -a
 
-grep 'zardoz.c' Makefile.in
+$FGREP 'zardoz.c' Makefile.in
+
+:
index a095edc..0476a90 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002, 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2001, 2002, 2003, 2006, 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
 
 # Test to make sure intermediate .h file is not generated nor removed
 # if (AM_)?YFLAGS do not contain -d.  Requested by Jim Meyering.
+# See also the related semantic test `yacc-d-basic.test'.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_YACC
 END
 
+# Run it here once and for all, since we are not going to modify
+# configure.in anymore.
+$ACLOCAL
+
 cat > Makefile.am <<'END'
 bin_PROGRAMS = zardoz
 zardoz_SOURCES = zardoz.y
@@ -34,53 +38,36 @@ END
 # Don't redefine several times the same variable.
 cp Makefile.am Makefile.src
 
-$ACLOCAL
 $AUTOMAKE -a
-
-# If zardoz.h IS mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null && Exit 1
-
-
+# If zardoz.h IS mentioned, fail.
+$FGREP 'zardoz.h' Makefile.in && Exit 1
 
 cp Makefile.src Makefile.am
 echo 'AM_YFLAGS = -d' >> Makefile.am
-
 $AUTOMAKE
-
-# If zardoz.h is NOT mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null
-
-
+# If zardoz.h is NOT mentioned, fail.
+$FGREP 'zardoz.h' Makefile.in
 
 cp Makefile.src Makefile.am
 echo 'AM_YFLAGS = ' >> Makefile.am
-
 $AUTOMAKE
-
-# If zardoz.h IS mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null && Exit 1
-
-
+# If zardoz.h IS mentioned, fail.
+$FGREP 'zardoz.h' Makefile.in && Exit 1
 
 cp Makefile.src Makefile.am
 echo 'YFLAGS = -d' >> Makefile.am
-
-# YFLAGS is a use variable.
+# YFLAGS is a user variable.
 AUTOMAKE_fails
-grep 'YFLAGS' stderr
+grep 'YFLAGS.* user variable' stderr
+grep 'AM_YFLAGS.* instead' stderr
 $AUTOMAKE -Wno-gnu
-
-# If zardoz.h is NOT mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null
-
-
+# If zardoz.h is NOT mentioned, fail.
+$FGREP 'zardoz.h' Makefile.in
 
 cp Makefile.src Makefile.am
 echo 'YFLAGS = ' >> Makefile.am
-
 $AUTOMAKE -Wno-gnu
-
-# If zardoz.h IS mentioned, fail
-grep 'zardoz.h' Makefile.in > /dev/null && Exit 1
+# If zardoz.h IS mentioned, fail.
+$FGREP 'zardoz.h' Makefile.in && Exit 1
 
 :
index 0435ec0..f50bebd 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2010, 2011, 2012 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
 
 # Some simple tests of ylwrap functionality.
 
-required='bison gcc'
+required='cc yacc'
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE(foo, 0.1)
-PACKAGE=foo
-VERSION=0.1
+cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_YACC
-AC_OUTPUT(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -39,7 +35,7 @@ END
 # First parser.
 cat > parse.y << 'END'
 %{
-int yylex () {return 0;}
+int yylex () { return 0; }
 void yyerror (char *s) {}
 %}
 %%
@@ -49,7 +45,7 @@ END
 # Second parser.
 cat > bar.y << 'END'
 %{
-int yylex () {return 0;}
+int yylex () { return 0; }
 void yyerror (char *s) {}
 %}
 %%
@@ -57,11 +53,12 @@ fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
 END
 
 cat > foo.c << 'END'
-int main () { return 0; }
+int main (void)
+{
+  return 0;
+}
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
@@ -86,6 +83,5 @@ test -f parse.c
 $MAKE maintainer-clean
 test ! -f bar.c
 test ! -f parse.c
-:
 
-Exit 0
+:
index f428396..bac61aa 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 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
 
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_YACC
-AC_OUTPUT(Makefile)
 END
 
 cat > Makefile.am << 'END'
@@ -70,8 +66,8 @@ maude_SOURCES = sub/maude.y
 maude_YFLAGS = -d
 END
 
-$ACLOCAL || Exit 1
-$AUTOMAKE -a || Exit 1
+$ACLOCAL
+$AUTOMAKE -a
 
 # Rule should use maude_YFLAGS.
 grep 'AM_YFLAGS.*maude' Makefile.in && Exit 1
diff --git a/tests/yacc6.test b/tests/yacc6.test
deleted file mode 100755 (executable)
index f10effd..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004, 2006, 2007  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/>.
-
-# Test to make sure ylwrap put in right location.
-# Report from Tim Van Holder.
-# Also make sure depcomp does not needlessly update headers.
-# Report from Paolo Bonzini.
-
-required='gcc bison GNUmake'
-. ./defs || Exit 1
-
-set -e
-
-cat > configure.in << 'END'
-AC_INIT([yacc6], [1.0])
-AC_CONFIG_AUX_DIR([aux1])
-AM_INIT_AUTOMAKE
-AC_CONFIG_FILES([Makefile])
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_PROG_YACC
-AC_CONFIG_FILES([sub/Makefile])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-SUBDIRS = sub
-
-test-time-unchanged:
-       test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = z
-test-time-changed:
-       test `ls -1t sub/main.$(OBJEXT) z | sed 1q` = sub/main.$(OBJEXT)
-END
-
-mkdir aux1 sub
-
-cat > sub/Makefile.am << 'END'
-bin_PROGRAMS = foo bar
-AM_YFLAGS = -d
-foo_SOURCES = foo.y main.c
-foo_CPPFLAGS = -DFOO
-bar_SOURCES = bar.y main.c
-BUILT_SOURCES = foo.h bar.h
-END
-
-cat > sub/foo.y << 'END'
-%{
-int yylex () {return 0;}
-void yyerror (char *s) {}
-%}
-%token TOKEN
-%%
-foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
-
-cp sub/foo.y sub/bar.y
-
-cat >sub/main.c <<'EOF'
-#ifdef FOO
-#  include "foo.h"
-#else
-#  include "bar.h"
-#endif
-
-int
-main()
-{
-  return 0;
-}
-EOF
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-test -f aux1/ylwrap
-test ! -f ylwrap
-test ! -f sub/ylwrap
-$FGREP '(top_srcdir)/aux1/ylwrap' sub/Makefile.in
-./configure
-$MAKE
-grep '#.*line.*foo.y' sub/foo.c
-grep '#.*line.*bar.y' sub/bar.c
-
-$sleep
-: > z
-$sleep
-touch sub/bar.y
-$MAKE
-$MAKE test-time-unchanged
-$sleep
-sed s/TOKEN/TEKON/g sub/bar.y >sub/bar.yt
-mv -f sub/bar.yt sub/bar.y
-$MAKE
-$MAKE test-time-changed
index 2edd15c..64a536b 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2004  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 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
@@ -20,7 +21,7 @@
 # Also check that the sources of the generated parser are distributed.
 # PR/47.
 
-required=bison
+required='cc yacc'
 . ./defs || Exit 1
 
 cat >> configure.in << 'END'
@@ -52,8 +53,6 @@ WORD: "up";
 %%
 END
 
-set -e
-
 $ACLOCAL
 $AUTOMAKE -a
 $AUTOCONF
@@ -83,8 +82,9 @@ $MAKE distclean
 test -f foo.h
 test -f foo.c
 # ... but maintainer-clean should.
-./configure
+./configure # Re-create `Makefile'.
 $MAKE maintainer-clean
 test ! -f foo.h
 test ! -f foo.c
+
 :
index 979415c..b33b6fd 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2006, 2010, 2011, 2012 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
 
 # Test for subdir parsers.
 
-required="gcc bison"
+required='cc yacc'
 
 . ./defs || Exit 1
 
-set -e
-
-cat > configure.in << 'END'
-AC_INIT([yacc8], [1.0])
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE
-AC_CONFIG_FILES([Makefile])
+cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_YACC
@@ -39,22 +34,23 @@ bin_PROGRAMS = foo/foo
 foo_foo_SOURCES = foo/parse.y
 AM_YFLAGS = -d
 
+.PHONY: obj
 obj: foo/parse.$(OBJEXT)
 
-test1: obj
-       test -f foo/parse.c
-       test -f foo/parse.$(OBJEXT)
-
-test2: obj
+.PHONY: test1 test2
+test1: foo/parse.$(OBJEXT)
        test -f foo/parse.c
        test -f foo/parse.$(OBJEXT)
+test2: foo/parse2.$(OBJEXT)
+       test -f foo/parse2.c
+       test -f foo/parse2.$(OBJEXT)
 END
 
 mkdir foo
 
 cat > foo/parse.y << 'END'
 %{
-int yylex () {return 0;}
+int yylex () { return 0; }
 void yyerror (char *s) {}
 %}
 %%
@@ -72,7 +68,7 @@ cd sub
 $MAKE test1
 
 # Aside of the rest of this test, let's see if we can recover from
-# parse.h removal
+# parse.h removal.
 test -f foo/parse.h
 rm -f foo/parse.h
 $MAKE foo/parse.h
@@ -104,9 +100,11 @@ EXTRA_foo_foo_SOURCES = foo/parse2.y
 END
 
 $AUTOMAKE -a
-test -f ./ylwrap || Exit 1
+test -f ./ylwrap
 
 cd sub
-# Regenerate Makefile (automatic in GNU Make, but not in other Makes)
+# Regenerate Makefile (automatic in GNU Make, but not in other Makes).
 ./config.status
 $MAKE test2
+
+:
index d2e7632..9e87f72 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 
 # Removal recovery rules for headers should not remove files with `make -n'.
 
-required=bison
+required='cc yacc'
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_YACC
@@ -39,7 +37,7 @@ END
 
 cat > parse.y << 'END'
 %{
-int yylex () {return 0;}
+int yylex () { return 0; }
 void yyerror (char *s) {}
 %}
 %%
index 9013f40..d9ea112 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1997, 2001, 2002, 2006, 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure yacc + c++ works.
+# Test to make sure Yacc + C++ is not obviously broken.
+# See also related tests `yacc-cxx.test' and `yacc-d-cxx.test',
+# which does much more in-depth checks (but requires an actual
+# Yacc program and a working C++ compiler).
 
 . ./defs || Exit 1
 
-set -e
-
 cat >> configure.in << 'END'
 AC_PROG_CXX
 AC_PROG_YACC
 END
 
 cat > Makefile.am << 'END'
-bin_PROGRAMS = zardoz
-zardoz_SOURCES = zardoz.yy
+bin_PROGRAMS = foo bar baz qux
+foo_SOURCES = foo.y++
+bar_SOURCES = bar.ypp
+baz_SOURCES = baz.yy
+qux_SOURCES = qux.yxx
 END
 
 $ACLOCAL
 $AUTOMAKE -a
 
-grep zardoz.cc Makefile.in
+$EGREP '(\.[ch]|foo|bar|baz|qux)' Makefile.in # For debugging.
+
+$EGREP '(foo|bar|baz|qux)\.h' Makefile.in && Exit 1
+
+sed -e 's/^/ /' -e 's/$/ /' Makefile.in >mk
+
+$FGREP ' foo.c++ ' mk
+$FGREP ' bar.cpp ' mk
+$FGREP ' baz.cc '  mk
+$FGREP ' qux.cxx ' mk
+
+cat >> Makefile.am <<END
+AM_YFLAGS = -d
+qux_YFLAGS = foo
+END
+
+$AUTOMAKE
+
+$EGREP '(\.[ch]|foo|bar|baz|qux)' Makefile.in # For debugging.
+
+sed -e 's/^/ /' -e 's/$/ /' Makefile.in >mk
+
+$FGREP ' foo.c++ ' mk
+$FGREP ' foo.h++ ' mk
+$FGREP ' bar.cpp ' mk
+$FGREP ' bar.hpp ' mk
+$FGREP ' baz.cc '  mk
+$FGREP ' baz.hh '  mk
+
+$EGREP '(^| )foo\.h\+\+(:| .*:)' Makefile.in
+$EGREP '(^| )bar\.hpp(:| .*:)'   Makefile.in
+$EGREP '(^| )baz\.hh(:| .*:)'    Makefile.in
+
+grep ' foo\.h[ :]' mk && Exit 1
+grep ' bar\.h[ :]' mk && Exit 1
+grep ' baz\.h[ :]' mk && Exit 1
+
+$FGREP ' qux-qux.cxx ' mk
+$EGREP '(^| )qux-qux\.cxx(:| .*:)' Makefile.in
+grep 'qux\.h.*:' Makefile.in && Exit 1
+
+:
index 6db5fd7..922c53e 100755 (executable)
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2010, 2011, 2012 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
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # This test checks that dependent files are updated before including
-# in the distribution. `parse.c' depends on `parce.y'. The later is
+# in the distribution. `parse.c' depends on `parse.y'. The later is
 # updated so that `parse.c' should be rebuild. Then we are running
 # `make' and `make distdir' and check whether the version of `parse.c'
 # to be distributed is up to date.
 
-required='gcc bison'
+# Please keep this in sync with sister test `yacc-d-vpath.test'.
+
+required='cc yacc'
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AC_CONFIG_AUX_DIR([.])
-AM_INIT_AUTOMAKE(foo, 0.1)
-PACKAGE=foo
-VERSION=0.1
+cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_YACC
-AC_OUTPUT(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -39,10 +37,10 @@ bin_PROGRAMS = foo
 foo_SOURCES = parse.y foo.c
 END
 
-# Original parser, with `foobar'
+# Original parser, with `foobar'.
 cat > parse.y << 'END'
 %{
-int yylex () {return 0;}
+int yylex () { return 0; }
 void yyerror (char *s) {}
 %}
 %%
@@ -53,8 +51,6 @@ cat > foo.c << 'END'
 int main () { return 0; }
 END
 
-set -e
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
@@ -66,14 +62,12 @@ mkdir sub
 cd sub
 ../configure
 
-# A delay is needed to make sure that the new parse.y is indeed newer
-# than parse.c, i.e. the they don't have the same timestamp.
 $sleep
 
-# New parser, with `fubar'
+# New parser, with `fubar'.
 cat > ../parse.y << 'END'
 %{
-int yylex () {return 0;}
+int yylex () { return 0; }
 void yyerror (char *s) {}
 %}
 %%
@@ -82,20 +76,16 @@ END
 
 $MAKE
 $MAKE distdir
-grep fubar foo-0.1/parse.c
+$FGREP fubar $distdir/parse.c
 
-#
 # Now check to make sure that `make dist' will rebuild the parser.
-#
 
-# A delay is needed to make sure that the new parse.y is indeed newer
-# than parse.c, i.e. the they don't have the same timestamp.
 $sleep
 
-# New parser, with `maude'
+# New parser, with `maude'.
 cat > ../parse.y << 'END'
 %{
-int yylex () {return 0;}
+int yylex () { return 0; }
 void yyerror (char *s) {}
 %}
 %%
@@ -103,4 +93,6 @@ maude : 'm' 'a' 'u' 'd' 'e' {};
 END
 
 $MAKE distdir
-grep maude foo-0.1/parse.c
+$FGREP maude $distdir/parse.c
+
+:
diff --git a/tests/yflags-cmdline-override.test b/tests/yflags-cmdline-override.test
new file mode 100755 (executable)
index 0000000..accebe3
--- /dev/null
@@ -0,0 +1,88 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that automake can cope with user-redefinition of $(YFLAGS)
+# at configure time and/or at make time.
+
+required='cc yacc'
+. ./defs || Exit 1
+
+unset YFLAGS || :
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+# A minor automake wart: automake doesn't generate code to clean
+# `*.output' files generated by yacc (it's not even clear if that
+# would be useful in general, so it's probably better to be
+# conservative).
+CLEANFILES = foo.output
+# Another automake wart: `-d' flag won't be given at automake time,
+# so automake won't be able to generate code to clean `foo.h' :-(
+MAINTAINERCLEANFILES = foo.h
+END
+
+cat > foo.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+int main () { return 0; }
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+./configure YFLAGS='-d -v'
+$MAKE
+ls -l
+test -f foo.c
+test -f foo.h
+test -f foo.output
+
+$MAKE maintainer-clean
+ls -l
+
+./configure YFLAGS='-v'
+$MAKE
+ls -l
+test -f foo.c
+test ! -r foo.h
+test -f foo.output
+
+$MAKE maintainer-clean
+ls -l
+
+./configure YFLAGS='-v'
+YFLAGS=-d $MAKE -e
+ls -l
+test -f foo.c
+test -f foo.h
+test ! -r foo.output
+
+$MAKE maintainer-clean
+ls -l
+
+:
diff --git a/tests/yflags-conditional.test b/tests/yflags-conditional.test
new file mode 100755 (executable)
index 0000000..8849af4
--- /dev/null
@@ -0,0 +1,143 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that automake complains about *_YFLAGS variables which have
+# conditional content.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+
+# `YFLAGS' is AC_SUBST'd by AC_PROG_YACC by default, but we
+# don't want this, since it might confuse our error messages.
+# Also, AM_SUBST_NOTMAKE seems not to help about this.
+# So we simply define $(YACC) by hand.
+AC_SUBST([YACC], [yacc])
+
+AM_CONDITIONAL([COND], [:])
+END
+
+$ACLOCAL
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo zardoz
+foo_SOURCES = foo.y
+zardoz_SOURCES = zardoz.y
+if COND
+AM_YFLAGS = -v
+zardoz_YFLAGS = -v
+endif COND
+END
+
+cat > Makefile1.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+## This is a dummy comment to keep line count right.
+if COND
+YFLAGS = foo
+endif COND
+END
+
+cat > Makefile2.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+AM_YFLAGS = am_yflags
+if COND
+YFLAGS = yflags
+endif COND
+END
+
+cat > Makefile3.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+foo_YFLAGS = foo_yflags
+if COND
+YFLAGS = yflags
+endif COND
+END
+
+cat > Makefile4.am <<'END'
+bin_PROGRAMS = foo zardoz
+
+foo_SOURCES = foo.y
+zardoz_SOURCES = $(foo_SOURCES)
+
+YFLAGS =
+AM_YFLAGS = $(COND_VAR1)
+zardoz_YFLAGS = $(COND_VAR2:z=r)
+
+COND_VAR2 = foo
+if COND
+YFLAGS += -v
+COND_VAR2 += bar
+else !COND
+COND_VAR1 = -d
+endif !COND
+END
+
+cat > Makefile5.am <<'END'
+bin_PROGRAMS = foo zardoz
+foo_SOURCES = foo.y
+zardoz_SOURCES = zardoz.y
+YFLAGS = -v
+AM_YFLAGS = -v
+if COND
+zardoz_YFLAGS = -v
+endif
+END
+
+cat > Makefile6.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+foo_YFLAGS = -v
+if COND
+quux_YFLAGS = -v
+AM_YFLAGS = -v
+endif
+END
+
+: > ylwrap
+
+LC_ALL=C; export LC_ALL; # For grep regexes below.
+
+AUTOMAKE_fails -Wnone -Wunsupported Makefile
+grep '^Makefile\.am:5:.*AM_YFLAGS.* conditional contents' stderr
+grep '^Makefile\.am:6:.*zardoz_YFLAGS.* conditional contents' stderr
+
+for i in 1 2 3; do
+  AUTOMAKE_fails -Wnone -Wunsupported Makefile$i
+  grep "^Makefile$i\\.am:5:.*[^a-zA-Z0-9_]YFLAGS.* conditional contents" \
+       stderr
+done
+
+AUTOMAKE_fails -Wnone -Wunsupported Makefile4
+grep '^Makefile4\.am:6:.*[^a-zA-Z0-9_]YFLAGS.* conditional contents' stderr
+grep '^Makefile4\.am:7:.*AM_YFLAGS.* conditional contents' stderr
+grep '^Makefile4\.am:8:.*zardoz_YFLAGS.* conditional contents' stderr
+
+# Now let's check we avoid false positives.
+
+# Disable `gnu' warnings because we override the user variable `YFLAGS'.
+AUTOMAKE_fails -Wno-gnu Makefile5
+grep -v '^Makefile5\.am:.*zardoz_YFLAGS' stderr \
+ | grep -v ': warnings are treated as errors' \
+ | grep . && Exit 1
+
+# Disable `gnu' warnings because we override the user variable `YFLAGS'.
+$AUTOMAKE -Wno-gnu Makefile6
+
+:
similarity index 56%
rename from tests/suffix10.test
rename to tests/yflags-d-false-positives.test
index 131359c..6decf9d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
+# Copyright (C) 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
 # 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 that derivations work with .lo too.
-# (related to PR/37)
+# Check for false positives in automake recognition of `-d' in YFLAGS.
 
-required='libtoolize bison'
 . ./defs || Exit 1
 
-set -e
-
-cat >>configure.in <<EOF
+cat >> configure.in <<'END'
 AC_PROG_CC
 AC_PROG_YACC
-AC_PROG_LIBTOOL
-AC_OUTPUT
-EOF
-
-
-cat >Makefile.am << 'END'
-lib_LTLIBRARIES = libfoo.la
-libfoo_la_SOURCES = foo.x_
-
-.x_.y:
-       cp $< $@
-
-print:
-       echo BEGIN: $(libfoo_la_OBJECTS) :END
 END
 
-libtoolize --force
 $ACLOCAL
-$AUTOCONF
-$AUTOMAKE --add-missing
 
-./configure
+cat > Makefile.am <<'END'
+bin_PROGRAMS = zardoz foobar
+zardoz_SOURCES = zardoz.y
+foobar_SOURCES = foobar.y
+# All the "almost -d" substrings ("- d", "-dd", etc.) are meant.
+AM_YFLAGS = -xd --d - d --output=d
+foobar_YFLAGS = - d $(foovar)-d -dd
+END
 
-$MAKE print >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep 'BEGIN: foo.lo :END' stdout
+$AUTOMAKE -a
+$EGREP '(foobar|zardoz)\.h.*:' Makefile.in && Exit 1
+$EGREP '(foobar|zardoz)\.h' Makefile.in | $FGREP -v '$(YLWRAP) ' && Exit 1
 
 :
diff --git a/tests/yflags-force-conditional.test b/tests/yflags-force-conditional.test
new file mode 100755 (executable)
index 0000000..a5b3599
--- /dev/null
@@ -0,0 +1,85 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that the user can force automake to use *_YFLAGS variables
+# which have conditional content.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_SUBST([CC], [false])
+AC_PROG_YACC
+AM_CONDITIONAL([COND], [test x"$cond" = x"yes"])
+AC_OUTPUT
+END
+
+mkdir bin
+cat > bin/fake-yacc <<'END'
+#!/bin/sh
+echo "/* $* */" > y.tab.c
+echo 'extern int dummy;' >> y.tab.c
+END
+chmod a+x bin/fake-yacc
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH
+YACC=fake-yacc; export YACC
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = no-dependencies
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.y main.c
+bar_SOURCES = $(foo_SOURCES)
+bar_YFLAGS = $(bar_yflags2)
+if COND
+AM_YFLAGS = __am_cond_yes__
+bar_YFLAGS += __bar_cond_yes__
+else !COND
+AM_YFLAGS = __am_cond_no__
+bar_yflags2 = __bar_cond_no__
+endif !COND
+END
+
+: > foo.y
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a -Wno-unsupported
+
+$EGREP '(YFLAGS|yflags|am__append)' Makefile.in # For debugging.
+
+./configure cond=yes
+$MAKE foo.c bar-foo.c
+
+cat foo.c
+cat bar-foo.c
+
+$FGREP ' __am_cond_yes__ ' foo.c
+$FGREP ' __bar_cond_yes__ ' bar-foo.c
+$FGREP 'cond_no' foo.c bar-foo.c && Exit 1
+
+$MAKE maintainer-clean
+ls -l
+
+./configure cond=no
+$MAKE foo.c bar-foo.c
+
+cat foo.c
+cat bar-foo.c
+
+$FGREP ' __am_cond_no__ ' foo.c
+$FGREP ' __bar_cond_no__ ' bar-foo.c
+$FGREP 'cond_yes' foo.c bar-foo.c && Exit 1
+
+:
diff --git a/tests/yflags-force-override.test b/tests/yflags-force-override.test
new file mode 100755 (executable)
index 0000000..de2a363
--- /dev/null
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that automake can cope with a definition of the $(YFLAGS) variable
+# in Makefile.am (even if that is extremely bad practice, because that
+# variable is user-reserved).
+
+required='cc yacc'
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+AC_PROG_YACC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.y
+# Don't do this in a real-life Makefile.am!
+YFLAGS = -d -v
+END
+
+cat > foo.y << 'END'
+%{
+int yylex () { return 0; }
+void yyerror (char *s) { return; }
+int main () { return 0; }
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+$ACLOCAL
+$AUTOMAKE -a -Wno-gnu
+
+$EGREP '(foo|YFLAGS)' Makefile.in # For debugging.
+grep '^foo.h *:' Makefile.in
+
+$AUTOCONF
+./configure
+
+$MAKE
+
+test -f foo.c
+test -f foo.h
+test -f foo.output
+
+:
diff --git a/tests/yflags-var-expand.test b/tests/yflags-var-expand.test
new file mode 100755 (executable)
index 0000000..5117b6b
--- /dev/null
@@ -0,0 +1,61 @@
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Check that automake expand variables when looking for `-d' in YFLAGS;
+# for example, the following is supposed to work:
+#  foo_flags = -d
+#  AM_YFLAGS = $(foo_flags)
+
+. ./defs || Exit 1
+
+cat >> configure.in <<'END'
+AC_PROG_CC
+AC_PROG_YACC
+END
+
+$ACLOCAL
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.y
+bar_SOURCES = bar.y
+my_YFLAGS = -x
+AM_YFLAGS = $(my_YFLAGS:x=d)
+bar_YFLAGS = $(AM_YFLAGS)
+END
+
+$AUTOMAKE -a
+
+$EGREP '(foo|bar|YFLAGS)' Makefile.in # For debugging.
+grep '^foo.h *:' Makefile.in
+grep '^bar-bar.h *:' Makefile.in
+
+cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = -Wno-gnu
+bin_PROGRAMS = zardoz
+zardoz_SOURCES = parser.y
+my_YFLAGS = $(my_YFLAGS_1)
+my_YFLAGS += $(my_YFLAGS_2)
+my_YFLAGS_2 = -d
+YFLAGS = $(my_YFLAGS)
+END
+
+$AUTOMAKE
+
+$EGREP 'parser|YFLAGS' Makefile.in # For debugging.
+grep '^parser.h *:' Makefile.in
+
+:
index dbc3a73..7eb3040 100755 (executable)
 # Check that $(YFLAGS) takes precedence over both $(AM_YFLAGS) and
 # $(foo_YFLAGS).
 # Please keep this in sync with the sister tests yflags2.test, lflags.test
-# and lflags2.test
+# and lflags2.test.
 
 . ./defs || Exit 1
 
-set -e
-
 cat >fake-yacc <<'END'
 #!/bin/sh
 echo '/*' "$*" '*/' >y.tab.c
@@ -35,13 +33,14 @@ chmod a+x fake-yacc
 unset YACC || :
 
 cat >> configure.in <<'END'
-AC_PROG_CC
+AC_SUBST([CC], [false])
 # Simulate presence of Yacc using our fake-yacc script.
 AC_SUBST([YACC], ['$(abs_top_srcdir)'/fake-yacc])
 AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = foo bar
 foo_SOURCES = main.c foo.y
 bar_SOURCES = main.c bar.y
@@ -55,19 +54,17 @@ $AUTOMAKE -a
 grep '\$(YFLAGS).*\$(bar_YFLAGS)' Makefile.in && Exit 1
 grep '\$(YFLAGS).*\$(AM_YFLAGS)' Makefile.in && Exit 1
 
-echo 'int main(void){ return 0; }' > main.c
 : > foo.y
 : > bar.y
 
 $AUTOCONF
 ./configure
-env YFLAGS=__user_flags__ $MAKE -e
-
-ls -l
+env YFLAGS=__user_flags__ $MAKE -e foo.c bar-bar.c
 
 cat foo.c
-grep '__am_flags__.*__user_flags__' foo.c
 cat bar-bar.c
+
+grep '__am_flags__.*__user_flags__' foo.c
 grep '__bar_flags__.*__user_flags__' bar-bar.c
 
 :
index 02aed8d..b4678af 100755 (executable)
 # Check that $(YFLAGS) takes precedence over both $(AM_YFLAGS) and
 # $(foo_YFLAGS).
 # Please keep this in sync with the sister tests yflags.test, lflags.test
-# and lflags2.test
+# and lflags2.test.
 
-required=g++ # FIXME: any working C++ compiler should be OK
 . ./defs || Exit 1
 
-set -e
-
 cat >fake-yacc <<'END'
 #!/bin/sh
 echo '/*' "$*" '*/' >y.tab.c
@@ -36,13 +33,14 @@ chmod a+x fake-yacc
 unset YACC || :
 
 cat >> configure.in <<'END'
-AC_PROG_CXX
+AC_SUBST([CXX], [false])
 # Simulate presence of Yacc using our fake-yacc script.
 AC_SUBST([YACC], ['$(abs_top_srcdir)'/fake-yacc])
 AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = foo bar
 foo_SOURCES = main.cc foo.yy
 bar_SOURCES = main.cc bar.y++
@@ -56,19 +54,17 @@ $AUTOMAKE -a
 grep '\$(YFLAGS).*\$(bar_YFLAGS)' Makefile.in && Exit 1
 grep '\$(YFLAGS).*\$(AM_YFLAGS)' Makefile.in && Exit 1
 
-echo 'int main(void) { return 0; }' > main.cc
 : > foo.yy
 : > bar.y++
 
 $AUTOCONF
 ./configure
-env YFLAGS=__user_flags__ $MAKE -e
-
-ls -l
+env YFLAGS=__user_flags__ $MAKE -e foo.cc bar-bar.c++
 
 cat foo.cc
-grep '__am_flags__.*__user_flags__' foo.cc
 cat bar-bar.c++
+
+grep '__am_flags__.*__user_flags__' foo.cc
 grep '__bar_flags__.*__user_flags__' bar-bar.c++
 
 :