]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/cpp/DataBoardTest/libantlr3c-3.2/missing
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / cpp / DataBoardTest / libantlr3c-3.2 / missing
1 #! /bin/sh\r
2 # Common stub for a few missing GNU programs while installing.\r
3 \r
4 scriptversion=2005-06-08.21\r
5 \r
6 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005\r
7 #   Free Software Foundation, Inc.\r
8 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.\r
9 \r
10 # This program is free software; you can redistribute it and/or modify\r
11 # it under the terms of the GNU General Public License as published by\r
12 # the Free Software Foundation; either version 2, or (at your option)\r
13 # any later version.\r
14 \r
15 # This program is distributed in the hope that it will be useful,\r
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of\r
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
18 # GNU General Public License for more details.\r
19 \r
20 # You should have received a copy of the GNU General Public License\r
21 # along with this program; if not, write to the Free Software\r
22 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\r
23 # 02110-1301, USA.\r
24 \r
25 # As a special exception to the GNU General Public License, if you\r
26 # distribute this file as part of a program that contains a\r
27 # configuration script generated by Autoconf, you may include it under\r
28 # the same distribution terms that you use for the rest of that program.\r
29 \r
30 if test $# -eq 0; then\r
31   echo 1>&2 "Try \`$0 --help' for more information"\r
32   exit 1\r
33 fi\r
34 \r
35 run=:\r
36 \r
37 # In the cases where this matters, `missing' is being run in the\r
38 # srcdir already.\r
39 if test -f configure.ac; then\r
40   configure_ac=configure.ac\r
41 else\r
42   configure_ac=configure.in\r
43 fi\r
44 \r
45 msg="missing on your system"\r
46 \r
47 case "$1" in\r
48 --run)\r
49   # Try to run requested program, and just exit if it succeeds.\r
50   run=\r
51   shift\r
52   "$@" && exit 0\r
53   # Exit code 63 means version mismatch.  This often happens\r
54   # when the user try to use an ancient version of a tool on\r
55   # a file that requires a minimum version.  In this case we\r
56   # we should proceed has if the program had been absent, or\r
57   # if --run hadn't been passed.\r
58   if test $? = 63; then\r
59     run=:\r
60     msg="probably too old"\r
61   fi\r
62   ;;\r
63 \r
64   -h|--h|--he|--hel|--help)\r
65     echo "\\r
66 $0 [OPTION]... PROGRAM [ARGUMENT]...\r
67 \r
68 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an\r
69 error status if there is no known handling for PROGRAM.\r
70 \r
71 Options:\r
72   -h, --help      display this help and exit\r
73   -v, --version   output version information and exit\r
74   --run           try to run the given command, and emulate it if it fails\r
75 \r
76 Supported PROGRAM values:\r
77   aclocal      touch file \`aclocal.m4'\r
78   autoconf     touch file \`configure'\r
79   autoheader   touch file \`config.h.in'\r
80   automake     touch all \`Makefile.in' files\r
81   bison        create \`y.tab.[ch]', if possible, from existing .[ch]\r
82   flex         create \`lex.yy.c', if possible, from existing .c\r
83   help2man     touch the output file\r
84   lex          create \`lex.yy.c', if possible, from existing .c\r
85   makeinfo     touch the output file\r
86   tar          try tar, gnutar, gtar, then tar without non-portable flags\r
87   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]\r
88 \r
89 Send bug reports to <bug-automake@gnu.org>."\r
90     exit $?\r
91     ;;\r
92 \r
93   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)\r
94     echo "missing $scriptversion (GNU Automake)"\r
95     exit $?\r
96     ;;\r
97 \r
98   -*)\r
99     echo 1>&2 "$0: Unknown \`$1' option"\r
100     echo 1>&2 "Try \`$0 --help' for more information"\r
101     exit 1\r
102     ;;\r
103 \r
104 esac\r
105 \r
106 # Now exit if we have it, but it failed.  Also exit now if we\r
107 # don't have it and --version was passed (most likely to detect\r
108 # the program).\r
109 case "$1" in\r
110   lex|yacc)\r
111     # Not GNU programs, they don't have --version.\r
112     ;;\r
113 \r
114   tar)\r
115     if test -n "$run"; then\r
116        echo 1>&2 "ERROR: \`tar' requires --run"\r
117        exit 1\r
118     elif test "x$2" = "x--version" || test "x$2" = "x--help"; then\r
119        exit 1\r
120     fi\r
121     ;;\r
122 \r
123   *)\r
124     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then\r
125        # We have it, but it failed.\r
126        exit 1\r
127     elif test "x$2" = "x--version" || test "x$2" = "x--help"; then\r
128        # Could not run --version or --help.  This is probably someone\r
129        # running `$TOOL --version' or `$TOOL --help' to check whether\r
130        # $TOOL exists and not knowing $TOOL uses missing.\r
131        exit 1\r
132     fi\r
133     ;;\r
134 esac\r
135 \r
136 # If it does not exist, or fails to run (possibly an outdated version),\r
137 # try to emulate it.\r
138 case "$1" in\r
139   aclocal*)\r
140     echo 1>&2 "\\r
141 WARNING: \`$1' is $msg.  You should only need it if\r
142          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want\r
143          to install the \`Automake' and \`Perl' packages.  Grab them from\r
144          any GNU archive site."\r
145     touch aclocal.m4\r
146     ;;\r
147 \r
148   autoconf)\r
149     echo 1>&2 "\\r
150 WARNING: \`$1' is $msg.  You should only need it if\r
151          you modified \`${configure_ac}'.  You might want to install the\r
152          \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU\r
153          archive site."\r
154     touch configure\r
155     ;;\r
156 \r
157   autoheader)\r
158     echo 1>&2 "\\r
159 WARNING: \`$1' is $msg.  You should only need it if\r
160          you modified \`acconfig.h' or \`${configure_ac}'.  You might want\r
161          to install the \`Autoconf' and \`GNU m4' packages.  Grab them\r
162          from any GNU archive site."\r
163     files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`\r
164     test -z "$files" && files="config.h"\r
165     touch_files=\r
166     for f in $files; do\r
167       case "$f" in\r
168       *:*) touch_files="$touch_files "`echo "$f" |\r
169                                        sed -e 's/^[^:]*://' -e 's/:.*//'`;;\r
170       *) touch_files="$touch_files $f.in";;\r
171       esac\r
172     done\r
173     touch $touch_files\r
174     ;;\r
175 \r
176   automake*)\r
177     echo 1>&2 "\\r
178 WARNING: \`$1' is $msg.  You should only need it if\r
179          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.\r
180          You might want to install the \`Automake' and \`Perl' packages.\r
181          Grab them from any GNU archive site."\r
182     find . -type f -name Makefile.am -print |\r
183            sed 's/\.am$/.in/' |\r
184            while read f; do touch "$f"; done\r
185     ;;\r
186 \r
187   autom4te)\r
188     echo 1>&2 "\\r
189 WARNING: \`$1' is needed, but is $msg.\r
190          You might have modified some files without having the\r
191          proper tools for further handling them.\r
192          You can get \`$1' as part of \`Autoconf' from any GNU\r
193          archive site."\r
194 \r
195     file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`\r
196     test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`\r
197     if test -f "$file"; then\r
198         touch $file\r
199     else\r
200         test -z "$file" || exec >$file\r
201         echo "#! /bin/sh"\r
202         echo "# Created by GNU Automake missing as a replacement of"\r
203         echo "#  $ $@"\r
204         echo "exit 0"\r
205         chmod +x $file\r
206         exit 1\r
207     fi\r
208     ;;\r
209 \r
210   bison|yacc)\r
211     echo 1>&2 "\\r
212 WARNING: \`$1' $msg.  You should only need it if\r
213          you modified a \`.y' file.  You may need the \`Bison' package\r
214          in order for those modifications to take effect.  You can get\r
215          \`Bison' from any GNU archive site."\r
216     rm -f y.tab.c y.tab.h\r
217     if [ $# -ne 1 ]; then\r
218         eval LASTARG="\${$#}"\r
219         case "$LASTARG" in\r
220         *.y)\r
221             SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`\r
222             if [ -f "$SRCFILE" ]; then\r
223                  cp "$SRCFILE" y.tab.c\r
224             fi\r
225             SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`\r
226             if [ -f "$SRCFILE" ]; then\r
227                  cp "$SRCFILE" y.tab.h\r
228             fi\r
229           ;;\r
230         esac\r
231     fi\r
232     if [ ! -f y.tab.h ]; then\r
233         echo >y.tab.h\r
234     fi\r
235     if [ ! -f y.tab.c ]; then\r
236         echo 'main() { return 0; }' >y.tab.c\r
237     fi\r
238     ;;\r
239 \r
240   lex|flex)\r
241     echo 1>&2 "\\r
242 WARNING: \`$1' is $msg.  You should only need it if\r
243          you modified a \`.l' file.  You may need the \`Flex' package\r
244          in order for those modifications to take effect.  You can get\r
245          \`Flex' from any GNU archive site."\r
246     rm -f lex.yy.c\r
247     if [ $# -ne 1 ]; then\r
248         eval LASTARG="\${$#}"\r
249         case "$LASTARG" in\r
250         *.l)\r
251             SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`\r
252             if [ -f "$SRCFILE" ]; then\r
253                  cp "$SRCFILE" lex.yy.c\r
254             fi\r
255           ;;\r
256         esac\r
257     fi\r
258     if [ ! -f lex.yy.c ]; then\r
259         echo 'main() { return 0; }' >lex.yy.c\r
260     fi\r
261     ;;\r
262 \r
263   help2man)\r
264     echo 1>&2 "\\r
265 WARNING: \`$1' is $msg.  You should only need it if\r
266          you modified a dependency of a manual page.  You may need the\r
267          \`Help2man' package in order for those modifications to take\r
268          effect.  You can get \`Help2man' from any GNU archive site."\r
269 \r
270     file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`\r
271     if test -z "$file"; then\r
272         file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`\r
273     fi\r
274     if [ -f "$file" ]; then\r
275         touch $file\r
276     else\r
277         test -z "$file" || exec >$file\r
278         echo ".ab help2man is required to generate this page"\r
279         exit 1\r
280     fi\r
281     ;;\r
282 \r
283   makeinfo)\r
284     echo 1>&2 "\\r
285 WARNING: \`$1' is $msg.  You should only need it if\r
286          you modified a \`.texi' or \`.texinfo' file, or any other file\r
287          indirectly affecting the aspect of the manual.  The spurious\r
288          call might also be the consequence of using a buggy \`make' (AIX,\r
289          DU, IRIX).  You might want to install the \`Texinfo' package or\r
290          the \`GNU make' package.  Grab either from any GNU archive site."\r
291     # The file to touch is that specified with -o ...\r
292     file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`\r
293     if test -z "$file"; then\r
294       # ... or it is the one specified with @setfilename ...\r
295       infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`\r
296       file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`\r
297       # ... or it is derived from the source name (dir/f.texi becomes f.info)\r
298       test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info\r
299     fi\r
300     # If the file does not exist, the user really needs makeinfo;\r
301     # let's fail without touching anything.\r
302     test -f $file || exit 1\r
303     touch $file\r
304     ;;\r
305 \r
306   tar)\r
307     shift\r
308 \r
309     # We have already tried tar in the generic part.\r
310     # Look for gnutar/gtar before invocation to avoid ugly error\r
311     # messages.\r
312     if (gnutar --version > /dev/null 2>&1); then\r
313        gnutar "$@" && exit 0\r
314     fi\r
315     if (gtar --version > /dev/null 2>&1); then\r
316        gtar "$@" && exit 0\r
317     fi\r
318     firstarg="$1"\r
319     if shift; then\r
320         case "$firstarg" in\r
321         *o*)\r
322             firstarg=`echo "$firstarg" | sed s/o//`\r
323             tar "$firstarg" "$@" && exit 0\r
324             ;;\r
325         esac\r
326         case "$firstarg" in\r
327         *h*)\r
328             firstarg=`echo "$firstarg" | sed s/h//`\r
329             tar "$firstarg" "$@" && exit 0\r
330             ;;\r
331         esac\r
332     fi\r
333 \r
334     echo 1>&2 "\\r
335 WARNING: I can't seem to be able to run \`tar' with the given arguments.\r
336          You may want to install GNU tar or Free paxutils, or check the\r
337          command line arguments."\r
338     exit 1\r
339     ;;\r
340 \r
341   *)\r
342     echo 1>&2 "\\r
343 WARNING: \`$1' is needed, and is $msg.\r
344          You might have modified some files without having the\r
345          proper tools for further handling them.  Check the \`README' file,\r
346          it often tells you about the needed prerequisites for installing\r
347          this package.  You may also peek at any GNU archive site, in case\r
348          some other package would contain this missing \`$1' program."\r
349     exit 1\r
350     ;;\r
351 esac\r
352 \r
353 exit 0\r
354 \r
355 # Local variables:\r
356 # eval: (add-hook 'write-file-hooks 'time-stamp)\r
357 # time-stamp-start: "scriptversion="\r
358 # time-stamp-format: "%:y-%02m-%02d.%02H"\r
359 # time-stamp-end: "$"\r
360 # End:\r