ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/deliantra/server/utils/missing
Revision: 1.7
Committed: Fri Sep 19 12:03:56 2025 UTC (12 months, 1 week ago) by root
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +48 -27 lines
Log Message:
automake

File Contents

# User Rev Content
1 root 1.1 #! /bin/sh
2 root 1.7 # Common wrapper for a few potentially missing GNU and other programs.
3 root 1.1
4 root 1.7 scriptversion=2024-06-07.14; # UTC
5 root 1.1
6 root 1.7 # shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells
7    
8     # Copyright (C) 1996-2024 Free Software Foundation, Inc.
9 root 1.3 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
10 root 1.1
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)
14     # any later version.
15    
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.
20    
21     # You should have received a copy of the GNU General Public License
22 root 1.4 # along with this program. If not, see <https://www.gnu.org/licenses/>.
23 root 1.1
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.
28    
29     if test $# -eq 0; then
30 root 1.3 echo 1>&2 "Try '$0 --help' for more information"
31 root 1.1 exit 1
32     fi
33    
34 root 1.3 case $1 in
35 root 1.1
36 root 1.3 --is-lightweight)
37     # Used by our autoconf macros to check whether the available missing
38     # script is modern enough.
39     exit 0
40     ;;
41 root 1.1
42 root 1.3 --run)
43     # Back-compat with the calling convention used by older automake.
44     shift
45     ;;
46 root 1.1
47     -h|--h|--he|--hel|--help)
48     echo "\
49     $0 [OPTION]... PROGRAM [ARGUMENT]...
50    
51 root 1.3 Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
52     to PROGRAM being missing or too old.
53 root 1.1
54     Options:
55     -h, --help display this help and exit
56     -v, --version output version information and exit
57    
58     Supported PROGRAM values:
59 root 1.7 aclocal autoconf autogen autoheader autom4te automake autoreconf
60     bison flex help2man lex makeinfo perl yacc
61 root 1.3
62     Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
63     'g' are ignored when checking the name.
64 root 1.1
65 root 1.7 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/>."
68 root 1.2 exit $?
69 root 1.1 ;;
70    
71     -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
72 root 1.7 echo "missing (GNU Automake) $scriptversion"
73 root 1.2 exit $?
74 root 1.1 ;;
75    
76     -*)
77 root 1.3 echo 1>&2 "$0: unknown '$1' option"
78     echo 1>&2 "Try '$0 --help' for more information"
79 root 1.1 exit 1
80     ;;
81    
82     esac
83    
84 root 1.3 # Run the given program, remember its exit status.
85     "$@"; st=$?
86 root 1.1
87 root 1.3 # If it succeeded, we are done.
88     test $st -eq 0 && exit 0
89 root 1.1
90 root 1.3 # 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
94    
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
97     # minimum version.
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"
103     else
104     # Program was found and executed, but failed. Give up.
105     exit $st
106     fi
107 root 1.1
108 root 1.4 perl_URL=https://www.perl.org/
109     flex_URL=https://github.com/westes/flex
110     gnu_software_URL=https://www.gnu.org/software
111 root 1.3
112     program_details ()
113     {
114     case $1 in
115 root 1.7 aclocal|automake|autoreconf)
116 root 1.3 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/>"
121     echo "<$perl_URL>"
122     ;;
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/>"
128     echo "<$perl_URL>"
129     ;;
130 root 1.7 *)
131     :
132     ;;
133 root 1.3 esac
134     }
135    
136     give_advice ()
137     {
138     # Normalize program name to check for.
139     normalized_program=`echo "$1" | sed '
140     s/^gnu-//; t
141     s/^gnu//; t
142     s/^g//; t'`
143    
144     printf '%s\n' "'$1' is $msg."
145    
146     configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
147 root 1.7 autoheader_deps="'acconfig.h'"
148     automake_deps="'Makefile.am'"
149     aclocal_deps="'acinclude.m4'"
150 root 1.3 case $normalized_program in
151 root 1.7 aclocal*)
152     echo "You should only need it if you modified $aclocal_deps or"
153     echo "$configure_deps."
154     ;;
155 root 1.3 autoconf*)
156 root 1.7 echo "You should only need it if you modified $configure_deps."
157     ;;
158     autogen*)
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/>"
162 root 1.3 ;;
163     autoheader*)
164 root 1.7 echo "You should only need it if you modified $autoheader_deps or"
165 root 1.3 echo "$configure_deps."
166     ;;
167     automake*)
168 root 1.7 echo "You should only need it if you modified $automake_deps or"
169 root 1.3 echo "$configure_deps."
170     ;;
171 root 1.7 autom4te*)
172 root 1.3 echo "You might have modified some maintainer files that require"
173     echo "the 'autom4te' program to be rebuilt."
174 root 1.7 ;;
175     autoreconf*)
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."
179 root 1.3 ;;
180     bison*|yacc*)
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/>"
184     ;;
185     help2man*)
186     echo "You should only need it if you modified a dependency" \
187     "of a man page."
188     echo "You may want to install the GNU Help2man package:"
189     echo "<$gnu_software_URL/help2man/>"
190     ;;
191 root 1.7 lex*|flex*)
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:"
194     echo "<$flex_URL>"
195     ;;
196 root 1.3 makeinfo*)
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/>"
205     ;;
206 root 1.7 perl*)
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:"
210     echo "<$perl_URL>"
211     ;;
212 root 1.3 *)
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."
218     ;;
219     esac
220 root 1.7 program_details "$normalized_program"
221 root 1.3 }
222    
223     give_advice "$1" | sed -e '1s/^/WARNING: /' \
224     -e '2,$s/^/ /' >&2
225    
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).
228     exit $st
229 root 1.1
230     # Local variables:
231 root 1.4 # eval: (add-hook 'before-save-hook 'time-stamp)
232 root 1.1 # time-stamp-start: "scriptversion="
233     # time-stamp-format: "%:y-%02m-%02d.%02H"
234 root 1.4 # time-stamp-time-zone: "UTC0"
235 root 1.3 # time-stamp-end: "; # UTC"
236 root 1.1 # End: