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