1b8f75c19Smrg#! /bin/sh 28e4923e5Smrg# Common wrapper for a few potentially missing GNU programs. 37e4fd55aSmrg 48832ea4aSmrgscriptversion=2013-10-28.13; # UTC 57e4fd55aSmrg 68832ea4aSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 78e4923e5Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8b8f75c19Smrg 9b8f75c19Smrg# This program is free software; you can redistribute it and/or modify 10b8f75c19Smrg# it under the terms of the GNU General Public License as published by 11b8f75c19Smrg# the Free Software Foundation; either version 2, or (at your option) 12b8f75c19Smrg# any later version. 13b8f75c19Smrg 14b8f75c19Smrg# This program is distributed in the hope that it will be useful, 15b8f75c19Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16b8f75c19Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17b8f75c19Smrg# GNU General Public License for more details. 18b8f75c19Smrg 19b8f75c19Smrg# You should have received a copy of the GNU General Public License 207e4fd55aSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21b8f75c19Smrg 22b8f75c19Smrg# As a special exception to the GNU General Public License, if you 23b8f75c19Smrg# distribute this file as part of a program that contains a 24b8f75c19Smrg# configuration script generated by Autoconf, you may include it under 25b8f75c19Smrg# the same distribution terms that you use for the rest of that program. 26b8f75c19Smrg 27b8f75c19Smrgif test $# -eq 0; then 288e4923e5Smrg echo 1>&2 "Try '$0 --help' for more information" 29b8f75c19Smrg exit 1 30b8f75c19Smrgfi 31b8f75c19Smrg 328e4923e5Smrgcase $1 in 33b8f75c19Smrg 348e4923e5Smrg --is-lightweight) 358e4923e5Smrg # Used by our autoconf macros to check whether the available missing 368e4923e5Smrg # script is modern enough. 378e4923e5Smrg exit 0 388e4923e5Smrg ;; 397e4fd55aSmrg 408e4923e5Smrg --run) 418e4923e5Smrg # Back-compat with the calling convention used by older automake. 428e4923e5Smrg shift 438e4923e5Smrg ;; 44b8f75c19Smrg 45b8f75c19Smrg -h|--h|--he|--hel|--help) 46b8f75c19Smrg echo "\ 47b8f75c19Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48b8f75c19Smrg 498e4923e5SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 508e4923e5Smrgto PROGRAM being missing or too old. 51b8f75c19Smrg 52b8f75c19SmrgOptions: 53b8f75c19Smrg -h, --help display this help and exit 54b8f75c19Smrg -v, --version output version information and exit 55b8f75c19Smrg 56b8f75c19SmrgSupported PROGRAM values: 578e4923e5Smrg aclocal autoconf autoheader autom4te automake makeinfo 588e4923e5Smrg bison yacc flex lex help2man 597e4fd55aSmrg 608e4923e5SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 618e4923e5Smrg'g' are ignored when checking the name. 627e4fd55aSmrg 637e4fd55aSmrgSend bug reports to <bug-automake@gnu.org>." 647e4fd55aSmrg exit $? 65b8f75c19Smrg ;; 66b8f75c19Smrg 67b8f75c19Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 687e4fd55aSmrg echo "missing $scriptversion (GNU Automake)" 697e4fd55aSmrg exit $? 70b8f75c19Smrg ;; 71b8f75c19Smrg 72b8f75c19Smrg -*) 738e4923e5Smrg echo 1>&2 "$0: unknown '$1' option" 748e4923e5Smrg echo 1>&2 "Try '$0 --help' for more information" 75b8f75c19Smrg exit 1 76b8f75c19Smrg ;; 77b8f75c19Smrg 787e4fd55aSmrgesac 797e4fd55aSmrg 808e4923e5Smrg# Run the given program, remember its exit status. 818e4923e5Smrg"$@"; st=$? 828e4923e5Smrg 838e4923e5Smrg# If it succeeded, we are done. 848e4923e5Smrgtest $st -eq 0 && exit 0 858e4923e5Smrg 868e4923e5Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 878e4923e5Smrg# passed; such an option is passed most likely to detect whether the 888e4923e5Smrg# program is present and works. 898e4923e5Smrgcase $2 in --version|--help) exit $st;; esac 908e4923e5Smrg 918e4923e5Smrg# Exit code 63 means version mismatch. This often happens when the user 928e4923e5Smrg# tries to use an ancient version of a tool on a file that requires a 938e4923e5Smrg# minimum version. 948e4923e5Smrgif test $st -eq 63; then 958e4923e5Smrg msg="probably too old" 968e4923e5Smrgelif test $st -eq 127; then 978e4923e5Smrg # Program was missing. 988e4923e5Smrg msg="missing on your system" 998e4923e5Smrgelse 1008e4923e5Smrg # Program was found and executed, but failed. Give up. 1018e4923e5Smrg exit $st 1028e4923e5Smrgfi 103b8f75c19Smrg 1048e4923e5Smrgperl_URL=http://www.perl.org/ 1058e4923e5Smrgflex_URL=http://flex.sourceforge.net/ 1068e4923e5Smrggnu_software_URL=http://www.gnu.org/software 1078e4923e5Smrg 1088e4923e5Smrgprogram_details () 1098e4923e5Smrg{ 1108e4923e5Smrg case $1 in 1118e4923e5Smrg aclocal|automake) 1128e4923e5Smrg echo "The '$1' program is part of the GNU Automake package:" 1138e4923e5Smrg echo "<$gnu_software_URL/automake>" 1148e4923e5Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1158e4923e5Smrg echo "<$gnu_software_URL/autoconf>" 1168e4923e5Smrg echo "<$gnu_software_URL/m4/>" 1178e4923e5Smrg echo "<$perl_URL>" 1188e4923e5Smrg ;; 1198e4923e5Smrg autoconf|autom4te|autoheader) 1208e4923e5Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1218e4923e5Smrg echo "<$gnu_software_URL/autoconf/>" 1228e4923e5Smrg echo "It also requires GNU m4 and Perl in order to run:" 1238e4923e5Smrg echo "<$gnu_software_URL/m4/>" 1248e4923e5Smrg echo "<$perl_URL>" 1258e4923e5Smrg ;; 1268e4923e5Smrg esac 1278e4923e5Smrg} 1288e4923e5Smrg 1298e4923e5Smrggive_advice () 1308e4923e5Smrg{ 1318e4923e5Smrg # Normalize program name to check for. 1328e4923e5Smrg normalized_program=`echo "$1" | sed ' 1338e4923e5Smrg s/^gnu-//; t 1348e4923e5Smrg s/^gnu//; t 1358e4923e5Smrg s/^g//; t'` 1368e4923e5Smrg 1378e4923e5Smrg printf '%s\n' "'$1' is $msg." 1388e4923e5Smrg 1398e4923e5Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1408e4923e5Smrg case $normalized_program in 1418e4923e5Smrg autoconf*) 1428e4923e5Smrg echo "You should only need it if you modified 'configure.ac'," 1438e4923e5Smrg echo "or m4 files included by it." 1448e4923e5Smrg program_details 'autoconf' 1458e4923e5Smrg ;; 1468e4923e5Smrg autoheader*) 1478e4923e5Smrg echo "You should only need it if you modified 'acconfig.h' or" 1488e4923e5Smrg echo "$configure_deps." 1498e4923e5Smrg program_details 'autoheader' 1508e4923e5Smrg ;; 1518e4923e5Smrg automake*) 1528e4923e5Smrg echo "You should only need it if you modified 'Makefile.am' or" 1538e4923e5Smrg echo "$configure_deps." 1548e4923e5Smrg program_details 'automake' 1558e4923e5Smrg ;; 1568e4923e5Smrg aclocal*) 1578e4923e5Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1588e4923e5Smrg echo "$configure_deps." 1598e4923e5Smrg program_details 'aclocal' 1608e4923e5Smrg ;; 1618e4923e5Smrg autom4te*) 1628e4923e5Smrg echo "You might have modified some maintainer files that require" 1638832ea4aSmrg echo "the 'autom4te' program to be rebuilt." 1648e4923e5Smrg program_details 'autom4te' 1658e4923e5Smrg ;; 1668e4923e5Smrg bison*|yacc*) 1678e4923e5Smrg echo "You should only need it if you modified a '.y' file." 1688e4923e5Smrg echo "You may want to install the GNU Bison package:" 1698e4923e5Smrg echo "<$gnu_software_URL/bison/>" 1708e4923e5Smrg ;; 1718e4923e5Smrg lex*|flex*) 1728e4923e5Smrg echo "You should only need it if you modified a '.l' file." 1738e4923e5Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1748e4923e5Smrg echo "<$flex_URL>" 1758e4923e5Smrg ;; 1768e4923e5Smrg help2man*) 1778e4923e5Smrg echo "You should only need it if you modified a dependency" \ 1788e4923e5Smrg "of a man page." 1798e4923e5Smrg echo "You may want to install the GNU Help2man package:" 1808e4923e5Smrg echo "<$gnu_software_URL/help2man/>" 1818e4923e5Smrg ;; 1828e4923e5Smrg makeinfo*) 1838e4923e5Smrg echo "You should only need it if you modified a '.texi' file, or" 1848e4923e5Smrg echo "any other file indirectly affecting the aspect of the manual." 1858e4923e5Smrg echo "You might want to install the Texinfo package:" 1868e4923e5Smrg echo "<$gnu_software_URL/texinfo/>" 1878e4923e5Smrg echo "The spurious makeinfo call might also be the consequence of" 1888e4923e5Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1898e4923e5Smrg echo "want to install GNU make:" 1908e4923e5Smrg echo "<$gnu_software_URL/make/>" 1918e4923e5Smrg ;; 1928e4923e5Smrg *) 1938e4923e5Smrg echo "You might have modified some files without having the proper" 1948e4923e5Smrg echo "tools for further handling them. Check the 'README' file, it" 1958e4923e5Smrg echo "often tells you about the needed prerequisites for installing" 1968e4923e5Smrg echo "this package. You may also peek at any GNU archive site, in" 1978e4923e5Smrg echo "case some other package contains this missing '$1' program." 1988e4923e5Smrg ;; 1998e4923e5Smrg esac 2008e4923e5Smrg} 2018e4923e5Smrg 2028e4923e5Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2038e4923e5Smrg -e '2,$s/^/ /' >&2 2048e4923e5Smrg 2058e4923e5Smrg# Propagate the correct exit status (expected to be 127 for a program 2068e4923e5Smrg# not found, 63 for a program that failed due to version mismatch). 2078e4923e5Smrgexit $st 2087e4fd55aSmrg 2097e4fd55aSmrg# Local variables: 2107e4fd55aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 2117e4fd55aSmrg# time-stamp-start: "scriptversion=" 2127e4fd55aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2137e4fd55aSmrg# time-stamp-time-zone: "UTC" 2147e4fd55aSmrg# time-stamp-end: "; # UTC" 2157e4fd55aSmrg# End: 216