missing revision 0d16fef4
1de2362d3Smrg#! /bin/sh 20d16fef4Smrg# Common wrapper for a few potentially missing GNU programs. 3de2362d3Smrg 40d16fef4Smrgscriptversion=2013-10-28.13; # UTC 5de2362d3Smrg 60d16fef4Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 70d16fef4Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8de2362d3Smrg 9de2362d3Smrg# This program is free software; you can redistribute it and/or modify 10de2362d3Smrg# it under the terms of the GNU General Public License as published by 11de2362d3Smrg# the Free Software Foundation; either version 2, or (at your option) 12de2362d3Smrg# any later version. 13de2362d3Smrg 14de2362d3Smrg# This program is distributed in the hope that it will be useful, 15de2362d3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16de2362d3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17de2362d3Smrg# GNU General Public License for more details. 18de2362d3Smrg 19de2362d3Smrg# You should have received a copy of the GNU General Public License 200d16fef4Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21de2362d3Smrg 22de2362d3Smrg# As a special exception to the GNU General Public License, if you 23de2362d3Smrg# distribute this file as part of a program that contains a 24de2362d3Smrg# configuration script generated by Autoconf, you may include it under 25de2362d3Smrg# the same distribution terms that you use for the rest of that program. 26de2362d3Smrg 27de2362d3Smrgif test $# -eq 0; then 280d16fef4Smrg echo 1>&2 "Try '$0 --help' for more information" 29de2362d3Smrg exit 1 30de2362d3Smrgfi 31de2362d3Smrg 320d16fef4Smrgcase $1 in 33de2362d3Smrg 340d16fef4Smrg --is-lightweight) 350d16fef4Smrg # Used by our autoconf macros to check whether the available missing 360d16fef4Smrg # script is modern enough. 370d16fef4Smrg exit 0 380d16fef4Smrg ;; 39de2362d3Smrg 400d16fef4Smrg --run) 410d16fef4Smrg # Back-compat with the calling convention used by older automake. 420d16fef4Smrg shift 430d16fef4Smrg ;; 44de2362d3Smrg 45de2362d3Smrg -h|--h|--he|--hel|--help) 46de2362d3Smrg echo "\ 47de2362d3Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48de2362d3Smrg 490d16fef4SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 500d16fef4Smrgto PROGRAM being missing or too old. 51de2362d3Smrg 52de2362d3SmrgOptions: 53de2362d3Smrg -h, --help display this help and exit 54de2362d3Smrg -v, --version output version information and exit 55de2362d3Smrg 56de2362d3SmrgSupported PROGRAM values: 570d16fef4Smrg aclocal autoconf autoheader autom4te automake makeinfo 580d16fef4Smrg bison yacc flex lex help2man 590d16fef4Smrg 600d16fef4SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 610d16fef4Smrg'g' are ignored when checking the name. 62de2362d3Smrg 63de2362d3SmrgSend bug reports to <bug-automake@gnu.org>." 64de2362d3Smrg exit $? 65de2362d3Smrg ;; 66de2362d3Smrg 67de2362d3Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68de2362d3Smrg echo "missing $scriptversion (GNU Automake)" 69de2362d3Smrg exit $? 70de2362d3Smrg ;; 71de2362d3Smrg 72de2362d3Smrg -*) 730d16fef4Smrg echo 1>&2 "$0: unknown '$1' option" 740d16fef4Smrg echo 1>&2 "Try '$0 --help' for more information" 75de2362d3Smrg exit 1 76de2362d3Smrg ;; 77de2362d3Smrg 78de2362d3Smrgesac 79de2362d3Smrg 800d16fef4Smrg# Run the given program, remember its exit status. 810d16fef4Smrg"$@"; st=$? 820d16fef4Smrg 830d16fef4Smrg# If it succeeded, we are done. 840d16fef4Smrgtest $st -eq 0 && exit 0 850d16fef4Smrg 860d16fef4Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 870d16fef4Smrg# passed; such an option is passed most likely to detect whether the 880d16fef4Smrg# program is present and works. 890d16fef4Smrgcase $2 in --version|--help) exit $st;; esac 900d16fef4Smrg 910d16fef4Smrg# Exit code 63 means version mismatch. This often happens when the user 920d16fef4Smrg# tries to use an ancient version of a tool on a file that requires a 930d16fef4Smrg# minimum version. 940d16fef4Smrgif test $st -eq 63; then 950d16fef4Smrg msg="probably too old" 960d16fef4Smrgelif test $st -eq 127; then 970d16fef4Smrg # Program was missing. 980d16fef4Smrg msg="missing on your system" 990d16fef4Smrgelse 1000d16fef4Smrg # Program was found and executed, but failed. Give up. 1010d16fef4Smrg exit $st 1020d16fef4Smrgfi 103de2362d3Smrg 1040d16fef4Smrgperl_URL=http://www.perl.org/ 1050d16fef4Smrgflex_URL=http://flex.sourceforge.net/ 1060d16fef4Smrggnu_software_URL=http://www.gnu.org/software 1070d16fef4Smrg 1080d16fef4Smrgprogram_details () 1090d16fef4Smrg{ 1100d16fef4Smrg case $1 in 1110d16fef4Smrg aclocal|automake) 1120d16fef4Smrg echo "The '$1' program is part of the GNU Automake package:" 1130d16fef4Smrg echo "<$gnu_software_URL/automake>" 1140d16fef4Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1150d16fef4Smrg echo "<$gnu_software_URL/autoconf>" 1160d16fef4Smrg echo "<$gnu_software_URL/m4/>" 1170d16fef4Smrg echo "<$perl_URL>" 1180d16fef4Smrg ;; 1190d16fef4Smrg autoconf|autom4te|autoheader) 1200d16fef4Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1210d16fef4Smrg echo "<$gnu_software_URL/autoconf/>" 1220d16fef4Smrg echo "It also requires GNU m4 and Perl in order to run:" 1230d16fef4Smrg echo "<$gnu_software_URL/m4/>" 1240d16fef4Smrg echo "<$perl_URL>" 1250d16fef4Smrg ;; 1260d16fef4Smrg esac 1270d16fef4Smrg} 1280d16fef4Smrg 1290d16fef4Smrggive_advice () 1300d16fef4Smrg{ 1310d16fef4Smrg # Normalize program name to check for. 1320d16fef4Smrg normalized_program=`echo "$1" | sed ' 1330d16fef4Smrg s/^gnu-//; t 1340d16fef4Smrg s/^gnu//; t 1350d16fef4Smrg s/^g//; t'` 1360d16fef4Smrg 1370d16fef4Smrg printf '%s\n' "'$1' is $msg." 1380d16fef4Smrg 1390d16fef4Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1400d16fef4Smrg case $normalized_program in 1410d16fef4Smrg autoconf*) 1420d16fef4Smrg echo "You should only need it if you modified 'configure.ac'," 1430d16fef4Smrg echo "or m4 files included by it." 1440d16fef4Smrg program_details 'autoconf' 1450d16fef4Smrg ;; 1460d16fef4Smrg autoheader*) 1470d16fef4Smrg echo "You should only need it if you modified 'acconfig.h' or" 1480d16fef4Smrg echo "$configure_deps." 1490d16fef4Smrg program_details 'autoheader' 1500d16fef4Smrg ;; 1510d16fef4Smrg automake*) 1520d16fef4Smrg echo "You should only need it if you modified 'Makefile.am' or" 1530d16fef4Smrg echo "$configure_deps." 1540d16fef4Smrg program_details 'automake' 1550d16fef4Smrg ;; 1560d16fef4Smrg aclocal*) 1570d16fef4Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1580d16fef4Smrg echo "$configure_deps." 1590d16fef4Smrg program_details 'aclocal' 1600d16fef4Smrg ;; 1610d16fef4Smrg autom4te*) 1620d16fef4Smrg echo "You might have modified some maintainer files that require" 1630d16fef4Smrg echo "the 'autom4te' program to be rebuilt." 1640d16fef4Smrg program_details 'autom4te' 1650d16fef4Smrg ;; 1660d16fef4Smrg bison*|yacc*) 1670d16fef4Smrg echo "You should only need it if you modified a '.y' file." 1680d16fef4Smrg echo "You may want to install the GNU Bison package:" 1690d16fef4Smrg echo "<$gnu_software_URL/bison/>" 1700d16fef4Smrg ;; 1710d16fef4Smrg lex*|flex*) 1720d16fef4Smrg echo "You should only need it if you modified a '.l' file." 1730d16fef4Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1740d16fef4Smrg echo "<$flex_URL>" 1750d16fef4Smrg ;; 1760d16fef4Smrg help2man*) 1770d16fef4Smrg echo "You should only need it if you modified a dependency" \ 1780d16fef4Smrg "of a man page." 1790d16fef4Smrg echo "You may want to install the GNU Help2man package:" 1800d16fef4Smrg echo "<$gnu_software_URL/help2man/>" 1810d16fef4Smrg ;; 1820d16fef4Smrg makeinfo*) 1830d16fef4Smrg echo "You should only need it if you modified a '.texi' file, or" 1840d16fef4Smrg echo "any other file indirectly affecting the aspect of the manual." 1850d16fef4Smrg echo "You might want to install the Texinfo package:" 1860d16fef4Smrg echo "<$gnu_software_URL/texinfo/>" 1870d16fef4Smrg echo "The spurious makeinfo call might also be the consequence of" 1880d16fef4Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1890d16fef4Smrg echo "want to install GNU make:" 1900d16fef4Smrg echo "<$gnu_software_URL/make/>" 1910d16fef4Smrg ;; 1920d16fef4Smrg *) 1930d16fef4Smrg echo "You might have modified some files without having the proper" 1940d16fef4Smrg echo "tools for further handling them. Check the 'README' file, it" 1950d16fef4Smrg echo "often tells you about the needed prerequisites for installing" 1960d16fef4Smrg echo "this package. You may also peek at any GNU archive site, in" 1970d16fef4Smrg echo "case some other package contains this missing '$1' program." 1980d16fef4Smrg ;; 1990d16fef4Smrg esac 2000d16fef4Smrg} 2010d16fef4Smrg 2020d16fef4Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2030d16fef4Smrg -e '2,$s/^/ /' >&2 2040d16fef4Smrg 2050d16fef4Smrg# Propagate the correct exit status (expected to be 127 for a program 2060d16fef4Smrg# not found, 63 for a program that failed due to version mismatch). 2070d16fef4Smrgexit $st 208de2362d3Smrg 209de2362d3Smrg# Local variables: 210de2362d3Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211de2362d3Smrg# time-stamp-start: "scriptversion=" 212de2362d3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2130d16fef4Smrg# time-stamp-time-zone: "UTC" 2140d16fef4Smrg# time-stamp-end: "; # UTC" 215de2362d3Smrg# End: 216