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