xref: /iperf/config/missing (revision ad98a8fe)
1e34c20c8SJon Dugan#! /bin/sh
2*ad98a8feSBruce A. Mah# Common wrapper for a few potentially missing GNU programs.
3e34c20c8SJon Dugan
4*ad98a8feSBruce A. Mahscriptversion=2013-10-28.13; # UTC
5e34c20c8SJon Dugan
6*ad98a8feSBruce A. Mah# Copyright (C) 1996-2013 Free Software Foundation, Inc.
7*ad98a8feSBruce A. Mah# Originally written by Fran,cois Pinard <[email protected]>, 1996.
8e34c20c8SJon Dugan
9e34c20c8SJon Dugan# This program is free software; you can redistribute it and/or modify
10e34c20c8SJon Dugan# it under the terms of the GNU General Public License as published by
11e34c20c8SJon Dugan# the Free Software Foundation; either version 2, or (at your option)
12e34c20c8SJon Dugan# any later version.
13e34c20c8SJon Dugan
14e34c20c8SJon Dugan# This program is distributed in the hope that it will be useful,
15e34c20c8SJon Dugan# but WITHOUT ANY WARRANTY; without even the implied warranty of
16e34c20c8SJon Dugan# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17e34c20c8SJon Dugan# GNU General Public License for more details.
18e34c20c8SJon Dugan
19e34c20c8SJon Dugan# You should have received a copy of the GNU General Public License
20*ad98a8feSBruce A. Mah# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21e34c20c8SJon Dugan
22e34c20c8SJon Dugan# As a special exception to the GNU General Public License, if you
23e34c20c8SJon Dugan# distribute this file as part of a program that contains a
24e34c20c8SJon Dugan# configuration script generated by Autoconf, you may include it under
25e34c20c8SJon Dugan# the same distribution terms that you use for the rest of that program.
26e34c20c8SJon Dugan
27e34c20c8SJon Duganif test $# -eq 0; then
28*ad98a8feSBruce A. Mah  echo 1>&2 "Try '$0 --help' for more information"
29e34c20c8SJon Dugan  exit 1
30e34c20c8SJon Duganfi
31e34c20c8SJon Dugan
32*ad98a8feSBruce A. Mahcase $1 in
33e34c20c8SJon Dugan
34*ad98a8feSBruce A. Mah  --is-lightweight)
35*ad98a8feSBruce A. Mah    # Used by our autoconf macros to check whether the available missing
36*ad98a8feSBruce A. Mah    # script is modern enough.
37*ad98a8feSBruce A. Mah    exit 0
38*ad98a8feSBruce A. Mah    ;;
39e34c20c8SJon Dugan
40e34c20c8SJon Dugan  --run)
41*ad98a8feSBruce A. Mah    # Back-compat with the calling convention used by older automake.
42e34c20c8SJon Dugan    shift
43e34c20c8SJon Dugan    ;;
44e34c20c8SJon Dugan
45e34c20c8SJon Dugan  -h|--h|--he|--hel|--help)
46e34c20c8SJon Dugan    echo "\
47e34c20c8SJon Dugan$0 [OPTION]... PROGRAM [ARGUMENT]...
48e34c20c8SJon Dugan
49*ad98a8feSBruce A. MahRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
50*ad98a8feSBruce A. Mahto PROGRAM being missing or too old.
51e34c20c8SJon Dugan
52e34c20c8SJon DuganOptions:
53e34c20c8SJon Dugan  -h, --help      display this help and exit
54e34c20c8SJon Dugan  -v, --version   output version information and exit
55e34c20c8SJon Dugan
56e34c20c8SJon DuganSupported PROGRAM values:
57*ad98a8feSBruce A. Mah  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
58*ad98a8feSBruce A. Mah  bison     yacc      flex         lex       help2man
59*ad98a8feSBruce A. Mah
60*ad98a8feSBruce A. MahVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
61*ad98a8feSBruce A. Mah'g' are ignored when checking the name.
62e34c20c8SJon Dugan
63e34c20c8SJon DuganSend bug reports to <[email protected]>."
64e34c20c8SJon Dugan    exit $?
65e34c20c8SJon Dugan    ;;
66e34c20c8SJon Dugan
67e34c20c8SJon Dugan  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
68e34c20c8SJon Dugan    echo "missing $scriptversion (GNU Automake)"
69e34c20c8SJon Dugan    exit $?
70e34c20c8SJon Dugan    ;;
71e34c20c8SJon Dugan
72e34c20c8SJon Dugan  -*)
73*ad98a8feSBruce A. Mah    echo 1>&2 "$0: unknown '$1' option"
74*ad98a8feSBruce A. Mah    echo 1>&2 "Try '$0 --help' for more information"
75e34c20c8SJon Dugan    exit 1
76e34c20c8SJon Dugan    ;;
77e34c20c8SJon Dugan
78e34c20c8SJon Duganesac
79e34c20c8SJon Dugan
80*ad98a8feSBruce A. Mah# Run the given program, remember its exit status.
81*ad98a8feSBruce A. Mah"$@"; st=$?
82e34c20c8SJon Dugan
83*ad98a8feSBruce A. Mah# If it succeeded, we are done.
84*ad98a8feSBruce A. Mahtest $st -eq 0 && exit 0
85*ad98a8feSBruce A. Mah
86*ad98a8feSBruce A. Mah# Also exit now if we it failed (or wasn't found), and '--version' was
87*ad98a8feSBruce A. Mah# passed; such an option is passed most likely to detect whether the
88*ad98a8feSBruce A. Mah# program is present and works.
89*ad98a8feSBruce A. Mahcase $2 in --version|--help) exit $st;; esac
90*ad98a8feSBruce A. Mah
91*ad98a8feSBruce A. Mah# Exit code 63 means version mismatch.  This often happens when the user
92*ad98a8feSBruce A. Mah# tries to use an ancient version of a tool on a file that requires a
93*ad98a8feSBruce A. Mah# minimum version.
94*ad98a8feSBruce A. Mahif test $st -eq 63; then
95*ad98a8feSBruce A. Mah  msg="probably too old"
96*ad98a8feSBruce A. Mahelif test $st -eq 127; then
97*ad98a8feSBruce A. Mah  # Program was missing.
98*ad98a8feSBruce A. Mah  msg="missing on your system"
99*ad98a8feSBruce A. Mahelse
100*ad98a8feSBruce A. Mah  # Program was found and executed, but failed.  Give up.
101*ad98a8feSBruce A. Mah  exit $st
102e34c20c8SJon Duganfi
103e34c20c8SJon Dugan
104*ad98a8feSBruce A. Mahperl_URL=http://www.perl.org/
105*ad98a8feSBruce A. Mahflex_URL=http://flex.sourceforge.net/
106*ad98a8feSBruce A. Mahgnu_software_URL=http://www.gnu.org/software
107*ad98a8feSBruce A. Mah
108*ad98a8feSBruce A. Mahprogram_details ()
109*ad98a8feSBruce A. Mah{
110*ad98a8feSBruce A. Mah  case $1 in
111*ad98a8feSBruce A. Mah    aclocal|automake)
112*ad98a8feSBruce A. Mah      echo "The '$1' program is part of the GNU Automake package:"
113*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/automake>"
114*ad98a8feSBruce A. Mah      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
115*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/autoconf>"
116*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/m4/>"
117*ad98a8feSBruce A. Mah      echo "<$perl_URL>"
118*ad98a8feSBruce A. Mah      ;;
119*ad98a8feSBruce A. Mah    autoconf|autom4te|autoheader)
120*ad98a8feSBruce A. Mah      echo "The '$1' program is part of the GNU Autoconf package:"
121*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/autoconf/>"
122*ad98a8feSBruce A. Mah      echo "It also requires GNU m4 and Perl in order to run:"
123*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/m4/>"
124*ad98a8feSBruce A. Mah      echo "<$perl_URL>"
125e34c20c8SJon Dugan      ;;
126e34c20c8SJon Dugan  esac
127*ad98a8feSBruce A. Mah}
128e34c20c8SJon Dugan
129*ad98a8feSBruce A. Mahgive_advice ()
130*ad98a8feSBruce A. Mah{
131*ad98a8feSBruce A. Mah  # Normalize program name to check for.
132*ad98a8feSBruce A. Mah  normalized_program=`echo "$1" | sed '
133*ad98a8feSBruce A. Mah    s/^gnu-//; t
134*ad98a8feSBruce A. Mah    s/^gnu//; t
135*ad98a8feSBruce A. Mah    s/^g//; t'`
136*ad98a8feSBruce A. Mah
137*ad98a8feSBruce A. Mah  printf '%s\n' "'$1' is $msg."
138*ad98a8feSBruce A. Mah
139*ad98a8feSBruce A. Mah  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
140*ad98a8feSBruce A. Mah  case $normalized_program in
141*ad98a8feSBruce A. Mah    autoconf*)
142*ad98a8feSBruce A. Mah      echo "You should only need it if you modified 'configure.ac',"
143*ad98a8feSBruce A. Mah      echo "or m4 files included by it."
144*ad98a8feSBruce A. Mah      program_details 'autoconf'
145e34c20c8SJon Dugan      ;;
146*ad98a8feSBruce A. Mah    autoheader*)
147*ad98a8feSBruce A. Mah      echo "You should only need it if you modified 'acconfig.h' or"
148*ad98a8feSBruce A. Mah      echo "$configure_deps."
149*ad98a8feSBruce A. Mah      program_details 'autoheader'
150e34c20c8SJon Dugan      ;;
151e34c20c8SJon Dugan    automake*)
152*ad98a8feSBruce A. Mah      echo "You should only need it if you modified 'Makefile.am' or"
153*ad98a8feSBruce A. Mah      echo "$configure_deps."
154*ad98a8feSBruce A. Mah      program_details 'automake'
155e34c20c8SJon Dugan      ;;
156*ad98a8feSBruce A. Mah    aclocal*)
157*ad98a8feSBruce A. Mah      echo "You should only need it if you modified 'acinclude.m4' or"
158*ad98a8feSBruce A. Mah      echo "$configure_deps."
159*ad98a8feSBruce A. Mah      program_details 'aclocal'
160e34c20c8SJon Dugan      ;;
161*ad98a8feSBruce A. Mah   autom4te*)
162*ad98a8feSBruce A. Mah      echo "You might have modified some maintainer files that require"
163*ad98a8feSBruce A. Mah      echo "the 'autom4te' program to be rebuilt."
164*ad98a8feSBruce A. Mah      program_details 'autom4te'
165e34c20c8SJon Dugan      ;;
166*ad98a8feSBruce A. Mah    bison*|yacc*)
167*ad98a8feSBruce A. Mah      echo "You should only need it if you modified a '.y' file."
168*ad98a8feSBruce A. Mah      echo "You may want to install the GNU Bison package:"
169*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/bison/>"
170e34c20c8SJon Dugan      ;;
171*ad98a8feSBruce A. Mah    lex*|flex*)
172*ad98a8feSBruce A. Mah      echo "You should only need it if you modified a '.l' file."
173*ad98a8feSBruce A. Mah      echo "You may want to install the Fast Lexical Analyzer package:"
174*ad98a8feSBruce A. Mah      echo "<$flex_URL>"
175e34c20c8SJon Dugan      ;;
176*ad98a8feSBruce A. Mah    help2man*)
177*ad98a8feSBruce A. Mah      echo "You should only need it if you modified a dependency" \
178*ad98a8feSBruce A. Mah           "of a man page."
179*ad98a8feSBruce A. Mah      echo "You may want to install the GNU Help2man package:"
180*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/help2man/>"
181e34c20c8SJon Dugan    ;;
182*ad98a8feSBruce A. Mah    makeinfo*)
183*ad98a8feSBruce A. Mah      echo "You should only need it if you modified a '.texi' file, or"
184*ad98a8feSBruce A. Mah      echo "any other file indirectly affecting the aspect of the manual."
185*ad98a8feSBruce A. Mah      echo "You might want to install the Texinfo package:"
186*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/texinfo/>"
187*ad98a8feSBruce A. Mah      echo "The spurious makeinfo call might also be the consequence of"
188*ad98a8feSBruce A. Mah      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
189*ad98a8feSBruce A. Mah      echo "want to install GNU make:"
190*ad98a8feSBruce A. Mah      echo "<$gnu_software_URL/make/>"
191e34c20c8SJon Dugan      ;;
192e34c20c8SJon Dugan    *)
193*ad98a8feSBruce A. Mah      echo "You might have modified some files without having the proper"
194*ad98a8feSBruce A. Mah      echo "tools for further handling them.  Check the 'README' file, it"
195*ad98a8feSBruce A. Mah      echo "often tells you about the needed prerequisites for installing"
196*ad98a8feSBruce A. Mah      echo "this package.  You may also peek at any GNU archive site, in"
197*ad98a8feSBruce A. Mah      echo "case some other package contains this missing '$1' program."
198e34c20c8SJon Dugan      ;;
199e34c20c8SJon Dugan  esac
200*ad98a8feSBruce A. Mah}
201e34c20c8SJon Dugan
202*ad98a8feSBruce A. Mahgive_advice "$1" | sed -e '1s/^/WARNING: /' \
203*ad98a8feSBruce A. Mah                       -e '2,$s/^/         /' >&2
204*ad98a8feSBruce A. Mah
205*ad98a8feSBruce A. Mah# Propagate the correct exit status (expected to be 127 for a program
206*ad98a8feSBruce A. Mah# not found, 63 for a program that failed due to version mismatch).
207*ad98a8feSBruce A. Mahexit $st
208e34c20c8SJon Dugan
209e34c20c8SJon Dugan# Local variables:
210e34c20c8SJon Dugan# eval: (add-hook 'write-file-hooks 'time-stamp)
211e34c20c8SJon Dugan# time-stamp-start: "scriptversion="
212e34c20c8SJon Dugan# time-stamp-format: "%:y-%02m-%02d.%02H"
213*ad98a8feSBruce A. Mah# time-stamp-time-zone: "UTC"
214*ad98a8feSBruce A. Mah# time-stamp-end: "; # UTC"
215e34c20c8SJon Dugan# End:
216