1966bf024Smrg#! /bin/sh 29384b2f3Smrg# Common wrapper for a few potentially missing GNU programs. 39384b2f3Smrg 49384b2f3Smrgscriptversion=2012-06-26.16; # UTC 59384b2f3Smrg 69384b2f3Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 79384b2f3Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8966bf024Smrg 9966bf024Smrg# This program is free software; you can redistribute it and/or modify 10966bf024Smrg# it under the terms of the GNU General Public License as published by 11966bf024Smrg# the Free Software Foundation; either version 2, or (at your option) 12966bf024Smrg# any later version. 13966bf024Smrg 14966bf024Smrg# This program is distributed in the hope that it will be useful, 15966bf024Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16966bf024Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17966bf024Smrg# GNU General Public License for more details. 18966bf024Smrg 19966bf024Smrg# You should have received a copy of the GNU General Public License 209384b2f3Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21966bf024Smrg 22966bf024Smrg# As a special exception to the GNU General Public License, if you 23966bf024Smrg# distribute this file as part of a program that contains a 24966bf024Smrg# configuration script generated by Autoconf, you may include it under 25966bf024Smrg# the same distribution terms that you use for the rest of that program. 26966bf024Smrg 27966bf024Smrgif test $# -eq 0; then 289384b2f3Smrg echo 1>&2 "Try '$0 --help' for more information" 29966bf024Smrg exit 1 30966bf024Smrgfi 31966bf024Smrg 329384b2f3Smrgcase $1 in 33966bf024Smrg 349384b2f3Smrg --is-lightweight) 359384b2f3Smrg # Used by our autoconf macros to check whether the available missing 369384b2f3Smrg # script is modern enough. 379384b2f3Smrg exit 0 389384b2f3Smrg ;; 39966bf024Smrg 409384b2f3Smrg --run) 419384b2f3Smrg # Back-compat with the calling convention used by older automake. 429384b2f3Smrg shift 439384b2f3Smrg ;; 44966bf024Smrg 45966bf024Smrg -h|--h|--he|--hel|--help) 46966bf024Smrg echo "\ 47966bf024Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48966bf024Smrg 499384b2f3SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 509384b2f3Smrgto PROGRAM being missing or too old. 51966bf024Smrg 52966bf024SmrgOptions: 53966bf024Smrg -h, --help display this help and exit 54966bf024Smrg -v, --version output version information and exit 55966bf024Smrg 56966bf024SmrgSupported PROGRAM values: 579384b2f3Smrg aclocal autoconf autoheader autom4te automake makeinfo 589384b2f3Smrg bison yacc flex lex help2man 599384b2f3Smrg 609384b2f3SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 619384b2f3Smrg'g' are ignored when checking the name. 629384b2f3Smrg 639384b2f3SmrgSend bug reports to <bug-automake@gnu.org>." 649384b2f3Smrg exit $? 65966bf024Smrg ;; 66966bf024Smrg 67966bf024Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 689384b2f3Smrg echo "missing $scriptversion (GNU Automake)" 699384b2f3Smrg exit $? 70966bf024Smrg ;; 71966bf024Smrg 72966bf024Smrg -*) 739384b2f3Smrg echo 1>&2 "$0: unknown '$1' option" 749384b2f3Smrg echo 1>&2 "Try '$0 --help' for more information" 75966bf024Smrg exit 1 76966bf024Smrg ;; 77966bf024Smrg 789384b2f3Smrgesac 79966bf024Smrg 809384b2f3Smrg# Run the given program, remember its exit status. 819384b2f3Smrg"$@"; st=$? 829384b2f3Smrg 839384b2f3Smrg# If it succeeded, we are done. 849384b2f3Smrgtest $st -eq 0 && exit 0 859384b2f3Smrg 869384b2f3Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 879384b2f3Smrg# passed; such an option is passed most likely to detect whether the 889384b2f3Smrg# program is present and works. 899384b2f3Smrgcase $2 in --version|--help) exit $st;; esac 909384b2f3Smrg 919384b2f3Smrg# Exit code 63 means version mismatch. This often happens when the user 929384b2f3Smrg# tries to use an ancient version of a tool on a file that requires a 939384b2f3Smrg# minimum version. 949384b2f3Smrgif test $st -eq 63; then 959384b2f3Smrg msg="probably too old" 969384b2f3Smrgelif test $st -eq 127; then 979384b2f3Smrg # Program was missing. 989384b2f3Smrg msg="missing on your system" 999384b2f3Smrgelse 1009384b2f3Smrg # Program was found and executed, but failed. Give up. 1019384b2f3Smrg exit $st 1029384b2f3Smrgfi 103966bf024Smrg 1049384b2f3Smrgperl_URL=http://www.perl.org/ 1059384b2f3Smrgflex_URL=http://flex.sourceforge.net/ 1069384b2f3Smrggnu_software_URL=http://www.gnu.org/software 1079384b2f3Smrg 1089384b2f3Smrgprogram_details () 1099384b2f3Smrg{ 1109384b2f3Smrg case $1 in 1119384b2f3Smrg aclocal|automake) 1129384b2f3Smrg echo "The '$1' program is part of the GNU Automake package:" 1139384b2f3Smrg echo "<$gnu_software_URL/automake>" 1149384b2f3Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1159384b2f3Smrg echo "<$gnu_software_URL/autoconf>" 1169384b2f3Smrg echo "<$gnu_software_URL/m4/>" 1179384b2f3Smrg echo "<$perl_URL>" 1189384b2f3Smrg ;; 1199384b2f3Smrg autoconf|autom4te|autoheader) 1209384b2f3Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1219384b2f3Smrg echo "<$gnu_software_URL/autoconf/>" 1229384b2f3Smrg echo "It also requires GNU m4 and Perl in order to run:" 1239384b2f3Smrg echo "<$gnu_software_URL/m4/>" 1249384b2f3Smrg echo "<$perl_URL>" 1259384b2f3Smrg ;; 1269384b2f3Smrg esac 1279384b2f3Smrg} 1289384b2f3Smrg 1299384b2f3Smrggive_advice () 1309384b2f3Smrg{ 1319384b2f3Smrg # Normalize program name to check for. 1329384b2f3Smrg normalized_program=`echo "$1" | sed ' 1339384b2f3Smrg s/^gnu-//; t 1349384b2f3Smrg s/^gnu//; t 1359384b2f3Smrg s/^g//; t'` 1369384b2f3Smrg 1379384b2f3Smrg printf '%s\n' "'$1' is $msg." 1389384b2f3Smrg 1399384b2f3Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1409384b2f3Smrg case $normalized_program in 1419384b2f3Smrg autoconf*) 1429384b2f3Smrg echo "You should only need it if you modified 'configure.ac'," 1439384b2f3Smrg echo "or m4 files included by it." 1449384b2f3Smrg program_details 'autoconf' 1459384b2f3Smrg ;; 1469384b2f3Smrg autoheader*) 1479384b2f3Smrg echo "You should only need it if you modified 'acconfig.h' or" 1489384b2f3Smrg echo "$configure_deps." 1499384b2f3Smrg program_details 'autoheader' 1509384b2f3Smrg ;; 1519384b2f3Smrg automake*) 1529384b2f3Smrg echo "You should only need it if you modified 'Makefile.am' or" 1539384b2f3Smrg echo "$configure_deps." 1549384b2f3Smrg program_details 'automake' 1559384b2f3Smrg ;; 1569384b2f3Smrg aclocal*) 1579384b2f3Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1589384b2f3Smrg echo "$configure_deps." 1599384b2f3Smrg program_details 'aclocal' 1609384b2f3Smrg ;; 1619384b2f3Smrg autom4te*) 1629384b2f3Smrg echo "You might have modified some maintainer files that require" 1639384b2f3Smrg echo "the 'automa4te' program to be rebuilt." 1649384b2f3Smrg program_details 'autom4te' 1659384b2f3Smrg ;; 1669384b2f3Smrg bison*|yacc*) 1679384b2f3Smrg echo "You should only need it if you modified a '.y' file." 1689384b2f3Smrg echo "You may want to install the GNU Bison package:" 1699384b2f3Smrg echo "<$gnu_software_URL/bison/>" 1709384b2f3Smrg ;; 1719384b2f3Smrg lex*|flex*) 1729384b2f3Smrg echo "You should only need it if you modified a '.l' file." 1739384b2f3Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1749384b2f3Smrg echo "<$flex_URL>" 1759384b2f3Smrg ;; 1769384b2f3Smrg help2man*) 1779384b2f3Smrg echo "You should only need it if you modified a dependency" \ 1789384b2f3Smrg "of a man page." 1799384b2f3Smrg echo "You may want to install the GNU Help2man package:" 1809384b2f3Smrg echo "<$gnu_software_URL/help2man/>" 181966bf024Smrg ;; 1829384b2f3Smrg makeinfo*) 1839384b2f3Smrg echo "You should only need it if you modified a '.texi' file, or" 1849384b2f3Smrg echo "any other file indirectly affecting the aspect of the manual." 1859384b2f3Smrg echo "You might want to install the Texinfo package:" 1869384b2f3Smrg echo "<$gnu_software_URL/texinfo/>" 1879384b2f3Smrg echo "The spurious makeinfo call might also be the consequence of" 1889384b2f3Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1899384b2f3Smrg echo "want to install GNU make:" 1909384b2f3Smrg echo "<$gnu_software_URL/make/>" 1919384b2f3Smrg ;; 1929384b2f3Smrg *) 1939384b2f3Smrg echo "You might have modified some files without having the proper" 1949384b2f3Smrg echo "tools for further handling them. Check the 'README' file, it" 1959384b2f3Smrg echo "often tells you about the needed prerequisites for installing" 1969384b2f3Smrg echo "this package. You may also peek at any GNU archive site, in" 1979384b2f3Smrg echo "case some other package contains this missing '$1' program." 1989384b2f3Smrg ;; 1999384b2f3Smrg esac 2009384b2f3Smrg} 2019384b2f3Smrg 2029384b2f3Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2039384b2f3Smrg -e '2,$s/^/ /' >&2 2049384b2f3Smrg 2059384b2f3Smrg# Propagate the correct exit status (expected to be 127 for a program 2069384b2f3Smrg# not found, 63 for a program that failed due to version mismatch). 2079384b2f3Smrgexit $st 2089384b2f3Smrg 2099384b2f3Smrg# Local variables: 2109384b2f3Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 2119384b2f3Smrg# time-stamp-start: "scriptversion=" 2129384b2f3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2139384b2f3Smrg# time-stamp-time-zone: "UTC" 2149384b2f3Smrg# time-stamp-end: "; # UTC" 2159384b2f3Smrg# End: 216