Trisurf Monte Carlo simulator
Samo Penic
2014-03-08 c0d703a09da108f218b687beeec671f71b7a44c9
commit | author | age
2870ab 1 #! /bin/sh
0fb40c 2 <<<<<<< HEAD
2870ab 3 # Common wrapper for a few potentially missing GNU programs.
SP 4
5 scriptversion=2012-06-26.16; # UTC
6
7 # Copyright (C) 1996-2013 Free Software Foundation, Inc.
8 # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
0fb40c 9 =======
083e03 10 # Common stub for a few missing GNU programs while installing.
SP 11
12 scriptversion=2012-01-06.13; # UTC
13
14 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
15 # 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
16 # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
0fb40c 17 >>>>>>> dump-state
2870ab 18
SP 19 # This program is free software; you can redistribute it and/or modify
20 # it under the terms of the GNU General Public License as published by
21 # the Free Software Foundation; either version 2, or (at your option)
22 # any later version.
23
24 # This program is distributed in the hope that it will be useful,
25 # but WITHOUT ANY WARRANTY; without even the implied warranty of
26 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27 # GNU General Public License for more details.
28
29 # You should have received a copy of the GNU General Public License
30 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
31
32 # As a special exception to the GNU General Public License, if you
33 # distribute this file as part of a program that contains a
34 # configuration script generated by Autoconf, you may include it under
35 # the same distribution terms that you use for the rest of that program.
36
37 if test $# -eq 0; then
0fb40c 38 <<<<<<< HEAD
2870ab 39   echo 1>&2 "Try '$0 --help' for more information"
SP 40   exit 1
41 fi
42
43 case $1 in
44
45   --is-lightweight)
46     # Used by our autoconf macros to check whether the available missing
47     # script is modern enough.
48     exit 0
49     ;;
50
51   --run)
52     # Back-compat with the calling convention used by older automake.
53     shift
54     ;;
0fb40c 55 =======
083e03 56   echo 1>&2 "Try \`$0 --help' for more information"
SP 57   exit 1
58 fi
59
60 run=:
61 sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
62 sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
63
64 # In the cases where this matters, `missing' is being run in the
65 # srcdir already.
66 if test -f configure.ac; then
67   configure_ac=configure.ac
68 else
69   configure_ac=configure.in
70 fi
71
72 msg="missing on your system"
73
74 case $1 in
75 --run)
76   # Try to run requested program, and just exit if it succeeds.
77   run=
78   shift
79   "$@" && exit 0
80   # Exit code 63 means version mismatch.  This often happens
81   # when the user try to use an ancient version of a tool on
82   # a file that requires a minimum version.  In this case we
83   # we should proceed has if the program had been absent, or
84   # if --run hadn't been passed.
85   if test $? = 63; then
86     run=:
87     msg="probably too old"
88   fi
89   ;;
0fb40c 90 >>>>>>> dump-state
2870ab 91
SP 92   -h|--h|--he|--hel|--help)
93     echo "\
94 $0 [OPTION]... PROGRAM [ARGUMENT]...
95
0fb40c 96 <<<<<<< HEAD
2870ab 97 Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
SP 98 to PROGRAM being missing or too old.
0fb40c 99 =======
083e03 100 Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
SP 101 error status if there is no known handling for PROGRAM.
0fb40c 102 >>>>>>> dump-state
2870ab 103
SP 104 Options:
105   -h, --help      display this help and exit
106   -v, --version   output version information and exit
0fb40c 107 <<<<<<< HEAD
2870ab 108
SP 109 Supported PROGRAM values:
110   aclocal   autoconf  autoheader   autom4te  automake  makeinfo
111   bison     yacc      flex         lex       help2man
112
113 Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
114 'g' are ignored when checking the name.
0fb40c 115 =======
083e03 116   --run           try to run the given command, and emulate it if it fails
SP 117
118 Supported PROGRAM values:
119   aclocal      touch file \`aclocal.m4'
120   autoconf     touch file \`configure'
121   autoheader   touch file \`config.h.in'
122   autom4te     touch the output file, or create a stub one
123   automake     touch all \`Makefile.in' files
124   bison        create \`y.tab.[ch]', if possible, from existing .[ch]
125   flex         create \`lex.yy.c', if possible, from existing .c
126   help2man     touch the output file
127   lex          create \`lex.yy.c', if possible, from existing .c
128   makeinfo     touch the output file
129   yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
130
131 Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
132 \`g' are ignored when checking the name.
0fb40c 133 >>>>>>> dump-state
2870ab 134
SP 135 Send bug reports to <bug-automake@gnu.org>."
136     exit $?
137     ;;
138
139   -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
140     echo "missing $scriptversion (GNU Automake)"
141     exit $?
142     ;;
143
144   -*)
0fb40c 145 <<<<<<< HEAD
2870ab 146     echo 1>&2 "$0: unknown '$1' option"
SP 147     echo 1>&2 "Try '$0 --help' for more information"
0fb40c 148 =======
083e03 149     echo 1>&2 "$0: Unknown \`$1' option"
SP 150     echo 1>&2 "Try \`$0 --help' for more information"
0fb40c 151 >>>>>>> dump-state
2870ab 152     exit 1
SP 153     ;;
154
155 esac
156
0fb40c 157 <<<<<<< HEAD
2870ab 158 # Run the given program, remember its exit status.
SP 159 "$@"; st=$?
160
161 # If it succeeded, we are done.
162 test $st -eq 0 && exit 0
163
164 # Also exit now if we it failed (or wasn't found), and '--version' was
165 # passed; such an option is passed most likely to detect whether the
166 # program is present and works.
167 case $2 in --version|--help) exit $st;; esac
168
169 # Exit code 63 means version mismatch.  This often happens when the user
170 # tries to use an ancient version of a tool on a file that requires a
171 # minimum version.
172 if test $st -eq 63; then
173   msg="probably too old"
174 elif test $st -eq 127; then
175   # Program was missing.
176   msg="missing on your system"
177 else
178   # Program was found and executed, but failed.  Give up.
179   exit $st
180 fi
181
182 perl_URL=http://www.perl.org/
183 flex_URL=http://flex.sourceforge.net/
184 gnu_software_URL=http://www.gnu.org/software
185
186 program_details ()
187 {
188   case $1 in
189     aclocal|automake)
190       echo "The '$1' program is part of the GNU Automake package:"
191       echo "<$gnu_software_URL/automake>"
192       echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
193       echo "<$gnu_software_URL/autoconf>"
194       echo "<$gnu_software_URL/m4/>"
195       echo "<$perl_URL>"
196       ;;
197     autoconf|autom4te|autoheader)
198       echo "The '$1' program is part of the GNU Autoconf package:"
199       echo "<$gnu_software_URL/autoconf/>"
200       echo "It also requires GNU m4 and Perl in order to run:"
201       echo "<$gnu_software_URL/m4/>"
202       echo "<$perl_URL>"
203       ;;
204   esac
205 }
206
207 give_advice ()
208 {
209   # Normalize program name to check for.
210   normalized_program=`echo "$1" | sed '
211     s/^gnu-//; t
212     s/^gnu//; t
213     s/^g//; t'`
214
215   printf '%s\n' "'$1' is $msg."
216
217   configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
218   case $normalized_program in
219     autoconf*)
220       echo "You should only need it if you modified 'configure.ac',"
221       echo "or m4 files included by it."
222       program_details 'autoconf'
223       ;;
224     autoheader*)
225       echo "You should only need it if you modified 'acconfig.h' or"
226       echo "$configure_deps."
227       program_details 'autoheader'
228       ;;
229     automake*)
230       echo "You should only need it if you modified 'Makefile.am' or"
231       echo "$configure_deps."
232       program_details 'automake'
233       ;;
234     aclocal*)
235       echo "You should only need it if you modified 'acinclude.m4' or"
236       echo "$configure_deps."
237       program_details 'aclocal'
238       ;;
239    autom4te*)
240       echo "You might have modified some maintainer files that require"
241       echo "the 'automa4te' program to be rebuilt."
242       program_details 'autom4te'
243       ;;
244     bison*|yacc*)
245       echo "You should only need it if you modified a '.y' file."
246       echo "You may want to install the GNU Bison package:"
247       echo "<$gnu_software_URL/bison/>"
248       ;;
249     lex*|flex*)
250       echo "You should only need it if you modified a '.l' file."
251       echo "You may want to install the Fast Lexical Analyzer package:"
252       echo "<$flex_URL>"
253       ;;
254     help2man*)
255       echo "You should only need it if you modified a dependency" \
256            "of a man page."
257       echo "You may want to install the GNU Help2man package:"
258       echo "<$gnu_software_URL/help2man/>"
259     ;;
260     makeinfo*)
261       echo "You should only need it if you modified a '.texi' file, or"
262       echo "any other file indirectly affecting the aspect of the manual."
263       echo "You might want to install the Texinfo package:"
264       echo "<$gnu_software_URL/texinfo/>"
265       echo "The spurious makeinfo call might also be the consequence of"
266       echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
267       echo "want to install GNU make:"
268       echo "<$gnu_software_URL/make/>"
269       ;;
270     *)
271       echo "You might have modified some files without having the proper"
272       echo "tools for further handling them.  Check the 'README' file, it"
273       echo "often tells you about the needed prerequisites for installing"
274       echo "this package.  You may also peek at any GNU archive site, in"
275       echo "case some other package contains this missing '$1' program."
276       ;;
277   esac
278 }
279
280 give_advice "$1" | sed -e '1s/^/WARNING: /' \
281                        -e '2,$s/^/         /' >&2
282
283 # Propagate the correct exit status (expected to be 127 for a program
284 # not found, 63 for a program that failed due to version mismatch).
285 exit $st
0fb40c 286 =======
083e03 287 # normalize program name to check for.
SP 288 program=`echo "$1" | sed '
289   s/^gnu-//; t
290   s/^gnu//; t
291   s/^g//; t'`
292
293 # Now exit if we have it, but it failed.  Also exit now if we
294 # don't have it and --version was passed (most likely to detect
295 # the program).  This is about non-GNU programs, so use $1 not
296 # $program.
297 case $1 in
298   lex*|yacc*)
299     # Not GNU programs, they don't have --version.
300     ;;
301
302   *)
303     if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
304        # We have it, but it failed.
305        exit 1
306     elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
307        # Could not run --version or --help.  This is probably someone
308        # running `$TOOL --version' or `$TOOL --help' to check whether
309        # $TOOL exists and not knowing $TOOL uses missing.
310        exit 1
311     fi
312     ;;
313 esac
314
315 # If it does not exist, or fails to run (possibly an outdated version),
316 # try to emulate it.
317 case $program in
318   aclocal*)
319     echo 1>&2 "\
320 WARNING: \`$1' is $msg.  You should only need it if
321          you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
322          to install the \`Automake' and \`Perl' packages.  Grab them from
323          any GNU archive site."
324     touch aclocal.m4
325     ;;
326
327   autoconf*)
328     echo 1>&2 "\
329 WARNING: \`$1' is $msg.  You should only need it if
330          you modified \`${configure_ac}'.  You might want to install the
331          \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
332          archive site."
333     touch configure
334     ;;
335
336   autoheader*)
337     echo 1>&2 "\
338 WARNING: \`$1' is $msg.  You should only need it if
339          you modified \`acconfig.h' or \`${configure_ac}'.  You might want
340          to install the \`Autoconf' and \`GNU m4' packages.  Grab them
341          from any GNU archive site."
342     files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
343     test -z "$files" && files="config.h"
344     touch_files=
345     for f in $files; do
346       case $f in
347       *:*) touch_files="$touch_files "`echo "$f" |
348                        sed -e 's/^[^:]*://' -e 's/:.*//'`;;
349       *) touch_files="$touch_files $f.in";;
350       esac
351     done
352     touch $touch_files
353     ;;
354
355   automake*)
356     echo 1>&2 "\
357 WARNING: \`$1' is $msg.  You should only need it if
358          you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
359          You might want to install the \`Automake' and \`Perl' packages.
360          Grab them from any GNU archive site."
361     find . -type f -name Makefile.am -print |
362        sed 's/\.am$/.in/' |
363        while read f; do touch "$f"; done
364     ;;
365
366   autom4te*)
367     echo 1>&2 "\
368 WARNING: \`$1' is needed, but is $msg.
369          You might have modified some files without having the
370          proper tools for further handling them.
371          You can get \`$1' as part of \`Autoconf' from any GNU
372          archive site."
373
374     file=`echo "$*" | sed -n "$sed_output"`
375     test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
376     if test -f "$file"; then
377     touch $file
378     else
379     test -z "$file" || exec >$file
380     echo "#! /bin/sh"
381     echo "# Created by GNU Automake missing as a replacement of"
382     echo "#  $ $@"
383     echo "exit 0"
384     chmod +x $file
385     exit 1
386     fi
387     ;;
388
389   bison*|yacc*)
390     echo 1>&2 "\
391 WARNING: \`$1' $msg.  You should only need it if
392          you modified a \`.y' file.  You may need the \`Bison' package
393          in order for those modifications to take effect.  You can get
394          \`Bison' from any GNU archive site."
395     rm -f y.tab.c y.tab.h
396     if test $# -ne 1; then
397         eval LASTARG=\${$#}
398     case $LASTARG in
399     *.y)
400         SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
401         if test -f "$SRCFILE"; then
402              cp "$SRCFILE" y.tab.c
403         fi
404         SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
405         if test -f "$SRCFILE"; then
406              cp "$SRCFILE" y.tab.h
407         fi
408       ;;
409     esac
410     fi
411     if test ! -f y.tab.h; then
412     echo >y.tab.h
413     fi
414     if test ! -f y.tab.c; then
415     echo 'main() { return 0; }' >y.tab.c
416     fi
417     ;;
418
419   lex*|flex*)
420     echo 1>&2 "\
421 WARNING: \`$1' is $msg.  You should only need it if
422          you modified a \`.l' file.  You may need the \`Flex' package
423          in order for those modifications to take effect.  You can get
424          \`Flex' from any GNU archive site."
425     rm -f lex.yy.c
426     if test $# -ne 1; then
427         eval LASTARG=\${$#}
428     case $LASTARG in
429     *.l)
430         SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
431         if test -f "$SRCFILE"; then
432              cp "$SRCFILE" lex.yy.c
433         fi
434       ;;
435     esac
436     fi
437     if test ! -f lex.yy.c; then
438     echo 'main() { return 0; }' >lex.yy.c
439     fi
440     ;;
441
442   help2man*)
443     echo 1>&2 "\
444 WARNING: \`$1' is $msg.  You should only need it if
445      you modified a dependency of a manual page.  You may need the
446      \`Help2man' package in order for those modifications to take
447      effect.  You can get \`Help2man' from any GNU archive site."
448
449     file=`echo "$*" | sed -n "$sed_output"`
450     test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
451     if test -f "$file"; then
452     touch $file
453     else
454     test -z "$file" || exec >$file
455     echo ".ab help2man is required to generate this page"
456     exit $?
457     fi
458     ;;
459
460   makeinfo*)
461     echo 1>&2 "\
462 WARNING: \`$1' is $msg.  You should only need it if
463          you modified a \`.texi' or \`.texinfo' file, or any other file
464          indirectly affecting the aspect of the manual.  The spurious
465          call might also be the consequence of using a buggy \`make' (AIX,
466          DU, IRIX).  You might want to install the \`Texinfo' package or
467          the \`GNU make' package.  Grab either from any GNU archive site."
468     # The file to touch is that specified with -o ...
469     file=`echo "$*" | sed -n "$sed_output"`
470     test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
471     if test -z "$file"; then
472       # ... or it is the one specified with @setfilename ...
473       infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
474       file=`sed -n '
475     /^@setfilename/{
476       s/.* \([^ ]*\) *$/\1/
477       p
478       q
479     }' $infile`
480       # ... or it is derived from the source name (dir/f.texi becomes f.info)
481       test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
482     fi
483     # If the file does not exist, the user really needs makeinfo;
484     # let's fail without touching anything.
485     test -f $file || exit 1
486     touch $file
487     ;;
488
489   *)
490     echo 1>&2 "\
491 WARNING: \`$1' is needed, and is $msg.
492          You might have modified some files without having the
493          proper tools for further handling them.  Check the \`README' file,
494          it often tells you about the needed prerequisites for installing
495          this package.  You may also peek at any GNU archive site, in case
496          some other package would contain this missing \`$1' program."
497     exit 1
498     ;;
499 esac
500
501 exit 0
0fb40c 502 >>>>>>> dump-state
2870ab 503
SP 504 # Local variables:
505 # eval: (add-hook 'write-file-hooks 'time-stamp)
506 # time-stamp-start: "scriptversion="
507 # time-stamp-format: "%:y-%02m-%02d.%02H"
508 # time-stamp-time-zone: "UTC"
509 # time-stamp-end: "; # UTC"
510 # End: