1644fc5c1Stron#! /bin/sh 27b5fefc8Smrg# Common wrapper for a few potentially missing GNU programs. 32227fc13Smrg 47b5fefc8Smrgscriptversion=2018-03-07.03; # UTC 52227fc13Smrg 67b5fefc8Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 77b5fefc8Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8644fc5c1Stron 9644fc5c1Stron# This program is free software; you can redistribute it and/or modify 10644fc5c1Stron# it under the terms of the GNU General Public License as published by 11644fc5c1Stron# the Free Software Foundation; either version 2, or (at your option) 12644fc5c1Stron# any later version. 13644fc5c1Stron 14644fc5c1Stron# This program is distributed in the hope that it will be useful, 15644fc5c1Stron# but WITHOUT ANY WARRANTY; without even the implied warranty of 16644fc5c1Stron# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17644fc5c1Stron# GNU General Public License for more details. 18644fc5c1Stron 19644fc5c1Stron# You should have received a copy of the GNU General Public License 207b5fefc8Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 21644fc5c1Stron 22644fc5c1Stron# As a special exception to the GNU General Public License, if you 23644fc5c1Stron# distribute this file as part of a program that contains a 24644fc5c1Stron# configuration script generated by Autoconf, you may include it under 25644fc5c1Stron# the same distribution terms that you use for the rest of that program. 26644fc5c1Stron 27644fc5c1Stronif test $# -eq 0; then 287b5fefc8Smrg echo 1>&2 "Try '$0 --help' for more information" 29644fc5c1Stron exit 1 30644fc5c1Stronfi 31644fc5c1Stron 327b5fefc8Smrgcase $1 in 33644fc5c1Stron 347b5fefc8Smrg --is-lightweight) 357b5fefc8Smrg # Used by our autoconf macros to check whether the available missing 367b5fefc8Smrg # script is modern enough. 377b5fefc8Smrg exit 0 387b5fefc8Smrg ;; 392227fc13Smrg 407b5fefc8Smrg --run) 417b5fefc8Smrg # Back-compat with the calling convention used by older automake. 427b5fefc8Smrg shift 437b5fefc8Smrg ;; 44644fc5c1Stron 45644fc5c1Stron -h|--h|--he|--hel|--help) 46644fc5c1Stron echo "\ 47644fc5c1Stron$0 [OPTION]... PROGRAM [ARGUMENT]... 48644fc5c1Stron 497b5fefc8SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 507b5fefc8Smrgto PROGRAM being missing or too old. 51644fc5c1Stron 52644fc5c1StronOptions: 53644fc5c1Stron -h, --help display this help and exit 54644fc5c1Stron -v, --version output version information and exit 55644fc5c1Stron 56644fc5c1StronSupported PROGRAM values: 577b5fefc8Smrg aclocal autoconf autoheader autom4te automake makeinfo 587b5fefc8Smrg bison yacc flex lex help2man 592227fc13Smrg 607b5fefc8SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 617b5fefc8Smrg'g' are ignored when checking the name. 622227fc13Smrg 632227fc13SmrgSend bug reports to <bug-automake@gnu.org>." 642227fc13Smrg exit $? 65644fc5c1Stron ;; 66644fc5c1Stron 67644fc5c1Stron -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 682227fc13Smrg echo "missing $scriptversion (GNU Automake)" 692227fc13Smrg exit $? 70644fc5c1Stron ;; 71644fc5c1Stron 72644fc5c1Stron -*) 737b5fefc8Smrg echo 1>&2 "$0: unknown '$1' option" 747b5fefc8Smrg echo 1>&2 "Try '$0 --help' for more information" 75644fc5c1Stron exit 1 76644fc5c1Stron ;; 77644fc5c1Stron 782227fc13Smrgesac 792227fc13Smrg 807b5fefc8Smrg# Run the given program, remember its exit status. 817b5fefc8Smrg"$@"; st=$? 827b5fefc8Smrg 837b5fefc8Smrg# If it succeeded, we are done. 847b5fefc8Smrgtest $st -eq 0 && exit 0 857b5fefc8Smrg 867b5fefc8Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 877b5fefc8Smrg# passed; such an option is passed most likely to detect whether the 887b5fefc8Smrg# program is present and works. 897b5fefc8Smrgcase $2 in --version|--help) exit $st;; esac 907b5fefc8Smrg 917b5fefc8Smrg# Exit code 63 means version mismatch. This often happens when the user 927b5fefc8Smrg# tries to use an ancient version of a tool on a file that requires a 937b5fefc8Smrg# minimum version. 947b5fefc8Smrgif test $st -eq 63; then 957b5fefc8Smrg msg="probably too old" 967b5fefc8Smrgelif test $st -eq 127; then 977b5fefc8Smrg # Program was missing. 987b5fefc8Smrg msg="missing on your system" 997b5fefc8Smrgelse 1007b5fefc8Smrg # Program was found and executed, but failed. Give up. 1017b5fefc8Smrg exit $st 1027b5fefc8Smrgfi 103644fc5c1Stron 1047b5fefc8Smrgperl_URL=https://www.perl.org/ 1057b5fefc8Smrgflex_URL=https://github.com/westes/flex 1067b5fefc8Smrggnu_software_URL=https://www.gnu.org/software 1077b5fefc8Smrg 1087b5fefc8Smrgprogram_details () 1097b5fefc8Smrg{ 1107b5fefc8Smrg case $1 in 1117b5fefc8Smrg aclocal|automake) 1127b5fefc8Smrg echo "The '$1' program is part of the GNU Automake package:" 1137b5fefc8Smrg echo "<$gnu_software_URL/automake>" 1147b5fefc8Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1157b5fefc8Smrg echo "<$gnu_software_URL/autoconf>" 1167b5fefc8Smrg echo "<$gnu_software_URL/m4/>" 1177b5fefc8Smrg echo "<$perl_URL>" 1187b5fefc8Smrg ;; 1197b5fefc8Smrg autoconf|autom4te|autoheader) 1207b5fefc8Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1217b5fefc8Smrg echo "<$gnu_software_URL/autoconf/>" 1227b5fefc8Smrg echo "It also requires GNU m4 and Perl in order to run:" 1237b5fefc8Smrg echo "<$gnu_software_URL/m4/>" 1247b5fefc8Smrg echo "<$perl_URL>" 1257b5fefc8Smrg ;; 1267b5fefc8Smrg esac 1277b5fefc8Smrg} 1287b5fefc8Smrg 1297b5fefc8Smrggive_advice () 1307b5fefc8Smrg{ 1317b5fefc8Smrg # Normalize program name to check for. 1327b5fefc8Smrg normalized_program=`echo "$1" | sed ' 1337b5fefc8Smrg s/^gnu-//; t 1347b5fefc8Smrg s/^gnu//; t 1357b5fefc8Smrg s/^g//; t'` 1367b5fefc8Smrg 1377b5fefc8Smrg printf '%s\n' "'$1' is $msg." 1387b5fefc8Smrg 1397b5fefc8Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1407b5fefc8Smrg case $normalized_program in 1417b5fefc8Smrg autoconf*) 1427b5fefc8Smrg echo "You should only need it if you modified 'configure.ac'," 1437b5fefc8Smrg echo "or m4 files included by it." 1447b5fefc8Smrg program_details 'autoconf' 1457b5fefc8Smrg ;; 1467b5fefc8Smrg autoheader*) 1477b5fefc8Smrg echo "You should only need it if you modified 'acconfig.h' or" 1487b5fefc8Smrg echo "$configure_deps." 1497b5fefc8Smrg program_details 'autoheader' 1507b5fefc8Smrg ;; 1517b5fefc8Smrg automake*) 1527b5fefc8Smrg echo "You should only need it if you modified 'Makefile.am' or" 1537b5fefc8Smrg echo "$configure_deps." 1547b5fefc8Smrg program_details 'automake' 1557b5fefc8Smrg ;; 1567b5fefc8Smrg aclocal*) 1577b5fefc8Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1587b5fefc8Smrg echo "$configure_deps." 1597b5fefc8Smrg program_details 'aclocal' 1607b5fefc8Smrg ;; 1617b5fefc8Smrg autom4te*) 1627b5fefc8Smrg echo "You might have modified some maintainer files that require" 1637b5fefc8Smrg echo "the 'autom4te' program to be rebuilt." 1647b5fefc8Smrg program_details 'autom4te' 1657b5fefc8Smrg ;; 1667b5fefc8Smrg bison*|yacc*) 1677b5fefc8Smrg echo "You should only need it if you modified a '.y' file." 1687b5fefc8Smrg echo "You may want to install the GNU Bison package:" 1697b5fefc8Smrg echo "<$gnu_software_URL/bison/>" 1707b5fefc8Smrg ;; 1717b5fefc8Smrg lex*|flex*) 1727b5fefc8Smrg echo "You should only need it if you modified a '.l' file." 1737b5fefc8Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1747b5fefc8Smrg echo "<$flex_URL>" 1757b5fefc8Smrg ;; 1767b5fefc8Smrg help2man*) 1777b5fefc8Smrg echo "You should only need it if you modified a dependency" \ 1787b5fefc8Smrg "of a man page." 1797b5fefc8Smrg echo "You may want to install the GNU Help2man package:" 1807b5fefc8Smrg echo "<$gnu_software_URL/help2man/>" 1817b5fefc8Smrg ;; 1827b5fefc8Smrg makeinfo*) 1837b5fefc8Smrg echo "You should only need it if you modified a '.texi' file, or" 1847b5fefc8Smrg echo "any other file indirectly affecting the aspect of the manual." 1857b5fefc8Smrg echo "You might want to install the Texinfo package:" 1867b5fefc8Smrg echo "<$gnu_software_URL/texinfo/>" 1877b5fefc8Smrg echo "The spurious makeinfo call might also be the consequence of" 1887b5fefc8Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1897b5fefc8Smrg echo "want to install GNU make:" 1907b5fefc8Smrg echo "<$gnu_software_URL/make/>" 1917b5fefc8Smrg ;; 1927b5fefc8Smrg *) 1937b5fefc8Smrg echo "You might have modified some files without having the proper" 1947b5fefc8Smrg echo "tools for further handling them. Check the 'README' file, it" 1957b5fefc8Smrg echo "often tells you about the needed prerequisites for installing" 1967b5fefc8Smrg echo "this package. You may also peek at any GNU archive site, in" 1977b5fefc8Smrg echo "case some other package contains this missing '$1' program." 1987b5fefc8Smrg ;; 1997b5fefc8Smrg esac 2007b5fefc8Smrg} 2017b5fefc8Smrg 2027b5fefc8Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2037b5fefc8Smrg -e '2,$s/^/ /' >&2 2047b5fefc8Smrg 2057b5fefc8Smrg# Propagate the correct exit status (expected to be 127 for a program 2067b5fefc8Smrg# not found, 63 for a program that failed due to version mismatch). 2077b5fefc8Smrgexit $st 2082227fc13Smrg 2092227fc13Smrg# Local variables: 2107b5fefc8Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 2112227fc13Smrg# time-stamp-start: "scriptversion=" 2122227fc13Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2137b5fefc8Smrg# time-stamp-time-zone: "UTC0" 2142227fc13Smrg# time-stamp-end: "; # UTC" 2152227fc13Smrg# End: 216