Blame missing

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