Blame build-aux/missing

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