missing revision 7591dea4
156f6b22bSmrg#! /bin/sh 27591dea4Smrg# Common wrapper for a few potentially missing GNU programs. 3ef7198c0Smrg 47591dea4Smrgscriptversion=2018-03-07.03; # UTC 5ef7198c0Smrg 67591dea4Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 77591dea4Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 856f6b22bSmrg 956f6b22bSmrg# This program is free software; you can redistribute it and/or modify 1056f6b22bSmrg# it under the terms of the GNU General Public License as published by 1156f6b22bSmrg# the Free Software Foundation; either version 2, or (at your option) 1256f6b22bSmrg# any later version. 1356f6b22bSmrg 1456f6b22bSmrg# This program is distributed in the hope that it will be useful, 1556f6b22bSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1656f6b22bSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1756f6b22bSmrg# GNU General Public License for more details. 1856f6b22bSmrg 1956f6b22bSmrg# You should have received a copy of the GNU General Public License 207591dea4Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 2156f6b22bSmrg 2256f6b22bSmrg# As a special exception to the GNU General Public License, if you 2356f6b22bSmrg# distribute this file as part of a program that contains a 2456f6b22bSmrg# configuration script generated by Autoconf, you may include it under 2556f6b22bSmrg# the same distribution terms that you use for the rest of that program. 2656f6b22bSmrg 2756f6b22bSmrgif test $# -eq 0; then 287591dea4Smrg echo 1>&2 "Try '$0 --help' for more information" 2956f6b22bSmrg exit 1 3056f6b22bSmrgfi 3156f6b22bSmrg 327591dea4Smrgcase $1 in 3356f6b22bSmrg 347591dea4Smrg --is-lightweight) 357591dea4Smrg # Used by our autoconf macros to check whether the available missing 367591dea4Smrg # script is modern enough. 377591dea4Smrg exit 0 387591dea4Smrg ;; 39ef7198c0Smrg 407591dea4Smrg --run) 417591dea4Smrg # Back-compat with the calling convention used by older automake. 427591dea4Smrg shift 437591dea4Smrg ;; 4456f6b22bSmrg 4556f6b22bSmrg -h|--h|--he|--hel|--help) 4656f6b22bSmrg echo "\ 4756f6b22bSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4856f6b22bSmrg 497591dea4SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 507591dea4Smrgto PROGRAM being missing or too old. 5156f6b22bSmrg 5256f6b22bSmrgOptions: 5356f6b22bSmrg -h, --help display this help and exit 5456f6b22bSmrg -v, --version output version information and exit 5556f6b22bSmrg 5656f6b22bSmrgSupported PROGRAM values: 577591dea4Smrg aclocal autoconf autoheader autom4te automake makeinfo 587591dea4Smrg bison yacc flex lex help2man 59ef7198c0Smrg 607591dea4SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 617591dea4Smrg'g' are ignored when checking the name. 62ef7198c0Smrg 63ef7198c0SmrgSend bug reports to <bug-automake@gnu.org>." 64ef7198c0Smrg exit $? 6556f6b22bSmrg ;; 6656f6b22bSmrg 6756f6b22bSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68ef7198c0Smrg echo "missing $scriptversion (GNU Automake)" 69ef7198c0Smrg exit $? 7056f6b22bSmrg ;; 7156f6b22bSmrg 7256f6b22bSmrg -*) 737591dea4Smrg echo 1>&2 "$0: unknown '$1' option" 747591dea4Smrg echo 1>&2 "Try '$0 --help' for more information" 7556f6b22bSmrg exit 1 7656f6b22bSmrg ;; 7756f6b22bSmrg 78ef7198c0Smrgesac 79ef7198c0Smrg 807591dea4Smrg# Run the given program, remember its exit status. 817591dea4Smrg"$@"; st=$? 827591dea4Smrg 837591dea4Smrg# If it succeeded, we are done. 847591dea4Smrgtest $st -eq 0 && exit 0 857591dea4Smrg 867591dea4Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 877591dea4Smrg# passed; such an option is passed most likely to detect whether the 887591dea4Smrg# program is present and works. 897591dea4Smrgcase $2 in --version|--help) exit $st;; esac 907591dea4Smrg 917591dea4Smrg# Exit code 63 means version mismatch. This often happens when the user 927591dea4Smrg# tries to use an ancient version of a tool on a file that requires a 937591dea4Smrg# minimum version. 947591dea4Smrgif test $st -eq 63; then 957591dea4Smrg msg="probably too old" 967591dea4Smrgelif test $st -eq 127; then 977591dea4Smrg # Program was missing. 987591dea4Smrg msg="missing on your system" 997591dea4Smrgelse 1007591dea4Smrg # Program was found and executed, but failed. Give up. 1017591dea4Smrg exit $st 1027591dea4Smrgfi 10356f6b22bSmrg 1047591dea4Smrgperl_URL=https://www.perl.org/ 1057591dea4Smrgflex_URL=https://github.com/westes/flex 1067591dea4Smrggnu_software_URL=https://www.gnu.org/software 1077591dea4Smrg 1087591dea4Smrgprogram_details () 1097591dea4Smrg{ 1107591dea4Smrg case $1 in 1117591dea4Smrg aclocal|automake) 1127591dea4Smrg echo "The '$1' program is part of the GNU Automake package:" 1137591dea4Smrg echo "<$gnu_software_URL/automake>" 1147591dea4Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1157591dea4Smrg echo "<$gnu_software_URL/autoconf>" 1167591dea4Smrg echo "<$gnu_software_URL/m4/>" 1177591dea4Smrg echo "<$perl_URL>" 1187591dea4Smrg ;; 1197591dea4Smrg autoconf|autom4te|autoheader) 1207591dea4Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1217591dea4Smrg echo "<$gnu_software_URL/autoconf/>" 1227591dea4Smrg echo "It also requires GNU m4 and Perl in order to run:" 1237591dea4Smrg echo "<$gnu_software_URL/m4/>" 1247591dea4Smrg echo "<$perl_URL>" 1257591dea4Smrg ;; 1267591dea4Smrg esac 1277591dea4Smrg} 1287591dea4Smrg 1297591dea4Smrggive_advice () 1307591dea4Smrg{ 1317591dea4Smrg # Normalize program name to check for. 1327591dea4Smrg normalized_program=`echo "$1" | sed ' 1337591dea4Smrg s/^gnu-//; t 1347591dea4Smrg s/^gnu//; t 1357591dea4Smrg s/^g//; t'` 1367591dea4Smrg 1377591dea4Smrg printf '%s\n' "'$1' is $msg." 1387591dea4Smrg 1397591dea4Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1407591dea4Smrg case $normalized_program in 1417591dea4Smrg autoconf*) 1427591dea4Smrg echo "You should only need it if you modified 'configure.ac'," 1437591dea4Smrg echo "or m4 files included by it." 1447591dea4Smrg program_details 'autoconf' 1457591dea4Smrg ;; 1467591dea4Smrg autoheader*) 1477591dea4Smrg echo "You should only need it if you modified 'acconfig.h' or" 1487591dea4Smrg echo "$configure_deps." 1497591dea4Smrg program_details 'autoheader' 1507591dea4Smrg ;; 1517591dea4Smrg automake*) 1527591dea4Smrg echo "You should only need it if you modified 'Makefile.am' or" 1537591dea4Smrg echo "$configure_deps." 1547591dea4Smrg program_details 'automake' 1557591dea4Smrg ;; 1567591dea4Smrg aclocal*) 1577591dea4Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1587591dea4Smrg echo "$configure_deps." 1597591dea4Smrg program_details 'aclocal' 1607591dea4Smrg ;; 1617591dea4Smrg autom4te*) 1627591dea4Smrg echo "You might have modified some maintainer files that require" 1637591dea4Smrg echo "the 'autom4te' program to be rebuilt." 1647591dea4Smrg program_details 'autom4te' 1657591dea4Smrg ;; 1667591dea4Smrg bison*|yacc*) 1677591dea4Smrg echo "You should only need it if you modified a '.y' file." 1687591dea4Smrg echo "You may want to install the GNU Bison package:" 1697591dea4Smrg echo "<$gnu_software_URL/bison/>" 1707591dea4Smrg ;; 1717591dea4Smrg lex*|flex*) 1727591dea4Smrg echo "You should only need it if you modified a '.l' file." 1737591dea4Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1747591dea4Smrg echo "<$flex_URL>" 1757591dea4Smrg ;; 1767591dea4Smrg help2man*) 1777591dea4Smrg echo "You should only need it if you modified a dependency" \ 1787591dea4Smrg "of a man page." 1797591dea4Smrg echo "You may want to install the GNU Help2man package:" 1807591dea4Smrg echo "<$gnu_software_URL/help2man/>" 1817591dea4Smrg ;; 1827591dea4Smrg makeinfo*) 1837591dea4Smrg echo "You should only need it if you modified a '.texi' file, or" 1847591dea4Smrg echo "any other file indirectly affecting the aspect of the manual." 1857591dea4Smrg echo "You might want to install the Texinfo package:" 1867591dea4Smrg echo "<$gnu_software_URL/texinfo/>" 1877591dea4Smrg echo "The spurious makeinfo call might also be the consequence of" 1887591dea4Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1897591dea4Smrg echo "want to install GNU make:" 1907591dea4Smrg echo "<$gnu_software_URL/make/>" 1917591dea4Smrg ;; 1927591dea4Smrg *) 1937591dea4Smrg echo "You might have modified some files without having the proper" 1947591dea4Smrg echo "tools for further handling them. Check the 'README' file, it" 1957591dea4Smrg echo "often tells you about the needed prerequisites for installing" 1967591dea4Smrg echo "this package. You may also peek at any GNU archive site, in" 1977591dea4Smrg echo "case some other package contains this missing '$1' program." 1987591dea4Smrg ;; 1997591dea4Smrg esac 2007591dea4Smrg} 2017591dea4Smrg 2027591dea4Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2037591dea4Smrg -e '2,$s/^/ /' >&2 2047591dea4Smrg 2057591dea4Smrg# Propagate the correct exit status (expected to be 127 for a program 2067591dea4Smrg# not found, 63 for a program that failed due to version mismatch). 2077591dea4Smrgexit $st 208ef7198c0Smrg 209ef7198c0Smrg# Local variables: 2107591dea4Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 211ef7198c0Smrg# time-stamp-start: "scriptversion=" 212ef7198c0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2137591dea4Smrg# time-stamp-time-zone: "UTC0" 214ef7198c0Smrg# time-stamp-end: "; # UTC" 215ef7198c0Smrg# End: 216