missing revision 8d623946
1ee3138f1Smrg#! /bin/sh 2414bd68fSmrg# Common wrapper for a few potentially missing GNU programs. 3ee3138f1Smrg 48d623946Smrgscriptversion=2018-03-07.03; # UTC 5ee3138f1Smrg 68d623946Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7414bd68fSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8ee3138f1Smrg 9ee3138f1Smrg# This program is free software; you can redistribute it and/or modify 10ee3138f1Smrg# it under the terms of the GNU General Public License as published by 11ee3138f1Smrg# the Free Software Foundation; either version 2, or (at your option) 12ee3138f1Smrg# any later version. 13ee3138f1Smrg 14ee3138f1Smrg# This program is distributed in the hope that it will be useful, 15ee3138f1Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16ee3138f1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17ee3138f1Smrg# GNU General Public License for more details. 18ee3138f1Smrg 19ee3138f1Smrg# You should have received a copy of the GNU General Public License 208d623946Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 21ee3138f1Smrg 22ee3138f1Smrg# As a special exception to the GNU General Public License, if you 23ee3138f1Smrg# distribute this file as part of a program that contains a 24ee3138f1Smrg# configuration script generated by Autoconf, you may include it under 25ee3138f1Smrg# the same distribution terms that you use for the rest of that program. 26ee3138f1Smrg 27ee3138f1Smrgif test $# -eq 0; then 283e72ca8cSmrg echo 1>&2 "Try '$0 --help' for more information" 29ee3138f1Smrg exit 1 30ee3138f1Smrgfi 31ee3138f1Smrg 32414bd68fSmrgcase $1 in 33ee3138f1Smrg 34414bd68fSmrg --is-lightweight) 35414bd68fSmrg # Used by our autoconf macros to check whether the available missing 36414bd68fSmrg # script is modern enough. 37414bd68fSmrg exit 0 38414bd68fSmrg ;; 39ee3138f1Smrg 40414bd68fSmrg --run) 41414bd68fSmrg # Back-compat with the calling convention used by older automake. 42414bd68fSmrg shift 43414bd68fSmrg ;; 44ee3138f1Smrg 45ee3138f1Smrg -h|--h|--he|--hel|--help) 46ee3138f1Smrg echo "\ 47ee3138f1Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48ee3138f1Smrg 49414bd68fSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50414bd68fSmrgto PROGRAM being missing or too old. 51ee3138f1Smrg 52ee3138f1SmrgOptions: 53ee3138f1Smrg -h, --help display this help and exit 54ee3138f1Smrg -v, --version output version information and exit 55ee3138f1Smrg 56ee3138f1SmrgSupported PROGRAM values: 57414bd68fSmrg aclocal autoconf autoheader autom4te automake makeinfo 58414bd68fSmrg bison yacc flex lex help2man 59ee3138f1Smrg 603e72ca8cSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 613e72ca8cSmrg'g' are ignored when checking the name. 6234977a2fSmrg 63ee3138f1SmrgSend bug reports to <bug-automake@gnu.org>." 64ee3138f1Smrg exit $? 65ee3138f1Smrg ;; 66ee3138f1Smrg 67ee3138f1Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68ee3138f1Smrg echo "missing $scriptversion (GNU Automake)" 69ee3138f1Smrg exit $? 70ee3138f1Smrg ;; 71ee3138f1Smrg 72ee3138f1Smrg -*) 73414bd68fSmrg echo 1>&2 "$0: unknown '$1' option" 743e72ca8cSmrg echo 1>&2 "Try '$0 --help' for more information" 75ee3138f1Smrg exit 1 76ee3138f1Smrg ;; 77ee3138f1Smrg 78ee3138f1Smrgesac 79ee3138f1Smrg 80414bd68fSmrg# Run the given program, remember its exit status. 81414bd68fSmrg"$@"; st=$? 82414bd68fSmrg 83414bd68fSmrg# If it succeeded, we are done. 84414bd68fSmrgtest $st -eq 0 && exit 0 85414bd68fSmrg 86414bd68fSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 87414bd68fSmrg# passed; such an option is passed most likely to detect whether the 88414bd68fSmrg# program is present and works. 89414bd68fSmrgcase $2 in --version|--help) exit $st;; esac 90414bd68fSmrg 91414bd68fSmrg# Exit code 63 means version mismatch. This often happens when the user 92414bd68fSmrg# tries to use an ancient version of a tool on a file that requires a 93414bd68fSmrg# minimum version. 94414bd68fSmrgif test $st -eq 63; then 95414bd68fSmrg msg="probably too old" 96414bd68fSmrgelif test $st -eq 127; then 97414bd68fSmrg # Program was missing. 98414bd68fSmrg msg="missing on your system" 99414bd68fSmrgelse 100414bd68fSmrg # Program was found and executed, but failed. Give up. 101414bd68fSmrg exit $st 102414bd68fSmrgfi 103ee3138f1Smrg 1048d623946Smrgperl_URL=https://www.perl.org/ 1058d623946Smrgflex_URL=https://github.com/westes/flex 1068d623946Smrggnu_software_URL=https://www.gnu.org/software 107414bd68fSmrg 108414bd68fSmrgprogram_details () 109414bd68fSmrg{ 110414bd68fSmrg case $1 in 111414bd68fSmrg aclocal|automake) 112414bd68fSmrg echo "The '$1' program is part of the GNU Automake package:" 113414bd68fSmrg echo "<$gnu_software_URL/automake>" 114414bd68fSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115414bd68fSmrg echo "<$gnu_software_URL/autoconf>" 116414bd68fSmrg echo "<$gnu_software_URL/m4/>" 117414bd68fSmrg echo "<$perl_URL>" 118414bd68fSmrg ;; 119414bd68fSmrg autoconf|autom4te|autoheader) 120414bd68fSmrg echo "The '$1' program is part of the GNU Autoconf package:" 121414bd68fSmrg echo "<$gnu_software_URL/autoconf/>" 122414bd68fSmrg echo "It also requires GNU m4 and Perl in order to run:" 123414bd68fSmrg echo "<$gnu_software_URL/m4/>" 124414bd68fSmrg echo "<$perl_URL>" 125414bd68fSmrg ;; 126414bd68fSmrg esac 127414bd68fSmrg} 128414bd68fSmrg 129414bd68fSmrggive_advice () 130414bd68fSmrg{ 131414bd68fSmrg # Normalize program name to check for. 132414bd68fSmrg normalized_program=`echo "$1" | sed ' 133414bd68fSmrg s/^gnu-//; t 134414bd68fSmrg s/^gnu//; t 135414bd68fSmrg s/^g//; t'` 136414bd68fSmrg 137414bd68fSmrg printf '%s\n' "'$1' is $msg." 138414bd68fSmrg 139414bd68fSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140414bd68fSmrg case $normalized_program in 141414bd68fSmrg autoconf*) 142414bd68fSmrg echo "You should only need it if you modified 'configure.ac'," 143414bd68fSmrg echo "or m4 files included by it." 144414bd68fSmrg program_details 'autoconf' 145414bd68fSmrg ;; 146414bd68fSmrg autoheader*) 147414bd68fSmrg echo "You should only need it if you modified 'acconfig.h' or" 148414bd68fSmrg echo "$configure_deps." 149414bd68fSmrg program_details 'autoheader' 150414bd68fSmrg ;; 151414bd68fSmrg automake*) 152414bd68fSmrg echo "You should only need it if you modified 'Makefile.am' or" 153414bd68fSmrg echo "$configure_deps." 154414bd68fSmrg program_details 'automake' 155414bd68fSmrg ;; 156414bd68fSmrg aclocal*) 157414bd68fSmrg echo "You should only need it if you modified 'acinclude.m4' or" 158414bd68fSmrg echo "$configure_deps." 159414bd68fSmrg program_details 'aclocal' 160414bd68fSmrg ;; 161414bd68fSmrg autom4te*) 162414bd68fSmrg echo "You might have modified some maintainer files that require" 163414bd68fSmrg echo "the 'autom4te' program to be rebuilt." 164414bd68fSmrg program_details 'autom4te' 165414bd68fSmrg ;; 166414bd68fSmrg bison*|yacc*) 167414bd68fSmrg echo "You should only need it if you modified a '.y' file." 168414bd68fSmrg echo "You may want to install the GNU Bison package:" 169414bd68fSmrg echo "<$gnu_software_URL/bison/>" 170414bd68fSmrg ;; 171414bd68fSmrg lex*|flex*) 172414bd68fSmrg echo "You should only need it if you modified a '.l' file." 173414bd68fSmrg echo "You may want to install the Fast Lexical Analyzer package:" 174414bd68fSmrg echo "<$flex_URL>" 175414bd68fSmrg ;; 176414bd68fSmrg help2man*) 177414bd68fSmrg echo "You should only need it if you modified a dependency" \ 178414bd68fSmrg "of a man page." 179414bd68fSmrg echo "You may want to install the GNU Help2man package:" 180414bd68fSmrg echo "<$gnu_software_URL/help2man/>" 181ee3138f1Smrg ;; 182414bd68fSmrg makeinfo*) 183414bd68fSmrg echo "You should only need it if you modified a '.texi' file, or" 184414bd68fSmrg echo "any other file indirectly affecting the aspect of the manual." 185414bd68fSmrg echo "You might want to install the Texinfo package:" 186414bd68fSmrg echo "<$gnu_software_URL/texinfo/>" 187414bd68fSmrg echo "The spurious makeinfo call might also be the consequence of" 188414bd68fSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189414bd68fSmrg echo "want to install GNU make:" 190414bd68fSmrg echo "<$gnu_software_URL/make/>" 191414bd68fSmrg ;; 192414bd68fSmrg *) 193414bd68fSmrg echo "You might have modified some files without having the proper" 194414bd68fSmrg echo "tools for further handling them. Check the 'README' file, it" 195414bd68fSmrg echo "often tells you about the needed prerequisites for installing" 196414bd68fSmrg echo "this package. You may also peek at any GNU archive site, in" 197414bd68fSmrg echo "case some other package contains this missing '$1' program." 198414bd68fSmrg ;; 199414bd68fSmrg esac 200414bd68fSmrg} 201414bd68fSmrg 202414bd68fSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203414bd68fSmrg -e '2,$s/^/ /' >&2 204414bd68fSmrg 205414bd68fSmrg# Propagate the correct exit status (expected to be 127 for a program 206414bd68fSmrg# not found, 63 for a program that failed due to version mismatch). 207414bd68fSmrgexit $st 208ee3138f1Smrg 209ee3138f1Smrg# Local variables: 2108d623946Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 211ee3138f1Smrg# time-stamp-start: "scriptversion=" 212ee3138f1Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2138d623946Smrg# time-stamp-time-zone: "UTC0" 21434977a2fSmrg# time-stamp-end: "; # UTC" 215ee3138f1Smrg# End: 216