missing revision 0a1d3ae0
1de2362d3Smrg#! /bin/sh 218781e08Smrg# Common wrapper for a few potentially missing GNU programs. 3de2362d3Smrg 439413783Smrgscriptversion=2018-03-07.03; # UTC 5de2362d3Smrg 60a1d3ae0Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 718781e08Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8de2362d3Smrg 9de2362d3Smrg# This program is free software; you can redistribute it and/or modify 10de2362d3Smrg# it under the terms of the GNU General Public License as published by 11de2362d3Smrg# the Free Software Foundation; either version 2, or (at your option) 12de2362d3Smrg# any later version. 13de2362d3Smrg 14de2362d3Smrg# This program is distributed in the hope that it will be useful, 15de2362d3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16de2362d3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17de2362d3Smrg# GNU General Public License for more details. 18de2362d3Smrg 19de2362d3Smrg# You should have received a copy of the GNU General Public License 2039413783Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 21de2362d3Smrg 22de2362d3Smrg# As a special exception to the GNU General Public License, if you 23de2362d3Smrg# distribute this file as part of a program that contains a 24de2362d3Smrg# configuration script generated by Autoconf, you may include it under 25de2362d3Smrg# the same distribution terms that you use for the rest of that program. 26de2362d3Smrg 27de2362d3Smrgif test $# -eq 0; then 2818781e08Smrg echo 1>&2 "Try '$0 --help' for more information" 29de2362d3Smrg exit 1 30de2362d3Smrgfi 31de2362d3Smrg 3218781e08Smrgcase $1 in 33de2362d3Smrg 3418781e08Smrg --is-lightweight) 3518781e08Smrg # Used by our autoconf macros to check whether the available missing 3618781e08Smrg # script is modern enough. 3718781e08Smrg exit 0 3818781e08Smrg ;; 397821949aSmrg 4018781e08Smrg --run) 4118781e08Smrg # Back-compat with the calling convention used by older automake. 4218781e08Smrg shift 4318781e08Smrg ;; 44de2362d3Smrg 45de2362d3Smrg -h|--h|--he|--hel|--help) 46de2362d3Smrg echo "\ 47de2362d3Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48de2362d3Smrg 4918781e08SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5018781e08Smrgto PROGRAM being missing or too old. 51de2362d3Smrg 52de2362d3SmrgOptions: 53de2362d3Smrg -h, --help display this help and exit 54de2362d3Smrg -v, --version output version information and exit 55de2362d3Smrg 56de2362d3SmrgSupported PROGRAM values: 5718781e08Smrg aclocal autoconf autoheader autom4te automake makeinfo 5818781e08Smrg bison yacc flex lex help2man 590d16fef4Smrg 6018781e08SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6118781e08Smrg'g' are ignored when checking the name. 62de2362d3Smrg 63de2362d3SmrgSend bug reports to <bug-automake@gnu.org>." 64de2362d3Smrg exit $? 65de2362d3Smrg ;; 66de2362d3Smrg 67de2362d3Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68de2362d3Smrg echo "missing $scriptversion (GNU Automake)" 69de2362d3Smrg exit $? 70de2362d3Smrg ;; 71de2362d3Smrg 72de2362d3Smrg -*) 7318781e08Smrg echo 1>&2 "$0: unknown '$1' option" 7418781e08Smrg echo 1>&2 "Try '$0 --help' for more information" 75de2362d3Smrg exit 1 76de2362d3Smrg ;; 77de2362d3Smrg 78de2362d3Smrgesac 79de2362d3Smrg 8018781e08Smrg# Run the given program, remember its exit status. 8118781e08Smrg"$@"; st=$? 8218781e08Smrg 8318781e08Smrg# If it succeeded, we are done. 8418781e08Smrgtest $st -eq 0 && exit 0 8518781e08Smrg 8618781e08Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 8718781e08Smrg# passed; such an option is passed most likely to detect whether the 8818781e08Smrg# program is present and works. 8918781e08Smrgcase $2 in --version|--help) exit $st;; esac 9018781e08Smrg 9118781e08Smrg# Exit code 63 means version mismatch. This often happens when the user 9218781e08Smrg# tries to use an ancient version of a tool on a file that requires a 9318781e08Smrg# minimum version. 9418781e08Smrgif test $st -eq 63; then 9518781e08Smrg msg="probably too old" 9618781e08Smrgelif test $st -eq 127; then 9718781e08Smrg # Program was missing. 9818781e08Smrg msg="missing on your system" 9918781e08Smrgelse 10018781e08Smrg # Program was found and executed, but failed. Give up. 10118781e08Smrg exit $st 10218781e08Smrgfi 103de2362d3Smrg 10439413783Smrgperl_URL=https://www.perl.org/ 10539413783Smrgflex_URL=https://github.com/westes/flex 10639413783Smrggnu_software_URL=https://www.gnu.org/software 10718781e08Smrg 10818781e08Smrgprogram_details () 10918781e08Smrg{ 11018781e08Smrg case $1 in 11118781e08Smrg aclocal|automake) 11218781e08Smrg echo "The '$1' program is part of the GNU Automake package:" 11318781e08Smrg echo "<$gnu_software_URL/automake>" 11418781e08Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11518781e08Smrg echo "<$gnu_software_URL/autoconf>" 11618781e08Smrg echo "<$gnu_software_URL/m4/>" 11718781e08Smrg echo "<$perl_URL>" 11818781e08Smrg ;; 11918781e08Smrg autoconf|autom4te|autoheader) 12018781e08Smrg echo "The '$1' program is part of the GNU Autoconf package:" 12118781e08Smrg echo "<$gnu_software_URL/autoconf/>" 12218781e08Smrg echo "It also requires GNU m4 and Perl in order to run:" 12318781e08Smrg echo "<$gnu_software_URL/m4/>" 12418781e08Smrg echo "<$perl_URL>" 12518781e08Smrg ;; 12618781e08Smrg esac 12718781e08Smrg} 12818781e08Smrg 12918781e08Smrggive_advice () 13018781e08Smrg{ 13118781e08Smrg # Normalize program name to check for. 13218781e08Smrg normalized_program=`echo "$1" | sed ' 13318781e08Smrg s/^gnu-//; t 13418781e08Smrg s/^gnu//; t 13518781e08Smrg s/^g//; t'` 13618781e08Smrg 13718781e08Smrg printf '%s\n' "'$1' is $msg." 13818781e08Smrg 13918781e08Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14018781e08Smrg case $normalized_program in 14118781e08Smrg autoconf*) 14218781e08Smrg echo "You should only need it if you modified 'configure.ac'," 14318781e08Smrg echo "or m4 files included by it." 14418781e08Smrg program_details 'autoconf' 14518781e08Smrg ;; 14618781e08Smrg autoheader*) 14718781e08Smrg echo "You should only need it if you modified 'acconfig.h' or" 14818781e08Smrg echo "$configure_deps." 14918781e08Smrg program_details 'autoheader' 15018781e08Smrg ;; 15118781e08Smrg automake*) 15218781e08Smrg echo "You should only need it if you modified 'Makefile.am' or" 15318781e08Smrg echo "$configure_deps." 15418781e08Smrg program_details 'automake' 15518781e08Smrg ;; 15618781e08Smrg aclocal*) 15718781e08Smrg echo "You should only need it if you modified 'acinclude.m4' or" 15818781e08Smrg echo "$configure_deps." 15918781e08Smrg program_details 'aclocal' 16018781e08Smrg ;; 16118781e08Smrg autom4te*) 16218781e08Smrg echo "You might have modified some maintainer files that require" 16318781e08Smrg echo "the 'autom4te' program to be rebuilt." 16418781e08Smrg program_details 'autom4te' 16518781e08Smrg ;; 16618781e08Smrg bison*|yacc*) 16718781e08Smrg echo "You should only need it if you modified a '.y' file." 16818781e08Smrg echo "You may want to install the GNU Bison package:" 16918781e08Smrg echo "<$gnu_software_URL/bison/>" 17018781e08Smrg ;; 17118781e08Smrg lex*|flex*) 17218781e08Smrg echo "You should only need it if you modified a '.l' file." 17318781e08Smrg echo "You may want to install the Fast Lexical Analyzer package:" 17418781e08Smrg echo "<$flex_URL>" 17518781e08Smrg ;; 17618781e08Smrg help2man*) 17718781e08Smrg echo "You should only need it if you modified a dependency" \ 17818781e08Smrg "of a man page." 17918781e08Smrg echo "You may want to install the GNU Help2man package:" 18018781e08Smrg echo "<$gnu_software_URL/help2man/>" 18118781e08Smrg ;; 18218781e08Smrg makeinfo*) 18318781e08Smrg echo "You should only need it if you modified a '.texi' file, or" 18418781e08Smrg echo "any other file indirectly affecting the aspect of the manual." 18518781e08Smrg echo "You might want to install the Texinfo package:" 18618781e08Smrg echo "<$gnu_software_URL/texinfo/>" 18718781e08Smrg echo "The spurious makeinfo call might also be the consequence of" 18818781e08Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18918781e08Smrg echo "want to install GNU make:" 19018781e08Smrg echo "<$gnu_software_URL/make/>" 19118781e08Smrg ;; 19218781e08Smrg *) 19318781e08Smrg echo "You might have modified some files without having the proper" 19418781e08Smrg echo "tools for further handling them. Check the 'README' file, it" 19518781e08Smrg echo "often tells you about the needed prerequisites for installing" 19618781e08Smrg echo "this package. You may also peek at any GNU archive site, in" 19718781e08Smrg echo "case some other package contains this missing '$1' program." 19818781e08Smrg ;; 19918781e08Smrg esac 20018781e08Smrg} 20118781e08Smrg 20218781e08Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20318781e08Smrg -e '2,$s/^/ /' >&2 20418781e08Smrg 20518781e08Smrg# Propagate the correct exit status (expected to be 127 for a program 20618781e08Smrg# not found, 63 for a program that failed due to version mismatch). 20718781e08Smrgexit $st 208de2362d3Smrg 209de2362d3Smrg# Local variables: 21039413783Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 211de2362d3Smrg# time-stamp-start: "scriptversion=" 212de2362d3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21339413783Smrg# time-stamp-time-zone: "UTC0" 2140d16fef4Smrg# time-stamp-end: "; # UTC" 215de2362d3Smrg# End: 216