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