Blame missing

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