11016ad83Smrg#! /bin/sh 21016ad83Smrg# Common wrapper for a few potentially missing GNU programs. 31016ad83Smrg 4fe12f63cSmrgscriptversion=2018-03-07.03; # UTC 51016ad83Smrg 68ffb90f1Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 71016ad83Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 81016ad83Smrg 91016ad83Smrg# This program is free software; you can redistribute it and/or modify 101016ad83Smrg# it under the terms of the GNU General Public License as published by 111016ad83Smrg# the Free Software Foundation; either version 2, or (at your option) 121016ad83Smrg# any later version. 131016ad83Smrg 141016ad83Smrg# This program is distributed in the hope that it will be useful, 151016ad83Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 161016ad83Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 171016ad83Smrg# GNU General Public License for more details. 181016ad83Smrg 191016ad83Smrg# You should have received a copy of the GNU General Public License 20fe12f63cSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 211016ad83Smrg 221016ad83Smrg# As a special exception to the GNU General Public License, if you 231016ad83Smrg# distribute this file as part of a program that contains a 241016ad83Smrg# configuration script generated by Autoconf, you may include it under 251016ad83Smrg# the same distribution terms that you use for the rest of that program. 261016ad83Smrg 271016ad83Smrgif test $# -eq 0; then 281016ad83Smrg echo 1>&2 "Try '$0 --help' for more information" 291016ad83Smrg exit 1 301016ad83Smrgfi 311016ad83Smrg 321016ad83Smrgcase $1 in 331016ad83Smrg 341016ad83Smrg --is-lightweight) 351016ad83Smrg # Used by our autoconf macros to check whether the available missing 361016ad83Smrg # script is modern enough. 371016ad83Smrg exit 0 381016ad83Smrg ;; 391016ad83Smrg 401016ad83Smrg --run) 411016ad83Smrg # Back-compat with the calling convention used by older automake. 421016ad83Smrg shift 431016ad83Smrg ;; 441016ad83Smrg 451016ad83Smrg -h|--h|--he|--hel|--help) 461016ad83Smrg echo "\ 471016ad83Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 481016ad83Smrg 491016ad83SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 501016ad83Smrgto PROGRAM being missing or too old. 511016ad83Smrg 521016ad83SmrgOptions: 531016ad83Smrg -h, --help display this help and exit 541016ad83Smrg -v, --version output version information and exit 551016ad83Smrg 561016ad83SmrgSupported PROGRAM values: 571016ad83Smrg aclocal autoconf autoheader autom4te automake makeinfo 581016ad83Smrg bison yacc flex lex help2man 591016ad83Smrg 601016ad83SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 611016ad83Smrg'g' are ignored when checking the name. 621016ad83Smrg 631016ad83SmrgSend bug reports to <bug-automake@gnu.org>." 641016ad83Smrg exit $? 651016ad83Smrg ;; 661016ad83Smrg 671016ad83Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 681016ad83Smrg echo "missing $scriptversion (GNU Automake)" 691016ad83Smrg exit $? 701016ad83Smrg ;; 711016ad83Smrg 721016ad83Smrg -*) 731016ad83Smrg echo 1>&2 "$0: unknown '$1' option" 741016ad83Smrg echo 1>&2 "Try '$0 --help' for more information" 751016ad83Smrg exit 1 761016ad83Smrg ;; 771016ad83Smrg 781016ad83Smrgesac 791016ad83Smrg 801016ad83Smrg# Run the given program, remember its exit status. 811016ad83Smrg"$@"; st=$? 821016ad83Smrg 831016ad83Smrg# If it succeeded, we are done. 841016ad83Smrgtest $st -eq 0 && exit 0 851016ad83Smrg 861016ad83Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 871016ad83Smrg# passed; such an option is passed most likely to detect whether the 881016ad83Smrg# program is present and works. 891016ad83Smrgcase $2 in --version|--help) exit $st;; esac 901016ad83Smrg 911016ad83Smrg# Exit code 63 means version mismatch. This often happens when the user 921016ad83Smrg# tries to use an ancient version of a tool on a file that requires a 931016ad83Smrg# minimum version. 941016ad83Smrgif test $st -eq 63; then 951016ad83Smrg msg="probably too old" 961016ad83Smrgelif test $st -eq 127; then 971016ad83Smrg # Program was missing. 981016ad83Smrg msg="missing on your system" 991016ad83Smrgelse 1001016ad83Smrg # Program was found and executed, but failed. Give up. 1011016ad83Smrg exit $st 1021016ad83Smrgfi 1031016ad83Smrg 104fe12f63cSmrgperl_URL=https://www.perl.org/ 105fe12f63cSmrgflex_URL=https://github.com/westes/flex 106fe12f63cSmrggnu_software_URL=https://www.gnu.org/software 1071016ad83Smrg 1081016ad83Smrgprogram_details () 1091016ad83Smrg{ 1101016ad83Smrg case $1 in 1111016ad83Smrg aclocal|automake) 1121016ad83Smrg echo "The '$1' program is part of the GNU Automake package:" 1131016ad83Smrg echo "<$gnu_software_URL/automake>" 1141016ad83Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1151016ad83Smrg echo "<$gnu_software_URL/autoconf>" 1161016ad83Smrg echo "<$gnu_software_URL/m4/>" 1171016ad83Smrg echo "<$perl_URL>" 1181016ad83Smrg ;; 1191016ad83Smrg autoconf|autom4te|autoheader) 1201016ad83Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1211016ad83Smrg echo "<$gnu_software_URL/autoconf/>" 1221016ad83Smrg echo "It also requires GNU m4 and Perl in order to run:" 1231016ad83Smrg echo "<$gnu_software_URL/m4/>" 1241016ad83Smrg echo "<$perl_URL>" 1251016ad83Smrg ;; 1261016ad83Smrg esac 1271016ad83Smrg} 1281016ad83Smrg 1291016ad83Smrggive_advice () 1301016ad83Smrg{ 1311016ad83Smrg # Normalize program name to check for. 1321016ad83Smrg normalized_program=`echo "$1" | sed ' 1331016ad83Smrg s/^gnu-//; t 1341016ad83Smrg s/^gnu//; t 1351016ad83Smrg s/^g//; t'` 1361016ad83Smrg 1371016ad83Smrg printf '%s\n' "'$1' is $msg." 1381016ad83Smrg 1391016ad83Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1401016ad83Smrg case $normalized_program in 1411016ad83Smrg autoconf*) 1421016ad83Smrg echo "You should only need it if you modified 'configure.ac'," 1431016ad83Smrg echo "or m4 files included by it." 1441016ad83Smrg program_details 'autoconf' 1451016ad83Smrg ;; 1461016ad83Smrg autoheader*) 1471016ad83Smrg echo "You should only need it if you modified 'acconfig.h' or" 1481016ad83Smrg echo "$configure_deps." 1491016ad83Smrg program_details 'autoheader' 1501016ad83Smrg ;; 1511016ad83Smrg automake*) 1521016ad83Smrg echo "You should only need it if you modified 'Makefile.am' or" 1531016ad83Smrg echo "$configure_deps." 1541016ad83Smrg program_details 'automake' 1551016ad83Smrg ;; 1561016ad83Smrg aclocal*) 1571016ad83Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1581016ad83Smrg echo "$configure_deps." 1591016ad83Smrg program_details 'aclocal' 1601016ad83Smrg ;; 1611016ad83Smrg autom4te*) 1621016ad83Smrg echo "You might have modified some maintainer files that require" 1631c7386f4Smrg echo "the 'autom4te' program to be rebuilt." 1641016ad83Smrg program_details 'autom4te' 1651016ad83Smrg ;; 1661016ad83Smrg bison*|yacc*) 1671016ad83Smrg echo "You should only need it if you modified a '.y' file." 1681016ad83Smrg echo "You may want to install the GNU Bison package:" 1691016ad83Smrg echo "<$gnu_software_URL/bison/>" 1701016ad83Smrg ;; 1711016ad83Smrg lex*|flex*) 1721016ad83Smrg echo "You should only need it if you modified a '.l' file." 1731016ad83Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1741016ad83Smrg echo "<$flex_URL>" 1751016ad83Smrg ;; 1761016ad83Smrg help2man*) 1771016ad83Smrg echo "You should only need it if you modified a dependency" \ 1781016ad83Smrg "of a man page." 1791016ad83Smrg echo "You may want to install the GNU Help2man package:" 1801016ad83Smrg echo "<$gnu_software_URL/help2man/>" 1811016ad83Smrg ;; 1821016ad83Smrg makeinfo*) 1831016ad83Smrg echo "You should only need it if you modified a '.texi' file, or" 1841016ad83Smrg echo "any other file indirectly affecting the aspect of the manual." 1851016ad83Smrg echo "You might want to install the Texinfo package:" 1861016ad83Smrg echo "<$gnu_software_URL/texinfo/>" 1871016ad83Smrg echo "The spurious makeinfo call might also be the consequence of" 1881016ad83Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1891016ad83Smrg echo "want to install GNU make:" 1901016ad83Smrg echo "<$gnu_software_URL/make/>" 1911016ad83Smrg ;; 1921016ad83Smrg *) 1931016ad83Smrg echo "You might have modified some files without having the proper" 1941016ad83Smrg echo "tools for further handling them. Check the 'README' file, it" 1951016ad83Smrg echo "often tells you about the needed prerequisites for installing" 1961016ad83Smrg echo "this package. You may also peek at any GNU archive site, in" 1971016ad83Smrg echo "case some other package contains this missing '$1' program." 1981016ad83Smrg ;; 1991016ad83Smrg esac 2001016ad83Smrg} 2011016ad83Smrg 2021016ad83Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2031016ad83Smrg -e '2,$s/^/ /' >&2 2041016ad83Smrg 2051016ad83Smrg# Propagate the correct exit status (expected to be 127 for a program 2061016ad83Smrg# not found, 63 for a program that failed due to version mismatch). 2071016ad83Smrgexit $st 2081016ad83Smrg 2091016ad83Smrg# Local variables: 210fe12f63cSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 2111016ad83Smrg# time-stamp-start: "scriptversion=" 2121016ad83Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213245c37e9Smrg# time-stamp-time-zone: "UTC0" 2141016ad83Smrg# time-stamp-end: "; # UTC" 2151016ad83Smrg# End: 216