1*30da1778Schristos#! /bin/sh 2*30da1778Schristos# Common wrapper for a few potentially missing GNU programs. 3*30da1778Schristos 4*30da1778Schristosscriptversion=2013-10-28.13; # UTC 5*30da1778Schristos 6*30da1778Schristos# Copyright (C) 1996-2014 Free Software Foundation, Inc. 7*30da1778Schristos# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8*30da1778Schristos 9*30da1778Schristos# This program is free software; you can redistribute it and/or modify 10*30da1778Schristos# it under the terms of the GNU General Public License as published by 11*30da1778Schristos# the Free Software Foundation; either version 2, or (at your option) 12*30da1778Schristos# any later version. 13*30da1778Schristos 14*30da1778Schristos# This program is distributed in the hope that it will be useful, 15*30da1778Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of 16*30da1778Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17*30da1778Schristos# GNU General Public License for more details. 18*30da1778Schristos 19*30da1778Schristos# You should have received a copy of the GNU General Public License 20*30da1778Schristos# along with this program. If not, see <http://www.gnu.org/licenses/>. 21*30da1778Schristos 22*30da1778Schristos# As a special exception to the GNU General Public License, if you 23*30da1778Schristos# distribute this file as part of a program that contains a 24*30da1778Schristos# configuration script generated by Autoconf, you may include it under 25*30da1778Schristos# the same distribution terms that you use for the rest of that program. 26*30da1778Schristos 27*30da1778Schristosif test $# -eq 0; then 28*30da1778Schristos echo 1>&2 "Try '$0 --help' for more information" 29*30da1778Schristos exit 1 30*30da1778Schristosfi 31*30da1778Schristos 32*30da1778Schristoscase $1 in 33*30da1778Schristos 34*30da1778Schristos --is-lightweight) 35*30da1778Schristos # Used by our autoconf macros to check whether the available missing 36*30da1778Schristos # script is modern enough. 37*30da1778Schristos exit 0 38*30da1778Schristos ;; 39*30da1778Schristos 40*30da1778Schristos --run) 41*30da1778Schristos # Back-compat with the calling convention used by older automake. 42*30da1778Schristos shift 43*30da1778Schristos ;; 44*30da1778Schristos 45*30da1778Schristos -h|--h|--he|--hel|--help) 46*30da1778Schristos echo "\ 47*30da1778Schristos$0 [OPTION]... PROGRAM [ARGUMENT]... 48*30da1778Schristos 49*30da1778SchristosRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50*30da1778Schristosto PROGRAM being missing or too old. 51*30da1778Schristos 52*30da1778SchristosOptions: 53*30da1778Schristos -h, --help display this help and exit 54*30da1778Schristos -v, --version output version information and exit 55*30da1778Schristos 56*30da1778SchristosSupported PROGRAM values: 57*30da1778Schristos aclocal autoconf autoheader autom4te automake makeinfo 58*30da1778Schristos bison yacc flex lex help2man 59*30da1778Schristos 60*30da1778SchristosVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61*30da1778Schristos'g' are ignored when checking the name. 62*30da1778Schristos 63*30da1778SchristosSend bug reports to <bug-automake@gnu.org>." 64*30da1778Schristos exit $? 65*30da1778Schristos ;; 66*30da1778Schristos 67*30da1778Schristos -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68*30da1778Schristos echo "missing $scriptversion (GNU Automake)" 69*30da1778Schristos exit $? 70*30da1778Schristos ;; 71*30da1778Schristos 72*30da1778Schristos -*) 73*30da1778Schristos echo 1>&2 "$0: unknown '$1' option" 74*30da1778Schristos echo 1>&2 "Try '$0 --help' for more information" 75*30da1778Schristos exit 1 76*30da1778Schristos ;; 77*30da1778Schristos 78*30da1778Schristosesac 79*30da1778Schristos 80*30da1778Schristos# Run the given program, remember its exit status. 81*30da1778Schristos"$@"; st=$? 82*30da1778Schristos 83*30da1778Schristos# If it succeeded, we are done. 84*30da1778Schristostest $st -eq 0 && exit 0 85*30da1778Schristos 86*30da1778Schristos# Also exit now if we it failed (or wasn't found), and '--version' was 87*30da1778Schristos# passed; such an option is passed most likely to detect whether the 88*30da1778Schristos# program is present and works. 89*30da1778Schristoscase $2 in --version|--help) exit $st;; esac 90*30da1778Schristos 91*30da1778Schristos# Exit code 63 means version mismatch. This often happens when the user 92*30da1778Schristos# tries to use an ancient version of a tool on a file that requires a 93*30da1778Schristos# minimum version. 94*30da1778Schristosif test $st -eq 63; then 95*30da1778Schristos msg="probably too old" 96*30da1778Schristoselif test $st -eq 127; then 97*30da1778Schristos # Program was missing. 98*30da1778Schristos msg="missing on your system" 99*30da1778Schristoselse 100*30da1778Schristos # Program was found and executed, but failed. Give up. 101*30da1778Schristos exit $st 102*30da1778Schristosfi 103*30da1778Schristos 104*30da1778Schristosperl_URL=http://www.perl.org/ 105*30da1778Schristosflex_URL=http://flex.sourceforge.net/ 106*30da1778Schristosgnu_software_URL=http://www.gnu.org/software 107*30da1778Schristos 108*30da1778Schristosprogram_details () 109*30da1778Schristos{ 110*30da1778Schristos case $1 in 111*30da1778Schristos aclocal|automake) 112*30da1778Schristos echo "The '$1' program is part of the GNU Automake package:" 113*30da1778Schristos echo "<$gnu_software_URL/automake>" 114*30da1778Schristos echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115*30da1778Schristos echo "<$gnu_software_URL/autoconf>" 116*30da1778Schristos echo "<$gnu_software_URL/m4/>" 117*30da1778Schristos echo "<$perl_URL>" 118*30da1778Schristos ;; 119*30da1778Schristos autoconf|autom4te|autoheader) 120*30da1778Schristos echo "The '$1' program is part of the GNU Autoconf package:" 121*30da1778Schristos echo "<$gnu_software_URL/autoconf/>" 122*30da1778Schristos echo "It also requires GNU m4 and Perl in order to run:" 123*30da1778Schristos echo "<$gnu_software_URL/m4/>" 124*30da1778Schristos echo "<$perl_URL>" 125*30da1778Schristos ;; 126*30da1778Schristos esac 127*30da1778Schristos} 128*30da1778Schristos 129*30da1778Schristosgive_advice () 130*30da1778Schristos{ 131*30da1778Schristos # Normalize program name to check for. 132*30da1778Schristos normalized_program=`echo "$1" | sed ' 133*30da1778Schristos s/^gnu-//; t 134*30da1778Schristos s/^gnu//; t 135*30da1778Schristos s/^g//; t'` 136*30da1778Schristos 137*30da1778Schristos printf '%s\n' "'$1' is $msg." 138*30da1778Schristos 139*30da1778Schristos configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140*30da1778Schristos case $normalized_program in 141*30da1778Schristos autoconf*) 142*30da1778Schristos echo "You should only need it if you modified 'configure.ac'," 143*30da1778Schristos echo "or m4 files included by it." 144*30da1778Schristos program_details 'autoconf' 145*30da1778Schristos ;; 146*30da1778Schristos autoheader*) 147*30da1778Schristos echo "You should only need it if you modified 'acconfig.h' or" 148*30da1778Schristos echo "$configure_deps." 149*30da1778Schristos program_details 'autoheader' 150*30da1778Schristos ;; 151*30da1778Schristos automake*) 152*30da1778Schristos echo "You should only need it if you modified 'Makefile.am' or" 153*30da1778Schristos echo "$configure_deps." 154*30da1778Schristos program_details 'automake' 155*30da1778Schristos ;; 156*30da1778Schristos aclocal*) 157*30da1778Schristos echo "You should only need it if you modified 'acinclude.m4' or" 158*30da1778Schristos echo "$configure_deps." 159*30da1778Schristos program_details 'aclocal' 160*30da1778Schristos ;; 161*30da1778Schristos autom4te*) 162*30da1778Schristos echo "You might have modified some maintainer files that require" 163*30da1778Schristos echo "the 'autom4te' program to be rebuilt." 164*30da1778Schristos program_details 'autom4te' 165*30da1778Schristos ;; 166*30da1778Schristos bison*|yacc*) 167*30da1778Schristos echo "You should only need it if you modified a '.y' file." 168*30da1778Schristos echo "You may want to install the GNU Bison package:" 169*30da1778Schristos echo "<$gnu_software_URL/bison/>" 170*30da1778Schristos ;; 171*30da1778Schristos lex*|flex*) 172*30da1778Schristos echo "You should only need it if you modified a '.l' file." 173*30da1778Schristos echo "You may want to install the Fast Lexical Analyzer package:" 174*30da1778Schristos echo "<$flex_URL>" 175*30da1778Schristos ;; 176*30da1778Schristos help2man*) 177*30da1778Schristos echo "You should only need it if you modified a dependency" \ 178*30da1778Schristos "of a man page." 179*30da1778Schristos echo "You may want to install the GNU Help2man package:" 180*30da1778Schristos echo "<$gnu_software_URL/help2man/>" 181*30da1778Schristos ;; 182*30da1778Schristos makeinfo*) 183*30da1778Schristos echo "You should only need it if you modified a '.texi' file, or" 184*30da1778Schristos echo "any other file indirectly affecting the aspect of the manual." 185*30da1778Schristos echo "You might want to install the Texinfo package:" 186*30da1778Schristos echo "<$gnu_software_URL/texinfo/>" 187*30da1778Schristos echo "The spurious makeinfo call might also be the consequence of" 188*30da1778Schristos echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189*30da1778Schristos echo "want to install GNU make:" 190*30da1778Schristos echo "<$gnu_software_URL/make/>" 191*30da1778Schristos ;; 192*30da1778Schristos *) 193*30da1778Schristos echo "You might have modified some files without having the proper" 194*30da1778Schristos echo "tools for further handling them. Check the 'README' file, it" 195*30da1778Schristos echo "often tells you about the needed prerequisites for installing" 196*30da1778Schristos echo "this package. You may also peek at any GNU archive site, in" 197*30da1778Schristos echo "case some other package contains this missing '$1' program." 198*30da1778Schristos ;; 199*30da1778Schristos esac 200*30da1778Schristos} 201*30da1778Schristos 202*30da1778Schristosgive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203*30da1778Schristos -e '2,$s/^/ /' >&2 204*30da1778Schristos 205*30da1778Schristos# Propagate the correct exit status (expected to be 127 for a program 206*30da1778Schristos# not found, 63 for a program that failed due to version mismatch). 207*30da1778Schristosexit $st 208*30da1778Schristos 209*30da1778Schristos# Local variables: 210*30da1778Schristos# eval: (add-hook 'write-file-hooks 'time-stamp) 211*30da1778Schristos# time-stamp-start: "scriptversion=" 212*30da1778Schristos# time-stamp-format: "%:y-%02m-%02d.%02H" 213*30da1778Schristos# time-stamp-time-zone: "UTC" 214*30da1778Schristos# time-stamp-end: "; # UTC" 215*30da1778Schristos# End: 216