missing revision 1bedbe3f
1ba6a1819Smrg#! /bin/sh 21bedbe3fSmrg# Common wrapper for a few potentially missing GNU programs. 3ba6a1819Smrg 41bedbe3fSmrgscriptversion=2012-06-26.16; # UTC 5ba6a1819Smrg 61bedbe3fSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 71bedbe3fSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8ba6a1819Smrg 9ba6a1819Smrg# This program is free software; you can redistribute it and/or modify 10ba6a1819Smrg# it under the terms of the GNU General Public License as published by 11ba6a1819Smrg# the Free Software Foundation; either version 2, or (at your option) 12ba6a1819Smrg# any later version. 13ba6a1819Smrg 14ba6a1819Smrg# This program is distributed in the hope that it will be useful, 15ba6a1819Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16ba6a1819Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17ba6a1819Smrg# GNU General Public License for more details. 18ba6a1819Smrg 19ba6a1819Smrg# You should have received a copy of the GNU General Public License 20549e21daSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21ba6a1819Smrg 22ba6a1819Smrg# As a special exception to the GNU General Public License, if you 23ba6a1819Smrg# distribute this file as part of a program that contains a 24ba6a1819Smrg# configuration script generated by Autoconf, you may include it under 25ba6a1819Smrg# the same distribution terms that you use for the rest of that program. 26ba6a1819Smrg 27ba6a1819Smrgif test $# -eq 0; then 281bedbe3fSmrg echo 1>&2 "Try '$0 --help' for more information" 29ba6a1819Smrg exit 1 30ba6a1819Smrgfi 31ba6a1819Smrg 321bedbe3fSmrgcase $1 in 33ba6a1819Smrg 341bedbe3fSmrg --is-lightweight) 351bedbe3fSmrg # Used by our autoconf macros to check whether the available missing 361bedbe3fSmrg # script is modern enough. 371bedbe3fSmrg exit 0 381bedbe3fSmrg ;; 39ba6a1819Smrg 401bedbe3fSmrg --run) 411bedbe3fSmrg # Back-compat with the calling convention used by older automake. 421bedbe3fSmrg shift 431bedbe3fSmrg ;; 44ba6a1819Smrg 45ba6a1819Smrg -h|--h|--he|--hel|--help) 46ba6a1819Smrg echo "\ 47ba6a1819Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48ba6a1819Smrg 491bedbe3fSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 501bedbe3fSmrgto PROGRAM being missing or too old. 51ba6a1819Smrg 52ba6a1819SmrgOptions: 53ba6a1819Smrg -h, --help display this help and exit 54ba6a1819Smrg -v, --version output version information and exit 55ba6a1819Smrg 56ba6a1819SmrgSupported PROGRAM values: 571bedbe3fSmrg aclocal autoconf autoheader autom4te automake makeinfo 581bedbe3fSmrg bison yacc flex lex help2man 59ba6a1819Smrg 601bedbe3fSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 611bedbe3fSmrg'g' are ignored when checking the name. 62549e21daSmrg 63ba6a1819SmrgSend bug reports to <bug-automake@gnu.org>." 64ba6a1819Smrg exit $? 65ba6a1819Smrg ;; 66ba6a1819Smrg 67ba6a1819Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68ba6a1819Smrg echo "missing $scriptversion (GNU Automake)" 69ba6a1819Smrg exit $? 70ba6a1819Smrg ;; 71ba6a1819Smrg 72ba6a1819Smrg -*) 731bedbe3fSmrg echo 1>&2 "$0: unknown '$1' option" 741bedbe3fSmrg echo 1>&2 "Try '$0 --help' for more information" 75ba6a1819Smrg exit 1 76ba6a1819Smrg ;; 77ba6a1819Smrg 78ba6a1819Smrgesac 79ba6a1819Smrg 801bedbe3fSmrg# Run the given program, remember its exit status. 811bedbe3fSmrg"$@"; st=$? 821bedbe3fSmrg 831bedbe3fSmrg# If it succeeded, we are done. 841bedbe3fSmrgtest $st -eq 0 && exit 0 851bedbe3fSmrg 861bedbe3fSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 871bedbe3fSmrg# passed; such an option is passed most likely to detect whether the 881bedbe3fSmrg# program is present and works. 891bedbe3fSmrgcase $2 in --version|--help) exit $st;; esac 901bedbe3fSmrg 911bedbe3fSmrg# Exit code 63 means version mismatch. This often happens when the user 921bedbe3fSmrg# tries to use an ancient version of a tool on a file that requires a 931bedbe3fSmrg# minimum version. 941bedbe3fSmrgif test $st -eq 63; then 951bedbe3fSmrg msg="probably too old" 961bedbe3fSmrgelif test $st -eq 127; then 971bedbe3fSmrg # Program was missing. 981bedbe3fSmrg msg="missing on your system" 991bedbe3fSmrgelse 1001bedbe3fSmrg # Program was found and executed, but failed. Give up. 1011bedbe3fSmrg exit $st 1021bedbe3fSmrgfi 103ba6a1819Smrg 1041bedbe3fSmrgperl_URL=http://www.perl.org/ 1051bedbe3fSmrgflex_URL=http://flex.sourceforge.net/ 1061bedbe3fSmrggnu_software_URL=http://www.gnu.org/software 1071bedbe3fSmrg 1081bedbe3fSmrgprogram_details () 1091bedbe3fSmrg{ 1101bedbe3fSmrg case $1 in 1111bedbe3fSmrg aclocal|automake) 1121bedbe3fSmrg echo "The '$1' program is part of the GNU Automake package:" 1131bedbe3fSmrg echo "<$gnu_software_URL/automake>" 1141bedbe3fSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1151bedbe3fSmrg echo "<$gnu_software_URL/autoconf>" 1161bedbe3fSmrg echo "<$gnu_software_URL/m4/>" 1171bedbe3fSmrg echo "<$perl_URL>" 1181bedbe3fSmrg ;; 1191bedbe3fSmrg autoconf|autom4te|autoheader) 1201bedbe3fSmrg echo "The '$1' program is part of the GNU Autoconf package:" 1211bedbe3fSmrg echo "<$gnu_software_URL/autoconf/>" 1221bedbe3fSmrg echo "It also requires GNU m4 and Perl in order to run:" 1231bedbe3fSmrg echo "<$gnu_software_URL/m4/>" 1241bedbe3fSmrg echo "<$perl_URL>" 1251bedbe3fSmrg ;; 1261bedbe3fSmrg esac 1271bedbe3fSmrg} 1281bedbe3fSmrg 1291bedbe3fSmrggive_advice () 1301bedbe3fSmrg{ 1311bedbe3fSmrg # Normalize program name to check for. 1321bedbe3fSmrg normalized_program=`echo "$1" | sed ' 1331bedbe3fSmrg s/^gnu-//; t 1341bedbe3fSmrg s/^gnu//; t 1351bedbe3fSmrg s/^g//; t'` 1361bedbe3fSmrg 1371bedbe3fSmrg printf '%s\n' "'$1' is $msg." 1381bedbe3fSmrg 1391bedbe3fSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1401bedbe3fSmrg case $normalized_program in 1411bedbe3fSmrg autoconf*) 1421bedbe3fSmrg echo "You should only need it if you modified 'configure.ac'," 1431bedbe3fSmrg echo "or m4 files included by it." 1441bedbe3fSmrg program_details 'autoconf' 1451bedbe3fSmrg ;; 1461bedbe3fSmrg autoheader*) 1471bedbe3fSmrg echo "You should only need it if you modified 'acconfig.h' or" 1481bedbe3fSmrg echo "$configure_deps." 1491bedbe3fSmrg program_details 'autoheader' 1501bedbe3fSmrg ;; 1511bedbe3fSmrg automake*) 1521bedbe3fSmrg echo "You should only need it if you modified 'Makefile.am' or" 1531bedbe3fSmrg echo "$configure_deps." 1541bedbe3fSmrg program_details 'automake' 1551bedbe3fSmrg ;; 1561bedbe3fSmrg aclocal*) 1571bedbe3fSmrg echo "You should only need it if you modified 'acinclude.m4' or" 1581bedbe3fSmrg echo "$configure_deps." 1591bedbe3fSmrg program_details 'aclocal' 1601bedbe3fSmrg ;; 1611bedbe3fSmrg autom4te*) 1621bedbe3fSmrg echo "You might have modified some maintainer files that require" 1631bedbe3fSmrg echo "the 'automa4te' program to be rebuilt." 1641bedbe3fSmrg program_details 'autom4te' 1651bedbe3fSmrg ;; 1661bedbe3fSmrg bison*|yacc*) 1671bedbe3fSmrg echo "You should only need it if you modified a '.y' file." 1681bedbe3fSmrg echo "You may want to install the GNU Bison package:" 1691bedbe3fSmrg echo "<$gnu_software_URL/bison/>" 1701bedbe3fSmrg ;; 1711bedbe3fSmrg lex*|flex*) 1721bedbe3fSmrg echo "You should only need it if you modified a '.l' file." 1731bedbe3fSmrg echo "You may want to install the Fast Lexical Analyzer package:" 1741bedbe3fSmrg echo "<$flex_URL>" 1751bedbe3fSmrg ;; 1761bedbe3fSmrg help2man*) 1771bedbe3fSmrg echo "You should only need it if you modified a dependency" \ 1781bedbe3fSmrg "of a man page." 1791bedbe3fSmrg echo "You may want to install the GNU Help2man package:" 1801bedbe3fSmrg echo "<$gnu_software_URL/help2man/>" 1811bedbe3fSmrg ;; 1821bedbe3fSmrg makeinfo*) 1831bedbe3fSmrg echo "You should only need it if you modified a '.texi' file, or" 1841bedbe3fSmrg echo "any other file indirectly affecting the aspect of the manual." 1851bedbe3fSmrg echo "You might want to install the Texinfo package:" 1861bedbe3fSmrg echo "<$gnu_software_URL/texinfo/>" 1871bedbe3fSmrg echo "The spurious makeinfo call might also be the consequence of" 1881bedbe3fSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1891bedbe3fSmrg echo "want to install GNU make:" 1901bedbe3fSmrg echo "<$gnu_software_URL/make/>" 1911bedbe3fSmrg ;; 1921bedbe3fSmrg *) 1931bedbe3fSmrg echo "You might have modified some files without having the proper" 1941bedbe3fSmrg echo "tools for further handling them. Check the 'README' file, it" 1951bedbe3fSmrg echo "often tells you about the needed prerequisites for installing" 1961bedbe3fSmrg echo "this package. You may also peek at any GNU archive site, in" 1971bedbe3fSmrg echo "case some other package contains this missing '$1' program." 1981bedbe3fSmrg ;; 1991bedbe3fSmrg esac 2001bedbe3fSmrg} 2011bedbe3fSmrg 2021bedbe3fSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2031bedbe3fSmrg -e '2,$s/^/ /' >&2 2041bedbe3fSmrg 2051bedbe3fSmrg# Propagate the correct exit status (expected to be 127 for a program 2061bedbe3fSmrg# not found, 63 for a program that failed due to version mismatch). 2071bedbe3fSmrgexit $st 208ba6a1819Smrg 209ba6a1819Smrg# Local variables: 210ba6a1819Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211ba6a1819Smrg# time-stamp-start: "scriptversion=" 212ba6a1819Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213549e21daSmrg# time-stamp-time-zone: "UTC" 214549e21daSmrg# time-stamp-end: "; # UTC" 215ba6a1819Smrg# End: 216