missing revision 644fc5c1
1644fc5c1Stron#! /bin/sh
2644fc5c1Stron# Common stub for a few missing GNU programs while installing.
3644fc5c1Stron# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
4644fc5c1Stron# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
5644fc5c1Stron
6644fc5c1Stron# This program is free software; you can redistribute it and/or modify
7644fc5c1Stron# it under the terms of the GNU General Public License as published by
8644fc5c1Stron# the Free Software Foundation; either version 2, or (at your option)
9644fc5c1Stron# any later version.
10644fc5c1Stron
11644fc5c1Stron# This program is distributed in the hope that it will be useful,
12644fc5c1Stron# but WITHOUT ANY WARRANTY; without even the implied warranty of
13644fc5c1Stron# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14644fc5c1Stron# GNU General Public License for more details.
15644fc5c1Stron
16644fc5c1Stron# You should have received a copy of the GNU General Public License
17644fc5c1Stron# along with this program; if not, write to the Free Software
18644fc5c1Stron# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19644fc5c1Stron# 02111-1307, USA.
20644fc5c1Stron
21644fc5c1Stron# As a special exception to the GNU General Public License, if you
22644fc5c1Stron# distribute this file as part of a program that contains a
23644fc5c1Stron# configuration script generated by Autoconf, you may include it under
24644fc5c1Stron# the same distribution terms that you use for the rest of that program.
25644fc5c1Stron
26644fc5c1Stronif test $# -eq 0; then
27644fc5c1Stron  echo 1>&2 "Try \`$0 --help' for more information"
28644fc5c1Stron  exit 1
29644fc5c1Stronfi
30644fc5c1Stron
31644fc5c1Stronrun=:
32644fc5c1Stron
33644fc5c1Stron# In the cases where this matters, `missing' is being run in the
34644fc5c1Stron# srcdir already.
35644fc5c1Stronif test -f configure.ac; then
36644fc5c1Stron  configure_ac=configure.ac
37644fc5c1Stronelse
38644fc5c1Stron  configure_ac=configure.in
39644fc5c1Stronfi
40644fc5c1Stron
41644fc5c1Stroncase "$1" in
42644fc5c1Stron--run)
43644fc5c1Stron  # Try to run requested program, and just exit if it succeeds.
44644fc5c1Stron  run=
45644fc5c1Stron  shift
46644fc5c1Stron  "$@" && exit 0
47644fc5c1Stron  ;;
48644fc5c1Stronesac
49644fc5c1Stron
50644fc5c1Stron# If it does not exist, or fails to run (possibly an outdated version),
51644fc5c1Stron# try to emulate it.
52644fc5c1Stroncase "$1" in
53644fc5c1Stron
54644fc5c1Stron  -h|--h|--he|--hel|--help)
55644fc5c1Stron    echo "\
56644fc5c1Stron$0 [OPTION]... PROGRAM [ARGUMENT]...
57644fc5c1Stron
58644fc5c1StronHandle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
59644fc5c1Stronerror status if there is no known handling for PROGRAM.
60644fc5c1Stron
61644fc5c1StronOptions:
62644fc5c1Stron  -h, --help      display this help and exit
63644fc5c1Stron  -v, --version   output version information and exit
64644fc5c1Stron  --run           try to run the given command, and emulate it if it fails
65644fc5c1Stron
66644fc5c1StronSupported PROGRAM values:
67644fc5c1Stron  aclocal      touch file \`aclocal.m4'
68644fc5c1Stron  autoconf     touch file \`configure'
69644fc5c1Stron  autoheader   touch file \`config.h.in'
70644fc5c1Stron  automake     touch all \`Makefile.in' files
71644fc5c1Stron  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
72644fc5c1Stron  flex         create \`lex.yy.c', if possible, from existing .c
73644fc5c1Stron  help2man     touch the output file
74644fc5c1Stron  lex          create \`lex.yy.c', if possible, from existing .c
75644fc5c1Stron  makeinfo     touch the output file
76644fc5c1Stron  tar          try tar, gnutar, gtar, then tar without non-portable flags
77644fc5c1Stron  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
78644fc5c1Stron    ;;
79644fc5c1Stron
80644fc5c1Stron  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
81644fc5c1Stron    echo "missing 0.4 - GNU automake"
82644fc5c1Stron    ;;
83644fc5c1Stron
84644fc5c1Stron  -*)
85644fc5c1Stron    echo 1>&2 "$0: Unknown \`$1' option"
86644fc5c1Stron    echo 1>&2 "Try \`$0 --help' for more information"
87644fc5c1Stron    exit 1
88644fc5c1Stron    ;;
89644fc5c1Stron
90644fc5c1Stron  aclocal*)
91644fc5c1Stron    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
92644fc5c1Stron       # We have it, but it failed.
93644fc5c1Stron       exit 1
94644fc5c1Stron    fi
95644fc5c1Stron
96644fc5c1Stron    echo 1>&2 "\
97644fc5c1StronWARNING: \`$1' is missing on your system.  You should only need it if
98644fc5c1Stron         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
99644fc5c1Stron         to install the \`Automake' and \`Perl' packages.  Grab them from
100644fc5c1Stron         any GNU archive site."
101644fc5c1Stron    touch aclocal.m4
102644fc5c1Stron    ;;
103644fc5c1Stron
104644fc5c1Stron  autoconf)
105644fc5c1Stron    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
106644fc5c1Stron       # We have it, but it failed.
107644fc5c1Stron       exit 1
108644fc5c1Stron    fi
109644fc5c1Stron
110644fc5c1Stron    echo 1>&2 "\
111644fc5c1StronWARNING: \`$1' is missing on your system.  You should only need it if
112644fc5c1Stron         you modified \`${configure_ac}'.  You might want to install the
113644fc5c1Stron         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
114644fc5c1Stron         archive site."
115644fc5c1Stron    touch configure
116644fc5c1Stron    ;;
117644fc5c1Stron
118644fc5c1Stron  autoheader)
119644fc5c1Stron    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
120644fc5c1Stron       # We have it, but it failed.
121644fc5c1Stron       exit 1
122644fc5c1Stron    fi
123644fc5c1Stron
124644fc5c1Stron    echo 1>&2 "\
125644fc5c1StronWARNING: \`$1' is missing on your system.  You should only need it if
126644fc5c1Stron         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
127644fc5c1Stron         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
128644fc5c1Stron         from any GNU archive site."
129644fc5c1Stron    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
130644fc5c1Stron    test -z "$files" && files="config.h"
131644fc5c1Stron    touch_files=
132644fc5c1Stron    for f in $files; do
133644fc5c1Stron      case "$f" in
134644fc5c1Stron      *:*) touch_files="$touch_files "`echo "$f" |
135644fc5c1Stron				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
136644fc5c1Stron      *) touch_files="$touch_files $f.in";;
137644fc5c1Stron      esac
138644fc5c1Stron    done
139644fc5c1Stron    touch $touch_files
140644fc5c1Stron    ;;
141644fc5c1Stron
142644fc5c1Stron  automake*)
143644fc5c1Stron    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
144644fc5c1Stron       # We have it, but it failed.
145644fc5c1Stron       exit 1
146644fc5c1Stron    fi
147644fc5c1Stron
148644fc5c1Stron    echo 1>&2 "\
149644fc5c1StronWARNING: \`$1' is missing on your system.  You should only need it if
150644fc5c1Stron         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
151644fc5c1Stron         You might want to install the \`Automake' and \`Perl' packages.
152644fc5c1Stron         Grab them from any GNU archive site."
153644fc5c1Stron    find . -type f -name Makefile.am -print |
154644fc5c1Stron	   sed 's/\.am$/.in/' |
155644fc5c1Stron	   while read f; do touch "$f"; done
156644fc5c1Stron    ;;
157644fc5c1Stron
158644fc5c1Stron  autom4te)
159644fc5c1Stron    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
160644fc5c1Stron       # We have it, but it failed.
161644fc5c1Stron       exit 1
162644fc5c1Stron    fi
163644fc5c1Stron
164644fc5c1Stron    echo 1>&2 "\
165644fc5c1StronWARNING: \`$1' is needed, and you do not seem to have it handy on your
166644fc5c1Stron         system.  You might have modified some files without having the
167644fc5c1Stron         proper tools for further handling them.
168644fc5c1Stron         You can get \`$1' as part of \`Autoconf' from any GNU
169644fc5c1Stron         archive site."
170644fc5c1Stron
171644fc5c1Stron    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
172644fc5c1Stron    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
173644fc5c1Stron    if test -f "$file"; then
174644fc5c1Stron	touch $file
175644fc5c1Stron    else
176644fc5c1Stron	test -z "$file" || exec >$file
177644fc5c1Stron	echo "#! /bin/sh"
178644fc5c1Stron	echo "# Created by GNU Automake missing as a replacement of"
179644fc5c1Stron	echo "#  $ $@"
180644fc5c1Stron	echo "exit 0"
181644fc5c1Stron	chmod +x $file
182644fc5c1Stron	exit 1
183644fc5c1Stron    fi
184644fc5c1Stron    ;;
185644fc5c1Stron
186644fc5c1Stron  bison|yacc)
187644fc5c1Stron    echo 1>&2 "\
188644fc5c1StronWARNING: \`$1' is missing on your system.  You should only need it if
189644fc5c1Stron         you modified a \`.y' file.  You may need the \`Bison' package
190644fc5c1Stron         in order for those modifications to take effect.  You can get
191644fc5c1Stron         \`Bison' from any GNU archive site."
192644fc5c1Stron    rm -f y.tab.c y.tab.h
193644fc5c1Stron    if [ $# -ne 1 ]; then
194644fc5c1Stron        eval LASTARG="\${$#}"
195644fc5c1Stron	case "$LASTARG" in
196644fc5c1Stron	*.y)
197644fc5c1Stron	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
198644fc5c1Stron	    if [ -f "$SRCFILE" ]; then
199644fc5c1Stron	         cp "$SRCFILE" y.tab.c
200644fc5c1Stron	    fi
201644fc5c1Stron	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
202644fc5c1Stron	    if [ -f "$SRCFILE" ]; then
203644fc5c1Stron	         cp "$SRCFILE" y.tab.h
204644fc5c1Stron	    fi
205644fc5c1Stron	  ;;
206644fc5c1Stron	esac
207644fc5c1Stron    fi
208644fc5c1Stron    if [ ! -f y.tab.h ]; then
209644fc5c1Stron	echo >y.tab.h
210644fc5c1Stron    fi
211644fc5c1Stron    if [ ! -f y.tab.c ]; then
212644fc5c1Stron	echo 'main() { return 0; }' >y.tab.c
213644fc5c1Stron    fi
214644fc5c1Stron    ;;
215644fc5c1Stron
216644fc5c1Stron  lex|flex)
217644fc5c1Stron    echo 1>&2 "\
218644fc5c1StronWARNING: \`$1' is missing on your system.  You should only need it if
219644fc5c1Stron         you modified a \`.l' file.  You may need the \`Flex' package
220644fc5c1Stron         in order for those modifications to take effect.  You can get
221644fc5c1Stron         \`Flex' from any GNU archive site."
222644fc5c1Stron    rm -f lex.yy.c
223644fc5c1Stron    if [ $# -ne 1 ]; then
224644fc5c1Stron        eval LASTARG="\${$#}"
225644fc5c1Stron	case "$LASTARG" in
226644fc5c1Stron	*.l)
227644fc5c1Stron	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
228644fc5c1Stron	    if [ -f "$SRCFILE" ]; then
229644fc5c1Stron	         cp "$SRCFILE" lex.yy.c
230644fc5c1Stron	    fi
231644fc5c1Stron	  ;;
232644fc5c1Stron	esac
233644fc5c1Stron    fi
234644fc5c1Stron    if [ ! -f lex.yy.c ]; then
235644fc5c1Stron	echo 'main() { return 0; }' >lex.yy.c
236644fc5c1Stron    fi
237644fc5c1Stron    ;;
238644fc5c1Stron
239644fc5c1Stron  help2man)
240644fc5c1Stron    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
241644fc5c1Stron       # We have it, but it failed.
242644fc5c1Stron       exit 1
243644fc5c1Stron    fi
244644fc5c1Stron
245644fc5c1Stron    echo 1>&2 "\
246644fc5c1StronWARNING: \`$1' is missing on your system.  You should only need it if
247644fc5c1Stron	 you modified a dependency of a manual page.  You may need the
248644fc5c1Stron	 \`Help2man' package in order for those modifications to take
249644fc5c1Stron	 effect.  You can get \`Help2man' from any GNU archive site."
250644fc5c1Stron
251644fc5c1Stron    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
252644fc5c1Stron    if test -z "$file"; then
253644fc5c1Stron	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
254644fc5c1Stron    fi
255644fc5c1Stron    if [ -f "$file" ]; then
256644fc5c1Stron	touch $file
257644fc5c1Stron    else
258644fc5c1Stron	test -z "$file" || exec >$file
259644fc5c1Stron	echo ".ab help2man is required to generate this page"
260644fc5c1Stron	exit 1
261644fc5c1Stron    fi
262644fc5c1Stron    ;;
263644fc5c1Stron
264644fc5c1Stron  makeinfo)
265644fc5c1Stron    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
266644fc5c1Stron       # We have makeinfo, but it failed.
267644fc5c1Stron       exit 1
268644fc5c1Stron    fi
269644fc5c1Stron
270644fc5c1Stron    echo 1>&2 "\
271644fc5c1StronWARNING: \`$1' is missing on your system.  You should only need it if
272644fc5c1Stron         you modified a \`.texi' or \`.texinfo' file, or any other file
273644fc5c1Stron         indirectly affecting the aspect of the manual.  The spurious
274644fc5c1Stron         call might also be the consequence of using a buggy \`make' (AIX,
275644fc5c1Stron         DU, IRIX).  You might want to install the \`Texinfo' package or
276644fc5c1Stron         the \`GNU make' package.  Grab either from any GNU archive site."
277644fc5c1Stron    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
278644fc5c1Stron    if test -z "$file"; then
279644fc5c1Stron      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
280644fc5c1Stron      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
281644fc5c1Stron    fi
282644fc5c1Stron    touch $file
283644fc5c1Stron    ;;
284644fc5c1Stron
285644fc5c1Stron  tar)
286644fc5c1Stron    shift
287644fc5c1Stron    if test -n "$run"; then
288644fc5c1Stron      echo 1>&2 "ERROR: \`tar' requires --run"
289644fc5c1Stron      exit 1
290644fc5c1Stron    fi
291644fc5c1Stron
292644fc5c1Stron    # We have already tried tar in the generic part.
293644fc5c1Stron    # Look for gnutar/gtar before invocation to avoid ugly error
294644fc5c1Stron    # messages.
295644fc5c1Stron    if (gnutar --version > /dev/null 2>&1); then
296644fc5c1Stron       gnutar "$@" && exit 0
297644fc5c1Stron    fi
298644fc5c1Stron    if (gtar --version > /dev/null 2>&1); then
299644fc5c1Stron       gtar "$@" && exit 0
300644fc5c1Stron    fi
301644fc5c1Stron    firstarg="$1"
302644fc5c1Stron    if shift; then
303644fc5c1Stron	case "$firstarg" in
304644fc5c1Stron	*o*)
305644fc5c1Stron	    firstarg=`echo "$firstarg" | sed s/o//`
306644fc5c1Stron	    tar "$firstarg" "$@" && exit 0
307644fc5c1Stron	    ;;
308644fc5c1Stron	esac
309644fc5c1Stron	case "$firstarg" in
310644fc5c1Stron	*h*)
311644fc5c1Stron	    firstarg=`echo "$firstarg" | sed s/h//`
312644fc5c1Stron	    tar "$firstarg" "$@" && exit 0
313644fc5c1Stron	    ;;
314644fc5c1Stron	esac
315644fc5c1Stron    fi
316644fc5c1Stron
317644fc5c1Stron    echo 1>&2 "\
318644fc5c1StronWARNING: I can't seem to be able to run \`tar' with the given arguments.
319644fc5c1Stron         You may want to install GNU tar or Free paxutils, or check the
320644fc5c1Stron         command line arguments."
321644fc5c1Stron    exit 1
322644fc5c1Stron    ;;
323644fc5c1Stron
324644fc5c1Stron  *)
325644fc5c1Stron    echo 1>&2 "\
326644fc5c1StronWARNING: \`$1' is needed, and you do not seem to have it handy on your
327644fc5c1Stron         system.  You might have modified some files without having the
328644fc5c1Stron         proper tools for further handling them.  Check the \`README' file,
329644fc5c1Stron         it often tells you about the needed prerequisites for installing
330644fc5c1Stron         this package.  You may also peek at any GNU archive site, in case
331644fc5c1Stron         some other package would contain this missing \`$1' program."
332644fc5c1Stron    exit 1
333644fc5c1Stron    ;;
334644fc5c1Stronesac
335644fc5c1Stron
336644fc5c1Stronexit 0
337