missing revision fb5e8d76
1266e564dSmrg#! /bin/sh 2fb5e8d76Smrg# Common wrapper for a few potentially missing GNU programs. 3266e564dSmrg 4fb5e8d76Smrgscriptversion=2012-06-26.16; # UTC 5266e564dSmrg 6fb5e8d76Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 7fb5e8d76Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8266e564dSmrg 9266e564dSmrg# This program is free software; you can redistribute it and/or modify 10266e564dSmrg# it under the terms of the GNU General Public License as published by 11266e564dSmrg# the Free Software Foundation; either version 2, or (at your option) 12266e564dSmrg# any later version. 13266e564dSmrg 14266e564dSmrg# This program is distributed in the hope that it will be useful, 15266e564dSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16266e564dSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17266e564dSmrg# GNU General Public License for more details. 18266e564dSmrg 19266e564dSmrg# You should have received a copy of the GNU General Public License 20d17cd367Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21266e564dSmrg 22266e564dSmrg# As a special exception to the GNU General Public License, if you 23266e564dSmrg# distribute this file as part of a program that contains a 24266e564dSmrg# configuration script generated by Autoconf, you may include it under 25266e564dSmrg# the same distribution terms that you use for the rest of that program. 26266e564dSmrg 27266e564dSmrgif test $# -eq 0; then 28fb5e8d76Smrg echo 1>&2 "Try '$0 --help' for more information" 29266e564dSmrg exit 1 30266e564dSmrgfi 31266e564dSmrg 32fb5e8d76Smrgcase $1 in 33266e564dSmrg 34fb5e8d76Smrg --is-lightweight) 35fb5e8d76Smrg # Used by our autoconf macros to check whether the available missing 36fb5e8d76Smrg # script is modern enough. 37fb5e8d76Smrg exit 0 38fb5e8d76Smrg ;; 39266e564dSmrg 40fb5e8d76Smrg --run) 41fb5e8d76Smrg # Back-compat with the calling convention used by older automake. 42fb5e8d76Smrg shift 43fb5e8d76Smrg ;; 44266e564dSmrg 45266e564dSmrg -h|--h|--he|--hel|--help) 46266e564dSmrg echo "\ 47266e564dSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48266e564dSmrg 49fb5e8d76SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50fb5e8d76Smrgto PROGRAM being missing or too old. 51266e564dSmrg 52266e564dSmrgOptions: 53266e564dSmrg -h, --help display this help and exit 54266e564dSmrg -v, --version output version information and exit 55266e564dSmrg 56266e564dSmrgSupported PROGRAM values: 57fb5e8d76Smrg aclocal autoconf autoheader autom4te automake makeinfo 58fb5e8d76Smrg bison yacc flex lex help2man 59266e564dSmrg 60fb5e8d76SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61fb5e8d76Smrg'g' are ignored when checking the name. 62d17cd367Smrg 63266e564dSmrgSend bug reports to <bug-automake@gnu.org>." 64266e564dSmrg exit $? 65266e564dSmrg ;; 66266e564dSmrg 67266e564dSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68266e564dSmrg echo "missing $scriptversion (GNU Automake)" 69266e564dSmrg exit $? 70266e564dSmrg ;; 71266e564dSmrg 72266e564dSmrg -*) 73fb5e8d76Smrg echo 1>&2 "$0: unknown '$1' option" 74fb5e8d76Smrg echo 1>&2 "Try '$0 --help' for more information" 75266e564dSmrg exit 1 76266e564dSmrg ;; 77266e564dSmrg 78266e564dSmrgesac 79266e564dSmrg 80fb5e8d76Smrg# Run the given program, remember its exit status. 81fb5e8d76Smrg"$@"; st=$? 82fb5e8d76Smrg 83fb5e8d76Smrg# If it succeeded, we are done. 84fb5e8d76Smrgtest $st -eq 0 && exit 0 85fb5e8d76Smrg 86fb5e8d76Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87fb5e8d76Smrg# passed; such an option is passed most likely to detect whether the 88fb5e8d76Smrg# program is present and works. 89fb5e8d76Smrgcase $2 in --version|--help) exit $st;; esac 90fb5e8d76Smrg 91fb5e8d76Smrg# Exit code 63 means version mismatch. This often happens when the user 92fb5e8d76Smrg# tries to use an ancient version of a tool on a file that requires a 93fb5e8d76Smrg# minimum version. 94fb5e8d76Smrgif test $st -eq 63; then 95fb5e8d76Smrg msg="probably too old" 96fb5e8d76Smrgelif test $st -eq 127; then 97fb5e8d76Smrg # Program was missing. 98fb5e8d76Smrg msg="missing on your system" 99fb5e8d76Smrgelse 100fb5e8d76Smrg # Program was found and executed, but failed. Give up. 101fb5e8d76Smrg exit $st 102fb5e8d76Smrgfi 103266e564dSmrg 104fb5e8d76Smrgperl_URL=http://www.perl.org/ 105fb5e8d76Smrgflex_URL=http://flex.sourceforge.net/ 106fb5e8d76Smrggnu_software_URL=http://www.gnu.org/software 107fb5e8d76Smrg 108fb5e8d76Smrgprogram_details () 109fb5e8d76Smrg{ 110fb5e8d76Smrg case $1 in 111fb5e8d76Smrg aclocal|automake) 112fb5e8d76Smrg echo "The '$1' program is part of the GNU Automake package:" 113fb5e8d76Smrg echo "<$gnu_software_URL/automake>" 114fb5e8d76Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115fb5e8d76Smrg echo "<$gnu_software_URL/autoconf>" 116fb5e8d76Smrg echo "<$gnu_software_URL/m4/>" 117fb5e8d76Smrg echo "<$perl_URL>" 118fb5e8d76Smrg ;; 119fb5e8d76Smrg autoconf|autom4te|autoheader) 120fb5e8d76Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121fb5e8d76Smrg echo "<$gnu_software_URL/autoconf/>" 122fb5e8d76Smrg echo "It also requires GNU m4 and Perl in order to run:" 123fb5e8d76Smrg echo "<$gnu_software_URL/m4/>" 124fb5e8d76Smrg echo "<$perl_URL>" 125fb5e8d76Smrg ;; 126fb5e8d76Smrg esac 127fb5e8d76Smrg} 128fb5e8d76Smrg 129fb5e8d76Smrggive_advice () 130fb5e8d76Smrg{ 131fb5e8d76Smrg # Normalize program name to check for. 132fb5e8d76Smrg normalized_program=`echo "$1" | sed ' 133fb5e8d76Smrg s/^gnu-//; t 134fb5e8d76Smrg s/^gnu//; t 135fb5e8d76Smrg s/^g//; t'` 136fb5e8d76Smrg 137fb5e8d76Smrg printf '%s\n' "'$1' is $msg." 138fb5e8d76Smrg 139fb5e8d76Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140fb5e8d76Smrg case $normalized_program in 141fb5e8d76Smrg autoconf*) 142fb5e8d76Smrg echo "You should only need it if you modified 'configure.ac'," 143fb5e8d76Smrg echo "or m4 files included by it." 144fb5e8d76Smrg program_details 'autoconf' 145fb5e8d76Smrg ;; 146fb5e8d76Smrg autoheader*) 147fb5e8d76Smrg echo "You should only need it if you modified 'acconfig.h' or" 148fb5e8d76Smrg echo "$configure_deps." 149fb5e8d76Smrg program_details 'autoheader' 150fb5e8d76Smrg ;; 151fb5e8d76Smrg automake*) 152fb5e8d76Smrg echo "You should only need it if you modified 'Makefile.am' or" 153fb5e8d76Smrg echo "$configure_deps." 154fb5e8d76Smrg program_details 'automake' 155fb5e8d76Smrg ;; 156fb5e8d76Smrg aclocal*) 157fb5e8d76Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158fb5e8d76Smrg echo "$configure_deps." 159fb5e8d76Smrg program_details 'aclocal' 160fb5e8d76Smrg ;; 161fb5e8d76Smrg autom4te*) 162fb5e8d76Smrg echo "You might have modified some maintainer files that require" 163fb5e8d76Smrg echo "the 'automa4te' program to be rebuilt." 164fb5e8d76Smrg program_details 'autom4te' 165fb5e8d76Smrg ;; 166fb5e8d76Smrg bison*|yacc*) 167fb5e8d76Smrg echo "You should only need it if you modified a '.y' file." 168fb5e8d76Smrg echo "You may want to install the GNU Bison package:" 169fb5e8d76Smrg echo "<$gnu_software_URL/bison/>" 170fb5e8d76Smrg ;; 171fb5e8d76Smrg lex*|flex*) 172fb5e8d76Smrg echo "You should only need it if you modified a '.l' file." 173fb5e8d76Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174fb5e8d76Smrg echo "<$flex_URL>" 175fb5e8d76Smrg ;; 176fb5e8d76Smrg help2man*) 177fb5e8d76Smrg echo "You should only need it if you modified a dependency" \ 178fb5e8d76Smrg "of a man page." 179fb5e8d76Smrg echo "You may want to install the GNU Help2man package:" 180fb5e8d76Smrg echo "<$gnu_software_URL/help2man/>" 181fb5e8d76Smrg ;; 182fb5e8d76Smrg makeinfo*) 183fb5e8d76Smrg echo "You should only need it if you modified a '.texi' file, or" 184fb5e8d76Smrg echo "any other file indirectly affecting the aspect of the manual." 185fb5e8d76Smrg echo "You might want to install the Texinfo package:" 186fb5e8d76Smrg echo "<$gnu_software_URL/texinfo/>" 187fb5e8d76Smrg echo "The spurious makeinfo call might also be the consequence of" 188fb5e8d76Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189fb5e8d76Smrg echo "want to install GNU make:" 190fb5e8d76Smrg echo "<$gnu_software_URL/make/>" 191fb5e8d76Smrg ;; 192fb5e8d76Smrg *) 193fb5e8d76Smrg echo "You might have modified some files without having the proper" 194fb5e8d76Smrg echo "tools for further handling them. Check the 'README' file, it" 195fb5e8d76Smrg echo "often tells you about the needed prerequisites for installing" 196fb5e8d76Smrg echo "this package. You may also peek at any GNU archive site, in" 197fb5e8d76Smrg echo "case some other package contains this missing '$1' program." 198fb5e8d76Smrg ;; 199fb5e8d76Smrg esac 200fb5e8d76Smrg} 201fb5e8d76Smrg 202fb5e8d76Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203fb5e8d76Smrg -e '2,$s/^/ /' >&2 204fb5e8d76Smrg 205fb5e8d76Smrg# Propagate the correct exit status (expected to be 127 for a program 206fb5e8d76Smrg# not found, 63 for a program that failed due to version mismatch). 207fb5e8d76Smrgexit $st 208266e564dSmrg 209266e564dSmrg# Local variables: 210266e564dSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211266e564dSmrg# time-stamp-start: "scriptversion=" 212266e564dSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213d17cd367Smrg# time-stamp-time-zone: "UTC" 214d17cd367Smrg# time-stamp-end: "; # UTC" 215266e564dSmrg# End: 216