missing revision 949d0342
19f606849Smrg#! /bin/sh 2cdbfa18aSmrg# Common wrapper for a few potentially missing GNU programs. 39f606849Smrg 4949d0342Smrgscriptversion=2018-03-07.03; # UTC 59f606849Smrg 6949d0342Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7cdbfa18aSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 89f606849Smrg 99f606849Smrg# This program is free software; you can redistribute it and/or modify 109f606849Smrg# it under the terms of the GNU General Public License as published by 119f606849Smrg# the Free Software Foundation; either version 2, or (at your option) 129f606849Smrg# any later version. 139f606849Smrg 149f606849Smrg# This program is distributed in the hope that it will be useful, 159f606849Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 169f606849Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 179f606849Smrg# GNU General Public License for more details. 189f606849Smrg 199f606849Smrg# You should have received a copy of the GNU General Public License 20949d0342Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 219f606849Smrg 229f606849Smrg# As a special exception to the GNU General Public License, if you 239f606849Smrg# distribute this file as part of a program that contains a 249f606849Smrg# configuration script generated by Autoconf, you may include it under 259f606849Smrg# the same distribution terms that you use for the rest of that program. 269f606849Smrg 279f606849Smrgif test $# -eq 0; then 28cdbfa18aSmrg echo 1>&2 "Try '$0 --help' for more information" 299f606849Smrg exit 1 309f606849Smrgfi 319f606849Smrg 32cdbfa18aSmrgcase $1 in 339f606849Smrg 34cdbfa18aSmrg --is-lightweight) 35cdbfa18aSmrg # Used by our autoconf macros to check whether the available missing 36cdbfa18aSmrg # script is modern enough. 37cdbfa18aSmrg exit 0 38cdbfa18aSmrg ;; 399f606849Smrg 40cdbfa18aSmrg --run) 41cdbfa18aSmrg # Back-compat with the calling convention used by older automake. 42cdbfa18aSmrg shift 43cdbfa18aSmrg ;; 449f606849Smrg 459f606849Smrg -h|--h|--he|--hel|--help) 469f606849Smrg echo "\ 479f606849Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 489f606849Smrg 49cdbfa18aSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50cdbfa18aSmrgto PROGRAM being missing or too old. 519f606849Smrg 529f606849SmrgOptions: 539f606849Smrg -h, --help display this help and exit 549f606849Smrg -v, --version output version information and exit 559f606849Smrg 569f606849SmrgSupported PROGRAM values: 57cdbfa18aSmrg aclocal autoconf autoheader autom4te automake makeinfo 58cdbfa18aSmrg bison yacc flex lex help2man 599f606849Smrg 60cdbfa18aSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61cdbfa18aSmrg'g' are ignored when checking the name. 62fba89afeSmrg 639f606849SmrgSend bug reports to <bug-automake@gnu.org>." 649f606849Smrg exit $? 659f606849Smrg ;; 669f606849Smrg 679f606849Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 689f606849Smrg echo "missing $scriptversion (GNU Automake)" 699f606849Smrg exit $? 709f606849Smrg ;; 719f606849Smrg 729f606849Smrg -*) 73cdbfa18aSmrg echo 1>&2 "$0: unknown '$1' option" 74cdbfa18aSmrg echo 1>&2 "Try '$0 --help' for more information" 759f606849Smrg exit 1 769f606849Smrg ;; 779f606849Smrg 789f606849Smrgesac 799f606849Smrg 80cdbfa18aSmrg# Run the given program, remember its exit status. 81cdbfa18aSmrg"$@"; st=$? 82cdbfa18aSmrg 83cdbfa18aSmrg# If it succeeded, we are done. 84cdbfa18aSmrgtest $st -eq 0 && exit 0 85cdbfa18aSmrg 86cdbfa18aSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 87cdbfa18aSmrg# passed; such an option is passed most likely to detect whether the 88cdbfa18aSmrg# program is present and works. 89cdbfa18aSmrgcase $2 in --version|--help) exit $st;; esac 90cdbfa18aSmrg 91cdbfa18aSmrg# Exit code 63 means version mismatch. This often happens when the user 92cdbfa18aSmrg# tries to use an ancient version of a tool on a file that requires a 93cdbfa18aSmrg# minimum version. 94cdbfa18aSmrgif test $st -eq 63; then 95cdbfa18aSmrg msg="probably too old" 96cdbfa18aSmrgelif test $st -eq 127; then 97cdbfa18aSmrg # Program was missing. 98cdbfa18aSmrg msg="missing on your system" 99cdbfa18aSmrgelse 100cdbfa18aSmrg # Program was found and executed, but failed. Give up. 101cdbfa18aSmrg exit $st 102cdbfa18aSmrgfi 1039f606849Smrg 104949d0342Smrgperl_URL=https://www.perl.org/ 105949d0342Smrgflex_URL=https://github.com/westes/flex 106949d0342Smrggnu_software_URL=https://www.gnu.org/software 107cdbfa18aSmrg 108cdbfa18aSmrgprogram_details () 109cdbfa18aSmrg{ 110cdbfa18aSmrg case $1 in 111cdbfa18aSmrg aclocal|automake) 112cdbfa18aSmrg echo "The '$1' program is part of the GNU Automake package:" 113cdbfa18aSmrg echo "<$gnu_software_URL/automake>" 114cdbfa18aSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115cdbfa18aSmrg echo "<$gnu_software_URL/autoconf>" 116cdbfa18aSmrg echo "<$gnu_software_URL/m4/>" 117cdbfa18aSmrg echo "<$perl_URL>" 118cdbfa18aSmrg ;; 119cdbfa18aSmrg autoconf|autom4te|autoheader) 120cdbfa18aSmrg echo "The '$1' program is part of the GNU Autoconf package:" 121cdbfa18aSmrg echo "<$gnu_software_URL/autoconf/>" 122cdbfa18aSmrg echo "It also requires GNU m4 and Perl in order to run:" 123cdbfa18aSmrg echo "<$gnu_software_URL/m4/>" 124cdbfa18aSmrg echo "<$perl_URL>" 125cdbfa18aSmrg ;; 126cdbfa18aSmrg esac 127cdbfa18aSmrg} 128cdbfa18aSmrg 129cdbfa18aSmrggive_advice () 130cdbfa18aSmrg{ 131cdbfa18aSmrg # Normalize program name to check for. 132cdbfa18aSmrg normalized_program=`echo "$1" | sed ' 133cdbfa18aSmrg s/^gnu-//; t 134cdbfa18aSmrg s/^gnu//; t 135cdbfa18aSmrg s/^g//; t'` 136cdbfa18aSmrg 137cdbfa18aSmrg printf '%s\n' "'$1' is $msg." 138cdbfa18aSmrg 139cdbfa18aSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140cdbfa18aSmrg case $normalized_program in 141cdbfa18aSmrg autoconf*) 142cdbfa18aSmrg echo "You should only need it if you modified 'configure.ac'," 143cdbfa18aSmrg echo "or m4 files included by it." 144cdbfa18aSmrg program_details 'autoconf' 145cdbfa18aSmrg ;; 146cdbfa18aSmrg autoheader*) 147cdbfa18aSmrg echo "You should only need it if you modified 'acconfig.h' or" 148cdbfa18aSmrg echo "$configure_deps." 149cdbfa18aSmrg program_details 'autoheader' 150cdbfa18aSmrg ;; 151cdbfa18aSmrg automake*) 152cdbfa18aSmrg echo "You should only need it if you modified 'Makefile.am' or" 153cdbfa18aSmrg echo "$configure_deps." 154cdbfa18aSmrg program_details 'automake' 155cdbfa18aSmrg ;; 156cdbfa18aSmrg aclocal*) 157cdbfa18aSmrg echo "You should only need it if you modified 'acinclude.m4' or" 158cdbfa18aSmrg echo "$configure_deps." 159cdbfa18aSmrg program_details 'aclocal' 160cdbfa18aSmrg ;; 161cdbfa18aSmrg autom4te*) 162cdbfa18aSmrg echo "You might have modified some maintainer files that require" 163444fb138Smrg echo "the 'autom4te' program to be rebuilt." 164cdbfa18aSmrg program_details 'autom4te' 165cdbfa18aSmrg ;; 166cdbfa18aSmrg bison*|yacc*) 167cdbfa18aSmrg echo "You should only need it if you modified a '.y' file." 168cdbfa18aSmrg echo "You may want to install the GNU Bison package:" 169cdbfa18aSmrg echo "<$gnu_software_URL/bison/>" 170cdbfa18aSmrg ;; 171cdbfa18aSmrg lex*|flex*) 172cdbfa18aSmrg echo "You should only need it if you modified a '.l' file." 173cdbfa18aSmrg echo "You may want to install the Fast Lexical Analyzer package:" 174cdbfa18aSmrg echo "<$flex_URL>" 175cdbfa18aSmrg ;; 176cdbfa18aSmrg help2man*) 177cdbfa18aSmrg echo "You should only need it if you modified a dependency" \ 178cdbfa18aSmrg "of a man page." 179cdbfa18aSmrg echo "You may want to install the GNU Help2man package:" 180cdbfa18aSmrg echo "<$gnu_software_URL/help2man/>" 181cdbfa18aSmrg ;; 182cdbfa18aSmrg makeinfo*) 183cdbfa18aSmrg echo "You should only need it if you modified a '.texi' file, or" 184cdbfa18aSmrg echo "any other file indirectly affecting the aspect of the manual." 185cdbfa18aSmrg echo "You might want to install the Texinfo package:" 186cdbfa18aSmrg echo "<$gnu_software_URL/texinfo/>" 187cdbfa18aSmrg echo "The spurious makeinfo call might also be the consequence of" 188cdbfa18aSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189cdbfa18aSmrg echo "want to install GNU make:" 190cdbfa18aSmrg echo "<$gnu_software_URL/make/>" 191cdbfa18aSmrg ;; 192cdbfa18aSmrg *) 193cdbfa18aSmrg echo "You might have modified some files without having the proper" 194cdbfa18aSmrg echo "tools for further handling them. Check the 'README' file, it" 195cdbfa18aSmrg echo "often tells you about the needed prerequisites for installing" 196cdbfa18aSmrg echo "this package. You may also peek at any GNU archive site, in" 197cdbfa18aSmrg echo "case some other package contains this missing '$1' program." 198cdbfa18aSmrg ;; 199cdbfa18aSmrg esac 200cdbfa18aSmrg} 201cdbfa18aSmrg 202cdbfa18aSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203cdbfa18aSmrg -e '2,$s/^/ /' >&2 204cdbfa18aSmrg 205cdbfa18aSmrg# Propagate the correct exit status (expected to be 127 for a program 206cdbfa18aSmrg# not found, 63 for a program that failed due to version mismatch). 207cdbfa18aSmrgexit $st 2089f606849Smrg 2099f606849Smrg# Local variables: 210949d0342Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 2119f606849Smrg# time-stamp-start: "scriptversion=" 2129f606849Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213949d0342Smrg# time-stamp-time-zone: "UTC0" 214fba89afeSmrg# time-stamp-end: "; # UTC" 2159f606849Smrg# End: 216