12c393a42Smrg#! /bin/sh 26fc018e4Smrg# Common wrapper for a few potentially missing GNU programs. 32c393a42Smrg 4a32e9e42Smrgscriptversion=2018-03-07.03; # UTC 52c393a42Smrg 6a32e9e42Smrg# Copyright (C) 1996-2018 Free Software Foundation, Inc. 76fc018e4Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 82c393a42Smrg 92c393a42Smrg# This program is free software; you can redistribute it and/or modify 102c393a42Smrg# it under the terms of the GNU General Public License as published by 112c393a42Smrg# the Free Software Foundation; either version 2, or (at your option) 122c393a42Smrg# any later version. 132c393a42Smrg 142c393a42Smrg# This program is distributed in the hope that it will be useful, 152c393a42Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 162c393a42Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 172c393a42Smrg# GNU General Public License for more details. 182c393a42Smrg 192c393a42Smrg# You should have received a copy of the GNU General Public License 20a32e9e42Smrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 212c393a42Smrg 222c393a42Smrg# As a special exception to the GNU General Public License, if you 232c393a42Smrg# distribute this file as part of a program that contains a 242c393a42Smrg# configuration script generated by Autoconf, you may include it under 252c393a42Smrg# the same distribution terms that you use for the rest of that program. 262c393a42Smrg 272c393a42Smrgif test $# -eq 0; then 28c9710b42Smrg echo 1>&2 "Try '$0 --help' for more information" 292c393a42Smrg exit 1 302c393a42Smrgfi 312c393a42Smrg 326fc018e4Smrgcase $1 in 332c393a42Smrg 346fc018e4Smrg --is-lightweight) 356fc018e4Smrg # Used by our autoconf macros to check whether the available missing 366fc018e4Smrg # script is modern enough. 376fc018e4Smrg exit 0 386fc018e4Smrg ;; 392c393a42Smrg 406fc018e4Smrg --run) 416fc018e4Smrg # Back-compat with the calling convention used by older automake. 426fc018e4Smrg shift 436fc018e4Smrg ;; 442c393a42Smrg 452c393a42Smrg -h|--h|--he|--hel|--help) 462c393a42Smrg echo "\ 472c393a42Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 482c393a42Smrg 496fc018e4SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 506fc018e4Smrgto PROGRAM being missing or too old. 512c393a42Smrg 522c393a42SmrgOptions: 532c393a42Smrg -h, --help display this help and exit 542c393a42Smrg -v, --version output version information and exit 552c393a42Smrg 562c393a42SmrgSupported PROGRAM values: 576fc018e4Smrg aclocal autoconf autoheader autom4te automake makeinfo 586fc018e4Smrg bison yacc flex lex help2man 592c393a42Smrg 60c9710b42SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 61c9710b42Smrg'g' are ignored when checking the name. 62a6844aabSmrg 632c393a42SmrgSend bug reports to <bug-automake@gnu.org>." 642c393a42Smrg exit $? 652c393a42Smrg ;; 662c393a42Smrg 672c393a42Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 682c393a42Smrg echo "missing $scriptversion (GNU Automake)" 692c393a42Smrg exit $? 702c393a42Smrg ;; 712c393a42Smrg 722c393a42Smrg -*) 736fc018e4Smrg echo 1>&2 "$0: unknown '$1' option" 74c9710b42Smrg echo 1>&2 "Try '$0 --help' for more information" 752c393a42Smrg exit 1 762c393a42Smrg ;; 772c393a42Smrg 782c393a42Smrgesac 792c393a42Smrg 806fc018e4Smrg# Run the given program, remember its exit status. 816fc018e4Smrg"$@"; st=$? 826fc018e4Smrg 836fc018e4Smrg# If it succeeded, we are done. 846fc018e4Smrgtest $st -eq 0 && exit 0 856fc018e4Smrg 866fc018e4Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 876fc018e4Smrg# passed; such an option is passed most likely to detect whether the 886fc018e4Smrg# program is present and works. 896fc018e4Smrgcase $2 in --version|--help) exit $st;; esac 906fc018e4Smrg 916fc018e4Smrg# Exit code 63 means version mismatch. This often happens when the user 926fc018e4Smrg# tries to use an ancient version of a tool on a file that requires a 936fc018e4Smrg# minimum version. 946fc018e4Smrgif test $st -eq 63; then 956fc018e4Smrg msg="probably too old" 966fc018e4Smrgelif test $st -eq 127; then 976fc018e4Smrg # Program was missing. 986fc018e4Smrg msg="missing on your system" 996fc018e4Smrgelse 1006fc018e4Smrg # Program was found and executed, but failed. Give up. 1016fc018e4Smrg exit $st 1026fc018e4Smrgfi 1032c393a42Smrg 104a32e9e42Smrgperl_URL=https://www.perl.org/ 105a32e9e42Smrgflex_URL=https://github.com/westes/flex 106a32e9e42Smrggnu_software_URL=https://www.gnu.org/software 1076fc018e4Smrg 1086fc018e4Smrgprogram_details () 1096fc018e4Smrg{ 1106fc018e4Smrg case $1 in 1116fc018e4Smrg aclocal|automake) 1126fc018e4Smrg echo "The '$1' program is part of the GNU Automake package:" 1136fc018e4Smrg echo "<$gnu_software_URL/automake>" 1146fc018e4Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1156fc018e4Smrg echo "<$gnu_software_URL/autoconf>" 1166fc018e4Smrg echo "<$gnu_software_URL/m4/>" 1176fc018e4Smrg echo "<$perl_URL>" 1186fc018e4Smrg ;; 1196fc018e4Smrg autoconf|autom4te|autoheader) 1206fc018e4Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1216fc018e4Smrg echo "<$gnu_software_URL/autoconf/>" 1226fc018e4Smrg echo "It also requires GNU m4 and Perl in order to run:" 1236fc018e4Smrg echo "<$gnu_software_URL/m4/>" 1246fc018e4Smrg echo "<$perl_URL>" 1256fc018e4Smrg ;; 1266fc018e4Smrg esac 1276fc018e4Smrg} 1286fc018e4Smrg 1296fc018e4Smrggive_advice () 1306fc018e4Smrg{ 1316fc018e4Smrg # Normalize program name to check for. 1326fc018e4Smrg normalized_program=`echo "$1" | sed ' 1336fc018e4Smrg s/^gnu-//; t 1346fc018e4Smrg s/^gnu//; t 1356fc018e4Smrg s/^g//; t'` 1366fc018e4Smrg 1376fc018e4Smrg printf '%s\n' "'$1' is $msg." 1386fc018e4Smrg 1396fc018e4Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1406fc018e4Smrg case $normalized_program in 1416fc018e4Smrg autoconf*) 1426fc018e4Smrg echo "You should only need it if you modified 'configure.ac'," 1436fc018e4Smrg echo "or m4 files included by it." 1446fc018e4Smrg program_details 'autoconf' 1456fc018e4Smrg ;; 1466fc018e4Smrg autoheader*) 1476fc018e4Smrg echo "You should only need it if you modified 'acconfig.h' or" 1486fc018e4Smrg echo "$configure_deps." 1496fc018e4Smrg program_details 'autoheader' 1506fc018e4Smrg ;; 1516fc018e4Smrg automake*) 1526fc018e4Smrg echo "You should only need it if you modified 'Makefile.am' or" 1536fc018e4Smrg echo "$configure_deps." 1546fc018e4Smrg program_details 'automake' 1556fc018e4Smrg ;; 1566fc018e4Smrg aclocal*) 1576fc018e4Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1586fc018e4Smrg echo "$configure_deps." 1596fc018e4Smrg program_details 'aclocal' 1606fc018e4Smrg ;; 1616fc018e4Smrg autom4te*) 1626fc018e4Smrg echo "You might have modified some maintainer files that require" 163953daebaSmrg echo "the 'autom4te' program to be rebuilt." 1646fc018e4Smrg program_details 'autom4te' 1656fc018e4Smrg ;; 1666fc018e4Smrg bison*|yacc*) 1676fc018e4Smrg echo "You should only need it if you modified a '.y' file." 1686fc018e4Smrg echo "You may want to install the GNU Bison package:" 1696fc018e4Smrg echo "<$gnu_software_URL/bison/>" 1706fc018e4Smrg ;; 1716fc018e4Smrg lex*|flex*) 1726fc018e4Smrg echo "You should only need it if you modified a '.l' file." 1736fc018e4Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1746fc018e4Smrg echo "<$flex_URL>" 1756fc018e4Smrg ;; 1766fc018e4Smrg help2man*) 1776fc018e4Smrg echo "You should only need it if you modified a dependency" \ 1786fc018e4Smrg "of a man page." 1796fc018e4Smrg echo "You may want to install the GNU Help2man package:" 1806fc018e4Smrg echo "<$gnu_software_URL/help2man/>" 1812c393a42Smrg ;; 1826fc018e4Smrg makeinfo*) 1836fc018e4Smrg echo "You should only need it if you modified a '.texi' file, or" 1846fc018e4Smrg echo "any other file indirectly affecting the aspect of the manual." 1856fc018e4Smrg echo "You might want to install the Texinfo package:" 1866fc018e4Smrg echo "<$gnu_software_URL/texinfo/>" 1876fc018e4Smrg echo "The spurious makeinfo call might also be the consequence of" 1886fc018e4Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1896fc018e4Smrg echo "want to install GNU make:" 1906fc018e4Smrg echo "<$gnu_software_URL/make/>" 1916fc018e4Smrg ;; 1926fc018e4Smrg *) 1936fc018e4Smrg echo "You might have modified some files without having the proper" 1946fc018e4Smrg echo "tools for further handling them. Check the 'README' file, it" 1956fc018e4Smrg echo "often tells you about the needed prerequisites for installing" 1966fc018e4Smrg echo "this package. You may also peek at any GNU archive site, in" 1976fc018e4Smrg echo "case some other package contains this missing '$1' program." 1986fc018e4Smrg ;; 1996fc018e4Smrg esac 2006fc018e4Smrg} 2016fc018e4Smrg 2026fc018e4Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2036fc018e4Smrg -e '2,$s/^/ /' >&2 2046fc018e4Smrg 2056fc018e4Smrg# Propagate the correct exit status (expected to be 127 for a program 2066fc018e4Smrg# not found, 63 for a program that failed due to version mismatch). 2076fc018e4Smrgexit $st 2082c393a42Smrg 2092c393a42Smrg# Local variables: 210a32e9e42Smrg# eval: (add-hook 'before-save-hook 'time-stamp) 2112c393a42Smrg# time-stamp-start: "scriptversion=" 2122c393a42Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213a32e9e42Smrg# time-stamp-time-zone: "UTC0" 214a6844aabSmrg# time-stamp-end: "; # UTC" 2152c393a42Smrg# End: 216