117a48c7cSmrg#! /bin/sh 236e956c5Smrg# Common wrapper for a few potentially missing GNU programs. 317a48c7cSmrg 436e956c5Smrgscriptversion=2013-10-28.13; # UTC 517a48c7cSmrg 636e956c5Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 736e956c5Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 817a48c7cSmrg 917a48c7cSmrg# This program is free software; you can redistribute it and/or modify 1017a48c7cSmrg# it under the terms of the GNU General Public License as published by 1117a48c7cSmrg# the Free Software Foundation; either version 2, or (at your option) 1217a48c7cSmrg# any later version. 1317a48c7cSmrg 1417a48c7cSmrg# This program is distributed in the hope that it will be useful, 1517a48c7cSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1617a48c7cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1717a48c7cSmrg# GNU General Public License for more details. 1817a48c7cSmrg 1917a48c7cSmrg# You should have received a copy of the GNU General Public License 20fbed5abfSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2117a48c7cSmrg 2217a48c7cSmrg# As a special exception to the GNU General Public License, if you 2317a48c7cSmrg# distribute this file as part of a program that contains a 2417a48c7cSmrg# configuration script generated by Autoconf, you may include it under 2517a48c7cSmrg# the same distribution terms that you use for the rest of that program. 2617a48c7cSmrg 2717a48c7cSmrgif test $# -eq 0; then 2836e956c5Smrg echo 1>&2 "Try '$0 --help' for more information" 2917a48c7cSmrg exit 1 3017a48c7cSmrgfi 3117a48c7cSmrg 3236e956c5Smrgcase $1 in 3317a48c7cSmrg 3436e956c5Smrg --is-lightweight) 3536e956c5Smrg # Used by our autoconf macros to check whether the available missing 3636e956c5Smrg # script is modern enough. 3736e956c5Smrg exit 0 3836e956c5Smrg ;; 3917a48c7cSmrg 4036e956c5Smrg --run) 4136e956c5Smrg # Back-compat with the calling convention used by older automake. 4236e956c5Smrg shift 4336e956c5Smrg ;; 4417a48c7cSmrg 4517a48c7cSmrg -h|--h|--he|--hel|--help) 4617a48c7cSmrg echo "\ 4717a48c7cSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4817a48c7cSmrg 4936e956c5SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5036e956c5Smrgto PROGRAM being missing or too old. 5117a48c7cSmrg 5217a48c7cSmrgOptions: 5317a48c7cSmrg -h, --help display this help and exit 5417a48c7cSmrg -v, --version output version information and exit 5517a48c7cSmrg 5617a48c7cSmrgSupported PROGRAM values: 5736e956c5Smrg aclocal autoconf autoheader autom4te automake makeinfo 5836e956c5Smrg bison yacc flex lex help2man 5917a48c7cSmrg 6036e956c5SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6136e956c5Smrg'g' are ignored when checking the name. 62fbed5abfSmrg 6317a48c7cSmrgSend bug reports to <bug-automake@gnu.org>." 6417a48c7cSmrg exit $? 6517a48c7cSmrg ;; 6617a48c7cSmrg 6717a48c7cSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 6817a48c7cSmrg echo "missing $scriptversion (GNU Automake)" 6917a48c7cSmrg exit $? 7017a48c7cSmrg ;; 7117a48c7cSmrg 7217a48c7cSmrg -*) 7336e956c5Smrg echo 1>&2 "$0: unknown '$1' option" 7436e956c5Smrg echo 1>&2 "Try '$0 --help' for more information" 7517a48c7cSmrg exit 1 7617a48c7cSmrg ;; 7717a48c7cSmrg 7817a48c7cSmrgesac 7917a48c7cSmrg 8036e956c5Smrg# Run the given program, remember its exit status. 8136e956c5Smrg"$@"; st=$? 8236e956c5Smrg 8336e956c5Smrg# If it succeeded, we are done. 8436e956c5Smrgtest $st -eq 0 && exit 0 8536e956c5Smrg 8636e956c5Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 8736e956c5Smrg# passed; such an option is passed most likely to detect whether the 8836e956c5Smrg# program is present and works. 8936e956c5Smrgcase $2 in --version|--help) exit $st;; esac 9036e956c5Smrg 9136e956c5Smrg# Exit code 63 means version mismatch. This often happens when the user 9236e956c5Smrg# tries to use an ancient version of a tool on a file that requires a 9336e956c5Smrg# minimum version. 9436e956c5Smrgif test $st -eq 63; then 9536e956c5Smrg msg="probably too old" 9636e956c5Smrgelif test $st -eq 127; then 9736e956c5Smrg # Program was missing. 9836e956c5Smrg msg="missing on your system" 9936e956c5Smrgelse 10036e956c5Smrg # Program was found and executed, but failed. Give up. 10136e956c5Smrg exit $st 10236e956c5Smrgfi 10317a48c7cSmrg 10436e956c5Smrgperl_URL=http://www.perl.org/ 10536e956c5Smrgflex_URL=http://flex.sourceforge.net/ 10636e956c5Smrggnu_software_URL=http://www.gnu.org/software 10736e956c5Smrg 10836e956c5Smrgprogram_details () 10936e956c5Smrg{ 11036e956c5Smrg case $1 in 11136e956c5Smrg aclocal|automake) 11236e956c5Smrg echo "The '$1' program is part of the GNU Automake package:" 11336e956c5Smrg echo "<$gnu_software_URL/automake>" 11436e956c5Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11536e956c5Smrg echo "<$gnu_software_URL/autoconf>" 11636e956c5Smrg echo "<$gnu_software_URL/m4/>" 11736e956c5Smrg echo "<$perl_URL>" 11836e956c5Smrg ;; 11936e956c5Smrg autoconf|autom4te|autoheader) 12036e956c5Smrg echo "The '$1' program is part of the GNU Autoconf package:" 12136e956c5Smrg echo "<$gnu_software_URL/autoconf/>" 12236e956c5Smrg echo "It also requires GNU m4 and Perl in order to run:" 12336e956c5Smrg echo "<$gnu_software_URL/m4/>" 12436e956c5Smrg echo "<$perl_URL>" 12536e956c5Smrg ;; 12636e956c5Smrg esac 12736e956c5Smrg} 12836e956c5Smrg 12936e956c5Smrggive_advice () 13036e956c5Smrg{ 13136e956c5Smrg # Normalize program name to check for. 13236e956c5Smrg normalized_program=`echo "$1" | sed ' 13336e956c5Smrg s/^gnu-//; t 13436e956c5Smrg s/^gnu//; t 13536e956c5Smrg s/^g//; t'` 13636e956c5Smrg 13736e956c5Smrg printf '%s\n' "'$1' is $msg." 13836e956c5Smrg 13936e956c5Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14036e956c5Smrg case $normalized_program in 14136e956c5Smrg autoconf*) 14236e956c5Smrg echo "You should only need it if you modified 'configure.ac'," 14336e956c5Smrg echo "or m4 files included by it." 14436e956c5Smrg program_details 'autoconf' 14536e956c5Smrg ;; 14636e956c5Smrg autoheader*) 14736e956c5Smrg echo "You should only need it if you modified 'acconfig.h' or" 14836e956c5Smrg echo "$configure_deps." 14936e956c5Smrg program_details 'autoheader' 15036e956c5Smrg ;; 15136e956c5Smrg automake*) 15236e956c5Smrg echo "You should only need it if you modified 'Makefile.am' or" 15336e956c5Smrg echo "$configure_deps." 15436e956c5Smrg program_details 'automake' 15536e956c5Smrg ;; 15636e956c5Smrg aclocal*) 15736e956c5Smrg echo "You should only need it if you modified 'acinclude.m4' or" 15836e956c5Smrg echo "$configure_deps." 15936e956c5Smrg program_details 'aclocal' 16036e956c5Smrg ;; 16136e956c5Smrg autom4te*) 16236e956c5Smrg echo "You might have modified some maintainer files that require" 16336e956c5Smrg echo "the 'autom4te' program to be rebuilt." 16436e956c5Smrg program_details 'autom4te' 16536e956c5Smrg ;; 16636e956c5Smrg bison*|yacc*) 16736e956c5Smrg echo "You should only need it if you modified a '.y' file." 16836e956c5Smrg echo "You may want to install the GNU Bison package:" 16936e956c5Smrg echo "<$gnu_software_URL/bison/>" 17036e956c5Smrg ;; 17136e956c5Smrg lex*|flex*) 17236e956c5Smrg echo "You should only need it if you modified a '.l' file." 17336e956c5Smrg echo "You may want to install the Fast Lexical Analyzer package:" 17436e956c5Smrg echo "<$flex_URL>" 17536e956c5Smrg ;; 17636e956c5Smrg help2man*) 17736e956c5Smrg echo "You should only need it if you modified a dependency" \ 17836e956c5Smrg "of a man page." 17936e956c5Smrg echo "You may want to install the GNU Help2man package:" 18036e956c5Smrg echo "<$gnu_software_URL/help2man/>" 18117a48c7cSmrg ;; 18236e956c5Smrg makeinfo*) 18336e956c5Smrg echo "You should only need it if you modified a '.texi' file, or" 18436e956c5Smrg echo "any other file indirectly affecting the aspect of the manual." 18536e956c5Smrg echo "You might want to install the Texinfo package:" 18636e956c5Smrg echo "<$gnu_software_URL/texinfo/>" 18736e956c5Smrg echo "The spurious makeinfo call might also be the consequence of" 18836e956c5Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18936e956c5Smrg echo "want to install GNU make:" 19036e956c5Smrg echo "<$gnu_software_URL/make/>" 19136e956c5Smrg ;; 19236e956c5Smrg *) 19336e956c5Smrg echo "You might have modified some files without having the proper" 19436e956c5Smrg echo "tools for further handling them. Check the 'README' file, it" 19536e956c5Smrg echo "often tells you about the needed prerequisites for installing" 19636e956c5Smrg echo "this package. You may also peek at any GNU archive site, in" 19736e956c5Smrg echo "case some other package contains this missing '$1' program." 19836e956c5Smrg ;; 19936e956c5Smrg esac 20036e956c5Smrg} 20136e956c5Smrg 20236e956c5Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20336e956c5Smrg -e '2,$s/^/ /' >&2 20436e956c5Smrg 20536e956c5Smrg# Propagate the correct exit status (expected to be 127 for a program 20636e956c5Smrg# not found, 63 for a program that failed due to version mismatch). 20736e956c5Smrgexit $st 20817a48c7cSmrg 20917a48c7cSmrg# Local variables: 21017a48c7cSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 21117a48c7cSmrg# time-stamp-start: "scriptversion=" 21217a48c7cSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213fbed5abfSmrg# time-stamp-time-zone: "UTC" 214fbed5abfSmrg# time-stamp-end: "; # UTC" 21517a48c7cSmrg# End: 216