missing revision 313a12fd
127702724Smrg#! /bin/sh 2313a12fdSmrg# Common wrapper for a few potentially missing GNU programs. 327702724Smrg 4313a12fdSmrgscriptversion=2012-06-26.16; # UTC 527702724Smrg 6313a12fdSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 7313a12fdSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 827702724Smrg 927702724Smrg# This program is free software; you can redistribute it and/or modify 1027702724Smrg# it under the terms of the GNU General Public License as published by 1127702724Smrg# the Free Software Foundation; either version 2, or (at your option) 1227702724Smrg# any later version. 1327702724Smrg 1427702724Smrg# This program is distributed in the hope that it will be useful, 1527702724Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1627702724Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1727702724Smrg# GNU General Public License for more details. 1827702724Smrg 1927702724Smrg# You should have received a copy of the GNU General Public License 2000084f2cSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 2127702724Smrg 2227702724Smrg# As a special exception to the GNU General Public License, if you 2327702724Smrg# distribute this file as part of a program that contains a 2427702724Smrg# configuration script generated by Autoconf, you may include it under 2527702724Smrg# the same distribution terms that you use for the rest of that program. 2627702724Smrg 2727702724Smrgif test $# -eq 0; then 28313a12fdSmrg echo 1>&2 "Try '$0 --help' for more information" 2927702724Smrg exit 1 3027702724Smrgfi 3127702724Smrg 32313a12fdSmrgcase $1 in 3327702724Smrg 34313a12fdSmrg --is-lightweight) 35313a12fdSmrg # Used by our autoconf macros to check whether the available missing 36313a12fdSmrg # script is modern enough. 37313a12fdSmrg exit 0 38313a12fdSmrg ;; 3927702724Smrg 40313a12fdSmrg --run) 41313a12fdSmrg # Back-compat with the calling convention used by older automake. 42313a12fdSmrg shift 43313a12fdSmrg ;; 4427702724Smrg 4527702724Smrg -h|--h|--he|--hel|--help) 4627702724Smrg echo "\ 4727702724Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4827702724Smrg 49313a12fdSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50313a12fdSmrgto PROGRAM being missing or too old. 5127702724Smrg 5227702724SmrgOptions: 5327702724Smrg -h, --help display this help and exit 5427702724Smrg -v, --version output version information and exit 5527702724Smrg 5627702724SmrgSupported PROGRAM values: 57313a12fdSmrg aclocal autoconf autoheader autom4te automake makeinfo 58313a12fdSmrg bison yacc flex lex help2man 5927702724Smrg 60313a12fdSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61313a12fdSmrg'g' are ignored when checking the name. 6200084f2cSmrg 6327702724SmrgSend bug reports to <bug-automake@gnu.org>." 6427702724Smrg exit $? 6527702724Smrg ;; 6627702724Smrg 6727702724Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 6827702724Smrg echo "missing $scriptversion (GNU Automake)" 6927702724Smrg exit $? 7027702724Smrg ;; 7127702724Smrg 7227702724Smrg -*) 73313a12fdSmrg echo 1>&2 "$0: unknown '$1' option" 74313a12fdSmrg echo 1>&2 "Try '$0 --help' for more information" 7527702724Smrg exit 1 7627702724Smrg ;; 7727702724Smrg 7827702724Smrgesac 7927702724Smrg 80313a12fdSmrg# Run the given program, remember its exit status. 81313a12fdSmrg"$@"; st=$? 82313a12fdSmrg 83313a12fdSmrg# If it succeeded, we are done. 84313a12fdSmrgtest $st -eq 0 && exit 0 85313a12fdSmrg 86313a12fdSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 87313a12fdSmrg# passed; such an option is passed most likely to detect whether the 88313a12fdSmrg# program is present and works. 89313a12fdSmrgcase $2 in --version|--help) exit $st;; esac 90313a12fdSmrg 91313a12fdSmrg# Exit code 63 means version mismatch. This often happens when the user 92313a12fdSmrg# tries to use an ancient version of a tool on a file that requires a 93313a12fdSmrg# minimum version. 94313a12fdSmrgif test $st -eq 63; then 95313a12fdSmrg msg="probably too old" 96313a12fdSmrgelif test $st -eq 127; then 97313a12fdSmrg # Program was missing. 98313a12fdSmrg msg="missing on your system" 99313a12fdSmrgelse 100313a12fdSmrg # Program was found and executed, but failed. Give up. 101313a12fdSmrg exit $st 102313a12fdSmrgfi 10327702724Smrg 104313a12fdSmrgperl_URL=http://www.perl.org/ 105313a12fdSmrgflex_URL=http://flex.sourceforge.net/ 106313a12fdSmrggnu_software_URL=http://www.gnu.org/software 107313a12fdSmrg 108313a12fdSmrgprogram_details () 109313a12fdSmrg{ 110313a12fdSmrg case $1 in 111313a12fdSmrg aclocal|automake) 112313a12fdSmrg echo "The '$1' program is part of the GNU Automake package:" 113313a12fdSmrg echo "<$gnu_software_URL/automake>" 114313a12fdSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115313a12fdSmrg echo "<$gnu_software_URL/autoconf>" 116313a12fdSmrg echo "<$gnu_software_URL/m4/>" 117313a12fdSmrg echo "<$perl_URL>" 118313a12fdSmrg ;; 119313a12fdSmrg autoconf|autom4te|autoheader) 120313a12fdSmrg echo "The '$1' program is part of the GNU Autoconf package:" 121313a12fdSmrg echo "<$gnu_software_URL/autoconf/>" 122313a12fdSmrg echo "It also requires GNU m4 and Perl in order to run:" 123313a12fdSmrg echo "<$gnu_software_URL/m4/>" 124313a12fdSmrg echo "<$perl_URL>" 125313a12fdSmrg ;; 126313a12fdSmrg esac 127313a12fdSmrg} 128313a12fdSmrg 129313a12fdSmrggive_advice () 130313a12fdSmrg{ 131313a12fdSmrg # Normalize program name to check for. 132313a12fdSmrg normalized_program=`echo "$1" | sed ' 133313a12fdSmrg s/^gnu-//; t 134313a12fdSmrg s/^gnu//; t 135313a12fdSmrg s/^g//; t'` 136313a12fdSmrg 137313a12fdSmrg printf '%s\n' "'$1' is $msg." 138313a12fdSmrg 139313a12fdSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140313a12fdSmrg case $normalized_program in 141313a12fdSmrg autoconf*) 142313a12fdSmrg echo "You should only need it if you modified 'configure.ac'," 143313a12fdSmrg echo "or m4 files included by it." 144313a12fdSmrg program_details 'autoconf' 145313a12fdSmrg ;; 146313a12fdSmrg autoheader*) 147313a12fdSmrg echo "You should only need it if you modified 'acconfig.h' or" 148313a12fdSmrg echo "$configure_deps." 149313a12fdSmrg program_details 'autoheader' 150313a12fdSmrg ;; 151313a12fdSmrg automake*) 152313a12fdSmrg echo "You should only need it if you modified 'Makefile.am' or" 153313a12fdSmrg echo "$configure_deps." 154313a12fdSmrg program_details 'automake' 155313a12fdSmrg ;; 156313a12fdSmrg aclocal*) 157313a12fdSmrg echo "You should only need it if you modified 'acinclude.m4' or" 158313a12fdSmrg echo "$configure_deps." 159313a12fdSmrg program_details 'aclocal' 160313a12fdSmrg ;; 161313a12fdSmrg autom4te*) 162313a12fdSmrg echo "You might have modified some maintainer files that require" 163313a12fdSmrg echo "the 'automa4te' program to be rebuilt." 164313a12fdSmrg program_details 'autom4te' 165313a12fdSmrg ;; 166313a12fdSmrg bison*|yacc*) 167313a12fdSmrg echo "You should only need it if you modified a '.y' file." 168313a12fdSmrg echo "You may want to install the GNU Bison package:" 169313a12fdSmrg echo "<$gnu_software_URL/bison/>" 170313a12fdSmrg ;; 171313a12fdSmrg lex*|flex*) 172313a12fdSmrg echo "You should only need it if you modified a '.l' file." 173313a12fdSmrg echo "You may want to install the Fast Lexical Analyzer package:" 174313a12fdSmrg echo "<$flex_URL>" 175313a12fdSmrg ;; 176313a12fdSmrg help2man*) 177313a12fdSmrg echo "You should only need it if you modified a dependency" \ 178313a12fdSmrg "of a man page." 179313a12fdSmrg echo "You may want to install the GNU Help2man package:" 180313a12fdSmrg echo "<$gnu_software_URL/help2man/>" 181313a12fdSmrg ;; 182313a12fdSmrg makeinfo*) 183313a12fdSmrg echo "You should only need it if you modified a '.texi' file, or" 184313a12fdSmrg echo "any other file indirectly affecting the aspect of the manual." 185313a12fdSmrg echo "You might want to install the Texinfo package:" 186313a12fdSmrg echo "<$gnu_software_URL/texinfo/>" 187313a12fdSmrg echo "The spurious makeinfo call might also be the consequence of" 188313a12fdSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189313a12fdSmrg echo "want to install GNU make:" 190313a12fdSmrg echo "<$gnu_software_URL/make/>" 191313a12fdSmrg ;; 192313a12fdSmrg *) 193313a12fdSmrg echo "You might have modified some files without having the proper" 194313a12fdSmrg echo "tools for further handling them. Check the 'README' file, it" 195313a12fdSmrg echo "often tells you about the needed prerequisites for installing" 196313a12fdSmrg echo "this package. You may also peek at any GNU archive site, in" 197313a12fdSmrg echo "case some other package contains this missing '$1' program." 198313a12fdSmrg ;; 199313a12fdSmrg esac 200313a12fdSmrg} 201313a12fdSmrg 202313a12fdSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203313a12fdSmrg -e '2,$s/^/ /' >&2 204313a12fdSmrg 205313a12fdSmrg# Propagate the correct exit status (expected to be 127 for a program 206313a12fdSmrg# not found, 63 for a program that failed due to version mismatch). 207313a12fdSmrgexit $st 20827702724Smrg 20927702724Smrg# Local variables: 21027702724Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 21127702724Smrg# time-stamp-start: "scriptversion=" 21227702724Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21300084f2cSmrg# time-stamp-time-zone: "UTC" 21400084f2cSmrg# time-stamp-end: "; # UTC" 21527702724Smrg# End: 216