Blame missing

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