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