Blame isl-0.14/missing

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