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