* automake.in (yacc_lex_finish_helper): Find ylwrap in
[automake.git] / missing
blob02dd54137d54923f90b430974d63cabcea5ee6a3
1 #! /bin/sh
2 # Common stub for a few missing GNU programs while installing.
3 # Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
4 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
21 if test $# -eq 0; then
22 echo 1>&2 "Try \`$0 --help' for more information"
23 exit 1
26 run=:
28 if test -f configure.ac; then
29 configure_ac=configure.ac
30 else
31 configure_ac=configure.in
34 case "$1" in
35 --run)
36 # Try to run requested program, and just exit if it succeeds.
37 run=
38 shift
39 "$@" && exit 0
41 esac
43 # If it does not exist, or fails to run (possibly an outdated version),
44 # try to emulate it.
45 case "$1" in
47 -h|--h|--he|--hel|--help)
48 echo "\
49 $0 [OPTION]... PROGRAM [ARGUMENT]...
51 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
52 error status if there is no known handling for PROGRAM.
54 Options:
55 -h, --help display this help and exit
56 -v, --version output version information and exit
57 --run try to run the given command, and emulate it if it fails
59 Supported PROGRAM values:
60 aclocal touch file \`aclocal.m4'
61 autoconf touch file \`configure'
62 autoheader touch file \`config.h.in'
63 automake touch all \`Makefile.in' files
64 bison create \`y.tab.[ch]', if possible, from existing .[ch]
65 flex create \`lex.yy.c', if possible, from existing .c
66 help2man touch the output file
67 lex create \`lex.yy.c', if possible, from existing .c
68 makeinfo touch the output file
69 tar try tar, gnutar, gtar, then tar without non-portable flags
70 yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
73 -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
74 echo "missing 0.3 - GNU automake"
77 -*)
78 echo 1>&2 "$0: Unknown \`$1' option"
79 echo 1>&2 "Try \`$0 --help' for more information"
80 exit 1
83 aclocal)
84 echo 1>&2 "\
85 WARNING: \`$1' is missing on your system. You should only need it if
86 you modified \`acinclude.m4' or \`${configure_ac}'. You might want
87 to install the \`Automake' and \`Perl' packages. Grab them from
88 any GNU archive site."
89 touch aclocal.m4
92 autoconf)
93 echo 1>&2 "\
94 WARNING: \`$1' is missing on your system. You should only need it if
95 you modified \`${configure_ac}'. You might want to install the
96 \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
97 archive site."
98 touch configure
101 autoheader)
102 echo 1>&2 "\
103 WARNING: \`$1' is missing on your system. You should only need it if
104 you modified \`acconfig.h' or \`${configure_ac}'. You might want
105 to install the \`Autoconf' and \`GNU m4' packages. Grab them
106 from any GNU archive site."
107 files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
108 test -z "$files" && files="config.h"
109 touch_files=
110 for f in $files; do
111 case "$f" in
112 *:*) touch_files="$touch_files "`echo "$f" |
113 sed -e 's/^[^:]*://' -e 's/:.*//'`;;
114 *) touch_files="$touch_files $f.in";;
115 esac
116 done
117 touch $touch_files
120 automake)
121 echo 1>&2 "\
122 WARNING: \`$1' is missing on your system. You should only need it if
123 you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
124 You might want to install the \`Automake' and \`Perl' packages.
125 Grab them from any GNU archive site."
126 find . -type f -name Makefile.am -print |
127 sed 's/\.am$/.in/' |
128 while read f; do touch "$f"; done
131 bison|yacc)
132 echo 1>&2 "\
133 WARNING: \`$1' is missing on your system. You should only need it if
134 you modified a \`.y' file. You may need the \`Bison' package
135 in order for those modifications to take effect. You can get
136 \`Bison' from any GNU archive site."
137 rm -f y.tab.c y.tab.h
138 if [ $# -ne 1 ]; then
139 eval LASTARG="\${$#}"
140 case "$LASTARG" in
141 *.y)
142 SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
143 if [ -f "$SRCFILE" ]; then
144 cp "$SRCFILE" y.tab.c
146 SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
147 if [ -f "$SRCFILE" ]; then
148 cp "$SRCFILE" y.tab.h
151 esac
153 if [ ! -f y.tab.h ]; then
154 echo >y.tab.h
156 if [ ! -f y.tab.c ]; then
157 echo 'main() { return 0; }' >y.tab.c
161 lex|flex)
162 echo 1>&2 "\
163 WARNING: \`$1' is missing on your system. You should only need it if
164 you modified a \`.l' file. You may need the \`Flex' package
165 in order for those modifications to take effect. You can get
166 \`Flex' from any GNU archive site."
167 rm -f lex.yy.c
168 if [ $# -ne 1 ]; then
169 eval LASTARG="\${$#}"
170 case "$LASTARG" in
171 *.l)
172 SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
173 if [ -f "$SRCFILE" ]; then
174 cp "$SRCFILE" lex.yy.c
177 esac
179 if [ ! -f lex.yy.c ]; then
180 echo 'main() { return 0; }' >lex.yy.c
184 help2man)
185 echo 1>&2 "\
186 WARNING: \`$1' is missing on your system. You should only need it if
187 you modified a dependency of a manual page. You may need the
188 \`Help2man' package in order for those modifications to take
189 effect. You can get \`Help2man' from any GNU archive site."
191 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
192 if test -z "$file"; then
193 file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
195 if [ -f "$file" ]; then
196 touch $file
197 else
198 test -z "$file" || exec >$file
199 echo ".ab help2man is required to generate this page"
200 exit 1
204 makeinfo)
205 echo 1>&2 "\
206 WARNING: \`$1' is missing on your system. You should only need it if
207 you modified a \`.texi' or \`.texinfo' file, or any other file
208 indirectly affecting the aspect of the manual. The spurious
209 call might also be the consequence of using a buggy \`make' (AIX,
210 DU, IRIX). You might want to install the \`Texinfo' package or
211 the \`GNU make' package. Grab either from any GNU archive site."
212 file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
213 if test -z "$file"; then
214 file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
215 file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
217 touch $file
220 tar)
221 shift
222 if test -n "$run"; then
223 echo 1>&2 "ERROR: \`tar' requires --run"
224 exit 1
227 # We have already tried tar in the generic part.
228 # Look for gnutar/gtar before invocation to avoid ugly error
229 # messages.
230 if (gnutar --version > /dev/null 2>&1); then
231 gnutar ${1+"$@"} && exit 0
233 if (gtar --version > /dev/null 2>&1); then
234 gtar ${1+"$@"} && exit 0
236 firstarg="$1"
237 if shift; then
238 case "$firstarg" in
239 *o*)
240 firstarg=`echo "$firstarg" | sed s/o//`
241 tar "$firstarg" ${1+"$@"} && exit 0
243 esac
244 case "$firstarg" in
245 *h*)
246 firstarg=`echo "$firstarg" | sed s/h//`
247 tar "$firstarg" ${1+"$@"} && exit 0
249 esac
252 echo 1>&2 "\
253 WARNING: I can't seem to be able to run \`tar' with the given arguments.
254 You may want to install GNU tar or Free paxutils, or check the
255 command line arguments."
256 exit 1
260 echo 1>&2 "\
261 WARNING: \`$1' is needed, and you do not seem to have it handy on your
262 system. You might have modified some files without having the
263 proper tools for further handling them. Check the \`README' file,
264 it often tells you about the needed prerequirements for installing
265 this package. You may also peek at any GNU archive site, in case
266 some other package would contain this missing \`$1' program."
267 exit 1
269 esac
271 exit 0