missing revision 3d2ed3e3
173143b9aSmrg#! /bin/sh 275ebec6dSmrg# Common wrapper for a few potentially missing GNU programs. 373143b9aSmrg 43d2ed3e3Smrgscriptversion=2013-10-28.13; # UTC 573143b9aSmrg 63d2ed3e3Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 775ebec6dSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 873143b9aSmrg 973143b9aSmrg# This program is free software; you can redistribute it and/or modify 1073143b9aSmrg# it under the terms of the GNU General Public License as published by 1173143b9aSmrg# the Free Software Foundation; either version 2, or (at your option) 1273143b9aSmrg# any later version. 1373143b9aSmrg 1473143b9aSmrg# This program is distributed in the hope that it will be useful, 1573143b9aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1673143b9aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1773143b9aSmrg# GNU General Public License for more details. 1873143b9aSmrg 1973143b9aSmrg# You should have received a copy of the GNU General Public License 20b53e5eeaSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2173143b9aSmrg 2273143b9aSmrg# As a special exception to the GNU General Public License, if you 2373143b9aSmrg# distribute this file as part of a program that contains a 2473143b9aSmrg# configuration script generated by Autoconf, you may include it under 2573143b9aSmrg# the same distribution terms that you use for the rest of that program. 2673143b9aSmrg 2773143b9aSmrgif test $# -eq 0; then 2875ebec6dSmrg echo 1>&2 "Try '$0 --help' for more information" 2973143b9aSmrg exit 1 3073143b9aSmrgfi 3173143b9aSmrg 3275ebec6dSmrgcase $1 in 3373143b9aSmrg 3475ebec6dSmrg --is-lightweight) 3575ebec6dSmrg # Used by our autoconf macros to check whether the available missing 3675ebec6dSmrg # script is modern enough. 3775ebec6dSmrg exit 0 3875ebec6dSmrg ;; 3973143b9aSmrg 4075ebec6dSmrg --run) 4175ebec6dSmrg # Back-compat with the calling convention used by older automake. 4275ebec6dSmrg shift 4375ebec6dSmrg ;; 4473143b9aSmrg 4573143b9aSmrg -h|--h|--he|--hel|--help) 4673143b9aSmrg echo "\ 4773143b9aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4873143b9aSmrg 4975ebec6dSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5075ebec6dSmrgto PROGRAM being missing or too old. 5173143b9aSmrg 5273143b9aSmrgOptions: 5373143b9aSmrg -h, --help display this help and exit 5473143b9aSmrg -v, --version output version information and exit 5573143b9aSmrg 5673143b9aSmrgSupported PROGRAM values: 5775ebec6dSmrg aclocal autoconf autoheader autom4te automake makeinfo 5875ebec6dSmrg bison yacc flex lex help2man 5973143b9aSmrg 6075ebec6dSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6175ebec6dSmrg'g' are ignored when checking the name. 62b53e5eeaSmrg 6373143b9aSmrgSend bug reports to <bug-automake@gnu.org>." 6473143b9aSmrg exit $? 6573143b9aSmrg ;; 6673143b9aSmrg 6773143b9aSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 6873143b9aSmrg echo "missing $scriptversion (GNU Automake)" 6973143b9aSmrg exit $? 7073143b9aSmrg ;; 7173143b9aSmrg 7273143b9aSmrg -*) 7375ebec6dSmrg echo 1>&2 "$0: unknown '$1' option" 7475ebec6dSmrg echo 1>&2 "Try '$0 --help' for more information" 7573143b9aSmrg exit 1 7673143b9aSmrg ;; 7773143b9aSmrg 7873143b9aSmrgesac 7973143b9aSmrg 8075ebec6dSmrg# Run the given program, remember its exit status. 8175ebec6dSmrg"$@"; st=$? 8275ebec6dSmrg 8375ebec6dSmrg# If it succeeded, we are done. 8475ebec6dSmrgtest $st -eq 0 && exit 0 8575ebec6dSmrg 8675ebec6dSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 8775ebec6dSmrg# passed; such an option is passed most likely to detect whether the 8875ebec6dSmrg# program is present and works. 8975ebec6dSmrgcase $2 in --version|--help) exit $st;; esac 9075ebec6dSmrg 9175ebec6dSmrg# Exit code 63 means version mismatch. This often happens when the user 9275ebec6dSmrg# tries to use an ancient version of a tool on a file that requires a 9375ebec6dSmrg# minimum version. 9475ebec6dSmrgif test $st -eq 63; then 9575ebec6dSmrg msg="probably too old" 9675ebec6dSmrgelif test $st -eq 127; then 9775ebec6dSmrg # Program was missing. 9875ebec6dSmrg msg="missing on your system" 9975ebec6dSmrgelse 10075ebec6dSmrg # Program was found and executed, but failed. Give up. 10175ebec6dSmrg exit $st 10275ebec6dSmrgfi 10373143b9aSmrg 10475ebec6dSmrgperl_URL=http://www.perl.org/ 10575ebec6dSmrgflex_URL=http://flex.sourceforge.net/ 10675ebec6dSmrggnu_software_URL=http://www.gnu.org/software 10775ebec6dSmrg 10875ebec6dSmrgprogram_details () 10975ebec6dSmrg{ 11075ebec6dSmrg case $1 in 11175ebec6dSmrg aclocal|automake) 11275ebec6dSmrg echo "The '$1' program is part of the GNU Automake package:" 11375ebec6dSmrg echo "<$gnu_software_URL/automake>" 11475ebec6dSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11575ebec6dSmrg echo "<$gnu_software_URL/autoconf>" 11675ebec6dSmrg echo "<$gnu_software_URL/m4/>" 11775ebec6dSmrg echo "<$perl_URL>" 11875ebec6dSmrg ;; 11975ebec6dSmrg autoconf|autom4te|autoheader) 12075ebec6dSmrg echo "The '$1' program is part of the GNU Autoconf package:" 12175ebec6dSmrg echo "<$gnu_software_URL/autoconf/>" 12275ebec6dSmrg echo "It also requires GNU m4 and Perl in order to run:" 12375ebec6dSmrg echo "<$gnu_software_URL/m4/>" 12475ebec6dSmrg echo "<$perl_URL>" 12575ebec6dSmrg ;; 12675ebec6dSmrg esac 12775ebec6dSmrg} 12875ebec6dSmrg 12975ebec6dSmrggive_advice () 13075ebec6dSmrg{ 13175ebec6dSmrg # Normalize program name to check for. 13275ebec6dSmrg normalized_program=`echo "$1" | sed ' 13375ebec6dSmrg s/^gnu-//; t 13475ebec6dSmrg s/^gnu//; t 13575ebec6dSmrg s/^g//; t'` 13675ebec6dSmrg 13775ebec6dSmrg printf '%s\n' "'$1' is $msg." 13875ebec6dSmrg 13975ebec6dSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14075ebec6dSmrg case $normalized_program in 14175ebec6dSmrg autoconf*) 14275ebec6dSmrg echo "You should only need it if you modified 'configure.ac'," 14375ebec6dSmrg echo "or m4 files included by it." 14475ebec6dSmrg program_details 'autoconf' 14575ebec6dSmrg ;; 14675ebec6dSmrg autoheader*) 14775ebec6dSmrg echo "You should only need it if you modified 'acconfig.h' or" 14875ebec6dSmrg echo "$configure_deps." 14975ebec6dSmrg program_details 'autoheader' 15075ebec6dSmrg ;; 15175ebec6dSmrg automake*) 15275ebec6dSmrg echo "You should only need it if you modified 'Makefile.am' or" 15375ebec6dSmrg echo "$configure_deps." 15475ebec6dSmrg program_details 'automake' 15575ebec6dSmrg ;; 15675ebec6dSmrg aclocal*) 15775ebec6dSmrg echo "You should only need it if you modified 'acinclude.m4' or" 15875ebec6dSmrg echo "$configure_deps." 15975ebec6dSmrg program_details 'aclocal' 16075ebec6dSmrg ;; 16175ebec6dSmrg autom4te*) 16275ebec6dSmrg echo "You might have modified some maintainer files that require" 1633d2ed3e3Smrg echo "the 'autom4te' program to be rebuilt." 16475ebec6dSmrg program_details 'autom4te' 16575ebec6dSmrg ;; 16675ebec6dSmrg bison*|yacc*) 16775ebec6dSmrg echo "You should only need it if you modified a '.y' file." 16875ebec6dSmrg echo "You may want to install the GNU Bison package:" 16975ebec6dSmrg echo "<$gnu_software_URL/bison/>" 17075ebec6dSmrg ;; 17175ebec6dSmrg lex*|flex*) 17275ebec6dSmrg echo "You should only need it if you modified a '.l' file." 17375ebec6dSmrg echo "You may want to install the Fast Lexical Analyzer package:" 17475ebec6dSmrg echo "<$flex_URL>" 17575ebec6dSmrg ;; 17675ebec6dSmrg help2man*) 17775ebec6dSmrg echo "You should only need it if you modified a dependency" \ 17875ebec6dSmrg "of a man page." 17975ebec6dSmrg echo "You may want to install the GNU Help2man package:" 18075ebec6dSmrg echo "<$gnu_software_URL/help2man/>" 18175ebec6dSmrg ;; 18275ebec6dSmrg makeinfo*) 18375ebec6dSmrg echo "You should only need it if you modified a '.texi' file, or" 18475ebec6dSmrg echo "any other file indirectly affecting the aspect of the manual." 18575ebec6dSmrg echo "You might want to install the Texinfo package:" 18675ebec6dSmrg echo "<$gnu_software_URL/texinfo/>" 18775ebec6dSmrg echo "The spurious makeinfo call might also be the consequence of" 18875ebec6dSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18975ebec6dSmrg echo "want to install GNU make:" 19075ebec6dSmrg echo "<$gnu_software_URL/make/>" 19175ebec6dSmrg ;; 19275ebec6dSmrg *) 19375ebec6dSmrg echo "You might have modified some files without having the proper" 19475ebec6dSmrg echo "tools for further handling them. Check the 'README' file, it" 19575ebec6dSmrg echo "often tells you about the needed prerequisites for installing" 19675ebec6dSmrg echo "this package. You may also peek at any GNU archive site, in" 19775ebec6dSmrg echo "case some other package contains this missing '$1' program." 19875ebec6dSmrg ;; 19975ebec6dSmrg esac 20075ebec6dSmrg} 20175ebec6dSmrg 20275ebec6dSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20375ebec6dSmrg -e '2,$s/^/ /' >&2 20475ebec6dSmrg 20575ebec6dSmrg# Propagate the correct exit status (expected to be 127 for a program 20675ebec6dSmrg# not found, 63 for a program that failed due to version mismatch). 20775ebec6dSmrgexit $st 20873143b9aSmrg 20973143b9aSmrg# Local variables: 21073143b9aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 21173143b9aSmrg# time-stamp-start: "scriptversion=" 21273143b9aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213b53e5eeaSmrg# time-stamp-time-zone: "UTC" 214b53e5eeaSmrg# time-stamp-end: "; # UTC" 21573143b9aSmrg# End: 216