Blame missing

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