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