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