missing revision f6d57fde
17a0395d0Smrg#! /bin/sh 2f6d57fdeSmrg# Common wrapper for a few potentially missing GNU and other programs. 37a0395d0Smrg 4f6d57fdeSmrgscriptversion=2024-06-07.14; # UTC 57a0395d0Smrg 6f6d57fdeSmrg# shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells 7f6d57fdeSmrg 8f6d57fdeSmrg# Copyright (C) 1996-2024 Free Software Foundation, Inc. 99a011757Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 107a0395d0Smrg 117a0395d0Smrg# This program is free software; you can redistribute it and/or modify 127a0395d0Smrg# it under the terms of the GNU General Public License as published by 137a0395d0Smrg# the Free Software Foundation; either version 2, or (at your option) 147a0395d0Smrg# any later version. 157a0395d0Smrg 167a0395d0Smrg# This program is distributed in the hope that it will be useful, 177a0395d0Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 187a0395d0Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 197a0395d0Smrg# GNU General Public License for more details. 207a0395d0Smrg 217a0395d0Smrg# You should have received a copy of the GNU General Public License 226c3c2bceSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 237a0395d0Smrg 247a0395d0Smrg# As a special exception to the GNU General Public License, if you 257a0395d0Smrg# distribute this file as part of a program that contains a 267a0395d0Smrg# configuration script generated by Autoconf, you may include it under 277a0395d0Smrg# the same distribution terms that you use for the rest of that program. 287a0395d0Smrg 297a0395d0Smrgif test $# -eq 0; then 308abc0ccfSmrg echo 1>&2 "Try '$0 --help' for more information" 317a0395d0Smrg exit 1 327a0395d0Smrgfi 337a0395d0Smrg 349a011757Smrgcase $1 in 357a0395d0Smrg 369a011757Smrg --is-lightweight) 379a011757Smrg # Used by our autoconf macros to check whether the available missing 389a011757Smrg # script is modern enough. 399a011757Smrg exit 0 409a011757Smrg ;; 417a0395d0Smrg 429a011757Smrg --run) 439a011757Smrg # Back-compat with the calling convention used by older automake. 449a011757Smrg shift 459a011757Smrg ;; 467a0395d0Smrg 477a0395d0Smrg -h|--h|--he|--hel|--help) 487a0395d0Smrg echo "\ 497a0395d0Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 507a0395d0Smrg 519a011757SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 529a011757Smrgto PROGRAM being missing or too old. 537a0395d0Smrg 547a0395d0SmrgOptions: 557a0395d0Smrg -h, --help display this help and exit 567a0395d0Smrg -v, --version output version information and exit 577a0395d0Smrg 587a0395d0SmrgSupported PROGRAM values: 59f6d57fdeSmrgaclocal autoconf autogen autoheader autom4te automake autoreconf 60f6d57fdeSmrgbison flex help2man lex makeinfo perl yacc 617a0395d0Smrg 628abc0ccfSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 638abc0ccfSmrg'g' are ignored when checking the name. 647366012aSmrg 65f6d57fdeSmrgReport bugs to <bug-automake@gnu.org>. 66f6d57fdeSmrgGNU Automake home page: <https://www.gnu.org/software/automake/>. 67f6d57fdeSmrgGeneral help using GNU software: <https://www.gnu.org/gethelp/>." 687a0395d0Smrg exit $? 697a0395d0Smrg ;; 707a0395d0Smrg 717a0395d0Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 72f6d57fdeSmrg echo "missing (GNU Automake) $scriptversion" 737a0395d0Smrg exit $? 747a0395d0Smrg ;; 757a0395d0Smrg 767a0395d0Smrg -*) 779a011757Smrg echo 1>&2 "$0: unknown '$1' option" 788abc0ccfSmrg echo 1>&2 "Try '$0 --help' for more information" 797a0395d0Smrg exit 1 807a0395d0Smrg ;; 817a0395d0Smrg 827a0395d0Smrgesac 837a0395d0Smrg 849a011757Smrg# Run the given program, remember its exit status. 859a011757Smrg"$@"; st=$? 869a011757Smrg 879a011757Smrg# If it succeeded, we are done. 889a011757Smrgtest $st -eq 0 && exit 0 899a011757Smrg 909a011757Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 919a011757Smrg# passed; such an option is passed most likely to detect whether the 929a011757Smrg# program is present and works. 939a011757Smrgcase $2 in --version|--help) exit $st;; esac 949a011757Smrg 959a011757Smrg# Exit code 63 means version mismatch. This often happens when the user 969a011757Smrg# tries to use an ancient version of a tool on a file that requires a 979a011757Smrg# minimum version. 989a011757Smrgif test $st -eq 63; then 999a011757Smrg msg="probably too old" 1009a011757Smrgelif test $st -eq 127; then 1019a011757Smrg # Program was missing. 1029a011757Smrg msg="missing on your system" 1039a011757Smrgelse 1049a011757Smrg # Program was found and executed, but failed. Give up. 1059a011757Smrg exit $st 1069a011757Smrgfi 1077a0395d0Smrg 1086c3c2bceSmrgperl_URL=https://www.perl.org/ 1096c3c2bceSmrgflex_URL=https://github.com/westes/flex 1106c3c2bceSmrggnu_software_URL=https://www.gnu.org/software 1119a011757Smrg 1129a011757Smrgprogram_details () 1139a011757Smrg{ 1149a011757Smrg case $1 in 115f6d57fdeSmrg aclocal|automake|autoreconf) 1169a011757Smrg echo "The '$1' program is part of the GNU Automake package:" 1179a011757Smrg echo "<$gnu_software_URL/automake>" 1189a011757Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1199a011757Smrg echo "<$gnu_software_URL/autoconf>" 1209a011757Smrg echo "<$gnu_software_URL/m4/>" 1219a011757Smrg echo "<$perl_URL>" 1229a011757Smrg ;; 1239a011757Smrg autoconf|autom4te|autoheader) 1249a011757Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1259a011757Smrg echo "<$gnu_software_URL/autoconf/>" 1269a011757Smrg echo "It also requires GNU m4 and Perl in order to run:" 1279a011757Smrg echo "<$gnu_software_URL/m4/>" 1289a011757Smrg echo "<$perl_URL>" 1299a011757Smrg ;; 130f6d57fdeSmrg *) 131f6d57fdeSmrg : 132f6d57fdeSmrg ;; 1339a011757Smrg esac 1349a011757Smrg} 1359a011757Smrg 1369a011757Smrggive_advice () 1379a011757Smrg{ 1389a011757Smrg # Normalize program name to check for. 1399a011757Smrg normalized_program=`echo "$1" | sed ' 1409a011757Smrg s/^gnu-//; t 1419a011757Smrg s/^gnu//; t 1429a011757Smrg s/^g//; t'` 1439a011757Smrg 1449a011757Smrg printf '%s\n' "'$1' is $msg." 1459a011757Smrg 1469a011757Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 147f6d57fdeSmrg autoheader_deps="'acconfig.h'" 148f6d57fdeSmrg automake_deps="'Makefile.am'" 149f6d57fdeSmrg aclocal_deps="'acinclude.m4'" 1509a011757Smrg case $normalized_program in 151f6d57fdeSmrg aclocal*) 152f6d57fdeSmrg echo "You should only need it if you modified $aclocal_deps or" 153f6d57fdeSmrg echo "$configure_deps." 154f6d57fdeSmrg ;; 1559a011757Smrg autoconf*) 156f6d57fdeSmrg echo "You should only need it if you modified $configure_deps." 157f6d57fdeSmrg ;; 158f6d57fdeSmrg autogen*) 159f6d57fdeSmrg echo "You should only need it if you modified a '.def' or '.tpl' file." 160f6d57fdeSmrg echo "You may want to install the GNU AutoGen package:" 161f6d57fdeSmrg echo "<$gnu_software_URL/autogen/>" 1629a011757Smrg ;; 1639a011757Smrg autoheader*) 164f6d57fdeSmrg echo "You should only need it if you modified $autoheader_deps or" 1659a011757Smrg echo "$configure_deps." 1669a011757Smrg ;; 1679a011757Smrg automake*) 168f6d57fdeSmrg echo "You should only need it if you modified $automake_deps or" 1699a011757Smrg echo "$configure_deps." 1709a011757Smrg ;; 171f6d57fdeSmrg autom4te*) 1729a011757Smrg echo "You might have modified some maintainer files that require" 17340c5344fSmrg echo "the 'autom4te' program to be rebuilt." 174f6d57fdeSmrg ;; 175f6d57fdeSmrg autoreconf*) 176f6d57fdeSmrg echo "You should only need it if you modified $aclocal_deps or" 177f6d57fdeSmrg echo "$automake_deps or $autoheader_deps or $automake_deps or" 178f6d57fdeSmrg echo "$configure_deps." 1799a011757Smrg ;; 1809a011757Smrg bison*|yacc*) 1819a011757Smrg echo "You should only need it if you modified a '.y' file." 1829a011757Smrg echo "You may want to install the GNU Bison package:" 1839a011757Smrg echo "<$gnu_software_URL/bison/>" 1849a011757Smrg ;; 1859a011757Smrg help2man*) 1869a011757Smrg echo "You should only need it if you modified a dependency" \ 1879a011757Smrg "of a man page." 1889a011757Smrg echo "You may want to install the GNU Help2man package:" 1899a011757Smrg echo "<$gnu_software_URL/help2man/>" 1907a0395d0Smrg ;; 191f6d57fdeSmrg lex*|flex*) 192f6d57fdeSmrg echo "You should only need it if you modified a '.l' file." 193f6d57fdeSmrg echo "You may want to install the Fast Lexical Analyzer package:" 194f6d57fdeSmrg echo "<$flex_URL>" 195f6d57fdeSmrg ;; 1969a011757Smrg makeinfo*) 1979a011757Smrg echo "You should only need it if you modified a '.texi' file, or" 1989a011757Smrg echo "any other file indirectly affecting the aspect of the manual." 1999a011757Smrg echo "You might want to install the Texinfo package:" 2009a011757Smrg echo "<$gnu_software_URL/texinfo/>" 2019a011757Smrg echo "The spurious makeinfo call might also be the consequence of" 2029a011757Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 2039a011757Smrg echo "want to install GNU make:" 2049a011757Smrg echo "<$gnu_software_URL/make/>" 2059a011757Smrg ;; 206f6d57fdeSmrg perl*) 207f6d57fdeSmrg echo "You should only need it to run GNU Autoconf, GNU Automake, " 208f6d57fdeSmrg echo " assorted other tools, or if you modified a Perl source file." 209f6d57fdeSmrg echo "You may want to install the Perl 5 language interpreter:" 210f6d57fdeSmrg echo "<$perl_URL>" 211f6d57fdeSmrg ;; 2129a011757Smrg *) 2139a011757Smrg echo "You might have modified some files without having the proper" 2149a011757Smrg echo "tools for further handling them. Check the 'README' file, it" 2159a011757Smrg echo "often tells you about the needed prerequisites for installing" 2169a011757Smrg echo "this package. You may also peek at any GNU archive site, in" 2179a011757Smrg echo "case some other package contains this missing '$1' program." 2189a011757Smrg ;; 2199a011757Smrg esac 220f6d57fdeSmrg program_details "$normalized_program" 2219a011757Smrg} 2229a011757Smrg 2239a011757Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2249a011757Smrg -e '2,$s/^/ /' >&2 2259a011757Smrg 2269a011757Smrg# Propagate the correct exit status (expected to be 127 for a program 2279a011757Smrg# not found, 63 for a program that failed due to version mismatch). 2289a011757Smrgexit $st 2297a0395d0Smrg 2307a0395d0Smrg# Local variables: 2316c3c2bceSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 2327a0395d0Smrg# time-stamp-start: "scriptversion=" 2337a0395d0Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2346c3c2bceSmrg# time-stamp-time-zone: "UTC0" 2357366012aSmrg# time-stamp-end: "; # UTC" 2367a0395d0Smrg# End: 237