missing revision 39f9c979
1bb2e14f3Smrg#! /bin/sh 239f9c979Smrg# Common wrapper for a few potentially missing GNU programs. 3bb2e14f3Smrg 439f9c979Smrgscriptversion=2012-06-26.16; # UTC 5bb2e14f3Smrg 639f9c979Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 739f9c979Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8bb2e14f3Smrg 9bb2e14f3Smrg# This program is free software; you can redistribute it and/or modify 10bb2e14f3Smrg# it under the terms of the GNU General Public License as published by 11bb2e14f3Smrg# the Free Software Foundation; either version 2, or (at your option) 12bb2e14f3Smrg# any later version. 13bb2e14f3Smrg 14bb2e14f3Smrg# This program is distributed in the hope that it will be useful, 15bb2e14f3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16bb2e14f3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17bb2e14f3Smrg# GNU General Public License for more details. 18bb2e14f3Smrg 19bb2e14f3Smrg# You should have received a copy of the GNU General Public License 20a5399cb1Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21bb2e14f3Smrg 22bb2e14f3Smrg# As a special exception to the GNU General Public License, if you 23bb2e14f3Smrg# distribute this file as part of a program that contains a 24bb2e14f3Smrg# configuration script generated by Autoconf, you may include it under 25bb2e14f3Smrg# the same distribution terms that you use for the rest of that program. 26bb2e14f3Smrg 27bb2e14f3Smrgif test $# -eq 0; then 2839f9c979Smrg echo 1>&2 "Try '$0 --help' for more information" 29bb2e14f3Smrg exit 1 30bb2e14f3Smrgfi 31bb2e14f3Smrg 3239f9c979Smrgcase $1 in 33bb2e14f3Smrg 3439f9c979Smrg --is-lightweight) 3539f9c979Smrg # Used by our autoconf macros to check whether the available missing 3639f9c979Smrg # script is modern enough. 3739f9c979Smrg exit 0 3839f9c979Smrg ;; 39bb2e14f3Smrg 4039f9c979Smrg --run) 4139f9c979Smrg # Back-compat with the calling convention used by older automake. 4239f9c979Smrg shift 4339f9c979Smrg ;; 44bb2e14f3Smrg 45bb2e14f3Smrg -h|--h|--he|--hel|--help) 46bb2e14f3Smrg echo "\ 47bb2e14f3Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48bb2e14f3Smrg 4939f9c979SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5039f9c979Smrgto PROGRAM being missing or too old. 51bb2e14f3Smrg 52bb2e14f3SmrgOptions: 53bb2e14f3Smrg -h, --help display this help and exit 54bb2e14f3Smrg -v, --version output version information and exit 55bb2e14f3Smrg 56bb2e14f3SmrgSupported PROGRAM values: 5739f9c979Smrg aclocal autoconf autoheader autom4te automake makeinfo 5839f9c979Smrg bison yacc flex lex help2man 59bb2e14f3Smrg 6039f9c979SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6139f9c979Smrg'g' are ignored when checking the name. 62a5399cb1Smrg 63bb2e14f3SmrgSend bug reports to <bug-automake@gnu.org>." 64bb2e14f3Smrg exit $? 65bb2e14f3Smrg ;; 66bb2e14f3Smrg 67bb2e14f3Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68bb2e14f3Smrg echo "missing $scriptversion (GNU Automake)" 69bb2e14f3Smrg exit $? 70bb2e14f3Smrg ;; 71bb2e14f3Smrg 72bb2e14f3Smrg -*) 7339f9c979Smrg echo 1>&2 "$0: unknown '$1' option" 7439f9c979Smrg echo 1>&2 "Try '$0 --help' for more information" 75bb2e14f3Smrg exit 1 76bb2e14f3Smrg ;; 77bb2e14f3Smrg 78bb2e14f3Smrgesac 79bb2e14f3Smrg 8039f9c979Smrg# Run the given program, remember its exit status. 8139f9c979Smrg"$@"; st=$? 8239f9c979Smrg 8339f9c979Smrg# If it succeeded, we are done. 8439f9c979Smrgtest $st -eq 0 && exit 0 8539f9c979Smrg 8639f9c979Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 8739f9c979Smrg# passed; such an option is passed most likely to detect whether the 8839f9c979Smrg# program is present and works. 8939f9c979Smrgcase $2 in --version|--help) exit $st;; esac 9039f9c979Smrg 9139f9c979Smrg# Exit code 63 means version mismatch. This often happens when the user 9239f9c979Smrg# tries to use an ancient version of a tool on a file that requires a 9339f9c979Smrg# minimum version. 9439f9c979Smrgif test $st -eq 63; then 9539f9c979Smrg msg="probably too old" 9639f9c979Smrgelif test $st -eq 127; then 9739f9c979Smrg # Program was missing. 9839f9c979Smrg msg="missing on your system" 9939f9c979Smrgelse 10039f9c979Smrg # Program was found and executed, but failed. Give up. 10139f9c979Smrg exit $st 10239f9c979Smrgfi 103bb2e14f3Smrg 10439f9c979Smrgperl_URL=http://www.perl.org/ 10539f9c979Smrgflex_URL=http://flex.sourceforge.net/ 10639f9c979Smrggnu_software_URL=http://www.gnu.org/software 10739f9c979Smrg 10839f9c979Smrgprogram_details () 10939f9c979Smrg{ 11039f9c979Smrg case $1 in 11139f9c979Smrg aclocal|automake) 11239f9c979Smrg echo "The '$1' program is part of the GNU Automake package:" 11339f9c979Smrg echo "<$gnu_software_URL/automake>" 11439f9c979Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11539f9c979Smrg echo "<$gnu_software_URL/autoconf>" 11639f9c979Smrg echo "<$gnu_software_URL/m4/>" 11739f9c979Smrg echo "<$perl_URL>" 11839f9c979Smrg ;; 11939f9c979Smrg autoconf|autom4te|autoheader) 12039f9c979Smrg echo "The '$1' program is part of the GNU Autoconf package:" 12139f9c979Smrg echo "<$gnu_software_URL/autoconf/>" 12239f9c979Smrg echo "It also requires GNU m4 and Perl in order to run:" 12339f9c979Smrg echo "<$gnu_software_URL/m4/>" 12439f9c979Smrg echo "<$perl_URL>" 12539f9c979Smrg ;; 12639f9c979Smrg esac 12739f9c979Smrg} 12839f9c979Smrg 12939f9c979Smrggive_advice () 13039f9c979Smrg{ 13139f9c979Smrg # Normalize program name to check for. 13239f9c979Smrg normalized_program=`echo "$1" | sed ' 13339f9c979Smrg s/^gnu-//; t 13439f9c979Smrg s/^gnu//; t 13539f9c979Smrg s/^g//; t'` 13639f9c979Smrg 13739f9c979Smrg printf '%s\n' "'$1' is $msg." 13839f9c979Smrg 13939f9c979Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14039f9c979Smrg case $normalized_program in 14139f9c979Smrg autoconf*) 14239f9c979Smrg echo "You should only need it if you modified 'configure.ac'," 14339f9c979Smrg echo "or m4 files included by it." 14439f9c979Smrg program_details 'autoconf' 14539f9c979Smrg ;; 14639f9c979Smrg autoheader*) 14739f9c979Smrg echo "You should only need it if you modified 'acconfig.h' or" 14839f9c979Smrg echo "$configure_deps." 14939f9c979Smrg program_details 'autoheader' 15039f9c979Smrg ;; 15139f9c979Smrg automake*) 15239f9c979Smrg echo "You should only need it if you modified 'Makefile.am' or" 15339f9c979Smrg echo "$configure_deps." 15439f9c979Smrg program_details 'automake' 15539f9c979Smrg ;; 15639f9c979Smrg aclocal*) 15739f9c979Smrg echo "You should only need it if you modified 'acinclude.m4' or" 15839f9c979Smrg echo "$configure_deps." 15939f9c979Smrg program_details 'aclocal' 16039f9c979Smrg ;; 16139f9c979Smrg autom4te*) 16239f9c979Smrg echo "You might have modified some maintainer files that require" 16339f9c979Smrg echo "the 'automa4te' program to be rebuilt." 16439f9c979Smrg program_details 'autom4te' 16539f9c979Smrg ;; 16639f9c979Smrg bison*|yacc*) 16739f9c979Smrg echo "You should only need it if you modified a '.y' file." 16839f9c979Smrg echo "You may want to install the GNU Bison package:" 16939f9c979Smrg echo "<$gnu_software_URL/bison/>" 17039f9c979Smrg ;; 17139f9c979Smrg lex*|flex*) 17239f9c979Smrg echo "You should only need it if you modified a '.l' file." 17339f9c979Smrg echo "You may want to install the Fast Lexical Analyzer package:" 17439f9c979Smrg echo "<$flex_URL>" 17539f9c979Smrg ;; 17639f9c979Smrg help2man*) 17739f9c979Smrg echo "You should only need it if you modified a dependency" \ 17839f9c979Smrg "of a man page." 17939f9c979Smrg echo "You may want to install the GNU Help2man package:" 18039f9c979Smrg echo "<$gnu_software_URL/help2man/>" 18139f9c979Smrg ;; 18239f9c979Smrg makeinfo*) 18339f9c979Smrg echo "You should only need it if you modified a '.texi' file, or" 18439f9c979Smrg echo "any other file indirectly affecting the aspect of the manual." 18539f9c979Smrg echo "You might want to install the Texinfo package:" 18639f9c979Smrg echo "<$gnu_software_URL/texinfo/>" 18739f9c979Smrg echo "The spurious makeinfo call might also be the consequence of" 18839f9c979Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18939f9c979Smrg echo "want to install GNU make:" 19039f9c979Smrg echo "<$gnu_software_URL/make/>" 19139f9c979Smrg ;; 19239f9c979Smrg *) 19339f9c979Smrg echo "You might have modified some files without having the proper" 19439f9c979Smrg echo "tools for further handling them. Check the 'README' file, it" 19539f9c979Smrg echo "often tells you about the needed prerequisites for installing" 19639f9c979Smrg echo "this package. You may also peek at any GNU archive site, in" 19739f9c979Smrg echo "case some other package contains this missing '$1' program." 19839f9c979Smrg ;; 19939f9c979Smrg esac 20039f9c979Smrg} 20139f9c979Smrg 20239f9c979Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20339f9c979Smrg -e '2,$s/^/ /' >&2 20439f9c979Smrg 20539f9c979Smrg# Propagate the correct exit status (expected to be 127 for a program 20639f9c979Smrg# not found, 63 for a program that failed due to version mismatch). 20739f9c979Smrgexit $st 208bb2e14f3Smrg 209bb2e14f3Smrg# Local variables: 210bb2e14f3Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211bb2e14f3Smrg# time-stamp-start: "scriptversion=" 212bb2e14f3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213a5399cb1Smrg# time-stamp-time-zone: "UTC" 214a5399cb1Smrg# time-stamp-end: "; # UTC" 215bb2e14f3Smrg# End: 216