1876ff6feSmrg#! /bin/sh 2d41660beSmrg# Common wrapper for a few potentially missing GNU programs. 3876ff6feSmrg 4d41660beSmrgscriptversion=2016-01-11.22; # UTC 5876ff6feSmrg 6d41660beSmrg# Copyright (C) 1996-2017 Free Software Foundation, Inc. 7d41660beSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8876ff6feSmrg 9876ff6feSmrg# This program is free software; you can redistribute it and/or modify 10876ff6feSmrg# it under the terms of the GNU General Public License as published by 11876ff6feSmrg# the Free Software Foundation; either version 2, or (at your option) 12876ff6feSmrg# any later version. 13876ff6feSmrg 14876ff6feSmrg# This program is distributed in the hope that it will be useful, 15876ff6feSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16876ff6feSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17876ff6feSmrg# GNU General Public License for more details. 18876ff6feSmrg 19876ff6feSmrg# You should have received a copy of the GNU General Public License 20d41660beSmrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 21876ff6feSmrg 22876ff6feSmrg# As a special exception to the GNU General Public License, if you 23876ff6feSmrg# distribute this file as part of a program that contains a 24876ff6feSmrg# configuration script generated by Autoconf, you may include it under 25876ff6feSmrg# the same distribution terms that you use for the rest of that program. 26876ff6feSmrg 27876ff6feSmrgif test $# -eq 0; then 28d41660beSmrg echo 1>&2 "Try '$0 --help' for more information" 29876ff6feSmrg exit 1 30876ff6feSmrgfi 31876ff6feSmrg 32d41660beSmrgcase $1 in 33876ff6feSmrg 34d41660beSmrg --is-lightweight) 35d41660beSmrg # Used by our autoconf macros to check whether the available missing 36d41660beSmrg # script is modern enough. 37d41660beSmrg exit 0 38d41660beSmrg ;; 39876ff6feSmrg 40d41660beSmrg --run) 41d41660beSmrg # Back-compat with the calling convention used by older automake. 42d41660beSmrg shift 43d41660beSmrg ;; 44876ff6feSmrg 45876ff6feSmrg -h|--h|--he|--hel|--help) 46876ff6feSmrg echo "\ 47876ff6feSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48876ff6feSmrg 49d41660beSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50d41660beSmrgto PROGRAM being missing or too old. 51876ff6feSmrg 52876ff6feSmrgOptions: 53876ff6feSmrg -h, --help display this help and exit 54876ff6feSmrg -v, --version output version information and exit 55876ff6feSmrg 56876ff6feSmrgSupported PROGRAM values: 57d41660beSmrg aclocal autoconf autoheader autom4te automake makeinfo 58d41660beSmrg bison yacc flex lex help2man 59d41660beSmrg 60d41660beSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61d41660beSmrg'g' are ignored when checking the name. 62876ff6feSmrg 63876ff6feSmrgSend bug reports to <bug-automake@gnu.org>." 64876ff6feSmrg exit $? 65876ff6feSmrg ;; 66876ff6feSmrg 67876ff6feSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68876ff6feSmrg echo "missing $scriptversion (GNU Automake)" 69876ff6feSmrg exit $? 70876ff6feSmrg ;; 71876ff6feSmrg 72876ff6feSmrg -*) 73d41660beSmrg echo 1>&2 "$0: unknown '$1' option" 74d41660beSmrg echo 1>&2 "Try '$0 --help' for more information" 75876ff6feSmrg exit 1 76876ff6feSmrg ;; 77876ff6feSmrg 78876ff6feSmrgesac 79876ff6feSmrg 80d41660beSmrg# Run the given program, remember its exit status. 81d41660beSmrg"$@"; st=$? 82d41660beSmrg 83d41660beSmrg# If it succeeded, we are done. 84d41660beSmrgtest $st -eq 0 && exit 0 85d41660beSmrg 86d41660beSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 87d41660beSmrg# passed; such an option is passed most likely to detect whether the 88d41660beSmrg# program is present and works. 89d41660beSmrgcase $2 in --version|--help) exit $st;; esac 90d41660beSmrg 91d41660beSmrg# Exit code 63 means version mismatch. This often happens when the user 92d41660beSmrg# tries to use an ancient version of a tool on a file that requires a 93d41660beSmrg# minimum version. 94d41660beSmrgif test $st -eq 63; then 95d41660beSmrg msg="probably too old" 96d41660beSmrgelif test $st -eq 127; then 97d41660beSmrg # Program was missing. 98d41660beSmrg msg="missing on your system" 99d41660beSmrgelse 100d41660beSmrg # Program was found and executed, but failed. Give up. 101d41660beSmrg exit $st 102d41660beSmrgfi 103876ff6feSmrg 104d41660beSmrgperl_URL=http://www.perl.org/ 105d41660beSmrgflex_URL=http://flex.sourceforge.net/ 106d41660beSmrggnu_software_URL=http://www.gnu.org/software 107d41660beSmrg 108d41660beSmrgprogram_details () 109d41660beSmrg{ 110d41660beSmrg case $1 in 111d41660beSmrg aclocal|automake) 112d41660beSmrg echo "The '$1' program is part of the GNU Automake package:" 113d41660beSmrg echo "<$gnu_software_URL/automake>" 114d41660beSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115d41660beSmrg echo "<$gnu_software_URL/autoconf>" 116d41660beSmrg echo "<$gnu_software_URL/m4/>" 117d41660beSmrg echo "<$perl_URL>" 118d41660beSmrg ;; 119d41660beSmrg autoconf|autom4te|autoheader) 120d41660beSmrg echo "The '$1' program is part of the GNU Autoconf package:" 121d41660beSmrg echo "<$gnu_software_URL/autoconf/>" 122d41660beSmrg echo "It also requires GNU m4 and Perl in order to run:" 123d41660beSmrg echo "<$gnu_software_URL/m4/>" 124d41660beSmrg echo "<$perl_URL>" 125d41660beSmrg ;; 126d41660beSmrg esac 127d41660beSmrg} 128d41660beSmrg 129d41660beSmrggive_advice () 130d41660beSmrg{ 131d41660beSmrg # Normalize program name to check for. 132d41660beSmrg normalized_program=`echo "$1" | sed ' 133d41660beSmrg s/^gnu-//; t 134d41660beSmrg s/^gnu//; t 135d41660beSmrg s/^g//; t'` 136d41660beSmrg 137d41660beSmrg printf '%s\n' "'$1' is $msg." 138d41660beSmrg 139d41660beSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140d41660beSmrg case $normalized_program in 141d41660beSmrg autoconf*) 142d41660beSmrg echo "You should only need it if you modified 'configure.ac'," 143d41660beSmrg echo "or m4 files included by it." 144d41660beSmrg program_details 'autoconf' 145d41660beSmrg ;; 146d41660beSmrg autoheader*) 147d41660beSmrg echo "You should only need it if you modified 'acconfig.h' or" 148d41660beSmrg echo "$configure_deps." 149d41660beSmrg program_details 'autoheader' 150d41660beSmrg ;; 151d41660beSmrg automake*) 152d41660beSmrg echo "You should only need it if you modified 'Makefile.am' or" 153d41660beSmrg echo "$configure_deps." 154d41660beSmrg program_details 'automake' 155d41660beSmrg ;; 156d41660beSmrg aclocal*) 157d41660beSmrg echo "You should only need it if you modified 'acinclude.m4' or" 158d41660beSmrg echo "$configure_deps." 159d41660beSmrg program_details 'aclocal' 160d41660beSmrg ;; 161d41660beSmrg autom4te*) 162d41660beSmrg echo "You might have modified some maintainer files that require" 163d41660beSmrg echo "the 'autom4te' program to be rebuilt." 164d41660beSmrg program_details 'autom4te' 165d41660beSmrg ;; 166d41660beSmrg bison*|yacc*) 167d41660beSmrg echo "You should only need it if you modified a '.y' file." 168d41660beSmrg echo "You may want to install the GNU Bison package:" 169d41660beSmrg echo "<$gnu_software_URL/bison/>" 170d41660beSmrg ;; 171d41660beSmrg lex*|flex*) 172d41660beSmrg echo "You should only need it if you modified a '.l' file." 173d41660beSmrg echo "You may want to install the Fast Lexical Analyzer package:" 174d41660beSmrg echo "<$flex_URL>" 175d41660beSmrg ;; 176d41660beSmrg help2man*) 177d41660beSmrg echo "You should only need it if you modified a dependency" \ 178d41660beSmrg "of a man page." 179d41660beSmrg echo "You may want to install the GNU Help2man package:" 180d41660beSmrg echo "<$gnu_software_URL/help2man/>" 181d41660beSmrg ;; 182d41660beSmrg makeinfo*) 183d41660beSmrg echo "You should only need it if you modified a '.texi' file, or" 184d41660beSmrg echo "any other file indirectly affecting the aspect of the manual." 185d41660beSmrg echo "You might want to install the Texinfo package:" 186d41660beSmrg echo "<$gnu_software_URL/texinfo/>" 187d41660beSmrg echo "The spurious makeinfo call might also be the consequence of" 188d41660beSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189d41660beSmrg echo "want to install GNU make:" 190d41660beSmrg echo "<$gnu_software_URL/make/>" 191d41660beSmrg ;; 192d41660beSmrg *) 193d41660beSmrg echo "You might have modified some files without having the proper" 194d41660beSmrg echo "tools for further handling them. Check the 'README' file, it" 195d41660beSmrg echo "often tells you about the needed prerequisites for installing" 196d41660beSmrg echo "this package. You may also peek at any GNU archive site, in" 197d41660beSmrg echo "case some other package contains this missing '$1' program." 198d41660beSmrg ;; 199d41660beSmrg esac 200d41660beSmrg} 201d41660beSmrg 202d41660beSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203d41660beSmrg -e '2,$s/^/ /' >&2 204d41660beSmrg 205d41660beSmrg# Propagate the correct exit status (expected to be 127 for a program 206d41660beSmrg# not found, 63 for a program that failed due to version mismatch). 207d41660beSmrgexit $st 208876ff6feSmrg 209876ff6feSmrg# Local variables: 210876ff6feSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211876ff6feSmrg# time-stamp-start: "scriptversion=" 212876ff6feSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213d41660beSmrg# time-stamp-time-zone: "UTC0" 214d41660beSmrg# time-stamp-end: "; # UTC" 215876ff6feSmrg# End: 216