missing revision 533545b5
1264fa531Smrg#! /bin/sh 2533545b5Smrg# Common wrapper for a few potentially missing GNU programs. 3c37a63b8Smrg 4533545b5Smrgscriptversion=2013-10-28.13; # UTC 5c37a63b8Smrg 6533545b5Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 7533545b5Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8264fa531Smrg 9264fa531Smrg# This program is free software; you can redistribute it and/or modify 10264fa531Smrg# it under the terms of the GNU General Public License as published by 11264fa531Smrg# the Free Software Foundation; either version 2, or (at your option) 12264fa531Smrg# any later version. 13264fa531Smrg 14264fa531Smrg# This program is distributed in the hope that it will be useful, 15264fa531Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16264fa531Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17264fa531Smrg# GNU General Public License for more details. 18264fa531Smrg 19264fa531Smrg# You should have received a copy of the GNU General Public License 20c37a63b8Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21264fa531Smrg 22264fa531Smrg# As a special exception to the GNU General Public License, if you 23264fa531Smrg# distribute this file as part of a program that contains a 24264fa531Smrg# configuration script generated by Autoconf, you may include it under 25264fa531Smrg# the same distribution terms that you use for the rest of that program. 26264fa531Smrg 27264fa531Smrgif test $# -eq 0; then 28533545b5Smrg echo 1>&2 "Try '$0 --help' for more information" 29264fa531Smrg exit 1 30264fa531Smrgfi 31264fa531Smrg 32533545b5Smrgcase $1 in 33264fa531Smrg 34533545b5Smrg --is-lightweight) 35533545b5Smrg # Used by our autoconf macros to check whether the available missing 36533545b5Smrg # script is modern enough. 37533545b5Smrg exit 0 38533545b5Smrg ;; 39c37a63b8Smrg 40533545b5Smrg --run) 41533545b5Smrg # Back-compat with the calling convention used by older automake. 42533545b5Smrg shift 43533545b5Smrg ;; 44264fa531Smrg 45264fa531Smrg -h|--h|--he|--hel|--help) 46264fa531Smrg echo "\ 47264fa531Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48264fa531Smrg 49533545b5SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50533545b5Smrgto PROGRAM being missing or too old. 51264fa531Smrg 52264fa531SmrgOptions: 53264fa531Smrg -h, --help display this help and exit 54264fa531Smrg -v, --version output version information and exit 55264fa531Smrg 56264fa531SmrgSupported PROGRAM values: 57533545b5Smrg aclocal autoconf autoheader autom4te automake makeinfo 58533545b5Smrg bison yacc flex lex help2man 59c37a63b8Smrg 60533545b5SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61533545b5Smrg'g' are ignored when checking the name. 62c37a63b8Smrg 63c37a63b8SmrgSend bug reports to <bug-automake@gnu.org>." 64c37a63b8Smrg exit $? 65264fa531Smrg ;; 66264fa531Smrg 67264fa531Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68c37a63b8Smrg echo "missing $scriptversion (GNU Automake)" 69c37a63b8Smrg exit $? 70264fa531Smrg ;; 71264fa531Smrg 72264fa531Smrg -*) 73533545b5Smrg echo 1>&2 "$0: unknown '$1' option" 74533545b5Smrg echo 1>&2 "Try '$0 --help' for more information" 75264fa531Smrg exit 1 76264fa531Smrg ;; 77264fa531Smrg 78c37a63b8Smrgesac 79c37a63b8Smrg 80533545b5Smrg# Run the given program, remember its exit status. 81533545b5Smrg"$@"; st=$? 82533545b5Smrg 83533545b5Smrg# If it succeeded, we are done. 84533545b5Smrgtest $st -eq 0 && exit 0 85533545b5Smrg 86533545b5Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87533545b5Smrg# passed; such an option is passed most likely to detect whether the 88533545b5Smrg# program is present and works. 89533545b5Smrgcase $2 in --version|--help) exit $st;; esac 90533545b5Smrg 91533545b5Smrg# Exit code 63 means version mismatch. This often happens when the user 92533545b5Smrg# tries to use an ancient version of a tool on a file that requires a 93533545b5Smrg# minimum version. 94533545b5Smrgif test $st -eq 63; then 95533545b5Smrg msg="probably too old" 96533545b5Smrgelif test $st -eq 127; then 97533545b5Smrg # Program was missing. 98533545b5Smrg msg="missing on your system" 99533545b5Smrgelse 100533545b5Smrg # Program was found and executed, but failed. Give up. 101533545b5Smrg exit $st 102533545b5Smrgfi 103264fa531Smrg 104533545b5Smrgperl_URL=http://www.perl.org/ 105533545b5Smrgflex_URL=http://flex.sourceforge.net/ 106533545b5Smrggnu_software_URL=http://www.gnu.org/software 107533545b5Smrg 108533545b5Smrgprogram_details () 109533545b5Smrg{ 110533545b5Smrg case $1 in 111533545b5Smrg aclocal|automake) 112533545b5Smrg echo "The '$1' program is part of the GNU Automake package:" 113533545b5Smrg echo "<$gnu_software_URL/automake>" 114533545b5Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115533545b5Smrg echo "<$gnu_software_URL/autoconf>" 116533545b5Smrg echo "<$gnu_software_URL/m4/>" 117533545b5Smrg echo "<$perl_URL>" 118533545b5Smrg ;; 119533545b5Smrg autoconf|autom4te|autoheader) 120533545b5Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121533545b5Smrg echo "<$gnu_software_URL/autoconf/>" 122533545b5Smrg echo "It also requires GNU m4 and Perl in order to run:" 123533545b5Smrg echo "<$gnu_software_URL/m4/>" 124533545b5Smrg echo "<$perl_URL>" 125533545b5Smrg ;; 126533545b5Smrg esac 127533545b5Smrg} 128533545b5Smrg 129533545b5Smrggive_advice () 130533545b5Smrg{ 131533545b5Smrg # Normalize program name to check for. 132533545b5Smrg normalized_program=`echo "$1" | sed ' 133533545b5Smrg s/^gnu-//; t 134533545b5Smrg s/^gnu//; t 135533545b5Smrg s/^g//; t'` 136533545b5Smrg 137533545b5Smrg printf '%s\n' "'$1' is $msg." 138533545b5Smrg 139533545b5Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140533545b5Smrg case $normalized_program in 141533545b5Smrg autoconf*) 142533545b5Smrg echo "You should only need it if you modified 'configure.ac'," 143533545b5Smrg echo "or m4 files included by it." 144533545b5Smrg program_details 'autoconf' 145533545b5Smrg ;; 146533545b5Smrg autoheader*) 147533545b5Smrg echo "You should only need it if you modified 'acconfig.h' or" 148533545b5Smrg echo "$configure_deps." 149533545b5Smrg program_details 'autoheader' 150533545b5Smrg ;; 151533545b5Smrg automake*) 152533545b5Smrg echo "You should only need it if you modified 'Makefile.am' or" 153533545b5Smrg echo "$configure_deps." 154533545b5Smrg program_details 'automake' 155533545b5Smrg ;; 156533545b5Smrg aclocal*) 157533545b5Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158533545b5Smrg echo "$configure_deps." 159533545b5Smrg program_details 'aclocal' 160533545b5Smrg ;; 161533545b5Smrg autom4te*) 162533545b5Smrg echo "You might have modified some maintainer files that require" 163533545b5Smrg echo "the 'autom4te' program to be rebuilt." 164533545b5Smrg program_details 'autom4te' 165533545b5Smrg ;; 166533545b5Smrg bison*|yacc*) 167533545b5Smrg echo "You should only need it if you modified a '.y' file." 168533545b5Smrg echo "You may want to install the GNU Bison package:" 169533545b5Smrg echo "<$gnu_software_URL/bison/>" 170533545b5Smrg ;; 171533545b5Smrg lex*|flex*) 172533545b5Smrg echo "You should only need it if you modified a '.l' file." 173533545b5Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174533545b5Smrg echo "<$flex_URL>" 175533545b5Smrg ;; 176533545b5Smrg help2man*) 177533545b5Smrg echo "You should only need it if you modified a dependency" \ 178533545b5Smrg "of a man page." 179533545b5Smrg echo "You may want to install the GNU Help2man package:" 180533545b5Smrg echo "<$gnu_software_URL/help2man/>" 181533545b5Smrg ;; 182533545b5Smrg makeinfo*) 183533545b5Smrg echo "You should only need it if you modified a '.texi' file, or" 184533545b5Smrg echo "any other file indirectly affecting the aspect of the manual." 185533545b5Smrg echo "You might want to install the Texinfo package:" 186533545b5Smrg echo "<$gnu_software_URL/texinfo/>" 187533545b5Smrg echo "The spurious makeinfo call might also be the consequence of" 188533545b5Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189533545b5Smrg echo "want to install GNU make:" 190533545b5Smrg echo "<$gnu_software_URL/make/>" 191533545b5Smrg ;; 192533545b5Smrg *) 193533545b5Smrg echo "You might have modified some files without having the proper" 194533545b5Smrg echo "tools for further handling them. Check the 'README' file, it" 195533545b5Smrg echo "often tells you about the needed prerequisites for installing" 196533545b5Smrg echo "this package. You may also peek at any GNU archive site, in" 197533545b5Smrg echo "case some other package contains this missing '$1' program." 198533545b5Smrg ;; 199533545b5Smrg esac 200533545b5Smrg} 201533545b5Smrg 202533545b5Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203533545b5Smrg -e '2,$s/^/ /' >&2 204533545b5Smrg 205533545b5Smrg# Propagate the correct exit status (expected to be 127 for a program 206533545b5Smrg# not found, 63 for a program that failed due to version mismatch). 207533545b5Smrgexit $st 208c37a63b8Smrg 209c37a63b8Smrg# Local variables: 210c37a63b8Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211c37a63b8Smrg# time-stamp-start: "scriptversion=" 212c37a63b8Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213c37a63b8Smrg# time-stamp-time-zone: "UTC" 214c37a63b8Smrg# time-stamp-end: "; # UTC" 215c37a63b8Smrg# End: 216