Blame missing

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