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