missing revision 79d5fcd7
104007ebaSmrg#! /bin/sh 204007ebaSmrg# Common wrapper for a few potentially missing GNU programs. 304007ebaSmrg 405cf1079Smrgscriptversion=2018-03-07.03; # UTC 504007ebaSmrg 679d5fcd7Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 704007ebaSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 804007ebaSmrg 904007ebaSmrg# This program is free software; you can redistribute it and/or modify 1004007ebaSmrg# it under the terms of the GNU General Public License as published by 1104007ebaSmrg# the Free Software Foundation; either version 2, or (at your option) 1204007ebaSmrg# any later version. 1304007ebaSmrg 1404007ebaSmrg# This program is distributed in the hope that it will be useful, 1504007ebaSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1604007ebaSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1704007ebaSmrg# GNU General Public License for more details. 1804007ebaSmrg 1904007ebaSmrg# You should have received a copy of the GNU General Public License 2005cf1079Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 2104007ebaSmrg 2204007ebaSmrg# As a special exception to the GNU General Public License, if you 2304007ebaSmrg# distribute this file as part of a program that contains a 2404007ebaSmrg# configuration script generated by Autoconf, you may include it under 2504007ebaSmrg# the same distribution terms that you use for the rest of that program. 2604007ebaSmrg 2704007ebaSmrgif test $# -eq 0; then 2804007ebaSmrg echo 1>&2 "Try '$0 --help' for more information" 2904007ebaSmrg exit 1 3004007ebaSmrgfi 3104007ebaSmrg 3204007ebaSmrgcase $1 in 3304007ebaSmrg 3404007ebaSmrg --is-lightweight) 3504007ebaSmrg # Used by our autoconf macros to check whether the available missing 3604007ebaSmrg # script is modern enough. 3704007ebaSmrg exit 0 3804007ebaSmrg ;; 3904007ebaSmrg 4004007ebaSmrg --run) 4104007ebaSmrg # Back-compat with the calling convention used by older automake. 4204007ebaSmrg shift 4304007ebaSmrg ;; 4404007ebaSmrg 4504007ebaSmrg -h|--h|--he|--hel|--help) 4604007ebaSmrg echo "\ 4704007ebaSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4804007ebaSmrg 4904007ebaSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5004007ebaSmrgto PROGRAM being missing or too old. 5104007ebaSmrg 5204007ebaSmrgOptions: 5304007ebaSmrg -h, --help display this help and exit 5404007ebaSmrg -v, --version output version information and exit 5504007ebaSmrg 5604007ebaSmrgSupported PROGRAM values: 5704007ebaSmrg aclocal autoconf autoheader autom4te automake makeinfo 5804007ebaSmrg bison yacc flex lex help2man 5904007ebaSmrg 6004007ebaSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6104007ebaSmrg'g' are ignored when checking the name. 6204007ebaSmrg 6304007ebaSmrgSend bug reports to <bug-automake@gnu.org>." 6404007ebaSmrg exit $? 6504007ebaSmrg ;; 6604007ebaSmrg 6704007ebaSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 6804007ebaSmrg echo "missing $scriptversion (GNU Automake)" 6904007ebaSmrg exit $? 7004007ebaSmrg ;; 7104007ebaSmrg 7204007ebaSmrg -*) 7304007ebaSmrg echo 1>&2 "$0: unknown '$1' option" 7404007ebaSmrg echo 1>&2 "Try '$0 --help' for more information" 7504007ebaSmrg exit 1 7604007ebaSmrg ;; 7704007ebaSmrg 7804007ebaSmrgesac 7904007ebaSmrg 8004007ebaSmrg# Run the given program, remember its exit status. 8104007ebaSmrg"$@"; st=$? 8204007ebaSmrg 8304007ebaSmrg# If it succeeded, we are done. 8404007ebaSmrgtest $st -eq 0 && exit 0 8504007ebaSmrg 8604007ebaSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 8704007ebaSmrg# passed; such an option is passed most likely to detect whether the 8804007ebaSmrg# program is present and works. 8904007ebaSmrgcase $2 in --version|--help) exit $st;; esac 9004007ebaSmrg 9104007ebaSmrg# Exit code 63 means version mismatch. This often happens when the user 9204007ebaSmrg# tries to use an ancient version of a tool on a file that requires a 9304007ebaSmrg# minimum version. 9404007ebaSmrgif test $st -eq 63; then 9504007ebaSmrg msg="probably too old" 9604007ebaSmrgelif test $st -eq 127; then 9704007ebaSmrg # Program was missing. 9804007ebaSmrg msg="missing on your system" 9904007ebaSmrgelse 10004007ebaSmrg # Program was found and executed, but failed. Give up. 10104007ebaSmrg exit $st 10204007ebaSmrgfi 10304007ebaSmrg 10405cf1079Smrgperl_URL=https://www.perl.org/ 10505cf1079Smrgflex_URL=https://github.com/westes/flex 10605cf1079Smrggnu_software_URL=https://www.gnu.org/software 10704007ebaSmrg 10804007ebaSmrgprogram_details () 10904007ebaSmrg{ 11004007ebaSmrg case $1 in 11104007ebaSmrg aclocal|automake) 11204007ebaSmrg echo "The '$1' program is part of the GNU Automake package:" 11304007ebaSmrg echo "<$gnu_software_URL/automake>" 11404007ebaSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11504007ebaSmrg echo "<$gnu_software_URL/autoconf>" 11604007ebaSmrg echo "<$gnu_software_URL/m4/>" 11704007ebaSmrg echo "<$perl_URL>" 11804007ebaSmrg ;; 11904007ebaSmrg autoconf|autom4te|autoheader) 12004007ebaSmrg echo "The '$1' program is part of the GNU Autoconf package:" 12104007ebaSmrg echo "<$gnu_software_URL/autoconf/>" 12204007ebaSmrg echo "It also requires GNU m4 and Perl in order to run:" 12304007ebaSmrg echo "<$gnu_software_URL/m4/>" 12404007ebaSmrg echo "<$perl_URL>" 12504007ebaSmrg ;; 12604007ebaSmrg esac 12704007ebaSmrg} 12804007ebaSmrg 12904007ebaSmrggive_advice () 13004007ebaSmrg{ 13104007ebaSmrg # Normalize program name to check for. 13204007ebaSmrg normalized_program=`echo "$1" | sed ' 13304007ebaSmrg s/^gnu-//; t 13404007ebaSmrg s/^gnu//; t 13504007ebaSmrg s/^g//; t'` 13604007ebaSmrg 13704007ebaSmrg printf '%s\n' "'$1' is $msg." 13804007ebaSmrg 13904007ebaSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14004007ebaSmrg case $normalized_program in 14104007ebaSmrg autoconf*) 14204007ebaSmrg echo "You should only need it if you modified 'configure.ac'," 14304007ebaSmrg echo "or m4 files included by it." 14404007ebaSmrg program_details 'autoconf' 14504007ebaSmrg ;; 14604007ebaSmrg autoheader*) 14704007ebaSmrg echo "You should only need it if you modified 'acconfig.h' or" 14804007ebaSmrg echo "$configure_deps." 14904007ebaSmrg program_details 'autoheader' 15004007ebaSmrg ;; 15104007ebaSmrg automake*) 15204007ebaSmrg echo "You should only need it if you modified 'Makefile.am' or" 15304007ebaSmrg echo "$configure_deps." 15404007ebaSmrg program_details 'automake' 15504007ebaSmrg ;; 15604007ebaSmrg aclocal*) 15704007ebaSmrg echo "You should only need it if you modified 'acinclude.m4' or" 15804007ebaSmrg echo "$configure_deps." 15904007ebaSmrg program_details 'aclocal' 16004007ebaSmrg ;; 16104007ebaSmrg autom4te*) 16204007ebaSmrg echo "You might have modified some maintainer files that require" 1637f419768Smrg echo "the 'autom4te' program to be rebuilt." 16404007ebaSmrg program_details 'autom4te' 16504007ebaSmrg ;; 16604007ebaSmrg bison*|yacc*) 16704007ebaSmrg echo "You should only need it if you modified a '.y' file." 16804007ebaSmrg echo "You may want to install the GNU Bison package:" 16904007ebaSmrg echo "<$gnu_software_URL/bison/>" 17004007ebaSmrg ;; 17104007ebaSmrg lex*|flex*) 17204007ebaSmrg echo "You should only need it if you modified a '.l' file." 17304007ebaSmrg echo "You may want to install the Fast Lexical Analyzer package:" 17404007ebaSmrg echo "<$flex_URL>" 17504007ebaSmrg ;; 17604007ebaSmrg help2man*) 17704007ebaSmrg echo "You should only need it if you modified a dependency" \ 17804007ebaSmrg "of a man page." 17904007ebaSmrg echo "You may want to install the GNU Help2man package:" 18004007ebaSmrg echo "<$gnu_software_URL/help2man/>" 18104007ebaSmrg ;; 18204007ebaSmrg makeinfo*) 18304007ebaSmrg echo "You should only need it if you modified a '.texi' file, or" 18404007ebaSmrg echo "any other file indirectly affecting the aspect of the manual." 18504007ebaSmrg echo "You might want to install the Texinfo package:" 18604007ebaSmrg echo "<$gnu_software_URL/texinfo/>" 18704007ebaSmrg echo "The spurious makeinfo call might also be the consequence of" 18804007ebaSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18904007ebaSmrg echo "want to install GNU make:" 19004007ebaSmrg echo "<$gnu_software_URL/make/>" 19104007ebaSmrg ;; 19204007ebaSmrg *) 19304007ebaSmrg echo "You might have modified some files without having the proper" 19404007ebaSmrg echo "tools for further handling them. Check the 'README' file, it" 19504007ebaSmrg echo "often tells you about the needed prerequisites for installing" 19604007ebaSmrg echo "this package. You may also peek at any GNU archive site, in" 19704007ebaSmrg echo "case some other package contains this missing '$1' program." 19804007ebaSmrg ;; 19904007ebaSmrg esac 20004007ebaSmrg} 20104007ebaSmrg 20204007ebaSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20304007ebaSmrg -e '2,$s/^/ /' >&2 20404007ebaSmrg 20504007ebaSmrg# Propagate the correct exit status (expected to be 127 for a program 20604007ebaSmrg# not found, 63 for a program that failed due to version mismatch). 20704007ebaSmrgexit $st 20804007ebaSmrg 20904007ebaSmrg# Local variables: 21005cf1079Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 21104007ebaSmrg# time-stamp-start: "scriptversion=" 21204007ebaSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21305cf1079Smrg# time-stamp-time-zone: "UTC0" 21404007ebaSmrg# time-stamp-end: "; # UTC" 21504007ebaSmrg# End: 216