11e00de39Smrg#! /bin/sh 2b6f5cd12Smrg# Common wrapper for a few potentially missing GNU programs. 31e00de39Smrg 4d67195daSmrgscriptversion=2018-03-07.03; # UTC 51e00de39Smrg 6d67195daSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7b6f5cd12Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 81e00de39Smrg 91e00de39Smrg# This program is free software; you can redistribute it and/or modify 101e00de39Smrg# it under the terms of the GNU General Public License as published by 111e00de39Smrg# the Free Software Foundation; either version 2, or (at your option) 121e00de39Smrg# any later version. 131e00de39Smrg 141e00de39Smrg# This program is distributed in the hope that it will be useful, 151e00de39Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 161e00de39Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 171e00de39Smrg# GNU General Public License for more details. 181e00de39Smrg 191e00de39Smrg# You should have received a copy of the GNU General Public License 20d67195daSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 211e00de39Smrg 221e00de39Smrg# As a special exception to the GNU General Public License, if you 231e00de39Smrg# distribute this file as part of a program that contains a 241e00de39Smrg# configuration script generated by Autoconf, you may include it under 251e00de39Smrg# the same distribution terms that you use for the rest of that program. 261e00de39Smrg 271e00de39Smrgif test $# -eq 0; then 28b6f5cd12Smrg echo 1>&2 "Try '$0 --help' for more information" 291e00de39Smrg exit 1 301e00de39Smrgfi 311e00de39Smrg 32b6f5cd12Smrgcase $1 in 331e00de39Smrg 34b6f5cd12Smrg --is-lightweight) 35b6f5cd12Smrg # Used by our autoconf macros to check whether the available missing 36b6f5cd12Smrg # script is modern enough. 37b6f5cd12Smrg exit 0 38b6f5cd12Smrg ;; 391e00de39Smrg 40b6f5cd12Smrg --run) 41b6f5cd12Smrg # Back-compat with the calling convention used by older automake. 42b6f5cd12Smrg shift 43b6f5cd12Smrg ;; 441e00de39Smrg 451e00de39Smrg -h|--h|--he|--hel|--help) 461e00de39Smrg echo "\ 471e00de39Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 481e00de39Smrg 49b6f5cd12SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50b6f5cd12Smrgto PROGRAM being missing or too old. 511e00de39Smrg 521e00de39SmrgOptions: 531e00de39Smrg -h, --help display this help and exit 541e00de39Smrg -v, --version output version information and exit 551e00de39Smrg 561e00de39SmrgSupported PROGRAM values: 57b6f5cd12Smrg aclocal autoconf autoheader autom4te automake makeinfo 58b6f5cd12Smrg bison yacc flex lex help2man 591e00de39Smrg 60b6f5cd12SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61b6f5cd12Smrg'g' are ignored when checking the name. 6221ecb1efSmrg 631e00de39SmrgSend bug reports to <bug-automake@gnu.org>." 641e00de39Smrg exit $? 651e00de39Smrg ;; 661e00de39Smrg 671e00de39Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 681e00de39Smrg echo "missing $scriptversion (GNU Automake)" 691e00de39Smrg exit $? 701e00de39Smrg ;; 711e00de39Smrg 721e00de39Smrg -*) 73b6f5cd12Smrg echo 1>&2 "$0: unknown '$1' option" 74b6f5cd12Smrg echo 1>&2 "Try '$0 --help' for more information" 751e00de39Smrg exit 1 761e00de39Smrg ;; 771e00de39Smrg 781e00de39Smrgesac 791e00de39Smrg 80b6f5cd12Smrg# Run the given program, remember its exit status. 81b6f5cd12Smrg"$@"; st=$? 82b6f5cd12Smrg 83b6f5cd12Smrg# If it succeeded, we are done. 84b6f5cd12Smrgtest $st -eq 0 && exit 0 85b6f5cd12Smrg 86b6f5cd12Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87b6f5cd12Smrg# passed; such an option is passed most likely to detect whether the 88b6f5cd12Smrg# program is present and works. 89b6f5cd12Smrgcase $2 in --version|--help) exit $st;; esac 90b6f5cd12Smrg 91b6f5cd12Smrg# Exit code 63 means version mismatch. This often happens when the user 92b6f5cd12Smrg# tries to use an ancient version of a tool on a file that requires a 93b6f5cd12Smrg# minimum version. 94b6f5cd12Smrgif test $st -eq 63; then 95b6f5cd12Smrg msg="probably too old" 96b6f5cd12Smrgelif test $st -eq 127; then 97b6f5cd12Smrg # Program was missing. 98b6f5cd12Smrg msg="missing on your system" 99b6f5cd12Smrgelse 100b6f5cd12Smrg # Program was found and executed, but failed. Give up. 101b6f5cd12Smrg exit $st 102b6f5cd12Smrgfi 1031e00de39Smrg 104d67195daSmrgperl_URL=https://www.perl.org/ 105d67195daSmrgflex_URL=https://github.com/westes/flex 106d67195daSmrggnu_software_URL=https://www.gnu.org/software 107b6f5cd12Smrg 108b6f5cd12Smrgprogram_details () 109b6f5cd12Smrg{ 110b6f5cd12Smrg case $1 in 111b6f5cd12Smrg aclocal|automake) 112b6f5cd12Smrg echo "The '$1' program is part of the GNU Automake package:" 113b6f5cd12Smrg echo "<$gnu_software_URL/automake>" 114b6f5cd12Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115b6f5cd12Smrg echo "<$gnu_software_URL/autoconf>" 116b6f5cd12Smrg echo "<$gnu_software_URL/m4/>" 117b6f5cd12Smrg echo "<$perl_URL>" 118b6f5cd12Smrg ;; 119b6f5cd12Smrg autoconf|autom4te|autoheader) 120b6f5cd12Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121b6f5cd12Smrg echo "<$gnu_software_URL/autoconf/>" 122b6f5cd12Smrg echo "It also requires GNU m4 and Perl in order to run:" 123b6f5cd12Smrg echo "<$gnu_software_URL/m4/>" 124b6f5cd12Smrg echo "<$perl_URL>" 125b6f5cd12Smrg ;; 126b6f5cd12Smrg esac 127b6f5cd12Smrg} 128b6f5cd12Smrg 129b6f5cd12Smrggive_advice () 130b6f5cd12Smrg{ 131b6f5cd12Smrg # Normalize program name to check for. 132b6f5cd12Smrg normalized_program=`echo "$1" | sed ' 133b6f5cd12Smrg s/^gnu-//; t 134b6f5cd12Smrg s/^gnu//; t 135b6f5cd12Smrg s/^g//; t'` 136b6f5cd12Smrg 137b6f5cd12Smrg printf '%s\n' "'$1' is $msg." 138b6f5cd12Smrg 139b6f5cd12Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140b6f5cd12Smrg case $normalized_program in 141b6f5cd12Smrg autoconf*) 142b6f5cd12Smrg echo "You should only need it if you modified 'configure.ac'," 143b6f5cd12Smrg echo "or m4 files included by it." 144b6f5cd12Smrg program_details 'autoconf' 145b6f5cd12Smrg ;; 146b6f5cd12Smrg autoheader*) 147b6f5cd12Smrg echo "You should only need it if you modified 'acconfig.h' or" 148b6f5cd12Smrg echo "$configure_deps." 149b6f5cd12Smrg program_details 'autoheader' 150b6f5cd12Smrg ;; 151b6f5cd12Smrg automake*) 152b6f5cd12Smrg echo "You should only need it if you modified 'Makefile.am' or" 153b6f5cd12Smrg echo "$configure_deps." 154b6f5cd12Smrg program_details 'automake' 155b6f5cd12Smrg ;; 156b6f5cd12Smrg aclocal*) 157b6f5cd12Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158b6f5cd12Smrg echo "$configure_deps." 159b6f5cd12Smrg program_details 'aclocal' 160b6f5cd12Smrg ;; 161b6f5cd12Smrg autom4te*) 162b6f5cd12Smrg echo "You might have modified some maintainer files that require" 16379bbd9e8Smrg echo "the 'autom4te' program to be rebuilt." 164b6f5cd12Smrg program_details 'autom4te' 165b6f5cd12Smrg ;; 166b6f5cd12Smrg bison*|yacc*) 167b6f5cd12Smrg echo "You should only need it if you modified a '.y' file." 168b6f5cd12Smrg echo "You may want to install the GNU Bison package:" 169b6f5cd12Smrg echo "<$gnu_software_URL/bison/>" 170b6f5cd12Smrg ;; 171b6f5cd12Smrg lex*|flex*) 172b6f5cd12Smrg echo "You should only need it if you modified a '.l' file." 173b6f5cd12Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174b6f5cd12Smrg echo "<$flex_URL>" 175b6f5cd12Smrg ;; 176b6f5cd12Smrg help2man*) 177b6f5cd12Smrg echo "You should only need it if you modified a dependency" \ 178b6f5cd12Smrg "of a man page." 179b6f5cd12Smrg echo "You may want to install the GNU Help2man package:" 180b6f5cd12Smrg echo "<$gnu_software_URL/help2man/>" 181b6f5cd12Smrg ;; 182b6f5cd12Smrg makeinfo*) 183b6f5cd12Smrg echo "You should only need it if you modified a '.texi' file, or" 184b6f5cd12Smrg echo "any other file indirectly affecting the aspect of the manual." 185b6f5cd12Smrg echo "You might want to install the Texinfo package:" 186b6f5cd12Smrg echo "<$gnu_software_URL/texinfo/>" 187b6f5cd12Smrg echo "The spurious makeinfo call might also be the consequence of" 188b6f5cd12Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189b6f5cd12Smrg echo "want to install GNU make:" 190b6f5cd12Smrg echo "<$gnu_software_URL/make/>" 191b6f5cd12Smrg ;; 192b6f5cd12Smrg *) 193b6f5cd12Smrg echo "You might have modified some files without having the proper" 194b6f5cd12Smrg echo "tools for further handling them. Check the 'README' file, it" 195b6f5cd12Smrg echo "often tells you about the needed prerequisites for installing" 196b6f5cd12Smrg echo "this package. You may also peek at any GNU archive site, in" 197b6f5cd12Smrg echo "case some other package contains this missing '$1' program." 198b6f5cd12Smrg ;; 199b6f5cd12Smrg esac 200b6f5cd12Smrg} 201b6f5cd12Smrg 202b6f5cd12Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203b6f5cd12Smrg -e '2,$s/^/ /' >&2 204b6f5cd12Smrg 205b6f5cd12Smrg# Propagate the correct exit status (expected to be 127 for a program 206b6f5cd12Smrg# not found, 63 for a program that failed due to version mismatch). 207b6f5cd12Smrgexit $st 2081e00de39Smrg 2091e00de39Smrg# Local variables: 210d67195daSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 2111e00de39Smrg# time-stamp-start: "scriptversion=" 2121e00de39Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213d67195daSmrg# time-stamp-time-zone: "UTC0" 21421ecb1efSmrg# time-stamp-end: "; # UTC" 2151e00de39Smrg# End: 216