13da084b3Smrg#! /bin/sh 2e1c0d025Smrg# Common wrapper for a few potentially missing GNU programs. 33da084b3Smrg 42a53b785Smrgscriptversion=2018-03-07.03; # UTC 53da084b3Smrg 62a53b785Smrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 7e1c0d025Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 83da084b3Smrg 93da084b3Smrg# This program is free software; you can redistribute it and/or modify 103da084b3Smrg# it under the terms of the GNU General Public License as published by 113da084b3Smrg# the Free Software Foundation; either version 2, or (at your option) 123da084b3Smrg# any later version. 133da084b3Smrg 143da084b3Smrg# This program is distributed in the hope that it will be useful, 153da084b3Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 163da084b3Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 173da084b3Smrg# GNU General Public License for more details. 183da084b3Smrg 193da084b3Smrg# You should have received a copy of the GNU General Public License 202a53b785Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 213da084b3Smrg 223da084b3Smrg# As a special exception to the GNU General Public License, if you 233da084b3Smrg# distribute this file as part of a program that contains a 243da084b3Smrg# configuration script generated by Autoconf, you may include it under 253da084b3Smrg# the same distribution terms that you use for the rest of that program. 263da084b3Smrg 273da084b3Smrgif test $# -eq 0; then 28e1c0d025Smrg echo 1>&2 "Try '$0 --help' for more information" 293da084b3Smrg exit 1 303da084b3Smrgfi 313da084b3Smrg 32e1c0d025Smrgcase $1 in 333da084b3Smrg 34e1c0d025Smrg --is-lightweight) 35e1c0d025Smrg # Used by our autoconf macros to check whether the available missing 36e1c0d025Smrg # script is modern enough. 37e1c0d025Smrg exit 0 38e1c0d025Smrg ;; 393da084b3Smrg 40e1c0d025Smrg --run) 41e1c0d025Smrg # Back-compat with the calling convention used by older automake. 42e1c0d025Smrg shift 43e1c0d025Smrg ;; 443da084b3Smrg 453da084b3Smrg -h|--h|--he|--hel|--help) 463da084b3Smrg echo "\ 473da084b3Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 483da084b3Smrg 49e1c0d025SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 50e1c0d025Smrgto PROGRAM being missing or too old. 513da084b3Smrg 523da084b3SmrgOptions: 533da084b3Smrg -h, --help display this help and exit 543da084b3Smrg -v, --version output version information and exit 553da084b3Smrg 563da084b3SmrgSupported PROGRAM values: 57e1c0d025Smrg aclocal autoconf autoheader autom4te automake makeinfo 58e1c0d025Smrg bison yacc flex lex help2man 593da084b3Smrg 60e1c0d025SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61e1c0d025Smrg'g' are ignored when checking the name. 6255acc8fcSmrg 633da084b3SmrgSend bug reports to <bug-automake@gnu.org>." 643da084b3Smrg exit $? 653da084b3Smrg ;; 663da084b3Smrg 673da084b3Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 683da084b3Smrg echo "missing $scriptversion (GNU Automake)" 693da084b3Smrg exit $? 703da084b3Smrg ;; 713da084b3Smrg 723da084b3Smrg -*) 73e1c0d025Smrg echo 1>&2 "$0: unknown '$1' option" 74e1c0d025Smrg echo 1>&2 "Try '$0 --help' for more information" 753da084b3Smrg exit 1 763da084b3Smrg ;; 773da084b3Smrg 783da084b3Smrgesac 793da084b3Smrg 80e1c0d025Smrg# Run the given program, remember its exit status. 81e1c0d025Smrg"$@"; st=$? 82e1c0d025Smrg 83e1c0d025Smrg# If it succeeded, we are done. 84e1c0d025Smrgtest $st -eq 0 && exit 0 85e1c0d025Smrg 86e1c0d025Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 87e1c0d025Smrg# passed; such an option is passed most likely to detect whether the 88e1c0d025Smrg# program is present and works. 89e1c0d025Smrgcase $2 in --version|--help) exit $st;; esac 90e1c0d025Smrg 91e1c0d025Smrg# Exit code 63 means version mismatch. This often happens when the user 92e1c0d025Smrg# tries to use an ancient version of a tool on a file that requires a 93e1c0d025Smrg# minimum version. 94e1c0d025Smrgif test $st -eq 63; then 95e1c0d025Smrg msg="probably too old" 96e1c0d025Smrgelif test $st -eq 127; then 97e1c0d025Smrg # Program was missing. 98e1c0d025Smrg msg="missing on your system" 99e1c0d025Smrgelse 100e1c0d025Smrg # Program was found and executed, but failed. Give up. 101e1c0d025Smrg exit $st 102e1c0d025Smrgfi 1033da084b3Smrg 1042a53b785Smrgperl_URL=https://www.perl.org/ 1052a53b785Smrgflex_URL=https://github.com/westes/flex 1062a53b785Smrggnu_software_URL=https://www.gnu.org/software 107e1c0d025Smrg 108e1c0d025Smrgprogram_details () 109e1c0d025Smrg{ 110e1c0d025Smrg case $1 in 111e1c0d025Smrg aclocal|automake) 112e1c0d025Smrg echo "The '$1' program is part of the GNU Automake package:" 113e1c0d025Smrg echo "<$gnu_software_URL/automake>" 114e1c0d025Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 115e1c0d025Smrg echo "<$gnu_software_URL/autoconf>" 116e1c0d025Smrg echo "<$gnu_software_URL/m4/>" 117e1c0d025Smrg echo "<$perl_URL>" 118e1c0d025Smrg ;; 119e1c0d025Smrg autoconf|autom4te|autoheader) 120e1c0d025Smrg echo "The '$1' program is part of the GNU Autoconf package:" 121e1c0d025Smrg echo "<$gnu_software_URL/autoconf/>" 122e1c0d025Smrg echo "It also requires GNU m4 and Perl in order to run:" 123e1c0d025Smrg echo "<$gnu_software_URL/m4/>" 124e1c0d025Smrg echo "<$perl_URL>" 125e1c0d025Smrg ;; 126e1c0d025Smrg esac 127e1c0d025Smrg} 128e1c0d025Smrg 129e1c0d025Smrggive_advice () 130e1c0d025Smrg{ 131e1c0d025Smrg # Normalize program name to check for. 132e1c0d025Smrg normalized_program=`echo "$1" | sed ' 133e1c0d025Smrg s/^gnu-//; t 134e1c0d025Smrg s/^gnu//; t 135e1c0d025Smrg s/^g//; t'` 136e1c0d025Smrg 137e1c0d025Smrg printf '%s\n' "'$1' is $msg." 138e1c0d025Smrg 139e1c0d025Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 140e1c0d025Smrg case $normalized_program in 141e1c0d025Smrg autoconf*) 142e1c0d025Smrg echo "You should only need it if you modified 'configure.ac'," 143e1c0d025Smrg echo "or m4 files included by it." 144e1c0d025Smrg program_details 'autoconf' 145e1c0d025Smrg ;; 146e1c0d025Smrg autoheader*) 147e1c0d025Smrg echo "You should only need it if you modified 'acconfig.h' or" 148e1c0d025Smrg echo "$configure_deps." 149e1c0d025Smrg program_details 'autoheader' 150e1c0d025Smrg ;; 151e1c0d025Smrg automake*) 152e1c0d025Smrg echo "You should only need it if you modified 'Makefile.am' or" 153e1c0d025Smrg echo "$configure_deps." 154e1c0d025Smrg program_details 'automake' 155e1c0d025Smrg ;; 156e1c0d025Smrg aclocal*) 157e1c0d025Smrg echo "You should only need it if you modified 'acinclude.m4' or" 158e1c0d025Smrg echo "$configure_deps." 159e1c0d025Smrg program_details 'aclocal' 160e1c0d025Smrg ;; 161e1c0d025Smrg autom4te*) 162e1c0d025Smrg echo "You might have modified some maintainer files that require" 163e1c0d025Smrg echo "the 'autom4te' program to be rebuilt." 164e1c0d025Smrg program_details 'autom4te' 165e1c0d025Smrg ;; 166e1c0d025Smrg bison*|yacc*) 167e1c0d025Smrg echo "You should only need it if you modified a '.y' file." 168e1c0d025Smrg echo "You may want to install the GNU Bison package:" 169e1c0d025Smrg echo "<$gnu_software_URL/bison/>" 170e1c0d025Smrg ;; 171e1c0d025Smrg lex*|flex*) 172e1c0d025Smrg echo "You should only need it if you modified a '.l' file." 173e1c0d025Smrg echo "You may want to install the Fast Lexical Analyzer package:" 174e1c0d025Smrg echo "<$flex_URL>" 175e1c0d025Smrg ;; 176e1c0d025Smrg help2man*) 177e1c0d025Smrg echo "You should only need it if you modified a dependency" \ 178e1c0d025Smrg "of a man page." 179e1c0d025Smrg echo "You may want to install the GNU Help2man package:" 180e1c0d025Smrg echo "<$gnu_software_URL/help2man/>" 181e1c0d025Smrg ;; 182e1c0d025Smrg makeinfo*) 183e1c0d025Smrg echo "You should only need it if you modified a '.texi' file, or" 184e1c0d025Smrg echo "any other file indirectly affecting the aspect of the manual." 185e1c0d025Smrg echo "You might want to install the Texinfo package:" 186e1c0d025Smrg echo "<$gnu_software_URL/texinfo/>" 187e1c0d025Smrg echo "The spurious makeinfo call might also be the consequence of" 188e1c0d025Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 189e1c0d025Smrg echo "want to install GNU make:" 190e1c0d025Smrg echo "<$gnu_software_URL/make/>" 191e1c0d025Smrg ;; 192e1c0d025Smrg *) 193e1c0d025Smrg echo "You might have modified some files without having the proper" 194e1c0d025Smrg echo "tools for further handling them. Check the 'README' file, it" 195e1c0d025Smrg echo "often tells you about the needed prerequisites for installing" 196e1c0d025Smrg echo "this package. You may also peek at any GNU archive site, in" 197e1c0d025Smrg echo "case some other package contains this missing '$1' program." 198e1c0d025Smrg ;; 199e1c0d025Smrg esac 200e1c0d025Smrg} 201e1c0d025Smrg 202e1c0d025Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 203e1c0d025Smrg -e '2,$s/^/ /' >&2 204e1c0d025Smrg 205e1c0d025Smrg# Propagate the correct exit status (expected to be 127 for a program 206e1c0d025Smrg# not found, 63 for a program that failed due to version mismatch). 207e1c0d025Smrgexit $st 2083da084b3Smrg 2093da084b3Smrg# Local variables: 2102a53b785Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 2113da084b3Smrg# time-stamp-start: "scriptversion=" 2123da084b3Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2132a53b785Smrg# time-stamp-time-zone: "UTC0" 21455acc8fcSmrg# time-stamp-end: "; # UTC" 2153da084b3Smrg# End: 216