diff options
-rw-r--r-- | NEWS | 15 | ||||
-rw-r--r-- | doc/automake.texi | 69 | ||||
-rw-r--r-- | lib/am/distdir.am | 26 | ||||
-rwxr-xr-x | lib/missing | 208 | ||||
-rw-r--r-- | m4/missing.m4 | 10 | ||||
-rwxr-xr-x | t/aclocal-autoconf-version-check.sh (renamed from t/missing6.sh) | 0 | ||||
-rw-r--r-- | t/list-of-tests.mk | 10 | ||||
-rwxr-xr-x | t/man4.sh | 105 | ||||
-rwxr-xr-x | t/man6.sh | 4 | ||||
-rwxr-xr-x | t/missing-version-mismatch.sh (renamed from t/missing2.sh) | 54 | ||||
-rwxr-xr-x | t/missing.sh | 66 | ||||
-rwxr-xr-x | t/missing3.sh | 43 | ||||
-rwxr-xr-x | t/missing5.sh | 64 | ||||
-rwxr-xr-x | t/remake-aclocal-version-mismatch.sh (renamed from t/missing4.sh) | 0 | ||||
-rwxr-xr-x | t/remake6.sh | 8 | ||||
-rwxr-xr-x | t/txinfo30.sh | 63 |
16 files changed, 166 insertions, 579 deletions
@@ -56,6 +56,21 @@ New in 1.13: backward-compatibility only. In particular, its use does not disable the warnings in the 'portability-recursive' category anymore. +* Automatic remake rules and 'missing' script: + + - The 'missing' script does not try anymore to update the timestamp + of out-of-date files that require a maintainer-specific tool to be + remade, in case the user lacks such a tool (or has a too-old version + of it). It just give a useful warning, and in some cases also a tip + about how to obtain such a tool. + + - The missing script has thus become useless as a (poor) way to work + around the sketched-timestamps issues that can happen for projects + that keep generated files committed in their VCS repository. Such + projects are now encouraged to write a custom "fix-timestamps.sh" + script to avoid such issues; a simple example is provided in the + "CVS and generated files" chapter of the automake manual. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ New in 1.12.2: diff --git a/doc/automake.texi b/doc/automake.texi index 0ed2bfec0..475bd7dcc 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -2294,9 +2294,9 @@ a file and prints some date information about it. @item missing This wraps a number of programs that are typically only required by -maintainers. If the program in question doesn't exist, -@command{missing} prints an informative warning and attempts to fix -things so that the build can continue. +maintainers. If the program in question doesn't exist, or seems to old, +@command{missing} will print an informative warning before failing out, +to provide the user with more context and information. @item mkinstalldirs This script used to be a wrapper around @samp{mkdir -p}, which is not @@ -11498,12 +11498,12 @@ lists. Packages made with Autoconf and Automake ship with some generated files like @file{configure} or @file{Makefile.in}. These files were -generated on the developer's host and are distributed so that +generated on the developer's machine and are distributed so that end-users do not have to install the maintainer tools required to rebuild them. Other generated files like Lex scanners, Yacc parsers, or Info documentation, are usually distributed on similar grounds. -Automake outputs rules in @file{Makefile}s to rebuild these files. For +Automake output rules in @file{Makefile}s to rebuild these files. For instance, @command{make} will run @command{autoconf} to rebuild @file{configure} whenever @file{configure.ac} is changed. This makes development safer by ensuring a @file{configure} is never out-of-date @@ -11566,10 +11566,41 @@ If users use @command{cvs update} to update their copy, instead of inaccurate. Some rebuild rules will be triggered and attempt to run developer tools such as @command{autoconf} or @command{automake}. -Actually, calls to such tools are all wrapped into a call to the -@command{missing} script discussed later (@pxref{maintainer-mode}). -@command{missing} will take care of fixing the timestamps when these -tools are not installed, so that the build can continue. +Calls to such tools are all wrapped into a call to the @command{missing} +script discussed later (@pxref{maintainer-mode}), so that the user will +see more descriptive warnings about missing or out-of-date tools, and +possible suggestions about how to obtain them, rather than just some +``command not found'' error, or (worse) some obscure message from some +older version of the required tool they happen to have installed. + +Maintainers interested in keeping their package buildable from a CVS +checkout even for those users that lack maintainer-specific tools might +want to provide an helper script (or to enhance their existing bootstrap +script) to fix the timestamps after a +@command{cvs update} or a @command{git checkout}, to prevent spurious +rebuilds. In case of a project committing the Autotools-generated +files, as well as the generated @file{.info} files, such script might +look something like this: + +@smallexample +#!/bin/sh +# fix-timestamp.sh: prevents useless rebuilds after "cvs update" +sleep 1 +# aclocal-generated aclocal.m4 depends on locally-installed +# '.m4' macro files, as well as on 'configure.ac' +touch aclocal.m4 +sleep 1 +# autoconf-generated configure depends on aclocal.m4 and on +# configure.ac +configure config.h.in +# so does autoheader-generated config.h.in +configure config.h.in +# and all the automake-generated Makefile.in files +touch `find . -name Makefile.in -print` +# finally, the makeinfo-generated '.info' files depend on the +# corresponding '.texi' files +touch doc/*.info +@end smallexample @item In distributed development, developers are likely to have different @@ -11666,20 +11697,20 @@ tools shouldn't be required during a user build and they are not checked for in @file{configure}. However, if for some reason a rebuild rule is triggered and involves a -missing tool, @command{missing} will notice it and warn the user. -Besides the warning, when a tool is missing, @command{missing} will -attempt to fix timestamps in a way that allows the build to continue. -For instance, @command{missing} will touch @file{configure} if -@command{autoconf} is not installed. When all distributed files are -kept under version control, this feature of @command{missing} allows a -user @emph{with no maintainer tools} to build a package off its version -control repository, bypassing any timestamp inconsistency (implied by -e.g.@: @samp{cvs update} or @samp{git clone}). +missing tool, @command{missing} will notice it and warn the user, even +suggesting how to obtain such a tool (at least in case it is a well-known +one, like @command{makeinfo} or @command{bison}). This is more helpful +and user-friendly than just having the rebuild rules spewing out a terse +error message like @samp{sh: @var{tool}: command not found}. Similarly, +@command{missing} will warn the user if it detects that a maintainer +tool it attempted to use seems too old (be warned that diagnosing this +correctly is typically more difficult that detecting missing tools, and +requires cooperation from the tool itself, so it won't always work). If the required tool is installed, @command{missing} will run it and won't attempt to continue after failures. This is correct during development: developers love fixing failures. However, users with -wrong versions of maintainer tools may get an error when the rebuild +missing or too old maintainer tools may get an error when the rebuild rule is spuriously triggered, halting the build. This failure to let the build continue is one of the arguments of the @code{AM_MAINTAINER_MODE} advocates. diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 3a5e1a531..bfe0f3145 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -90,32 +90,6 @@ if %?CK-NEWS% endif %?CK-NEWS% endif %?TOPDIR_P% ## -## 'missing help2man' may have created some bogus man pages. Ensure they -## are not distributed. -## -if %?INSTALL-MAN% -if %?HAVE-MANS% - @list='$(MANS)'; if test -n "$$list"; then \ - list=`for p in $$list; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ -## Note that we check existing man pages here only. If there are man pages -## which are not distributed, and may be generated only conditionally, then -## we should not error out because of them. This could be refined to take -## into account only dist_*_MANS, but then we'd be missing out on those -## the user distributes with EXTRA_DIST. - if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ - if test -n "$$list" && \ - grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ - echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \ - grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ - echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ - echo " typically 'make maintainer-clean' will remove them" >&2; \ - exit 1; \ - else :; fi; \ - else :; fi -endif %?HAVE-MANS% -endif %?INSTALL-MAN% -## ## Only for the top dir. ## if %?TOPDIR_P% diff --git a/lib/missing b/lib/missing index 074c62c44..06e0af1d7 100755 --- a/lib/missing +++ b/lib/missing @@ -1,10 +1,10 @@ #! /bin/sh -# Common stub for a few missing GNU programs while installing. +# Common wrapper for a few potentially missing GNU programs. -scriptversion=2012-05-23.18; # UTC +scriptversion=2012-06-14.10; # UTC # Copyright (C) 1996-2012 Free Software Foundation, Inc. -# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. +# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. # This 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,6 @@ if test $# -eq 0; then exit 1 fi -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 # srcdir already. if test -f configure.ac; then @@ -41,49 +37,28 @@ else configure_ac=configure.in fi -msg="missing on your system" - case $1 in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... -Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit - --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' - 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 - help2man touch the output file - 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] + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. @@ -98,51 +73,53 @@ Send bug reports to <bug-automake@gnu.org>." ;; -*) - echo 1>&2 "$0: Unknown '$1' option" + echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac -# normalize program name to check for. +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +# Normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). This is about non-GNU programs, so use $1 not -# $program. -case $1 in - lex*|yacc*) - # Not GNU programs, they don't have --version. - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - 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 - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - # If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. +# advise the user how to get it. 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 any GNU archive site." - touch aclocal.m4 ;; autoconf*) @@ -151,7 +128,6 @@ 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*) @@ -160,19 +136,6 @@ 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 -e 's/^[ ]*AC_CONFIG_HEADER(\([^)]*\)).*/\1/p' \ - -e 's/^[ ]*AC_CONFIG_HEADERS(\([^)]*\)).*/\1/p' \ - ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case $f in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files ;; automake*) @@ -181,9 +144,6 @@ 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/' | - while read f; do touch "$f"; done ;; autom4te*) @@ -193,20 +153,6 @@ WARNING: '$1' is needed, but is $msg. proper tools for further handling them. You can get '$1' as part of Autoconf from any GNU archive site." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi ;; bison*|yacc*) @@ -215,28 +161,6 @@ 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." - rm -f y.tab.c y.tab.h - if test $# -ne 1; then - eval LASTARG=\${$#} - case $LASTARG in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if test ! -f y.tab.h; then - echo >y.tab.h - fi - if test ! -f y.tab.c; then - echo 'main() { return 0; }' >y.tab.c - fi ;; lex*|flex*) @@ -245,21 +169,6 @@ 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." - rm -f lex.yy.c - if test $# -ne 1; then - eval LASTARG=\${$#} - case $LASTARG in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if test -f "$SRCFILE"; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if test ! -f lex.yy.c; then - echo 'main() { return 0; }' >lex.yy.c - fi ;; help2man*) @@ -268,16 +177,6 @@ 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." - - file=`echo "$*" | sed -n "$sed_output"` - test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit $? - fi ;; makeinfo*) @@ -288,25 +187,6 @@ WARNING: '$1' is $msg. You should only need it if 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"` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n ' - /^@setfilename/{ - s/.* \([^ ]*\) *$/\1/ - p - q - }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file ;; *) @@ -317,11 +197,13 @@ WARNING: '$1' is needed, and is $msg. 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." - exit 1 ;; + esac -exit 0 +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/m4/missing.m4 b/m4/missing.m4 index e12480334..2de7fe455 100644 --- a/m4/missing.m4 +++ b/m4/missing.m4 @@ -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 7 +# serial 8 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ @@ -18,8 +18,8 @@ AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ -# Define MISSING if not defined so far and test if it supports --run. -# If it does, set am_missing_run to use it, otherwise, to nothing. +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl @@ -32,8 +32,8 @@ if test x"${MISSING+set}" != xset; then esac fi # Use eval to expand $SHELL -if eval "$MISSING --run true"; then - am_missing_run="$MISSING --run " +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) diff --git a/t/missing6.sh b/t/aclocal-autoconf-version-check.sh index 8173f818a..8173f818a 100755 --- a/t/missing6.sh +++ b/t/aclocal-autoconf-version-check.sh diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk index b80c07155..4eecb3e3c 100644 --- a/t/list-of-tests.mk +++ b/t/list-of-tests.mk @@ -109,6 +109,7 @@ t/aclocal-install-fail.sh \ t/aclocal-install-mkdir.sh \ t/aclocal-no-install-no-mkdir.sh \ t/aclocal-verbose-install.sh \ +t/aclocal-autoconf-version-check.sh \ t/ac-output-old.tap \ t/acsilent.sh \ t/acsubst.sh \ @@ -656,7 +657,6 @@ t/makevars.sh \ t/man.sh \ t/man2.sh \ t/man3.sh \ -t/man4.sh \ t/man5.sh \ t/man6.sh \ t/man7.sh \ @@ -667,12 +667,8 @@ t/mdate3.sh \ t/mdate4.sh \ t/mdate5.sh \ t/mdate6.sh \ -t/missing.sh \ -t/missing2.sh \ +t/missing-version-mismatch.sh \ t/missing3.sh \ -t/missing4.sh \ -t/missing5.sh \ -t/missing6.sh \ t/missing-auxfile-stops-makefiles-creation.sh \ t/mkinstall.sh \ t/mkinst2.sh \ @@ -931,6 +927,7 @@ t/remake-deleted-am-2.sh \ t/remake-deleted-am-subdir.sh \ t/remake-deleted-am.sh \ t/remake-renamed-am.sh \ +t/remake-aclocal-version-mismatch.sh \ t/pr8365-remake-timing.sh \ t/req.sh \ t/reqd.sh \ @@ -1177,7 +1174,6 @@ t/txinfo26.sh \ t/txinfo27.sh \ t/txinfo28.sh \ t/txinfo29.sh \ -t/txinfo30.sh \ t/txinfo31.sh \ t/txinfo32.sh \ t/txinfo33.sh \ diff --git a/t/man4.sh b/t/man4.sh deleted file mode 100755 index c7333b9c2..000000000 --- a/t/man4.sh +++ /dev/null @@ -1,105 +0,0 @@ -#! /bin/sh -# Copyright (C) 2008-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/>. - -# Ensure 'make dist' fails when help2man replacement man pages are created. -# -# The assumption here is the following: if the developer uses help2man to -# generate man pages from --help output, then these man pages may not be -# stored in VCS. However, they should be distributed, so that the end user -# that receives the tarball doesn't have to install help2man. If they are -# not distributed, then the developer should make help2man a prerequisite -# to building the package from a tarball, e.g., with a configure check for -# help2man that errors out if it is unavailable. In both cases it is -# sufficient to check only distributed man pages. -# -# Idea of this whole shenanigan is to allow somebody to check out sources from -# a VCS and build and install them without needing help2man installed. The -# installed man pages will be bogus in this case. Typically, this happens -# when developers ask users to try out a fix from VCS; the developers themselves -# will usually have help2man installed (or should install it). - -. ./defs || Exit 1 - -cat > Makefile.am << 'END' -dist_man_MANS = $(srcdir)/foo.1 bar.1 -dist_bin_SCRIPTS = foo bar -$(srcdir)/foo.1: - $(HELP2MAN) --output=$@ $(srcdir)/foo -bar.1: - $(HELP2MAN) --output=$(srcdir)/bar.1 $(srcdir)/bar -END - -cat >>configure.ac <<'END' -AM_MISSING_PROG([HELP2MAN], [help2man]) -AC_OUTPUT -END - -cat > foo <<'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 foo bar -chmod +x foo bar - -mkdir bin -cat > bin/help2man <<'END' -#! /bin/sh -# Fake help2man script that lets 'missing' think it is not installed. -exit 127 -END -chmod +x bin/help2man -PATH=`pwd`/bin$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 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 -cd build -../configure -$MAKE -$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 - -: @@ -65,7 +65,7 @@ cd build ../configure # Sanity check. -grep '^HELP2MAN *=.*/missing --run help2man' Makefile +grep '^HELP2MAN *=.*/missing help2man' Makefile $MAKE $FGREP foobar ../foobar.1 @@ -84,7 +84,7 @@ rm -f *.1 # Remove leftover generated manpages. ./configure # Sanity check. -grep '^HELP2MAN *=.*/missing --run help2man' Makefile +grep '^HELP2MAN *=.*/missing help2man' Makefile $MAKE $FGREP foobar foobar.1 diff --git a/t/missing2.sh b/t/missing-version-mismatch.sh index 89e9a5daf..4a2910a04 100755 --- a/t/missing2.sh +++ b/t/missing-version-mismatch.sh @@ -16,43 +16,35 @@ # Test missing with version mismatches. +am_create_testdir=empty . ./defs || Exit 1 -cat >>configure.ac <<'EOF' -m4_include([v.m4]) -AC_OUTPUT -EOF +get_shell_script missing -: > v.m4 +do_check () +{ + progname=$1; shift; + ./missing "$@" 2>stderr && { cat stderr >&2; Exit 1; } + cat stderr >&2 + $FGREP "WARNING: '$progname' is probably too old." stderr +} -: > Makefile.am +echo 'AC_INIT([x], [1.0]) AC_PREREQ([9999])' >> configure.ac -get_shell_script missing +do_check autoconf $AUTOCONF +do_check autoheader $AUTOHEADER +do_check aclocal-$APIVERSION $am_original_ACLOCAL + +cat > configure.ac << 'END' +AC_INIT([x], [0]) +AM_INIT_AUTOMAKE +AC_CONFIG_FILES([Makefile]) +END +echo AUTOMAKE_OPTIONS = 9999.9999 > Makefile.am $ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -# See missing.test for explanations about this. -MYAUTOCONF="./missing --run $AUTOCONF" -unset AUTOCONF - -./configure AUTOCONF="$MYAUTOCONF" - -$MAKE -$sleep -# Hopefully the install version of Autoconf cannot compete with this one... -echo 'AC_PREREQ(9999)' > v.m4 -$MAKE distdir - -# Run again, but without missing, to ensure that timestamps were updated. -export AUTOMAKE ACLOCAL -./configure AUTOCONF="$MYAUTOCONF" -$MAKE - -# Make sure $MAKE fail when timestamps aren't updated and missing is not used. -$sleep -touch v.m4 -$MAKE && Exit 1 +: > install-sh +# FIXME: this doesn't work due to a bug in automake (not 'missing'). +#do_check automake-$APIVERSION $am_original_AUTOMAKE : diff --git a/t/missing.sh b/t/missing.sh deleted file mode 100755 index 473d0412c..000000000 --- a/t/missing.sh +++ /dev/null @@ -1,66 +0,0 @@ -#! /bin/sh -# Copyright (C) 2003-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 missing with version mismatches. - -. ./defs || Exit 1 - -cat >>configure.ac <<'EOF' -AC_OUTPUT -EOF - -: > Makefile.am - -get_shell_script missing - -$ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -# Make sure we do use missing, even if the user exported AUTOCONF. -# (We cannot export this new value, because it would be used by Automake -# when tracing, and missing is no good for this.) -MYAUTOCONF="./missing --run $AUTOCONF" -unset AUTOCONF - -./configure AUTOCONF="$MYAUTOCONF" -$MAKE -$sleep -# Hopefully the install version of Autoconf cannot compete with this one... -echo 'AC_PREREQ(9999)' >> aclocal.m4 -$MAKE distdir - -# Try version number suffixes if we can add them safely. -case $MYAUTOCONF in *autoconf) - ./configure AUTOCONF="${MYAUTOCONF}6789" - $MAKE - $sleep - # Hopefully the install version of Autoconf cannot compete with this one... - echo 'AC_PREREQ(9999)' >> aclocal.m4 - $MAKE distdir -esac - -# Run again, but without missing, to ensure that timestamps were updated. -export AUTOMAKE ACLOCAL -./configure AUTOCONF="$MYAUTOCONF" -$MAKE - -# Make sure $MAKE fails when timestamps aren't updated and missing is not used. -$sleep -touch aclocal.m4 -$MAKE && Exit 1 - -: diff --git a/t/missing3.sh b/t/missing3.sh index a26f954c9..e8641da18 100755 --- a/t/missing3.sh +++ b/t/missing3.sh @@ -23,31 +23,26 @@ get_shell_script missing # b7cb8259 assumed not to exist. -./missing b7cb8259 --version 2>stderr && { cat stderr >&2; Exit 1; } -cat stderr >&2 -grep . stderr && Exit 1 -./missing b7cb8259 --grep 2>stderr && { cat stderr >&2; Exit 1; } -cat stderr >&2 -grep WARNING stderr - -./missing --run b7cb8259 --version && Exit 1 -./missing --run b7cb8259 --grep 2>stderr && { cat stderr >&2; Exit 1; } -cat stderr >&2 -grep WARNING stderr +run_cmd () +{ + st=0; "$@" >stdout 2>stderr || st=$? + cat stdout + cat stderr >&2 + return $st +} + +./missing b7cb8259 --version && Exit 1 +grep WARNING stderr && Exit 1 +run_cmd ./missing b7cb8259 --grep && Exit 1 +grep 'WARNING:.*missing on your system' stderr # missing itself it known to exist :) -./missing ./missing --version 2>stderr && { cat stderr >&2; Exit 1; } -cat stderr >&2 -grep . stderr && Exit 1 -./missing ./missing --grep 2>stderr && { cat stderr >&2; Exit 1; } -cat stderr >&2 -grep WARNING stderr - -./missing --run ./missing --version 2>stderr || { cat stderr >&2; Exit 1; } -cat stderr >&2 -grep . stderr && Exit 1 -./missing --run ./missing --grep 2>stderr && { cat stderr >&2; Exit 1; } -cat stderr >&2 +run_cmd ./missing ./missing --version || Exit 1 +grep 'missing .*(GNU [aA]utomake)' stdout +test -s stderr && Exit 1 +run_cmd ./missing ./missing --grep && Exit 1 grep WARNING stderr && Exit 1 -grep Unknown stderr +grep "missing:.* unknown '--grep'" stderr + +: diff --git a/t/missing5.sh b/t/missing5.sh deleted file mode 100755 index 80bba3691..000000000 --- a/t/missing5.sh +++ /dev/null @@ -1,64 +0,0 @@ -#! /bin/sh -# Copyright (C) 2006-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 how well 'missing' finds output file names of various tools. -# PR automake/483. - -am_create_testdir=empty -. ./defs || Exit 1 - -get_shell_script missing - -# These programs may be invoked by 'missing'. -needed_tools='chmod find sed test touch' -needed_tools_csep=`echo $needed_tools | sed 's/ /, /g'` - -cat >configure.ac <<EOF -AC_INIT([missing4], [1.0]) -m4_foreach([tool], [$needed_tools_csep], - [AC_PATH_PROG(tool, tool, [false]) - AC_CONFIG_FILES(tool, chmod +x tool) - ]) -AC_OUTPUT -EOF - -for tool in $needed_tools; do - unindent >$tool.in <<EOF - #! /bin/sh - exec @$tool@ "\$@" -EOF -done - -$AUTOCONF -./configure - -echo output-file > output-file -cp output-file my--output--file-o - -save_PATH=$PATH -PATH=. -export PATH -missing --help -missing --version -for tool in autom4te help2man makeinfo; do - missing --run $tool -o my--output--file-o input - missing --run $tool --output my--output--file-o input -done -PATH=$save_PATH -export PATH -diff output-file my--output--file-o -test ! -f ./--file-o -test ! -f input diff --git a/t/missing4.sh b/t/remake-aclocal-version-mismatch.sh index 01321c349..01321c349 100755 --- a/t/missing4.sh +++ b/t/remake-aclocal-version-mismatch.sh diff --git a/t/remake6.sh b/t/remake6.sh index c48c1b882..0fc7ead66 100755 --- a/t/remake6.sh +++ b/t/remake6.sh @@ -42,23 +42,23 @@ $MAKE rm -f Makefile.in $MAKE >stdout || { cat stdout; Exit 1; } cat stdout -test `grep -c " --run " stdout` -eq 1 +test `grep -c "/missing " stdout` -eq 1 rm -f sub/Makefile.in $MAKE >stdout || { cat stdout; Exit 1; } cat stdout -test `grep -c " --run " stdout` -eq 1 +test `grep -c "/missing " stdout` -eq 1 $sleep # Let touched files appear newer. touch Makefile.am $MAKE >stdout || { cat stdout; Exit 1; } cat stdout -test `grep -c " --run " stdout` -eq 1 +test `grep -c "/missing " stdout` -eq 1 touch sub/Makefile.am $MAKE >stdout || { cat stdout; Exit 1; } cat stdout -test `grep -c " --run " stdout` -eq 1 +test `grep -c "/missing " stdout` -eq 1 : diff --git a/t/txinfo30.sh b/t/txinfo30.sh deleted file mode 100755 index 09ebd5e18..000000000 --- a/t/txinfo30.sh +++ /dev/null @@ -1,63 +0,0 @@ -#! /bin/sh -# Copyright (C) 2005-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/>. - -# Make sure 'missing texinfo' does not create empty files. -# Report from Bob Proulx. - -. ./defs || Exit 1 - -echo info_TEXINFOS = bar.texi >Makefile.am -echo grepme >bar.info -$sleep -cat >bar.texi <<EOF -@setfilename bar.info -EOF - -echo AC_OUTPUT >>configure.ac - -cat >makeinfo <<\EOF -#!/bin/sh -# This script -# 1. fails so 'missing' can take over -# 2. does not understand '--version' so 'missing' thinks 'makeinfo' isn't -# installed -exec false -EOF - -chmod +x makeinfo - -PATH=`pwd`$PATH_SEPARATOR$PATH -export PATH - -# Otherwise configure might pick up a working makeinfo from the -# environment. Seen in automake bug#10866. -unset MAKEINFO || : - -$ACLOCAL -$AUTOCONF -$AUTOMAKE --add-missing - -./configure -$MAKE -grep grepme bar.info -test -f bar.info - -# We should not create a missing bar.info. -rm -f bar.info -$MAKE && Exit 1 -test ! -f bar.info - -: |