missing revision 9a011757
17a0395d0Smrg#! /bin/sh 29a011757Smrg# Common wrapper for a few potentially missing GNU programs. 37a0395d0Smrg 49a011757Smrgscriptversion=2012-06-26.16; # UTC 57a0395d0Smrg 69a011757Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 79a011757Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 87a0395d0Smrg 97a0395d0Smrg# This program is free software; you can redistribute it and/or modify 107a0395d0Smrg# it under the terms of the GNU General Public License as published by 117a0395d0Smrg# the Free Software Foundation; either version 2, or (at your option) 127a0395d0Smrg# any later version. 137a0395d0Smrg 147a0395d0Smrg# This program is distributed in the hope that it will be useful, 157a0395d0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 167a0395d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 177a0395d0Smrg# GNU General Public License for more details. 187a0395d0Smrg 197a0395d0Smrg# You should have received a copy of the GNU General Public License 207366012aSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 217a0395d0Smrg 227a0395d0Smrg# As a special exception to the GNU General Public License, if you 237a0395d0Smrg# distribute this file as part of a program that contains a 247a0395d0Smrg# configuration script generated by Autoconf, you may include it under 257a0395d0Smrg# the same distribution terms that you use for the rest of that program. 267a0395d0Smrg 277a0395d0Smrgif test $# -eq 0; then 288abc0ccfSmrg echo 1>&2 "Try '$0 --help' for more information" 297a0395d0Smrg exit 1 307a0395d0Smrgfi 317a0395d0Smrg 329a011757Smrgcase $1 in 337a0395d0Smrg 349a011757Smrg --is-lightweight) 359a011757Smrg # Used by our autoconf macros to check whether the available missing 369a011757Smrg # script is modern enough. 379a011757Smrg exit 0 389a011757Smrg ;; 397a0395d0Smrg 409a011757Smrg --run) 419a011757Smrg # Back-compat with the calling convention used by older automake. 429a011757Smrg shift 439a011757Smrg ;; 447a0395d0Smrg 457a0395d0Smrg -h|--h|--he|--hel|--help) 467a0395d0Smrg echo "\ 477a0395d0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 487a0395d0Smrg 499a011757SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 509a011757Smrgto PROGRAM being missing or too old. 517a0395d0Smrg 527a0395d0SmrgOptions: 537a0395d0Smrg -h, --help display this help and exit 547a0395d0Smrg -v, --version output version information and exit 557a0395d0Smrg 567a0395d0SmrgSupported PROGRAM values: 579a011757Smrg aclocal autoconf autoheader autom4te automake makeinfo 589a011757Smrg bison yacc flex lex help2man 597a0395d0Smrg 608abc0ccfSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 618abc0ccfSmrg'g' are ignored when checking the name. 627366012aSmrg 637a0395d0SmrgSend bug reports to <bug-automake@gnu.org>." 647a0395d0Smrg exit $? 657a0395d0Smrg ;; 667a0395d0Smrg 677a0395d0Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 687a0395d0Smrg echo "missing $scriptversion (GNU Automake)" 697a0395d0Smrg exit $? 707a0395d0Smrg ;; 717a0395d0Smrg 727a0395d0Smrg -*) 739a011757Smrg echo 1>&2 "$0: unknown '$1' option" 748abc0ccfSmrg echo 1>&2 "Try '$0 --help' for more information" 757a0395d0Smrg exit 1 767a0395d0Smrg ;; 777a0395d0Smrg 787a0395d0Smrgesac 797a0395d0Smrg 809a011757Smrg# Run the given program, remember its exit status. 819a011757Smrg"$@"; st=$? 829a011757Smrg 839a011757Smrg# If it succeeded, we are done. 849a011757Smrgtest $st -eq 0 && exit 0 859a011757Smrg 869a011757Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 879a011757Smrg# passed; such an option is passed most likely to detect whether the 889a011757Smrg# program is present and works. 899a011757Smrgcase $2 in --version|--help) exit $st;; esac 909a011757Smrg 919a011757Smrg# Exit code 63 means version mismatch. This often happens when the user 929a011757Smrg# tries to use an ancient version of a tool on a file that requires a 939a011757Smrg# minimum version. 949a011757Smrgif test $st -eq 63; then 959a011757Smrg msg="probably too old" 969a011757Smrgelif test $st -eq 127; then 979a011757Smrg # Program was missing. 989a011757Smrg msg="missing on your system" 999a011757Smrgelse 1009a011757Smrg # Program was found and executed, but failed. Give up. 1019a011757Smrg exit $st 1029a011757Smrgfi 1037a0395d0Smrg 1049a011757Smrgperl_URL=http://www.perl.org/ 1059a011757Smrgflex_URL=http://flex.sourceforge.net/ 1069a011757Smrggnu_software_URL=http://www.gnu.org/software 1079a011757Smrg 1089a011757Smrgprogram_details () 1099a011757Smrg{ 1109a011757Smrg case $1 in 1119a011757Smrg aclocal|automake) 1129a011757Smrg echo "The '$1' program is part of the GNU Automake package:" 1139a011757Smrg echo "<$gnu_software_URL/automake>" 1149a011757Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1159a011757Smrg echo "<$gnu_software_URL/autoconf>" 1169a011757Smrg echo "<$gnu_software_URL/m4/>" 1179a011757Smrg echo "<$perl_URL>" 1189a011757Smrg ;; 1199a011757Smrg autoconf|autom4te|autoheader) 1209a011757Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1219a011757Smrg echo "<$gnu_software_URL/autoconf/>" 1229a011757Smrg echo "It also requires GNU m4 and Perl in order to run:" 1239a011757Smrg echo "<$gnu_software_URL/m4/>" 1249a011757Smrg echo "<$perl_URL>" 1259a011757Smrg ;; 1269a011757Smrg esac 1279a011757Smrg} 1289a011757Smrg 1299a011757Smrggive_advice () 1309a011757Smrg{ 1319a011757Smrg # Normalize program name to check for. 1329a011757Smrg normalized_program=`echo "$1" | sed ' 1339a011757Smrg s/^gnu-//; t 1349a011757Smrg s/^gnu//; t 1359a011757Smrg s/^g//; t'` 1369a011757Smrg 1379a011757Smrg printf '%s\n' "'$1' is $msg." 1389a011757Smrg 1399a011757Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1409a011757Smrg case $normalized_program in 1419a011757Smrg autoconf*) 1429a011757Smrg echo "You should only need it if you modified 'configure.ac'," 1439a011757Smrg echo "or m4 files included by it." 1449a011757Smrg program_details 'autoconf' 1459a011757Smrg ;; 1469a011757Smrg autoheader*) 1479a011757Smrg echo "You should only need it if you modified 'acconfig.h' or" 1489a011757Smrg echo "$configure_deps." 1499a011757Smrg program_details 'autoheader' 1509a011757Smrg ;; 1519a011757Smrg automake*) 1529a011757Smrg echo "You should only need it if you modified 'Makefile.am' or" 1539a011757Smrg echo "$configure_deps." 1549a011757Smrg program_details 'automake' 1559a011757Smrg ;; 1569a011757Smrg aclocal*) 1579a011757Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1589a011757Smrg echo "$configure_deps." 1599a011757Smrg program_details 'aclocal' 1609a011757Smrg ;; 1619a011757Smrg autom4te*) 1629a011757Smrg echo "You might have modified some maintainer files that require" 1639a011757Smrg echo "the 'automa4te' program to be rebuilt." 1649a011757Smrg program_details 'autom4te' 1659a011757Smrg ;; 1669a011757Smrg bison*|yacc*) 1679a011757Smrg echo "You should only need it if you modified a '.y' file." 1689a011757Smrg echo "You may want to install the GNU Bison package:" 1699a011757Smrg echo "<$gnu_software_URL/bison/>" 1709a011757Smrg ;; 1719a011757Smrg lex*|flex*) 1729a011757Smrg echo "You should only need it if you modified a '.l' file." 1739a011757Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1749a011757Smrg echo "<$flex_URL>" 1759a011757Smrg ;; 1769a011757Smrg help2man*) 1779a011757Smrg echo "You should only need it if you modified a dependency" \ 1789a011757Smrg "of a man page." 1799a011757Smrg echo "You may want to install the GNU Help2man package:" 1809a011757Smrg echo "<$gnu_software_URL/help2man/>" 1817a0395d0Smrg ;; 1829a011757Smrg makeinfo*) 1839a011757Smrg echo "You should only need it if you modified a '.texi' file, or" 1849a011757Smrg echo "any other file indirectly affecting the aspect of the manual." 1859a011757Smrg echo "You might want to install the Texinfo package:" 1869a011757Smrg echo "<$gnu_software_URL/texinfo/>" 1879a011757Smrg echo "The spurious makeinfo call might also be the consequence of" 1889a011757Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1899a011757Smrg echo "want to install GNU make:" 1909a011757Smrg echo "<$gnu_software_URL/make/>" 1919a011757Smrg ;; 1929a011757Smrg *) 1939a011757Smrg echo "You might have modified some files without having the proper" 1949a011757Smrg echo "tools for further handling them. Check the 'README' file, it" 1959a011757Smrg echo "often tells you about the needed prerequisites for installing" 1969a011757Smrg echo "this package. You may also peek at any GNU archive site, in" 1979a011757Smrg echo "case some other package contains this missing '$1' program." 1989a011757Smrg ;; 1999a011757Smrg esac 2009a011757Smrg} 2019a011757Smrg 2029a011757Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2039a011757Smrg -e '2,$s/^/ /' >&2 2049a011757Smrg 2059a011757Smrg# Propagate the correct exit status (expected to be 127 for a program 2069a011757Smrg# not found, 63 for a program that failed due to version mismatch). 2079a011757Smrgexit $st 2087a0395d0Smrg 2097a0395d0Smrg# Local variables: 2107a0395d0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 2117a0395d0Smrg# time-stamp-start: "scriptversion=" 2127a0395d0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2137366012aSmrg# time-stamp-time-zone: "UTC" 2147366012aSmrg# time-stamp-end: "; # UTC" 2157a0395d0Smrg# End: 216