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