Blame missing

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