missing revision 493f84f4
11.1Smaxv#! /bin/sh
21.1Smaxv# Common wrapper for a few potentially missing GNU programs.
31.1Smaxv
41.1Smaxvscriptversion=2013-10-28.13; # UTC
51.1Smaxv
61.1Smaxv# Copyright (C) 1996-2013 Free Software Foundation, Inc.
71.1Smaxv# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
81.1Smaxv
91.1Smaxv# This program is free software; you can redistribute it and/or modify
101.1Smaxv# it under the terms of the GNU General Public License as published by
111.1Smaxv# the Free Software Foundation; either version 2, or (at your option)
121.1Smaxv# any later version.
131.1Smaxv
141.1Smaxv# This program is distributed in the hope that it will be useful,
151.1Smaxv# but WITHOUT ANY WARRANTY; without even the implied warranty of
161.1Smaxv# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
171.1Smaxv# GNU General Public License for more details.
181.1Smaxv
191.1Smaxv# You should have received a copy of the GNU General Public License
201.1Smaxv# along with this program.  If not, see <http://www.gnu.org/licenses/>.
211.1Smaxv
221.1Smaxv# As a special exception to the GNU General Public License, if you
231.1Smaxv# distribute this file as part of a program that contains a
241.1Smaxv# configuration script generated by Autoconf, you may include it under
251.1Smaxv# the same distribution terms that you use for the rest of that program.
261.1Smaxv
271.1Smaxvif test $# -eq 0; then
281.1Smaxv  echo 1>&2 "Try '$0 --help' for more information"
291.1Smaxv  exit 1
301.1Smaxvfi
311.1Smaxv
321.1Smaxvcase $1 in
331.1Smaxv
341.1Smaxv  --is-lightweight)
351.1Smaxv    # Used by our autoconf macros to check whether the available missing
361.1Smaxv    # script is modern enough.
371.1Smaxv    exit 0
381.1Smaxv    ;;
391.1Smaxv
401.1Smaxv  --run)
411.1Smaxv    # Back-compat with the calling convention used by older automake.
421.1Smaxv    shift
431.1Smaxv    ;;
441.1Smaxv
451.1Smaxv  -h|--h|--he|--hel|--help)
461.1Smaxv    echo "\
471.1Smaxv$0 [OPTION]... PROGRAM [ARGUMENT]...
481.1Smaxv
491.1SmaxvRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
501.1Smaxvto PROGRAM being missing or too old.
511.1Smaxv
521.1SmaxvOptions:
531.1Smaxv  -h, --help      display this help and exit
541.1Smaxv  -v, --version   output version information and exit
551.1Smaxv
561.1SmaxvSupported PROGRAM values:
571.1Smaxv  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
581.1Smaxv  bison     yacc      flex         lex       help2man
591.1Smaxv
601.1SmaxvVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
611.1Smaxv'g' are ignored when checking the name.
621.1Smaxv
631.1SmaxvSend bug reports to <bug-automake@gnu.org>."
641.1Smaxv    exit $?
651.1Smaxv    ;;
661.1Smaxv
671.1Smaxv  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
681.1Smaxv    echo "missing $scriptversion (GNU Automake)"
691.1Smaxv    exit $?
701.1Smaxv    ;;
711.1Smaxv
721.1Smaxv  -*)
731.1Smaxv    echo 1>&2 "$0: unknown '$1' option"
741.1Smaxv    echo 1>&2 "Try '$0 --help' for more information"
751.1Smaxv    exit 1
761.1Smaxv    ;;
771.1Smaxv
781.1Smaxvesac
791.1Smaxv
801.1Smaxv# Run the given program, remember its exit status.
811.1Smaxv"$@"; st=$?
821.1Smaxv
831.1Smaxv# If it succeeded, we are done.
841.1Smaxvtest $st -eq 0 && exit 0
851.1Smaxv
861.1Smaxv# Also exit now if we it failed (or wasn't found), and '--version' was
871.1Smaxv# passed; such an option is passed most likely to detect whether the
881.1Smaxv# program is present and works.
891.1Smaxvcase $2 in --version|--help) exit $st;; esac
901.1Smaxv
911.1Smaxv# Exit code 63 means version mismatch.  This often happens when the user
921.1Smaxv# tries to use an ancient version of a tool on a file that requires a
931.1Smaxv# minimum version.
941.1Smaxvif test $st -eq 63; then
951.1Smaxv  msg="probably too old"
961.1Smaxvelif test $st -eq 127; then
971.1Smaxv  # Program was missing.
981.1Smaxv  msg="missing on your system"
991.1Smaxvelse
1001.1Smaxv  # Program was found and executed, but failed.  Give up.
1011.1Smaxv  exit $st
1021.1Smaxvfi
1031.1Smaxv
1041.1Smaxvperl_URL=http://www.perl.org/
1051.1Smaxvflex_URL=http://flex.sourceforge.net/
1061.1Smaxvgnu_software_URL=http://www.gnu.org/software
1071.1Smaxv
1081.1Smaxvprogram_details ()
1091.1Smaxv{
1101.1Smaxv  case $1 in
1111.1Smaxv    aclocal|automake)
1121.1Smaxv      echo "The '$1' program is part of the GNU Automake package:"
1131.1Smaxv      echo "<$gnu_software_URL/automake>"
1141.1Smaxv      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
1151.1Smaxv      echo "<$gnu_software_URL/autoconf>"
1161.1Smaxv      echo "<$gnu_software_URL/m4/>"
1171.1Smaxv      echo "<$perl_URL>"
1181.1Smaxv      ;;
1191.1Smaxv    autoconf|autom4te|autoheader)
1201.1Smaxv      echo "The '$1' program is part of the GNU Autoconf package:"
1211.1Smaxv      echo "<$gnu_software_URL/autoconf/>"
1221.1Smaxv      echo "It also requires GNU m4 and Perl in order to run:"
1231.1Smaxv      echo "<$gnu_software_URL/m4/>"
1241.1Smaxv      echo "<$perl_URL>"
1251.1Smaxv      ;;
1261.1Smaxv  esac
1271.1Smaxv}
1281.1Smaxv
1291.1Smaxvgive_advice ()
1301.1Smaxv{
1311.1Smaxv  # Normalize program name to check for.
1321.1Smaxv  normalized_program=`echo "$1" | sed '
1331.1Smaxv    s/^gnu-//; t
1341.1Smaxv    s/^gnu//; t
1351.1Smaxv    s/^g//; t'`
1361.1Smaxv
1371.1Smaxv  printf '%s\n' "'$1' is $msg."
1381.1Smaxv
1391.1Smaxv  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
1401.1Smaxv  case $normalized_program in
1411.1Smaxv    autoconf*)
1421.1Smaxv      echo "You should only need it if you modified 'configure.ac',"
1431.1Smaxv      echo "or m4 files included by it."
1441.1Smaxv      program_details 'autoconf'
1451.1Smaxv      ;;
1461.1Smaxv    autoheader*)
1471.1Smaxv      echo "You should only need it if you modified 'acconfig.h' or"
1481.1Smaxv      echo "$configure_deps."
1491.1Smaxv      program_details 'autoheader'
1501.1Smaxv      ;;
1511.1Smaxv    automake*)
1521.1Smaxv      echo "You should only need it if you modified 'Makefile.am' or"
1531.1Smaxv      echo "$configure_deps."
1541.1Smaxv      program_details 'automake'
1551.1Smaxv      ;;
1561.1Smaxv    aclocal*)
1571.1Smaxv      echo "You should only need it if you modified 'acinclude.m4' or"
1581.1Smaxv      echo "$configure_deps."
1591.1Smaxv      program_details 'aclocal'
1601.1Smaxv      ;;
1611.1Smaxv   autom4te*)
1621.1Smaxv      echo "You might have modified some maintainer files that require"
1631.1Smaxv      echo "the 'autom4te' program to be rebuilt."
1641.1Smaxv      program_details 'autom4te'
1651.1Smaxv      ;;
1661.1Smaxv    bison*|yacc*)
1671.1Smaxv      echo "You should only need it if you modified a '.y' file."
1681.1Smaxv      echo "You may want to install the GNU Bison package:"
1691.1Smaxv      echo "<$gnu_software_URL/bison/>"
1701.1Smaxv      ;;
1711.1Smaxv    lex*|flex*)
1721.1Smaxv      echo "You should only need it if you modified a '.l' file."
1731.1Smaxv      echo "You may want to install the Fast Lexical Analyzer package:"
1741.1Smaxv      echo "<$flex_URL>"
1751.1Smaxv      ;;
1761.1Smaxv    help2man*)
1771.1Smaxv      echo "You should only need it if you modified a dependency" \
1781.1Smaxv           "of a man page."
1791.1Smaxv      echo "You may want to install the GNU Help2man package:"
1801.1Smaxv      echo "<$gnu_software_URL/help2man/>"
1811.1Smaxv    ;;
1821.1Smaxv    makeinfo*)
1831.1Smaxv      echo "You should only need it if you modified a '.texi' file, or"
1841.1Smaxv      echo "any other file indirectly affecting the aspect of the manual."
1851.1Smaxv      echo "You might want to install the Texinfo package:"
1861.1Smaxv      echo "<$gnu_software_URL/texinfo/>"
1871.1Smaxv      echo "The spurious makeinfo call might also be the consequence of"
1881.1Smaxv      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
1891.1Smaxv      echo "want to install GNU make:"
1901.1Smaxv      echo "<$gnu_software_URL/make/>"
1911.1Smaxv      ;;
1921.1Smaxv    *)
1931.1Smaxv      echo "You might have modified some files without having the proper"
1941.1Smaxv      echo "tools for further handling them.  Check the 'README' file, it"
1951.1Smaxv      echo "often tells you about the needed prerequisites for installing"
1961.1Smaxv      echo "this package.  You may also peek at any GNU archive site, in"
1971.1Smaxv      echo "case some other package contains this missing '$1' program."
1981.1Smaxv      ;;
1991.1Smaxv  esac
2001.1Smaxv}
2011.1Smaxv
2021.1Smaxvgive_advice "$1" | sed -e '1s/^/WARNING: /' \
2031.1Smaxv                       -e '2,$s/^/         /' >&2
2041.1Smaxv
2051.1Smaxv# Propagate the correct exit status (expected to be 127 for a program
2061.1Smaxv# not found, 63 for a program that failed due to version mismatch).
2071.1Smaxvexit $st
2081.1Smaxv
2091.1Smaxv# Local variables:
2101.1Smaxv# eval: (add-hook 'write-file-hooks 'time-stamp)
2111.1Smaxv# time-stamp-start: "scriptversion="
2121.1Smaxv# time-stamp-format: "%:y-%02m-%02d.%02H"
2131.1Smaxv# time-stamp-time-zone: "UTC"
2141.1Smaxv# time-stamp-end: "; # UTC"
2151.1Smaxv# End:
2161.1Smaxv