missing revision ea148d1d
1ea148d1dSmrg#! /bin/sh 26ef05171Smrg# Common wrapper for a few potentially missing GNU programs. 343f32c10Smrg 4ea148d1dSmrgscriptversion=2018-03-07.03; # UTC 543f32c10Smrg 6ea148d1dSmrg# Copyright (C) 1996-2018 Free Software Foundation, Inc. 76ef05171Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 843f32c10Smrg 943f32c10Smrg# This program is free software; you can redistribute it and/or modify 1043f32c10Smrg# it under the terms of the GNU General Public License as published by 1143f32c10Smrg# the Free Software Foundation; either version 2, or (at your option) 1243f32c10Smrg# any later version. 1343f32c10Smrg 1443f32c10Smrg# This program is distributed in the hope that it will be useful, 1543f32c10Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 1643f32c10Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1743f32c10Smrg# GNU General Public License for more details. 1843f32c10Smrg 1943f32c10Smrg# You should have received a copy of the GNU General Public License 20ea148d1dSmrg# along with this program. If not, see <https://www.gnu.org/licenses/>. 2143f32c10Smrg 2243f32c10Smrg# As a special exception to the GNU General Public License, if you 2343f32c10Smrg# distribute this file as part of a program that contains a 2443f32c10Smrg# configuration script generated by Autoconf, you may include it under 2543f32c10Smrg# the same distribution terms that you use for the rest of that program. 2643f32c10Smrg 2743f32c10Smrgif test $# -eq 0; then 286ef05171Smrg echo 1>&2 "Try '$0 --help' for more information" 2943f32c10Smrg exit 1 3043f32c10Smrgfi 3143f32c10Smrg 326ef05171Smrgcase $1 in 3343f32c10Smrg 346ef05171Smrg --is-lightweight) 356ef05171Smrg # Used by our autoconf macros to check whether the available missing 366ef05171Smrg # script is modern enough. 376ef05171Smrg exit 0 386ef05171Smrg ;; 3943f32c10Smrg 406ef05171Smrg --run) 416ef05171Smrg # Back-compat with the calling convention used by older automake. 426ef05171Smrg shift 436ef05171Smrg ;; 4443f32c10Smrg 4543f32c10Smrg -h|--h|--he|--hel|--help) 4643f32c10Smrg echo "\ 4743f32c10Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 4843f32c10Smrg 496ef05171SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 506ef05171Smrgto PROGRAM being missing or too old. 5143f32c10Smrg 5243f32c10SmrgOptions: 5343f32c10Smrg -h, --help display this help and exit 5443f32c10Smrg -v, --version output version information and exit 5543f32c10Smrg 5643f32c10SmrgSupported PROGRAM values: 576ef05171Smrg aclocal autoconf autoheader autom4te automake makeinfo 586ef05171Smrg bison yacc flex lex help2man 596ef05171Smrg 606ef05171SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 616ef05171Smrg'g' are ignored when checking the name. 6243f32c10Smrg 6343f32c10SmrgSend bug reports to <bug-automake@gnu.org>." 6443f32c10Smrg exit $? 6543f32c10Smrg ;; 6643f32c10Smrg 6743f32c10Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 6843f32c10Smrg echo "missing $scriptversion (GNU Automake)" 6943f32c10Smrg exit $? 7043f32c10Smrg ;; 7143f32c10Smrg 7243f32c10Smrg -*) 736ef05171Smrg echo 1>&2 "$0: unknown '$1' option" 746ef05171Smrg echo 1>&2 "Try '$0 --help' for more information" 7543f32c10Smrg exit 1 7643f32c10Smrg ;; 7743f32c10Smrg 7843f32c10Smrgesac 7943f32c10Smrg 806ef05171Smrg# Run the given program, remember its exit status. 816ef05171Smrg"$@"; st=$? 826ef05171Smrg 836ef05171Smrg# If it succeeded, we are done. 846ef05171Smrgtest $st -eq 0 && exit 0 856ef05171Smrg 866ef05171Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 876ef05171Smrg# passed; such an option is passed most likely to detect whether the 886ef05171Smrg# program is present and works. 896ef05171Smrgcase $2 in --version|--help) exit $st;; esac 906ef05171Smrg 916ef05171Smrg# Exit code 63 means version mismatch. This often happens when the user 926ef05171Smrg# tries to use an ancient version of a tool on a file that requires a 936ef05171Smrg# minimum version. 946ef05171Smrgif test $st -eq 63; then 956ef05171Smrg msg="probably too old" 966ef05171Smrgelif test $st -eq 127; then 976ef05171Smrg # Program was missing. 986ef05171Smrg msg="missing on your system" 996ef05171Smrgelse 1006ef05171Smrg # Program was found and executed, but failed. Give up. 1016ef05171Smrg exit $st 1026ef05171Smrgfi 10343f32c10Smrg 104ea148d1dSmrgperl_URL=https://www.perl.org/ 105ea148d1dSmrgflex_URL=https://github.com/westes/flex 106ea148d1dSmrggnu_software_URL=https://www.gnu.org/software 1076ef05171Smrg 1086ef05171Smrgprogram_details () 1096ef05171Smrg{ 1106ef05171Smrg case $1 in 1116ef05171Smrg aclocal|automake) 1126ef05171Smrg echo "The '$1' program is part of the GNU Automake package:" 1136ef05171Smrg echo "<$gnu_software_URL/automake>" 1146ef05171Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1156ef05171Smrg echo "<$gnu_software_URL/autoconf>" 1166ef05171Smrg echo "<$gnu_software_URL/m4/>" 1176ef05171Smrg echo "<$perl_URL>" 1186ef05171Smrg ;; 1196ef05171Smrg autoconf|autom4te|autoheader) 1206ef05171Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1216ef05171Smrg echo "<$gnu_software_URL/autoconf/>" 1226ef05171Smrg echo "It also requires GNU m4 and Perl in order to run:" 1236ef05171Smrg echo "<$gnu_software_URL/m4/>" 1246ef05171Smrg echo "<$perl_URL>" 1256ef05171Smrg ;; 1266ef05171Smrg esac 1276ef05171Smrg} 1286ef05171Smrg 1296ef05171Smrggive_advice () 1306ef05171Smrg{ 1316ef05171Smrg # Normalize program name to check for. 1326ef05171Smrg normalized_program=`echo "$1" | sed ' 1336ef05171Smrg s/^gnu-//; t 1346ef05171Smrg s/^gnu//; t 1356ef05171Smrg s/^g//; t'` 1366ef05171Smrg 1376ef05171Smrg printf '%s\n' "'$1' is $msg." 1386ef05171Smrg 1396ef05171Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1406ef05171Smrg case $normalized_program in 1416ef05171Smrg autoconf*) 1426ef05171Smrg echo "You should only need it if you modified 'configure.ac'," 1436ef05171Smrg echo "or m4 files included by it." 1446ef05171Smrg program_details 'autoconf' 1456ef05171Smrg ;; 1466ef05171Smrg autoheader*) 1476ef05171Smrg echo "You should only need it if you modified 'acconfig.h' or" 1486ef05171Smrg echo "$configure_deps." 1496ef05171Smrg program_details 'autoheader' 1506ef05171Smrg ;; 1516ef05171Smrg automake*) 1526ef05171Smrg echo "You should only need it if you modified 'Makefile.am' or" 1536ef05171Smrg echo "$configure_deps." 1546ef05171Smrg program_details 'automake' 1556ef05171Smrg ;; 1566ef05171Smrg aclocal*) 1576ef05171Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1586ef05171Smrg echo "$configure_deps." 1596ef05171Smrg program_details 'aclocal' 1606ef05171Smrg ;; 1616ef05171Smrg autom4te*) 1626ef05171Smrg echo "You might have modified some maintainer files that require" 1636ef05171Smrg echo "the 'autom4te' program to be rebuilt." 1646ef05171Smrg program_details 'autom4te' 1656ef05171Smrg ;; 1666ef05171Smrg bison*|yacc*) 1676ef05171Smrg echo "You should only need it if you modified a '.y' file." 1686ef05171Smrg echo "You may want to install the GNU Bison package:" 1696ef05171Smrg echo "<$gnu_software_URL/bison/>" 1706ef05171Smrg ;; 1716ef05171Smrg lex*|flex*) 1726ef05171Smrg echo "You should only need it if you modified a '.l' file." 1736ef05171Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1746ef05171Smrg echo "<$flex_URL>" 1756ef05171Smrg ;; 1766ef05171Smrg help2man*) 1776ef05171Smrg echo "You should only need it if you modified a dependency" \ 1786ef05171Smrg "of a man page." 1796ef05171Smrg echo "You may want to install the GNU Help2man package:" 1806ef05171Smrg echo "<$gnu_software_URL/help2man/>" 1816ef05171Smrg ;; 1826ef05171Smrg makeinfo*) 1836ef05171Smrg echo "You should only need it if you modified a '.texi' file, or" 1846ef05171Smrg echo "any other file indirectly affecting the aspect of the manual." 1856ef05171Smrg echo "You might want to install the Texinfo package:" 1866ef05171Smrg echo "<$gnu_software_URL/texinfo/>" 1876ef05171Smrg echo "The spurious makeinfo call might also be the consequence of" 1886ef05171Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1896ef05171Smrg echo "want to install GNU make:" 1906ef05171Smrg echo "<$gnu_software_URL/make/>" 1916ef05171Smrg ;; 1926ef05171Smrg *) 1936ef05171Smrg echo "You might have modified some files without having the proper" 1946ef05171Smrg echo "tools for further handling them. Check the 'README' file, it" 1956ef05171Smrg echo "often tells you about the needed prerequisites for installing" 1966ef05171Smrg echo "this package. You may also peek at any GNU archive site, in" 1976ef05171Smrg echo "case some other package contains this missing '$1' program." 1986ef05171Smrg ;; 1996ef05171Smrg esac 2006ef05171Smrg} 2016ef05171Smrg 2026ef05171Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2036ef05171Smrg -e '2,$s/^/ /' >&2 2046ef05171Smrg 2056ef05171Smrg# Propagate the correct exit status (expected to be 127 for a program 2066ef05171Smrg# not found, 63 for a program that failed due to version mismatch). 2076ef05171Smrgexit $st 20843f32c10Smrg 20943f32c10Smrg# Local variables: 210ea148d1dSmrg# eval: (add-hook 'before-save-hook 'time-stamp) 21143f32c10Smrg# time-stamp-start: "scriptversion=" 21243f32c10Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 2136ef05171Smrg# time-stamp-time-zone: "UTC0" 2146ef05171Smrg# time-stamp-end: "; # UTC" 21543f32c10Smrg# End: 216