missing revision 14210e8e
1c35d236eSmrg#! /bin/sh 214210e8eSmrg# Common wrapper for a few potentially missing GNU programs. 3c35d236eSmrg 414210e8eSmrgscriptversion=2013-10-28.13; # UTC 5c35d236eSmrg 614210e8eSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 714210e8eSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8c35d236eSmrg 9c35d236eSmrg# This program is free software; you can redistribute it and/or modify 10c35d236eSmrg# it under the terms of the GNU General Public License as published by 11c35d236eSmrg# the Free Software Foundation; either version 2, or (at your option) 12c35d236eSmrg# any later version. 13c35d236eSmrg 14c35d236eSmrg# This program is distributed in the hope that it will be useful, 15c35d236eSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16c35d236eSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17c35d236eSmrg# GNU General Public License for more details. 18c35d236eSmrg 19c35d236eSmrg# You should have received a copy of the GNU General Public License 20518bcf38Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21c35d236eSmrg 22c35d236eSmrg# As a special exception to the GNU General Public License, if you 23c35d236eSmrg# distribute this file as part of a program that contains a 24c35d236eSmrg# configuration script generated by Autoconf, you may include it under 25c35d236eSmrg# the same distribution terms that you use for the rest of that program. 26c35d236eSmrg 27c35d236eSmrgif test $# -eq 0; then 2814210e8eSmrg echo 1>&2 "Try '$0 --help' for more information" 29c35d236eSmrg exit 1 30c35d236eSmrgfi 31c35d236eSmrg 3214210e8eSmrgcase $1 in 33c35d236eSmrg 3414210e8eSmrg --is-lightweight) 3514210e8eSmrg # Used by our autoconf macros to check whether the available missing 3614210e8eSmrg # script is modern enough. 3714210e8eSmrg exit 0 3814210e8eSmrg ;; 39c35d236eSmrg 4014210e8eSmrg --run) 4114210e8eSmrg # Back-compat with the calling convention used by older automake. 4214210e8eSmrg shift 4314210e8eSmrg ;; 44c35d236eSmrg 45c35d236eSmrg -h|--h|--he|--hel|--help) 46c35d236eSmrg echo "\ 47c35d236eSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48c35d236eSmrg 4914210e8eSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5014210e8eSmrgto PROGRAM being missing or too old. 51c35d236eSmrg 52c35d236eSmrgOptions: 53c35d236eSmrg -h, --help display this help and exit 54c35d236eSmrg -v, --version output version information and exit 55c35d236eSmrg 56c35d236eSmrgSupported PROGRAM values: 5714210e8eSmrg aclocal autoconf autoheader autom4te automake makeinfo 5814210e8eSmrg bison yacc flex lex help2man 59c35d236eSmrg 6014210e8eSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6114210e8eSmrg'g' are ignored when checking the name. 62518bcf38Smrg 63c35d236eSmrgSend bug reports to <bug-automake@gnu.org>." 64c35d236eSmrg exit $? 65c35d236eSmrg ;; 66c35d236eSmrg 67c35d236eSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68c35d236eSmrg echo "missing $scriptversion (GNU Automake)" 69c35d236eSmrg exit $? 70c35d236eSmrg ;; 71c35d236eSmrg 72c35d236eSmrg -*) 7314210e8eSmrg echo 1>&2 "$0: unknown '$1' option" 7414210e8eSmrg echo 1>&2 "Try '$0 --help' for more information" 75c35d236eSmrg exit 1 76c35d236eSmrg ;; 77c35d236eSmrg 78c35d236eSmrgesac 79c35d236eSmrg 8014210e8eSmrg# Run the given program, remember its exit status. 8114210e8eSmrg"$@"; st=$? 8214210e8eSmrg 8314210e8eSmrg# If it succeeded, we are done. 8414210e8eSmrgtest $st -eq 0 && exit 0 8514210e8eSmrg 8614210e8eSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 8714210e8eSmrg# passed; such an option is passed most likely to detect whether the 8814210e8eSmrg# program is present and works. 8914210e8eSmrgcase $2 in --version|--help) exit $st;; esac 9014210e8eSmrg 9114210e8eSmrg# Exit code 63 means version mismatch. This often happens when the user 9214210e8eSmrg# tries to use an ancient version of a tool on a file that requires a 9314210e8eSmrg# minimum version. 9414210e8eSmrgif test $st -eq 63; then 9514210e8eSmrg msg="probably too old" 9614210e8eSmrgelif test $st -eq 127; then 9714210e8eSmrg # Program was missing. 9814210e8eSmrg msg="missing on your system" 9914210e8eSmrgelse 10014210e8eSmrg # Program was found and executed, but failed. Give up. 10114210e8eSmrg exit $st 10214210e8eSmrgfi 103c35d236eSmrg 10414210e8eSmrgperl_URL=http://www.perl.org/ 10514210e8eSmrgflex_URL=http://flex.sourceforge.net/ 10614210e8eSmrggnu_software_URL=http://www.gnu.org/software 10714210e8eSmrg 10814210e8eSmrgprogram_details () 10914210e8eSmrg{ 11014210e8eSmrg case $1 in 11114210e8eSmrg aclocal|automake) 11214210e8eSmrg echo "The '$1' program is part of the GNU Automake package:" 11314210e8eSmrg echo "<$gnu_software_URL/automake>" 11414210e8eSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11514210e8eSmrg echo "<$gnu_software_URL/autoconf>" 11614210e8eSmrg echo "<$gnu_software_URL/m4/>" 11714210e8eSmrg echo "<$perl_URL>" 11814210e8eSmrg ;; 11914210e8eSmrg autoconf|autom4te|autoheader) 12014210e8eSmrg echo "The '$1' program is part of the GNU Autoconf package:" 12114210e8eSmrg echo "<$gnu_software_URL/autoconf/>" 12214210e8eSmrg echo "It also requires GNU m4 and Perl in order to run:" 12314210e8eSmrg echo "<$gnu_software_URL/m4/>" 12414210e8eSmrg echo "<$perl_URL>" 12514210e8eSmrg ;; 12614210e8eSmrg esac 12714210e8eSmrg} 12814210e8eSmrg 12914210e8eSmrggive_advice () 13014210e8eSmrg{ 13114210e8eSmrg # Normalize program name to check for. 13214210e8eSmrg normalized_program=`echo "$1" | sed ' 13314210e8eSmrg s/^gnu-//; t 13414210e8eSmrg s/^gnu//; t 13514210e8eSmrg s/^g//; t'` 13614210e8eSmrg 13714210e8eSmrg printf '%s\n' "'$1' is $msg." 13814210e8eSmrg 13914210e8eSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14014210e8eSmrg case $normalized_program in 14114210e8eSmrg autoconf*) 14214210e8eSmrg echo "You should only need it if you modified 'configure.ac'," 14314210e8eSmrg echo "or m4 files included by it." 14414210e8eSmrg program_details 'autoconf' 14514210e8eSmrg ;; 14614210e8eSmrg autoheader*) 14714210e8eSmrg echo "You should only need it if you modified 'acconfig.h' or" 14814210e8eSmrg echo "$configure_deps." 14914210e8eSmrg program_details 'autoheader' 15014210e8eSmrg ;; 15114210e8eSmrg automake*) 15214210e8eSmrg echo "You should only need it if you modified 'Makefile.am' or" 15314210e8eSmrg echo "$configure_deps." 15414210e8eSmrg program_details 'automake' 15514210e8eSmrg ;; 15614210e8eSmrg aclocal*) 15714210e8eSmrg echo "You should only need it if you modified 'acinclude.m4' or" 15814210e8eSmrg echo "$configure_deps." 15914210e8eSmrg program_details 'aclocal' 16014210e8eSmrg ;; 16114210e8eSmrg autom4te*) 16214210e8eSmrg echo "You might have modified some maintainer files that require" 16314210e8eSmrg echo "the 'autom4te' program to be rebuilt." 16414210e8eSmrg program_details 'autom4te' 16514210e8eSmrg ;; 16614210e8eSmrg bison*|yacc*) 16714210e8eSmrg echo "You should only need it if you modified a '.y' file." 16814210e8eSmrg echo "You may want to install the GNU Bison package:" 16914210e8eSmrg echo "<$gnu_software_URL/bison/>" 17014210e8eSmrg ;; 17114210e8eSmrg lex*|flex*) 17214210e8eSmrg echo "You should only need it if you modified a '.l' file." 17314210e8eSmrg echo "You may want to install the Fast Lexical Analyzer package:" 17414210e8eSmrg echo "<$flex_URL>" 17514210e8eSmrg ;; 17614210e8eSmrg help2man*) 17714210e8eSmrg echo "You should only need it if you modified a dependency" \ 17814210e8eSmrg "of a man page." 17914210e8eSmrg echo "You may want to install the GNU Help2man package:" 18014210e8eSmrg echo "<$gnu_software_URL/help2man/>" 181c35d236eSmrg ;; 18214210e8eSmrg makeinfo*) 18314210e8eSmrg echo "You should only need it if you modified a '.texi' file, or" 18414210e8eSmrg echo "any other file indirectly affecting the aspect of the manual." 18514210e8eSmrg echo "You might want to install the Texinfo package:" 18614210e8eSmrg echo "<$gnu_software_URL/texinfo/>" 18714210e8eSmrg echo "The spurious makeinfo call might also be the consequence of" 18814210e8eSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18914210e8eSmrg echo "want to install GNU make:" 19014210e8eSmrg echo "<$gnu_software_URL/make/>" 19114210e8eSmrg ;; 19214210e8eSmrg *) 19314210e8eSmrg echo "You might have modified some files without having the proper" 19414210e8eSmrg echo "tools for further handling them. Check the 'README' file, it" 19514210e8eSmrg echo "often tells you about the needed prerequisites for installing" 19614210e8eSmrg echo "this package. You may also peek at any GNU archive site, in" 19714210e8eSmrg echo "case some other package contains this missing '$1' program." 19814210e8eSmrg ;; 19914210e8eSmrg esac 20014210e8eSmrg} 20114210e8eSmrg 20214210e8eSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20314210e8eSmrg -e '2,$s/^/ /' >&2 20414210e8eSmrg 20514210e8eSmrg# Propagate the correct exit status (expected to be 127 for a program 20614210e8eSmrg# not found, 63 for a program that failed due to version mismatch). 20714210e8eSmrgexit $st 208c35d236eSmrg 209c35d236eSmrg# Local variables: 210c35d236eSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211c35d236eSmrg# time-stamp-start: "scriptversion=" 212c35d236eSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213518bcf38Smrg# time-stamp-time-zone: "UTC" 214518bcf38Smrg# time-stamp-end: "; # UTC" 215c35d236eSmrg# End: 216