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