2 # Common wrapper for a few potentially missing GNU and other programs.
4 scriptversion
=2024-12-03.03
; # UTC
6 # shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells
8 # Copyright (C) 1996-2025 Free Software Foundation, Inc.
9 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2, or (at your option)
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
21 # You should have received a copy of the GNU General Public License
22 # along with this program. If not, see <https://www.gnu.org/licenses/>.
24 # As a special exception to the GNU General Public License, if you
25 # distribute this file as part of a program that contains a
26 # configuration script generated by Autoconf, you may include it under
27 # the same distribution terms that you use for the rest of that program.
29 if test $# -eq 0; then
30 echo 1>&2 "Try '$0 --help' for more information"
37 # Used by our autoconf macros to check whether the available missing
38 # script is modern enough.
43 # Back-compat with the calling convention used by older automake.
47 -h|
--h|
--he|
--hel|
--help)
49 $0 [OPTION]... PROGRAM [ARGUMENT]...
51 Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
52 to PROGRAM being missing or too old.
55 -h, --help display this help and exit
56 -v, --version output version information and exit
58 Supported PROGRAM values:
59 aclocal autoconf autogen autoheader autom4te automake autoreconf
60 bison flex help2man lex makeinfo perl yacc
62 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
63 'g' are ignored when checking the name.
65 Report bugs to <bug-automake@gnu.org>.
66 GNU Automake home page: <https://www.gnu.org/software/automake/>.
67 General help using GNU software: <https://www.gnu.org/gethelp/>."
71 -v|
--v|
--ve|
--ver|
--vers|
--versi|
--versio|
--version)
72 echo "missing (GNU Automake) $scriptversion"
77 echo 1>&2 "$0: unknown '$1' option"
78 echo 1>&2 "Try '$0 --help' for more information"
84 # Run the given program, remember its exit status.
87 # If it succeeded, we are done.
88 test $st -eq 0 && exit 0
90 # Also exit now if we it failed (or wasn't found), and '--version' was
91 # passed; such an option is passed most likely to detect whether the
92 # program is present and works.
93 case $2 in --version|
--help) exit $st;; esac
95 # Exit code 63 means version mismatch. This often happens when the user
96 # tries to use an ancient version of a tool on a file that requires a
98 if test $st -eq 63; then
99 msg
="probably too old"
100 elif test $st -eq 127; then
101 # Program was missing.
102 msg
="missing on your system"
104 # Program was found and executed, but failed. Give up.
108 perl_URL
=https
://www.perl.org
/
109 flex_URL
=https
://github.com
/westes
/flex
110 gnu_software_URL
=https
://www.gnu.org
/software
115 aclocal|automake|autoreconf
)
116 echo "The '$1' program is part of the GNU Automake package:"
117 echo "<$gnu_software_URL/automake>"
118 echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
119 echo "<$gnu_software_URL/autoconf>"
120 echo "<$gnu_software_URL/m4/>"
123 autoconf|autom4te|autoheader
)
124 echo "The '$1' program is part of the GNU Autoconf package:"
125 echo "<$gnu_software_URL/autoconf/>"
126 echo "It also requires GNU m4 and Perl in order to run:"
127 echo "<$gnu_software_URL/m4/>"
138 # Normalize program name to check for.
139 normalized_program
=`echo "$1" | sed '
144 printf '%s\n' "'$1' is $msg."
146 configure_deps
="'configure.ac' or m4 files included by 'configure.ac'"
147 autoheader_deps
="'acconfig.h'"
148 automake_deps
="'Makefile.am'"
149 aclocal_deps
="'acinclude.m4'"
150 case $normalized_program in
152 echo "You should only need it if you modified $aclocal_deps or"
153 echo "$configure_deps."
156 echo "You should only need it if you modified $configure_deps."
159 echo "You should only need it if you modified a '.def' or '.tpl' file."
160 echo "You may want to install the GNU AutoGen package:"
161 echo "<$gnu_software_URL/autogen/>"
164 echo "You should only need it if you modified $autoheader_deps or"
165 echo "$configure_deps."
168 echo "You should only need it if you modified $automake_deps or"
169 echo "$configure_deps."
172 echo "You might have modified some maintainer files that require"
173 echo "the 'autom4te' program to be rebuilt."
176 echo "You should only need it if you modified $aclocal_deps or"
177 echo "$automake_deps or $autoheader_deps or $automake_deps or"
178 echo "$configure_deps."
181 echo "You should only need it if you modified a '.y' file."
182 echo "You may want to install the GNU Bison package:"
183 echo "<$gnu_software_URL/bison/>"
186 echo "You should only need it if you modified a dependency" \
188 echo "You may want to install the GNU Help2man package:"
189 echo "<$gnu_software_URL/help2man/>"
192 echo "You should only need it if you modified a '.l' file."
193 echo "You may want to install the Fast Lexical Analyzer package:"
197 echo "You should only need it if you modified a '.texi' file, or"
198 echo "any other file indirectly affecting the aspect of the manual."
199 echo "You might want to install the Texinfo package:"
200 echo "<$gnu_software_URL/texinfo/>"
201 echo "The spurious makeinfo call might also be the consequence of"
202 echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
203 echo "want to install GNU make:"
204 echo "<$gnu_software_URL/make/>"
207 echo "You should only need it to run GNU Autoconf, GNU Automake, "
208 echo " assorted other tools, or if you modified a Perl source file."
209 echo "You may want to install the Perl 5 language interpreter:"
213 echo "You might have modified some files without having the proper"
214 echo "tools for further handling them. Check the 'README' file, it"
215 echo "often tells you about the needed prerequisites for installing"
216 echo "this package. You may also peek at any GNU archive site, in"
217 echo "case some other package contains this missing '$1' program."
220 program_details
"$normalized_program"
223 give_advice
"$1" |
sed -e '1s/^/WARNING: /' \
226 # Propagate the correct exit status (expected to be 127 for a program
227 # not found, 63 for a program that failed due to version mismatch).
231 # eval: (add-hook 'before-save-hook 'time-stamp nil t)
232 # time-stamp-start: "scriptversion="
233 # time-stamp-format: "%:y-%02m-%02d.%02H"
234 # time-stamp-time-zone: "UTC0"
235 # time-stamp-end: "; # UTC"