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