missing revision e8340fab
1129be1b7Smrg#! /bin/sh 2e1670675Smrg# Common wrapper for a few potentially missing GNU programs. 3a9a39c43Smrg 4e8340fabSmrgscriptversion=2018-03-07.03; # UTC 5a9a39c43Smrg 6e8340fabSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7e1670675Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8129be1b7Smrg 9129be1b7Smrg# This program is free software; you can redistribute it and/or modify 10129be1b7Smrg# it under the terms of the GNU General Public License as published by 11129be1b7Smrg# the Free Software Foundation; either version 2, or (at your option) 12129be1b7Smrg# any later version. 13129be1b7Smrg 14129be1b7Smrg# This program is distributed in the hope that it will be useful, 15129be1b7Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16129be1b7Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17129be1b7Smrg# GNU General Public License for more details. 18129be1b7Smrg 19129be1b7Smrg# You should have received a copy of the GNU General Public License 20e8340fabSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 21129be1b7Smrg 22129be1b7Smrg# As a special exception to the GNU General Public License, if you 23129be1b7Smrg# distribute this file as part of a program that contains a 24129be1b7Smrg# configuration script generated by Autoconf, you may include it under 25129be1b7Smrg# the same distribution terms that you use for the rest of that program. 26129be1b7Smrg 27129be1b7Smrgif test $# -eq 0; then 28e1670675Smrg echo 1>&2 "Try '$0 --help' for more information" 29129be1b7Smrg exit 1 30129be1b7Smrgfi 31129be1b7Smrg 32e1670675Smrgcase $1 in 33129be1b7Smrg 34e1670675Smrg --is-lightweight) 35e1670675Smrg # Used by our autoconf macros to check whether the available missing 36e1670675Smrg # script is modern enough. 37e1670675Smrg exit 0 38e1670675Smrg ;; 39a9a39c43Smrg 40e1670675Smrg --run) 41e1670675Smrg # Back-compat with the calling convention used by older automake. 42e1670675Smrg shift 43e1670675Smrg ;; 44129be1b7Smrg 45129be1b7Smrg -h|--h|--he|--hel|--help) 46129be1b7Smrg echo "\ 47129be1b7Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48129be1b7Smrg 49e1670675SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50e1670675Smrgto PROGRAM being missing or too old. 51129be1b7Smrg 52129be1b7SmrgOptions: 53129be1b7Smrg -h, --help display this help and exit 54129be1b7Smrg -v, --version output version information and exit 55129be1b7Smrg 56129be1b7SmrgSupported PROGRAM values: 57e1670675Smrg aclocal autoconf autoheader autom4te automake makeinfo 58e1670675Smrg bison yacc flex lex help2man 59a9a39c43Smrg 60e1670675SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61e1670675Smrg'g' are ignored when checking the name. 62a9a39c43Smrg 63a9a39c43SmrgSend bug reports to <bug-automake@gnu.org>." 64a9a39c43Smrg exit $? 65129be1b7Smrg ;; 66129be1b7Smrg 67129be1b7Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68a9a39c43Smrg echo "missing $scriptversion (GNU Automake)" 69a9a39c43Smrg exit $? 70129be1b7Smrg ;; 71129be1b7Smrg 72129be1b7Smrg -*) 73e1670675Smrg echo 1>&2 "$0: unknown '$1' option" 74e1670675Smrg echo 1>&2 "Try '$0 --help' for more information" 75129be1b7Smrg exit 1 76129be1b7Smrg ;; 77129be1b7Smrg 78a9a39c43Smrgesac 79a9a39c43Smrg 80e1670675Smrg# Run the given program, remember its exit status. 81e1670675Smrg"$@"; st=$? 82e1670675Smrg 83e1670675Smrg# If it succeeded, we are done. 84e1670675Smrgtest $st -eq 0 && exit 0 85e1670675Smrg 86e1670675Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87e1670675Smrg# passed; such an option is passed most likely to detect whether the 88e1670675Smrg# program is present and works. 89e1670675Smrgcase $2 in --version|--help) exit $st;; esac 90e1670675Smrg 91e1670675Smrg# Exit code 63 means version mismatch. This often happens when the user 92e1670675Smrg# tries to use an ancient version of a tool on a file that requires a 93e1670675Smrg# minimum version. 94e1670675Smrgif test $st -eq 63; then 95e1670675Smrg msg="probably too old" 96e1670675Smrgelif test $st -eq 127; then 97e1670675Smrg # Program was missing. 98e1670675Smrg msg="missing on your system" 99e1670675Smrgelse 100e1670675Smrg # Program was found and executed, but failed. Give up. 101e1670675Smrg exit $st 102e1670675Smrgfi 103129be1b7Smrg 104e8340fabSmrgperl_URL=https://www.perl.org/ 105e8340fabSmrgflex_URL=https://github.com/westes/flex 106e8340fabSmrggnu_software_URL=https://www.gnu.org/software 107e1670675Smrg 108e1670675Smrgprogram_details () 109e1670675Smrg{ 110e1670675Smrg case $1 in 111e1670675Smrg aclocal|automake) 112e1670675Smrg echo "The '$1' program is part of the GNU Automake package:" 113e1670675Smrg echo "<$gnu_software_URL/automake>" 114e1670675Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115e1670675Smrg echo "<$gnu_software_URL/autoconf>" 116e1670675Smrg echo "<$gnu_software_URL/m4/>" 117e1670675Smrg echo "<$perl_URL>" 118e1670675Smrg ;; 119e1670675Smrg autoconf|autom4te|autoheader) 120e1670675Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121e1670675Smrg echo "<$gnu_software_URL/autoconf/>" 122e1670675Smrg echo "It also requires GNU m4 and Perl in order to run:" 123e1670675Smrg echo "<$gnu_software_URL/m4/>" 124e1670675Smrg echo "<$perl_URL>" 125e1670675Smrg ;; 126e1670675Smrg esac 127e1670675Smrg} 128e1670675Smrg 129e1670675Smrggive_advice () 130e1670675Smrg{ 131e1670675Smrg # Normalize program name to check for. 132e1670675Smrg normalized_program=`echo "$1" | sed ' 133e1670675Smrg s/^gnu-//; t 134e1670675Smrg s/^gnu//; t 135e1670675Smrg s/^g//; t'` 136e1670675Smrg 137e1670675Smrg printf '%s\n' "'$1' is $msg." 138e1670675Smrg 139e1670675Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140e1670675Smrg case $normalized_program in 141e1670675Smrg autoconf*) 142e1670675Smrg echo "You should only need it if you modified 'configure.ac'," 143e1670675Smrg echo "or m4 files included by it." 144e1670675Smrg program_details 'autoconf' 145e1670675Smrg ;; 146e1670675Smrg autoheader*) 147e1670675Smrg echo "You should only need it if you modified 'acconfig.h' or" 148e1670675Smrg echo "$configure_deps." 149e1670675Smrg program_details 'autoheader' 150e1670675Smrg ;; 151e1670675Smrg automake*) 152e1670675Smrg echo "You should only need it if you modified 'Makefile.am' or" 153e1670675Smrg echo "$configure_deps." 154e1670675Smrg program_details 'automake' 155e1670675Smrg ;; 156e1670675Smrg aclocal*) 157e1670675Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158e1670675Smrg echo "$configure_deps." 159e1670675Smrg program_details 'aclocal' 160e1670675Smrg ;; 161e1670675Smrg autom4te*) 162e1670675Smrg echo "You might have modified some maintainer files that require" 163e1670675Smrg echo "the 'autom4te' program to be rebuilt." 164e1670675Smrg program_details 'autom4te' 165e1670675Smrg ;; 166e1670675Smrg bison*|yacc*) 167e1670675Smrg echo "You should only need it if you modified a '.y' file." 168e1670675Smrg echo "You may want to install the GNU Bison package:" 169e1670675Smrg echo "<$gnu_software_URL/bison/>" 170e1670675Smrg ;; 171e1670675Smrg lex*|flex*) 172e1670675Smrg echo "You should only need it if you modified a '.l' file." 173e1670675Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174e1670675Smrg echo "<$flex_URL>" 175e1670675Smrg ;; 176e1670675Smrg help2man*) 177e1670675Smrg echo "You should only need it if you modified a dependency" \ 178e1670675Smrg "of a man page." 179e1670675Smrg echo "You may want to install the GNU Help2man package:" 180e1670675Smrg echo "<$gnu_software_URL/help2man/>" 181e1670675Smrg ;; 182e1670675Smrg makeinfo*) 183e1670675Smrg echo "You should only need it if you modified a '.texi' file, or" 184e1670675Smrg echo "any other file indirectly affecting the aspect of the manual." 185e1670675Smrg echo "You might want to install the Texinfo package:" 186e1670675Smrg echo "<$gnu_software_URL/texinfo/>" 187e1670675Smrg echo "The spurious makeinfo call might also be the consequence of" 188e1670675Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189e1670675Smrg echo "want to install GNU make:" 190e1670675Smrg echo "<$gnu_software_URL/make/>" 191e1670675Smrg ;; 192e1670675Smrg *) 193e1670675Smrg echo "You might have modified some files without having the proper" 194e1670675Smrg echo "tools for further handling them. Check the 'README' file, it" 195e1670675Smrg echo "often tells you about the needed prerequisites for installing" 196e1670675Smrg echo "this package. You may also peek at any GNU archive site, in" 197e1670675Smrg echo "case some other package contains this missing '$1' program." 198e1670675Smrg ;; 199e1670675Smrg esac 200e1670675Smrg} 201e1670675Smrg 202e1670675Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203e1670675Smrg -e '2,$s/^/ /' >&2 204e1670675Smrg 205e1670675Smrg# Propagate the correct exit status (expected to be 127 for a program 206e1670675Smrg# not found, 63 for a program that failed due to version mismatch). 207e1670675Smrgexit $st 208a9a39c43Smrg 209a9a39c43Smrg# Local variables: 210e8340fabSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 211a9a39c43Smrg# time-stamp-start: "scriptversion=" 212a9a39c43Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213e8340fabSmrg# time-stamp-time-zone: "UTC0" 214a9a39c43Smrg# time-stamp-end: "; # UTC" 215a9a39c43Smrg# End: 216