rev |
line source |
alpar@9
|
1 #! /bin/sh
|
alpar@9
|
2 # Common stub for a few missing GNU programs while installing.
|
alpar@9
|
3
|
alpar@9
|
4 scriptversion=2009-04-28.21; # UTC
|
alpar@9
|
5
|
alpar@9
|
6 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
|
alpar@9
|
7 # 2008, 2009 Free Software Foundation, Inc.
|
alpar@9
|
8 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
alpar@9
|
9
|
alpar@9
|
10 # This program is free software; you can redistribute it and/or modify
|
alpar@9
|
11 # it under the terms of the GNU General Public License as published by
|
alpar@9
|
12 # the Free Software Foundation; either version 2, or (at your option)
|
alpar@9
|
13 # any later version.
|
alpar@9
|
14
|
alpar@9
|
15 # This program is distributed in the hope that it will be useful,
|
alpar@9
|
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
alpar@9
|
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
alpar@9
|
18 # GNU General Public License for more details.
|
alpar@9
|
19
|
alpar@9
|
20 # You should have received a copy of the GNU General Public License
|
alpar@9
|
21 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
alpar@9
|
22
|
alpar@9
|
23 # As a special exception to the GNU General Public License, if you
|
alpar@9
|
24 # distribute this file as part of a program that contains a
|
alpar@9
|
25 # configuration script generated by Autoconf, you may include it under
|
alpar@9
|
26 # the same distribution terms that you use for the rest of that program.
|
alpar@9
|
27
|
alpar@9
|
28 if test $# -eq 0; then
|
alpar@9
|
29 echo 1>&2 "Try \`$0 --help' for more information"
|
alpar@9
|
30 exit 1
|
alpar@9
|
31 fi
|
alpar@9
|
32
|
alpar@9
|
33 run=:
|
alpar@9
|
34 sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
alpar@9
|
35 sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
alpar@9
|
36
|
alpar@9
|
37 # In the cases where this matters, `missing' is being run in the
|
alpar@9
|
38 # srcdir already.
|
alpar@9
|
39 if test -f configure.ac; then
|
alpar@9
|
40 configure_ac=configure.ac
|
alpar@9
|
41 else
|
alpar@9
|
42 configure_ac=configure.in
|
alpar@9
|
43 fi
|
alpar@9
|
44
|
alpar@9
|
45 msg="missing on your system"
|
alpar@9
|
46
|
alpar@9
|
47 case $1 in
|
alpar@9
|
48 --run)
|
alpar@9
|
49 # Try to run requested program, and just exit if it succeeds.
|
alpar@9
|
50 run=
|
alpar@9
|
51 shift
|
alpar@9
|
52 "$@" && exit 0
|
alpar@9
|
53 # Exit code 63 means version mismatch. This often happens
|
alpar@9
|
54 # when the user try to use an ancient version of a tool on
|
alpar@9
|
55 # a file that requires a minimum version. In this case we
|
alpar@9
|
56 # we should proceed has if the program had been absent, or
|
alpar@9
|
57 # if --run hadn't been passed.
|
alpar@9
|
58 if test $? = 63; then
|
alpar@9
|
59 run=:
|
alpar@9
|
60 msg="probably too old"
|
alpar@9
|
61 fi
|
alpar@9
|
62 ;;
|
alpar@9
|
63
|
alpar@9
|
64 -h|--h|--he|--hel|--help)
|
alpar@9
|
65 echo "\
|
alpar@9
|
66 $0 [OPTION]... PROGRAM [ARGUMENT]...
|
alpar@9
|
67
|
alpar@9
|
68 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
alpar@9
|
69 error status if there is no known handling for PROGRAM.
|
alpar@9
|
70
|
alpar@9
|
71 Options:
|
alpar@9
|
72 -h, --help display this help and exit
|
alpar@9
|
73 -v, --version output version information and exit
|
alpar@9
|
74 --run try to run the given command, and emulate it if it fails
|
alpar@9
|
75
|
alpar@9
|
76 Supported PROGRAM values:
|
alpar@9
|
77 aclocal touch file \`aclocal.m4'
|
alpar@9
|
78 autoconf touch file \`configure'
|
alpar@9
|
79 autoheader touch file \`config.h.in'
|
alpar@9
|
80 autom4te touch the output file, or create a stub one
|
alpar@9
|
81 automake touch all \`Makefile.in' files
|
alpar@9
|
82 bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
alpar@9
|
83 flex create \`lex.yy.c', if possible, from existing .c
|
alpar@9
|
84 help2man touch the output file
|
alpar@9
|
85 lex create \`lex.yy.c', if possible, from existing .c
|
alpar@9
|
86 makeinfo touch the output file
|
alpar@9
|
87 tar try tar, gnutar, gtar, then tar without non-portable flags
|
alpar@9
|
88 yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
alpar@9
|
89
|
alpar@9
|
90 Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
|
alpar@9
|
91 \`g' are ignored when checking the name.
|
alpar@9
|
92
|
alpar@9
|
93 Send bug reports to <bug-automake@gnu.org>."
|
alpar@9
|
94 exit $?
|
alpar@9
|
95 ;;
|
alpar@9
|
96
|
alpar@9
|
97 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
alpar@9
|
98 echo "missing $scriptversion (GNU Automake)"
|
alpar@9
|
99 exit $?
|
alpar@9
|
100 ;;
|
alpar@9
|
101
|
alpar@9
|
102 -*)
|
alpar@9
|
103 echo 1>&2 "$0: Unknown \`$1' option"
|
alpar@9
|
104 echo 1>&2 "Try \`$0 --help' for more information"
|
alpar@9
|
105 exit 1
|
alpar@9
|
106 ;;
|
alpar@9
|
107
|
alpar@9
|
108 esac
|
alpar@9
|
109
|
alpar@9
|
110 # normalize program name to check for.
|
alpar@9
|
111 program=`echo "$1" | sed '
|
alpar@9
|
112 s/^gnu-//; t
|
alpar@9
|
113 s/^gnu//; t
|
alpar@9
|
114 s/^g//; t'`
|
alpar@9
|
115
|
alpar@9
|
116 # Now exit if we have it, but it failed. Also exit now if we
|
alpar@9
|
117 # don't have it and --version was passed (most likely to detect
|
alpar@9
|
118 # the program). This is about non-GNU programs, so use $1 not
|
alpar@9
|
119 # $program.
|
alpar@9
|
120 case $1 in
|
alpar@9
|
121 lex*|yacc*)
|
alpar@9
|
122 # Not GNU programs, they don't have --version.
|
alpar@9
|
123 ;;
|
alpar@9
|
124
|
alpar@9
|
125 tar*)
|
alpar@9
|
126 if test -n "$run"; then
|
alpar@9
|
127 echo 1>&2 "ERROR: \`tar' requires --run"
|
alpar@9
|
128 exit 1
|
alpar@9
|
129 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
alpar@9
|
130 exit 1
|
alpar@9
|
131 fi
|
alpar@9
|
132 ;;
|
alpar@9
|
133
|
alpar@9
|
134 *)
|
alpar@9
|
135 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
alpar@9
|
136 # We have it, but it failed.
|
alpar@9
|
137 exit 1
|
alpar@9
|
138 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
alpar@9
|
139 # Could not run --version or --help. This is probably someone
|
alpar@9
|
140 # running `$TOOL --version' or `$TOOL --help' to check whether
|
alpar@9
|
141 # $TOOL exists and not knowing $TOOL uses missing.
|
alpar@9
|
142 exit 1
|
alpar@9
|
143 fi
|
alpar@9
|
144 ;;
|
alpar@9
|
145 esac
|
alpar@9
|
146
|
alpar@9
|
147 # If it does not exist, or fails to run (possibly an outdated version),
|
alpar@9
|
148 # try to emulate it.
|
alpar@9
|
149 case $program in
|
alpar@9
|
150 aclocal*)
|
alpar@9
|
151 echo 1>&2 "\
|
alpar@9
|
152 WARNING: \`$1' is $msg. You should only need it if
|
alpar@9
|
153 you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
alpar@9
|
154 to install the \`Automake' and \`Perl' packages. Grab them from
|
alpar@9
|
155 any GNU archive site."
|
alpar@9
|
156 touch aclocal.m4
|
alpar@9
|
157 ;;
|
alpar@9
|
158
|
alpar@9
|
159 autoconf*)
|
alpar@9
|
160 echo 1>&2 "\
|
alpar@9
|
161 WARNING: \`$1' is $msg. You should only need it if
|
alpar@9
|
162 you modified \`${configure_ac}'. You might want to install the
|
alpar@9
|
163 \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
alpar@9
|
164 archive site."
|
alpar@9
|
165 touch configure
|
alpar@9
|
166 ;;
|
alpar@9
|
167
|
alpar@9
|
168 autoheader*)
|
alpar@9
|
169 echo 1>&2 "\
|
alpar@9
|
170 WARNING: \`$1' is $msg. You should only need it if
|
alpar@9
|
171 you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
alpar@9
|
172 to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
alpar@9
|
173 from any GNU archive site."
|
alpar@9
|
174 files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
alpar@9
|
175 test -z "$files" && files="config.h"
|
alpar@9
|
176 touch_files=
|
alpar@9
|
177 for f in $files; do
|
alpar@9
|
178 case $f in
|
alpar@9
|
179 *:*) touch_files="$touch_files "`echo "$f" |
|
alpar@9
|
180 sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
alpar@9
|
181 *) touch_files="$touch_files $f.in";;
|
alpar@9
|
182 esac
|
alpar@9
|
183 done
|
alpar@9
|
184 touch $touch_files
|
alpar@9
|
185 ;;
|
alpar@9
|
186
|
alpar@9
|
187 automake*)
|
alpar@9
|
188 echo 1>&2 "\
|
alpar@9
|
189 WARNING: \`$1' is $msg. You should only need it if
|
alpar@9
|
190 you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
alpar@9
|
191 You might want to install the \`Automake' and \`Perl' packages.
|
alpar@9
|
192 Grab them from any GNU archive site."
|
alpar@9
|
193 find . -type f -name Makefile.am -print |
|
alpar@9
|
194 sed 's/\.am$/.in/' |
|
alpar@9
|
195 while read f; do touch "$f"; done
|
alpar@9
|
196 ;;
|
alpar@9
|
197
|
alpar@9
|
198 autom4te*)
|
alpar@9
|
199 echo 1>&2 "\
|
alpar@9
|
200 WARNING: \`$1' is needed, but is $msg.
|
alpar@9
|
201 You might have modified some files without having the
|
alpar@9
|
202 proper tools for further handling them.
|
alpar@9
|
203 You can get \`$1' as part of \`Autoconf' from any GNU
|
alpar@9
|
204 archive site."
|
alpar@9
|
205
|
alpar@9
|
206 file=`echo "$*" | sed -n "$sed_output"`
|
alpar@9
|
207 test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
alpar@9
|
208 if test -f "$file"; then
|
alpar@9
|
209 touch $file
|
alpar@9
|
210 else
|
alpar@9
|
211 test -z "$file" || exec >$file
|
alpar@9
|
212 echo "#! /bin/sh"
|
alpar@9
|
213 echo "# Created by GNU Automake missing as a replacement of"
|
alpar@9
|
214 echo "# $ $@"
|
alpar@9
|
215 echo "exit 0"
|
alpar@9
|
216 chmod +x $file
|
alpar@9
|
217 exit 1
|
alpar@9
|
218 fi
|
alpar@9
|
219 ;;
|
alpar@9
|
220
|
alpar@9
|
221 bison*|yacc*)
|
alpar@9
|
222 echo 1>&2 "\
|
alpar@9
|
223 WARNING: \`$1' $msg. You should only need it if
|
alpar@9
|
224 you modified a \`.y' file. You may need the \`Bison' package
|
alpar@9
|
225 in order for those modifications to take effect. You can get
|
alpar@9
|
226 \`Bison' from any GNU archive site."
|
alpar@9
|
227 rm -f y.tab.c y.tab.h
|
alpar@9
|
228 if test $# -ne 1; then
|
alpar@9
|
229 eval LASTARG="\${$#}"
|
alpar@9
|
230 case $LASTARG in
|
alpar@9
|
231 *.y)
|
alpar@9
|
232 SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
alpar@9
|
233 if test -f "$SRCFILE"; then
|
alpar@9
|
234 cp "$SRCFILE" y.tab.c
|
alpar@9
|
235 fi
|
alpar@9
|
236 SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
alpar@9
|
237 if test -f "$SRCFILE"; then
|
alpar@9
|
238 cp "$SRCFILE" y.tab.h
|
alpar@9
|
239 fi
|
alpar@9
|
240 ;;
|
alpar@9
|
241 esac
|
alpar@9
|
242 fi
|
alpar@9
|
243 if test ! -f y.tab.h; then
|
alpar@9
|
244 echo >y.tab.h
|
alpar@9
|
245 fi
|
alpar@9
|
246 if test ! -f y.tab.c; then
|
alpar@9
|
247 echo 'main() { return 0; }' >y.tab.c
|
alpar@9
|
248 fi
|
alpar@9
|
249 ;;
|
alpar@9
|
250
|
alpar@9
|
251 lex*|flex*)
|
alpar@9
|
252 echo 1>&2 "\
|
alpar@9
|
253 WARNING: \`$1' is $msg. You should only need it if
|
alpar@9
|
254 you modified a \`.l' file. You may need the \`Flex' package
|
alpar@9
|
255 in order for those modifications to take effect. You can get
|
alpar@9
|
256 \`Flex' from any GNU archive site."
|
alpar@9
|
257 rm -f lex.yy.c
|
alpar@9
|
258 if test $# -ne 1; then
|
alpar@9
|
259 eval LASTARG="\${$#}"
|
alpar@9
|
260 case $LASTARG in
|
alpar@9
|
261 *.l)
|
alpar@9
|
262 SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
alpar@9
|
263 if test -f "$SRCFILE"; then
|
alpar@9
|
264 cp "$SRCFILE" lex.yy.c
|
alpar@9
|
265 fi
|
alpar@9
|
266 ;;
|
alpar@9
|
267 esac
|
alpar@9
|
268 fi
|
alpar@9
|
269 if test ! -f lex.yy.c; then
|
alpar@9
|
270 echo 'main() { return 0; }' >lex.yy.c
|
alpar@9
|
271 fi
|
alpar@9
|
272 ;;
|
alpar@9
|
273
|
alpar@9
|
274 help2man*)
|
alpar@9
|
275 echo 1>&2 "\
|
alpar@9
|
276 WARNING: \`$1' is $msg. You should only need it if
|
alpar@9
|
277 you modified a dependency of a manual page. You may need the
|
alpar@9
|
278 \`Help2man' package in order for those modifications to take
|
alpar@9
|
279 effect. You can get \`Help2man' from any GNU archive site."
|
alpar@9
|
280
|
alpar@9
|
281 file=`echo "$*" | sed -n "$sed_output"`
|
alpar@9
|
282 test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
alpar@9
|
283 if test -f "$file"; then
|
alpar@9
|
284 touch $file
|
alpar@9
|
285 else
|
alpar@9
|
286 test -z "$file" || exec >$file
|
alpar@9
|
287 echo ".ab help2man is required to generate this page"
|
alpar@9
|
288 exit $?
|
alpar@9
|
289 fi
|
alpar@9
|
290 ;;
|
alpar@9
|
291
|
alpar@9
|
292 makeinfo*)
|
alpar@9
|
293 echo 1>&2 "\
|
alpar@9
|
294 WARNING: \`$1' is $msg. You should only need it if
|
alpar@9
|
295 you modified a \`.texi' or \`.texinfo' file, or any other file
|
alpar@9
|
296 indirectly affecting the aspect of the manual. The spurious
|
alpar@9
|
297 call might also be the consequence of using a buggy \`make' (AIX,
|
alpar@9
|
298 DU, IRIX). You might want to install the \`Texinfo' package or
|
alpar@9
|
299 the \`GNU make' package. Grab either from any GNU archive site."
|
alpar@9
|
300 # The file to touch is that specified with -o ...
|
alpar@9
|
301 file=`echo "$*" | sed -n "$sed_output"`
|
alpar@9
|
302 test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
alpar@9
|
303 if test -z "$file"; then
|
alpar@9
|
304 # ... or it is the one specified with @setfilename ...
|
alpar@9
|
305 infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
alpar@9
|
306 file=`sed -n '
|
alpar@9
|
307 /^@setfilename/{
|
alpar@9
|
308 s/.* \([^ ]*\) *$/\1/
|
alpar@9
|
309 p
|
alpar@9
|
310 q
|
alpar@9
|
311 }' $infile`
|
alpar@9
|
312 # ... or it is derived from the source name (dir/f.texi becomes f.info)
|
alpar@9
|
313 test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
alpar@9
|
314 fi
|
alpar@9
|
315 # If the file does not exist, the user really needs makeinfo;
|
alpar@9
|
316 # let's fail without touching anything.
|
alpar@9
|
317 test -f $file || exit 1
|
alpar@9
|
318 touch $file
|
alpar@9
|
319 ;;
|
alpar@9
|
320
|
alpar@9
|
321 tar*)
|
alpar@9
|
322 shift
|
alpar@9
|
323
|
alpar@9
|
324 # We have already tried tar in the generic part.
|
alpar@9
|
325 # Look for gnutar/gtar before invocation to avoid ugly error
|
alpar@9
|
326 # messages.
|
alpar@9
|
327 if (gnutar --version > /dev/null 2>&1); then
|
alpar@9
|
328 gnutar "$@" && exit 0
|
alpar@9
|
329 fi
|
alpar@9
|
330 if (gtar --version > /dev/null 2>&1); then
|
alpar@9
|
331 gtar "$@" && exit 0
|
alpar@9
|
332 fi
|
alpar@9
|
333 firstarg="$1"
|
alpar@9
|
334 if shift; then
|
alpar@9
|
335 case $firstarg in
|
alpar@9
|
336 *o*)
|
alpar@9
|
337 firstarg=`echo "$firstarg" | sed s/o//`
|
alpar@9
|
338 tar "$firstarg" "$@" && exit 0
|
alpar@9
|
339 ;;
|
alpar@9
|
340 esac
|
alpar@9
|
341 case $firstarg in
|
alpar@9
|
342 *h*)
|
alpar@9
|
343 firstarg=`echo "$firstarg" | sed s/h//`
|
alpar@9
|
344 tar "$firstarg" "$@" && exit 0
|
alpar@9
|
345 ;;
|
alpar@9
|
346 esac
|
alpar@9
|
347 fi
|
alpar@9
|
348
|
alpar@9
|
349 echo 1>&2 "\
|
alpar@9
|
350 WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
alpar@9
|
351 You may want to install GNU tar or Free paxutils, or check the
|
alpar@9
|
352 command line arguments."
|
alpar@9
|
353 exit 1
|
alpar@9
|
354 ;;
|
alpar@9
|
355
|
alpar@9
|
356 *)
|
alpar@9
|
357 echo 1>&2 "\
|
alpar@9
|
358 WARNING: \`$1' is needed, and is $msg.
|
alpar@9
|
359 You might have modified some files without having the
|
alpar@9
|
360 proper tools for further handling them. Check the \`README' file,
|
alpar@9
|
361 it often tells you about the needed prerequisites for installing
|
alpar@9
|
362 this package. You may also peek at any GNU archive site, in case
|
alpar@9
|
363 some other package would contain this missing \`$1' program."
|
alpar@9
|
364 exit 1
|
alpar@9
|
365 ;;
|
alpar@9
|
366 esac
|
alpar@9
|
367
|
alpar@9
|
368 exit 0
|
alpar@9
|
369
|
alpar@9
|
370 # Local variables:
|
alpar@9
|
371 # eval: (add-hook 'write-file-hooks 'time-stamp)
|
alpar@9
|
372 # time-stamp-start: "scriptversion="
|
alpar@9
|
373 # time-stamp-format: "%:y-%02m-%02d.%02H"
|
alpar@9
|
374 # time-stamp-time-zone: "UTC"
|
alpar@9
|
375 # time-stamp-end: "; # UTC"
|
alpar@9
|
376 # End:
|