Merge branch 'master' into rtoy-verify-html-index
[maxima.git] / interfaces / emacs / imaxima / missing
blob576965426e6d27ac68184b68eb907e5eaf845a7c
1 #! /bin/sh
2 # Common stub for a few missing GNU programs while installing.
4 scriptversion=2003-09-02.23
6 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
7 # Free Software Foundation, Inc.
8 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2, or (at your option)
13 # any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
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"
31 exit 1
34 run=:
36 # In the cases where this matters, `missing' is being run in the
37 # srcdir already.
38 if test -f configure.ac; then
39 configure_ac=configure.ac
40 else
41 configure_ac=configure.in
44 msg="missing on your system"
46 case "$1" in
47 --run)
48 # Try to run requested program, and just exit if it succeeds.
49 run=
50 shift
51 "$@" && exit 0
52 # Exit code 63 means version mismatch. This often happens
53 # when the user try to use an ancient version of a tool on
54 # a file that requires a minimum version. In this case we
55 # we should proceed has if the program had been absent, or
56 # if --run hadn't been passed.
57 if test $? = 63; then
58 run=:
59 msg="probably too old"
62 esac
64 # If it does not exist, or fails to run (possibly an outdated version),
65 # try to emulate it.
66 case "$1" in
68 -h|--h|--he|--hel|--help)
69 echo "\
70 $0 [OPTION]... PROGRAM [ARGUMENT]...
72 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
73 error status if there is no known handling for PROGRAM.
75 Options:
76 -h, --help display this help and exit
77 -v, --version output version information and exit
78 --run try to run the given command, and emulate it if it fails
80 Supported PROGRAM values:
81 aclocal touch file \`aclocal.m4'
82 autoconf touch file \`configure'
83 autoheader touch file \`config.h.in'
84 automake touch all \`Makefile.in' files
85 bison create \`y.tab.[ch]', if possible, from existing .[ch]
86 flex create \`lex.yy.c', if possible, from existing .c
87 help2man touch the output file
88 lex create \`lex.yy.c', if possible, from existing .c
89 makeinfo touch the output file
90 tar try tar, gnutar, gtar, then tar without non-portable flags
91 yacc create \`y.tab.[ch]', if possible, from existing .[ch]
93 Send bug reports to <bug-automake@gnu.org>."
96 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
97 echo "missing $scriptversion (GNU Automake)"
101 echo 1>&2 "$0: Unknown \`$1' option"
102 echo 1>&2 "Try \`$0 --help' for more information"
103 exit 1
106 aclocal*)
107 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
108 # We have it, but it failed.
109 exit 1
112 echo 1>&2 "\
113 WARNING: \`$1' is $msg. You should only need it if
114 you modified \`acinclude.m4' or \`${configure_ac}'. You might want
115 to install the \`Automake' and \`Perl' packages. Grab them from
116 any GNU archive site."
117 touch aclocal.m4
120 autoconf)
121 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
122 # We have it, but it failed.
123 exit 1
126 echo 1>&2 "\
127 WARNING: \`$1' is $msg. You should only need it if
128 you modified \`${configure_ac}'. You might want to install the
129 \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
130 archive site."
131 touch configure
134 autoheader)
135 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
136 # We have it, but it failed.
137 exit 1
140 echo 1>&2 "\
141 WARNING: \`$1' is $msg. You should only need it if
142 you modified \`acconfig.h' or \`${configure_ac}'. You might want
143 to install the \`Autoconf' and \`GNU m4' packages. Grab them
144 from any GNU archive site."
145 files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
146 test -z "$files" && files="config.h"
147 touch_files=
148 for f in $files; do
149 case "$f" in
150 *:*) touch_files="$touch_files "`echo "$f" |
151 sed -e 's/^[^:]*://' -e 's/:.*//'`;;
152 *) touch_files="$touch_files $f.in";;
153 esac
154 done
155 touch $touch_files
158 automake*)
159 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
160 # We have it, but it failed.
161 exit 1
164 echo 1>&2 "\
165 WARNING: \`$1' is $msg. You should only need it if
166 you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
167 You might want to install the \`Automake' and \`Perl' packages.
168 Grab them from any GNU archive site."
169 find . -type f -name Makefile.am -print |
170 sed 's/\.am$/.in/' |
171 while read f; do touch "$f"; done
174 autom4te)
175 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
176 # We have it, but it failed.
177 exit 1
180 echo 1>&2 "\
181 WARNING: \`$1' is needed, but is $msg.
182 You might have modified some files without having the
183 proper tools for further handling them.
184 You can get \`$1' as part of \`Autoconf' from any GNU
185 archive site."
187 file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
188 test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
189 if test -f "$file"; then
190 touch $file
191 else
192 test -z "$file" || exec >$file
193 echo "#! /bin/sh"
194 echo "# Created by GNU Automake missing as a replacement of"
195 echo "# $ $@"
196 echo "exit 0"
197 chmod +x $file
198 exit 1
202 bison|yacc)
203 echo 1>&2 "\
204 WARNING: \`$1' $msg. You should only need it if
205 you modified a \`.y' file. You may need the \`Bison' package
206 in order for those modifications to take effect. You can get
207 \`Bison' from any GNU archive site."
208 rm -f y.tab.c y.tab.h
209 if [ $# -ne 1 ]; then
210 eval LASTARG="\${$#}"
211 case "$LASTARG" in
212 *.y)
213 SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
214 if [ -f "$SRCFILE" ]; then
215 cp "$SRCFILE" y.tab.c
217 SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
218 if [ -f "$SRCFILE" ]; then
219 cp "$SRCFILE" y.tab.h
222 esac
224 if [ ! -f y.tab.h ]; then
225 echo >y.tab.h
227 if [ ! -f y.tab.c ]; then
228 echo 'main() { return 0; }' >y.tab.c
232 lex|flex)
233 echo 1>&2 "\
234 WARNING: \`$1' is $msg. You should only need it if
235 you modified a \`.l' file. You may need the \`Flex' package
236 in order for those modifications to take effect. You can get
237 \`Flex' from any GNU archive site."
238 rm -f lex.yy.c
239 if [ $# -ne 1 ]; then
240 eval LASTARG="\${$#}"
241 case "$LASTARG" in
242 *.l)
243 SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
244 if [ -f "$SRCFILE" ]; then
245 cp "$SRCFILE" lex.yy.c
248 esac
250 if [ ! -f lex.yy.c ]; then
251 echo 'main() { return 0; }' >lex.yy.c
255 help2man)
256 if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
257 # We have it, but it failed.
258 exit 1
261 echo 1>&2 "\
262 WARNING: \`$1' is $msg. You should only need it if
263 you modified a dependency of a manual page. You may need the
264 \`Help2man' package in order for those modifications to take
265 effect. You can get \`Help2man' from any GNU archive site."
267 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
268 if test -z "$file"; then
269 file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
271 if [ -f "$file" ]; then
272 touch $file
273 else
274 test -z "$file" || exec >$file
275 echo ".ab help2man is required to generate this page"
276 exit 1
280 makeinfo)
281 if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
282 # We have makeinfo, but it failed.
283 exit 1
286 echo 1>&2 "\
287 WARNING: \`$1' is $msg. You should only need it if
288 you modified a \`.texi' or \`.texinfo' file, or any other file
289 indirectly affecting the aspect of the manual. The spurious
290 call might also be the consequence of using a buggy \`make' (AIX,
291 DU, IRIX). You might want to install the \`Texinfo' package or
292 the \`GNU make' package. Grab either from any GNU archive site."
293 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
294 if test -z "$file"; then
295 file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
296 file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
298 touch $file
301 tar)
302 shift
303 if test -n "$run"; then
304 echo 1>&2 "ERROR: \`tar' requires --run"
305 exit 1
308 # We have already tried tar in the generic part.
309 # Look for gnutar/gtar before invocation to avoid ugly error
310 # messages.
311 if (gnutar --version > /dev/null 2>&1); then
312 gnutar "$@" && exit 0
314 if (gtar --version > /dev/null 2>&1); then
315 gtar "$@" && exit 0
317 firstarg="$1"
318 if shift; then
319 case "$firstarg" in
320 *o*)
321 firstarg=`echo "$firstarg" | sed s/o//`
322 tar "$firstarg" "$@" && exit 0
324 esac
325 case "$firstarg" in
326 *h*)
327 firstarg=`echo "$firstarg" | sed s/h//`
328 tar "$firstarg" "$@" && exit 0
330 esac
333 echo 1>&2 "\
334 WARNING: I can't seem to be able to run \`tar' with the given arguments.
335 You may want to install GNU tar or Free paxutils, or check the
336 command line arguments."
337 exit 1
341 echo 1>&2 "\
342 WARNING: \`$1' is needed, and is $msg.
343 You might have modified some files without having the
344 proper tools for further handling them. Check the \`README' file,
345 it often tells you about the needed prerequisites for installing
346 this package. You may also peek at any GNU archive site, in case
347 some other package would contain this missing \`$1' program."
348 exit 1
350 esac
352 exit 0
354 # Local variables:
355 # eval: (add-hook 'write-file-hooks 'time-stamp)
356 # time-stamp-start: "scriptversion="
357 # time-stamp-format: "%:y-%02m-%02d.%02H"
358 # time-stamp-end: "$"
359 # End: