Blame missing

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