Blame missing

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