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