1301ea0f4Smrg#! /bin/sh 218552c8aSmrg# Common wrapper for a few potentially missing GNU programs. 3301ea0f4Smrg 497ee6427Smrgscriptversion=2013-10-28.13; # UTC 5301ea0f4Smrg 697ee6427Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 718552c8aSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8301ea0f4Smrg 9301ea0f4Smrg# This program is free software; you can redistribute it and/or modify 10301ea0f4Smrg# it under the terms of the GNU General Public License as published by 11301ea0f4Smrg# the Free Software Foundation; either version 2, or (at your option) 12301ea0f4Smrg# any later version. 13301ea0f4Smrg 14301ea0f4Smrg# This program is distributed in the hope that it will be useful, 15301ea0f4Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16301ea0f4Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17301ea0f4Smrg# GNU General Public License for more details. 18301ea0f4Smrg 19301ea0f4Smrg# You should have received a copy of the GNU General Public License 20ef6fb4a5Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21301ea0f4Smrg 22301ea0f4Smrg# As a special exception to the GNU General Public License, if you 23301ea0f4Smrg# distribute this file as part of a program that contains a 24301ea0f4Smrg# configuration script generated by Autoconf, you may include it under 25301ea0f4Smrg# the same distribution terms that you use for the rest of that program. 26301ea0f4Smrg 27301ea0f4Smrgif test $# -eq 0; then 2818552c8aSmrg echo 1>&2 "Try '$0 --help' for more information" 29301ea0f4Smrg exit 1 30301ea0f4Smrgfi 31301ea0f4Smrg 3218552c8aSmrgcase $1 in 33301ea0f4Smrg 3418552c8aSmrg --is-lightweight) 3518552c8aSmrg # Used by our autoconf macros to check whether the available missing 3618552c8aSmrg # script is modern enough. 3718552c8aSmrg exit 0 3818552c8aSmrg ;; 39301ea0f4Smrg 4018552c8aSmrg --run) 4118552c8aSmrg # Back-compat with the calling convention used by older automake. 4218552c8aSmrg shift 4318552c8aSmrg ;; 44301ea0f4Smrg 45301ea0f4Smrg -h|--h|--he|--hel|--help) 46301ea0f4Smrg echo "\ 47301ea0f4Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48301ea0f4Smrg 4918552c8aSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5018552c8aSmrgto PROGRAM being missing or too old. 51301ea0f4Smrg 52301ea0f4SmrgOptions: 53301ea0f4Smrg -h, --help display this help and exit 54301ea0f4Smrg -v, --version output version information and exit 55301ea0f4Smrg 56301ea0f4SmrgSupported PROGRAM values: 5718552c8aSmrg aclocal autoconf autoheader autom4te automake makeinfo 5818552c8aSmrg bison yacc flex lex help2man 59301ea0f4Smrg 6018552c8aSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6118552c8aSmrg'g' are ignored when checking the name. 62ef6fb4a5Smrg 63301ea0f4SmrgSend bug reports to <bug-automake@gnu.org>." 64301ea0f4Smrg exit $? 65301ea0f4Smrg ;; 66301ea0f4Smrg 67301ea0f4Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68301ea0f4Smrg echo "missing $scriptversion (GNU Automake)" 69301ea0f4Smrg exit $? 70301ea0f4Smrg ;; 71301ea0f4Smrg 72301ea0f4Smrg -*) 7318552c8aSmrg echo 1>&2 "$0: unknown '$1' option" 7418552c8aSmrg echo 1>&2 "Try '$0 --help' for more information" 75301ea0f4Smrg exit 1 76301ea0f4Smrg ;; 77301ea0f4Smrg 78301ea0f4Smrgesac 79301ea0f4Smrg 8018552c8aSmrg# Run the given program, remember its exit status. 8118552c8aSmrg"$@"; st=$? 8218552c8aSmrg 8318552c8aSmrg# If it succeeded, we are done. 8418552c8aSmrgtest $st -eq 0 && exit 0 8518552c8aSmrg 8618552c8aSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 8718552c8aSmrg# passed; such an option is passed most likely to detect whether the 8818552c8aSmrg# program is present and works. 8918552c8aSmrgcase $2 in --version|--help) exit $st;; esac 9018552c8aSmrg 9118552c8aSmrg# Exit code 63 means version mismatch. This often happens when the user 9218552c8aSmrg# tries to use an ancient version of a tool on a file that requires a 9318552c8aSmrg# minimum version. 9418552c8aSmrgif test $st -eq 63; then 9518552c8aSmrg msg="probably too old" 9618552c8aSmrgelif test $st -eq 127; then 9718552c8aSmrg # Program was missing. 9818552c8aSmrg msg="missing on your system" 9918552c8aSmrgelse 10018552c8aSmrg # Program was found and executed, but failed. Give up. 10118552c8aSmrg exit $st 10218552c8aSmrgfi 103301ea0f4Smrg 10418552c8aSmrgperl_URL=http://www.perl.org/ 10518552c8aSmrgflex_URL=http://flex.sourceforge.net/ 10618552c8aSmrggnu_software_URL=http://www.gnu.org/software 10718552c8aSmrg 10818552c8aSmrgprogram_details () 10918552c8aSmrg{ 11018552c8aSmrg case $1 in 11118552c8aSmrg aclocal|automake) 11218552c8aSmrg echo "The '$1' program is part of the GNU Automake package:" 11318552c8aSmrg echo "<$gnu_software_URL/automake>" 11418552c8aSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11518552c8aSmrg echo "<$gnu_software_URL/autoconf>" 11618552c8aSmrg echo "<$gnu_software_URL/m4/>" 11718552c8aSmrg echo "<$perl_URL>" 11818552c8aSmrg ;; 11918552c8aSmrg autoconf|autom4te|autoheader) 12018552c8aSmrg echo "The '$1' program is part of the GNU Autoconf package:" 12118552c8aSmrg echo "<$gnu_software_URL/autoconf/>" 12218552c8aSmrg echo "It also requires GNU m4 and Perl in order to run:" 12318552c8aSmrg echo "<$gnu_software_URL/m4/>" 12418552c8aSmrg echo "<$perl_URL>" 12518552c8aSmrg ;; 12618552c8aSmrg esac 12718552c8aSmrg} 12818552c8aSmrg 12918552c8aSmrggive_advice () 13018552c8aSmrg{ 13118552c8aSmrg # Normalize program name to check for. 13218552c8aSmrg normalized_program=`echo "$1" | sed ' 13318552c8aSmrg s/^gnu-//; t 13418552c8aSmrg s/^gnu//; t 13518552c8aSmrg s/^g//; t'` 13618552c8aSmrg 13718552c8aSmrg printf '%s\n' "'$1' is $msg." 13818552c8aSmrg 13918552c8aSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14018552c8aSmrg case $normalized_program in 14118552c8aSmrg autoconf*) 14218552c8aSmrg echo "You should only need it if you modified 'configure.ac'," 14318552c8aSmrg echo "or m4 files included by it." 14418552c8aSmrg program_details 'autoconf' 14518552c8aSmrg ;; 14618552c8aSmrg autoheader*) 14718552c8aSmrg echo "You should only need it if you modified 'acconfig.h' or" 14818552c8aSmrg echo "$configure_deps." 14918552c8aSmrg program_details 'autoheader' 15018552c8aSmrg ;; 15118552c8aSmrg automake*) 15218552c8aSmrg echo "You should only need it if you modified 'Makefile.am' or" 15318552c8aSmrg echo "$configure_deps." 15418552c8aSmrg program_details 'automake' 15518552c8aSmrg ;; 15618552c8aSmrg aclocal*) 15718552c8aSmrg echo "You should only need it if you modified 'acinclude.m4' or" 15818552c8aSmrg echo "$configure_deps." 15918552c8aSmrg program_details 'aclocal' 16018552c8aSmrg ;; 16118552c8aSmrg autom4te*) 16218552c8aSmrg echo "You might have modified some maintainer files that require" 16397ee6427Smrg echo "the 'autom4te' program to be rebuilt." 16418552c8aSmrg program_details 'autom4te' 16518552c8aSmrg ;; 16618552c8aSmrg bison*|yacc*) 16718552c8aSmrg echo "You should only need it if you modified a '.y' file." 16818552c8aSmrg echo "You may want to install the GNU Bison package:" 16918552c8aSmrg echo "<$gnu_software_URL/bison/>" 17018552c8aSmrg ;; 17118552c8aSmrg lex*|flex*) 17218552c8aSmrg echo "You should only need it if you modified a '.l' file." 17318552c8aSmrg echo "You may want to install the Fast Lexical Analyzer package:" 17418552c8aSmrg echo "<$flex_URL>" 17518552c8aSmrg ;; 17618552c8aSmrg help2man*) 17718552c8aSmrg echo "You should only need it if you modified a dependency" \ 17818552c8aSmrg "of a man page." 17918552c8aSmrg echo "You may want to install the GNU Help2man package:" 18018552c8aSmrg echo "<$gnu_software_URL/help2man/>" 181301ea0f4Smrg ;; 18218552c8aSmrg makeinfo*) 18318552c8aSmrg echo "You should only need it if you modified a '.texi' file, or" 18418552c8aSmrg echo "any other file indirectly affecting the aspect of the manual." 18518552c8aSmrg echo "You might want to install the Texinfo package:" 18618552c8aSmrg echo "<$gnu_software_URL/texinfo/>" 18718552c8aSmrg echo "The spurious makeinfo call might also be the consequence of" 18818552c8aSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18918552c8aSmrg echo "want to install GNU make:" 19018552c8aSmrg echo "<$gnu_software_URL/make/>" 19118552c8aSmrg ;; 19218552c8aSmrg *) 19318552c8aSmrg echo "You might have modified some files without having the proper" 19418552c8aSmrg echo "tools for further handling them. Check the 'README' file, it" 19518552c8aSmrg echo "often tells you about the needed prerequisites for installing" 19618552c8aSmrg echo "this package. You may also peek at any GNU archive site, in" 19718552c8aSmrg echo "case some other package contains this missing '$1' program." 19818552c8aSmrg ;; 19918552c8aSmrg esac 20018552c8aSmrg} 20118552c8aSmrg 20218552c8aSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20318552c8aSmrg -e '2,$s/^/ /' >&2 20418552c8aSmrg 20518552c8aSmrg# Propagate the correct exit status (expected to be 127 for a program 20618552c8aSmrg# not found, 63 for a program that failed due to version mismatch). 20718552c8aSmrgexit $st 208301ea0f4Smrg 209301ea0f4Smrg# Local variables: 210301ea0f4Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211301ea0f4Smrg# time-stamp-start: "scriptversion=" 212301ea0f4Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213ef6fb4a5Smrg# time-stamp-time-zone: "UTC" 214ef6fb4a5Smrg# time-stamp-end: "; # UTC" 215301ea0f4Smrg# End: 216