missing revision 0f1ac3bc
14456fccdSmrg#! /bin/sh 23e6c936aSmrg# Common wrapper for a few potentially missing GNU programs. 34456fccdSmrg 40f1ac3bcSmrgscriptversion=2013-10-28.13; # UTC 54456fccdSmrg 63e6c936aSmrg# Copyright (C) 1996-2013 Free Software Foundation, Inc. 73e6c936aSmrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 84456fccdSmrg 94456fccdSmrg# This program is free software; you can redistribute it and/or modify 104456fccdSmrg# it under the terms of the GNU General Public License as published by 114456fccdSmrg# the Free Software Foundation; either version 2, or (at your option) 124456fccdSmrg# any later version. 134456fccdSmrg 144456fccdSmrg# This program is distributed in the hope that it will be useful, 154456fccdSmrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 164456fccdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 174456fccdSmrg# GNU General Public License for more details. 184456fccdSmrg 194456fccdSmrg# You should have received a copy of the GNU General Public License 2042d69509Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 214456fccdSmrg 224456fccdSmrg# As a special exception to the GNU General Public License, if you 234456fccdSmrg# distribute this file as part of a program that contains a 244456fccdSmrg# configuration script generated by Autoconf, you may include it under 254456fccdSmrg# the same distribution terms that you use for the rest of that program. 264456fccdSmrg 274456fccdSmrgif test $# -eq 0; then 283e6c936aSmrg echo 1>&2 "Try '$0 --help' for more information" 294456fccdSmrg exit 1 304456fccdSmrgfi 314456fccdSmrg 323e6c936aSmrgcase $1 in 334456fccdSmrg 343e6c936aSmrg --is-lightweight) 353e6c936aSmrg # Used by our autoconf macros to check whether the available missing 363e6c936aSmrg # script is modern enough. 373e6c936aSmrg exit 0 383e6c936aSmrg ;; 394456fccdSmrg 403e6c936aSmrg --run) 413e6c936aSmrg # Back-compat with the calling convention used by older automake. 423e6c936aSmrg shift 433e6c936aSmrg ;; 444456fccdSmrg 454456fccdSmrg -h|--h|--he|--hel|--help) 464456fccdSmrg echo "\ 474456fccdSmrg$0 [OPTION]... PROGRAM [ARGUMENT]... 484456fccdSmrg 493e6c936aSmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 503e6c936aSmrgto PROGRAM being missing or too old. 514456fccdSmrg 524456fccdSmrgOptions: 534456fccdSmrg -h, --help display this help and exit 544456fccdSmrg -v, --version output version information and exit 554456fccdSmrg 564456fccdSmrgSupported PROGRAM values: 573e6c936aSmrg aclocal autoconf autoheader autom4te automake makeinfo 583e6c936aSmrg bison yacc flex lex help2man 594456fccdSmrg 603e6c936aSmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 613e6c936aSmrg'g' are ignored when checking the name. 6242d69509Smrg 634456fccdSmrgSend bug reports to <bug-automake@gnu.org>." 644456fccdSmrg exit $? 654456fccdSmrg ;; 664456fccdSmrg 674456fccdSmrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 684456fccdSmrg echo "missing $scriptversion (GNU Automake)" 694456fccdSmrg exit $? 704456fccdSmrg ;; 714456fccdSmrg 724456fccdSmrg -*) 733e6c936aSmrg echo 1>&2 "$0: unknown '$1' option" 743e6c936aSmrg echo 1>&2 "Try '$0 --help' for more information" 754456fccdSmrg exit 1 764456fccdSmrg ;; 774456fccdSmrg 784456fccdSmrgesac 794456fccdSmrg 803e6c936aSmrg# Run the given program, remember its exit status. 813e6c936aSmrg"$@"; st=$? 823e6c936aSmrg 833e6c936aSmrg# If it succeeded, we are done. 843e6c936aSmrgtest $st -eq 0 && exit 0 853e6c936aSmrg 863e6c936aSmrg# Also exit now if we it failed (or wasn't found), and '--version' was 873e6c936aSmrg# passed; such an option is passed most likely to detect whether the 883e6c936aSmrg# program is present and works. 893e6c936aSmrgcase $2 in --version|--help) exit $st;; esac 903e6c936aSmrg 913e6c936aSmrg# Exit code 63 means version mismatch. This often happens when the user 923e6c936aSmrg# tries to use an ancient version of a tool on a file that requires a 933e6c936aSmrg# minimum version. 943e6c936aSmrgif test $st -eq 63; then 953e6c936aSmrg msg="probably too old" 963e6c936aSmrgelif test $st -eq 127; then 973e6c936aSmrg # Program was missing. 983e6c936aSmrg msg="missing on your system" 993e6c936aSmrgelse 1003e6c936aSmrg # Program was found and executed, but failed. Give up. 1013e6c936aSmrg exit $st 1023e6c936aSmrgfi 1034456fccdSmrg 1043e6c936aSmrgperl_URL=http://www.perl.org/ 1053e6c936aSmrgflex_URL=http://flex.sourceforge.net/ 1063e6c936aSmrggnu_software_URL=http://www.gnu.org/software 1073e6c936aSmrg 1083e6c936aSmrgprogram_details () 1093e6c936aSmrg{ 1103e6c936aSmrg case $1 in 1113e6c936aSmrg aclocal|automake) 1123e6c936aSmrg echo "The '$1' program is part of the GNU Automake package:" 1133e6c936aSmrg echo "<$gnu_software_URL/automake>" 1143e6c936aSmrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1153e6c936aSmrg echo "<$gnu_software_URL/autoconf>" 1163e6c936aSmrg echo "<$gnu_software_URL/m4/>" 1173e6c936aSmrg echo "<$perl_URL>" 1183e6c936aSmrg ;; 1193e6c936aSmrg autoconf|autom4te|autoheader) 1203e6c936aSmrg echo "The '$1' program is part of the GNU Autoconf package:" 1213e6c936aSmrg echo "<$gnu_software_URL/autoconf/>" 1223e6c936aSmrg echo "It also requires GNU m4 and Perl in order to run:" 1233e6c936aSmrg echo "<$gnu_software_URL/m4/>" 1243e6c936aSmrg echo "<$perl_URL>" 1253e6c936aSmrg ;; 1263e6c936aSmrg esac 1273e6c936aSmrg} 1283e6c936aSmrg 1293e6c936aSmrggive_advice () 1303e6c936aSmrg{ 1313e6c936aSmrg # Normalize program name to check for. 1323e6c936aSmrg normalized_program=`echo "$1" | sed ' 1333e6c936aSmrg s/^gnu-//; t 1343e6c936aSmrg s/^gnu//; t 1353e6c936aSmrg s/^g//; t'` 1363e6c936aSmrg 1373e6c936aSmrg printf '%s\n' "'$1' is $msg." 1383e6c936aSmrg 1393e6c936aSmrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1403e6c936aSmrg case $normalized_program in 1413e6c936aSmrg autoconf*) 1423e6c936aSmrg echo "You should only need it if you modified 'configure.ac'," 1433e6c936aSmrg echo "or m4 files included by it." 1443e6c936aSmrg program_details 'autoconf' 1453e6c936aSmrg ;; 1463e6c936aSmrg autoheader*) 1473e6c936aSmrg echo "You should only need it if you modified 'acconfig.h' or" 1483e6c936aSmrg echo "$configure_deps." 1493e6c936aSmrg program_details 'autoheader' 1503e6c936aSmrg ;; 1513e6c936aSmrg automake*) 1523e6c936aSmrg echo "You should only need it if you modified 'Makefile.am' or" 1533e6c936aSmrg echo "$configure_deps." 1543e6c936aSmrg program_details 'automake' 1553e6c936aSmrg ;; 1563e6c936aSmrg aclocal*) 1573e6c936aSmrg echo "You should only need it if you modified 'acinclude.m4' or" 1583e6c936aSmrg echo "$configure_deps." 1593e6c936aSmrg program_details 'aclocal' 1603e6c936aSmrg ;; 1613e6c936aSmrg autom4te*) 1623e6c936aSmrg echo "You might have modified some maintainer files that require" 1630f1ac3bcSmrg echo "the 'autom4te' program to be rebuilt." 1643e6c936aSmrg program_details 'autom4te' 1653e6c936aSmrg ;; 1663e6c936aSmrg bison*|yacc*) 1673e6c936aSmrg echo "You should only need it if you modified a '.y' file." 1683e6c936aSmrg echo "You may want to install the GNU Bison package:" 1693e6c936aSmrg echo "<$gnu_software_URL/bison/>" 1703e6c936aSmrg ;; 1713e6c936aSmrg lex*|flex*) 1723e6c936aSmrg echo "You should only need it if you modified a '.l' file." 1733e6c936aSmrg echo "You may want to install the Fast Lexical Analyzer package:" 1743e6c936aSmrg echo "<$flex_URL>" 1753e6c936aSmrg ;; 1763e6c936aSmrg help2man*) 1773e6c936aSmrg echo "You should only need it if you modified a dependency" \ 1783e6c936aSmrg "of a man page." 1793e6c936aSmrg echo "You may want to install the GNU Help2man package:" 1803e6c936aSmrg echo "<$gnu_software_URL/help2man/>" 1813e6c936aSmrg ;; 1823e6c936aSmrg makeinfo*) 1833e6c936aSmrg echo "You should only need it if you modified a '.texi' file, or" 1843e6c936aSmrg echo "any other file indirectly affecting the aspect of the manual." 1853e6c936aSmrg echo "You might want to install the Texinfo package:" 1863e6c936aSmrg echo "<$gnu_software_URL/texinfo/>" 1873e6c936aSmrg echo "The spurious makeinfo call might also be the consequence of" 1883e6c936aSmrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1893e6c936aSmrg echo "want to install GNU make:" 1903e6c936aSmrg echo "<$gnu_software_URL/make/>" 1913e6c936aSmrg ;; 1923e6c936aSmrg *) 1933e6c936aSmrg echo "You might have modified some files without having the proper" 1943e6c936aSmrg echo "tools for further handling them. Check the 'README' file, it" 1953e6c936aSmrg echo "often tells you about the needed prerequisites for installing" 1963e6c936aSmrg echo "this package. You may also peek at any GNU archive site, in" 1973e6c936aSmrg echo "case some other package contains this missing '$1' program." 1983e6c936aSmrg ;; 1993e6c936aSmrg esac 2003e6c936aSmrg} 2013e6c936aSmrg 2023e6c936aSmrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2033e6c936aSmrg -e '2,$s/^/ /' >&2 2043e6c936aSmrg 2053e6c936aSmrg# Propagate the correct exit status (expected to be 127 for a program 2063e6c936aSmrg# not found, 63 for a program that failed due to version mismatch). 2073e6c936aSmrgexit $st 2084456fccdSmrg 2094456fccdSmrg# Local variables: 2104456fccdSmrg# eval: (add-hook 'write-file-hooks 'time-stamp) 2114456fccdSmrg# time-stamp-start: "scriptversion=" 2124456fccdSmrg# time-stamp-format: "%:y-%02m-%02d.%02H" 21342d69509Smrg# time-stamp-time-zone: "UTC" 21442d69509Smrg# time-stamp-end: "; # UTC" 2154456fccdSmrg# End: 216