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