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