missing revision 111ba1da
10bd0e222Smrg#! /bin/sh 2111ba1daSmrg# Common wrapper for a few potentially missing GNU programs. 38ff16396Smrg 4111ba1daSmrgscriptversion=2018-03-07.03; # UTC 58ff16396Smrg 6111ba1daSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7111ba1daSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 80bd0e222Smrg 90bd0e222Smrg# This program is free software; you can redistribute it and/or modify 100bd0e222Smrg# it under the terms of the GNU General Public License as published by 110bd0e222Smrg# the Free Software Foundation; either version 2, or (at your option) 120bd0e222Smrg# any later version. 130bd0e222Smrg 140bd0e222Smrg# This program is distributed in the hope that it will be useful, 150bd0e222Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 160bd0e222Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 170bd0e222Smrg# GNU General Public License for more details. 180bd0e222Smrg 190bd0e222Smrg# You should have received a copy of the GNU General Public License 20111ba1daSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 210bd0e222Smrg 220bd0e222Smrg# As a special exception to the GNU General Public License, if you 230bd0e222Smrg# distribute this file as part of a program that contains a 240bd0e222Smrg# configuration script generated by Autoconf, you may include it under 250bd0e222Smrg# the same distribution terms that you use for the rest of that program. 260bd0e222Smrg 270bd0e222Smrgif test $# -eq 0; then 28111ba1daSmrg echo 1>&2 "Try '$0 --help' for more information" 290bd0e222Smrg exit 1 300bd0e222Smrgfi 310bd0e222Smrg 32111ba1daSmrgcase $1 in 330bd0e222Smrg 34111ba1daSmrg --is-lightweight) 35111ba1daSmrg # Used by our autoconf macros to check whether the available missing 36111ba1daSmrg # script is modern enough. 37111ba1daSmrg exit 0 38111ba1daSmrg ;; 398ff16396Smrg 40111ba1daSmrg --run) 41111ba1daSmrg # Back-compat with the calling convention used by older automake. 42111ba1daSmrg shift 43111ba1daSmrg ;; 440bd0e222Smrg 450bd0e222Smrg -h|--h|--he|--hel|--help) 460bd0e222Smrg echo "\ 470bd0e222Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 480bd0e222Smrg 49111ba1daSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50111ba1daSmrgto PROGRAM being missing or too old. 510bd0e222Smrg 520bd0e222SmrgOptions: 530bd0e222Smrg -h, --help display this help and exit 540bd0e222Smrg -v, --version output version information and exit 550bd0e222Smrg 560bd0e222SmrgSupported PROGRAM values: 57111ba1daSmrg aclocal autoconf autoheader autom4te automake makeinfo 58111ba1daSmrg bison yacc flex lex help2man 598ff16396Smrg 60111ba1daSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61111ba1daSmrg'g' are ignored when checking the name. 628ff16396Smrg 638ff16396SmrgSend bug reports to <bug-automake@gnu.org>." 648ff16396Smrg exit $? 650bd0e222Smrg ;; 660bd0e222Smrg 670bd0e222Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 688ff16396Smrg echo "missing $scriptversion (GNU Automake)" 698ff16396Smrg exit $? 700bd0e222Smrg ;; 710bd0e222Smrg 720bd0e222Smrg -*) 73111ba1daSmrg echo 1>&2 "$0: unknown '$1' option" 74111ba1daSmrg echo 1>&2 "Try '$0 --help' for more information" 750bd0e222Smrg exit 1 760bd0e222Smrg ;; 770bd0e222Smrg 788ff16396Smrgesac 798ff16396Smrg 80111ba1daSmrg# Run the given program, remember its exit status. 81111ba1daSmrg"$@"; st=$? 82111ba1daSmrg 83111ba1daSmrg# If it succeeded, we are done. 84111ba1daSmrgtest $st -eq 0 && exit 0 85111ba1daSmrg 86111ba1daSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 87111ba1daSmrg# passed; such an option is passed most likely to detect whether the 88111ba1daSmrg# program is present and works. 89111ba1daSmrgcase $2 in --version|--help) exit $st;; esac 90111ba1daSmrg 91111ba1daSmrg# Exit code 63 means version mismatch. This often happens when the user 92111ba1daSmrg# tries to use an ancient version of a tool on a file that requires a 93111ba1daSmrg# minimum version. 94111ba1daSmrgif test $st -eq 63; then 95111ba1daSmrg msg="probably too old" 96111ba1daSmrgelif test $st -eq 127; then 97111ba1daSmrg # Program was missing. 98111ba1daSmrg msg="missing on your system" 99111ba1daSmrgelse 100111ba1daSmrg # Program was found and executed, but failed. Give up. 101111ba1daSmrg exit $st 102111ba1daSmrgfi 1030bd0e222Smrg 104111ba1daSmrgperl_URL=https://www.perl.org/ 105111ba1daSmrgflex_URL=https://github.com/westes/flex 106111ba1daSmrggnu_software_URL=https://www.gnu.org/software 107111ba1daSmrg 108111ba1daSmrgprogram_details () 109111ba1daSmrg{ 110111ba1daSmrg case $1 in 111111ba1daSmrg aclocal|automake) 112111ba1daSmrg echo "The '$1' program is part of the GNU Automake package:" 113111ba1daSmrg echo "<$gnu_software_URL/automake>" 114111ba1daSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115111ba1daSmrg echo "<$gnu_software_URL/autoconf>" 116111ba1daSmrg echo "<$gnu_software_URL/m4/>" 117111ba1daSmrg echo "<$perl_URL>" 118111ba1daSmrg ;; 119111ba1daSmrg autoconf|autom4te|autoheader) 120111ba1daSmrg echo "The '$1' program is part of the GNU Autoconf package:" 121111ba1daSmrg echo "<$gnu_software_URL/autoconf/>" 122111ba1daSmrg echo "It also requires GNU m4 and Perl in order to run:" 123111ba1daSmrg echo "<$gnu_software_URL/m4/>" 124111ba1daSmrg echo "<$perl_URL>" 125111ba1daSmrg ;; 126111ba1daSmrg esac 127111ba1daSmrg} 128111ba1daSmrg 129111ba1daSmrggive_advice () 130111ba1daSmrg{ 131111ba1daSmrg # Normalize program name to check for. 132111ba1daSmrg normalized_program=`echo "$1" | sed ' 133111ba1daSmrg s/^gnu-//; t 134111ba1daSmrg s/^gnu//; t 135111ba1daSmrg s/^g//; t'` 136111ba1daSmrg 137111ba1daSmrg printf '%s\n' "'$1' is $msg." 138111ba1daSmrg 139111ba1daSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140111ba1daSmrg case $normalized_program in 141111ba1daSmrg autoconf*) 142111ba1daSmrg echo "You should only need it if you modified 'configure.ac'," 143111ba1daSmrg echo "or m4 files included by it." 144111ba1daSmrg program_details 'autoconf' 145111ba1daSmrg ;; 146111ba1daSmrg autoheader*) 147111ba1daSmrg echo "You should only need it if you modified 'acconfig.h' or" 148111ba1daSmrg echo "$configure_deps." 149111ba1daSmrg program_details 'autoheader' 150111ba1daSmrg ;; 151111ba1daSmrg automake*) 152111ba1daSmrg echo "You should only need it if you modified 'Makefile.am' or" 153111ba1daSmrg echo "$configure_deps." 154111ba1daSmrg program_details 'automake' 155111ba1daSmrg ;; 156111ba1daSmrg aclocal*) 157111ba1daSmrg echo "You should only need it if you modified 'acinclude.m4' or" 158111ba1daSmrg echo "$configure_deps." 159111ba1daSmrg program_details 'aclocal' 160111ba1daSmrg ;; 161111ba1daSmrg autom4te*) 162111ba1daSmrg echo "You might have modified some maintainer files that require" 163111ba1daSmrg echo "the 'autom4te' program to be rebuilt." 164111ba1daSmrg program_details 'autom4te' 165111ba1daSmrg ;; 166111ba1daSmrg bison*|yacc*) 167111ba1daSmrg echo "You should only need it if you modified a '.y' file." 168111ba1daSmrg echo "You may want to install the GNU Bison package:" 169111ba1daSmrg echo "<$gnu_software_URL/bison/>" 170111ba1daSmrg ;; 171111ba1daSmrg lex*|flex*) 172111ba1daSmrg echo "You should only need it if you modified a '.l' file." 173111ba1daSmrg echo "You may want to install the Fast Lexical Analyzer package:" 174111ba1daSmrg echo "<$flex_URL>" 175111ba1daSmrg ;; 176111ba1daSmrg help2man*) 177111ba1daSmrg echo "You should only need it if you modified a dependency" \ 178111ba1daSmrg "of a man page." 179111ba1daSmrg echo "You may want to install the GNU Help2man package:" 180111ba1daSmrg echo "<$gnu_software_URL/help2man/>" 181111ba1daSmrg ;; 182111ba1daSmrg makeinfo*) 183111ba1daSmrg echo "You should only need it if you modified a '.texi' file, or" 184111ba1daSmrg echo "any other file indirectly affecting the aspect of the manual." 185111ba1daSmrg echo "You might want to install the Texinfo package:" 186111ba1daSmrg echo "<$gnu_software_URL/texinfo/>" 187111ba1daSmrg echo "The spurious makeinfo call might also be the consequence of" 188111ba1daSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189111ba1daSmrg echo "want to install GNU make:" 190111ba1daSmrg echo "<$gnu_software_URL/make/>" 191111ba1daSmrg ;; 192111ba1daSmrg *) 193111ba1daSmrg echo "You might have modified some files without having the proper" 194111ba1daSmrg echo "tools for further handling them. Check the 'README' file, it" 195111ba1daSmrg echo "often tells you about the needed prerequisites for installing" 196111ba1daSmrg echo "this package. You may also peek at any GNU archive site, in" 197111ba1daSmrg echo "case some other package contains this missing '$1' program." 198111ba1daSmrg ;; 199111ba1daSmrg esac 200111ba1daSmrg} 201111ba1daSmrg 202111ba1daSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203111ba1daSmrg -e '2,$s/^/ /' >&2 204111ba1daSmrg 205111ba1daSmrg# Propagate the correct exit status (expected to be 127 for a program 206111ba1daSmrg# not found, 63 for a program that failed due to version mismatch). 207111ba1daSmrgexit $st 2088ff16396Smrg 2098ff16396Smrg# Local variables: 210111ba1daSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 2118ff16396Smrg# time-stamp-start: "scriptversion=" 2128ff16396Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213111ba1daSmrg# time-stamp-time-zone: "UTC0" 2148ff16396Smrg# time-stamp-end: "; # UTC" 2158ff16396Smrg# End: 216