Blame missing

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