xref: /aosp_15_r20/external/libconfig/aux-build/missing (revision 2e9d491483b805f09ea864149eadd5680efcc72a)
1*2e9d4914SAndroid Build Coastguard Worker#! /bin/sh
2*2e9d4914SAndroid Build Coastguard Worker# Common wrapper for a few potentially missing GNU programs.
3*2e9d4914SAndroid Build Coastguard Worker
4*2e9d4914SAndroid Build Coastguard Workerscriptversion=2013-10-28.13; # UTC
5*2e9d4914SAndroid Build Coastguard Worker
6*2e9d4914SAndroid Build Coastguard Worker# Copyright (C) 1996-2013 Free Software Foundation, Inc.
7*2e9d4914SAndroid Build Coastguard Worker# Originally written by Fran,cois Pinard <[email protected]>, 1996.
8*2e9d4914SAndroid Build Coastguard Worker
9*2e9d4914SAndroid Build Coastguard Worker# This program is free software; you can redistribute it and/or modify
10*2e9d4914SAndroid Build Coastguard Worker# it under the terms of the GNU General Public License as published by
11*2e9d4914SAndroid Build Coastguard Worker# the Free Software Foundation; either version 2, or (at your option)
12*2e9d4914SAndroid Build Coastguard Worker# any later version.
13*2e9d4914SAndroid Build Coastguard Worker
14*2e9d4914SAndroid Build Coastguard Worker# This program is distributed in the hope that it will be useful,
15*2e9d4914SAndroid Build Coastguard Worker# but WITHOUT ANY WARRANTY; without even the implied warranty of
16*2e9d4914SAndroid Build Coastguard Worker# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17*2e9d4914SAndroid Build Coastguard Worker# GNU General Public License for more details.
18*2e9d4914SAndroid Build Coastguard Worker
19*2e9d4914SAndroid Build Coastguard Worker# You should have received a copy of the GNU General Public License
20*2e9d4914SAndroid Build Coastguard Worker# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21*2e9d4914SAndroid Build Coastguard Worker
22*2e9d4914SAndroid Build Coastguard Worker# As a special exception to the GNU General Public License, if you
23*2e9d4914SAndroid Build Coastguard Worker# distribute this file as part of a program that contains a
24*2e9d4914SAndroid Build Coastguard Worker# configuration script generated by Autoconf, you may include it under
25*2e9d4914SAndroid Build Coastguard Worker# the same distribution terms that you use for the rest of that program.
26*2e9d4914SAndroid Build Coastguard Worker
27*2e9d4914SAndroid Build Coastguard Workerif test $# -eq 0; then
28*2e9d4914SAndroid Build Coastguard Worker  echo 1>&2 "Try '$0 --help' for more information"
29*2e9d4914SAndroid Build Coastguard Worker  exit 1
30*2e9d4914SAndroid Build Coastguard Workerfi
31*2e9d4914SAndroid Build Coastguard Worker
32*2e9d4914SAndroid Build Coastguard Workercase $1 in
33*2e9d4914SAndroid Build Coastguard Worker
34*2e9d4914SAndroid Build Coastguard Worker  --is-lightweight)
35*2e9d4914SAndroid Build Coastguard Worker    # Used by our autoconf macros to check whether the available missing
36*2e9d4914SAndroid Build Coastguard Worker    # script is modern enough.
37*2e9d4914SAndroid Build Coastguard Worker    exit 0
38*2e9d4914SAndroid Build Coastguard Worker    ;;
39*2e9d4914SAndroid Build Coastguard Worker
40*2e9d4914SAndroid Build Coastguard Worker  --run)
41*2e9d4914SAndroid Build Coastguard Worker    # Back-compat with the calling convention used by older automake.
42*2e9d4914SAndroid Build Coastguard Worker    shift
43*2e9d4914SAndroid Build Coastguard Worker    ;;
44*2e9d4914SAndroid Build Coastguard Worker
45*2e9d4914SAndroid Build Coastguard Worker  -h|--h|--he|--hel|--help)
46*2e9d4914SAndroid Build Coastguard Worker    echo "\
47*2e9d4914SAndroid Build Coastguard Worker$0 [OPTION]... PROGRAM [ARGUMENT]...
48*2e9d4914SAndroid Build Coastguard Worker
49*2e9d4914SAndroid Build Coastguard WorkerRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
50*2e9d4914SAndroid Build Coastguard Workerto PROGRAM being missing or too old.
51*2e9d4914SAndroid Build Coastguard Worker
52*2e9d4914SAndroid Build Coastguard WorkerOptions:
53*2e9d4914SAndroid Build Coastguard Worker  -h, --help      display this help and exit
54*2e9d4914SAndroid Build Coastguard Worker  -v, --version   output version information and exit
55*2e9d4914SAndroid Build Coastguard Worker
56*2e9d4914SAndroid Build Coastguard WorkerSupported PROGRAM values:
57*2e9d4914SAndroid Build Coastguard Worker  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
58*2e9d4914SAndroid Build Coastguard Worker  bison     yacc      flex         lex       help2man
59*2e9d4914SAndroid Build Coastguard Worker
60*2e9d4914SAndroid Build Coastguard WorkerVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
61*2e9d4914SAndroid Build Coastguard Worker'g' are ignored when checking the name.
62*2e9d4914SAndroid Build Coastguard Worker
63*2e9d4914SAndroid Build Coastguard WorkerSend bug reports to <[email protected]>."
64*2e9d4914SAndroid Build Coastguard Worker    exit $?
65*2e9d4914SAndroid Build Coastguard Worker    ;;
66*2e9d4914SAndroid Build Coastguard Worker
67*2e9d4914SAndroid Build Coastguard Worker  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
68*2e9d4914SAndroid Build Coastguard Worker    echo "missing $scriptversion (GNU Automake)"
69*2e9d4914SAndroid Build Coastguard Worker    exit $?
70*2e9d4914SAndroid Build Coastguard Worker    ;;
71*2e9d4914SAndroid Build Coastguard Worker
72*2e9d4914SAndroid Build Coastguard Worker  -*)
73*2e9d4914SAndroid Build Coastguard Worker    echo 1>&2 "$0: unknown '$1' option"
74*2e9d4914SAndroid Build Coastguard Worker    echo 1>&2 "Try '$0 --help' for more information"
75*2e9d4914SAndroid Build Coastguard Worker    exit 1
76*2e9d4914SAndroid Build Coastguard Worker    ;;
77*2e9d4914SAndroid Build Coastguard Worker
78*2e9d4914SAndroid Build Coastguard Workeresac
79*2e9d4914SAndroid Build Coastguard Worker
80*2e9d4914SAndroid Build Coastguard Worker# Run the given program, remember its exit status.
81*2e9d4914SAndroid Build Coastguard Worker"$@"; st=$?
82*2e9d4914SAndroid Build Coastguard Worker
83*2e9d4914SAndroid Build Coastguard Worker# If it succeeded, we are done.
84*2e9d4914SAndroid Build Coastguard Workertest $st -eq 0 && exit 0
85*2e9d4914SAndroid Build Coastguard Worker
86*2e9d4914SAndroid Build Coastguard Worker# Also exit now if we it failed (or wasn't found), and '--version' was
87*2e9d4914SAndroid Build Coastguard Worker# passed; such an option is passed most likely to detect whether the
88*2e9d4914SAndroid Build Coastguard Worker# program is present and works.
89*2e9d4914SAndroid Build Coastguard Workercase $2 in --version|--help) exit $st;; esac
90*2e9d4914SAndroid Build Coastguard Worker
91*2e9d4914SAndroid Build Coastguard Worker# Exit code 63 means version mismatch.  This often happens when the user
92*2e9d4914SAndroid Build Coastguard Worker# tries to use an ancient version of a tool on a file that requires a
93*2e9d4914SAndroid Build Coastguard Worker# minimum version.
94*2e9d4914SAndroid Build Coastguard Workerif test $st -eq 63; then
95*2e9d4914SAndroid Build Coastguard Worker  msg="probably too old"
96*2e9d4914SAndroid Build Coastguard Workerelif test $st -eq 127; then
97*2e9d4914SAndroid Build Coastguard Worker  # Program was missing.
98*2e9d4914SAndroid Build Coastguard Worker  msg="missing on your system"
99*2e9d4914SAndroid Build Coastguard Workerelse
100*2e9d4914SAndroid Build Coastguard Worker  # Program was found and executed, but failed.  Give up.
101*2e9d4914SAndroid Build Coastguard Worker  exit $st
102*2e9d4914SAndroid Build Coastguard Workerfi
103*2e9d4914SAndroid Build Coastguard Worker
104*2e9d4914SAndroid Build Coastguard Workerperl_URL=http://www.perl.org/
105*2e9d4914SAndroid Build Coastguard Workerflex_URL=http://flex.sourceforge.net/
106*2e9d4914SAndroid Build Coastguard Workergnu_software_URL=http://www.gnu.org/software
107*2e9d4914SAndroid Build Coastguard Worker
108*2e9d4914SAndroid Build Coastguard Workerprogram_details ()
109*2e9d4914SAndroid Build Coastguard Worker{
110*2e9d4914SAndroid Build Coastguard Worker  case $1 in
111*2e9d4914SAndroid Build Coastguard Worker    aclocal|automake)
112*2e9d4914SAndroid Build Coastguard Worker      echo "The '$1' program is part of the GNU Automake package:"
113*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/automake>"
114*2e9d4914SAndroid Build Coastguard Worker      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
115*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/autoconf>"
116*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/m4/>"
117*2e9d4914SAndroid Build Coastguard Worker      echo "<$perl_URL>"
118*2e9d4914SAndroid Build Coastguard Worker      ;;
119*2e9d4914SAndroid Build Coastguard Worker    autoconf|autom4te|autoheader)
120*2e9d4914SAndroid Build Coastguard Worker      echo "The '$1' program is part of the GNU Autoconf package:"
121*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/autoconf/>"
122*2e9d4914SAndroid Build Coastguard Worker      echo "It also requires GNU m4 and Perl in order to run:"
123*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/m4/>"
124*2e9d4914SAndroid Build Coastguard Worker      echo "<$perl_URL>"
125*2e9d4914SAndroid Build Coastguard Worker      ;;
126*2e9d4914SAndroid Build Coastguard Worker  esac
127*2e9d4914SAndroid Build Coastguard Worker}
128*2e9d4914SAndroid Build Coastguard Worker
129*2e9d4914SAndroid Build Coastguard Workergive_advice ()
130*2e9d4914SAndroid Build Coastguard Worker{
131*2e9d4914SAndroid Build Coastguard Worker  # Normalize program name to check for.
132*2e9d4914SAndroid Build Coastguard Worker  normalized_program=`echo "$1" | sed '
133*2e9d4914SAndroid Build Coastguard Worker    s/^gnu-//; t
134*2e9d4914SAndroid Build Coastguard Worker    s/^gnu//; t
135*2e9d4914SAndroid Build Coastguard Worker    s/^g//; t'`
136*2e9d4914SAndroid Build Coastguard Worker
137*2e9d4914SAndroid Build Coastguard Worker  printf '%s\n' "'$1' is $msg."
138*2e9d4914SAndroid Build Coastguard Worker
139*2e9d4914SAndroid Build Coastguard Worker  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
140*2e9d4914SAndroid Build Coastguard Worker  case $normalized_program in
141*2e9d4914SAndroid Build Coastguard Worker    autoconf*)
142*2e9d4914SAndroid Build Coastguard Worker      echo "You should only need it if you modified 'configure.ac',"
143*2e9d4914SAndroid Build Coastguard Worker      echo "or m4 files included by it."
144*2e9d4914SAndroid Build Coastguard Worker      program_details 'autoconf'
145*2e9d4914SAndroid Build Coastguard Worker      ;;
146*2e9d4914SAndroid Build Coastguard Worker    autoheader*)
147*2e9d4914SAndroid Build Coastguard Worker      echo "You should only need it if you modified 'acconfig.h' or"
148*2e9d4914SAndroid Build Coastguard Worker      echo "$configure_deps."
149*2e9d4914SAndroid Build Coastguard Worker      program_details 'autoheader'
150*2e9d4914SAndroid Build Coastguard Worker      ;;
151*2e9d4914SAndroid Build Coastguard Worker    automake*)
152*2e9d4914SAndroid Build Coastguard Worker      echo "You should only need it if you modified 'Makefile.am' or"
153*2e9d4914SAndroid Build Coastguard Worker      echo "$configure_deps."
154*2e9d4914SAndroid Build Coastguard Worker      program_details 'automake'
155*2e9d4914SAndroid Build Coastguard Worker      ;;
156*2e9d4914SAndroid Build Coastguard Worker    aclocal*)
157*2e9d4914SAndroid Build Coastguard Worker      echo "You should only need it if you modified 'acinclude.m4' or"
158*2e9d4914SAndroid Build Coastguard Worker      echo "$configure_deps."
159*2e9d4914SAndroid Build Coastguard Worker      program_details 'aclocal'
160*2e9d4914SAndroid Build Coastguard Worker      ;;
161*2e9d4914SAndroid Build Coastguard Worker   autom4te*)
162*2e9d4914SAndroid Build Coastguard Worker      echo "You might have modified some maintainer files that require"
163*2e9d4914SAndroid Build Coastguard Worker      echo "the 'autom4te' program to be rebuilt."
164*2e9d4914SAndroid Build Coastguard Worker      program_details 'autom4te'
165*2e9d4914SAndroid Build Coastguard Worker      ;;
166*2e9d4914SAndroid Build Coastguard Worker    bison*|yacc*)
167*2e9d4914SAndroid Build Coastguard Worker      echo "You should only need it if you modified a '.y' file."
168*2e9d4914SAndroid Build Coastguard Worker      echo "You may want to install the GNU Bison package:"
169*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/bison/>"
170*2e9d4914SAndroid Build Coastguard Worker      ;;
171*2e9d4914SAndroid Build Coastguard Worker    lex*|flex*)
172*2e9d4914SAndroid Build Coastguard Worker      echo "You should only need it if you modified a '.l' file."
173*2e9d4914SAndroid Build Coastguard Worker      echo "You may want to install the Fast Lexical Analyzer package:"
174*2e9d4914SAndroid Build Coastguard Worker      echo "<$flex_URL>"
175*2e9d4914SAndroid Build Coastguard Worker      ;;
176*2e9d4914SAndroid Build Coastguard Worker    help2man*)
177*2e9d4914SAndroid Build Coastguard Worker      echo "You should only need it if you modified a dependency" \
178*2e9d4914SAndroid Build Coastguard Worker           "of a man page."
179*2e9d4914SAndroid Build Coastguard Worker      echo "You may want to install the GNU Help2man package:"
180*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/help2man/>"
181*2e9d4914SAndroid Build Coastguard Worker    ;;
182*2e9d4914SAndroid Build Coastguard Worker    makeinfo*)
183*2e9d4914SAndroid Build Coastguard Worker      echo "You should only need it if you modified a '.texi' file, or"
184*2e9d4914SAndroid Build Coastguard Worker      echo "any other file indirectly affecting the aspect of the manual."
185*2e9d4914SAndroid Build Coastguard Worker      echo "You might want to install the Texinfo package:"
186*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/texinfo/>"
187*2e9d4914SAndroid Build Coastguard Worker      echo "The spurious makeinfo call might also be the consequence of"
188*2e9d4914SAndroid Build Coastguard Worker      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
189*2e9d4914SAndroid Build Coastguard Worker      echo "want to install GNU make:"
190*2e9d4914SAndroid Build Coastguard Worker      echo "<$gnu_software_URL/make/>"
191*2e9d4914SAndroid Build Coastguard Worker      ;;
192*2e9d4914SAndroid Build Coastguard Worker    *)
193*2e9d4914SAndroid Build Coastguard Worker      echo "You might have modified some files without having the proper"
194*2e9d4914SAndroid Build Coastguard Worker      echo "tools for further handling them.  Check the 'README' file, it"
195*2e9d4914SAndroid Build Coastguard Worker      echo "often tells you about the needed prerequisites for installing"
196*2e9d4914SAndroid Build Coastguard Worker      echo "this package.  You may also peek at any GNU archive site, in"
197*2e9d4914SAndroid Build Coastguard Worker      echo "case some other package contains this missing '$1' program."
198*2e9d4914SAndroid Build Coastguard Worker      ;;
199*2e9d4914SAndroid Build Coastguard Worker  esac
200*2e9d4914SAndroid Build Coastguard Worker}
201*2e9d4914SAndroid Build Coastguard Worker
202*2e9d4914SAndroid Build Coastguard Workergive_advice "$1" | sed -e '1s/^/WARNING: /' \
203*2e9d4914SAndroid Build Coastguard Worker                       -e '2,$s/^/         /' >&2
204*2e9d4914SAndroid Build Coastguard Worker
205*2e9d4914SAndroid Build Coastguard Worker# Propagate the correct exit status (expected to be 127 for a program
206*2e9d4914SAndroid Build Coastguard Worker# not found, 63 for a program that failed due to version mismatch).
207*2e9d4914SAndroid Build Coastguard Workerexit $st
208*2e9d4914SAndroid Build Coastguard Worker
209*2e9d4914SAndroid Build Coastguard Worker# Local variables:
210*2e9d4914SAndroid Build Coastguard Worker# eval: (add-hook 'write-file-hooks 'time-stamp)
211*2e9d4914SAndroid Build Coastguard Worker# time-stamp-start: "scriptversion="
212*2e9d4914SAndroid Build Coastguard Worker# time-stamp-format: "%:y-%02m-%02d.%02H"
213*2e9d4914SAndroid Build Coastguard Worker# time-stamp-time-zone: "UTC"
214*2e9d4914SAndroid Build Coastguard Worker# time-stamp-end: "; # UTC"
215*2e9d4914SAndroid Build Coastguard Worker# End:
216