Blame missing

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