rice 1.4.3 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. data/COPYING +2 -2
  2. data/Doxyfile +1 -1
  3. data/Makefile.in +296 -166
  4. data/README +18 -13
  5. data/Rakefile +3 -2
  6. data/aclocal.m4 +375 -248
  7. data/config.guess +296 -261
  8. data/config.sub +268 -94
  9. data/configure +2789 -3054
  10. data/configure.ac +1 -1
  11. data/depcomp +403 -197
  12. data/extconf.rb +14 -3
  13. data/install-sh +139 -119
  14. data/missing +154 -306
  15. data/rice/Builtin_Object_defn.hpp +0 -1
  16. data/rice/Constructor.hpp +31 -30
  17. data/rice/Data_Object_defn.hpp +8 -2
  18. data/rice/Hash.hpp +26 -9
  19. data/rice/Hash.ipp +52 -60
  20. data/rice/Makefile.am +0 -1
  21. data/rice/Makefile.in +278 -152
  22. data/rice/Module_impl.ipp +1 -1
  23. data/rice/VM.cpp +1 -11
  24. data/rice/config.hpp +3 -0
  25. data/rice/config.hpp.in +3 -0
  26. data/rice/detail/Auto_Function_Wrapper.hpp +69 -0
  27. data/rice/detail/Auto_Function_Wrapper.ipp +815 -512
  28. data/rice/detail/Auto_Member_Function_Wrapper.hpp +69 -0
  29. data/rice/detail/Auto_Member_Function_Wrapper.ipp +543 -272
  30. data/rice/detail/object_call.hpp +1 -0
  31. data/rice/detail/ruby.hpp +0 -9
  32. data/rice/detail/ruby_version_code.hpp +1 -1
  33. data/rice/detail/st.hpp +0 -38
  34. data/rice/protect.hpp +1 -0
  35. data/rice/protect.ipp +1 -0
  36. data/rice/to_from_ruby.ipp +1 -1
  37. data/ruby.ac +2 -2
  38. data/ruby/Makefile.in +221 -134
  39. data/ruby/lib/Makefile.in +133 -44
  40. data/ruby/lib/mkmf-rice.rb.in +1 -4
  41. data/ruby/lib/version.rb +1 -1
  42. data/sample/Makefile.in +96 -31
  43. data/test/Makefile.am +0 -1
  44. data/test/Makefile.in +617 -219
  45. data/test/ext/Makefile.in +96 -31
  46. data/test/test_Class.cpp +2 -2
  47. data/test/test_Data_Object.cpp +11 -11
  48. data/test/test_Hash.cpp +7 -4
  49. data/test/test_Module.cpp +17 -1
  50. data/test/test_To_From_Ruby.cpp +44 -0
  51. data/test/test_rice.rb +2 -2
  52. metadata +29 -43
  53. data/rice/Allocation_Strategies.hpp +0 -37
  54. data/test/test_Allocation_Strategies.cpp +0 -77
data/extconf.rb CHANGED
@@ -17,13 +17,24 @@ require 'rbconfig'
17
17
  require 'ruby/lib/version.rb'
18
18
 
19
19
  prefix_dir = File.join(File.dirname(File.expand_path(__FILE__)), "ruby", "lib")
20
- with_ruby = File.join(Config::CONFIG["bindir"], Config::CONFIG["RUBY_INSTALL_NAME"])
20
+ with_ruby = File.join(RbConfig::CONFIG["bindir"], RbConfig::CONFIG["RUBY_INSTALL_NAME"])
21
+
22
+ if RbConfig::CONFIG["ENABLE_SHARED"] == "no"
23
+ raise <<EOC
24
+ Unfortunately Rice does not work against a Ruby without any shared libraries.
25
+ You'll need to rebuild Ruby with --enable-shared to use this library.
26
+
27
+ If you're on rvm: rvm reinstall [version] -- --enable-shared
28
+ If you're on rbenv: CONFIGURE_OPTS="--enable-shard" rbenv install [version]
29
+ If this is a host environment like Heroku you'll need to contact their support.
30
+ EOC
31
+ end
21
32
 
22
33
  other_opts = ""
23
34
  env = ""
24
35
 
25
- if RUBY_PLATFORM =~ /darwin10/
26
- arch = Config::CONFIG["arch"].split("-")[0]
36
+ if RUBY_PLATFORM =~ /darwin1[0-2]/
37
+ arch = RbConfig::CONFIG["arch"].split("-")[0]
27
38
 
28
39
  if arch == "universal"
29
40
  arch = `uname -m`.strip
data/install-sh CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
  # install - install a program, script, or datafile
3
3
 
4
- scriptversion=2006-10-14.15
4
+ scriptversion=2011-11-20.07; # UTC
5
5
 
6
6
  # This originates from X11R5 (mit/util/scripts/install.sh), which was
7
7
  # later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,7 +35,7 @@ scriptversion=2006-10-14.15
35
35
  # FSF changes to this file are in the public domain.
36
36
  #
37
37
  # Calling this script install-sh is preferred over install.sh, to prevent
38
- # `make' implicit rules from creating a file called install from it
38
+ # 'make' implicit rules from creating a file called install from it
39
39
  # when there is no Makefile.
40
40
  #
41
41
  # This script is compatible with the BSD install script, but was written
@@ -48,7 +48,7 @@ IFS=" "" $nl"
48
48
  # set DOITPROG to echo to test this script
49
49
 
50
50
  # Don't use :- since 4.3BSD and earlier shells don't like it.
51
- doit="${DOITPROG-}"
51
+ doit=${DOITPROG-}
52
52
  if test -z "$doit"; then
53
53
  doit_exec=exec
54
54
  else
@@ -58,34 +58,49 @@ fi
58
58
  # Put in absolute file names if you don't have them in your path;
59
59
  # or use environment vars.
60
60
 
61
- mvprog="${MVPROG-mv}"
62
- cpprog="${CPPROG-cp}"
63
- chmodprog="${CHMODPROG-chmod}"
64
- chownprog="${CHOWNPROG-chown}"
65
- chgrpprog="${CHGRPPROG-chgrp}"
66
- stripprog="${STRIPPROG-strip}"
67
- rmprog="${RMPROG-rm}"
68
- mkdirprog="${MKDIRPROG-mkdir}"
61
+ chgrpprog=${CHGRPPROG-chgrp}
62
+ chmodprog=${CHMODPROG-chmod}
63
+ chownprog=${CHOWNPROG-chown}
64
+ cmpprog=${CMPPROG-cmp}
65
+ cpprog=${CPPROG-cp}
66
+ mkdirprog=${MKDIRPROG-mkdir}
67
+ mvprog=${MVPROG-mv}
68
+ rmprog=${RMPROG-rm}
69
+ stripprog=${STRIPPROG-strip}
70
+
71
+ posix_glob='?'
72
+ initialize_posix_glob='
73
+ test "$posix_glob" != "?" || {
74
+ if (set -f) 2>/dev/null; then
75
+ posix_glob=
76
+ else
77
+ posix_glob=:
78
+ fi
79
+ }
80
+ '
69
81
 
70
- posix_glob=
71
82
  posix_mkdir=
72
83
 
73
84
  # Desired mode of installed file.
74
85
  mode=0755
75
86
 
87
+ chgrpcmd=
76
88
  chmodcmd=$chmodprog
77
89
  chowncmd=
78
- chgrpcmd=
79
- stripcmd=
90
+ mvcmd=$mvprog
80
91
  rmcmd="$rmprog -f"
81
- mvcmd="$mvprog"
92
+ stripcmd=
93
+
82
94
  src=
83
95
  dst=
84
96
  dir_arg=
85
- dstarg=
97
+ dst_arg=
98
+
99
+ copy_on_change=false
86
100
  no_target_directory=
87
101
 
88
- usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
102
+ usage="\
103
+ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
89
104
  or: $0 [OPTION]... SRCFILES... DIRECTORY
90
105
  or: $0 [OPTION]... -t DIRECTORY SRCFILES...
91
106
  or: $0 [OPTION]... -d DIRECTORIES...
@@ -95,65 +110,59 @@ In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
95
110
  In the 4th, create DIRECTORIES.
96
111
 
97
112
  Options:
98
- -c (ignored)
99
- -d create directories instead of installing files.
100
- -g GROUP $chgrpprog installed files to GROUP.
101
- -m MODE $chmodprog installed files to MODE.
102
- -o USER $chownprog installed files to USER.
103
- -s $stripprog installed files.
104
- -t DIRECTORY install into DIRECTORY.
105
- -T report an error if DSTFILE is a directory.
106
- --help display this help and exit.
107
- --version display version info and exit.
113
+ --help display this help and exit.
114
+ --version display version info and exit.
115
+
116
+ -c (ignored)
117
+ -C install only if different (preserve the last data modification time)
118
+ -d create directories instead of installing files.
119
+ -g GROUP $chgrpprog installed files to GROUP.
120
+ -m MODE $chmodprog installed files to MODE.
121
+ -o USER $chownprog installed files to USER.
122
+ -s $stripprog installed files.
123
+ -t DIRECTORY install into DIRECTORY.
124
+ -T report an error if DSTFILE is a directory.
108
125
 
109
126
  Environment variables override the default commands:
110
- CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
127
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
128
+ RMPROG STRIPPROG
111
129
  "
112
130
 
113
131
  while test $# -ne 0; do
114
132
  case $1 in
115
- -c) shift
116
- continue;;
133
+ -c) ;;
117
134
 
118
- -d) dir_arg=true
119
- shift
120
- continue;;
135
+ -C) copy_on_change=true;;
136
+
137
+ -d) dir_arg=true;;
121
138
 
122
139
  -g) chgrpcmd="$chgrpprog $2"
123
- shift
124
- shift
125
- continue;;
140
+ shift;;
126
141
 
127
142
  --help) echo "$usage"; exit $?;;
128
143
 
129
144
  -m) mode=$2
130
- shift
131
- shift
132
145
  case $mode in
133
146
  *' '* | *' '* | *'
134
147
  '* | *'*'* | *'?'* | *'['*)
135
148
  echo "$0: invalid mode: $mode" >&2
136
149
  exit 1;;
137
150
  esac
138
- continue;;
151
+ shift;;
139
152
 
140
153
  -o) chowncmd="$chownprog $2"
141
- shift
142
- shift
143
- continue;;
154
+ shift;;
144
155
 
145
- -s) stripcmd=$stripprog
146
- shift
147
- continue;;
156
+ -s) stripcmd=$stripprog;;
148
157
 
149
- -t) dstarg=$2
150
- shift
151
- shift
152
- continue;;
158
+ -t) dst_arg=$2
159
+ # Protect names problematic for 'test' and other utilities.
160
+ case $dst_arg in
161
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
162
+ esac
163
+ shift;;
153
164
 
154
- -T) no_target_directory=true
155
- shift
156
- continue;;
165
+ -T) no_target_directory=true;;
157
166
 
158
167
  --version) echo "$0 $scriptversion"; exit $?;;
159
168
 
@@ -165,21 +174,26 @@ while test $# -ne 0; do
165
174
 
166
175
  *) break;;
167
176
  esac
177
+ shift
168
178
  done
169
179
 
170
- if test $# -ne 0 && test -z "$dir_arg$dstarg"; then
180
+ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
171
181
  # When -d is used, all remaining arguments are directories to create.
172
182
  # When -t is used, the destination is already specified.
173
183
  # Otherwise, the last argument is the destination. Remove it from $@.
174
184
  for arg
175
185
  do
176
- if test -n "$dstarg"; then
186
+ if test -n "$dst_arg"; then
177
187
  # $@ is not empty: it contains at least $arg.
178
- set fnord "$@" "$dstarg"
188
+ set fnord "$@" "$dst_arg"
179
189
  shift # fnord
180
190
  fi
181
191
  shift # arg
182
- dstarg=$arg
192
+ dst_arg=$arg
193
+ # Protect names problematic for 'test' and other utilities.
194
+ case $dst_arg in
195
+ -* | [=\(\)!]) dst_arg=./$dst_arg;;
196
+ esac
183
197
  done
184
198
  fi
185
199
 
@@ -188,13 +202,17 @@ if test $# -eq 0; then
188
202
  echo "$0: no input file specified." >&2
189
203
  exit 1
190
204
  fi
191
- # It's OK to call `install-sh -d' without argument.
205
+ # It's OK to call 'install-sh -d' without argument.
192
206
  # This can happen when creating conditional directories.
193
207
  exit 0
194
208
  fi
195
209
 
196
210
  if test -z "$dir_arg"; then
197
- trap '(exit $?); exit' 1 2 13 15
211
+ do_exit='(exit $ret); exit $ret'
212
+ trap "ret=129; $do_exit" 1
213
+ trap "ret=130; $do_exit" 2
214
+ trap "ret=141; $do_exit" 13
215
+ trap "ret=143; $do_exit" 15
198
216
 
199
217
  # Set umask so as not to create temps with too-generous modes.
200
218
  # However, 'strip' requires both read and write access to temps.
@@ -222,9 +240,9 @@ fi
222
240
 
223
241
  for src
224
242
  do
225
- # Protect names starting with `-'.
243
+ # Protect names problematic for 'test' and other utilities.
226
244
  case $src in
227
- -*) src=./$src ;;
245
+ -* | [=\(\)!]) src=./$src;;
228
246
  esac
229
247
 
230
248
  if test -n "$dir_arg"; then
@@ -242,22 +260,17 @@ do
242
260
  exit 1
243
261
  fi
244
262
 
245
- if test -z "$dstarg"; then
263
+ if test -z "$dst_arg"; then
246
264
  echo "$0: no destination specified." >&2
247
265
  exit 1
248
266
  fi
249
-
250
- dst=$dstarg
251
- # Protect names starting with `-'.
252
- case $dst in
253
- -*) dst=./$dst ;;
254
- esac
267
+ dst=$dst_arg
255
268
 
256
269
  # If destination is a directory, append the input filename; won't work
257
270
  # if double slashes aren't ignored.
258
271
  if test -d "$dst"; then
259
272
  if test -n "$no_target_directory"; then
260
- echo "$0: $dstarg: Is a directory" >&2
273
+ echo "$0: $dst_arg: Is a directory" >&2
261
274
  exit 1
262
275
  fi
263
276
  dstdir=$dst
@@ -341,7 +354,7 @@ do
341
354
  if test -z "$dir_arg" || {
342
355
  # Check for POSIX incompatibilities with -m.
343
356
  # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
344
- # other-writeable bit of parent directory when it shouldn't.
357
+ # other-writable bit of parent directory when it shouldn't.
345
358
  # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
346
359
  ls_ld_tmpdir=`ls -ld "$tmpdir"`
347
360
  case $ls_ld_tmpdir in
@@ -378,33 +391,26 @@ do
378
391
  # directory the slow way, step by step, checking for races as we go.
379
392
 
380
393
  case $dstdir in
381
- /*) prefix=/ ;;
382
- -*) prefix=./ ;;
383
- *) prefix= ;;
394
+ /*) prefix='/';;
395
+ [-=\(\)!]*) prefix='./';;
396
+ *) prefix='';;
384
397
  esac
385
398
 
386
- case $posix_glob in
387
- '')
388
- if (set -f) 2>/dev/null; then
389
- posix_glob=true
390
- else
391
- posix_glob=false
392
- fi ;;
393
- esac
399
+ eval "$initialize_posix_glob"
394
400
 
395
401
  oIFS=$IFS
396
402
  IFS=/
397
- $posix_glob && set -f
403
+ $posix_glob set -f
398
404
  set fnord $dstdir
399
405
  shift
400
- $posix_glob && set +f
406
+ $posix_glob set +f
401
407
  IFS=$oIFS
402
408
 
403
409
  prefixes=
404
410
 
405
411
  for d
406
412
  do
407
- test -z "$d" && continue
413
+ test X"$d" = X && continue
408
414
 
409
415
  prefix=$prefix$d
410
416
  if test -d "$prefix"; then
@@ -459,41 +465,54 @@ do
459
465
  # ignore errors from any of these, just make sure not to ignore
460
466
  # errors from the above "$doit $cpprog $src $dsttmp" command.
461
467
  #
462
- { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
463
- && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
464
- && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
465
- && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
466
-
467
- # Now rename the file to the real destination.
468
- { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \
469
- || {
470
- # The rename failed, perhaps because mv can't rename something else
471
- # to itself, or perhaps because mv is so ancient that it does not
472
- # support -f.
473
-
474
- # Now remove or move aside any old file at destination location.
475
- # We try this two ways since rm can't unlink itself on some
476
- # systems and the destination file might be busy for other
477
- # reasons. In this case, the final cleanup might fail but the new
478
- # file should still install successfully.
479
- {
480
- if test -f "$dst"; then
481
- $doit $rmcmd -f "$dst" 2>/dev/null \
482
- || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \
483
- && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\
484
- || {
485
- echo "$0: cannot unlink or rename $dst" >&2
486
- (exit 1); exit 1
487
- }
488
- else
489
- :
490
- fi
491
- } &&
492
-
493
- # Now rename the file to the real destination.
494
- $doit $mvcmd "$dsttmp" "$dst"
495
- }
496
- } || exit 1
468
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
469
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
470
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
471
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
472
+
473
+ # If -C, don't bother to copy if it wouldn't change the file.
474
+ if $copy_on_change &&
475
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
476
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
477
+
478
+ eval "$initialize_posix_glob" &&
479
+ $posix_glob set -f &&
480
+ set X $old && old=:$2:$4:$5:$6 &&
481
+ set X $new && new=:$2:$4:$5:$6 &&
482
+ $posix_glob set +f &&
483
+
484
+ test "$old" = "$new" &&
485
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
486
+ then
487
+ rm -f "$dsttmp"
488
+ else
489
+ # Rename the file to the real destination.
490
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
491
+
492
+ # The rename failed, perhaps because mv can't rename something else
493
+ # to itself, or perhaps because mv is so ancient that it does not
494
+ # support -f.
495
+ {
496
+ # Now remove or move aside any old file at destination location.
497
+ # We try this two ways since rm can't unlink itself on some
498
+ # systems and the destination file might be busy for other
499
+ # reasons. In this case, the final cleanup might fail but the new
500
+ # file should still install successfully.
501
+ {
502
+ test ! -f "$dst" ||
503
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
504
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
505
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
506
+ } ||
507
+ { echo "$0: cannot unlink or rename $dst" >&2
508
+ (exit 1); exit 1
509
+ }
510
+ } &&
511
+
512
+ # Now rename the file to the real destination.
513
+ $doit $mvcmd "$dsttmp" "$dst"
514
+ }
515
+ fi || exit 1
497
516
 
498
517
  trap '' 0
499
518
  fi
@@ -503,5 +522,6 @@ done
503
522
  # eval: (add-hook 'write-file-hooks 'time-stamp)
504
523
  # time-stamp-start: "scriptversion="
505
524
  # time-stamp-format: "%:y-%02m-%02d.%02H"
506
- # time-stamp-end: "$"
525
+ # time-stamp-time-zone: "UTC"
526
+ # time-stamp-end: "; # UTC"
507
527
  # End:
data/missing CHANGED
@@ -1,11 +1,10 @@
1
1
  #! /bin/sh
2
- # Common stub for a few missing GNU programs while installing.
2
+ # Common wrapper for a few potentially missing GNU programs.
3
3
 
4
- scriptversion=2006-05-10.23
4
+ scriptversion=2012-06-26.16; # UTC
5
5
 
6
- # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
7
- # Free Software Foundation, Inc.
8
- # Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
6
+ # Copyright (C) 1996-2013 Free Software Foundation, Inc.
7
+ # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
9
8
 
10
9
  # This program is free software; you can redistribute it and/or modify
11
10
  # it under the terms of the GNU General Public License as published by
@@ -18,9 +17,7 @@ scriptversion=2006-05-10.23
18
17
  # GNU General Public License for more details.
19
18
 
20
19
  # You should have received a copy of the GNU General Public License
21
- # along with this program; if not, write to the Free Software
22
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23
- # 02110-1301, USA.
20
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
24
21
 
25
22
  # As a special exception to the GNU General Public License, if you
26
23
  # distribute this file as part of a program that contains a
@@ -28,66 +25,40 @@ scriptversion=2006-05-10.23
28
25
  # the same distribution terms that you use for the rest of that program.
29
26
 
30
27
  if test $# -eq 0; then
31
- echo 1>&2 "Try \`$0 --help' for more information"
28
+ echo 1>&2 "Try '$0 --help' for more information"
32
29
  exit 1
33
30
  fi
34
31
 
35
- run=:
36
- sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
37
- sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
38
-
39
- # In the cases where this matters, `missing' is being run in the
40
- # srcdir already.
41
- if test -f configure.ac; then
42
- configure_ac=configure.ac
43
- else
44
- configure_ac=configure.in
45
- fi
32
+ case $1 in
46
33
 
47
- msg="missing on your system"
34
+ --is-lightweight)
35
+ # Used by our autoconf macros to check whether the available missing
36
+ # script is modern enough.
37
+ exit 0
38
+ ;;
48
39
 
49
- case $1 in
50
- --run)
51
- # Try to run requested program, and just exit if it succeeds.
52
- run=
53
- shift
54
- "$@" && exit 0
55
- # Exit code 63 means version mismatch. This often happens
56
- # when the user try to use an ancient version of a tool on
57
- # a file that requires a minimum version. In this case we
58
- # we should proceed has if the program had been absent, or
59
- # if --run hadn't been passed.
60
- if test $? = 63; then
61
- run=:
62
- msg="probably too old"
63
- fi
64
- ;;
40
+ --run)
41
+ # Back-compat with the calling convention used by older automake.
42
+ shift
43
+ ;;
65
44
 
66
45
  -h|--h|--he|--hel|--help)
67
46
  echo "\
68
47
  $0 [OPTION]... PROGRAM [ARGUMENT]...
69
48
 
70
- Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
71
- error status if there is no known handling for PROGRAM.
49
+ Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
50
+ to PROGRAM being missing or too old.
72
51
 
73
52
  Options:
74
53
  -h, --help display this help and exit
75
54
  -v, --version output version information and exit
76
- --run try to run the given command, and emulate it if it fails
77
55
 
78
56
  Supported PROGRAM values:
79
- aclocal touch file \`aclocal.m4'
80
- autoconf touch file \`configure'
81
- autoheader touch file \`config.h.in'
82
- autom4te touch the output file, or create a stub one
83
- automake touch all \`Makefile.in' files
84
- bison create \`y.tab.[ch]', if possible, from existing .[ch]
85
- flex create \`lex.yy.c', if possible, from existing .c
86
- help2man touch the output file
87
- lex create \`lex.yy.c', if possible, from existing .c
88
- makeinfo touch the output file
89
- tar try tar, gnutar, gtar, then tar without non-portable flags
90
- yacc create \`y.tab.[ch]', if possible, from existing .[ch]
57
+ aclocal autoconf autoheader autom4te automake makeinfo
58
+ bison yacc flex lex help2man
59
+
60
+ Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
61
+ 'g' are ignored when checking the name.
91
62
 
92
63
  Send bug reports to <bug-automake@gnu.org>."
93
64
  exit $?
@@ -99,269 +70,146 @@ Send bug reports to <bug-automake@gnu.org>."
99
70
  ;;
100
71
 
101
72
  -*)
102
- echo 1>&2 "$0: Unknown \`$1' option"
103
- echo 1>&2 "Try \`$0 --help' for more information"
73
+ echo 1>&2 "$0: unknown '$1' option"
74
+ echo 1>&2 "Try '$0 --help' for more information"
104
75
  exit 1
105
76
  ;;
106
77
 
107
78
  esac
108
79
 
109
- # Now exit if we have it, but it failed. Also exit now if we
110
- # don't have it and --version was passed (most likely to detect
111
- # the program).
112
- case $1 in
113
- lex|yacc)
114
- # Not GNU programs, they don't have --version.
115
- ;;
116
-
117
- tar)
118
- if test -n "$run"; then
119
- echo 1>&2 "ERROR: \`tar' requires --run"
120
- exit 1
121
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
122
- exit 1
123
- fi
124
- ;;
125
-
126
- *)
127
- if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
128
- # We have it, but it failed.
129
- exit 1
130
- elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
131
- # Could not run --version or --help. This is probably someone
132
- # running `$TOOL --version' or `$TOOL --help' to check whether
133
- # $TOOL exists and not knowing $TOOL uses missing.
134
- exit 1
135
- fi
136
- ;;
137
- esac
138
-
139
- # If it does not exist, or fails to run (possibly an outdated version),
140
- # try to emulate it.
141
- case $1 in
142
- aclocal*)
143
- echo 1>&2 "\
144
- WARNING: \`$1' is $msg. You should only need it if
145
- you modified \`acinclude.m4' or \`${configure_ac}'. You might want
146
- to install the \`Automake' and \`Perl' packages. Grab them from
147
- any GNU archive site."
148
- touch aclocal.m4
149
- ;;
150
-
151
- autoconf)
152
- echo 1>&2 "\
153
- WARNING: \`$1' is $msg. You should only need it if
154
- you modified \`${configure_ac}'. You might want to install the
155
- \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
156
- archive site."
157
- touch configure
158
- ;;
159
-
160
- autoheader)
161
- echo 1>&2 "\
162
- WARNING: \`$1' is $msg. You should only need it if
163
- you modified \`acconfig.h' or \`${configure_ac}'. You might want
164
- to install the \`Autoconf' and \`GNU m4' packages. Grab them
165
- from any GNU archive site."
166
- files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
167
- test -z "$files" && files="config.h"
168
- touch_files=
169
- for f in $files; do
170
- case $f in
171
- *:*) touch_files="$touch_files "`echo "$f" |
172
- sed -e 's/^[^:]*://' -e 's/:.*//'`;;
173
- *) touch_files="$touch_files $f.in";;
174
- esac
175
- done
176
- touch $touch_files
177
- ;;
178
-
179
- automake*)
180
- echo 1>&2 "\
181
- WARNING: \`$1' is $msg. You should only need it if
182
- you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
183
- You might want to install the \`Automake' and \`Perl' packages.
184
- Grab them from any GNU archive site."
185
- find . -type f -name Makefile.am -print |
186
- sed 's/\.am$/.in/' |
187
- while read f; do touch "$f"; done
188
- ;;
189
-
190
- autom4te)
191
- echo 1>&2 "\
192
- WARNING: \`$1' is needed, but is $msg.
193
- You might have modified some files without having the
194
- proper tools for further handling them.
195
- You can get \`$1' as part of \`Autoconf' from any GNU
196
- archive site."
197
-
198
- file=`echo "$*" | sed -n "$sed_output"`
199
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
200
- if test -f "$file"; then
201
- touch $file
202
- else
203
- test -z "$file" || exec >$file
204
- echo "#! /bin/sh"
205
- echo "# Created by GNU Automake missing as a replacement of"
206
- echo "# $ $@"
207
- echo "exit 0"
208
- chmod +x $file
209
- exit 1
210
- fi
211
- ;;
212
-
213
- bison|yacc)
214
- echo 1>&2 "\
215
- WARNING: \`$1' $msg. You should only need it if
216
- you modified a \`.y' file. You may need the \`Bison' package
217
- in order for those modifications to take effect. You can get
218
- \`Bison' from any GNU archive site."
219
- rm -f y.tab.c y.tab.h
220
- if test $# -ne 1; then
221
- eval LASTARG="\${$#}"
222
- case $LASTARG in
223
- *.y)
224
- SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
225
- if test -f "$SRCFILE"; then
226
- cp "$SRCFILE" y.tab.c
227
- fi
228
- SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
229
- if test -f "$SRCFILE"; then
230
- cp "$SRCFILE" y.tab.h
231
- fi
232
- ;;
233
- esac
234
- fi
235
- if test ! -f y.tab.h; then
236
- echo >y.tab.h
237
- fi
238
- if test ! -f y.tab.c; then
239
- echo 'main() { return 0; }' >y.tab.c
240
- fi
241
- ;;
242
-
243
- lex|flex)
244
- echo 1>&2 "\
245
- WARNING: \`$1' is $msg. You should only need it if
246
- you modified a \`.l' file. You may need the \`Flex' package
247
- in order for those modifications to take effect. You can get
248
- \`Flex' from any GNU archive site."
249
- rm -f lex.yy.c
250
- if test $# -ne 1; then
251
- eval LASTARG="\${$#}"
252
- case $LASTARG in
253
- *.l)
254
- SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
255
- if test -f "$SRCFILE"; then
256
- cp "$SRCFILE" lex.yy.c
257
- fi
258
- ;;
259
- esac
260
- fi
261
- if test ! -f lex.yy.c; then
262
- echo 'main() { return 0; }' >lex.yy.c
263
- fi
264
- ;;
265
-
266
- help2man)
267
- echo 1>&2 "\
268
- WARNING: \`$1' is $msg. You should only need it if
269
- you modified a dependency of a manual page. You may need the
270
- \`Help2man' package in order for those modifications to take
271
- effect. You can get \`Help2man' from any GNU archive site."
272
-
273
- file=`echo "$*" | sed -n "$sed_output"`
274
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
275
- if test -f "$file"; then
276
- touch $file
277
- else
278
- test -z "$file" || exec >$file
279
- echo ".ab help2man is required to generate this page"
280
- exit 1
281
- fi
282
- ;;
283
-
284
- makeinfo)
285
- echo 1>&2 "\
286
- WARNING: \`$1' is $msg. You should only need it if
287
- you modified a \`.texi' or \`.texinfo' file, or any other file
288
- indirectly affecting the aspect of the manual. The spurious
289
- call might also be the consequence of using a buggy \`make' (AIX,
290
- DU, IRIX). You might want to install the \`Texinfo' package or
291
- the \`GNU make' package. Grab either from any GNU archive site."
292
- # The file to touch is that specified with -o ...
293
- file=`echo "$*" | sed -n "$sed_output"`
294
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
295
- if test -z "$file"; then
296
- # ... or it is the one specified with @setfilename ...
297
- infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
298
- file=`sed -n '
299
- /^@setfilename/{
300
- s/.* \([^ ]*\) *$/\1/
301
- p
302
- q
303
- }' $infile`
304
- # ... or it is derived from the source name (dir/f.texi becomes f.info)
305
- test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
306
- fi
307
- # If the file does not exist, the user really needs makeinfo;
308
- # let's fail without touching anything.
309
- test -f $file || exit 1
310
- touch $file
311
- ;;
312
-
313
- tar)
314
- shift
315
-
316
- # We have already tried tar in the generic part.
317
- # Look for gnutar/gtar before invocation to avoid ugly error
318
- # messages.
319
- if (gnutar --version > /dev/null 2>&1); then
320
- gnutar "$@" && exit 0
321
- fi
322
- if (gtar --version > /dev/null 2>&1); then
323
- gtar "$@" && exit 0
324
- fi
325
- firstarg="$1"
326
- if shift; then
327
- case $firstarg in
328
- *o*)
329
- firstarg=`echo "$firstarg" | sed s/o//`
330
- tar "$firstarg" "$@" && exit 0
331
- ;;
332
- esac
333
- case $firstarg in
334
- *h*)
335
- firstarg=`echo "$firstarg" | sed s/h//`
336
- tar "$firstarg" "$@" && exit 0
337
- ;;
338
- esac
339
- fi
340
-
341
- echo 1>&2 "\
342
- WARNING: I can't seem to be able to run \`tar' with the given arguments.
343
- You may want to install GNU tar or Free paxutils, or check the
344
- command line arguments."
345
- exit 1
346
- ;;
347
-
348
- *)
349
- echo 1>&2 "\
350
- WARNING: \`$1' is needed, and is $msg.
351
- You might have modified some files without having the
352
- proper tools for further handling them. Check the \`README' file,
353
- it often tells you about the needed prerequisites for installing
354
- this package. You may also peek at any GNU archive site, in case
355
- some other package would contain this missing \`$1' program."
356
- exit 1
357
- ;;
358
- esac
80
+ # Run the given program, remember its exit status.
81
+ "$@"; st=$?
82
+
83
+ # If it succeeded, we are done.
84
+ test $st -eq 0 && exit 0
85
+
86
+ # Also exit now if we it failed (or wasn't found), and '--version' was
87
+ # passed; such an option is passed most likely to detect whether the
88
+ # program is present and works.
89
+ case $2 in --version|--help) exit $st;; esac
90
+
91
+ # Exit code 63 means version mismatch. This often happens when the user
92
+ # tries to use an ancient version of a tool on a file that requires a
93
+ # minimum version.
94
+ if test $st -eq 63; then
95
+ msg="probably too old"
96
+ elif test $st -eq 127; then
97
+ # Program was missing.
98
+ msg="missing on your system"
99
+ else
100
+ # Program was found and executed, but failed. Give up.
101
+ exit $st
102
+ fi
359
103
 
360
- exit 0
104
+ perl_URL=http://www.perl.org/
105
+ flex_URL=http://flex.sourceforge.net/
106
+ gnu_software_URL=http://www.gnu.org/software
107
+
108
+ program_details ()
109
+ {
110
+ case $1 in
111
+ aclocal|automake)
112
+ echo "The '$1' program is part of the GNU Automake package:"
113
+ echo "<$gnu_software_URL/automake>"
114
+ echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
115
+ echo "<$gnu_software_URL/autoconf>"
116
+ echo "<$gnu_software_URL/m4/>"
117
+ echo "<$perl_URL>"
118
+ ;;
119
+ autoconf|autom4te|autoheader)
120
+ echo "The '$1' program is part of the GNU Autoconf package:"
121
+ echo "<$gnu_software_URL/autoconf/>"
122
+ echo "It also requires GNU m4 and Perl in order to run:"
123
+ echo "<$gnu_software_URL/m4/>"
124
+ echo "<$perl_URL>"
125
+ ;;
126
+ esac
127
+ }
128
+
129
+ give_advice ()
130
+ {
131
+ # Normalize program name to check for.
132
+ normalized_program=`echo "$1" | sed '
133
+ s/^gnu-//; t
134
+ s/^gnu//; t
135
+ s/^g//; t'`
136
+
137
+ printf '%s\n' "'$1' is $msg."
138
+
139
+ configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
140
+ case $normalized_program in
141
+ autoconf*)
142
+ echo "You should only need it if you modified 'configure.ac',"
143
+ echo "or m4 files included by it."
144
+ program_details 'autoconf'
145
+ ;;
146
+ autoheader*)
147
+ echo "You should only need it if you modified 'acconfig.h' or"
148
+ echo "$configure_deps."
149
+ program_details 'autoheader'
150
+ ;;
151
+ automake*)
152
+ echo "You should only need it if you modified 'Makefile.am' or"
153
+ echo "$configure_deps."
154
+ program_details 'automake'
155
+ ;;
156
+ aclocal*)
157
+ echo "You should only need it if you modified 'acinclude.m4' or"
158
+ echo "$configure_deps."
159
+ program_details 'aclocal'
160
+ ;;
161
+ autom4te*)
162
+ echo "You might have modified some maintainer files that require"
163
+ echo "the 'automa4te' program to be rebuilt."
164
+ program_details 'autom4te'
165
+ ;;
166
+ bison*|yacc*)
167
+ echo "You should only need it if you modified a '.y' file."
168
+ echo "You may want to install the GNU Bison package:"
169
+ echo "<$gnu_software_URL/bison/>"
170
+ ;;
171
+ lex*|flex*)
172
+ echo "You should only need it if you modified a '.l' file."
173
+ echo "You may want to install the Fast Lexical Analyzer package:"
174
+ echo "<$flex_URL>"
175
+ ;;
176
+ help2man*)
177
+ echo "You should only need it if you modified a dependency" \
178
+ "of a man page."
179
+ echo "You may want to install the GNU Help2man package:"
180
+ echo "<$gnu_software_URL/help2man/>"
181
+ ;;
182
+ makeinfo*)
183
+ echo "You should only need it if you modified a '.texi' file, or"
184
+ echo "any other file indirectly affecting the aspect of the manual."
185
+ echo "You might want to install the Texinfo package:"
186
+ echo "<$gnu_software_URL/texinfo/>"
187
+ echo "The spurious makeinfo call might also be the consequence of"
188
+ echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
189
+ echo "want to install GNU make:"
190
+ echo "<$gnu_software_URL/make/>"
191
+ ;;
192
+ *)
193
+ echo "You might have modified some files without having the proper"
194
+ echo "tools for further handling them. Check the 'README' file, it"
195
+ echo "often tells you about the needed prerequisites for installing"
196
+ echo "this package. You may also peek at any GNU archive site, in"
197
+ echo "case some other package contains this missing '$1' program."
198
+ ;;
199
+ esac
200
+ }
201
+
202
+ give_advice "$1" | sed -e '1s/^/WARNING: /' \
203
+ -e '2,$s/^/ /' >&2
204
+
205
+ # Propagate the correct exit status (expected to be 127 for a program
206
+ # not found, 63 for a program that failed due to version mismatch).
207
+ exit $st
361
208
 
362
209
  # Local variables:
363
210
  # eval: (add-hook 'write-file-hooks 'time-stamp)
364
211
  # time-stamp-start: "scriptversion="
365
212
  # time-stamp-format: "%:y-%02m-%02d.%02H"
366
- # time-stamp-end: "$"
213
+ # time-stamp-time-zone: "UTC"
214
+ # time-stamp-end: "; # UTC"
367
215
  # End: