Blame missing

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