xref: /netbsd-src/external/gpl3/gdb/dist/missing (revision 9d2109275e137f9027abb05e859af639830e18f5)
1597410b8Schristos#! /bin/sh
2*9d210927Schristos# Common wrapper for a few potentially missing GNU programs.
3597410b8Schristos
4*9d210927Schristosscriptversion=2013-10-28.13; # UTC
5597410b8Schristos
6*9d210927Schristos# Copyright (C) 1996-2014 Free Software Foundation, Inc.
7*9d210927Schristos# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
8597410b8Schristos
9597410b8Schristos# This program is free software; you can redistribute it and/or modify
10597410b8Schristos# it under the terms of the GNU General Public License as published by
11597410b8Schristos# the Free Software Foundation; either version 2, or (at your option)
12597410b8Schristos# any later version.
13597410b8Schristos
14597410b8Schristos# This program is distributed in the hope that it will be useful,
15597410b8Schristos# but WITHOUT ANY WARRANTY; without even the implied warranty of
16597410b8Schristos# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17597410b8Schristos# GNU General Public License for more details.
18597410b8Schristos
19597410b8Schristos# You should have received a copy of the GNU General Public License
20597410b8Schristos# along with this program.  If not, see <http://www.gnu.org/licenses/>.
21597410b8Schristos
22597410b8Schristos# As a special exception to the GNU General Public License, if you
23597410b8Schristos# distribute this file as part of a program that contains a
24597410b8Schristos# configuration script generated by Autoconf, you may include it under
25597410b8Schristos# the same distribution terms that you use for the rest of that program.
26597410b8Schristos
27597410b8Schristosif test $# -eq 0; then
28*9d210927Schristos  echo 1>&2 "Try '$0 --help' for more information"
29597410b8Schristos  exit 1
30597410b8Schristosfi
31597410b8Schristos
32597410b8Schristoscase $1 in
33*9d210927Schristos
34*9d210927Schristos  --is-lightweight)
35*9d210927Schristos    # Used by our autoconf macros to check whether the available missing
36*9d210927Schristos    # script is modern enough.
37*9d210927Schristos    exit 0
38*9d210927Schristos    ;;
39*9d210927Schristos
40597410b8Schristos  --run)
41*9d210927Schristos    # Back-compat with the calling convention used by older automake.
42597410b8Schristos    shift
43597410b8Schristos    ;;
44597410b8Schristos
45597410b8Schristos  -h|--h|--he|--hel|--help)
46597410b8Schristos    echo "\
47597410b8Schristos$0 [OPTION]... PROGRAM [ARGUMENT]...
48597410b8Schristos
49*9d210927SchristosRun 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
50*9d210927Schristosto PROGRAM being missing or too old.
51597410b8Schristos
52597410b8SchristosOptions:
53597410b8Schristos  -h, --help      display this help and exit
54597410b8Schristos  -v, --version   output version information and exit
55597410b8Schristos
56597410b8SchristosSupported PROGRAM values:
57*9d210927Schristos  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
58*9d210927Schristos  bison     yacc      flex         lex       help2man
59597410b8Schristos
60*9d210927SchristosVersion suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
61*9d210927Schristos'g' are ignored when checking the name.
62597410b8Schristos
63597410b8SchristosSend bug reports to <bug-automake@gnu.org>."
64597410b8Schristos    exit $?
65597410b8Schristos    ;;
66597410b8Schristos
67597410b8Schristos  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
68597410b8Schristos    echo "missing $scriptversion (GNU Automake)"
69597410b8Schristos    exit $?
70597410b8Schristos    ;;
71597410b8Schristos
72597410b8Schristos  -*)
73*9d210927Schristos    echo 1>&2 "$0: unknown '$1' option"
74*9d210927Schristos    echo 1>&2 "Try '$0 --help' for more information"
75597410b8Schristos    exit 1
76597410b8Schristos    ;;
77597410b8Schristos
78597410b8Schristosesac
79597410b8Schristos
80*9d210927Schristos# Run the given program, remember its exit status.
81*9d210927Schristos"$@"; st=$?
82*9d210927Schristos
83*9d210927Schristos# If it succeeded, we are done.
84*9d210927Schristostest $st -eq 0 && exit 0
85*9d210927Schristos
86*9d210927Schristos# Also exit now if we it failed (or wasn't found), and '--version' was
87*9d210927Schristos# passed; such an option is passed most likely to detect whether the
88*9d210927Schristos# program is present and works.
89*9d210927Schristoscase $2 in --version|--help) exit $st;; esac
90*9d210927Schristos
91*9d210927Schristos# Exit code 63 means version mismatch.  This often happens when the user
92*9d210927Schristos# tries to use an ancient version of a tool on a file that requires a
93*9d210927Schristos# minimum version.
94*9d210927Schristosif test $st -eq 63; then
95*9d210927Schristos  msg="probably too old"
96*9d210927Schristoselif test $st -eq 127; then
97*9d210927Schristos  # Program was missing.
98*9d210927Schristos  msg="missing on your system"
99*9d210927Schristoselse
100*9d210927Schristos  # Program was found and executed, but failed.  Give up.
101*9d210927Schristos  exit $st
102*9d210927Schristosfi
103*9d210927Schristos
104*9d210927Schristosperl_URL=http://www.perl.org/
105*9d210927Schristosflex_URL=http://flex.sourceforge.net/
106*9d210927Schristosgnu_software_URL=http://www.gnu.org/software
107*9d210927Schristos
108*9d210927Schristosprogram_details ()
109*9d210927Schristos{
110*9d210927Schristos  case $1 in
111*9d210927Schristos    aclocal|automake)
112*9d210927Schristos      echo "The '$1' program is part of the GNU Automake package:"
113*9d210927Schristos      echo "<$gnu_software_URL/automake>"
114*9d210927Schristos      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
115*9d210927Schristos      echo "<$gnu_software_URL/autoconf>"
116*9d210927Schristos      echo "<$gnu_software_URL/m4/>"
117*9d210927Schristos      echo "<$perl_URL>"
118*9d210927Schristos      ;;
119*9d210927Schristos    autoconf|autom4te|autoheader)
120*9d210927Schristos      echo "The '$1' program is part of the GNU Autoconf package:"
121*9d210927Schristos      echo "<$gnu_software_URL/autoconf/>"
122*9d210927Schristos      echo "It also requires GNU m4 and Perl in order to run:"
123*9d210927Schristos      echo "<$gnu_software_URL/m4/>"
124*9d210927Schristos      echo "<$perl_URL>"
125*9d210927Schristos      ;;
126*9d210927Schristos  esac
127*9d210927Schristos}
128*9d210927Schristos
129*9d210927Schristosgive_advice ()
130*9d210927Schristos{
131*9d210927Schristos  # Normalize program name to check for.
132*9d210927Schristos  normalized_program=`echo "$1" | sed '
133597410b8Schristos    s/^gnu-//; t
134597410b8Schristos    s/^gnu//; t
135597410b8Schristos    s/^g//; t'`
136597410b8Schristos
137*9d210927Schristos  printf '%s\n' "'$1' is $msg."
138597410b8Schristos
139*9d210927Schristos  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
140*9d210927Schristos  case $normalized_program in
141597410b8Schristos    autoconf*)
142*9d210927Schristos      echo "You should only need it if you modified 'configure.ac',"
143*9d210927Schristos      echo "or m4 files included by it."
144*9d210927Schristos      program_details 'autoconf'
145597410b8Schristos      ;;
146597410b8Schristos    autoheader*)
147*9d210927Schristos      echo "You should only need it if you modified 'acconfig.h' or"
148*9d210927Schristos      echo "$configure_deps."
149*9d210927Schristos      program_details 'autoheader'
150597410b8Schristos      ;;
151597410b8Schristos    automake*)
152*9d210927Schristos      echo "You should only need it if you modified 'Makefile.am' or"
153*9d210927Schristos      echo "$configure_deps."
154*9d210927Schristos      program_details 'automake'
155597410b8Schristos      ;;
156*9d210927Schristos    aclocal*)
157*9d210927Schristos      echo "You should only need it if you modified 'acinclude.m4' or"
158*9d210927Schristos      echo "$configure_deps."
159*9d210927Schristos      program_details 'aclocal'
160*9d210927Schristos      ;;
161597410b8Schristos   autom4te*)
162*9d210927Schristos      echo "You might have modified some maintainer files that require"
163*9d210927Schristos      echo "the 'autom4te' program to be rebuilt."
164*9d210927Schristos      program_details 'autom4te'
165597410b8Schristos      ;;
166597410b8Schristos    bison*|yacc*)
167*9d210927Schristos      echo "You should only need it if you modified a '.y' file."
168*9d210927Schristos      echo "You may want to install the GNU Bison package:"
169*9d210927Schristos      echo "<$gnu_software_URL/bison/>"
170597410b8Schristos      ;;
171597410b8Schristos    lex*|flex*)
172*9d210927Schristos      echo "You should only need it if you modified a '.l' file."
173*9d210927Schristos      echo "You may want to install the Fast Lexical Analyzer package:"
174*9d210927Schristos      echo "<$flex_URL>"
175597410b8Schristos      ;;
176597410b8Schristos    help2man*)
177*9d210927Schristos      echo "You should only need it if you modified a dependency" \
178*9d210927Schristos           "of a man page."
179*9d210927Schristos      echo "You may want to install the GNU Help2man package:"
180*9d210927Schristos      echo "<$gnu_software_URL/help2man/>"
181597410b8Schristos    ;;
182597410b8Schristos    makeinfo*)
183*9d210927Schristos      echo "You should only need it if you modified a '.texi' file, or"
184*9d210927Schristos      echo "any other file indirectly affecting the aspect of the manual."
185*9d210927Schristos      echo "You might want to install the Texinfo package:"
186*9d210927Schristos      echo "<$gnu_software_URL/texinfo/>"
187*9d210927Schristos      echo "The spurious makeinfo call might also be the consequence of"
188*9d210927Schristos      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
189*9d210927Schristos      echo "want to install GNU make:"
190*9d210927Schristos      echo "<$gnu_software_URL/make/>"
191597410b8Schristos      ;;
192597410b8Schristos    *)
193*9d210927Schristos      echo "You might have modified some files without having the proper"
194*9d210927Schristos      echo "tools for further handling them.  Check the 'README' file, it"
195*9d210927Schristos      echo "often tells you about the needed prerequisites for installing"
196*9d210927Schristos      echo "this package.  You may also peek at any GNU archive site, in"
197*9d210927Schristos      echo "case some other package contains this missing '$1' program."
198597410b8Schristos      ;;
199597410b8Schristos  esac
200*9d210927Schristos}
201597410b8Schristos
202*9d210927Schristosgive_advice "$1" | sed -e '1s/^/WARNING: /' \
203*9d210927Schristos                       -e '2,$s/^/         /' >&2
204*9d210927Schristos
205*9d210927Schristos# Propagate the correct exit status (expected to be 127 for a program
206*9d210927Schristos# not found, 63 for a program that failed due to version mismatch).
207*9d210927Schristosexit $st
208597410b8Schristos
209597410b8Schristos# Local variables:
210597410b8Schristos# eval: (add-hook 'write-file-hooks 'time-stamp)
211597410b8Schristos# time-stamp-start: "scriptversion="
212597410b8Schristos# time-stamp-format: "%:y-%02m-%02d.%02H"
213597410b8Schristos# time-stamp-time-zone: "UTC"
214597410b8Schristos# time-stamp-end: "; # UTC"
215597410b8Schristos# End:
216