missing revision 26df5c7c
1a1d141d5Smrg#! /bin/sh 2054b3d00Smrg# Common wrapper for a few potentially missing GNU programs. 32ddb6cf1Smrg 426df5c7cSmrgscriptversion=2018-03-07.03; # UTC 52ddb6cf1Smrg 626df5c7cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7054b3d00Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8a1d141d5Smrg 9a1d141d5Smrg# This program is free software; you can redistribute it and/or modify 10a1d141d5Smrg# it under the terms of the GNU General Public License as published by 11a1d141d5Smrg# the Free Software Foundation; either version 2, or (at your option) 12a1d141d5Smrg# any later version. 13a1d141d5Smrg 14a1d141d5Smrg# This program is distributed in the hope that it will be useful, 15a1d141d5Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16a1d141d5Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17a1d141d5Smrg# GNU General Public License for more details. 18a1d141d5Smrg 19a1d141d5Smrg# You should have received a copy of the GNU General Public License 2026df5c7cSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 21a1d141d5Smrg 22a1d141d5Smrg# As a special exception to the GNU General Public License, if you 23a1d141d5Smrg# distribute this file as part of a program that contains a 24a1d141d5Smrg# configuration script generated by Autoconf, you may include it under 25a1d141d5Smrg# the same distribution terms that you use for the rest of that program. 26a1d141d5Smrg 27a1d141d5Smrgif test $# -eq 0; then 28054b3d00Smrg echo 1>&2 "Try '$0 --help' for more information" 29a1d141d5Smrg exit 1 30a1d141d5Smrgfi 31a1d141d5Smrg 32054b3d00Smrgcase $1 in 33a1d141d5Smrg 34054b3d00Smrg --is-lightweight) 35054b3d00Smrg # Used by our autoconf macros to check whether the available missing 36054b3d00Smrg # script is modern enough. 37054b3d00Smrg exit 0 38054b3d00Smrg ;; 392ddb6cf1Smrg 40054b3d00Smrg --run) 41054b3d00Smrg # Back-compat with the calling convention used by older automake. 42054b3d00Smrg shift 43054b3d00Smrg ;; 44a1d141d5Smrg 45a1d141d5Smrg -h|--h|--he|--hel|--help) 46a1d141d5Smrg echo "\ 47a1d141d5Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48a1d141d5Smrg 49054b3d00SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50054b3d00Smrgto PROGRAM being missing or too old. 51a1d141d5Smrg 52a1d141d5SmrgOptions: 53a1d141d5Smrg -h, --help display this help and exit 54a1d141d5Smrg -v, --version output version information and exit 55a1d141d5Smrg 56a1d141d5SmrgSupported PROGRAM values: 57054b3d00Smrg aclocal autoconf autoheader autom4te automake makeinfo 58054b3d00Smrg bison yacc flex lex help2man 592ddb6cf1Smrg 60054b3d00SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61054b3d00Smrg'g' are ignored when checking the name. 622ddb6cf1Smrg 632ddb6cf1SmrgSend bug reports to <bug-automake@gnu.org>." 642ddb6cf1Smrg exit $? 65a1d141d5Smrg ;; 66a1d141d5Smrg 67a1d141d5Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 682ddb6cf1Smrg echo "missing $scriptversion (GNU Automake)" 692ddb6cf1Smrg exit $? 70a1d141d5Smrg ;; 71a1d141d5Smrg 72a1d141d5Smrg -*) 73054b3d00Smrg echo 1>&2 "$0: unknown '$1' option" 74054b3d00Smrg echo 1>&2 "Try '$0 --help' for more information" 75a1d141d5Smrg exit 1 76a1d141d5Smrg ;; 77a1d141d5Smrg 782ddb6cf1Smrgesac 792ddb6cf1Smrg 80054b3d00Smrg# Run the given program, remember its exit status. 81054b3d00Smrg"$@"; st=$? 82054b3d00Smrg 83054b3d00Smrg# If it succeeded, we are done. 84054b3d00Smrgtest $st -eq 0 && exit 0 85054b3d00Smrg 86054b3d00Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87054b3d00Smrg# passed; such an option is passed most likely to detect whether the 88054b3d00Smrg# program is present and works. 89054b3d00Smrgcase $2 in --version|--help) exit $st;; esac 90054b3d00Smrg 91054b3d00Smrg# Exit code 63 means version mismatch. This often happens when the user 92054b3d00Smrg# tries to use an ancient version of a tool on a file that requires a 93054b3d00Smrg# minimum version. 94054b3d00Smrgif test $st -eq 63; then 95054b3d00Smrg msg="probably too old" 96054b3d00Smrgelif test $st -eq 127; then 97054b3d00Smrg # Program was missing. 98054b3d00Smrg msg="missing on your system" 99054b3d00Smrgelse 100054b3d00Smrg # Program was found and executed, but failed. Give up. 101054b3d00Smrg exit $st 102054b3d00Smrgfi 103a1d141d5Smrg 10426df5c7cSmrgperl_URL=https://www.perl.org/ 10526df5c7cSmrgflex_URL=https://github.com/westes/flex 10626df5c7cSmrggnu_software_URL=https://www.gnu.org/software 107054b3d00Smrg 108054b3d00Smrgprogram_details () 109054b3d00Smrg{ 110054b3d00Smrg case $1 in 111054b3d00Smrg aclocal|automake) 112054b3d00Smrg echo "The '$1' program is part of the GNU Automake package:" 113054b3d00Smrg echo "<$gnu_software_URL/automake>" 114054b3d00Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115054b3d00Smrg echo "<$gnu_software_URL/autoconf>" 116054b3d00Smrg echo "<$gnu_software_URL/m4/>" 117054b3d00Smrg echo "<$perl_URL>" 118054b3d00Smrg ;; 119054b3d00Smrg autoconf|autom4te|autoheader) 120054b3d00Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121054b3d00Smrg echo "<$gnu_software_URL/autoconf/>" 122054b3d00Smrg echo "It also requires GNU m4 and Perl in order to run:" 123054b3d00Smrg echo "<$gnu_software_URL/m4/>" 124054b3d00Smrg echo "<$perl_URL>" 125054b3d00Smrg ;; 126054b3d00Smrg esac 127054b3d00Smrg} 128054b3d00Smrg 129054b3d00Smrggive_advice () 130054b3d00Smrg{ 131054b3d00Smrg # Normalize program name to check for. 132054b3d00Smrg normalized_program=`echo "$1" | sed ' 133054b3d00Smrg s/^gnu-//; t 134054b3d00Smrg s/^gnu//; t 135054b3d00Smrg s/^g//; t'` 136054b3d00Smrg 137054b3d00Smrg printf '%s\n' "'$1' is $msg." 138054b3d00Smrg 139054b3d00Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140054b3d00Smrg case $normalized_program in 141054b3d00Smrg autoconf*) 142054b3d00Smrg echo "You should only need it if you modified 'configure.ac'," 143054b3d00Smrg echo "or m4 files included by it." 144054b3d00Smrg program_details 'autoconf' 145054b3d00Smrg ;; 146054b3d00Smrg autoheader*) 147054b3d00Smrg echo "You should only need it if you modified 'acconfig.h' or" 148054b3d00Smrg echo "$configure_deps." 149054b3d00Smrg program_details 'autoheader' 150054b3d00Smrg ;; 151054b3d00Smrg automake*) 152054b3d00Smrg echo "You should only need it if you modified 'Makefile.am' or" 153054b3d00Smrg echo "$configure_deps." 154054b3d00Smrg program_details 'automake' 155054b3d00Smrg ;; 156054b3d00Smrg aclocal*) 157054b3d00Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158054b3d00Smrg echo "$configure_deps." 159054b3d00Smrg program_details 'aclocal' 160054b3d00Smrg ;; 161054b3d00Smrg autom4te*) 162054b3d00Smrg echo "You might have modified some maintainer files that require" 163054b3d00Smrg echo "the 'autom4te' program to be rebuilt." 164054b3d00Smrg program_details 'autom4te' 165054b3d00Smrg ;; 166054b3d00Smrg bison*|yacc*) 167054b3d00Smrg echo "You should only need it if you modified a '.y' file." 168054b3d00Smrg echo "You may want to install the GNU Bison package:" 169054b3d00Smrg echo "<$gnu_software_URL/bison/>" 170054b3d00Smrg ;; 171054b3d00Smrg lex*|flex*) 172054b3d00Smrg echo "You should only need it if you modified a '.l' file." 173054b3d00Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174054b3d00Smrg echo "<$flex_URL>" 175054b3d00Smrg ;; 176054b3d00Smrg help2man*) 177054b3d00Smrg echo "You should only need it if you modified a dependency" \ 178054b3d00Smrg "of a man page." 179054b3d00Smrg echo "You may want to install the GNU Help2man package:" 180054b3d00Smrg echo "<$gnu_software_URL/help2man/>" 181054b3d00Smrg ;; 182054b3d00Smrg makeinfo*) 183054b3d00Smrg echo "You should only need it if you modified a '.texi' file, or" 184054b3d00Smrg echo "any other file indirectly affecting the aspect of the manual." 185054b3d00Smrg echo "You might want to install the Texinfo package:" 186054b3d00Smrg echo "<$gnu_software_URL/texinfo/>" 187054b3d00Smrg echo "The spurious makeinfo call might also be the consequence of" 188054b3d00Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189054b3d00Smrg echo "want to install GNU make:" 190054b3d00Smrg echo "<$gnu_software_URL/make/>" 191054b3d00Smrg ;; 192054b3d00Smrg *) 193054b3d00Smrg echo "You might have modified some files without having the proper" 194054b3d00Smrg echo "tools for further handling them. Check the 'README' file, it" 195054b3d00Smrg echo "often tells you about the needed prerequisites for installing" 196054b3d00Smrg echo "this package. You may also peek at any GNU archive site, in" 197054b3d00Smrg echo "case some other package contains this missing '$1' program." 198054b3d00Smrg ;; 199054b3d00Smrg esac 200054b3d00Smrg} 201054b3d00Smrg 202054b3d00Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203054b3d00Smrg -e '2,$s/^/ /' >&2 204054b3d00Smrg 205054b3d00Smrg# Propagate the correct exit status (expected to be 127 for a program 206054b3d00Smrg# not found, 63 for a program that failed due to version mismatch). 207054b3d00Smrgexit $st 2082ddb6cf1Smrg 2092ddb6cf1Smrg# Local variables: 21026df5c7cSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 2112ddb6cf1Smrg# time-stamp-start: "scriptversion=" 2122ddb6cf1Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21326df5c7cSmrg# time-stamp-time-zone: "UTC0" 2142ddb6cf1Smrg# time-stamp-end: "; # UTC" 2152ddb6cf1Smrg# End: 216