xref: /aosp_15_r20/external/libnfnetlink/build-aux/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=2012-01-06.13; # UTC
5*a376eb32SXin Li
6*a376eb32SXin Li# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
7*a376eb32SXin Li# 2008, 2009, 2010, 2011, 2012 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  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
88*a376eb32SXin Li
89*a376eb32SXin LiVersion suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
90*a376eb32SXin Li\`g' are ignored when checking the name.
91*a376eb32SXin Li
92*a376eb32SXin LiSend bug reports to <[email protected]>."
93*a376eb32SXin Li    exit $?
94*a376eb32SXin Li    ;;
95*a376eb32SXin Li
96*a376eb32SXin Li  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
97*a376eb32SXin Li    echo "missing $scriptversion (GNU Automake)"
98*a376eb32SXin Li    exit $?
99*a376eb32SXin Li    ;;
100*a376eb32SXin Li
101*a376eb32SXin Li  -*)
102*a376eb32SXin Li    echo 1>&2 "$0: Unknown \`$1' option"
103*a376eb32SXin Li    echo 1>&2 "Try \`$0 --help' for more information"
104*a376eb32SXin Li    exit 1
105*a376eb32SXin Li    ;;
106*a376eb32SXin Li
107*a376eb32SXin Liesac
108*a376eb32SXin Li
109*a376eb32SXin Li# normalize program name to check for.
110*a376eb32SXin Liprogram=`echo "$1" | sed '
111*a376eb32SXin Li  s/^gnu-//; t
112*a376eb32SXin Li  s/^gnu//; t
113*a376eb32SXin Li  s/^g//; t'`
114*a376eb32SXin Li
115*a376eb32SXin Li# Now exit if we have it, but it failed.  Also exit now if we
116*a376eb32SXin Li# don't have it and --version was passed (most likely to detect
117*a376eb32SXin Li# the program).  This is about non-GNU programs, so use $1 not
118*a376eb32SXin Li# $program.
119*a376eb32SXin Licase $1 in
120*a376eb32SXin Li  lex*|yacc*)
121*a376eb32SXin Li    # Not GNU programs, they don't have --version.
122*a376eb32SXin Li    ;;
123*a376eb32SXin Li
124*a376eb32SXin Li  *)
125*a376eb32SXin Li    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
126*a376eb32SXin Li       # We have it, but it failed.
127*a376eb32SXin Li       exit 1
128*a376eb32SXin Li    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
129*a376eb32SXin Li       # Could not run --version or --help.  This is probably someone
130*a376eb32SXin Li       # running `$TOOL --version' or `$TOOL --help' to check whether
131*a376eb32SXin Li       # $TOOL exists and not knowing $TOOL uses missing.
132*a376eb32SXin Li       exit 1
133*a376eb32SXin Li    fi
134*a376eb32SXin Li    ;;
135*a376eb32SXin Liesac
136*a376eb32SXin Li
137*a376eb32SXin Li# If it does not exist, or fails to run (possibly an outdated version),
138*a376eb32SXin Li# try to emulate it.
139*a376eb32SXin Licase $program in
140*a376eb32SXin Li  aclocal*)
141*a376eb32SXin Li    echo 1>&2 "\
142*a376eb32SXin LiWARNING: \`$1' is $msg.  You should only need it if
143*a376eb32SXin Li         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
144*a376eb32SXin Li         to install the \`Automake' and \`Perl' packages.  Grab them from
145*a376eb32SXin Li         any GNU archive site."
146*a376eb32SXin Li    touch aclocal.m4
147*a376eb32SXin Li    ;;
148*a376eb32SXin Li
149*a376eb32SXin Li  autoconf*)
150*a376eb32SXin Li    echo 1>&2 "\
151*a376eb32SXin LiWARNING: \`$1' is $msg.  You should only need it if
152*a376eb32SXin Li         you modified \`${configure_ac}'.  You might want to install the
153*a376eb32SXin Li         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
154*a376eb32SXin Li         archive site."
155*a376eb32SXin Li    touch configure
156*a376eb32SXin Li    ;;
157*a376eb32SXin Li
158*a376eb32SXin Li  autoheader*)
159*a376eb32SXin Li    echo 1>&2 "\
160*a376eb32SXin LiWARNING: \`$1' is $msg.  You should only need it if
161*a376eb32SXin Li         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
162*a376eb32SXin Li         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
163*a376eb32SXin Li         from any GNU archive site."
164*a376eb32SXin Li    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
165*a376eb32SXin Li    test -z "$files" && files="config.h"
166*a376eb32SXin Li    touch_files=
167*a376eb32SXin Li    for f in $files; do
168*a376eb32SXin Li      case $f in
169*a376eb32SXin Li      *:*) touch_files="$touch_files "`echo "$f" |
170*a376eb32SXin Li				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
171*a376eb32SXin Li      *) touch_files="$touch_files $f.in";;
172*a376eb32SXin Li      esac
173*a376eb32SXin Li    done
174*a376eb32SXin Li    touch $touch_files
175*a376eb32SXin Li    ;;
176*a376eb32SXin Li
177*a376eb32SXin Li  automake*)
178*a376eb32SXin Li    echo 1>&2 "\
179*a376eb32SXin LiWARNING: \`$1' is $msg.  You should only need it if
180*a376eb32SXin Li         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
181*a376eb32SXin Li         You might want to install the \`Automake' and \`Perl' packages.
182*a376eb32SXin Li         Grab them from any GNU archive site."
183*a376eb32SXin Li    find . -type f -name Makefile.am -print |
184*a376eb32SXin Li	   sed 's/\.am$/.in/' |
185*a376eb32SXin Li	   while read f; do touch "$f"; done
186*a376eb32SXin Li    ;;
187*a376eb32SXin Li
188*a376eb32SXin Li  autom4te*)
189*a376eb32SXin Li    echo 1>&2 "\
190*a376eb32SXin LiWARNING: \`$1' is needed, but is $msg.
191*a376eb32SXin Li         You might have modified some files without having the
192*a376eb32SXin Li         proper tools for further handling them.
193*a376eb32SXin Li         You can get \`$1' as part of \`Autoconf' from any GNU
194*a376eb32SXin Li         archive site."
195*a376eb32SXin Li
196*a376eb32SXin Li    file=`echo "$*" | sed -n "$sed_output"`
197*a376eb32SXin Li    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
198*a376eb32SXin Li    if test -f "$file"; then
199*a376eb32SXin Li	touch $file
200*a376eb32SXin Li    else
201*a376eb32SXin Li	test -z "$file" || exec >$file
202*a376eb32SXin Li	echo "#! /bin/sh"
203*a376eb32SXin Li	echo "# Created by GNU Automake missing as a replacement of"
204*a376eb32SXin Li	echo "#  $ $@"
205*a376eb32SXin Li	echo "exit 0"
206*a376eb32SXin Li	chmod +x $file
207*a376eb32SXin Li	exit 1
208*a376eb32SXin Li    fi
209*a376eb32SXin Li    ;;
210*a376eb32SXin Li
211*a376eb32SXin Li  bison*|yacc*)
212*a376eb32SXin Li    echo 1>&2 "\
213*a376eb32SXin LiWARNING: \`$1' $msg.  You should only need it if
214*a376eb32SXin Li         you modified a \`.y' file.  You may need the \`Bison' package
215*a376eb32SXin Li         in order for those modifications to take effect.  You can get
216*a376eb32SXin Li         \`Bison' from any GNU archive site."
217*a376eb32SXin Li    rm -f y.tab.c y.tab.h
218*a376eb32SXin Li    if test $# -ne 1; then
219*a376eb32SXin Li        eval LASTARG=\${$#}
220*a376eb32SXin Li	case $LASTARG in
221*a376eb32SXin Li	*.y)
222*a376eb32SXin Li	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
223*a376eb32SXin Li	    if test -f "$SRCFILE"; then
224*a376eb32SXin Li	         cp "$SRCFILE" y.tab.c
225*a376eb32SXin Li	    fi
226*a376eb32SXin Li	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
227*a376eb32SXin Li	    if test -f "$SRCFILE"; then
228*a376eb32SXin Li	         cp "$SRCFILE" y.tab.h
229*a376eb32SXin Li	    fi
230*a376eb32SXin Li	  ;;
231*a376eb32SXin Li	esac
232*a376eb32SXin Li    fi
233*a376eb32SXin Li    if test ! -f y.tab.h; then
234*a376eb32SXin Li	echo >y.tab.h
235*a376eb32SXin Li    fi
236*a376eb32SXin Li    if test ! -f y.tab.c; then
237*a376eb32SXin Li	echo 'main() { return 0; }' >y.tab.c
238*a376eb32SXin Li    fi
239*a376eb32SXin Li    ;;
240*a376eb32SXin Li
241*a376eb32SXin Li  lex*|flex*)
242*a376eb32SXin Li    echo 1>&2 "\
243*a376eb32SXin LiWARNING: \`$1' is $msg.  You should only need it if
244*a376eb32SXin Li         you modified a \`.l' file.  You may need the \`Flex' package
245*a376eb32SXin Li         in order for those modifications to take effect.  You can get
246*a376eb32SXin Li         \`Flex' from any GNU archive site."
247*a376eb32SXin Li    rm -f lex.yy.c
248*a376eb32SXin Li    if test $# -ne 1; then
249*a376eb32SXin Li        eval LASTARG=\${$#}
250*a376eb32SXin Li	case $LASTARG in
251*a376eb32SXin Li	*.l)
252*a376eb32SXin Li	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
253*a376eb32SXin Li	    if test -f "$SRCFILE"; then
254*a376eb32SXin Li	         cp "$SRCFILE" lex.yy.c
255*a376eb32SXin Li	    fi
256*a376eb32SXin Li	  ;;
257*a376eb32SXin Li	esac
258*a376eb32SXin Li    fi
259*a376eb32SXin Li    if test ! -f lex.yy.c; then
260*a376eb32SXin Li	echo 'main() { return 0; }' >lex.yy.c
261*a376eb32SXin Li    fi
262*a376eb32SXin Li    ;;
263*a376eb32SXin Li
264*a376eb32SXin Li  help2man*)
265*a376eb32SXin Li    echo 1>&2 "\
266*a376eb32SXin LiWARNING: \`$1' is $msg.  You should only need it if
267*a376eb32SXin Li	 you modified a dependency of a manual page.  You may need the
268*a376eb32SXin Li	 \`Help2man' package in order for those modifications to take
269*a376eb32SXin Li	 effect.  You can get \`Help2man' from any GNU archive site."
270*a376eb32SXin Li
271*a376eb32SXin Li    file=`echo "$*" | sed -n "$sed_output"`
272*a376eb32SXin Li    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
273*a376eb32SXin Li    if test -f "$file"; then
274*a376eb32SXin Li	touch $file
275*a376eb32SXin Li    else
276*a376eb32SXin Li	test -z "$file" || exec >$file
277*a376eb32SXin Li	echo ".ab help2man is required to generate this page"
278*a376eb32SXin Li	exit $?
279*a376eb32SXin Li    fi
280*a376eb32SXin Li    ;;
281*a376eb32SXin Li
282*a376eb32SXin Li  makeinfo*)
283*a376eb32SXin Li    echo 1>&2 "\
284*a376eb32SXin LiWARNING: \`$1' is $msg.  You should only need it if
285*a376eb32SXin Li         you modified a \`.texi' or \`.texinfo' file, or any other file
286*a376eb32SXin Li         indirectly affecting the aspect of the manual.  The spurious
287*a376eb32SXin Li         call might also be the consequence of using a buggy \`make' (AIX,
288*a376eb32SXin Li         DU, IRIX).  You might want to install the \`Texinfo' package or
289*a376eb32SXin Li         the \`GNU make' package.  Grab either from any GNU archive site."
290*a376eb32SXin Li    # The file to touch is that specified with -o ...
291*a376eb32SXin Li    file=`echo "$*" | sed -n "$sed_output"`
292*a376eb32SXin Li    test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
293*a376eb32SXin Li    if test -z "$file"; then
294*a376eb32SXin Li      # ... or it is the one specified with @setfilename ...
295*a376eb32SXin Li      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
296*a376eb32SXin Li      file=`sed -n '
297*a376eb32SXin Li	/^@setfilename/{
298*a376eb32SXin Li	  s/.* \([^ ]*\) *$/\1/
299*a376eb32SXin Li	  p
300*a376eb32SXin Li	  q
301*a376eb32SXin Li	}' $infile`
302*a376eb32SXin Li      # ... or it is derived from the source name (dir/f.texi becomes f.info)
303*a376eb32SXin Li      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
304*a376eb32SXin Li    fi
305*a376eb32SXin Li    # If the file does not exist, the user really needs makeinfo;
306*a376eb32SXin Li    # let's fail without touching anything.
307*a376eb32SXin Li    test -f $file || exit 1
308*a376eb32SXin Li    touch $file
309*a376eb32SXin Li    ;;
310*a376eb32SXin Li
311*a376eb32SXin Li  *)
312*a376eb32SXin Li    echo 1>&2 "\
313*a376eb32SXin LiWARNING: \`$1' is needed, and is $msg.
314*a376eb32SXin Li         You might have modified some files without having the
315*a376eb32SXin Li         proper tools for further handling them.  Check the \`README' file,
316*a376eb32SXin Li         it often tells you about the needed prerequisites for installing
317*a376eb32SXin Li         this package.  You may also peek at any GNU archive site, in case
318*a376eb32SXin Li         some other package would contain this missing \`$1' program."
319*a376eb32SXin Li    exit 1
320*a376eb32SXin Li    ;;
321*a376eb32SXin Liesac
322*a376eb32SXin Li
323*a376eb32SXin Liexit 0
324*a376eb32SXin Li
325*a376eb32SXin Li# Local variables:
326*a376eb32SXin Li# eval: (add-hook 'write-file-hooks 'time-stamp)
327*a376eb32SXin Li# time-stamp-start: "scriptversion="
328*a376eb32SXin Li# time-stamp-format: "%:y-%02m-%02d.%02H"
329*a376eb32SXin Li# time-stamp-time-zone: "UTC"
330*a376eb32SXin Li# time-stamp-end: "; # UTC"
331*a376eb32SXin Li# End:
332