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