Statistics
| Revision:

root / missing

History | View | Annotate | Download (10 kB)

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