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