10cc6efb6Smrg#! /bin/sh 248e37bc2Smrg# Common wrapper for a few potentially missing GNU programs. 36cf5427aSmrg 448e37bc2Smrgscriptversion=2018-03-07.03; # UTC 56cf5427aSmrg 648e37bc2Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 748e37bc2Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 80cc6efb6Smrg 90cc6efb6Smrg# This program is free software; you can redistribute it and/or modify 100cc6efb6Smrg# it under the terms of the GNU General Public License as published by 110cc6efb6Smrg# the Free Software Foundation; either version 2, or (at your option) 120cc6efb6Smrg# any later version. 130cc6efb6Smrg 140cc6efb6Smrg# This program is distributed in the hope that it will be useful, 150cc6efb6Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 160cc6efb6Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 170cc6efb6Smrg# GNU General Public License for more details. 180cc6efb6Smrg 190cc6efb6Smrg# You should have received a copy of the GNU General Public License 2048e37bc2Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 210cc6efb6Smrg 220cc6efb6Smrg# As a special exception to the GNU General Public License, if you 230cc6efb6Smrg# distribute this file as part of a program that contains a 240cc6efb6Smrg# configuration script generated by Autoconf, you may include it under 250cc6efb6Smrg# the same distribution terms that you use for the rest of that program. 260cc6efb6Smrg 270cc6efb6Smrgif test $# -eq 0; then 2848e37bc2Smrg echo 1>&2 "Try '$0 --help' for more information" 290cc6efb6Smrg exit 1 300cc6efb6Smrgfi 310cc6efb6Smrg 3248e37bc2Smrgcase $1 in 330cc6efb6Smrg 3448e37bc2Smrg --is-lightweight) 3548e37bc2Smrg # Used by our autoconf macros to check whether the available missing 3648e37bc2Smrg # script is modern enough. 3748e37bc2Smrg exit 0 3848e37bc2Smrg ;; 396cf5427aSmrg 4048e37bc2Smrg --run) 4148e37bc2Smrg # Back-compat with the calling convention used by older automake. 4248e37bc2Smrg shift 4348e37bc2Smrg ;; 440cc6efb6Smrg 450cc6efb6Smrg -h|--h|--he|--hel|--help) 460cc6efb6Smrg echo "\ 470cc6efb6Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 480cc6efb6Smrg 4948e37bc2SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5048e37bc2Smrgto PROGRAM being missing or too old. 510cc6efb6Smrg 520cc6efb6SmrgOptions: 530cc6efb6Smrg -h, --help display this help and exit 540cc6efb6Smrg -v, --version output version information and exit 550cc6efb6Smrg 560cc6efb6SmrgSupported PROGRAM values: 5748e37bc2Smrg aclocal autoconf autoheader autom4te automake makeinfo 5848e37bc2Smrg bison yacc flex lex help2man 596cf5427aSmrg 6048e37bc2SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6148e37bc2Smrg'g' are ignored when checking the name. 626cf5427aSmrg 636cf5427aSmrgSend bug reports to <bug-automake@gnu.org>." 646cf5427aSmrg exit $? 650cc6efb6Smrg ;; 660cc6efb6Smrg 670cc6efb6Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 686cf5427aSmrg echo "missing $scriptversion (GNU Automake)" 696cf5427aSmrg exit $? 700cc6efb6Smrg ;; 710cc6efb6Smrg 720cc6efb6Smrg -*) 7348e37bc2Smrg echo 1>&2 "$0: unknown '$1' option" 7448e37bc2Smrg echo 1>&2 "Try '$0 --help' for more information" 750cc6efb6Smrg exit 1 760cc6efb6Smrg ;; 770cc6efb6Smrg 786cf5427aSmrgesac 796cf5427aSmrg 8048e37bc2Smrg# Run the given program, remember its exit status. 8148e37bc2Smrg"$@"; st=$? 8248e37bc2Smrg 8348e37bc2Smrg# If it succeeded, we are done. 8448e37bc2Smrgtest $st -eq 0 && exit 0 8548e37bc2Smrg 8648e37bc2Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 8748e37bc2Smrg# passed; such an option is passed most likely to detect whether the 8848e37bc2Smrg# program is present and works. 8948e37bc2Smrgcase $2 in --version|--help) exit $st;; esac 9048e37bc2Smrg 9148e37bc2Smrg# Exit code 63 means version mismatch. This often happens when the user 9248e37bc2Smrg# tries to use an ancient version of a tool on a file that requires a 9348e37bc2Smrg# minimum version. 9448e37bc2Smrgif test $st -eq 63; then 9548e37bc2Smrg msg="probably too old" 9648e37bc2Smrgelif test $st -eq 127; then 9748e37bc2Smrg # Program was missing. 9848e37bc2Smrg msg="missing on your system" 9948e37bc2Smrgelse 10048e37bc2Smrg # Program was found and executed, but failed. Give up. 10148e37bc2Smrg exit $st 10248e37bc2Smrgfi 1030cc6efb6Smrg 10448e37bc2Smrgperl_URL=https://www.perl.org/ 10548e37bc2Smrgflex_URL=https://github.com/westes/flex 10648e37bc2Smrggnu_software_URL=https://www.gnu.org/software 10748e37bc2Smrg 10848e37bc2Smrgprogram_details () 10948e37bc2Smrg{ 11048e37bc2Smrg case $1 in 11148e37bc2Smrg aclocal|automake) 11248e37bc2Smrg echo "The '$1' program is part of the GNU Automake package:" 11348e37bc2Smrg echo "<$gnu_software_URL/automake>" 11448e37bc2Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11548e37bc2Smrg echo "<$gnu_software_URL/autoconf>" 11648e37bc2Smrg echo "<$gnu_software_URL/m4/>" 11748e37bc2Smrg echo "<$perl_URL>" 11848e37bc2Smrg ;; 11948e37bc2Smrg autoconf|autom4te|autoheader) 12048e37bc2Smrg echo "The '$1' program is part of the GNU Autoconf package:" 12148e37bc2Smrg echo "<$gnu_software_URL/autoconf/>" 12248e37bc2Smrg echo "It also requires GNU m4 and Perl in order to run:" 12348e37bc2Smrg echo "<$gnu_software_URL/m4/>" 12448e37bc2Smrg echo "<$perl_URL>" 12548e37bc2Smrg ;; 12648e37bc2Smrg esac 12748e37bc2Smrg} 12848e37bc2Smrg 12948e37bc2Smrggive_advice () 13048e37bc2Smrg{ 13148e37bc2Smrg # Normalize program name to check for. 13248e37bc2Smrg normalized_program=`echo "$1" | sed ' 13348e37bc2Smrg s/^gnu-//; t 13448e37bc2Smrg s/^gnu//; t 13548e37bc2Smrg s/^g//; t'` 13648e37bc2Smrg 13748e37bc2Smrg printf '%s\n' "'$1' is $msg." 13848e37bc2Smrg 13948e37bc2Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14048e37bc2Smrg case $normalized_program in 14148e37bc2Smrg autoconf*) 14248e37bc2Smrg echo "You should only need it if you modified 'configure.ac'," 14348e37bc2Smrg echo "or m4 files included by it." 14448e37bc2Smrg program_details 'autoconf' 14548e37bc2Smrg ;; 14648e37bc2Smrg autoheader*) 14748e37bc2Smrg echo "You should only need it if you modified 'acconfig.h' or" 14848e37bc2Smrg echo "$configure_deps." 14948e37bc2Smrg program_details 'autoheader' 15048e37bc2Smrg ;; 15148e37bc2Smrg automake*) 15248e37bc2Smrg echo "You should only need it if you modified 'Makefile.am' or" 15348e37bc2Smrg echo "$configure_deps." 15448e37bc2Smrg program_details 'automake' 15548e37bc2Smrg ;; 15648e37bc2Smrg aclocal*) 15748e37bc2Smrg echo "You should only need it if you modified 'acinclude.m4' or" 15848e37bc2Smrg echo "$configure_deps." 15948e37bc2Smrg program_details 'aclocal' 16048e37bc2Smrg ;; 16148e37bc2Smrg autom4te*) 16248e37bc2Smrg echo "You might have modified some maintainer files that require" 16348e37bc2Smrg echo "the 'autom4te' program to be rebuilt." 16448e37bc2Smrg program_details 'autom4te' 16548e37bc2Smrg ;; 16648e37bc2Smrg bison*|yacc*) 16748e37bc2Smrg echo "You should only need it if you modified a '.y' file." 16848e37bc2Smrg echo "You may want to install the GNU Bison package:" 16948e37bc2Smrg echo "<$gnu_software_URL/bison/>" 17048e37bc2Smrg ;; 17148e37bc2Smrg lex*|flex*) 17248e37bc2Smrg echo "You should only need it if you modified a '.l' file." 17348e37bc2Smrg echo "You may want to install the Fast Lexical Analyzer package:" 17448e37bc2Smrg echo "<$flex_URL>" 17548e37bc2Smrg ;; 17648e37bc2Smrg help2man*) 17748e37bc2Smrg echo "You should only need it if you modified a dependency" \ 17848e37bc2Smrg "of a man page." 17948e37bc2Smrg echo "You may want to install the GNU Help2man package:" 18048e37bc2Smrg echo "<$gnu_software_URL/help2man/>" 18148e37bc2Smrg ;; 18248e37bc2Smrg makeinfo*) 18348e37bc2Smrg echo "You should only need it if you modified a '.texi' file, or" 18448e37bc2Smrg echo "any other file indirectly affecting the aspect of the manual." 18548e37bc2Smrg echo "You might want to install the Texinfo package:" 18648e37bc2Smrg echo "<$gnu_software_URL/texinfo/>" 18748e37bc2Smrg echo "The spurious makeinfo call might also be the consequence of" 18848e37bc2Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18948e37bc2Smrg echo "want to install GNU make:" 19048e37bc2Smrg echo "<$gnu_software_URL/make/>" 19148e37bc2Smrg ;; 19248e37bc2Smrg *) 19348e37bc2Smrg echo "You might have modified some files without having the proper" 19448e37bc2Smrg echo "tools for further handling them. Check the 'README' file, it" 19548e37bc2Smrg echo "often tells you about the needed prerequisites for installing" 19648e37bc2Smrg echo "this package. You may also peek at any GNU archive site, in" 19748e37bc2Smrg echo "case some other package contains this missing '$1' program." 19848e37bc2Smrg ;; 19948e37bc2Smrg esac 20048e37bc2Smrg} 20148e37bc2Smrg 20248e37bc2Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20348e37bc2Smrg -e '2,$s/^/ /' >&2 20448e37bc2Smrg 20548e37bc2Smrg# Propagate the correct exit status (expected to be 127 for a program 20648e37bc2Smrg# not found, 63 for a program that failed due to version mismatch). 20748e37bc2Smrgexit $st 2086cf5427aSmrg 2096cf5427aSmrg# Local variables: 21048e37bc2Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 2116cf5427aSmrg# time-stamp-start: "scriptversion=" 2126cf5427aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21348e37bc2Smrg# time-stamp-time-zone: "UTC0" 2146cf5427aSmrg# time-stamp-end: "; # UTC" 2156cf5427aSmrg# End: 216