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