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