doc: update Vala documentation
[automake.git] / lib / missing
blob28b8645f8d323b89d455fc420869ac29af94cf51
1 #! /bin/sh
2 # Common wrapper for a few potentially missing GNU and other programs.
4 scriptversion=2023-11-23.18; # UTC
6 # Copyright (C) 1996-2024 Free Software Foundation, Inc.
7 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <https://www.gnu.org/licenses/>.
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
27 if test $# -eq 0; then
28 echo 1>&2 "Try '$0 --help' for more information"
29 exit 1
32 case $1 in
34 --is-lightweight)
35 # Used by our autoconf macros to check whether the available missing
36 # script is modern enough.
37 exit 0
40 --run)
41 # Back-compat with the calling convention used by older automake.
42 shift
45 -h|--h|--he|--hel|--help)
46 echo "\
47 $0 [OPTION]... PROGRAM [ARGUMENT]...
49 Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
50 to PROGRAM being missing or too old.
52 Options:
53 -h, --help display this help and exit
54 -v, --version output version information and exit
56 Supported PROGRAM values:
57 aclocal autoconf autogen autoheader autom4te automake autoreconf
58 bison flex help2man lex makeinfo perl yacc
60 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
61 'g' are ignored when checking the name.
63 Report bugs to <bug-automake@gnu.org>.
64 GNU Automake home page: <https://www.gnu.org/software/automake/>.
65 General help using GNU software: <https://www.gnu.org/gethelp/>."
66 exit $?
69 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
70 echo "missing $scriptversion (GNU Automake)"
71 exit $?
74 -*)
75 echo 1>&2 "$0: unknown '$1' option"
76 echo 1>&2 "Try '$0 --help' for more information"
77 exit 1
80 esac
82 # Run the given program, remember its exit status.
83 "$@"; st=$?
85 # If it succeeded, we are done.
86 test $st -eq 0 && exit 0
88 # Also exit now if we it failed (or wasn't found), and '--version' was
89 # passed; such an option is passed most likely to detect whether the
90 # program is present and works.
91 case $2 in --version|--help) exit $st;; esac
93 # Exit code 63 means version mismatch. This often happens when the user
94 # tries to use an ancient version of a tool on a file that requires a
95 # minimum version.
96 if test $st -eq 63; then
97 msg="probably too old"
98 elif test $st -eq 127; then
99 # Program was missing.
100 msg="missing on your system"
101 else
102 # Program was found and executed, but failed. Give up.
103 exit $st
106 perl_URL=https://www.perl.org/
107 flex_URL=https://github.com/westes/flex
108 gnu_software_URL=https://www.gnu.org/software
110 program_details ()
112 case $1 in
113 aclocal|automake|autoreconf)
114 echo "The '$1' program is part of the GNU Automake package:"
115 echo "<$gnu_software_URL/automake>"
116 echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
117 echo "<$gnu_software_URL/autoconf>"
118 echo "<$gnu_software_URL/m4/>"
119 echo "<$perl_URL>"
121 autoconf|autom4te|autoheader)
122 echo "The '$1' program is part of the GNU Autoconf package:"
123 echo "<$gnu_software_URL/autoconf/>"
124 echo "It also requires GNU m4 and Perl in order to run:"
125 echo "<$gnu_software_URL/m4/>"
126 echo "<$perl_URL>"
131 esac
134 give_advice ()
136 # Normalize program name to check for.
137 normalized_program=`echo "$1" | sed '
138 s/^gnu-//; t
139 s/^gnu//; t
140 s/^g//; t'`
142 printf '%s\n' "'$1' is $msg."
144 configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
145 autoheader_deps="'acconfig.h'"
146 automake_deps="'Makefile.am'"
147 aclocal_deps="'acinclude.m4'"
148 case $normalized_program in
149 aclocal*)
150 echo "You should only need it if you modified $aclocal_deps or"
151 echo "$configure_deps."
153 autoconf*)
154 echo "You should only need it if you modified $configure_deps."
156 autogen*)
157 echo "You should only need it if you modified a '.def' or '.tpl' file."
158 echo "You may want to install the GNU AutoGen package:"
159 echo "<$gnu_software_URL/autogen/>"
161 autoheader*)
162 echo "You should only need it if you modified $autoheader_deps or"
163 echo "$configure_deps."
165 automake*)
166 echo "You should only need it if you modified $automake_deps or"
167 echo "$configure_deps."
169 autom4te*)
170 echo "You might have modified some maintainer files that require"
171 echo "the 'autom4te' program to be rebuilt."
173 autoreconf*)
174 echo "You should only need it if you modified $aclocal_deps or"
175 echo "$automake_deps or $autoheader_deps or $automake_deps or"
176 echo "$configure_deps."
178 bison*|yacc*)
179 echo "You should only need it if you modified a '.y' file."
180 echo "You may want to install the GNU Bison package:"
181 echo "<$gnu_software_URL/bison/>"
183 help2man*)
184 echo "You should only need it if you modified a dependency" \
185 "of a man page."
186 echo "You may want to install the GNU Help2man package:"
187 echo "<$gnu_software_URL/help2man/>"
189 lex*|flex*)
190 echo "You should only need it if you modified a '.l' file."
191 echo "You may want to install the Fast Lexical Analyzer package:"
192 echo "<$flex_URL>"
194 makeinfo*)
195 echo "You should only need it if you modified a '.texi' file, or"
196 echo "any other file indirectly affecting the aspect of the manual."
197 echo "You might want to install the Texinfo package:"
198 echo "<$gnu_software_URL/texinfo/>"
199 echo "The spurious makeinfo call might also be the consequence of"
200 echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
201 echo "want to install GNU make:"
202 echo "<$gnu_software_URL/make/>"
204 perl*)
205 echo "You should only need it to run GNU Autoconf, GNU Automake, "
206 echo " assorted other tools, or if you modified a Perl source file."
207 echo "You may want to install the Perl 5 language interpreter:"
208 echo "<$perl_URL>"
211 echo "You might have modified some files without having the proper"
212 echo "tools for further handling them. Check the 'README' file, it"
213 echo "often tells you about the needed prerequisites for installing"
214 echo "this package. You may also peek at any GNU archive site, in"
215 echo "case some other package contains this missing '$1' program."
217 esac
218 program_details "$normalized_program"
221 give_advice "$1" | sed -e '1s/^/WARNING: /' \
222 -e '2,$s/^/ /' >&2
224 # Propagate the correct exit status (expected to be 127 for a program
225 # not found, 63 for a program that failed due to version mismatch).
226 exit $st
228 # Local variables:
229 # eval: (add-hook 'before-save-hook 'time-stamp)
230 # time-stamp-start: "scriptversion="
231 # time-stamp-format: "%:y-%02m-%02d.%02H"
232 # time-stamp-time-zone: "UTC0"
233 # time-stamp-end: "; # UTC"
234 # End: