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