missing revision 6c19a6d3
198049353Smrg#! /bin/sh 26c19a6d3Smrg# Common wrapper for a few potentially missing GNU programs. 30ad07f78Smrg 46c19a6d3Smrgscriptversion=2018-03-07.03; # UTC 50ad07f78Smrg 66c19a6d3Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 76c19a6d3Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 898049353Smrg 998049353Smrg# This program is free software; you can redistribute it and/or modify 1098049353Smrg# it under the terms of the GNU General Public License as published by 1198049353Smrg# the Free Software Foundation; either version 2, or (at your option) 1298049353Smrg# any later version. 1398049353Smrg 1498049353Smrg# This program is distributed in the hope that it will be useful, 1598049353Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1698049353Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1798049353Smrg# GNU General Public License for more details. 1898049353Smrg 1998049353Smrg# You should have received a copy of the GNU General Public License 206c19a6d3Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 2198049353Smrg 2298049353Smrg# As a special exception to the GNU General Public License, if you 2398049353Smrg# distribute this file as part of a program that contains a 2498049353Smrg# configuration script generated by Autoconf, you may include it under 2598049353Smrg# the same distribution terms that you use for the rest of that program. 2698049353Smrg 2798049353Smrgif test $# -eq 0; then 286c19a6d3Smrg echo 1>&2 "Try '$0 --help' for more information" 2998049353Smrg exit 1 3098049353Smrgfi 3198049353Smrg 326c19a6d3Smrgcase $1 in 3398049353Smrg 346c19a6d3Smrg --is-lightweight) 356c19a6d3Smrg # Used by our autoconf macros to check whether the available missing 366c19a6d3Smrg # script is modern enough. 376c19a6d3Smrg exit 0 386c19a6d3Smrg ;; 390ad07f78Smrg 406c19a6d3Smrg --run) 416c19a6d3Smrg # Back-compat with the calling convention used by older automake. 426c19a6d3Smrg shift 436c19a6d3Smrg ;; 4498049353Smrg 4598049353Smrg -h|--h|--he|--hel|--help) 4698049353Smrg echo "\ 4798049353Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4898049353Smrg 496c19a6d3SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 506c19a6d3Smrgto PROGRAM being missing or too old. 5198049353Smrg 5298049353SmrgOptions: 5398049353Smrg -h, --help display this help and exit 5498049353Smrg -v, --version output version information and exit 5598049353Smrg 5698049353SmrgSupported PROGRAM values: 576c19a6d3Smrg aclocal autoconf autoheader autom4te automake makeinfo 586c19a6d3Smrg bison yacc flex lex help2man 590ad07f78Smrg 606c19a6d3SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 616c19a6d3Smrg'g' are ignored when checking the name. 620ad07f78Smrg 630ad07f78SmrgSend bug reports to <bug-automake@gnu.org>." 640ad07f78Smrg exit $? 6598049353Smrg ;; 6698049353Smrg 6798049353Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 680ad07f78Smrg echo "missing $scriptversion (GNU Automake)" 690ad07f78Smrg exit $? 7098049353Smrg ;; 7198049353Smrg 7298049353Smrg -*) 736c19a6d3Smrg echo 1>&2 "$0: unknown '$1' option" 746c19a6d3Smrg echo 1>&2 "Try '$0 --help' for more information" 7598049353Smrg exit 1 7698049353Smrg ;; 7798049353Smrg 780ad07f78Smrgesac 790ad07f78Smrg 806c19a6d3Smrg# Run the given program, remember its exit status. 816c19a6d3Smrg"$@"; st=$? 826c19a6d3Smrg 836c19a6d3Smrg# If it succeeded, we are done. 846c19a6d3Smrgtest $st -eq 0 && exit 0 856c19a6d3Smrg 866c19a6d3Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 876c19a6d3Smrg# passed; such an option is passed most likely to detect whether the 886c19a6d3Smrg# program is present and works. 896c19a6d3Smrgcase $2 in --version|--help) exit $st;; esac 906c19a6d3Smrg 916c19a6d3Smrg# Exit code 63 means version mismatch. This often happens when the user 926c19a6d3Smrg# tries to use an ancient version of a tool on a file that requires a 936c19a6d3Smrg# minimum version. 946c19a6d3Smrgif test $st -eq 63; then 956c19a6d3Smrg msg="probably too old" 966c19a6d3Smrgelif test $st -eq 127; then 976c19a6d3Smrg # Program was missing. 986c19a6d3Smrg msg="missing on your system" 996c19a6d3Smrgelse 1006c19a6d3Smrg # Program was found and executed, but failed. Give up. 1016c19a6d3Smrg exit $st 1026c19a6d3Smrgfi 10398049353Smrg 1046c19a6d3Smrgperl_URL=https://www.perl.org/ 1056c19a6d3Smrgflex_URL=https://github.com/westes/flex 1066c19a6d3Smrggnu_software_URL=https://www.gnu.org/software 1076c19a6d3Smrg 1086c19a6d3Smrgprogram_details () 1096c19a6d3Smrg{ 1106c19a6d3Smrg case $1 in 1116c19a6d3Smrg aclocal|automake) 1126c19a6d3Smrg echo "The '$1' program is part of the GNU Automake package:" 1136c19a6d3Smrg echo "<$gnu_software_URL/automake>" 1146c19a6d3Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1156c19a6d3Smrg echo "<$gnu_software_URL/autoconf>" 1166c19a6d3Smrg echo "<$gnu_software_URL/m4/>" 1176c19a6d3Smrg echo "<$perl_URL>" 1186c19a6d3Smrg ;; 1196c19a6d3Smrg autoconf|autom4te|autoheader) 1206c19a6d3Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1216c19a6d3Smrg echo "<$gnu_software_URL/autoconf/>" 1226c19a6d3Smrg echo "It also requires GNU m4 and Perl in order to run:" 1236c19a6d3Smrg echo "<$gnu_software_URL/m4/>" 1246c19a6d3Smrg echo "<$perl_URL>" 1256c19a6d3Smrg ;; 1266c19a6d3Smrg esac 1276c19a6d3Smrg} 1286c19a6d3Smrg 1296c19a6d3Smrggive_advice () 1306c19a6d3Smrg{ 1316c19a6d3Smrg # Normalize program name to check for. 1326c19a6d3Smrg normalized_program=`echo "$1" | sed ' 1336c19a6d3Smrg s/^gnu-//; t 1346c19a6d3Smrg s/^gnu//; t 1356c19a6d3Smrg s/^g//; t'` 1366c19a6d3Smrg 1376c19a6d3Smrg printf '%s\n' "'$1' is $msg." 1386c19a6d3Smrg 1396c19a6d3Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1406c19a6d3Smrg case $normalized_program in 1416c19a6d3Smrg autoconf*) 1426c19a6d3Smrg echo "You should only need it if you modified 'configure.ac'," 1436c19a6d3Smrg echo "or m4 files included by it." 1446c19a6d3Smrg program_details 'autoconf' 1456c19a6d3Smrg ;; 1466c19a6d3Smrg autoheader*) 1476c19a6d3Smrg echo "You should only need it if you modified 'acconfig.h' or" 1486c19a6d3Smrg echo "$configure_deps." 1496c19a6d3Smrg program_details 'autoheader' 1506c19a6d3Smrg ;; 1516c19a6d3Smrg automake*) 1526c19a6d3Smrg echo "You should only need it if you modified 'Makefile.am' or" 1536c19a6d3Smrg echo "$configure_deps." 1546c19a6d3Smrg program_details 'automake' 1556c19a6d3Smrg ;; 1566c19a6d3Smrg aclocal*) 1576c19a6d3Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1586c19a6d3Smrg echo "$configure_deps." 1596c19a6d3Smrg program_details 'aclocal' 1606c19a6d3Smrg ;; 1616c19a6d3Smrg autom4te*) 1626c19a6d3Smrg echo "You might have modified some maintainer files that require" 1636c19a6d3Smrg echo "the 'autom4te' program to be rebuilt." 1646c19a6d3Smrg program_details 'autom4te' 1656c19a6d3Smrg ;; 1666c19a6d3Smrg bison*|yacc*) 1676c19a6d3Smrg echo "You should only need it if you modified a '.y' file." 1686c19a6d3Smrg echo "You may want to install the GNU Bison package:" 1696c19a6d3Smrg echo "<$gnu_software_URL/bison/>" 1706c19a6d3Smrg ;; 1716c19a6d3Smrg lex*|flex*) 1726c19a6d3Smrg echo "You should only need it if you modified a '.l' file." 1736c19a6d3Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1746c19a6d3Smrg echo "<$flex_URL>" 1756c19a6d3Smrg ;; 1766c19a6d3Smrg help2man*) 1776c19a6d3Smrg echo "You should only need it if you modified a dependency" \ 1786c19a6d3Smrg "of a man page." 1796c19a6d3Smrg echo "You may want to install the GNU Help2man package:" 1806c19a6d3Smrg echo "<$gnu_software_URL/help2man/>" 1816c19a6d3Smrg ;; 1826c19a6d3Smrg makeinfo*) 1836c19a6d3Smrg echo "You should only need it if you modified a '.texi' file, or" 1846c19a6d3Smrg echo "any other file indirectly affecting the aspect of the manual." 1856c19a6d3Smrg echo "You might want to install the Texinfo package:" 1866c19a6d3Smrg echo "<$gnu_software_URL/texinfo/>" 1876c19a6d3Smrg echo "The spurious makeinfo call might also be the consequence of" 1886c19a6d3Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1896c19a6d3Smrg echo "want to install GNU make:" 1906c19a6d3Smrg echo "<$gnu_software_URL/make/>" 1916c19a6d3Smrg ;; 1926c19a6d3Smrg *) 1936c19a6d3Smrg echo "You might have modified some files without having the proper" 1946c19a6d3Smrg echo "tools for further handling them. Check the 'README' file, it" 1956c19a6d3Smrg echo "often tells you about the needed prerequisites for installing" 1966c19a6d3Smrg echo "this package. You may also peek at any GNU archive site, in" 1976c19a6d3Smrg echo "case some other package contains this missing '$1' program." 1986c19a6d3Smrg ;; 1996c19a6d3Smrg esac 2006c19a6d3Smrg} 2016c19a6d3Smrg 2026c19a6d3Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2036c19a6d3Smrg -e '2,$s/^/ /' >&2 2046c19a6d3Smrg 2056c19a6d3Smrg# Propagate the correct exit status (expected to be 127 for a program 2066c19a6d3Smrg# not found, 63 for a program that failed due to version mismatch). 2076c19a6d3Smrgexit $st 2080ad07f78Smrg 2090ad07f78Smrg# Local variables: 2106c19a6d3Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 2110ad07f78Smrg# time-stamp-start: "scriptversion=" 2120ad07f78Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2136c19a6d3Smrg# time-stamp-time-zone: "UTC0" 2140ad07f78Smrg# time-stamp-end: "; # UTC" 2150ad07f78Smrg# End: 216