missing revision 69ef5f27
1d1333322Smrg#! /bin/sh 269ef5f27Smrg# Common wrapper for a few potentially missing GNU programs. 3d1333322Smrg 469ef5f27Smrgscriptversion=2013-10-28.13; # UTC 5d1333322Smrg 669ef5f27Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 769ef5f27Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8d1333322Smrg 9d1333322Smrg# This program is free software; you can redistribute it and/or modify 10d1333322Smrg# it under the terms of the GNU General Public License as published by 11d1333322Smrg# the Free Software Foundation; either version 2, or (at your option) 12d1333322Smrg# any later version. 13d1333322Smrg 14d1333322Smrg# This program is distributed in the hope that it will be useful, 15d1333322Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16d1333322Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17d1333322Smrg# GNU General Public License for more details. 18d1333322Smrg 19d1333322Smrg# You should have received a copy of the GNU General Public License 204f9ac78aSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21d1333322Smrg 22d1333322Smrg# As a special exception to the GNU General Public License, if you 23d1333322Smrg# distribute this file as part of a program that contains a 24d1333322Smrg# configuration script generated by Autoconf, you may include it under 25d1333322Smrg# the same distribution terms that you use for the rest of that program. 26d1333322Smrg 27d1333322Smrgif test $# -eq 0; then 2869ef5f27Smrg echo 1>&2 "Try '$0 --help' for more information" 29d1333322Smrg exit 1 30d1333322Smrgfi 31d1333322Smrg 3269ef5f27Smrgcase $1 in 33d1333322Smrg 3469ef5f27Smrg --is-lightweight) 3569ef5f27Smrg # Used by our autoconf macros to check whether the available missing 3669ef5f27Smrg # script is modern enough. 3769ef5f27Smrg exit 0 3869ef5f27Smrg ;; 39d1333322Smrg 4069ef5f27Smrg --run) 4169ef5f27Smrg # Back-compat with the calling convention used by older automake. 4269ef5f27Smrg shift 4369ef5f27Smrg ;; 44d1333322Smrg 45d1333322Smrg -h|--h|--he|--hel|--help) 46d1333322Smrg echo "\ 47d1333322Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48d1333322Smrg 4969ef5f27SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5069ef5f27Smrgto PROGRAM being missing or too old. 51d1333322Smrg 52d1333322SmrgOptions: 53d1333322Smrg -h, --help display this help and exit 54d1333322Smrg -v, --version output version information and exit 55d1333322Smrg 56d1333322SmrgSupported PROGRAM values: 5769ef5f27Smrg aclocal autoconf autoheader autom4te automake makeinfo 5869ef5f27Smrg bison yacc flex lex help2man 59d1333322Smrg 6069ef5f27SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6169ef5f27Smrg'g' are ignored when checking the name. 624f9ac78aSmrg 63d1333322SmrgSend bug reports to <bug-automake@gnu.org>." 64d1333322Smrg exit $? 65d1333322Smrg ;; 66d1333322Smrg 67d1333322Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68d1333322Smrg echo "missing $scriptversion (GNU Automake)" 69d1333322Smrg exit $? 70d1333322Smrg ;; 71d1333322Smrg 72d1333322Smrg -*) 7369ef5f27Smrg echo 1>&2 "$0: unknown '$1' option" 7469ef5f27Smrg echo 1>&2 "Try '$0 --help' for more information" 75d1333322Smrg exit 1 76d1333322Smrg ;; 77d1333322Smrg 78d1333322Smrgesac 79d1333322Smrg 8069ef5f27Smrg# Run the given program, remember its exit status. 8169ef5f27Smrg"$@"; st=$? 8269ef5f27Smrg 8369ef5f27Smrg# If it succeeded, we are done. 8469ef5f27Smrgtest $st -eq 0 && exit 0 8569ef5f27Smrg 8669ef5f27Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 8769ef5f27Smrg# passed; such an option is passed most likely to detect whether the 8869ef5f27Smrg# program is present and works. 8969ef5f27Smrgcase $2 in --version|--help) exit $st;; esac 9069ef5f27Smrg 9169ef5f27Smrg# Exit code 63 means version mismatch. This often happens when the user 9269ef5f27Smrg# tries to use an ancient version of a tool on a file that requires a 9369ef5f27Smrg# minimum version. 9469ef5f27Smrgif test $st -eq 63; then 9569ef5f27Smrg msg="probably too old" 9669ef5f27Smrgelif test $st -eq 127; then 9769ef5f27Smrg # Program was missing. 9869ef5f27Smrg msg="missing on your system" 9969ef5f27Smrgelse 10069ef5f27Smrg # Program was found and executed, but failed. Give up. 10169ef5f27Smrg exit $st 10269ef5f27Smrgfi 103d1333322Smrg 10469ef5f27Smrgperl_URL=http://www.perl.org/ 10569ef5f27Smrgflex_URL=http://flex.sourceforge.net/ 10669ef5f27Smrggnu_software_URL=http://www.gnu.org/software 10769ef5f27Smrg 10869ef5f27Smrgprogram_details () 10969ef5f27Smrg{ 11069ef5f27Smrg case $1 in 11169ef5f27Smrg aclocal|automake) 11269ef5f27Smrg echo "The '$1' program is part of the GNU Automake package:" 11369ef5f27Smrg echo "<$gnu_software_URL/automake>" 11469ef5f27Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11569ef5f27Smrg echo "<$gnu_software_URL/autoconf>" 11669ef5f27Smrg echo "<$gnu_software_URL/m4/>" 11769ef5f27Smrg echo "<$perl_URL>" 11869ef5f27Smrg ;; 11969ef5f27Smrg autoconf|autom4te|autoheader) 12069ef5f27Smrg echo "The '$1' program is part of the GNU Autoconf package:" 12169ef5f27Smrg echo "<$gnu_software_URL/autoconf/>" 12269ef5f27Smrg echo "It also requires GNU m4 and Perl in order to run:" 12369ef5f27Smrg echo "<$gnu_software_URL/m4/>" 12469ef5f27Smrg echo "<$perl_URL>" 12569ef5f27Smrg ;; 12669ef5f27Smrg esac 12769ef5f27Smrg} 12869ef5f27Smrg 12969ef5f27Smrggive_advice () 13069ef5f27Smrg{ 13169ef5f27Smrg # Normalize program name to check for. 13269ef5f27Smrg normalized_program=`echo "$1" | sed ' 13369ef5f27Smrg s/^gnu-//; t 13469ef5f27Smrg s/^gnu//; t 13569ef5f27Smrg s/^g//; t'` 13669ef5f27Smrg 13769ef5f27Smrg printf '%s\n' "'$1' is $msg." 13869ef5f27Smrg 13969ef5f27Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14069ef5f27Smrg case $normalized_program in 14169ef5f27Smrg autoconf*) 14269ef5f27Smrg echo "You should only need it if you modified 'configure.ac'," 14369ef5f27Smrg echo "or m4 files included by it." 14469ef5f27Smrg program_details 'autoconf' 14569ef5f27Smrg ;; 14669ef5f27Smrg autoheader*) 14769ef5f27Smrg echo "You should only need it if you modified 'acconfig.h' or" 14869ef5f27Smrg echo "$configure_deps." 14969ef5f27Smrg program_details 'autoheader' 15069ef5f27Smrg ;; 15169ef5f27Smrg automake*) 15269ef5f27Smrg echo "You should only need it if you modified 'Makefile.am' or" 15369ef5f27Smrg echo "$configure_deps." 15469ef5f27Smrg program_details 'automake' 15569ef5f27Smrg ;; 15669ef5f27Smrg aclocal*) 15769ef5f27Smrg echo "You should only need it if you modified 'acinclude.m4' or" 15869ef5f27Smrg echo "$configure_deps." 15969ef5f27Smrg program_details 'aclocal' 16069ef5f27Smrg ;; 16169ef5f27Smrg autom4te*) 16269ef5f27Smrg echo "You might have modified some maintainer files that require" 16369ef5f27Smrg echo "the 'autom4te' program to be rebuilt." 16469ef5f27Smrg program_details 'autom4te' 16569ef5f27Smrg ;; 16669ef5f27Smrg bison*|yacc*) 16769ef5f27Smrg echo "You should only need it if you modified a '.y' file." 16869ef5f27Smrg echo "You may want to install the GNU Bison package:" 16969ef5f27Smrg echo "<$gnu_software_URL/bison/>" 17069ef5f27Smrg ;; 17169ef5f27Smrg lex*|flex*) 17269ef5f27Smrg echo "You should only need it if you modified a '.l' file." 17369ef5f27Smrg echo "You may want to install the Fast Lexical Analyzer package:" 17469ef5f27Smrg echo "<$flex_URL>" 17569ef5f27Smrg ;; 17669ef5f27Smrg help2man*) 17769ef5f27Smrg echo "You should only need it if you modified a dependency" \ 17869ef5f27Smrg "of a man page." 17969ef5f27Smrg echo "You may want to install the GNU Help2man package:" 18069ef5f27Smrg echo "<$gnu_software_URL/help2man/>" 18169ef5f27Smrg ;; 18269ef5f27Smrg makeinfo*) 18369ef5f27Smrg echo "You should only need it if you modified a '.texi' file, or" 18469ef5f27Smrg echo "any other file indirectly affecting the aspect of the manual." 18569ef5f27Smrg echo "You might want to install the Texinfo package:" 18669ef5f27Smrg echo "<$gnu_software_URL/texinfo/>" 18769ef5f27Smrg echo "The spurious makeinfo call might also be the consequence of" 18869ef5f27Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18969ef5f27Smrg echo "want to install GNU make:" 19069ef5f27Smrg echo "<$gnu_software_URL/make/>" 19169ef5f27Smrg ;; 19269ef5f27Smrg *) 19369ef5f27Smrg echo "You might have modified some files without having the proper" 19469ef5f27Smrg echo "tools for further handling them. Check the 'README' file, it" 19569ef5f27Smrg echo "often tells you about the needed prerequisites for installing" 19669ef5f27Smrg echo "this package. You may also peek at any GNU archive site, in" 19769ef5f27Smrg echo "case some other package contains this missing '$1' program." 19869ef5f27Smrg ;; 19969ef5f27Smrg esac 20069ef5f27Smrg} 20169ef5f27Smrg 20269ef5f27Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20369ef5f27Smrg -e '2,$s/^/ /' >&2 20469ef5f27Smrg 20569ef5f27Smrg# Propagate the correct exit status (expected to be 127 for a program 20669ef5f27Smrg# not found, 63 for a program that failed due to version mismatch). 20769ef5f27Smrgexit $st 208d1333322Smrg 209d1333322Smrg# Local variables: 210d1333322Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211d1333322Smrg# time-stamp-start: "scriptversion=" 212d1333322Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2134f9ac78aSmrg# time-stamp-time-zone: "UTC" 2144f9ac78aSmrg# time-stamp-end: "; # UTC" 215d1333322Smrg# End: 216