missing revision 60da515c
1a96d7823Smrg#! /bin/sh 2a96d7823Smrg# Common wrapper for a few potentially missing GNU programs. 3a96d7823Smrg 460da515cSmrgscriptversion=2018-03-07.03; # UTC 5a96d7823Smrg 660da515cSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7a96d7823Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8a96d7823Smrg 9a96d7823Smrg# This program is free software; you can redistribute it and/or modify 10a96d7823Smrg# it under the terms of the GNU General Public License as published by 11a96d7823Smrg# the Free Software Foundation; either version 2, or (at your option) 12a96d7823Smrg# any later version. 13a96d7823Smrg 14a96d7823Smrg# This program is distributed in the hope that it will be useful, 15a96d7823Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16a96d7823Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17a96d7823Smrg# GNU General Public License for more details. 18a96d7823Smrg 19a96d7823Smrg# You should have received a copy of the GNU General Public License 2060da515cSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 21a96d7823Smrg 22a96d7823Smrg# As a special exception to the GNU General Public License, if you 23a96d7823Smrg# distribute this file as part of a program that contains a 24a96d7823Smrg# configuration script generated by Autoconf, you may include it under 25a96d7823Smrg# the same distribution terms that you use for the rest of that program. 26a96d7823Smrg 27a96d7823Smrgif test $# -eq 0; then 28a96d7823Smrg echo 1>&2 "Try '$0 --help' for more information" 29a96d7823Smrg exit 1 30a96d7823Smrgfi 31a96d7823Smrg 32a96d7823Smrgcase $1 in 33a96d7823Smrg 34a96d7823Smrg --is-lightweight) 35a96d7823Smrg # Used by our autoconf macros to check whether the available missing 36a96d7823Smrg # script is modern enough. 37a96d7823Smrg exit 0 38a96d7823Smrg ;; 39a96d7823Smrg 40a96d7823Smrg --run) 41a96d7823Smrg # Back-compat with the calling convention used by older automake. 42a96d7823Smrg shift 43a96d7823Smrg ;; 44a96d7823Smrg 45a96d7823Smrg -h|--h|--he|--hel|--help) 46a96d7823Smrg echo "\ 47a96d7823Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48a96d7823Smrg 49a96d7823SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50a96d7823Smrgto PROGRAM being missing or too old. 51a96d7823Smrg 52a96d7823SmrgOptions: 53a96d7823Smrg -h, --help display this help and exit 54a96d7823Smrg -v, --version output version information and exit 55a96d7823Smrg 56a96d7823SmrgSupported PROGRAM values: 57a96d7823Smrg aclocal autoconf autoheader autom4te automake makeinfo 58a96d7823Smrg bison yacc flex lex help2man 59a96d7823Smrg 60a96d7823SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61a96d7823Smrg'g' are ignored when checking the name. 62a96d7823Smrg 63a96d7823SmrgSend bug reports to <bug-automake@gnu.org>." 64a96d7823Smrg exit $? 65a96d7823Smrg ;; 66a96d7823Smrg 67a96d7823Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68a96d7823Smrg echo "missing $scriptversion (GNU Automake)" 69a96d7823Smrg exit $? 70a96d7823Smrg ;; 71a96d7823Smrg 72a96d7823Smrg -*) 73a96d7823Smrg echo 1>&2 "$0: unknown '$1' option" 74a96d7823Smrg echo 1>&2 "Try '$0 --help' for more information" 75a96d7823Smrg exit 1 76a96d7823Smrg ;; 77a96d7823Smrg 78a96d7823Smrgesac 79a96d7823Smrg 80a96d7823Smrg# Run the given program, remember its exit status. 81a96d7823Smrg"$@"; st=$? 82a96d7823Smrg 83a96d7823Smrg# If it succeeded, we are done. 84a96d7823Smrgtest $st -eq 0 && exit 0 85a96d7823Smrg 86a96d7823Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87a96d7823Smrg# passed; such an option is passed most likely to detect whether the 88a96d7823Smrg# program is present and works. 89a96d7823Smrgcase $2 in --version|--help) exit $st;; esac 90a96d7823Smrg 91a96d7823Smrg# Exit code 63 means version mismatch. This often happens when the user 92a96d7823Smrg# tries to use an ancient version of a tool on a file that requires a 93a96d7823Smrg# minimum version. 94a96d7823Smrgif test $st -eq 63; then 95a96d7823Smrg msg="probably too old" 96a96d7823Smrgelif test $st -eq 127; then 97a96d7823Smrg # Program was missing. 98a96d7823Smrg msg="missing on your system" 99a96d7823Smrgelse 100a96d7823Smrg # Program was found and executed, but failed. Give up. 101a96d7823Smrg exit $st 102a96d7823Smrgfi 103a96d7823Smrg 10460da515cSmrgperl_URL=https://www.perl.org/ 10560da515cSmrgflex_URL=https://github.com/westes/flex 10660da515cSmrggnu_software_URL=https://www.gnu.org/software 107a96d7823Smrg 108a96d7823Smrgprogram_details () 109a96d7823Smrg{ 110a96d7823Smrg case $1 in 111a96d7823Smrg aclocal|automake) 112a96d7823Smrg echo "The '$1' program is part of the GNU Automake package:" 113a96d7823Smrg echo "<$gnu_software_URL/automake>" 114a96d7823Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115a96d7823Smrg echo "<$gnu_software_URL/autoconf>" 116a96d7823Smrg echo "<$gnu_software_URL/m4/>" 117a96d7823Smrg echo "<$perl_URL>" 118a96d7823Smrg ;; 119a96d7823Smrg autoconf|autom4te|autoheader) 120a96d7823Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121a96d7823Smrg echo "<$gnu_software_URL/autoconf/>" 122a96d7823Smrg echo "It also requires GNU m4 and Perl in order to run:" 123a96d7823Smrg echo "<$gnu_software_URL/m4/>" 124a96d7823Smrg echo "<$perl_URL>" 125a96d7823Smrg ;; 126a96d7823Smrg esac 127a96d7823Smrg} 128a96d7823Smrg 129a96d7823Smrggive_advice () 130a96d7823Smrg{ 131a96d7823Smrg # Normalize program name to check for. 132a96d7823Smrg normalized_program=`echo "$1" | sed ' 133a96d7823Smrg s/^gnu-//; t 134a96d7823Smrg s/^gnu//; t 135a96d7823Smrg s/^g//; t'` 136a96d7823Smrg 137a96d7823Smrg printf '%s\n' "'$1' is $msg." 138a96d7823Smrg 139a96d7823Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140a96d7823Smrg case $normalized_program in 141a96d7823Smrg autoconf*) 142a96d7823Smrg echo "You should only need it if you modified 'configure.ac'," 143a96d7823Smrg echo "or m4 files included by it." 144a96d7823Smrg program_details 'autoconf' 145a96d7823Smrg ;; 146a96d7823Smrg autoheader*) 147a96d7823Smrg echo "You should only need it if you modified 'acconfig.h' or" 148a96d7823Smrg echo "$configure_deps." 149a96d7823Smrg program_details 'autoheader' 150a96d7823Smrg ;; 151a96d7823Smrg automake*) 152a96d7823Smrg echo "You should only need it if you modified 'Makefile.am' or" 153a96d7823Smrg echo "$configure_deps." 154a96d7823Smrg program_details 'automake' 155a96d7823Smrg ;; 156a96d7823Smrg aclocal*) 157a96d7823Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158a96d7823Smrg echo "$configure_deps." 159a96d7823Smrg program_details 'aclocal' 160a96d7823Smrg ;; 161a96d7823Smrg autom4te*) 162a96d7823Smrg echo "You might have modified some maintainer files that require" 163a96d7823Smrg echo "the 'autom4te' program to be rebuilt." 164a96d7823Smrg program_details 'autom4te' 165a96d7823Smrg ;; 166a96d7823Smrg bison*|yacc*) 167a96d7823Smrg echo "You should only need it if you modified a '.y' file." 168a96d7823Smrg echo "You may want to install the GNU Bison package:" 169a96d7823Smrg echo "<$gnu_software_URL/bison/>" 170a96d7823Smrg ;; 171a96d7823Smrg lex*|flex*) 172a96d7823Smrg echo "You should only need it if you modified a '.l' file." 173a96d7823Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174a96d7823Smrg echo "<$flex_URL>" 175a96d7823Smrg ;; 176a96d7823Smrg help2man*) 177a96d7823Smrg echo "You should only need it if you modified a dependency" \ 178a96d7823Smrg "of a man page." 179a96d7823Smrg echo "You may want to install the GNU Help2man package:" 180a96d7823Smrg echo "<$gnu_software_URL/help2man/>" 181a96d7823Smrg ;; 182a96d7823Smrg makeinfo*) 183a96d7823Smrg echo "You should only need it if you modified a '.texi' file, or" 184a96d7823Smrg echo "any other file indirectly affecting the aspect of the manual." 185a96d7823Smrg echo "You might want to install the Texinfo package:" 186a96d7823Smrg echo "<$gnu_software_URL/texinfo/>" 187a96d7823Smrg echo "The spurious makeinfo call might also be the consequence of" 188a96d7823Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189a96d7823Smrg echo "want to install GNU make:" 190a96d7823Smrg echo "<$gnu_software_URL/make/>" 191a96d7823Smrg ;; 192a96d7823Smrg *) 193a96d7823Smrg echo "You might have modified some files without having the proper" 194a96d7823Smrg echo "tools for further handling them. Check the 'README' file, it" 195a96d7823Smrg echo "often tells you about the needed prerequisites for installing" 196a96d7823Smrg echo "this package. You may also peek at any GNU archive site, in" 197a96d7823Smrg echo "case some other package contains this missing '$1' program." 198a96d7823Smrg ;; 199a96d7823Smrg esac 200a96d7823Smrg} 201a96d7823Smrg 202a96d7823Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203a96d7823Smrg -e '2,$s/^/ /' >&2 204a96d7823Smrg 205a96d7823Smrg# Propagate the correct exit status (expected to be 127 for a program 206a96d7823Smrg# not found, 63 for a program that failed due to version mismatch). 207a96d7823Smrgexit $st 208a96d7823Smrg 209a96d7823Smrg# Local variables: 21060da515cSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 211a96d7823Smrg# time-stamp-start: "scriptversion=" 212a96d7823Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21360da515cSmrg# time-stamp-time-zone: "UTC0" 214a96d7823Smrg# time-stamp-end: "; # UTC" 215a96d7823Smrg# End: 216