1bdcaa8d0Smrg#! /bin/sh 24f00d7e1Smrg# Common wrapper for a few potentially missing GNU programs. 3bdcaa8d0Smrg 44f00d7e1Smrgscriptversion=2012-06-26.16; # UTC 5bdcaa8d0Smrg 64f00d7e1Smrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 74f00d7e1Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8bdcaa8d0Smrg 9bdcaa8d0Smrg# This program is free software; you can redistribute it and/or modify 10bdcaa8d0Smrg# it under the terms of the GNU General Public License as published by 11bdcaa8d0Smrg# the Free Software Foundation; either version 2, or (at your option) 12bdcaa8d0Smrg# any later version. 13bdcaa8d0Smrg 14bdcaa8d0Smrg# This program is distributed in the hope that it will be useful, 15bdcaa8d0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16bdcaa8d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17bdcaa8d0Smrg# GNU General Public License for more details. 18bdcaa8d0Smrg 19bdcaa8d0Smrg# You should have received a copy of the GNU General Public License 2096ce994aSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21bdcaa8d0Smrg 22bdcaa8d0Smrg# As a special exception to the GNU General Public License, if you 23bdcaa8d0Smrg# distribute this file as part of a program that contains a 24bdcaa8d0Smrg# configuration script generated by Autoconf, you may include it under 25bdcaa8d0Smrg# the same distribution terms that you use for the rest of that program. 26bdcaa8d0Smrg 27bdcaa8d0Smrgif test $# -eq 0; then 284f00d7e1Smrg echo 1>&2 "Try '$0 --help' for more information" 29bdcaa8d0Smrg exit 1 30bdcaa8d0Smrgfi 31bdcaa8d0Smrg 324f00d7e1Smrgcase $1 in 33bdcaa8d0Smrg 344f00d7e1Smrg --is-lightweight) 354f00d7e1Smrg # Used by our autoconf macros to check whether the available missing 364f00d7e1Smrg # script is modern enough. 374f00d7e1Smrg exit 0 384f00d7e1Smrg ;; 39bdcaa8d0Smrg 404f00d7e1Smrg --run) 414f00d7e1Smrg # Back-compat with the calling convention used by older automake. 424f00d7e1Smrg shift 434f00d7e1Smrg ;; 44bdcaa8d0Smrg 45bdcaa8d0Smrg -h|--h|--he|--hel|--help) 46bdcaa8d0Smrg echo "\ 47bdcaa8d0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48bdcaa8d0Smrg 494f00d7e1SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 504f00d7e1Smrgto PROGRAM being missing or too old. 51bdcaa8d0Smrg 52bdcaa8d0SmrgOptions: 53bdcaa8d0Smrg -h, --help display this help and exit 54bdcaa8d0Smrg -v, --version output version information and exit 55bdcaa8d0Smrg 56bdcaa8d0SmrgSupported PROGRAM values: 574f00d7e1Smrg aclocal autoconf autoheader autom4te automake makeinfo 584f00d7e1Smrg bison yacc flex lex help2man 59bdcaa8d0Smrg 604f00d7e1SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 614f00d7e1Smrg'g' are ignored when checking the name. 6296ce994aSmrg 63bdcaa8d0SmrgSend bug reports to <bug-automake@gnu.org>." 64bdcaa8d0Smrg exit $? 65bdcaa8d0Smrg ;; 66bdcaa8d0Smrg 67bdcaa8d0Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68bdcaa8d0Smrg echo "missing $scriptversion (GNU Automake)" 69bdcaa8d0Smrg exit $? 70bdcaa8d0Smrg ;; 71bdcaa8d0Smrg 72bdcaa8d0Smrg -*) 734f00d7e1Smrg echo 1>&2 "$0: unknown '$1' option" 744f00d7e1Smrg echo 1>&2 "Try '$0 --help' for more information" 75bdcaa8d0Smrg exit 1 76bdcaa8d0Smrg ;; 77bdcaa8d0Smrg 78bdcaa8d0Smrgesac 79bdcaa8d0Smrg 804f00d7e1Smrg# Run the given program, remember its exit status. 814f00d7e1Smrg"$@"; st=$? 824f00d7e1Smrg 834f00d7e1Smrg# If it succeeded, we are done. 844f00d7e1Smrgtest $st -eq 0 && exit 0 854f00d7e1Smrg 864f00d7e1Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 874f00d7e1Smrg# passed; such an option is passed most likely to detect whether the 884f00d7e1Smrg# program is present and works. 894f00d7e1Smrgcase $2 in --version|--help) exit $st;; esac 904f00d7e1Smrg 914f00d7e1Smrg# Exit code 63 means version mismatch. This often happens when the user 924f00d7e1Smrg# tries to use an ancient version of a tool on a file that requires a 934f00d7e1Smrg# minimum version. 944f00d7e1Smrgif test $st -eq 63; then 954f00d7e1Smrg msg="probably too old" 964f00d7e1Smrgelif test $st -eq 127; then 974f00d7e1Smrg # Program was missing. 984f00d7e1Smrg msg="missing on your system" 994f00d7e1Smrgelse 1004f00d7e1Smrg # Program was found and executed, but failed. Give up. 1014f00d7e1Smrg exit $st 1024f00d7e1Smrgfi 103bdcaa8d0Smrg 1044f00d7e1Smrgperl_URL=http://www.perl.org/ 1054f00d7e1Smrgflex_URL=http://flex.sourceforge.net/ 1064f00d7e1Smrggnu_software_URL=http://www.gnu.org/software 1074f00d7e1Smrg 1084f00d7e1Smrgprogram_details () 1094f00d7e1Smrg{ 1104f00d7e1Smrg case $1 in 1114f00d7e1Smrg aclocal|automake) 1124f00d7e1Smrg echo "The '$1' program is part of the GNU Automake package:" 1134f00d7e1Smrg echo "<$gnu_software_URL/automake>" 1144f00d7e1Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1154f00d7e1Smrg echo "<$gnu_software_URL/autoconf>" 1164f00d7e1Smrg echo "<$gnu_software_URL/m4/>" 1174f00d7e1Smrg echo "<$perl_URL>" 1184f00d7e1Smrg ;; 1194f00d7e1Smrg autoconf|autom4te|autoheader) 1204f00d7e1Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1214f00d7e1Smrg echo "<$gnu_software_URL/autoconf/>" 1224f00d7e1Smrg echo "It also requires GNU m4 and Perl in order to run:" 1234f00d7e1Smrg echo "<$gnu_software_URL/m4/>" 1244f00d7e1Smrg echo "<$perl_URL>" 1254f00d7e1Smrg ;; 1264f00d7e1Smrg esac 1274f00d7e1Smrg} 1284f00d7e1Smrg 1294f00d7e1Smrggive_advice () 1304f00d7e1Smrg{ 1314f00d7e1Smrg # Normalize program name to check for. 1324f00d7e1Smrg normalized_program=`echo "$1" | sed ' 1334f00d7e1Smrg s/^gnu-//; t 1344f00d7e1Smrg s/^gnu//; t 1354f00d7e1Smrg s/^g//; t'` 1364f00d7e1Smrg 1374f00d7e1Smrg printf '%s\n' "'$1' is $msg." 1384f00d7e1Smrg 1394f00d7e1Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1404f00d7e1Smrg case $normalized_program in 1414f00d7e1Smrg autoconf*) 1424f00d7e1Smrg echo "You should only need it if you modified 'configure.ac'," 1434f00d7e1Smrg echo "or m4 files included by it." 1444f00d7e1Smrg program_details 'autoconf' 1454f00d7e1Smrg ;; 1464f00d7e1Smrg autoheader*) 1474f00d7e1Smrg echo "You should only need it if you modified 'acconfig.h' or" 1484f00d7e1Smrg echo "$configure_deps." 1494f00d7e1Smrg program_details 'autoheader' 1504f00d7e1Smrg ;; 1514f00d7e1Smrg automake*) 1524f00d7e1Smrg echo "You should only need it if you modified 'Makefile.am' or" 1534f00d7e1Smrg echo "$configure_deps." 1544f00d7e1Smrg program_details 'automake' 1554f00d7e1Smrg ;; 1564f00d7e1Smrg aclocal*) 1574f00d7e1Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1584f00d7e1Smrg echo "$configure_deps." 1594f00d7e1Smrg program_details 'aclocal' 1604f00d7e1Smrg ;; 1614f00d7e1Smrg autom4te*) 1624f00d7e1Smrg echo "You might have modified some maintainer files that require" 1634f00d7e1Smrg echo "the 'automa4te' program to be rebuilt." 1644f00d7e1Smrg program_details 'autom4te' 1654f00d7e1Smrg ;; 1664f00d7e1Smrg bison*|yacc*) 1674f00d7e1Smrg echo "You should only need it if you modified a '.y' file." 1684f00d7e1Smrg echo "You may want to install the GNU Bison package:" 1694f00d7e1Smrg echo "<$gnu_software_URL/bison/>" 1704f00d7e1Smrg ;; 1714f00d7e1Smrg lex*|flex*) 1724f00d7e1Smrg echo "You should only need it if you modified a '.l' file." 1734f00d7e1Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1744f00d7e1Smrg echo "<$flex_URL>" 1754f00d7e1Smrg ;; 1764f00d7e1Smrg help2man*) 1774f00d7e1Smrg echo "You should only need it if you modified a dependency" \ 1784f00d7e1Smrg "of a man page." 1794f00d7e1Smrg echo "You may want to install the GNU Help2man package:" 1804f00d7e1Smrg echo "<$gnu_software_URL/help2man/>" 181bdcaa8d0Smrg ;; 1824f00d7e1Smrg makeinfo*) 1834f00d7e1Smrg echo "You should only need it if you modified a '.texi' file, or" 1844f00d7e1Smrg echo "any other file indirectly affecting the aspect of the manual." 1854f00d7e1Smrg echo "You might want to install the Texinfo package:" 1864f00d7e1Smrg echo "<$gnu_software_URL/texinfo/>" 1874f00d7e1Smrg echo "The spurious makeinfo call might also be the consequence of" 1884f00d7e1Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1894f00d7e1Smrg echo "want to install GNU make:" 1904f00d7e1Smrg echo "<$gnu_software_URL/make/>" 1914f00d7e1Smrg ;; 1924f00d7e1Smrg *) 1934f00d7e1Smrg echo "You might have modified some files without having the proper" 1944f00d7e1Smrg echo "tools for further handling them. Check the 'README' file, it" 1954f00d7e1Smrg echo "often tells you about the needed prerequisites for installing" 1964f00d7e1Smrg echo "this package. You may also peek at any GNU archive site, in" 1974f00d7e1Smrg echo "case some other package contains this missing '$1' program." 1984f00d7e1Smrg ;; 1994f00d7e1Smrg esac 2004f00d7e1Smrg} 2014f00d7e1Smrg 2024f00d7e1Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2034f00d7e1Smrg -e '2,$s/^/ /' >&2 2044f00d7e1Smrg 2054f00d7e1Smrg# Propagate the correct exit status (expected to be 127 for a program 2064f00d7e1Smrg# not found, 63 for a program that failed due to version mismatch). 2074f00d7e1Smrgexit $st 208bdcaa8d0Smrg 209bdcaa8d0Smrg# Local variables: 210bdcaa8d0Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211bdcaa8d0Smrg# time-stamp-start: "scriptversion=" 212bdcaa8d0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21396ce994aSmrg# time-stamp-time-zone: "UTC" 21496ce994aSmrg# time-stamp-end: "; # UTC" 215bdcaa8d0Smrg# End: 216