missing revision 4a908991
1a0d3b6eaSmrg#! /bin/sh 24a908991Smrg# Common wrapper for a few potentially missing GNU programs. 3a0d3b6eaSmrg 44a908991Smrgscriptversion=2013-10-28.13; # UTC 5a0d3b6eaSmrg 64a908991Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 74a908991Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8a0d3b6eaSmrg 9a0d3b6eaSmrg# This program is free software; you can redistribute it and/or modify 10a0d3b6eaSmrg# it under the terms of the GNU General Public License as published by 11a0d3b6eaSmrg# the Free Software Foundation; either version 2, or (at your option) 12a0d3b6eaSmrg# any later version. 13a0d3b6eaSmrg 14a0d3b6eaSmrg# This program is distributed in the hope that it will be useful, 15a0d3b6eaSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16a0d3b6eaSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17a0d3b6eaSmrg# GNU General Public License for more details. 18a0d3b6eaSmrg 19a0d3b6eaSmrg# You should have received a copy of the GNU General Public License 20f8a31ee4Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21a0d3b6eaSmrg 22a0d3b6eaSmrg# As a special exception to the GNU General Public License, if you 23a0d3b6eaSmrg# distribute this file as part of a program that contains a 24a0d3b6eaSmrg# configuration script generated by Autoconf, you may include it under 25a0d3b6eaSmrg# the same distribution terms that you use for the rest of that program. 26a0d3b6eaSmrg 27a0d3b6eaSmrgif test $# -eq 0; then 284a908991Smrg echo 1>&2 "Try '$0 --help' for more information" 29a0d3b6eaSmrg exit 1 30a0d3b6eaSmrgfi 31a0d3b6eaSmrg 324a908991Smrgcase $1 in 33a0d3b6eaSmrg 344a908991Smrg --is-lightweight) 354a908991Smrg # Used by our autoconf macros to check whether the available missing 364a908991Smrg # script is modern enough. 374a908991Smrg exit 0 384a908991Smrg ;; 39f3dfa9d3Smrg 404a908991Smrg --run) 414a908991Smrg # Back-compat with the calling convention used by older automake. 424a908991Smrg shift 434a908991Smrg ;; 44a0d3b6eaSmrg 45a0d3b6eaSmrg -h|--h|--he|--hel|--help) 46a0d3b6eaSmrg echo "\ 47a0d3b6eaSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48a0d3b6eaSmrg 494a908991SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 504a908991Smrgto PROGRAM being missing or too old. 51a0d3b6eaSmrg 52a0d3b6eaSmrgOptions: 53a0d3b6eaSmrg -h, --help display this help and exit 54a0d3b6eaSmrg -v, --version output version information and exit 55a0d3b6eaSmrg 56a0d3b6eaSmrgSupported PROGRAM values: 574a908991Smrg aclocal autoconf autoheader autom4te automake makeinfo 584a908991Smrg bison yacc flex lex help2man 59a0d3b6eaSmrg 604a908991SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 614a908991Smrg'g' are ignored when checking the name. 62f8a31ee4Smrg 63a0d3b6eaSmrgSend bug reports to <bug-automake@gnu.org>." 64a0d3b6eaSmrg exit $? 65a0d3b6eaSmrg ;; 66a0d3b6eaSmrg 67a0d3b6eaSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68a0d3b6eaSmrg echo "missing $scriptversion (GNU Automake)" 69a0d3b6eaSmrg exit $? 70a0d3b6eaSmrg ;; 71a0d3b6eaSmrg 72a0d3b6eaSmrg -*) 734a908991Smrg echo 1>&2 "$0: unknown '$1' option" 744a908991Smrg echo 1>&2 "Try '$0 --help' for more information" 75a0d3b6eaSmrg exit 1 76a0d3b6eaSmrg ;; 77a0d3b6eaSmrg 78a0d3b6eaSmrgesac 79a0d3b6eaSmrg 804a908991Smrg# Run the given program, remember its exit status. 814a908991Smrg"$@"; st=$? 824a908991Smrg 834a908991Smrg# If it succeeded, we are done. 844a908991Smrgtest $st -eq 0 && exit 0 854a908991Smrg 864a908991Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 874a908991Smrg# passed; such an option is passed most likely to detect whether the 884a908991Smrg# program is present and works. 894a908991Smrgcase $2 in --version|--help) exit $st;; esac 904a908991Smrg 914a908991Smrg# Exit code 63 means version mismatch. This often happens when the user 924a908991Smrg# tries to use an ancient version of a tool on a file that requires a 934a908991Smrg# minimum version. 944a908991Smrgif test $st -eq 63; then 954a908991Smrg msg="probably too old" 964a908991Smrgelif test $st -eq 127; then 974a908991Smrg # Program was missing. 984a908991Smrg msg="missing on your system" 994a908991Smrgelse 1004a908991Smrg # Program was found and executed, but failed. Give up. 1014a908991Smrg exit $st 1024a908991Smrgfi 103f3dfa9d3Smrg 1044a908991Smrgperl_URL=http://www.perl.org/ 1054a908991Smrgflex_URL=http://flex.sourceforge.net/ 1064a908991Smrggnu_software_URL=http://www.gnu.org/software 1074a908991Smrg 1084a908991Smrgprogram_details () 1094a908991Smrg{ 1104a908991Smrg case $1 in 1114a908991Smrg aclocal|automake) 1124a908991Smrg echo "The '$1' program is part of the GNU Automake package:" 1134a908991Smrg echo "<$gnu_software_URL/automake>" 1144a908991Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1154a908991Smrg echo "<$gnu_software_URL/autoconf>" 1164a908991Smrg echo "<$gnu_software_URL/m4/>" 1174a908991Smrg echo "<$perl_URL>" 1184a908991Smrg ;; 1194a908991Smrg autoconf|autom4te|autoheader) 1204a908991Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1214a908991Smrg echo "<$gnu_software_URL/autoconf/>" 1224a908991Smrg echo "It also requires GNU m4 and Perl in order to run:" 1234a908991Smrg echo "<$gnu_software_URL/m4/>" 1244a908991Smrg echo "<$perl_URL>" 1254a908991Smrg ;; 1264a908991Smrg esac 1274a908991Smrg} 1284a908991Smrg 1294a908991Smrggive_advice () 1304a908991Smrg{ 1314a908991Smrg # Normalize program name to check for. 1324a908991Smrg normalized_program=`echo "$1" | sed ' 1334a908991Smrg s/^gnu-//; t 1344a908991Smrg s/^gnu//; t 1354a908991Smrg s/^g//; t'` 1364a908991Smrg 1374a908991Smrg printf '%s\n' "'$1' is $msg." 1384a908991Smrg 1394a908991Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1404a908991Smrg case $normalized_program in 1414a908991Smrg autoconf*) 1424a908991Smrg echo "You should only need it if you modified 'configure.ac'," 1434a908991Smrg echo "or m4 files included by it." 1444a908991Smrg program_details 'autoconf' 1454a908991Smrg ;; 1464a908991Smrg autoheader*) 1474a908991Smrg echo "You should only need it if you modified 'acconfig.h' or" 1484a908991Smrg echo "$configure_deps." 1494a908991Smrg program_details 'autoheader' 1504a908991Smrg ;; 1514a908991Smrg automake*) 1524a908991Smrg echo "You should only need it if you modified 'Makefile.am' or" 1534a908991Smrg echo "$configure_deps." 1544a908991Smrg program_details 'automake' 1554a908991Smrg ;; 1564a908991Smrg aclocal*) 1574a908991Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1584a908991Smrg echo "$configure_deps." 1594a908991Smrg program_details 'aclocal' 1604a908991Smrg ;; 1614a908991Smrg autom4te*) 1624a908991Smrg echo "You might have modified some maintainer files that require" 1634a908991Smrg echo "the 'autom4te' program to be rebuilt." 1644a908991Smrg program_details 'autom4te' 1654a908991Smrg ;; 1664a908991Smrg bison*|yacc*) 1674a908991Smrg echo "You should only need it if you modified a '.y' file." 1684a908991Smrg echo "You may want to install the GNU Bison package:" 1694a908991Smrg echo "<$gnu_software_URL/bison/>" 1704a908991Smrg ;; 1714a908991Smrg lex*|flex*) 1724a908991Smrg echo "You should only need it if you modified a '.l' file." 1734a908991Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1744a908991Smrg echo "<$flex_URL>" 1754a908991Smrg ;; 1764a908991Smrg help2man*) 1774a908991Smrg echo "You should only need it if you modified a dependency" \ 1784a908991Smrg "of a man page." 1794a908991Smrg echo "You may want to install the GNU Help2man package:" 1804a908991Smrg echo "<$gnu_software_URL/help2man/>" 181f3dfa9d3Smrg ;; 1824a908991Smrg makeinfo*) 1834a908991Smrg echo "You should only need it if you modified a '.texi' file, or" 1844a908991Smrg echo "any other file indirectly affecting the aspect of the manual." 1854a908991Smrg echo "You might want to install the Texinfo package:" 1864a908991Smrg echo "<$gnu_software_URL/texinfo/>" 1874a908991Smrg echo "The spurious makeinfo call might also be the consequence of" 1884a908991Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1894a908991Smrg echo "want to install GNU make:" 1904a908991Smrg echo "<$gnu_software_URL/make/>" 1914a908991Smrg ;; 1924a908991Smrg *) 1934a908991Smrg echo "You might have modified some files without having the proper" 1944a908991Smrg echo "tools for further handling them. Check the 'README' file, it" 1954a908991Smrg echo "often tells you about the needed prerequisites for installing" 1964a908991Smrg echo "this package. You may also peek at any GNU archive site, in" 1974a908991Smrg echo "case some other package contains this missing '$1' program." 1984a908991Smrg ;; 1994a908991Smrg esac 2004a908991Smrg} 2014a908991Smrg 2024a908991Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2034a908991Smrg -e '2,$s/^/ /' >&2 2044a908991Smrg 2054a908991Smrg# Propagate the correct exit status (expected to be 127 for a program 2064a908991Smrg# not found, 63 for a program that failed due to version mismatch). 2074a908991Smrgexit $st 208a0d3b6eaSmrg 209a0d3b6eaSmrg# Local variables: 210a0d3b6eaSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211a0d3b6eaSmrg# time-stamp-start: "scriptversion=" 212a0d3b6eaSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213f8a31ee4Smrg# time-stamp-time-zone: "UTC" 214f8a31ee4Smrg# time-stamp-end: "; # UTC" 215a0d3b6eaSmrg# End: 216