Chris@69: #! /bin/sh Chris@69: # Common wrapper for a few potentially missing GNU programs. Chris@69: Chris@69: scriptversion=2013-10-28.13; # UTC Chris@69: Chris@69: # Copyright (C) 1996-2014 Free Software Foundation, Inc. Chris@69: # Originally written by Fran,cois Pinard , 1996. Chris@69: Chris@69: # This program is free software; you can redistribute it and/or modify Chris@69: # it under the terms of the GNU General Public License as published by Chris@69: # the Free Software Foundation; either version 2, or (at your option) Chris@69: # any later version. Chris@69: Chris@69: # This program is distributed in the hope that it will be useful, Chris@69: # but WITHOUT ANY WARRANTY; without even the implied warranty of Chris@69: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Chris@69: # GNU General Public License for more details. Chris@69: Chris@69: # You should have received a copy of the GNU General Public License Chris@69: # along with this program. If not, see . Chris@69: Chris@69: # As a special exception to the GNU General Public License, if you Chris@69: # distribute this file as part of a program that contains a Chris@69: # configuration script generated by Autoconf, you may include it under Chris@69: # the same distribution terms that you use for the rest of that program. Chris@69: Chris@69: if test $# -eq 0; then Chris@69: echo 1>&2 "Try '$0 --help' for more information" Chris@69: exit 1 Chris@69: fi Chris@69: Chris@69: case $1 in Chris@69: Chris@69: --is-lightweight) Chris@69: # Used by our autoconf macros to check whether the available missing Chris@69: # script is modern enough. Chris@69: exit 0 Chris@69: ;; Chris@69: Chris@69: --run) Chris@69: # Back-compat with the calling convention used by older automake. Chris@69: shift Chris@69: ;; Chris@69: Chris@69: -h|--h|--he|--hel|--help) Chris@69: echo "\ Chris@69: $0 [OPTION]... PROGRAM [ARGUMENT]... Chris@69: Chris@69: Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due Chris@69: to PROGRAM being missing or too old. Chris@69: Chris@69: Options: Chris@69: -h, --help display this help and exit Chris@69: -v, --version output version information and exit Chris@69: Chris@69: Supported PROGRAM values: Chris@69: aclocal autoconf autoheader autom4te automake makeinfo Chris@69: bison yacc flex lex help2man Chris@69: Chris@69: Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and Chris@69: 'g' are ignored when checking the name. Chris@69: Chris@69: Send bug reports to ." Chris@69: exit $? Chris@69: ;; Chris@69: Chris@69: -v|--v|--ve|--ver|--vers|--versi|--versio|--version) Chris@69: echo "missing $scriptversion (GNU Automake)" Chris@69: exit $? Chris@69: ;; Chris@69: Chris@69: -*) Chris@69: echo 1>&2 "$0: unknown '$1' option" Chris@69: echo 1>&2 "Try '$0 --help' for more information" Chris@69: exit 1 Chris@69: ;; Chris@69: Chris@69: esac Chris@69: Chris@69: # Run the given program, remember its exit status. Chris@69: "$@"; st=$? Chris@69: Chris@69: # If it succeeded, we are done. Chris@69: test $st -eq 0 && exit 0 Chris@69: Chris@69: # Also exit now if we it failed (or wasn't found), and '--version' was Chris@69: # passed; such an option is passed most likely to detect whether the Chris@69: # program is present and works. Chris@69: case $2 in --version|--help) exit $st;; esac Chris@69: Chris@69: # Exit code 63 means version mismatch. This often happens when the user Chris@69: # tries to use an ancient version of a tool on a file that requires a Chris@69: # minimum version. Chris@69: if test $st -eq 63; then Chris@69: msg="probably too old" Chris@69: elif test $st -eq 127; then Chris@69: # Program was missing. Chris@69: msg="missing on your system" Chris@69: else Chris@69: # Program was found and executed, but failed. Give up. Chris@69: exit $st Chris@69: fi Chris@69: Chris@69: perl_URL=http://www.perl.org/ Chris@69: flex_URL=http://flex.sourceforge.net/ Chris@69: gnu_software_URL=http://www.gnu.org/software Chris@69: Chris@69: program_details () Chris@69: { Chris@69: case $1 in Chris@69: aclocal|automake) Chris@69: echo "The '$1' program is part of the GNU Automake package:" Chris@69: echo "<$gnu_software_URL/automake>" Chris@69: echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" Chris@69: echo "<$gnu_software_URL/autoconf>" Chris@69: echo "<$gnu_software_URL/m4/>" Chris@69: echo "<$perl_URL>" Chris@69: ;; Chris@69: autoconf|autom4te|autoheader) Chris@69: echo "The '$1' program is part of the GNU Autoconf package:" Chris@69: echo "<$gnu_software_URL/autoconf/>" Chris@69: echo "It also requires GNU m4 and Perl in order to run:" Chris@69: echo "<$gnu_software_URL/m4/>" Chris@69: echo "<$perl_URL>" Chris@69: ;; Chris@69: esac Chris@69: } Chris@69: Chris@69: give_advice () Chris@69: { Chris@69: # Normalize program name to check for. Chris@69: normalized_program=`echo "$1" | sed ' Chris@69: s/^gnu-//; t Chris@69: s/^gnu//; t Chris@69: s/^g//; t'` Chris@69: Chris@69: printf '%s\n' "'$1' is $msg." Chris@69: Chris@69: configure_deps="'configure.ac' or m4 files included by 'configure.ac'" Chris@69: case $normalized_program in Chris@69: autoconf*) Chris@69: echo "You should only need it if you modified 'configure.ac'," Chris@69: echo "or m4 files included by it." Chris@69: program_details 'autoconf' Chris@69: ;; Chris@69: autoheader*) Chris@69: echo "You should only need it if you modified 'acconfig.h' or" Chris@69: echo "$configure_deps." Chris@69: program_details 'autoheader' Chris@69: ;; Chris@69: automake*) Chris@69: echo "You should only need it if you modified 'Makefile.am' or" Chris@69: echo "$configure_deps." Chris@69: program_details 'automake' Chris@69: ;; Chris@69: aclocal*) Chris@69: echo "You should only need it if you modified 'acinclude.m4' or" Chris@69: echo "$configure_deps." Chris@69: program_details 'aclocal' Chris@69: ;; Chris@69: autom4te*) Chris@69: echo "You might have modified some maintainer files that require" Chris@69: echo "the 'autom4te' program to be rebuilt." Chris@69: program_details 'autom4te' Chris@69: ;; Chris@69: bison*|yacc*) Chris@69: echo "You should only need it if you modified a '.y' file." Chris@69: echo "You may want to install the GNU Bison package:" Chris@69: echo "<$gnu_software_URL/bison/>" Chris@69: ;; Chris@69: lex*|flex*) Chris@69: echo "You should only need it if you modified a '.l' file." Chris@69: echo "You may want to install the Fast Lexical Analyzer package:" Chris@69: echo "<$flex_URL>" Chris@69: ;; Chris@69: help2man*) Chris@69: echo "You should only need it if you modified a dependency" \ Chris@69: "of a man page." Chris@69: echo "You may want to install the GNU Help2man package:" Chris@69: echo "<$gnu_software_URL/help2man/>" Chris@69: ;; Chris@69: makeinfo*) Chris@69: echo "You should only need it if you modified a '.texi' file, or" Chris@69: echo "any other file indirectly affecting the aspect of the manual." Chris@69: echo "You might want to install the Texinfo package:" Chris@69: echo "<$gnu_software_URL/texinfo/>" Chris@69: echo "The spurious makeinfo call might also be the consequence of" Chris@69: echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" Chris@69: echo "want to install GNU make:" Chris@69: echo "<$gnu_software_URL/make/>" Chris@69: ;; Chris@69: *) Chris@69: echo "You might have modified some files without having the proper" Chris@69: echo "tools for further handling them. Check the 'README' file, it" Chris@69: echo "often tells you about the needed prerequisites for installing" Chris@69: echo "this package. You may also peek at any GNU archive site, in" Chris@69: echo "case some other package contains this missing '$1' program." Chris@69: ;; Chris@69: esac Chris@69: } Chris@69: Chris@69: give_advice "$1" | sed -e '1s/^/WARNING: /' \ Chris@69: -e '2,$s/^/ /' >&2 Chris@69: Chris@69: # Propagate the correct exit status (expected to be 127 for a program Chris@69: # not found, 63 for a program that failed due to version mismatch). Chris@69: exit $st Chris@69: Chris@69: # Local variables: Chris@69: # eval: (add-hook 'write-file-hooks 'time-stamp) Chris@69: # time-stamp-start: "scriptversion=" Chris@69: # time-stamp-format: "%:y-%02m-%02d.%02H" Chris@69: # time-stamp-time-zone: "UTC" Chris@69: # time-stamp-end: "; # UTC" Chris@69: # End: