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