1dcae5b9eSmrg#! /bin/sh 215adf0bfSmrg# Common wrapper for a few potentially missing GNU programs. 35b28e182Smrg 415adf0bfSmrgscriptversion=2018-03-07.03; # UTC 55b28e182Smrg 615adf0bfSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 715adf0bfSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 8dcae5b9eSmrg 9dcae5b9eSmrg# This program is free software; you can redistribute it and/or modify 10dcae5b9eSmrg# it under the terms of the GNU General Public License as published by 11dcae5b9eSmrg# the Free Software Foundation; either version 2, or (at your option) 12dcae5b9eSmrg# any later version. 13dcae5b9eSmrg 14dcae5b9eSmrg# This program is distributed in the hope that it will be useful, 15dcae5b9eSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 16dcae5b9eSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17dcae5b9eSmrg# GNU General Public License for more details. 18dcae5b9eSmrg 19dcae5b9eSmrg# You should have received a copy of the GNU General Public License 2015adf0bfSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 21dcae5b9eSmrg 22dcae5b9eSmrg# As a special exception to the GNU General Public License, if you 23dcae5b9eSmrg# distribute this file as part of a program that contains a 24dcae5b9eSmrg# configuration script generated by Autoconf, you may include it under 25dcae5b9eSmrg# the same distribution terms that you use for the rest of that program. 26dcae5b9eSmrg 27dcae5b9eSmrgif test $# -eq 0; then 2815adf0bfSmrg echo 1>&2 "Try '$0 --help' for more information" 29dcae5b9eSmrg exit 1 30dcae5b9eSmrgfi 31dcae5b9eSmrg 3215adf0bfSmrgcase $1 in 33dcae5b9eSmrg 3415adf0bfSmrg --is-lightweight) 3515adf0bfSmrg # Used by our autoconf macros to check whether the available missing 3615adf0bfSmrg # script is modern enough. 3715adf0bfSmrg exit 0 3815adf0bfSmrg ;; 395b28e182Smrg 4015adf0bfSmrg --run) 4115adf0bfSmrg # Back-compat with the calling convention used by older automake. 4215adf0bfSmrg shift 4315adf0bfSmrg ;; 44dcae5b9eSmrg 45dcae5b9eSmrg -h|--h|--he|--hel|--help) 46dcae5b9eSmrg echo "\ 47dcae5b9eSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 48dcae5b9eSmrg 4915adf0bfSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5015adf0bfSmrgto PROGRAM being missing or too old. 51dcae5b9eSmrg 52dcae5b9eSmrgOptions: 53dcae5b9eSmrg -h, --help display this help and exit 54dcae5b9eSmrg -v, --version output version information and exit 55dcae5b9eSmrg 56dcae5b9eSmrgSupported PROGRAM values: 5715adf0bfSmrg aclocal autoconf autoheader autom4te automake makeinfo 5815adf0bfSmrg bison yacc flex lex help2man 595b28e182Smrg 6015adf0bfSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6115adf0bfSmrg'g' are ignored when checking the name. 625b28e182Smrg 635b28e182SmrgSend bug reports to <bug-automake@gnu.org>." 645b28e182Smrg exit $? 65dcae5b9eSmrg ;; 66dcae5b9eSmrg 67dcae5b9eSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 685b28e182Smrg echo "missing $scriptversion (GNU Automake)" 695b28e182Smrg exit $? 70dcae5b9eSmrg ;; 71dcae5b9eSmrg 72dcae5b9eSmrg -*) 7315adf0bfSmrg echo 1>&2 "$0: unknown '$1' option" 7415adf0bfSmrg echo 1>&2 "Try '$0 --help' for more information" 75dcae5b9eSmrg exit 1 76dcae5b9eSmrg ;; 77dcae5b9eSmrg 785b28e182Smrgesac 795b28e182Smrg 8015adf0bfSmrg# Run the given program, remember its exit status. 8115adf0bfSmrg"$@"; st=$? 8215adf0bfSmrg 8315adf0bfSmrg# If it succeeded, we are done. 8415adf0bfSmrgtest $st -eq 0 && exit 0 8515adf0bfSmrg 8615adf0bfSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 8715adf0bfSmrg# passed; such an option is passed most likely to detect whether the 8815adf0bfSmrg# program is present and works. 8915adf0bfSmrgcase $2 in --version|--help) exit $st;; esac 9015adf0bfSmrg 9115adf0bfSmrg# Exit code 63 means version mismatch. This often happens when the user 9215adf0bfSmrg# tries to use an ancient version of a tool on a file that requires a 9315adf0bfSmrg# minimum version. 9415adf0bfSmrgif test $st -eq 63; then 9515adf0bfSmrg msg="probably too old" 9615adf0bfSmrgelif test $st -eq 127; then 9715adf0bfSmrg # Program was missing. 9815adf0bfSmrg msg="missing on your system" 9915adf0bfSmrgelse 10015adf0bfSmrg # Program was found and executed, but failed. Give up. 10115adf0bfSmrg exit $st 10215adf0bfSmrgfi 103dcae5b9eSmrg 10415adf0bfSmrgperl_URL=https://www.perl.org/ 10515adf0bfSmrgflex_URL=https://github.com/westes/flex 10615adf0bfSmrggnu_software_URL=https://www.gnu.org/software 10715adf0bfSmrg 10815adf0bfSmrgprogram_details () 10915adf0bfSmrg{ 11015adf0bfSmrg case $1 in 11115adf0bfSmrg aclocal|automake) 11215adf0bfSmrg echo "The '$1' program is part of the GNU Automake package:" 11315adf0bfSmrg echo "<$gnu_software_URL/automake>" 11415adf0bfSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11515adf0bfSmrg echo "<$gnu_software_URL/autoconf>" 11615adf0bfSmrg echo "<$gnu_software_URL/m4/>" 11715adf0bfSmrg echo "<$perl_URL>" 11815adf0bfSmrg ;; 11915adf0bfSmrg autoconf|autom4te|autoheader) 12015adf0bfSmrg echo "The '$1' program is part of the GNU Autoconf package:" 12115adf0bfSmrg echo "<$gnu_software_URL/autoconf/>" 12215adf0bfSmrg echo "It also requires GNU m4 and Perl in order to run:" 12315adf0bfSmrg echo "<$gnu_software_URL/m4/>" 12415adf0bfSmrg echo "<$perl_URL>" 12515adf0bfSmrg ;; 12615adf0bfSmrg esac 12715adf0bfSmrg} 12815adf0bfSmrg 12915adf0bfSmrggive_advice () 13015adf0bfSmrg{ 13115adf0bfSmrg # Normalize program name to check for. 13215adf0bfSmrg normalized_program=`echo "$1" | sed ' 13315adf0bfSmrg s/^gnu-//; t 13415adf0bfSmrg s/^gnu//; t 13515adf0bfSmrg s/^g//; t'` 13615adf0bfSmrg 13715adf0bfSmrg printf '%s\n' "'$1' is $msg." 13815adf0bfSmrg 13915adf0bfSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14015adf0bfSmrg case $normalized_program in 14115adf0bfSmrg autoconf*) 14215adf0bfSmrg echo "You should only need it if you modified 'configure.ac'," 14315adf0bfSmrg echo "or m4 files included by it." 14415adf0bfSmrg program_details 'autoconf' 14515adf0bfSmrg ;; 14615adf0bfSmrg autoheader*) 14715adf0bfSmrg echo "You should only need it if you modified 'acconfig.h' or" 14815adf0bfSmrg echo "$configure_deps." 14915adf0bfSmrg program_details 'autoheader' 15015adf0bfSmrg ;; 15115adf0bfSmrg automake*) 15215adf0bfSmrg echo "You should only need it if you modified 'Makefile.am' or" 15315adf0bfSmrg echo "$configure_deps." 15415adf0bfSmrg program_details 'automake' 15515adf0bfSmrg ;; 15615adf0bfSmrg aclocal*) 15715adf0bfSmrg echo "You should only need it if you modified 'acinclude.m4' or" 15815adf0bfSmrg echo "$configure_deps." 15915adf0bfSmrg program_details 'aclocal' 16015adf0bfSmrg ;; 16115adf0bfSmrg autom4te*) 16215adf0bfSmrg echo "You might have modified some maintainer files that require" 16315adf0bfSmrg echo "the 'autom4te' program to be rebuilt." 16415adf0bfSmrg program_details 'autom4te' 16515adf0bfSmrg ;; 16615adf0bfSmrg bison*|yacc*) 16715adf0bfSmrg echo "You should only need it if you modified a '.y' file." 16815adf0bfSmrg echo "You may want to install the GNU Bison package:" 16915adf0bfSmrg echo "<$gnu_software_URL/bison/>" 17015adf0bfSmrg ;; 17115adf0bfSmrg lex*|flex*) 17215adf0bfSmrg echo "You should only need it if you modified a '.l' file." 17315adf0bfSmrg echo "You may want to install the Fast Lexical Analyzer package:" 17415adf0bfSmrg echo "<$flex_URL>" 17515adf0bfSmrg ;; 17615adf0bfSmrg help2man*) 17715adf0bfSmrg echo "You should only need it if you modified a dependency" \ 17815adf0bfSmrg "of a man page." 17915adf0bfSmrg echo "You may want to install the GNU Help2man package:" 18015adf0bfSmrg echo "<$gnu_software_URL/help2man/>" 18115adf0bfSmrg ;; 18215adf0bfSmrg makeinfo*) 18315adf0bfSmrg echo "You should only need it if you modified a '.texi' file, or" 18415adf0bfSmrg echo "any other file indirectly affecting the aspect of the manual." 18515adf0bfSmrg echo "You might want to install the Texinfo package:" 18615adf0bfSmrg echo "<$gnu_software_URL/texinfo/>" 18715adf0bfSmrg echo "The spurious makeinfo call might also be the consequence of" 18815adf0bfSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18915adf0bfSmrg echo "want to install GNU make:" 19015adf0bfSmrg echo "<$gnu_software_URL/make/>" 19115adf0bfSmrg ;; 19215adf0bfSmrg *) 19315adf0bfSmrg echo "You might have modified some files without having the proper" 19415adf0bfSmrg echo "tools for further handling them. Check the 'README' file, it" 19515adf0bfSmrg echo "often tells you about the needed prerequisites for installing" 19615adf0bfSmrg echo "this package. You may also peek at any GNU archive site, in" 19715adf0bfSmrg echo "case some other package contains this missing '$1' program." 19815adf0bfSmrg ;; 19915adf0bfSmrg esac 20015adf0bfSmrg} 20115adf0bfSmrg 20215adf0bfSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20315adf0bfSmrg -e '2,$s/^/ /' >&2 20415adf0bfSmrg 20515adf0bfSmrg# Propagate the correct exit status (expected to be 127 for a program 20615adf0bfSmrg# not found, 63 for a program that failed due to version mismatch). 20715adf0bfSmrgexit $st 2085b28e182Smrg 2095b28e182Smrg# Local variables: 21015adf0bfSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 2115b28e182Smrg# time-stamp-start: "scriptversion=" 2125b28e182Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21315adf0bfSmrg# time-stamp-time-zone: "UTC0" 2145b28e182Smrg# time-stamp-end: "; # UTC" 2155b28e182Smrg# End: 216