Blame missing

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