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