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