2 # Copyright (C) 2008, 2010 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Ensure `make dist' fails when help2man replacement man pages are created.
19 # The assumption here is the following: if the developer uses help2man to
20 # generate man pages from --help output, then these man pages may not be
21 # stored in VCS. However, they should be distributed, so that the end user
22 # that receives the tarball doesn't have to install help2man. If they are
23 # not distributed, then the developer should make help2man a prerequisite
24 # to building the package from a tarball, e.g., with a configure check for
25 # help2man that errors out if it is unavailable. In both cases it is
26 # sufficient to check only distributed man pages.
28 # Idea of this whole shenanigan is to allow somebody to check out sources from
29 # a VCS and build and install them without needing help2man installed. The
30 # installed man pages will be bogus in this case. Typically, this happens
31 # when developers ask users to try out a fix from VCS; the developers themselves
32 # will usually have help2man installed (or should install it).
38 cat > Makefile.am
<< 'END'
39 dist_man_MANS
= $
(srcdir
)/foo
.1 bar
.1
40 dist_bin_SCRIPTS
= foo bar
42 $
(HELP2MAN
) --output=$@ $
(srcdir
)/foo
44 $
(HELP2MAN
) --output=$
(srcdir
)/bar
.1 $
(srcdir
)/bar
46 ## It is a bug that we need to list $(srcdir)/bar.1 explicitly here.
47 MAINTAINERCLEANFILES
= $
(dist_man_MANS
) $
(srcdir
)/bar
.1
50 cat >>configure.
in <<'END'
51 AM_MISSING_PROG([HELP2MAN], [help2man])
57 while test $# -gt 0; do
59 -h | --help) echo "usage: $0 [OPTIONS]..."; exit 0;;
60 -v | --version) echo "$0 1.0"; exit 0;;
68 cat > help2man
<<'END'
70 # fake help2man script that lets `missing' think it is not installed
74 chmod +x foo bar help2man
76 PATH
=`pwd`$PATH_SEPARATOR$PATH
84 $MAKE distcheck
&& Exit
1
91 $MAKE dist
2>stderr
&& { cat stderr
>&2; Exit
1; }
93 grep 'install help2man' stderr
94 $MAKE distcheck
2>stderr
&& { cat stderr
>&2; Exit
1; }
96 grep 'install help2man' stderr
102 # If help2man is installed, then ensure that the recommendation works.
103 if (help2man
--version) >/dev
/null
2>&1; then
104 $MAKE maintainer-clean