14fee23f9Smrg#! /bin/sh 2*4d5abbe8Smrg# Common wrapper for a few potentially missing GNU programs. 34fee23f9Smrg 4*4d5abbe8Smrgscriptversion=2013-10-28.13; # UTC 54fee23f9Smrg 6*4d5abbe8Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 7*4d5abbe8Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 84fee23f9Smrg 94fee23f9Smrg# This program is free software; you can redistribute it and/or modify 104fee23f9Smrg# it under the terms of the GNU General Public License as published by 114fee23f9Smrg# the Free Software Foundation; either version 2, or (at your option) 124fee23f9Smrg# any later version. 134fee23f9Smrg 144fee23f9Smrg# This program is distributed in the hope that it will be useful, 154fee23f9Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 164fee23f9Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 174fee23f9Smrg# GNU General Public License for more details. 184fee23f9Smrg 194fee23f9Smrg# You should have received a copy of the GNU General Public License 204fee23f9Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 214fee23f9Smrg 224fee23f9Smrg# As a special exception to the GNU General Public License, if you 234fee23f9Smrg# distribute this file as part of a program that contains a 244fee23f9Smrg# configuration script generated by Autoconf, you may include it under 254fee23f9Smrg# the same distribution terms that you use for the rest of that program. 264fee23f9Smrg 274fee23f9Smrgif test $# -eq 0; then 28*4d5abbe8Smrg echo 1>&2 "Try '$0 --help' for more information" 294fee23f9Smrg exit 1 304fee23f9Smrgfi 314fee23f9Smrg 324fee23f9Smrgcase $1 in 33*4d5abbe8Smrg 34*4d5abbe8Smrg --is-lightweight) 35*4d5abbe8Smrg # Used by our autoconf macros to check whether the available missing 36*4d5abbe8Smrg # script is modern enough. 37*4d5abbe8Smrg exit 0 38*4d5abbe8Smrg ;; 39*4d5abbe8Smrg 404fee23f9Smrg --run) 41*4d5abbe8Smrg # Back-compat with the calling convention used by older automake. 424fee23f9Smrg shift 434fee23f9Smrg ;; 444fee23f9Smrg 454fee23f9Smrg -h|--h|--he|--hel|--help) 464fee23f9Smrg echo "\ 474fee23f9Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 484fee23f9Smrg 49*4d5abbe8SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50*4d5abbe8Smrgto PROGRAM being missing or too old. 514fee23f9Smrg 524fee23f9SmrgOptions: 534fee23f9Smrg -h, --help display this help and exit 544fee23f9Smrg -v, --version output version information and exit 554fee23f9Smrg 564fee23f9SmrgSupported PROGRAM values: 57*4d5abbe8Smrg aclocal autoconf autoheader autom4te automake makeinfo 58*4d5abbe8Smrg bison yacc flex lex help2man 594fee23f9Smrg 60*4d5abbe8SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61*4d5abbe8Smrg'g' are ignored when checking the name. 624fee23f9Smrg 634fee23f9SmrgSend bug reports to <bug-automake@gnu.org>." 644fee23f9Smrg exit $? 654fee23f9Smrg ;; 664fee23f9Smrg 674fee23f9Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 684fee23f9Smrg echo "missing $scriptversion (GNU Automake)" 694fee23f9Smrg exit $? 704fee23f9Smrg ;; 714fee23f9Smrg 724fee23f9Smrg -*) 73*4d5abbe8Smrg echo 1>&2 "$0: unknown '$1' option" 74*4d5abbe8Smrg echo 1>&2 "Try '$0 --help' for more information" 754fee23f9Smrg exit 1 764fee23f9Smrg ;; 774fee23f9Smrg 784fee23f9Smrgesac 794fee23f9Smrg 80*4d5abbe8Smrg# Run the given program, remember its exit status. 81*4d5abbe8Smrg"$@"; st=$? 82*4d5abbe8Smrg 83*4d5abbe8Smrg# If it succeeded, we are done. 84*4d5abbe8Smrgtest $st -eq 0 && exit 0 85*4d5abbe8Smrg 86*4d5abbe8Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87*4d5abbe8Smrg# passed; such an option is passed most likely to detect whether the 88*4d5abbe8Smrg# program is present and works. 89*4d5abbe8Smrgcase $2 in --version|--help) exit $st;; esac 90*4d5abbe8Smrg 91*4d5abbe8Smrg# Exit code 63 means version mismatch. This often happens when the user 92*4d5abbe8Smrg# tries to use an ancient version of a tool on a file that requires a 93*4d5abbe8Smrg# minimum version. 94*4d5abbe8Smrgif test $st -eq 63; then 95*4d5abbe8Smrg msg="probably too old" 96*4d5abbe8Smrgelif test $st -eq 127; then 97*4d5abbe8Smrg # Program was missing. 98*4d5abbe8Smrg msg="missing on your system" 99*4d5abbe8Smrgelse 100*4d5abbe8Smrg # Program was found and executed, but failed. Give up. 101*4d5abbe8Smrg exit $st 102*4d5abbe8Smrgfi 103*4d5abbe8Smrg 104*4d5abbe8Smrgperl_URL=http://www.perl.org/ 105*4d5abbe8Smrgflex_URL=http://flex.sourceforge.net/ 106*4d5abbe8Smrggnu_software_URL=http://www.gnu.org/software 107*4d5abbe8Smrg 108*4d5abbe8Smrgprogram_details () 109*4d5abbe8Smrg{ 110*4d5abbe8Smrg case $1 in 111*4d5abbe8Smrg aclocal|automake) 112*4d5abbe8Smrg echo "The '$1' program is part of the GNU Automake package:" 113*4d5abbe8Smrg echo "<$gnu_software_URL/automake>" 114*4d5abbe8Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115*4d5abbe8Smrg echo "<$gnu_software_URL/autoconf>" 116*4d5abbe8Smrg echo "<$gnu_software_URL/m4/>" 117*4d5abbe8Smrg echo "<$perl_URL>" 118*4d5abbe8Smrg ;; 119*4d5abbe8Smrg autoconf|autom4te|autoheader) 120*4d5abbe8Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121*4d5abbe8Smrg echo "<$gnu_software_URL/autoconf/>" 122*4d5abbe8Smrg echo "It also requires GNU m4 and Perl in order to run:" 123*4d5abbe8Smrg echo "<$gnu_software_URL/m4/>" 124*4d5abbe8Smrg echo "<$perl_URL>" 125*4d5abbe8Smrg ;; 126*4d5abbe8Smrg esac 127*4d5abbe8Smrg} 128*4d5abbe8Smrg 129*4d5abbe8Smrggive_advice () 130*4d5abbe8Smrg{ 131*4d5abbe8Smrg # Normalize program name to check for. 132*4d5abbe8Smrg normalized_program=`echo "$1" | sed ' 1334fee23f9Smrg s/^gnu-//; t 1344fee23f9Smrg s/^gnu//; t 1354fee23f9Smrg s/^g//; t'` 1364fee23f9Smrg 137*4d5abbe8Smrg printf '%s\n' "'$1' is $msg." 1384fee23f9Smrg 139*4d5abbe8Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140*4d5abbe8Smrg case $normalized_program in 1414fee23f9Smrg autoconf*) 142*4d5abbe8Smrg echo "You should only need it if you modified 'configure.ac'," 143*4d5abbe8Smrg echo "or m4 files included by it." 144*4d5abbe8Smrg program_details 'autoconf' 1454fee23f9Smrg ;; 1464fee23f9Smrg autoheader*) 147*4d5abbe8Smrg echo "You should only need it if you modified 'acconfig.h' or" 148*4d5abbe8Smrg echo "$configure_deps." 149*4d5abbe8Smrg program_details 'autoheader' 1504fee23f9Smrg ;; 1514fee23f9Smrg automake*) 152*4d5abbe8Smrg echo "You should only need it if you modified 'Makefile.am' or" 153*4d5abbe8Smrg echo "$configure_deps." 154*4d5abbe8Smrg program_details 'automake' 1554fee23f9Smrg ;; 156*4d5abbe8Smrg aclocal*) 157*4d5abbe8Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158*4d5abbe8Smrg echo "$configure_deps." 159*4d5abbe8Smrg program_details 'aclocal' 160*4d5abbe8Smrg ;; 1614fee23f9Smrg autom4te*) 162*4d5abbe8Smrg echo "You might have modified some maintainer files that require" 163*4d5abbe8Smrg echo "the 'autom4te' program to be rebuilt." 164*4d5abbe8Smrg program_details 'autom4te' 1654fee23f9Smrg ;; 1664fee23f9Smrg bison*|yacc*) 167*4d5abbe8Smrg echo "You should only need it if you modified a '.y' file." 168*4d5abbe8Smrg echo "You may want to install the GNU Bison package:" 169*4d5abbe8Smrg echo "<$gnu_software_URL/bison/>" 1704fee23f9Smrg ;; 1714fee23f9Smrg lex*|flex*) 172*4d5abbe8Smrg echo "You should only need it if you modified a '.l' file." 173*4d5abbe8Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174*4d5abbe8Smrg echo "<$flex_URL>" 1754fee23f9Smrg ;; 1764fee23f9Smrg help2man*) 177*4d5abbe8Smrg echo "You should only need it if you modified a dependency" \ 178*4d5abbe8Smrg "of a man page." 179*4d5abbe8Smrg echo "You may want to install the GNU Help2man package:" 180*4d5abbe8Smrg echo "<$gnu_software_URL/help2man/>" 1814fee23f9Smrg ;; 1824fee23f9Smrg makeinfo*) 183*4d5abbe8Smrg echo "You should only need it if you modified a '.texi' file, or" 184*4d5abbe8Smrg echo "any other file indirectly affecting the aspect of the manual." 185*4d5abbe8Smrg echo "You might want to install the Texinfo package:" 186*4d5abbe8Smrg echo "<$gnu_software_URL/texinfo/>" 187*4d5abbe8Smrg echo "The spurious makeinfo call might also be the consequence of" 188*4d5abbe8Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189*4d5abbe8Smrg echo "want to install GNU make:" 190*4d5abbe8Smrg echo "<$gnu_software_URL/make/>" 1914fee23f9Smrg ;; 1924fee23f9Smrg *) 193*4d5abbe8Smrg echo "You might have modified some files without having the proper" 194*4d5abbe8Smrg echo "tools for further handling them. Check the 'README' file, it" 195*4d5abbe8Smrg echo "often tells you about the needed prerequisites for installing" 196*4d5abbe8Smrg echo "this package. You may also peek at any GNU archive site, in" 197*4d5abbe8Smrg echo "case some other package contains this missing '$1' program." 1984fee23f9Smrg ;; 1994fee23f9Smrg esac 200*4d5abbe8Smrg} 2014fee23f9Smrg 202*4d5abbe8Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203*4d5abbe8Smrg -e '2,$s/^/ /' >&2 204*4d5abbe8Smrg 205*4d5abbe8Smrg# Propagate the correct exit status (expected to be 127 for a program 206*4d5abbe8Smrg# not found, 63 for a program that failed due to version mismatch). 207*4d5abbe8Smrgexit $st 2084fee23f9Smrg 2094fee23f9Smrg# Local variables: 2104fee23f9Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 2114fee23f9Smrg# time-stamp-start: "scriptversion=" 2124fee23f9Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2134fee23f9Smrg# time-stamp-time-zone: "UTC" 2144fee23f9Smrg# time-stamp-end: "; # UTC" 2154fee23f9Smrg# End: 216