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