172b4363aSmrg#! /bin/sh 233dddc75Smrg# Common wrapper for a few potentially missing GNU programs. 372b4363aSmrg 47ed541caSmrgscriptversion=2018-03-07.03; # UTC 572b4363aSmrg 67ed541caSmrg# Copyright (C) 1996-2021 Free Software Foundation, Inc. 733dddc75Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 872b4363aSmrg 972b4363aSmrg# This program is free software; you can redistribute it and/or modify 1072b4363aSmrg# it under the terms of the GNU General Public License as published by 1172b4363aSmrg# the Free Software Foundation; either version 2, or (at your option) 1272b4363aSmrg# any later version. 1372b4363aSmrg 1472b4363aSmrg# This program is distributed in the hope that it will be useful, 1572b4363aSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1672b4363aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1772b4363aSmrg# GNU General Public License for more details. 1872b4363aSmrg 1972b4363aSmrg# You should have received a copy of the GNU General Public License 207ed541caSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 2172b4363aSmrg 2272b4363aSmrg# As a special exception to the GNU General Public License, if you 2372b4363aSmrg# distribute this file as part of a program that contains a 2472b4363aSmrg# configuration script generated by Autoconf, you may include it under 2572b4363aSmrg# the same distribution terms that you use for the rest of that program. 2672b4363aSmrg 2772b4363aSmrgif test $# -eq 0; then 2833dddc75Smrg echo 1>&2 "Try '$0 --help' for more information" 2972b4363aSmrg exit 1 3072b4363aSmrgfi 3172b4363aSmrg 3233dddc75Smrgcase $1 in 3372b4363aSmrg 3433dddc75Smrg --is-lightweight) 3533dddc75Smrg # Used by our autoconf macros to check whether the available missing 3633dddc75Smrg # script is modern enough. 3733dddc75Smrg exit 0 3833dddc75Smrg ;; 3972b4363aSmrg 4033dddc75Smrg --run) 4133dddc75Smrg # Back-compat with the calling convention used by older automake. 4233dddc75Smrg shift 4333dddc75Smrg ;; 4472b4363aSmrg 4572b4363aSmrg -h|--h|--he|--hel|--help) 4672b4363aSmrg echo "\ 4772b4363aSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4872b4363aSmrg 4933dddc75SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 5033dddc75Smrgto PROGRAM being missing or too old. 5172b4363aSmrg 5272b4363aSmrgOptions: 5372b4363aSmrg -h, --help display this help and exit 5472b4363aSmrg -v, --version output version information and exit 5572b4363aSmrg 5672b4363aSmrgSupported PROGRAM values: 5733dddc75Smrg aclocal autoconf autoheader autom4te automake makeinfo 5833dddc75Smrg bison yacc flex lex help2man 5972b4363aSmrg 6033dddc75SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 6133dddc75Smrg'g' are ignored when checking the name. 62dd77ae96Smrg 6372b4363aSmrgSend bug reports to <bug-automake@gnu.org>." 6472b4363aSmrg exit $? 6572b4363aSmrg ;; 6672b4363aSmrg 6772b4363aSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 6872b4363aSmrg echo "missing $scriptversion (GNU Automake)" 6972b4363aSmrg exit $? 7072b4363aSmrg ;; 7172b4363aSmrg 7272b4363aSmrg -*) 7333dddc75Smrg echo 1>&2 "$0: unknown '$1' option" 7433dddc75Smrg echo 1>&2 "Try '$0 --help' for more information" 7572b4363aSmrg exit 1 7672b4363aSmrg ;; 7772b4363aSmrg 7872b4363aSmrgesac 7972b4363aSmrg 8033dddc75Smrg# Run the given program, remember its exit status. 8133dddc75Smrg"$@"; st=$? 8233dddc75Smrg 8333dddc75Smrg# If it succeeded, we are done. 8433dddc75Smrgtest $st -eq 0 && exit 0 8533dddc75Smrg 8633dddc75Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 8733dddc75Smrg# passed; such an option is passed most likely to detect whether the 8833dddc75Smrg# program is present and works. 8933dddc75Smrgcase $2 in --version|--help) exit $st;; esac 9033dddc75Smrg 9133dddc75Smrg# Exit code 63 means version mismatch. This often happens when the user 9233dddc75Smrg# tries to use an ancient version of a tool on a file that requires a 9333dddc75Smrg# minimum version. 9433dddc75Smrgif test $st -eq 63; then 9533dddc75Smrg msg="probably too old" 9633dddc75Smrgelif test $st -eq 127; then 9733dddc75Smrg # Program was missing. 9833dddc75Smrg msg="missing on your system" 9933dddc75Smrgelse 10033dddc75Smrg # Program was found and executed, but failed. Give up. 10133dddc75Smrg exit $st 10233dddc75Smrgfi 10372b4363aSmrg 1047ed541caSmrgperl_URL=https://www.perl.org/ 1057ed541caSmrgflex_URL=https://github.com/westes/flex 1067ed541caSmrggnu_software_URL=https://www.gnu.org/software 10733dddc75Smrg 10833dddc75Smrgprogram_details () 10933dddc75Smrg{ 11033dddc75Smrg case $1 in 11133dddc75Smrg aclocal|automake) 11233dddc75Smrg echo "The '$1' program is part of the GNU Automake package:" 11333dddc75Smrg echo "<$gnu_software_URL/automake>" 11433dddc75Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 11533dddc75Smrg echo "<$gnu_software_URL/autoconf>" 11633dddc75Smrg echo "<$gnu_software_URL/m4/>" 11733dddc75Smrg echo "<$perl_URL>" 11833dddc75Smrg ;; 11933dddc75Smrg autoconf|autom4te|autoheader) 12033dddc75Smrg echo "The '$1' program is part of the GNU Autoconf package:" 12133dddc75Smrg echo "<$gnu_software_URL/autoconf/>" 12233dddc75Smrg echo "It also requires GNU m4 and Perl in order to run:" 12333dddc75Smrg echo "<$gnu_software_URL/m4/>" 12433dddc75Smrg echo "<$perl_URL>" 12533dddc75Smrg ;; 12633dddc75Smrg esac 12733dddc75Smrg} 12833dddc75Smrg 12933dddc75Smrggive_advice () 13033dddc75Smrg{ 13133dddc75Smrg # Normalize program name to check for. 13233dddc75Smrg normalized_program=`echo "$1" | sed ' 13333dddc75Smrg s/^gnu-//; t 13433dddc75Smrg s/^gnu//; t 13533dddc75Smrg s/^g//; t'` 13633dddc75Smrg 13733dddc75Smrg printf '%s\n' "'$1' is $msg." 13833dddc75Smrg 13933dddc75Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 14033dddc75Smrg case $normalized_program in 14133dddc75Smrg autoconf*) 14233dddc75Smrg echo "You should only need it if you modified 'configure.ac'," 14333dddc75Smrg echo "or m4 files included by it." 14433dddc75Smrg program_details 'autoconf' 14533dddc75Smrg ;; 14633dddc75Smrg autoheader*) 14733dddc75Smrg echo "You should only need it if you modified 'acconfig.h' or" 14833dddc75Smrg echo "$configure_deps." 14933dddc75Smrg program_details 'autoheader' 15033dddc75Smrg ;; 15133dddc75Smrg automake*) 15233dddc75Smrg echo "You should only need it if you modified 'Makefile.am' or" 15333dddc75Smrg echo "$configure_deps." 15433dddc75Smrg program_details 'automake' 15533dddc75Smrg ;; 15633dddc75Smrg aclocal*) 15733dddc75Smrg echo "You should only need it if you modified 'acinclude.m4' or" 15833dddc75Smrg echo "$configure_deps." 15933dddc75Smrg program_details 'aclocal' 16033dddc75Smrg ;; 16133dddc75Smrg autom4te*) 16233dddc75Smrg echo "You might have modified some maintainer files that require" 16333dddc75Smrg echo "the 'autom4te' program to be rebuilt." 16433dddc75Smrg program_details 'autom4te' 16533dddc75Smrg ;; 16633dddc75Smrg bison*|yacc*) 16733dddc75Smrg echo "You should only need it if you modified a '.y' file." 16833dddc75Smrg echo "You may want to install the GNU Bison package:" 16933dddc75Smrg echo "<$gnu_software_URL/bison/>" 17033dddc75Smrg ;; 17133dddc75Smrg lex*|flex*) 17233dddc75Smrg echo "You should only need it if you modified a '.l' file." 17333dddc75Smrg echo "You may want to install the Fast Lexical Analyzer package:" 17433dddc75Smrg echo "<$flex_URL>" 17533dddc75Smrg ;; 17633dddc75Smrg help2man*) 17733dddc75Smrg echo "You should only need it if you modified a dependency" \ 17833dddc75Smrg "of a man page." 17933dddc75Smrg echo "You may want to install the GNU Help2man package:" 18033dddc75Smrg echo "<$gnu_software_URL/help2man/>" 18133dddc75Smrg ;; 18233dddc75Smrg makeinfo*) 18333dddc75Smrg echo "You should only need it if you modified a '.texi' file, or" 18433dddc75Smrg echo "any other file indirectly affecting the aspect of the manual." 18533dddc75Smrg echo "You might want to install the Texinfo package:" 18633dddc75Smrg echo "<$gnu_software_URL/texinfo/>" 18733dddc75Smrg echo "The spurious makeinfo call might also be the consequence of" 18833dddc75Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 18933dddc75Smrg echo "want to install GNU make:" 19033dddc75Smrg echo "<$gnu_software_URL/make/>" 19133dddc75Smrg ;; 19233dddc75Smrg *) 19333dddc75Smrg echo "You might have modified some files without having the proper" 19433dddc75Smrg echo "tools for further handling them. Check the 'README' file, it" 19533dddc75Smrg echo "often tells you about the needed prerequisites for installing" 19633dddc75Smrg echo "this package. You may also peek at any GNU archive site, in" 19733dddc75Smrg echo "case some other package contains this missing '$1' program." 19833dddc75Smrg ;; 19933dddc75Smrg esac 20033dddc75Smrg} 20133dddc75Smrg 20233dddc75Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 20333dddc75Smrg -e '2,$s/^/ /' >&2 20433dddc75Smrg 20533dddc75Smrg# Propagate the correct exit status (expected to be 127 for a program 20633dddc75Smrg# not found, 63 for a program that failed due to version mismatch). 20733dddc75Smrgexit $st 20872b4363aSmrg 20972b4363aSmrg# Local variables: 2107ed541caSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 21172b4363aSmrg# time-stamp-start: "scriptversion=" 21272b4363aSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2137ed541caSmrg# time-stamp-time-zone: "UTC0" 214dd77ae96Smrg# time-stamp-end: "; # UTC" 21572b4363aSmrg# End: 216