missing revision 3e999d35
13da7aff1Smrg#! /bin/sh 23e999d35Smrg# Common wrapper for a few potentially missing GNU programs. 3e531b1a7Smrg 43e999d35Smrgscriptversion=2013-10-28.13; # UTC 5e531b1a7Smrg 63e999d35Smrg# Copyright (C) 1996-2014 Free Software Foundation, Inc. 73e999d35Smrg# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. 83da7aff1Smrg 93da7aff1Smrg# This program is free software; you can redistribute it and/or modify 103da7aff1Smrg# it under the terms of the GNU General Public License as published by 113da7aff1Smrg# the Free Software Foundation; either version 2, or (at your option) 123da7aff1Smrg# any later version. 133da7aff1Smrg 143da7aff1Smrg# This program is distributed in the hope that it will be useful, 153da7aff1Smrg# but WITHOUT ANY WARRANTY; without even the implied warranty of 163da7aff1Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 173da7aff1Smrg# GNU General Public License for more details. 183da7aff1Smrg 193da7aff1Smrg# You should have received a copy of the GNU General Public License 20e531b1a7Smrg# along with this program. If not, see <http://www.gnu.org/licenses/>. 213da7aff1Smrg 223da7aff1Smrg# As a special exception to the GNU General Public License, if you 233da7aff1Smrg# distribute this file as part of a program that contains a 243da7aff1Smrg# configuration script generated by Autoconf, you may include it under 253da7aff1Smrg# the same distribution terms that you use for the rest of that program. 263da7aff1Smrg 273da7aff1Smrgif test $# -eq 0; then 283e999d35Smrg echo 1>&2 "Try '$0 --help' for more information" 293da7aff1Smrg exit 1 303da7aff1Smrgfi 313da7aff1Smrg 323e999d35Smrgcase $1 in 333da7aff1Smrg 343e999d35Smrg --is-lightweight) 353e999d35Smrg # Used by our autoconf macros to check whether the available missing 363e999d35Smrg # script is modern enough. 373e999d35Smrg exit 0 383e999d35Smrg ;; 39e531b1a7Smrg 403e999d35Smrg --run) 413e999d35Smrg # Back-compat with the calling convention used by older automake. 423e999d35Smrg shift 433e999d35Smrg ;; 443da7aff1Smrg 453da7aff1Smrg -h|--h|--he|--hel|--help) 463da7aff1Smrg echo "\ 473da7aff1Smrg$0 [OPTION]... PROGRAM [ARGUMENT]... 483da7aff1Smrg 493e999d35SmrgRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due 503e999d35Smrgto PROGRAM being missing or too old. 513da7aff1Smrg 523da7aff1SmrgOptions: 533da7aff1Smrg -h, --help display this help and exit 543da7aff1Smrg -v, --version output version information and exit 553da7aff1Smrg 563da7aff1SmrgSupported PROGRAM values: 573e999d35Smrg aclocal autoconf autoheader autom4te automake makeinfo 583e999d35Smrg bison yacc flex lex help2man 59e531b1a7Smrg 603e999d35SmrgVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 613e999d35Smrg'g' are ignored when checking the name. 62e531b1a7Smrg 63e531b1a7SmrgSend bug reports to <bug-automake@gnu.org>." 64e531b1a7Smrg exit $? 653da7aff1Smrg ;; 663da7aff1Smrg 673da7aff1Smrg -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 68e531b1a7Smrg echo "missing $scriptversion (GNU Automake)" 69e531b1a7Smrg exit $? 703da7aff1Smrg ;; 713da7aff1Smrg 723da7aff1Smrg -*) 733e999d35Smrg echo 1>&2 "$0: unknown '$1' option" 743e999d35Smrg echo 1>&2 "Try '$0 --help' for more information" 753da7aff1Smrg exit 1 763da7aff1Smrg ;; 773da7aff1Smrg 78e531b1a7Smrgesac 79e531b1a7Smrg 803e999d35Smrg# Run the given program, remember its exit status. 813e999d35Smrg"$@"; st=$? 823e999d35Smrg 833e999d35Smrg# If it succeeded, we are done. 843e999d35Smrgtest $st -eq 0 && exit 0 853e999d35Smrg 863e999d35Smrg# Also exit now if we it failed (or wasn't found), and '--version' was 873e999d35Smrg# passed; such an option is passed most likely to detect whether the 883e999d35Smrg# program is present and works. 893e999d35Smrgcase $2 in --version|--help) exit $st;; esac 903e999d35Smrg 913e999d35Smrg# Exit code 63 means version mismatch. This often happens when the user 923e999d35Smrg# tries to use an ancient version of a tool on a file that requires a 933e999d35Smrg# minimum version. 943e999d35Smrgif test $st -eq 63; then 953e999d35Smrg msg="probably too old" 963e999d35Smrgelif test $st -eq 127; then 973e999d35Smrg # Program was missing. 983e999d35Smrg msg="missing on your system" 993e999d35Smrgelse 1003e999d35Smrg # Program was found and executed, but failed. Give up. 1013e999d35Smrg exit $st 1023e999d35Smrgfi 1033da7aff1Smrg 1043e999d35Smrgperl_URL=http://www.perl.org/ 1053e999d35Smrgflex_URL=http://flex.sourceforge.net/ 1063e999d35Smrggnu_software_URL=http://www.gnu.org/software 1073e999d35Smrg 1083e999d35Smrgprogram_details () 1093e999d35Smrg{ 1103e999d35Smrg case $1 in 1113e999d35Smrg aclocal|automake) 1123e999d35Smrg echo "The '$1' program is part of the GNU Automake package:" 1133e999d35Smrg echo "<$gnu_software_URL/automake>" 1143e999d35Smrg echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" 1153e999d35Smrg echo "<$gnu_software_URL/autoconf>" 1163e999d35Smrg echo "<$gnu_software_URL/m4/>" 1173e999d35Smrg echo "<$perl_URL>" 1183e999d35Smrg ;; 1193e999d35Smrg autoconf|autom4te|autoheader) 1203e999d35Smrg echo "The '$1' program is part of the GNU Autoconf package:" 1213e999d35Smrg echo "<$gnu_software_URL/autoconf/>" 1223e999d35Smrg echo "It also requires GNU m4 and Perl in order to run:" 1233e999d35Smrg echo "<$gnu_software_URL/m4/>" 1243e999d35Smrg echo "<$perl_URL>" 1253e999d35Smrg ;; 1263e999d35Smrg esac 1273e999d35Smrg} 1283e999d35Smrg 1293e999d35Smrggive_advice () 1303e999d35Smrg{ 1313e999d35Smrg # Normalize program name to check for. 1323e999d35Smrg normalized_program=`echo "$1" | sed ' 1333e999d35Smrg s/^gnu-//; t 1343e999d35Smrg s/^gnu//; t 1353e999d35Smrg s/^g//; t'` 1363e999d35Smrg 1373e999d35Smrg printf '%s\n' "'$1' is $msg." 1383e999d35Smrg 1393e999d35Smrg configure_deps="'configure.ac' or m4 files included by 'configure.ac'" 1403e999d35Smrg case $normalized_program in 1413e999d35Smrg autoconf*) 1423e999d35Smrg echo "You should only need it if you modified 'configure.ac'," 1433e999d35Smrg echo "or m4 files included by it." 1443e999d35Smrg program_details 'autoconf' 1453e999d35Smrg ;; 1463e999d35Smrg autoheader*) 1473e999d35Smrg echo "You should only need it if you modified 'acconfig.h' or" 1483e999d35Smrg echo "$configure_deps." 1493e999d35Smrg program_details 'autoheader' 1503e999d35Smrg ;; 1513e999d35Smrg automake*) 1523e999d35Smrg echo "You should only need it if you modified 'Makefile.am' or" 1533e999d35Smrg echo "$configure_deps." 1543e999d35Smrg program_details 'automake' 1553e999d35Smrg ;; 1563e999d35Smrg aclocal*) 1573e999d35Smrg echo "You should only need it if you modified 'acinclude.m4' or" 1583e999d35Smrg echo "$configure_deps." 1593e999d35Smrg program_details 'aclocal' 1603e999d35Smrg ;; 1613e999d35Smrg autom4te*) 1623e999d35Smrg echo "You might have modified some maintainer files that require" 1633e999d35Smrg echo "the 'autom4te' program to be rebuilt." 1643e999d35Smrg program_details 'autom4te' 1653e999d35Smrg ;; 1663e999d35Smrg bison*|yacc*) 1673e999d35Smrg echo "You should only need it if you modified a '.y' file." 1683e999d35Smrg echo "You may want to install the GNU Bison package:" 1693e999d35Smrg echo "<$gnu_software_URL/bison/>" 1703e999d35Smrg ;; 1713e999d35Smrg lex*|flex*) 1723e999d35Smrg echo "You should only need it if you modified a '.l' file." 1733e999d35Smrg echo "You may want to install the Fast Lexical Analyzer package:" 1743e999d35Smrg echo "<$flex_URL>" 1753e999d35Smrg ;; 1763e999d35Smrg help2man*) 1773e999d35Smrg echo "You should only need it if you modified a dependency" \ 1783e999d35Smrg "of a man page." 1793e999d35Smrg echo "You may want to install the GNU Help2man package:" 1803e999d35Smrg echo "<$gnu_software_URL/help2man/>" 1813e999d35Smrg ;; 1823e999d35Smrg makeinfo*) 1833e999d35Smrg echo "You should only need it if you modified a '.texi' file, or" 1843e999d35Smrg echo "any other file indirectly affecting the aspect of the manual." 1853e999d35Smrg echo "You might want to install the Texinfo package:" 1863e999d35Smrg echo "<$gnu_software_URL/texinfo/>" 1873e999d35Smrg echo "The spurious makeinfo call might also be the consequence of" 1883e999d35Smrg echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" 1893e999d35Smrg echo "want to install GNU make:" 1903e999d35Smrg echo "<$gnu_software_URL/make/>" 1913e999d35Smrg ;; 1923e999d35Smrg *) 1933e999d35Smrg echo "You might have modified some files without having the proper" 1943e999d35Smrg echo "tools for further handling them. Check the 'README' file, it" 1953e999d35Smrg echo "often tells you about the needed prerequisites for installing" 1963e999d35Smrg echo "this package. You may also peek at any GNU archive site, in" 1973e999d35Smrg echo "case some other package contains this missing '$1' program." 1983e999d35Smrg ;; 1993e999d35Smrg esac 2003e999d35Smrg} 2013e999d35Smrg 2023e999d35Smrggive_advice "$1" | sed -e '1s/^/WARNING: /' \ 2033e999d35Smrg -e '2,$s/^/ /' >&2 2043e999d35Smrg 2053e999d35Smrg# Propagate the correct exit status (expected to be 127 for a program 2063e999d35Smrg# not found, 63 for a program that failed due to version mismatch). 2073e999d35Smrgexit $st 208e531b1a7Smrg 209e531b1a7Smrg# Local variables: 210e531b1a7Smrg# eval: (add-hook 'write-file-hooks 'time-stamp) 211e531b1a7Smrg# time-stamp-start: "scriptversion=" 212e531b1a7Smrg# time-stamp-format: "%:y-%02m-%02d.%02H" 213e531b1a7Smrg# time-stamp-time-zone: "UTC" 214e531b1a7Smrg# time-stamp-end: "; # UTC" 215e531b1a7Smrg# End: 216