missing revision b0c24a08
16ea72052Smrg#! /bin/sh 2b0c24a08Smrg# Common wrapper for a few potentially missing GNU programs. 3168023feSmrg 4b0c24a08Smrgscriptversion=2013-10-28.13; # UTC 5168023feSmrg 6b0c24a08Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 7b0c24a08Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 86ea72052Smrg 96ea72052Smrg# This program is free software; you can redistribute it and/or modify 106ea72052Smrg# it under the terms of the GNU General Public License as published by 116ea72052Smrg# the Free Software Foundation; either version 2, or (at your option) 126ea72052Smrg# any later version. 136ea72052Smrg 146ea72052Smrg# This program is distributed in the hope that it will be useful, 156ea72052Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 166ea72052Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 176ea72052Smrg# GNU General Public License for more details. 186ea72052Smrg 196ea72052Smrg# You should have received a copy of the GNU General Public License 20168023feSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 216ea72052Smrg 226ea72052Smrg# As a special exception to the GNU General Public License, if you 236ea72052Smrg# distribute this file as part of a program that contains a 246ea72052Smrg# configuration script generated by Autoconf, you may include it under 256ea72052Smrg# the same distribution terms that you use for the rest of that program. 266ea72052Smrg 276ea72052Smrgif test $# -eq 0; then 28b0c24a08Smrg echo 1>&2 "Try '$0 --help' for more information" 296ea72052Smrg exit 1 306ea72052Smrgfi 316ea72052Smrg 32b0c24a08Smrgcase $1 in 336ea72052Smrg 34b0c24a08Smrg --is-lightweight) 35b0c24a08Smrg # Used by our autoconf macros to check whether the available missing 36b0c24a08Smrg # script is modern enough. 37b0c24a08Smrg exit 0 38b0c24a08Smrg ;; 39168023feSmrg 40b0c24a08Smrg --run) 41b0c24a08Smrg # Back-compat with the calling convention used by older automake. 42b0c24a08Smrg shift 43b0c24a08Smrg ;; 446ea72052Smrg 456ea72052Smrg -h|--h|--he|--hel|--help) 466ea72052Smrg echo "\ 476ea72052Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 486ea72052Smrg 49b0c24a08SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50b0c24a08Smrgto PROGRAM being missing or too old. 516ea72052Smrg 526ea72052SmrgOptions: 536ea72052Smrg -h, --help display this help and exit 546ea72052Smrg -v, --version output version information and exit 556ea72052Smrg 566ea72052SmrgSupported PROGRAM values: 57b0c24a08Smrg aclocal autoconf autoheader autom4te automake makeinfo 58b0c24a08Smrg bison yacc flex lex help2man 59168023feSmrg 60b0c24a08SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61b0c24a08Smrg'g' are ignored when checking the name. 62168023feSmrg 63168023feSmrgSend bug reports to <bug-automake@gnu.org>." 64168023feSmrg exit $? 656ea72052Smrg ;; 666ea72052Smrg 676ea72052Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68168023feSmrg echo "missing $scriptversion (GNU Automake)" 69168023feSmrg exit $? 706ea72052Smrg ;; 716ea72052Smrg 726ea72052Smrg -*) 73b0c24a08Smrg echo 1>&2 "$0: unknown '$1' option" 74b0c24a08Smrg echo 1>&2 "Try '$0 --help' for more information" 756ea72052Smrg exit 1 766ea72052Smrg ;; 776ea72052Smrg 78168023feSmrgesac 79168023feSmrg 80b0c24a08Smrg# Run the given program, remember its exit status. 81b0c24a08Smrg"$@"; st=$? 82b0c24a08Smrg 83b0c24a08Smrg# If it succeeded, we are done. 84b0c24a08Smrgtest $st -eq 0 && exit 0 85b0c24a08Smrg 86b0c24a08Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87b0c24a08Smrg# passed; such an option is passed most likely to detect whether the 88b0c24a08Smrg# program is present and works. 89b0c24a08Smrgcase $2 in --version|--help) exit $st;; esac 90b0c24a08Smrg 91b0c24a08Smrg# Exit code 63 means version mismatch. This often happens when the user 92b0c24a08Smrg# tries to use an ancient version of a tool on a file that requires a 93b0c24a08Smrg# minimum version. 94b0c24a08Smrgif test $st -eq 63; then 95b0c24a08Smrg msg="probably too old" 96b0c24a08Smrgelif test $st -eq 127; then 97b0c24a08Smrg # Program was missing. 98b0c24a08Smrg msg="missing on your system" 99b0c24a08Smrgelse 100b0c24a08Smrg # Program was found and executed, but failed. Give up. 101b0c24a08Smrg exit $st 102b0c24a08Smrgfi 1036ea72052Smrg 104b0c24a08Smrgperl_URL=http://www.perl.org/ 105b0c24a08Smrgflex_URL=http://flex.sourceforge.net/ 106b0c24a08Smrggnu_software_URL=http://www.gnu.org/software 107b0c24a08Smrg 108b0c24a08Smrgprogram_details () 109b0c24a08Smrg{ 110b0c24a08Smrg case $1 in 111b0c24a08Smrg aclocal|automake) 112b0c24a08Smrg echo "The '$1' program is part of the GNU Automake package:" 113b0c24a08Smrg echo "<$gnu_software_URL/automake>" 114b0c24a08Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115b0c24a08Smrg echo "<$gnu_software_URL/autoconf>" 116b0c24a08Smrg echo "<$gnu_software_URL/m4/>" 117b0c24a08Smrg echo "<$perl_URL>" 118b0c24a08Smrg ;; 119b0c24a08Smrg autoconf|autom4te|autoheader) 120b0c24a08Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121b0c24a08Smrg echo "<$gnu_software_URL/autoconf/>" 122b0c24a08Smrg echo "It also requires GNU m4 and Perl in order to run:" 123b0c24a08Smrg echo "<$gnu_software_URL/m4/>" 124b0c24a08Smrg echo "<$perl_URL>" 125b0c24a08Smrg ;; 126b0c24a08Smrg esac 127b0c24a08Smrg} 128b0c24a08Smrg 129b0c24a08Smrggive_advice () 130b0c24a08Smrg{ 131b0c24a08Smrg # Normalize program name to check for. 132b0c24a08Smrg normalized_program=`echo "$1" | sed ' 133b0c24a08Smrg s/^gnu-//; t 134b0c24a08Smrg s/^gnu//; t 135b0c24a08Smrg s/^g//; t'` 136b0c24a08Smrg 137b0c24a08Smrg printf '%s\n' "'$1' is $msg." 138b0c24a08Smrg 139b0c24a08Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140b0c24a08Smrg case $normalized_program in 141b0c24a08Smrg autoconf*) 142b0c24a08Smrg echo "You should only need it if you modified 'configure.ac'," 143b0c24a08Smrg echo "or m4 files included by it." 144b0c24a08Smrg program_details 'autoconf' 145b0c24a08Smrg ;; 146b0c24a08Smrg autoheader*) 147b0c24a08Smrg echo "You should only need it if you modified 'acconfig.h' or" 148b0c24a08Smrg echo "$configure_deps." 149b0c24a08Smrg program_details 'autoheader' 150b0c24a08Smrg ;; 151b0c24a08Smrg automake*) 152b0c24a08Smrg echo "You should only need it if you modified 'Makefile.am' or" 153b0c24a08Smrg echo "$configure_deps." 154b0c24a08Smrg program_details 'automake' 155b0c24a08Smrg ;; 156b0c24a08Smrg aclocal*) 157b0c24a08Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158b0c24a08Smrg echo "$configure_deps." 159b0c24a08Smrg program_details 'aclocal' 160b0c24a08Smrg ;; 161b0c24a08Smrg autom4te*) 162b0c24a08Smrg echo "You might have modified some maintainer files that require" 163b0c24a08Smrg echo "the 'autom4te' program to be rebuilt." 164b0c24a08Smrg program_details 'autom4te' 165b0c24a08Smrg ;; 166b0c24a08Smrg bison*|yacc*) 167b0c24a08Smrg echo "You should only need it if you modified a '.y' file." 168b0c24a08Smrg echo "You may want to install the GNU Bison package:" 169b0c24a08Smrg echo "<$gnu_software_URL/bison/>" 170b0c24a08Smrg ;; 171b0c24a08Smrg lex*|flex*) 172b0c24a08Smrg echo "You should only need it if you modified a '.l' file." 173b0c24a08Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174b0c24a08Smrg echo "<$flex_URL>" 175b0c24a08Smrg ;; 176b0c24a08Smrg help2man*) 177b0c24a08Smrg echo "You should only need it if you modified a dependency" \ 178b0c24a08Smrg "of a man page." 179b0c24a08Smrg echo "You may want to install the GNU Help2man package:" 180b0c24a08Smrg echo "<$gnu_software_URL/help2man/>" 181b0c24a08Smrg ;; 182b0c24a08Smrg makeinfo*) 183b0c24a08Smrg echo "You should only need it if you modified a '.texi' file, or" 184b0c24a08Smrg echo "any other file indirectly affecting the aspect of the manual." 185b0c24a08Smrg echo "You might want to install the Texinfo package:" 186b0c24a08Smrg echo "<$gnu_software_URL/texinfo/>" 187b0c24a08Smrg echo "The spurious makeinfo call might also be the consequence of" 188b0c24a08Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189b0c24a08Smrg echo "want to install GNU make:" 190b0c24a08Smrg echo "<$gnu_software_URL/make/>" 191b0c24a08Smrg ;; 192b0c24a08Smrg *) 193b0c24a08Smrg echo "You might have modified some files without having the proper" 194b0c24a08Smrg echo "tools for further handling them. Check the 'README' file, it" 195b0c24a08Smrg echo "often tells you about the needed prerequisites for installing" 196b0c24a08Smrg echo "this package. You may also peek at any GNU archive site, in" 197b0c24a08Smrg echo "case some other package contains this missing '$1' program." 198b0c24a08Smrg ;; 199b0c24a08Smrg esac 200b0c24a08Smrg} 201b0c24a08Smrg 202b0c24a08Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203b0c24a08Smrg -e '2,$s/^/ /' >&2 204b0c24a08Smrg 205b0c24a08Smrg# Propagate the correct exit status (expected to be 127 for a program 206b0c24a08Smrg# not found, 63 for a program that failed due to version mismatch). 207b0c24a08Smrgexit $st 208168023feSmrg 209168023feSmrg# Local variables: 210168023feSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211168023feSmrg# time-stamp-start: "scriptversion=" 212168023feSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213168023feSmrg# time-stamp-time-zone: "UTC" 214168023feSmrg# time-stamp-end: "; # UTC" 215168023feSmrg# End: 216