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