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