missing revision d9dcd5ae
1191cded7Smrg#! /bin/sh 2d9dcd5aeSmrg# Common wrapper for a few potentially missing GNU programs. 3191cded7Smrg 4d9dcd5aeSmrgscriptversion=2012-06-26.16; # UTC 5191cded7Smrg 6d9dcd5aeSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 7d9dcd5aeSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8191cded7Smrg 9191cded7Smrg# This program is free software; you can redistribute it and/or modify 10191cded7Smrg# it under the terms of the GNU General Public License as published by 11191cded7Smrg# the Free Software Foundation; either version 2, or (at your option) 12191cded7Smrg# any later version. 13191cded7Smrg 14191cded7Smrg# This program is distributed in the hope that it will be useful, 15191cded7Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16191cded7Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17191cded7Smrg# GNU General Public License for more details. 18191cded7Smrg 19191cded7Smrg# You should have received a copy of the GNU General Public License 20ba064abeSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21191cded7Smrg 22191cded7Smrg# As a special exception to the GNU General Public License, if you 23191cded7Smrg# distribute this file as part of a program that contains a 24191cded7Smrg# configuration script generated by Autoconf, you may include it under 25191cded7Smrg# the same distribution terms that you use for the rest of that program. 26191cded7Smrg 27191cded7Smrgif test $# -eq 0; then 28d9dcd5aeSmrg echo 1>&2 "Try '$0 --help' for more information" 29191cded7Smrg exit 1 30191cded7Smrgfi 31191cded7Smrg 32d9dcd5aeSmrgcase $1 in 33191cded7Smrg 34d9dcd5aeSmrg --is-lightweight) 35d9dcd5aeSmrg # Used by our autoconf macros to check whether the available missing 36d9dcd5aeSmrg # script is modern enough. 37d9dcd5aeSmrg exit 0 38d9dcd5aeSmrg ;; 39191cded7Smrg 40d9dcd5aeSmrg --run) 41d9dcd5aeSmrg # Back-compat with the calling convention used by older automake. 42d9dcd5aeSmrg shift 43d9dcd5aeSmrg ;; 44191cded7Smrg 45191cded7Smrg -h|--h|--he|--hel|--help) 46191cded7Smrg echo "\ 47191cded7Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48191cded7Smrg 49d9dcd5aeSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50d9dcd5aeSmrgto PROGRAM being missing or too old. 51191cded7Smrg 52191cded7SmrgOptions: 53191cded7Smrg -h, --help display this help and exit 54191cded7Smrg -v, --version output version information and exit 55191cded7Smrg 56191cded7SmrgSupported PROGRAM values: 57d9dcd5aeSmrg aclocal autoconf autoheader autom4te automake makeinfo 58d9dcd5aeSmrg bison yacc flex lex help2man 59191cded7Smrg 60d9dcd5aeSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61d9dcd5aeSmrg'g' are ignored when checking the name. 62ba064abeSmrg 63191cded7SmrgSend bug reports to <bug-automake@gnu.org>." 64191cded7Smrg exit $? 65191cded7Smrg ;; 66191cded7Smrg 67191cded7Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68191cded7Smrg echo "missing $scriptversion (GNU Automake)" 69191cded7Smrg exit $? 70191cded7Smrg ;; 71191cded7Smrg 72191cded7Smrg -*) 73d9dcd5aeSmrg echo 1>&2 "$0: unknown '$1' option" 74d9dcd5aeSmrg echo 1>&2 "Try '$0 --help' for more information" 75191cded7Smrg exit 1 76191cded7Smrg ;; 77191cded7Smrg 78191cded7Smrgesac 79191cded7Smrg 80d9dcd5aeSmrg# Run the given program, remember its exit status. 81d9dcd5aeSmrg"$@"; st=$? 82d9dcd5aeSmrg 83d9dcd5aeSmrg# If it succeeded, we are done. 84d9dcd5aeSmrgtest $st -eq 0 && exit 0 85d9dcd5aeSmrg 86d9dcd5aeSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 87d9dcd5aeSmrg# passed; such an option is passed most likely to detect whether the 88d9dcd5aeSmrg# program is present and works. 89d9dcd5aeSmrgcase $2 in --version|--help) exit $st;; esac 90d9dcd5aeSmrg 91d9dcd5aeSmrg# Exit code 63 means version mismatch. This often happens when the user 92d9dcd5aeSmrg# tries to use an ancient version of a tool on a file that requires a 93d9dcd5aeSmrg# minimum version. 94d9dcd5aeSmrgif test $st -eq 63; then 95d9dcd5aeSmrg msg="probably too old" 96d9dcd5aeSmrgelif test $st -eq 127; then 97d9dcd5aeSmrg # Program was missing. 98d9dcd5aeSmrg msg="missing on your system" 99d9dcd5aeSmrgelse 100d9dcd5aeSmrg # Program was found and executed, but failed. Give up. 101d9dcd5aeSmrg exit $st 102d9dcd5aeSmrgfi 103191cded7Smrg 104d9dcd5aeSmrgperl_URL=http://www.perl.org/ 105d9dcd5aeSmrgflex_URL=http://flex.sourceforge.net/ 106d9dcd5aeSmrggnu_software_URL=http://www.gnu.org/software 107d9dcd5aeSmrg 108d9dcd5aeSmrgprogram_details () 109d9dcd5aeSmrg{ 110d9dcd5aeSmrg case $1 in 111d9dcd5aeSmrg aclocal|automake) 112d9dcd5aeSmrg echo "The '$1' program is part of the GNU Automake package:" 113d9dcd5aeSmrg echo "<$gnu_software_URL/automake>" 114d9dcd5aeSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115d9dcd5aeSmrg echo "<$gnu_software_URL/autoconf>" 116d9dcd5aeSmrg echo "<$gnu_software_URL/m4/>" 117d9dcd5aeSmrg echo "<$perl_URL>" 118d9dcd5aeSmrg ;; 119d9dcd5aeSmrg autoconf|autom4te|autoheader) 120d9dcd5aeSmrg echo "The '$1' program is part of the GNU Autoconf package:" 121d9dcd5aeSmrg echo "<$gnu_software_URL/autoconf/>" 122d9dcd5aeSmrg echo "It also requires GNU m4 and Perl in order to run:" 123d9dcd5aeSmrg echo "<$gnu_software_URL/m4/>" 124d9dcd5aeSmrg echo "<$perl_URL>" 125d9dcd5aeSmrg ;; 126d9dcd5aeSmrg esac 127d9dcd5aeSmrg} 128d9dcd5aeSmrg 129d9dcd5aeSmrggive_advice () 130d9dcd5aeSmrg{ 131d9dcd5aeSmrg # Normalize program name to check for. 132d9dcd5aeSmrg normalized_program=`echo "$1" | sed ' 133d9dcd5aeSmrg s/^gnu-//; t 134d9dcd5aeSmrg s/^gnu//; t 135d9dcd5aeSmrg s/^g//; t'` 136d9dcd5aeSmrg 137d9dcd5aeSmrg printf '%s\n' "'$1' is $msg." 138d9dcd5aeSmrg 139d9dcd5aeSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140d9dcd5aeSmrg case $normalized_program in 141d9dcd5aeSmrg autoconf*) 142d9dcd5aeSmrg echo "You should only need it if you modified 'configure.ac'," 143d9dcd5aeSmrg echo "or m4 files included by it." 144d9dcd5aeSmrg program_details 'autoconf' 145d9dcd5aeSmrg ;; 146d9dcd5aeSmrg autoheader*) 147d9dcd5aeSmrg echo "You should only need it if you modified 'acconfig.h' or" 148d9dcd5aeSmrg echo "$configure_deps." 149d9dcd5aeSmrg program_details 'autoheader' 150d9dcd5aeSmrg ;; 151d9dcd5aeSmrg automake*) 152d9dcd5aeSmrg echo "You should only need it if you modified 'Makefile.am' or" 153d9dcd5aeSmrg echo "$configure_deps." 154d9dcd5aeSmrg program_details 'automake' 155d9dcd5aeSmrg ;; 156d9dcd5aeSmrg aclocal*) 157d9dcd5aeSmrg echo "You should only need it if you modified 'acinclude.m4' or" 158d9dcd5aeSmrg echo "$configure_deps." 159d9dcd5aeSmrg program_details 'aclocal' 160d9dcd5aeSmrg ;; 161d9dcd5aeSmrg autom4te*) 162d9dcd5aeSmrg echo "You might have modified some maintainer files that require" 163d9dcd5aeSmrg echo "the 'automa4te' program to be rebuilt." 164d9dcd5aeSmrg program_details 'autom4te' 165d9dcd5aeSmrg ;; 166d9dcd5aeSmrg bison*|yacc*) 167d9dcd5aeSmrg echo "You should only need it if you modified a '.y' file." 168d9dcd5aeSmrg echo "You may want to install the GNU Bison package:" 169d9dcd5aeSmrg echo "<$gnu_software_URL/bison/>" 170d9dcd5aeSmrg ;; 171d9dcd5aeSmrg lex*|flex*) 172d9dcd5aeSmrg echo "You should only need it if you modified a '.l' file." 173d9dcd5aeSmrg echo "You may want to install the Fast Lexical Analyzer package:" 174d9dcd5aeSmrg echo "<$flex_URL>" 175d9dcd5aeSmrg ;; 176d9dcd5aeSmrg help2man*) 177d9dcd5aeSmrg echo "You should only need it if you modified a dependency" \ 178d9dcd5aeSmrg "of a man page." 179d9dcd5aeSmrg echo "You may want to install the GNU Help2man package:" 180d9dcd5aeSmrg echo "<$gnu_software_URL/help2man/>" 181d9dcd5aeSmrg ;; 182d9dcd5aeSmrg makeinfo*) 183d9dcd5aeSmrg echo "You should only need it if you modified a '.texi' file, or" 184d9dcd5aeSmrg echo "any other file indirectly affecting the aspect of the manual." 185d9dcd5aeSmrg echo "You might want to install the Texinfo package:" 186d9dcd5aeSmrg echo "<$gnu_software_URL/texinfo/>" 187d9dcd5aeSmrg echo "The spurious makeinfo call might also be the consequence of" 188d9dcd5aeSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189d9dcd5aeSmrg echo "want to install GNU make:" 190d9dcd5aeSmrg echo "<$gnu_software_URL/make/>" 191d9dcd5aeSmrg ;; 192d9dcd5aeSmrg *) 193d9dcd5aeSmrg echo "You might have modified some files without having the proper" 194d9dcd5aeSmrg echo "tools for further handling them. Check the 'README' file, it" 195d9dcd5aeSmrg echo "often tells you about the needed prerequisites for installing" 196d9dcd5aeSmrg echo "this package. You may also peek at any GNU archive site, in" 197d9dcd5aeSmrg echo "case some other package contains this missing '$1' program." 198d9dcd5aeSmrg ;; 199d9dcd5aeSmrg esac 200d9dcd5aeSmrg} 201d9dcd5aeSmrg 202d9dcd5aeSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203d9dcd5aeSmrg -e '2,$s/^/ /' >&2 204d9dcd5aeSmrg 205d9dcd5aeSmrg# Propagate the correct exit status (expected to be 127 for a program 206d9dcd5aeSmrg# not found, 63 for a program that failed due to version mismatch). 207d9dcd5aeSmrgexit $st 208191cded7Smrg 209191cded7Smrg# Local variables: 210191cded7Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211191cded7Smrg# time-stamp-start: "scriptversion=" 212191cded7Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213ba064abeSmrg# time-stamp-time-zone: "UTC" 214ba064abeSmrg# time-stamp-end: "; # UTC" 215191cded7Smrg# End: 216