12a6b7db3Sskrll#! /bin/sh 2*9573673dSchristos# Common wrapper for a few potentially missing GNU programs. 32a6b7db3Sskrll 4*9573673dSchristosscriptversion=2013-10-28.13; # UTC 52a6b7db3Sskrll 6*9573673dSchristos# Copyright (C) 1996-2014 Free Software Foundation, Inc. 7*9573673dSchristos# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 82a6b7db3Sskrll 92a6b7db3Sskrll# This program is free software; you can redistribute it and/or modify 102a6b7db3Sskrll# it under the terms of the GNU General Public License as published by 112a6b7db3Sskrll# the Free Software Foundation; either version 2, or (at your option) 122a6b7db3Sskrll# any later version. 132a6b7db3Sskrll 142a6b7db3Sskrll# This program is distributed in the hope that it will be useful, 152a6b7db3Sskrll# but WITHOUT ANY WARRANTY; without even the implied warranty of 162a6b7db3Sskrll# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 172a6b7db3Sskrll# GNU General Public License for more details. 182a6b7db3Sskrll 192a6b7db3Sskrll# You should have received a copy of the GNU General Public License 20be9ac0eaSchristos# along with this program. If not, see <http://www.gnu.org/licenses/>. 212a6b7db3Sskrll 222a6b7db3Sskrll# As a special exception to the GNU General Public License, if you 232a6b7db3Sskrll# distribute this file as part of a program that contains a 242a6b7db3Sskrll# configuration script generated by Autoconf, you may include it under 252a6b7db3Sskrll# the same distribution terms that you use for the rest of that program. 262a6b7db3Sskrll 272a6b7db3Sskrllif test $# -eq 0; then 28*9573673dSchristos echo 1>&2 "Try '$0 --help' for more information" 292a6b7db3Sskrll exit 1 302a6b7db3Sskrllfi 312a6b7db3Sskrll 32be9ac0eaSchristoscase $1 in 33*9573673dSchristos 34*9573673dSchristos --is-lightweight) 35*9573673dSchristos # Used by our autoconf macros to check whether the available missing 36*9573673dSchristos # script is modern enough. 37*9573673dSchristos exit 0 38*9573673dSchristos ;; 39*9573673dSchristos 402a6b7db3Sskrll --run) 41*9573673dSchristos # Back-compat with the calling convention used by older automake. 422a6b7db3Sskrll shift 432a6b7db3Sskrll ;; 442a6b7db3Sskrll 452a6b7db3Sskrll -h|--h|--he|--hel|--help) 462a6b7db3Sskrll echo "\ 472a6b7db3Sskrll$0 [OPTION]... PROGRAM [ARGUMENT]... 482a6b7db3Sskrll 49*9573673dSchristosRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50*9573673dSchristosto PROGRAM being missing or too old. 512a6b7db3Sskrll 522a6b7db3SskrllOptions: 532a6b7db3Sskrll -h, --help display this help and exit 542a6b7db3Sskrll -v, --version output version information and exit 552a6b7db3Sskrll 562a6b7db3SskrllSupported PROGRAM values: 57*9573673dSchristos aclocal autoconf autoheader autom4te automake makeinfo 58*9573673dSchristos bison yacc flex lex help2man 592a6b7db3Sskrll 60*9573673dSchristosVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61*9573673dSchristos'g' are ignored when checking the name. 62be9ac0eaSchristos 632a6b7db3SskrllSend bug reports to <bug-automake@gnu.org>." 642a6b7db3Sskrll exit $? 652a6b7db3Sskrll ;; 662a6b7db3Sskrll 672a6b7db3Sskrll -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 682a6b7db3Sskrll echo "missing $scriptversion (GNU Automake)" 692a6b7db3Sskrll exit $? 702a6b7db3Sskrll ;; 712a6b7db3Sskrll 722a6b7db3Sskrll -*) 73*9573673dSchristos echo 1>&2 "$0: unknown '$1' option" 74*9573673dSchristos echo 1>&2 "Try '$0 --help' for more information" 752a6b7db3Sskrll exit 1 762a6b7db3Sskrll ;; 772a6b7db3Sskrll 782a6b7db3Sskrllesac 792a6b7db3Sskrll 80*9573673dSchristos# Run the given program, remember its exit status. 81*9573673dSchristos"$@"; st=$? 82*9573673dSchristos 83*9573673dSchristos# If it succeeded, we are done. 84*9573673dSchristostest $st -eq 0 && exit 0 85*9573673dSchristos 86*9573673dSchristos# Also exit now if we it failed (or wasn't found), and '--version' was 87*9573673dSchristos# passed; such an option is passed most likely to detect whether the 88*9573673dSchristos# program is present and works. 89*9573673dSchristoscase $2 in --version|--help) exit $st;; esac 90*9573673dSchristos 91*9573673dSchristos# Exit code 63 means version mismatch. This often happens when the user 92*9573673dSchristos# tries to use an ancient version of a tool on a file that requires a 93*9573673dSchristos# minimum version. 94*9573673dSchristosif test $st -eq 63; then 95*9573673dSchristos msg="probably too old" 96*9573673dSchristoselif test $st -eq 127; then 97*9573673dSchristos # Program was missing. 98*9573673dSchristos msg="missing on your system" 99*9573673dSchristoselse 100*9573673dSchristos # Program was found and executed, but failed. Give up. 101*9573673dSchristos exit $st 102*9573673dSchristosfi 103*9573673dSchristos 104*9573673dSchristosperl_URL=http://www.perl.org/ 105*9573673dSchristosflex_URL=http://flex.sourceforge.net/ 106*9573673dSchristosgnu_software_URL=http://www.gnu.org/software 107*9573673dSchristos 108*9573673dSchristosprogram_details () 109*9573673dSchristos{ 110*9573673dSchristos case $1 in 111*9573673dSchristos aclocal|automake) 112*9573673dSchristos echo "The '$1' program is part of the GNU Automake package:" 113*9573673dSchristos echo "<$gnu_software_URL/automake>" 114*9573673dSchristos echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115*9573673dSchristos echo "<$gnu_software_URL/autoconf>" 116*9573673dSchristos echo "<$gnu_software_URL/m4/>" 117*9573673dSchristos echo "<$perl_URL>" 118*9573673dSchristos ;; 119*9573673dSchristos autoconf|autom4te|autoheader) 120*9573673dSchristos echo "The '$1' program is part of the GNU Autoconf package:" 121*9573673dSchristos echo "<$gnu_software_URL/autoconf/>" 122*9573673dSchristos echo "It also requires GNU m4 and Perl in order to run:" 123*9573673dSchristos echo "<$gnu_software_URL/m4/>" 124*9573673dSchristos echo "<$perl_URL>" 125*9573673dSchristos ;; 126*9573673dSchristos esac 127*9573673dSchristos} 128*9573673dSchristos 129*9573673dSchristosgive_advice () 130*9573673dSchristos{ 131*9573673dSchristos # Normalize program name to check for. 132*9573673dSchristos normalized_program=`echo "$1" | sed ' 133be9ac0eaSchristos s/^gnu-//; t 134be9ac0eaSchristos s/^gnu//; t 135be9ac0eaSchristos s/^g//; t'` 136be9ac0eaSchristos 137*9573673dSchristos printf '%s\n' "'$1' is $msg." 1382a6b7db3Sskrll 139*9573673dSchristos configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140*9573673dSchristos case $normalized_program in 141be9ac0eaSchristos autoconf*) 142*9573673dSchristos echo "You should only need it if you modified 'configure.ac'," 143*9573673dSchristos echo "or m4 files included by it." 144*9573673dSchristos program_details 'autoconf' 1452a6b7db3Sskrll ;; 146be9ac0eaSchristos autoheader*) 147*9573673dSchristos echo "You should only need it if you modified 'acconfig.h' or" 148*9573673dSchristos echo "$configure_deps." 149*9573673dSchristos program_details 'autoheader' 1502a6b7db3Sskrll ;; 1512a6b7db3Sskrll automake*) 152*9573673dSchristos echo "You should only need it if you modified 'Makefile.am' or" 153*9573673dSchristos echo "$configure_deps." 154*9573673dSchristos program_details 'automake' 1552a6b7db3Sskrll ;; 156*9573673dSchristos aclocal*) 157*9573673dSchristos echo "You should only need it if you modified 'acinclude.m4' or" 158*9573673dSchristos echo "$configure_deps." 159*9573673dSchristos program_details 'aclocal' 160*9573673dSchristos ;; 161be9ac0eaSchristos autom4te*) 162*9573673dSchristos echo "You might have modified some maintainer files that require" 163*9573673dSchristos echo "the 'autom4te' program to be rebuilt." 164*9573673dSchristos program_details 'autom4te' 1652a6b7db3Sskrll ;; 166be9ac0eaSchristos bison*|yacc*) 167*9573673dSchristos echo "You should only need it if you modified a '.y' file." 168*9573673dSchristos echo "You may want to install the GNU Bison package:" 169*9573673dSchristos echo "<$gnu_software_URL/bison/>" 1702a6b7db3Sskrll ;; 171be9ac0eaSchristos lex*|flex*) 172*9573673dSchristos echo "You should only need it if you modified a '.l' file." 173*9573673dSchristos echo "You may want to install the Fast Lexical Analyzer package:" 174*9573673dSchristos echo "<$flex_URL>" 1752a6b7db3Sskrll ;; 176be9ac0eaSchristos help2man*) 177*9573673dSchristos echo "You should only need it if you modified a dependency" \ 178*9573673dSchristos "of a man page." 179*9573673dSchristos echo "You may want to install the GNU Help2man package:" 180*9573673dSchristos echo "<$gnu_software_URL/help2man/>" 1812a6b7db3Sskrll ;; 182be9ac0eaSchristos makeinfo*) 183*9573673dSchristos echo "You should only need it if you modified a '.texi' file, or" 184*9573673dSchristos echo "any other file indirectly affecting the aspect of the manual." 185*9573673dSchristos echo "You might want to install the Texinfo package:" 186*9573673dSchristos echo "<$gnu_software_URL/texinfo/>" 187*9573673dSchristos echo "The spurious makeinfo call might also be the consequence of" 188*9573673dSchristos echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189*9573673dSchristos echo "want to install GNU make:" 190*9573673dSchristos echo "<$gnu_software_URL/make/>" 1912a6b7db3Sskrll ;; 1922a6b7db3Sskrll *) 193*9573673dSchristos echo "You might have modified some files without having the proper" 194*9573673dSchristos echo "tools for further handling them. Check the 'README' file, it" 195*9573673dSchristos echo "often tells you about the needed prerequisites for installing" 196*9573673dSchristos echo "this package. You may also peek at any GNU archive site, in" 197*9573673dSchristos echo "case some other package contains this missing '$1' program." 1982a6b7db3Sskrll ;; 1992a6b7db3Sskrll esac 200*9573673dSchristos} 2012a6b7db3Sskrll 202*9573673dSchristosgive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203*9573673dSchristos -e '2,$s/^/ /' >&2 204*9573673dSchristos 205*9573673dSchristos# Propagate the correct exit status (expected to be 127 for a program 206*9573673dSchristos# not found, 63 for a program that failed due to version mismatch). 207*9573673dSchristosexit $st 2082a6b7db3Sskrll 2092a6b7db3Sskrll# Local variables: 2102a6b7db3Sskrll# eval: (add-hook 'write-file-hooks 'time-stamp) 2112a6b7db3Sskrll# time-stamp-start: "scriptversion=" 2122a6b7db3Sskrll# time-stamp-format: "%:y-%02m-%02d.%02H" 213be9ac0eaSchristos# time-stamp-time-zone: "UTC" 214be9ac0eaSchristos# time-stamp-end: "; # UTC" 2152a6b7db3Sskrll# End: 216