missing revision 9f1d9476
1f33d31a3Smrg#! /bin/sh 2f33d31a3Smrg# Common wrapper for a few potentially missing GNU programs. 3f33d31a3Smrg 49f1d9476Smrgscriptversion=2018-03-07.03; # UTC 5f33d31a3Smrg 69f1d9476Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7f33d31a3Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8f33d31a3Smrg 9f33d31a3Smrg# This program is free software; you can redistribute it and/or modify 10f33d31a3Smrg# it under the terms of the GNU General Public License as published by 11f33d31a3Smrg# the Free Software Foundation; either version 2, or (at your option) 12f33d31a3Smrg# any later version. 13f33d31a3Smrg 14f33d31a3Smrg# This program is distributed in the hope that it will be useful, 15f33d31a3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16f33d31a3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17f33d31a3Smrg# GNU General Public License for more details. 18f33d31a3Smrg 19f33d31a3Smrg# You should have received a copy of the GNU General Public License 209f1d9476Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 21f33d31a3Smrg 22f33d31a3Smrg# As a special exception to the GNU General Public License, if you 23f33d31a3Smrg# distribute this file as part of a program that contains a 24f33d31a3Smrg# configuration script generated by Autoconf, you may include it under 25f33d31a3Smrg# the same distribution terms that you use for the rest of that program. 26f33d31a3Smrg 27f33d31a3Smrgif test $# -eq 0; then 28f33d31a3Smrg echo 1>&2 "Try '$0 --help' for more information" 29f33d31a3Smrg exit 1 30f33d31a3Smrgfi 31f33d31a3Smrg 32f33d31a3Smrgcase $1 in 33f33d31a3Smrg 34f33d31a3Smrg --is-lightweight) 35f33d31a3Smrg # Used by our autoconf macros to check whether the available missing 36f33d31a3Smrg # script is modern enough. 37f33d31a3Smrg exit 0 38f33d31a3Smrg ;; 39f33d31a3Smrg 40f33d31a3Smrg --run) 41f33d31a3Smrg # Back-compat with the calling convention used by older automake. 42f33d31a3Smrg shift 43f33d31a3Smrg ;; 44f33d31a3Smrg 45f33d31a3Smrg -h|--h|--he|--hel|--help) 46f33d31a3Smrg echo "\ 47f33d31a3Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48f33d31a3Smrg 49f33d31a3SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50f33d31a3Smrgto PROGRAM being missing or too old. 51f33d31a3Smrg 52f33d31a3SmrgOptions: 53f33d31a3Smrg -h, --help display this help and exit 54f33d31a3Smrg -v, --version output version information and exit 55f33d31a3Smrg 56f33d31a3SmrgSupported PROGRAM values: 57f33d31a3Smrg aclocal autoconf autoheader autom4te automake makeinfo 58f33d31a3Smrg bison yacc flex lex help2man 59f33d31a3Smrg 60f33d31a3SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61f33d31a3Smrg'g' are ignored when checking the name. 62f33d31a3Smrg 63f33d31a3SmrgSend bug reports to <bug-automake@gnu.org>." 64f33d31a3Smrg exit $? 65f33d31a3Smrg ;; 66f33d31a3Smrg 67f33d31a3Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68f33d31a3Smrg echo "missing $scriptversion (GNU Automake)" 69f33d31a3Smrg exit $? 70f33d31a3Smrg ;; 71f33d31a3Smrg 72f33d31a3Smrg -*) 73f33d31a3Smrg echo 1>&2 "$0: unknown '$1' option" 74f33d31a3Smrg echo 1>&2 "Try '$0 --help' for more information" 75f33d31a3Smrg exit 1 76f33d31a3Smrg ;; 77f33d31a3Smrg 78f33d31a3Smrgesac 79f33d31a3Smrg 80f33d31a3Smrg# Run the given program, remember its exit status. 81f33d31a3Smrg"$@"; st=$? 82f33d31a3Smrg 83f33d31a3Smrg# If it succeeded, we are done. 84f33d31a3Smrgtest $st -eq 0 && exit 0 85f33d31a3Smrg 86f33d31a3Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87f33d31a3Smrg# passed; such an option is passed most likely to detect whether the 88f33d31a3Smrg# program is present and works. 89f33d31a3Smrgcase $2 in --version|--help) exit $st;; esac 90f33d31a3Smrg 91f33d31a3Smrg# Exit code 63 means version mismatch. This often happens when the user 92f33d31a3Smrg# tries to use an ancient version of a tool on a file that requires a 93f33d31a3Smrg# minimum version. 94f33d31a3Smrgif test $st -eq 63; then 95f33d31a3Smrg msg="probably too old" 96f33d31a3Smrgelif test $st -eq 127; then 97f33d31a3Smrg # Program was missing. 98f33d31a3Smrg msg="missing on your system" 99f33d31a3Smrgelse 100f33d31a3Smrg # Program was found and executed, but failed. Give up. 101f33d31a3Smrg exit $st 102f33d31a3Smrgfi 103f33d31a3Smrg 1049f1d9476Smrgperl_URL=https://www.perl.org/ 1059f1d9476Smrgflex_URL=https://github.com/westes/flex 1069f1d9476Smrggnu_software_URL=https://www.gnu.org/software 107f33d31a3Smrg 108f33d31a3Smrgprogram_details () 109f33d31a3Smrg{ 110f33d31a3Smrg case $1 in 111f33d31a3Smrg aclocal|automake) 112f33d31a3Smrg echo "The '$1' program is part of the GNU Automake package:" 113f33d31a3Smrg echo "<$gnu_software_URL/automake>" 114f33d31a3Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115f33d31a3Smrg echo "<$gnu_software_URL/autoconf>" 116f33d31a3Smrg echo "<$gnu_software_URL/m4/>" 117f33d31a3Smrg echo "<$perl_URL>" 118f33d31a3Smrg ;; 119f33d31a3Smrg autoconf|autom4te|autoheader) 120f33d31a3Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121f33d31a3Smrg echo "<$gnu_software_URL/autoconf/>" 122f33d31a3Smrg echo "It also requires GNU m4 and Perl in order to run:" 123f33d31a3Smrg echo "<$gnu_software_URL/m4/>" 124f33d31a3Smrg echo "<$perl_URL>" 125f33d31a3Smrg ;; 126f33d31a3Smrg esac 127f33d31a3Smrg} 128f33d31a3Smrg 129f33d31a3Smrggive_advice () 130f33d31a3Smrg{ 131f33d31a3Smrg # Normalize program name to check for. 132f33d31a3Smrg normalized_program=`echo "$1" | sed ' 133f33d31a3Smrg s/^gnu-//; t 134f33d31a3Smrg s/^gnu//; t 135f33d31a3Smrg s/^g//; t'` 136f33d31a3Smrg 137f33d31a3Smrg printf '%s\n' "'$1' is $msg." 138f33d31a3Smrg 139f33d31a3Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140f33d31a3Smrg case $normalized_program in 141f33d31a3Smrg autoconf*) 142f33d31a3Smrg echo "You should only need it if you modified 'configure.ac'," 143f33d31a3Smrg echo "or m4 files included by it." 144f33d31a3Smrg program_details 'autoconf' 145f33d31a3Smrg ;; 146f33d31a3Smrg autoheader*) 147f33d31a3Smrg echo "You should only need it if you modified 'acconfig.h' or" 148f33d31a3Smrg echo "$configure_deps." 149f33d31a3Smrg program_details 'autoheader' 150f33d31a3Smrg ;; 151f33d31a3Smrg automake*) 152f33d31a3Smrg echo "You should only need it if you modified 'Makefile.am' or" 153f33d31a3Smrg echo "$configure_deps." 154f33d31a3Smrg program_details 'automake' 155f33d31a3Smrg ;; 156f33d31a3Smrg aclocal*) 157f33d31a3Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158f33d31a3Smrg echo "$configure_deps." 159f33d31a3Smrg program_details 'aclocal' 160f33d31a3Smrg ;; 161f33d31a3Smrg autom4te*) 162f33d31a3Smrg echo "You might have modified some maintainer files that require" 163f33d31a3Smrg echo "the 'autom4te' program to be rebuilt." 164f33d31a3Smrg program_details 'autom4te' 165f33d31a3Smrg ;; 166f33d31a3Smrg bison*|yacc*) 167f33d31a3Smrg echo "You should only need it if you modified a '.y' file." 168f33d31a3Smrg echo "You may want to install the GNU Bison package:" 169f33d31a3Smrg echo "<$gnu_software_URL/bison/>" 170f33d31a3Smrg ;; 171f33d31a3Smrg lex*|flex*) 172f33d31a3Smrg echo "You should only need it if you modified a '.l' file." 173f33d31a3Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174f33d31a3Smrg echo "<$flex_URL>" 175f33d31a3Smrg ;; 176f33d31a3Smrg help2man*) 177f33d31a3Smrg echo "You should only need it if you modified a dependency" \ 178f33d31a3Smrg "of a man page." 179f33d31a3Smrg echo "You may want to install the GNU Help2man package:" 180f33d31a3Smrg echo "<$gnu_software_URL/help2man/>" 181f33d31a3Smrg ;; 182f33d31a3Smrg makeinfo*) 183f33d31a3Smrg echo "You should only need it if you modified a '.texi' file, or" 184f33d31a3Smrg echo "any other file indirectly affecting the aspect of the manual." 185f33d31a3Smrg echo "You might want to install the Texinfo package:" 186f33d31a3Smrg echo "<$gnu_software_URL/texinfo/>" 187f33d31a3Smrg echo "The spurious makeinfo call might also be the consequence of" 188f33d31a3Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189f33d31a3Smrg echo "want to install GNU make:" 190f33d31a3Smrg echo "<$gnu_software_URL/make/>" 191f33d31a3Smrg ;; 192f33d31a3Smrg *) 193f33d31a3Smrg echo "You might have modified some files without having the proper" 194f33d31a3Smrg echo "tools for further handling them. Check the 'README' file, it" 195f33d31a3Smrg echo "often tells you about the needed prerequisites for installing" 196f33d31a3Smrg echo "this package. You may also peek at any GNU archive site, in" 197f33d31a3Smrg echo "case some other package contains this missing '$1' program." 198f33d31a3Smrg ;; 199f33d31a3Smrg esac 200f33d31a3Smrg} 201f33d31a3Smrg 202f33d31a3Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203f33d31a3Smrg -e '2,$s/^/ /' >&2 204f33d31a3Smrg 205f33d31a3Smrg# Propagate the correct exit status (expected to be 127 for a program 206f33d31a3Smrg# not found, 63 for a program that failed due to version mismatch). 207f33d31a3Smrgexit $st 208f33d31a3Smrg 209f33d31a3Smrg# Local variables: 2109f1d9476Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 211f33d31a3Smrg# time-stamp-start: "scriptversion=" 212f33d31a3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2139f1d9476Smrg# time-stamp-time-zone: "UTC0" 214f33d31a3Smrg# time-stamp-end: "; # UTC" 215f33d31a3Smrg# End: 216