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