111d341caSmrg#! /bin/sh 21c80d5b0Smrg# Common wrapper for a few potentially missing GNU programs. 311d341caSmrg 4b8df70beSmrgscriptversion=2018-03-07.03; # UTC 511d341caSmrg 6b8df70beSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 71c80d5b0Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 811d341caSmrg 911d341caSmrg# This program is free software; you can redistribute it and/or modify 1011d341caSmrg# it under the terms of the GNU General Public License as published by 1111d341caSmrg# the Free Software Foundation; either version 2, or (at your option) 1211d341caSmrg# any later version. 1311d341caSmrg 1411d341caSmrg# This program is distributed in the hope that it will be useful, 1511d341caSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1611d341caSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1711d341caSmrg# GNU General Public License for more details. 1811d341caSmrg 1911d341caSmrg# You should have received a copy of the GNU General Public License 20b8df70beSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 2111d341caSmrg 2211d341caSmrg# As a special exception to the GNU General Public License, if you 2311d341caSmrg# distribute this file as part of a program that contains a 2411d341caSmrg# configuration script generated by Autoconf, you may include it under 2511d341caSmrg# the same distribution terms that you use for the rest of that program. 2611d341caSmrg 2711d341caSmrgif test $# -eq 0; then 281c80d5b0Smrg echo 1>&2 "Try '$0 --help' for more information" 2911d341caSmrg exit 1 3011d341caSmrgfi 3111d341caSmrg 321c80d5b0Smrgcase $1 in 3311d341caSmrg 341c80d5b0Smrg --is-lightweight) 351c80d5b0Smrg # Used by our autoconf macros to check whether the available missing 361c80d5b0Smrg # script is modern enough. 371c80d5b0Smrg exit 0 381c80d5b0Smrg ;; 3911d341caSmrg 401c80d5b0Smrg --run) 411c80d5b0Smrg # Back-compat with the calling convention used by older automake. 421c80d5b0Smrg shift 431c80d5b0Smrg ;; 4411d341caSmrg 4511d341caSmrg -h|--h|--he|--hel|--help) 4611d341caSmrg echo "\ 4711d341caSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4811d341caSmrg 491c80d5b0SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 501c80d5b0Smrgto PROGRAM being missing or too old. 5111d341caSmrg 5211d341caSmrgOptions: 5311d341caSmrg -h, --help display this help and exit 5411d341caSmrg -v, --version output version information and exit 5511d341caSmrg 5611d341caSmrgSupported PROGRAM values: 571c80d5b0Smrg aclocal autoconf autoheader autom4te automake makeinfo 581c80d5b0Smrg bison yacc flex lex help2man 5911d341caSmrg 601c80d5b0SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 611c80d5b0Smrg'g' are ignored when checking the name. 624c61c93dSmrg 6311d341caSmrgSend bug reports to <bug-automake@gnu.org>." 6411d341caSmrg exit $? 6511d341caSmrg ;; 6611d341caSmrg 6711d341caSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 6811d341caSmrg echo "missing $scriptversion (GNU Automake)" 6911d341caSmrg exit $? 7011d341caSmrg ;; 7111d341caSmrg 7211d341caSmrg -*) 731c80d5b0Smrg echo 1>&2 "$0: unknown '$1' option" 741c80d5b0Smrg echo 1>&2 "Try '$0 --help' for more information" 7511d341caSmrg exit 1 7611d341caSmrg ;; 7711d341caSmrg 7811d341caSmrgesac 7911d341caSmrg 801c80d5b0Smrg# Run the given program, remember its exit status. 811c80d5b0Smrg"$@"; st=$? 821c80d5b0Smrg 831c80d5b0Smrg# If it succeeded, we are done. 841c80d5b0Smrgtest $st -eq 0 && exit 0 851c80d5b0Smrg 861c80d5b0Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 871c80d5b0Smrg# passed; such an option is passed most likely to detect whether the 881c80d5b0Smrg# program is present and works. 891c80d5b0Smrgcase $2 in --version|--help) exit $st;; esac 901c80d5b0Smrg 911c80d5b0Smrg# Exit code 63 means version mismatch. This often happens when the user 921c80d5b0Smrg# tries to use an ancient version of a tool on a file that requires a 931c80d5b0Smrg# minimum version. 941c80d5b0Smrgif test $st -eq 63; then 951c80d5b0Smrg msg="probably too old" 961c80d5b0Smrgelif test $st -eq 127; then 971c80d5b0Smrg # Program was missing. 981c80d5b0Smrg msg="missing on your system" 991c80d5b0Smrgelse 1001c80d5b0Smrg # Program was found and executed, but failed. Give up. 1011c80d5b0Smrg exit $st 1021c80d5b0Smrgfi 10311d341caSmrg 104b8df70beSmrgperl_URL=https://www.perl.org/ 105b8df70beSmrgflex_URL=https://github.com/westes/flex 106b8df70beSmrggnu_software_URL=https://www.gnu.org/software 1071c80d5b0Smrg 1081c80d5b0Smrgprogram_details () 1091c80d5b0Smrg{ 1101c80d5b0Smrg case $1 in 1111c80d5b0Smrg aclocal|automake) 1121c80d5b0Smrg echo "The '$1' program is part of the GNU Automake package:" 1131c80d5b0Smrg echo "<$gnu_software_URL/automake>" 1141c80d5b0Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1151c80d5b0Smrg echo "<$gnu_software_URL/autoconf>" 1161c80d5b0Smrg echo "<$gnu_software_URL/m4/>" 1171c80d5b0Smrg echo "<$perl_URL>" 1181c80d5b0Smrg ;; 1191c80d5b0Smrg autoconf|autom4te|autoheader) 1201c80d5b0Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1211c80d5b0Smrg echo "<$gnu_software_URL/autoconf/>" 1221c80d5b0Smrg echo "It also requires GNU m4 and Perl in order to run:" 1231c80d5b0Smrg echo "<$gnu_software_URL/m4/>" 1241c80d5b0Smrg echo "<$perl_URL>" 1251c80d5b0Smrg ;; 1261c80d5b0Smrg esac 1271c80d5b0Smrg} 1281c80d5b0Smrg 1291c80d5b0Smrggive_advice () 1301c80d5b0Smrg{ 1311c80d5b0Smrg # Normalize program name to check for. 1321c80d5b0Smrg normalized_program=`echo "$1" | sed ' 1331c80d5b0Smrg s/^gnu-//; t 1341c80d5b0Smrg s/^gnu//; t 1351c80d5b0Smrg s/^g//; t'` 1361c80d5b0Smrg 1371c80d5b0Smrg printf '%s\n' "'$1' is $msg." 1381c80d5b0Smrg 1391c80d5b0Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1401c80d5b0Smrg case $normalized_program in 1411c80d5b0Smrg autoconf*) 1421c80d5b0Smrg echo "You should only need it if you modified 'configure.ac'," 1431c80d5b0Smrg echo "or m4 files included by it." 1441c80d5b0Smrg program_details 'autoconf' 1451c80d5b0Smrg ;; 1461c80d5b0Smrg autoheader*) 1471c80d5b0Smrg echo "You should only need it if you modified 'acconfig.h' or" 1481c80d5b0Smrg echo "$configure_deps." 1491c80d5b0Smrg program_details 'autoheader' 1501c80d5b0Smrg ;; 1511c80d5b0Smrg automake*) 1521c80d5b0Smrg echo "You should only need it if you modified 'Makefile.am' or" 1531c80d5b0Smrg echo "$configure_deps." 1541c80d5b0Smrg program_details 'automake' 1551c80d5b0Smrg ;; 1561c80d5b0Smrg aclocal*) 1571c80d5b0Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1581c80d5b0Smrg echo "$configure_deps." 1591c80d5b0Smrg program_details 'aclocal' 1601c80d5b0Smrg ;; 1611c80d5b0Smrg autom4te*) 1621c80d5b0Smrg echo "You might have modified some maintainer files that require" 16341fe0c2aSmrg echo "the 'autom4te' program to be rebuilt." 1641c80d5b0Smrg program_details 'autom4te' 1651c80d5b0Smrg ;; 1661c80d5b0Smrg bison*|yacc*) 1671c80d5b0Smrg echo "You should only need it if you modified a '.y' file." 1681c80d5b0Smrg echo "You may want to install the GNU Bison package:" 1691c80d5b0Smrg echo "<$gnu_software_URL/bison/>" 1701c80d5b0Smrg ;; 1711c80d5b0Smrg lex*|flex*) 1721c80d5b0Smrg echo "You should only need it if you modified a '.l' file." 1731c80d5b0Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1741c80d5b0Smrg echo "<$flex_URL>" 1751c80d5b0Smrg ;; 1761c80d5b0Smrg help2man*) 1771c80d5b0Smrg echo "You should only need it if you modified a dependency" \ 1781c80d5b0Smrg "of a man page." 1791c80d5b0Smrg echo "You may want to install the GNU Help2man package:" 1801c80d5b0Smrg echo "<$gnu_software_URL/help2man/>" 1811c80d5b0Smrg ;; 1821c80d5b0Smrg makeinfo*) 1831c80d5b0Smrg echo "You should only need it if you modified a '.texi' file, or" 1841c80d5b0Smrg echo "any other file indirectly affecting the aspect of the manual." 1851c80d5b0Smrg echo "You might want to install the Texinfo package:" 1861c80d5b0Smrg echo "<$gnu_software_URL/texinfo/>" 1871c80d5b0Smrg echo "The spurious makeinfo call might also be the consequence of" 1881c80d5b0Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1891c80d5b0Smrg echo "want to install GNU make:" 1901c80d5b0Smrg echo "<$gnu_software_URL/make/>" 1911c80d5b0Smrg ;; 1921c80d5b0Smrg *) 1931c80d5b0Smrg echo "You might have modified some files without having the proper" 1941c80d5b0Smrg echo "tools for further handling them. Check the 'README' file, it" 1951c80d5b0Smrg echo "often tells you about the needed prerequisites for installing" 1961c80d5b0Smrg echo "this package. You may also peek at any GNU archive site, in" 1971c80d5b0Smrg echo "case some other package contains this missing '$1' program." 1981c80d5b0Smrg ;; 1991c80d5b0Smrg esac 2001c80d5b0Smrg} 2011c80d5b0Smrg 2021c80d5b0Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2031c80d5b0Smrg -e '2,$s/^/ /' >&2 2041c80d5b0Smrg 2051c80d5b0Smrg# Propagate the correct exit status (expected to be 127 for a program 2061c80d5b0Smrg# not found, 63 for a program that failed due to version mismatch). 2071c80d5b0Smrgexit $st 20811d341caSmrg 20911d341caSmrg# Local variables: 210b8df70beSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 21111d341caSmrg# time-stamp-start: "scriptversion=" 21211d341caSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213b8df70beSmrg# time-stamp-time-zone: "UTC0" 2144c61c93dSmrg# time-stamp-end: "; # UTC" 21511d341caSmrg# End: 216