missing revision 1a28b98b
10ed7c580Smrg#! /bin/sh 20ed7c580Smrg# Common wrapper for a few potentially missing GNU programs. 30ed7c580Smrg 41a28b98bSmrgscriptversion=2018-03-07.03; # UTC 50ed7c580Smrg 61a28b98bSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 70ed7c580Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 80ed7c580Smrg 90ed7c580Smrg# This program is free software; you can redistribute it and/or modify 100ed7c580Smrg# it under the terms of the GNU General Public License as published by 110ed7c580Smrg# the Free Software Foundation; either version 2, or (at your option) 120ed7c580Smrg# any later version. 130ed7c580Smrg 140ed7c580Smrg# This program is distributed in the hope that it will be useful, 150ed7c580Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 160ed7c580Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 170ed7c580Smrg# GNU General Public License for more details. 180ed7c580Smrg 190ed7c580Smrg# You should have received a copy of the GNU General Public License 201a28b98bSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 210ed7c580Smrg 220ed7c580Smrg# As a special exception to the GNU General Public License, if you 230ed7c580Smrg# distribute this file as part of a program that contains a 240ed7c580Smrg# configuration script generated by Autoconf, you may include it under 250ed7c580Smrg# the same distribution terms that you use for the rest of that program. 260ed7c580Smrg 270ed7c580Smrgif test $# -eq 0; then 280ed7c580Smrg echo 1>&2 "Try '$0 --help' for more information" 290ed7c580Smrg exit 1 300ed7c580Smrgfi 310ed7c580Smrg 320ed7c580Smrgcase $1 in 330ed7c580Smrg 340ed7c580Smrg --is-lightweight) 350ed7c580Smrg # Used by our autoconf macros to check whether the available missing 360ed7c580Smrg # script is modern enough. 370ed7c580Smrg exit 0 380ed7c580Smrg ;; 390ed7c580Smrg 400ed7c580Smrg --run) 410ed7c580Smrg # Back-compat with the calling convention used by older automake. 420ed7c580Smrg shift 430ed7c580Smrg ;; 440ed7c580Smrg 450ed7c580Smrg -h|--h|--he|--hel|--help) 460ed7c580Smrg echo "\ 470ed7c580Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 480ed7c580Smrg 490ed7c580SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 500ed7c580Smrgto PROGRAM being missing or too old. 510ed7c580Smrg 520ed7c580SmrgOptions: 530ed7c580Smrg -h, --help display this help and exit 540ed7c580Smrg -v, --version output version information and exit 550ed7c580Smrg 560ed7c580SmrgSupported PROGRAM values: 570ed7c580Smrg aclocal autoconf autoheader autom4te automake makeinfo 580ed7c580Smrg bison yacc flex lex help2man 590ed7c580Smrg 600ed7c580SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 610ed7c580Smrg'g' are ignored when checking the name. 620ed7c580Smrg 630ed7c580SmrgSend bug reports to <bug-automake@gnu.org>." 640ed7c580Smrg exit $? 650ed7c580Smrg ;; 660ed7c580Smrg 670ed7c580Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 680ed7c580Smrg echo "missing $scriptversion (GNU Automake)" 690ed7c580Smrg exit $? 700ed7c580Smrg ;; 710ed7c580Smrg 720ed7c580Smrg -*) 730ed7c580Smrg echo 1>&2 "$0: unknown '$1' option" 740ed7c580Smrg echo 1>&2 "Try '$0 --help' for more information" 750ed7c580Smrg exit 1 760ed7c580Smrg ;; 770ed7c580Smrg 780ed7c580Smrgesac 790ed7c580Smrg 800ed7c580Smrg# Run the given program, remember its exit status. 810ed7c580Smrg"$@"; st=$? 820ed7c580Smrg 830ed7c580Smrg# If it succeeded, we are done. 840ed7c580Smrgtest $st -eq 0 && exit 0 850ed7c580Smrg 860ed7c580Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 870ed7c580Smrg# passed; such an option is passed most likely to detect whether the 880ed7c580Smrg# program is present and works. 890ed7c580Smrgcase $2 in --version|--help) exit $st;; esac 900ed7c580Smrg 910ed7c580Smrg# Exit code 63 means version mismatch. This often happens when the user 920ed7c580Smrg# tries to use an ancient version of a tool on a file that requires a 930ed7c580Smrg# minimum version. 940ed7c580Smrgif test $st -eq 63; then 950ed7c580Smrg msg="probably too old" 960ed7c580Smrgelif test $st -eq 127; then 970ed7c580Smrg # Program was missing. 980ed7c580Smrg msg="missing on your system" 990ed7c580Smrgelse 1000ed7c580Smrg # Program was found and executed, but failed. Give up. 1010ed7c580Smrg exit $st 1020ed7c580Smrgfi 1030ed7c580Smrg 1041a28b98bSmrgperl_URL=https://www.perl.org/ 1051a28b98bSmrgflex_URL=https://github.com/westes/flex 1061a28b98bSmrggnu_software_URL=https://www.gnu.org/software 1070ed7c580Smrg 1080ed7c580Smrgprogram_details () 1090ed7c580Smrg{ 1100ed7c580Smrg case $1 in 1110ed7c580Smrg aclocal|automake) 1120ed7c580Smrg echo "The '$1' program is part of the GNU Automake package:" 1130ed7c580Smrg echo "<$gnu_software_URL/automake>" 1140ed7c580Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1150ed7c580Smrg echo "<$gnu_software_URL/autoconf>" 1160ed7c580Smrg echo "<$gnu_software_URL/m4/>" 1170ed7c580Smrg echo "<$perl_URL>" 1180ed7c580Smrg ;; 1190ed7c580Smrg autoconf|autom4te|autoheader) 1200ed7c580Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1210ed7c580Smrg echo "<$gnu_software_URL/autoconf/>" 1220ed7c580Smrg echo "It also requires GNU m4 and Perl in order to run:" 1230ed7c580Smrg echo "<$gnu_software_URL/m4/>" 1240ed7c580Smrg echo "<$perl_URL>" 1250ed7c580Smrg ;; 1260ed7c580Smrg esac 1270ed7c580Smrg} 1280ed7c580Smrg 1290ed7c580Smrggive_advice () 1300ed7c580Smrg{ 1310ed7c580Smrg # Normalize program name to check for. 1320ed7c580Smrg normalized_program=`echo "$1" | sed ' 1330ed7c580Smrg s/^gnu-//; t 1340ed7c580Smrg s/^gnu//; t 1350ed7c580Smrg s/^g//; t'` 1360ed7c580Smrg 1370ed7c580Smrg printf '%s\n' "'$1' is $msg." 1380ed7c580Smrg 1390ed7c580Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1400ed7c580Smrg case $normalized_program in 1410ed7c580Smrg autoconf*) 1420ed7c580Smrg echo "You should only need it if you modified 'configure.ac'," 1430ed7c580Smrg echo "or m4 files included by it." 1440ed7c580Smrg program_details 'autoconf' 1450ed7c580Smrg ;; 1460ed7c580Smrg autoheader*) 1470ed7c580Smrg echo "You should only need it if you modified 'acconfig.h' or" 1480ed7c580Smrg echo "$configure_deps." 1490ed7c580Smrg program_details 'autoheader' 1500ed7c580Smrg ;; 1510ed7c580Smrg automake*) 1520ed7c580Smrg echo "You should only need it if you modified 'Makefile.am' or" 1530ed7c580Smrg echo "$configure_deps." 1540ed7c580Smrg program_details 'automake' 1550ed7c580Smrg ;; 1560ed7c580Smrg aclocal*) 1570ed7c580Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1580ed7c580Smrg echo "$configure_deps." 1590ed7c580Smrg program_details 'aclocal' 1600ed7c580Smrg ;; 1610ed7c580Smrg autom4te*) 1620ed7c580Smrg echo "You might have modified some maintainer files that require" 1630ed7c580Smrg echo "the 'autom4te' program to be rebuilt." 1640ed7c580Smrg program_details 'autom4te' 1650ed7c580Smrg ;; 1660ed7c580Smrg bison*|yacc*) 1670ed7c580Smrg echo "You should only need it if you modified a '.y' file." 1680ed7c580Smrg echo "You may want to install the GNU Bison package:" 1690ed7c580Smrg echo "<$gnu_software_URL/bison/>" 1700ed7c580Smrg ;; 1710ed7c580Smrg lex*|flex*) 1720ed7c580Smrg echo "You should only need it if you modified a '.l' file." 1730ed7c580Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1740ed7c580Smrg echo "<$flex_URL>" 1750ed7c580Smrg ;; 1760ed7c580Smrg help2man*) 1770ed7c580Smrg echo "You should only need it if you modified a dependency" \ 1780ed7c580Smrg "of a man page." 1790ed7c580Smrg echo "You may want to install the GNU Help2man package:" 1800ed7c580Smrg echo "<$gnu_software_URL/help2man/>" 1810ed7c580Smrg ;; 1820ed7c580Smrg makeinfo*) 1830ed7c580Smrg echo "You should only need it if you modified a '.texi' file, or" 1840ed7c580Smrg echo "any other file indirectly affecting the aspect of the manual." 1850ed7c580Smrg echo "You might want to install the Texinfo package:" 1860ed7c580Smrg echo "<$gnu_software_URL/texinfo/>" 1870ed7c580Smrg echo "The spurious makeinfo call might also be the consequence of" 1880ed7c580Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1890ed7c580Smrg echo "want to install GNU make:" 1900ed7c580Smrg echo "<$gnu_software_URL/make/>" 1910ed7c580Smrg ;; 1920ed7c580Smrg *) 1930ed7c580Smrg echo "You might have modified some files without having the proper" 1940ed7c580Smrg echo "tools for further handling them. Check the 'README' file, it" 1950ed7c580Smrg echo "often tells you about the needed prerequisites for installing" 1960ed7c580Smrg echo "this package. You may also peek at any GNU archive site, in" 1970ed7c580Smrg echo "case some other package contains this missing '$1' program." 1980ed7c580Smrg ;; 1990ed7c580Smrg esac 2000ed7c580Smrg} 2010ed7c580Smrg 2020ed7c580Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2030ed7c580Smrg -e '2,$s/^/ /' >&2 2040ed7c580Smrg 2050ed7c580Smrg# Propagate the correct exit status (expected to be 127 for a program 2060ed7c580Smrg# not found, 63 for a program that failed due to version mismatch). 2070ed7c580Smrgexit $st 2080ed7c580Smrg 2090ed7c580Smrg# Local variables: 2101a28b98bSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 2110ed7c580Smrg# time-stamp-start: "scriptversion=" 2120ed7c580Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2131a28b98bSmrg# time-stamp-time-zone: "UTC0" 2140ed7c580Smrg# time-stamp-end: "; # UTC" 2150ed7c580Smrg# End: 216