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