missing revision 40c5823b
1bbe1b32bSmrg#! /bin/sh 28f34cbf9Ssnj# Common wrapper for a few potentially missing GNU programs. 3bbe1b32bSmrg 440c5823bSmrgscriptversion=2016-01-11.22; # UTC 5bbe1b32bSmrg 640c5823bSmrg# Copyright (C) 1996-2017 Free Software Foundation, Inc. 78f34cbf9Ssnj# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8bbe1b32bSmrg 9bbe1b32bSmrg# This program is free software; you can redistribute it and/or modify 10bbe1b32bSmrg# it under the terms of the GNU General Public License as published by 11bbe1b32bSmrg# the Free Software Foundation; either version 2, or (at your option) 12bbe1b32bSmrg# any later version. 13bbe1b32bSmrg 14bbe1b32bSmrg# This program is distributed in the hope that it will be useful, 15bbe1b32bSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16bbe1b32bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17bbe1b32bSmrg# GNU General Public License for more details. 18bbe1b32bSmrg 19bbe1b32bSmrg# You should have received a copy of the GNU General Public License 2030f8ce46Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21bbe1b32bSmrg 22bbe1b32bSmrg# As a special exception to the GNU General Public License, if you 23bbe1b32bSmrg# distribute this file as part of a program that contains a 24bbe1b32bSmrg# configuration script generated by Autoconf, you may include it under 25bbe1b32bSmrg# the same distribution terms that you use for the rest of that program. 26bbe1b32bSmrg 27bbe1b32bSmrgif test $# -eq 0; then 288f34cbf9Ssnj echo 1>&2 "Try '$0 --help' for more information" 29bbe1b32bSmrg exit 1 30bbe1b32bSmrgfi 31bbe1b32bSmrg 328f34cbf9Ssnjcase $1 in 33bbe1b32bSmrg 348f34cbf9Ssnj --is-lightweight) 358f34cbf9Ssnj # Used by our autoconf macros to check whether the available missing 368f34cbf9Ssnj # script is modern enough. 378f34cbf9Ssnj exit 0 388f34cbf9Ssnj ;; 39bbe1b32bSmrg 408f34cbf9Ssnj --run) 418f34cbf9Ssnj # Back-compat with the calling convention used by older automake. 428f34cbf9Ssnj shift 438f34cbf9Ssnj ;; 44bbe1b32bSmrg 45bbe1b32bSmrg -h|--h|--he|--hel|--help) 46bbe1b32bSmrg echo "\ 47bbe1b32bSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48bbe1b32bSmrg 498f34cbf9SsnjRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 508f34cbf9Ssnjto PROGRAM being missing or too old. 51bbe1b32bSmrg 52bbe1b32bSmrgOptions: 53bbe1b32bSmrg -h, --help display this help and exit 54bbe1b32bSmrg -v, --version output version information and exit 55bbe1b32bSmrg 56bbe1b32bSmrgSupported PROGRAM values: 578f34cbf9Ssnj aclocal autoconf autoheader autom4te automake makeinfo 588f34cbf9Ssnj bison yacc flex lex help2man 59bbe1b32bSmrg 608f34cbf9SsnjVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 618f34cbf9Ssnj'g' are ignored when checking the name. 6230f8ce46Smrg 63bbe1b32bSmrgSend bug reports to <bug-automake@gnu.org>." 64bbe1b32bSmrg exit $? 65bbe1b32bSmrg ;; 66bbe1b32bSmrg 67bbe1b32bSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68bbe1b32bSmrg echo "missing $scriptversion (GNU Automake)" 69bbe1b32bSmrg exit $? 70bbe1b32bSmrg ;; 71bbe1b32bSmrg 72bbe1b32bSmrg -*) 738f34cbf9Ssnj echo 1>&2 "$0: unknown '$1' option" 748f34cbf9Ssnj echo 1>&2 "Try '$0 --help' for more information" 75bbe1b32bSmrg exit 1 76bbe1b32bSmrg ;; 77bbe1b32bSmrg 78bbe1b32bSmrgesac 79bbe1b32bSmrg 808f34cbf9Ssnj# Run the given program, remember its exit status. 818f34cbf9Ssnj"$@"; st=$? 828f34cbf9Ssnj 838f34cbf9Ssnj# If it succeeded, we are done. 848f34cbf9Ssnjtest $st -eq 0 && exit 0 858f34cbf9Ssnj 868f34cbf9Ssnj# Also exit now if we it failed (or wasn't found), and '--version' was 878f34cbf9Ssnj# passed; such an option is passed most likely to detect whether the 888f34cbf9Ssnj# program is present and works. 898f34cbf9Ssnjcase $2 in --version|--help) exit $st;; esac 908f34cbf9Ssnj 918f34cbf9Ssnj# Exit code 63 means version mismatch. This often happens when the user 928f34cbf9Ssnj# tries to use an ancient version of a tool on a file that requires a 938f34cbf9Ssnj# minimum version. 948f34cbf9Ssnjif test $st -eq 63; then 958f34cbf9Ssnj msg="probably too old" 968f34cbf9Ssnjelif test $st -eq 127; then 978f34cbf9Ssnj # Program was missing. 988f34cbf9Ssnj msg="missing on your system" 998f34cbf9Ssnjelse 1008f34cbf9Ssnj # Program was found and executed, but failed. Give up. 1018f34cbf9Ssnj exit $st 1028f34cbf9Ssnjfi 103bbe1b32bSmrg 1048f34cbf9Ssnjperl_URL=http://www.perl.org/ 1058f34cbf9Ssnjflex_URL=http://flex.sourceforge.net/ 1068f34cbf9Ssnjgnu_software_URL=http://www.gnu.org/software 1078f34cbf9Ssnj 1088f34cbf9Ssnjprogram_details () 1098f34cbf9Ssnj{ 1108f34cbf9Ssnj case $1 in 1118f34cbf9Ssnj aclocal|automake) 1128f34cbf9Ssnj echo "The '$1' program is part of the GNU Automake package:" 1138f34cbf9Ssnj echo "<$gnu_software_URL/automake>" 1148f34cbf9Ssnj echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1158f34cbf9Ssnj echo "<$gnu_software_URL/autoconf>" 1168f34cbf9Ssnj echo "<$gnu_software_URL/m4/>" 1178f34cbf9Ssnj echo "<$perl_URL>" 1188f34cbf9Ssnj ;; 1198f34cbf9Ssnj autoconf|autom4te|autoheader) 1208f34cbf9Ssnj echo "The '$1' program is part of the GNU Autoconf package:" 1218f34cbf9Ssnj echo "<$gnu_software_URL/autoconf/>" 1228f34cbf9Ssnj echo "It also requires GNU m4 and Perl in order to run:" 1238f34cbf9Ssnj echo "<$gnu_software_URL/m4/>" 1248f34cbf9Ssnj echo "<$perl_URL>" 1258f34cbf9Ssnj ;; 1268f34cbf9Ssnj esac 1278f34cbf9Ssnj} 1288f34cbf9Ssnj 1298f34cbf9Ssnjgive_advice () 1308f34cbf9Ssnj{ 1318f34cbf9Ssnj # Normalize program name to check for. 1328f34cbf9Ssnj normalized_program=`echo "$1" | sed ' 1338f34cbf9Ssnj s/^gnu-//; t 1348f34cbf9Ssnj s/^gnu//; t 1358f34cbf9Ssnj s/^g//; t'` 1368f34cbf9Ssnj 1378f34cbf9Ssnj printf '%s\n' "'$1' is $msg." 1388f34cbf9Ssnj 1398f34cbf9Ssnj configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1408f34cbf9Ssnj case $normalized_program in 1418f34cbf9Ssnj autoconf*) 1428f34cbf9Ssnj echo "You should only need it if you modified 'configure.ac'," 1438f34cbf9Ssnj echo "or m4 files included by it." 1448f34cbf9Ssnj program_details 'autoconf' 1458f34cbf9Ssnj ;; 1468f34cbf9Ssnj autoheader*) 1478f34cbf9Ssnj echo "You should only need it if you modified 'acconfig.h' or" 1488f34cbf9Ssnj echo "$configure_deps." 1498f34cbf9Ssnj program_details 'autoheader' 1508f34cbf9Ssnj ;; 1518f34cbf9Ssnj automake*) 1528f34cbf9Ssnj echo "You should only need it if you modified 'Makefile.am' or" 1538f34cbf9Ssnj echo "$configure_deps." 1548f34cbf9Ssnj program_details 'automake' 1558f34cbf9Ssnj ;; 1568f34cbf9Ssnj aclocal*) 1578f34cbf9Ssnj echo "You should only need it if you modified 'acinclude.m4' or" 1588f34cbf9Ssnj echo "$configure_deps." 1598f34cbf9Ssnj program_details 'aclocal' 1608f34cbf9Ssnj ;; 1618f34cbf9Ssnj autom4te*) 1628f34cbf9Ssnj echo "You might have modified some maintainer files that require" 1638f34cbf9Ssnj echo "the 'autom4te' program to be rebuilt." 1648f34cbf9Ssnj program_details 'autom4te' 1658f34cbf9Ssnj ;; 1668f34cbf9Ssnj bison*|yacc*) 1678f34cbf9Ssnj echo "You should only need it if you modified a '.y' file." 1688f34cbf9Ssnj echo "You may want to install the GNU Bison package:" 1698f34cbf9Ssnj echo "<$gnu_software_URL/bison/>" 1708f34cbf9Ssnj ;; 1718f34cbf9Ssnj lex*|flex*) 1728f34cbf9Ssnj echo "You should only need it if you modified a '.l' file." 1738f34cbf9Ssnj echo "You may want to install the Fast Lexical Analyzer package:" 1748f34cbf9Ssnj echo "<$flex_URL>" 1758f34cbf9Ssnj ;; 1768f34cbf9Ssnj help2man*) 1778f34cbf9Ssnj echo "You should only need it if you modified a dependency" \ 1788f34cbf9Ssnj "of a man page." 1798f34cbf9Ssnj echo "You may want to install the GNU Help2man package:" 1808f34cbf9Ssnj echo "<$gnu_software_URL/help2man/>" 1818f34cbf9Ssnj ;; 1828f34cbf9Ssnj makeinfo*) 1838f34cbf9Ssnj echo "You should only need it if you modified a '.texi' file, or" 1848f34cbf9Ssnj echo "any other file indirectly affecting the aspect of the manual." 1858f34cbf9Ssnj echo "You might want to install the Texinfo package:" 1868f34cbf9Ssnj echo "<$gnu_software_URL/texinfo/>" 1878f34cbf9Ssnj echo "The spurious makeinfo call might also be the consequence of" 1888f34cbf9Ssnj echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1898f34cbf9Ssnj echo "want to install GNU make:" 1908f34cbf9Ssnj echo "<$gnu_software_URL/make/>" 1918f34cbf9Ssnj ;; 1928f34cbf9Ssnj *) 1938f34cbf9Ssnj echo "You might have modified some files without having the proper" 1948f34cbf9Ssnj echo "tools for further handling them. Check the 'README' file, it" 1958f34cbf9Ssnj echo "often tells you about the needed prerequisites for installing" 1968f34cbf9Ssnj echo "this package. You may also peek at any GNU archive site, in" 1978f34cbf9Ssnj echo "case some other package contains this missing '$1' program." 1988f34cbf9Ssnj ;; 1998f34cbf9Ssnj esac 2008f34cbf9Ssnj} 2018f34cbf9Ssnj 2028f34cbf9Ssnjgive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2038f34cbf9Ssnj -e '2,$s/^/ /' >&2 2048f34cbf9Ssnj 2058f34cbf9Ssnj# Propagate the correct exit status (expected to be 127 for a program 2068f34cbf9Ssnj# not found, 63 for a program that failed due to version mismatch). 2078f34cbf9Ssnjexit $st 208bbe1b32bSmrg 209bbe1b32bSmrg# Local variables: 210bbe1b32bSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211bbe1b32bSmrg# time-stamp-start: "scriptversion=" 212bbe1b32bSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21340c5823bSmrg# time-stamp-time-zone: "UTC0" 21430f8ce46Smrg# time-stamp-end: "; # UTC" 215bbe1b32bSmrg# End: 216