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