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