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