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