102be438aSmrg#! /bin/sh 2e2463426Smrg# Common wrapper for a few potentially missing GNU programs. 302be438aSmrg 4adb5514aSmrgscriptversion=2013-10-28.13; # UTC 502be438aSmrg 6adb5514aSmrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 7e2463426Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 802be438aSmrg 902be438aSmrg# This program is free software; you can redistribute it and/or modify 1002be438aSmrg# it under the terms of the GNU General Public License as published by 1102be438aSmrg# the Free Software Foundation; either version 2, or (at your option) 1202be438aSmrg# any later version. 1302be438aSmrg 1402be438aSmrg# This program is distributed in the hope that it will be useful, 1502be438aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1602be438aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1702be438aSmrg# GNU General Public License for more details. 1802be438aSmrg 1902be438aSmrg# You should have received a copy of the GNU General Public License 2061dc2d86Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2102be438aSmrg 2202be438aSmrg# As a special exception to the GNU General Public License, if you 2302be438aSmrg# distribute this file as part of a program that contains a 2402be438aSmrg# configuration script generated by Autoconf, you may include it under 2502be438aSmrg# the same distribution terms that you use for the rest of that program. 2602be438aSmrg 2702be438aSmrgif test $# -eq 0; then 28e2463426Smrg echo 1>&2 "Try '$0 --help' for more information" 2902be438aSmrg exit 1 3002be438aSmrgfi 3102be438aSmrg 32e2463426Smrgcase $1 in 3302be438aSmrg 34e2463426Smrg --is-lightweight) 35e2463426Smrg # Used by our autoconf macros to check whether the available missing 36e2463426Smrg # script is modern enough. 37e2463426Smrg exit 0 38e2463426Smrg ;; 3902be438aSmrg 40e2463426Smrg --run) 41e2463426Smrg # Back-compat with the calling convention used by older automake. 42e2463426Smrg shift 43e2463426Smrg ;; 4402be438aSmrg 4502be438aSmrg -h|--h|--he|--hel|--help) 4602be438aSmrg echo "\ 4702be438aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4802be438aSmrg 49e2463426SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50e2463426Smrgto PROGRAM being missing or too old. 5102be438aSmrg 5202be438aSmrgOptions: 5302be438aSmrg -h, --help display this help and exit 5402be438aSmrg -v, --version output version information and exit 5502be438aSmrg 5602be438aSmrgSupported PROGRAM values: 57e2463426Smrg aclocal autoconf autoheader autom4te automake makeinfo 58e2463426Smrg bison yacc flex lex help2man 5902be438aSmrg 60e2463426SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61e2463426Smrg'g' are ignored when checking the name. 6261dc2d86Smrg 6302be438aSmrgSend bug reports to <bug-automake@gnu.org>." 6402be438aSmrg exit $? 6502be438aSmrg ;; 6602be438aSmrg 6702be438aSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 6802be438aSmrg echo "missing $scriptversion (GNU Automake)" 6902be438aSmrg exit $? 7002be438aSmrg ;; 7102be438aSmrg 7202be438aSmrg -*) 73e2463426Smrg echo 1>&2 "$0: unknown '$1' option" 74e2463426Smrg echo 1>&2 "Try '$0 --help' for more information" 7502be438aSmrg exit 1 7602be438aSmrg ;; 7702be438aSmrg 7802be438aSmrgesac 7902be438aSmrg 80e2463426Smrg# Run the given program, remember its exit status. 81e2463426Smrg"$@"; st=$? 82e2463426Smrg 83e2463426Smrg# If it succeeded, we are done. 84e2463426Smrgtest $st -eq 0 && exit 0 85e2463426Smrg 86e2463426Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87e2463426Smrg# passed; such an option is passed most likely to detect whether the 88e2463426Smrg# program is present and works. 89e2463426Smrgcase $2 in --version|--help) exit $st;; esac 90e2463426Smrg 91e2463426Smrg# Exit code 63 means version mismatch. This often happens when the user 92e2463426Smrg# tries to use an ancient version of a tool on a file that requires a 93e2463426Smrg# minimum version. 94e2463426Smrgif test $st -eq 63; then 95e2463426Smrg msg="probably too old" 96e2463426Smrgelif test $st -eq 127; then 97e2463426Smrg # Program was missing. 98e2463426Smrg msg="missing on your system" 99e2463426Smrgelse 100e2463426Smrg # Program was found and executed, but failed. Give up. 101e2463426Smrg exit $st 102e2463426Smrgfi 10302be438aSmrg 104e2463426Smrgperl_URL=http://www.perl.org/ 105e2463426Smrgflex_URL=http://flex.sourceforge.net/ 106e2463426Smrggnu_software_URL=http://www.gnu.org/software 107e2463426Smrg 108e2463426Smrgprogram_details () 109e2463426Smrg{ 110e2463426Smrg case $1 in 111e2463426Smrg aclocal|automake) 112e2463426Smrg echo "The '$1' program is part of the GNU Automake package:" 113e2463426Smrg echo "<$gnu_software_URL/automake>" 114e2463426Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115e2463426Smrg echo "<$gnu_software_URL/autoconf>" 116e2463426Smrg echo "<$gnu_software_URL/m4/>" 117e2463426Smrg echo "<$perl_URL>" 118e2463426Smrg ;; 119e2463426Smrg autoconf|autom4te|autoheader) 120e2463426Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121e2463426Smrg echo "<$gnu_software_URL/autoconf/>" 122e2463426Smrg echo "It also requires GNU m4 and Perl in order to run:" 123e2463426Smrg echo "<$gnu_software_URL/m4/>" 124e2463426Smrg echo "<$perl_URL>" 125e2463426Smrg ;; 126e2463426Smrg esac 127e2463426Smrg} 128e2463426Smrg 129e2463426Smrggive_advice () 130e2463426Smrg{ 131e2463426Smrg # Normalize program name to check for. 132e2463426Smrg normalized_program=`echo "$1" | sed ' 133e2463426Smrg s/^gnu-//; t 134e2463426Smrg s/^gnu//; t 135e2463426Smrg s/^g//; t'` 136e2463426Smrg 137e2463426Smrg printf '%s\n' "'$1' is $msg." 138e2463426Smrg 139e2463426Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140e2463426Smrg case $normalized_program in 141e2463426Smrg autoconf*) 142e2463426Smrg echo "You should only need it if you modified 'configure.ac'," 143e2463426Smrg echo "or m4 files included by it." 144e2463426Smrg program_details 'autoconf' 145e2463426Smrg ;; 146e2463426Smrg autoheader*) 147e2463426Smrg echo "You should only need it if you modified 'acconfig.h' or" 148e2463426Smrg echo "$configure_deps." 149e2463426Smrg program_details 'autoheader' 150e2463426Smrg ;; 151e2463426Smrg automake*) 152e2463426Smrg echo "You should only need it if you modified 'Makefile.am' or" 153e2463426Smrg echo "$configure_deps." 154e2463426Smrg program_details 'automake' 155e2463426Smrg ;; 156e2463426Smrg aclocal*) 157e2463426Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158e2463426Smrg echo "$configure_deps." 159e2463426Smrg program_details 'aclocal' 160e2463426Smrg ;; 161e2463426Smrg autom4te*) 162e2463426Smrg echo "You might have modified some maintainer files that require" 163adb5514aSmrg echo "the 'autom4te' program to be rebuilt." 164e2463426Smrg program_details 'autom4te' 165e2463426Smrg ;; 166e2463426Smrg bison*|yacc*) 167e2463426Smrg echo "You should only need it if you modified a '.y' file." 168e2463426Smrg echo "You may want to install the GNU Bison package:" 169e2463426Smrg echo "<$gnu_software_URL/bison/>" 170e2463426Smrg ;; 171e2463426Smrg lex*|flex*) 172e2463426Smrg echo "You should only need it if you modified a '.l' file." 173e2463426Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174e2463426Smrg echo "<$flex_URL>" 175e2463426Smrg ;; 176e2463426Smrg help2man*) 177e2463426Smrg echo "You should only need it if you modified a dependency" \ 178e2463426Smrg "of a man page." 179e2463426Smrg echo "You may want to install the GNU Help2man package:" 180e2463426Smrg echo "<$gnu_software_URL/help2man/>" 18102be438aSmrg ;; 182e2463426Smrg makeinfo*) 183e2463426Smrg echo "You should only need it if you modified a '.texi' file, or" 184e2463426Smrg echo "any other file indirectly affecting the aspect of the manual." 185e2463426Smrg echo "You might want to install the Texinfo package:" 186e2463426Smrg echo "<$gnu_software_URL/texinfo/>" 187e2463426Smrg echo "The spurious makeinfo call might also be the consequence of" 188e2463426Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189e2463426Smrg echo "want to install GNU make:" 190e2463426Smrg echo "<$gnu_software_URL/make/>" 191e2463426Smrg ;; 192e2463426Smrg *) 193e2463426Smrg echo "You might have modified some files without having the proper" 194e2463426Smrg echo "tools for further handling them. Check the 'README' file, it" 195e2463426Smrg echo "often tells you about the needed prerequisites for installing" 196e2463426Smrg echo "this package. You may also peek at any GNU archive site, in" 197e2463426Smrg echo "case some other package contains this missing '$1' program." 198e2463426Smrg ;; 199e2463426Smrg esac 200e2463426Smrg} 201e2463426Smrg 202e2463426Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203e2463426Smrg -e '2,$s/^/ /' >&2 204e2463426Smrg 205e2463426Smrg# Propagate the correct exit status (expected to be 127 for a program 206e2463426Smrg# not found, 63 for a program that failed due to version mismatch). 207e2463426Smrgexit $st 20802be438aSmrg 20902be438aSmrg# Local variables: 21002be438aSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 21102be438aSmrg# time-stamp-start: "scriptversion=" 21202be438aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21361dc2d86Smrg# time-stamp-time-zone: "UTC" 21461dc2d86Smrg# time-stamp-end: "; # UTC" 21502be438aSmrg# End: 216