missing revision 10f94802
1a253d6aeSmrg#! /bin/sh 210f94802Smrg# Common wrapper for a few potentially missing GNU and other programs. 3a253d6aeSmrg 410f94802Smrgscriptversion=2024-06-07.14; # UTC 5a253d6aeSmrg 610f94802Smrg# shellcheck disable=SC2006,SC2268 # we must support pre-POSIX shells 710f94802Smrg 810f94802Smrg# Copyright (C) 1996-2024 Free Software Foundation, Inc. 957ee1794Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 10a253d6aeSmrg 11a253d6aeSmrg# This program is free software; you can redistribute it and/or modify 12a253d6aeSmrg# it under the terms of the GNU General Public License as published by 13a253d6aeSmrg# the Free Software Foundation; either version 2, or (at your option) 14a253d6aeSmrg# any later version. 15a253d6aeSmrg 16a253d6aeSmrg# This program is distributed in the hope that it will be useful, 17a253d6aeSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 18a253d6aeSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19a253d6aeSmrg# GNU General Public License for more details. 20a253d6aeSmrg 21a253d6aeSmrg# You should have received a copy of the GNU General Public License 22b41a30aaSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 23a253d6aeSmrg 24a253d6aeSmrg# As a special exception to the GNU General Public License, if you 25a253d6aeSmrg# distribute this file as part of a program that contains a 26a253d6aeSmrg# configuration script generated by Autoconf, you may include it under 27a253d6aeSmrg# the same distribution terms that you use for the rest of that program. 28a253d6aeSmrg 29a253d6aeSmrgif test $# -eq 0; then 3057ee1794Smrg echo 1>&2 "Try '$0 --help' for more information" 31a253d6aeSmrg exit 1 32a253d6aeSmrgfi 33a253d6aeSmrg 3457ee1794Smrgcase $1 in 35a253d6aeSmrg 3657ee1794Smrg --is-lightweight) 3757ee1794Smrg # Used by our autoconf macros to check whether the available missing 3857ee1794Smrg # script is modern enough. 3957ee1794Smrg exit 0 4057ee1794Smrg ;; 41a253d6aeSmrg 4257ee1794Smrg --run) 4357ee1794Smrg # Back-compat with the calling convention used by older automake. 4457ee1794Smrg shift 4557ee1794Smrg ;; 46a253d6aeSmrg 47a253d6aeSmrg -h|--h|--he|--hel|--help) 48a253d6aeSmrg echo "\ 49a253d6aeSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 50a253d6aeSmrg 5157ee1794SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5257ee1794Smrgto PROGRAM being missing or too old. 53a253d6aeSmrg 54a253d6aeSmrgOptions: 55a253d6aeSmrg -h, --help display this help and exit 56a253d6aeSmrg -v, --version output version information and exit 57a253d6aeSmrg 58a253d6aeSmrgSupported PROGRAM values: 5910f94802Smrgaclocal autoconf autogen autoheader autom4te automake autoreconf 6010f94802Smrgbison flex help2man lex makeinfo perl yacc 61a253d6aeSmrg 6257ee1794SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6357ee1794Smrg'g' are ignored when checking the name. 6425b89263Smrg 6510f94802SmrgReport bugs to <bug-automake@gnu.org>. 6610f94802SmrgGNU Automake home page: <https://www.gnu.org/software/automake/>. 6710f94802SmrgGeneral help using GNU software: <https://www.gnu.org/gethelp/>." 68a253d6aeSmrg exit $? 69a253d6aeSmrg ;; 70a253d6aeSmrg 71a253d6aeSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 7210f94802Smrg echo "missing (GNU Automake) $scriptversion" 73a253d6aeSmrg exit $? 74a253d6aeSmrg ;; 75a253d6aeSmrg 76a253d6aeSmrg -*) 7757ee1794Smrg echo 1>&2 "$0: unknown '$1' option" 7857ee1794Smrg echo 1>&2 "Try '$0 --help' for more information" 79a253d6aeSmrg exit 1 80a253d6aeSmrg ;; 81a253d6aeSmrg 82a253d6aeSmrgesac 83a253d6aeSmrg 8457ee1794Smrg# Run the given program, remember its exit status. 8557ee1794Smrg"$@"; st=$? 8657ee1794Smrg 8757ee1794Smrg# If it succeeded, we are done. 8857ee1794Smrgtest $st -eq 0 && exit 0 8957ee1794Smrg 9057ee1794Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 9157ee1794Smrg# passed; such an option is passed most likely to detect whether the 9257ee1794Smrg# program is present and works. 9357ee1794Smrgcase $2 in --version|--help) exit $st;; esac 9457ee1794Smrg 9557ee1794Smrg# Exit code 63 means version mismatch. This often happens when the user 9657ee1794Smrg# tries to use an ancient version of a tool on a file that requires a 9757ee1794Smrg# minimum version. 9857ee1794Smrgif test $st -eq 63; then 9957ee1794Smrg msg="probably too old" 10057ee1794Smrgelif test $st -eq 127; then 10157ee1794Smrg # Program was missing. 10257ee1794Smrg msg="missing on your system" 10357ee1794Smrgelse 10457ee1794Smrg # Program was found and executed, but failed. Give up. 10557ee1794Smrg exit $st 10657ee1794Smrgfi 107a253d6aeSmrg 108b41a30aaSmrgperl_URL=https://www.perl.org/ 109b41a30aaSmrgflex_URL=https://github.com/westes/flex 110b41a30aaSmrggnu_software_URL=https://www.gnu.org/software 11157ee1794Smrg 11257ee1794Smrgprogram_details () 11357ee1794Smrg{ 11457ee1794Smrg case $1 in 11510f94802Smrg aclocal|automake|autoreconf) 11657ee1794Smrg echo "The '$1' program is part of the GNU Automake package:" 11757ee1794Smrg echo "<$gnu_software_URL/automake>" 11857ee1794Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11957ee1794Smrg echo "<$gnu_software_URL/autoconf>" 12057ee1794Smrg echo "<$gnu_software_URL/m4/>" 12157ee1794Smrg echo "<$perl_URL>" 12257ee1794Smrg ;; 12357ee1794Smrg autoconf|autom4te|autoheader) 12457ee1794Smrg echo "The '$1' program is part of the GNU Autoconf package:" 12557ee1794Smrg echo "<$gnu_software_URL/autoconf/>" 12657ee1794Smrg echo "It also requires GNU m4 and Perl in order to run:" 12757ee1794Smrg echo "<$gnu_software_URL/m4/>" 12857ee1794Smrg echo "<$perl_URL>" 12957ee1794Smrg ;; 13010f94802Smrg *) 13110f94802Smrg : 13210f94802Smrg ;; 13357ee1794Smrg esac 13457ee1794Smrg} 13557ee1794Smrg 13657ee1794Smrggive_advice () 13757ee1794Smrg{ 13857ee1794Smrg # Normalize program name to check for. 13957ee1794Smrg normalized_program=`echo "$1" | sed ' 14057ee1794Smrg s/^gnu-//; t 14157ee1794Smrg s/^gnu//; t 14257ee1794Smrg s/^g//; t'` 14357ee1794Smrg 14457ee1794Smrg printf '%s\n' "'$1' is $msg." 14557ee1794Smrg 14657ee1794Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14710f94802Smrg autoheader_deps="'acconfig.h'" 14810f94802Smrg automake_deps="'Makefile.am'" 14910f94802Smrg aclocal_deps="'acinclude.m4'" 15057ee1794Smrg case $normalized_program in 15110f94802Smrg aclocal*) 15210f94802Smrg echo "You should only need it if you modified $aclocal_deps or" 15310f94802Smrg echo "$configure_deps." 15410f94802Smrg ;; 15557ee1794Smrg autoconf*) 15610f94802Smrg echo "You should only need it if you modified $configure_deps." 15710f94802Smrg ;; 15810f94802Smrg autogen*) 15910f94802Smrg echo "You should only need it if you modified a '.def' or '.tpl' file." 16010f94802Smrg echo "You may want to install the GNU AutoGen package:" 16110f94802Smrg echo "<$gnu_software_URL/autogen/>" 16257ee1794Smrg ;; 16357ee1794Smrg autoheader*) 16410f94802Smrg echo "You should only need it if you modified $autoheader_deps or" 16557ee1794Smrg echo "$configure_deps." 16657ee1794Smrg ;; 16757ee1794Smrg automake*) 16810f94802Smrg echo "You should only need it if you modified $automake_deps or" 16957ee1794Smrg echo "$configure_deps." 17057ee1794Smrg ;; 17110f94802Smrg autom4te*) 17257ee1794Smrg echo "You might have modified some maintainer files that require" 17331637056Smrg echo "the 'autom4te' program to be rebuilt." 17410f94802Smrg ;; 17510f94802Smrg autoreconf*) 17610f94802Smrg echo "You should only need it if you modified $aclocal_deps or" 17710f94802Smrg echo "$automake_deps or $autoheader_deps or $automake_deps or" 17810f94802Smrg echo "$configure_deps." 17957ee1794Smrg ;; 18057ee1794Smrg bison*|yacc*) 18157ee1794Smrg echo "You should only need it if you modified a '.y' file." 18257ee1794Smrg echo "You may want to install the GNU Bison package:" 18357ee1794Smrg echo "<$gnu_software_URL/bison/>" 18457ee1794Smrg ;; 18557ee1794Smrg help2man*) 18657ee1794Smrg echo "You should only need it if you modified a dependency" \ 18757ee1794Smrg "of a man page." 18857ee1794Smrg echo "You may want to install the GNU Help2man package:" 18957ee1794Smrg echo "<$gnu_software_URL/help2man/>" 19057ee1794Smrg ;; 19110f94802Smrg lex*|flex*) 19210f94802Smrg echo "You should only need it if you modified a '.l' file." 19310f94802Smrg echo "You may want to install the Fast Lexical Analyzer package:" 19410f94802Smrg echo "<$flex_URL>" 19510f94802Smrg ;; 19657ee1794Smrg makeinfo*) 19757ee1794Smrg echo "You should only need it if you modified a '.texi' file, or" 19857ee1794Smrg echo "any other file indirectly affecting the aspect of the manual." 19957ee1794Smrg echo "You might want to install the Texinfo package:" 20057ee1794Smrg echo "<$gnu_software_URL/texinfo/>" 20157ee1794Smrg echo "The spurious makeinfo call might also be the consequence of" 20257ee1794Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 20357ee1794Smrg echo "want to install GNU make:" 20457ee1794Smrg echo "<$gnu_software_URL/make/>" 20557ee1794Smrg ;; 20610f94802Smrg perl*) 20710f94802Smrg echo "You should only need it to run GNU Autoconf, GNU Automake, " 20810f94802Smrg echo " assorted other tools, or if you modified a Perl source file." 20910f94802Smrg echo "You may want to install the Perl 5 language interpreter:" 21010f94802Smrg echo "<$perl_URL>" 21110f94802Smrg ;; 21257ee1794Smrg *) 21357ee1794Smrg echo "You might have modified some files without having the proper" 21457ee1794Smrg echo "tools for further handling them. Check the 'README' file, it" 21557ee1794Smrg echo "often tells you about the needed prerequisites for installing" 21657ee1794Smrg echo "this package. You may also peek at any GNU archive site, in" 21757ee1794Smrg echo "case some other package contains this missing '$1' program." 21857ee1794Smrg ;; 21957ee1794Smrg esac 22010f94802Smrg program_details "$normalized_program" 22157ee1794Smrg} 22257ee1794Smrg 22357ee1794Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 22457ee1794Smrg -e '2,$s/^/ /' >&2 22557ee1794Smrg 22657ee1794Smrg# Propagate the correct exit status (expected to be 127 for a program 22757ee1794Smrg# not found, 63 for a program that failed due to version mismatch). 22857ee1794Smrgexit $st 229a253d6aeSmrg 230a253d6aeSmrg# Local variables: 231b41a30aaSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 232a253d6aeSmrg# time-stamp-start: "scriptversion=" 233a253d6aeSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 234b41a30aaSmrg# time-stamp-time-zone: "UTC0" 23525b89263Smrg# time-stamp-end: "; # UTC" 236a253d6aeSmrg# End: 237