rice 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. data/Doxyfile +1 -1
  2. data/Makefile.in +3 -2
  3. data/README +247 -16
  4. data/aclocal.m4 +62 -51
  5. data/configure +1585 -1456
  6. data/extconf.rb +9 -1
  7. data/rice/Arg.hpp +8 -0
  8. data/rice/Arg_impl.hpp +124 -0
  9. data/rice/Arg_operators.cpp +21 -0
  10. data/rice/Arg_operators.hpp +19 -0
  11. data/rice/Constructor.hpp +150 -0
  12. data/rice/Data_Type.ipp +51 -6
  13. data/rice/Director.cpp +19 -0
  14. data/rice/Director.hpp +47 -0
  15. data/rice/Enum.hpp +2 -3
  16. data/rice/Enum.ipp +1 -1
  17. data/rice/Hash.hpp +1 -1
  18. data/rice/Makefile.am +7 -0
  19. data/rice/Makefile.in +18 -7
  20. data/rice/Module_impl.hpp +36 -3
  21. data/rice/Module_impl.ipp +56 -7
  22. data/rice/VM.cpp +2 -2
  23. data/rice/config.hpp +1 -1
  24. data/rice/detail/Arguments.hpp +118 -0
  25. data/rice/detail/Auto_Function_Wrapper.hpp +206 -96
  26. data/rice/detail/Auto_Function_Wrapper.ipp +1687 -144
  27. data/rice/detail/Auto_Member_Function_Wrapper.hpp +234 -123
  28. data/rice/detail/Auto_Member_Function_Wrapper.ipp +1133 -306
  29. data/rice/detail/Caster.hpp +3 -1
  30. data/rice/detail/creation_funcs.hpp +0 -8
  31. data/rice/detail/creation_funcs.ipp +1 -27
  32. data/rice/detail/define_method_and_auto_wrap.hpp +3 -1
  33. data/rice/detail/define_method_and_auto_wrap.ipp +4 -3
  34. data/rice/detail/object_call.ipp +1 -1
  35. data/rice/detail/ruby.hpp +1 -33
  36. data/rice/detail/wrap_function.hpp +103 -48
  37. data/rice/detail/wrap_function.ipp +154 -96
  38. data/rice/generate_code.rb +520 -55
  39. data/rice/global_function.hpp +12 -1
  40. data/rice/global_function.ipp +14 -2
  41. data/ruby/Makefile.in +5 -4
  42. data/ruby/lib/Makefile.in +4 -3
  43. data/ruby/lib/version.rb +1 -1
  44. data/sample/Makefile.in +4 -3
  45. data/test/Makefile.am +2 -0
  46. data/test/Makefile.in +32 -13
  47. data/test/test_Class.cpp +36 -14
  48. data/test/test_Constructor.cpp +176 -1
  49. data/test/test_Data_Type.cpp +121 -0
  50. data/test/test_Director.cpp +225 -0
  51. data/test/test_Enum.cpp +33 -0
  52. data/test/test_Module.cpp +175 -0
  53. data/test/test_global_functions.cpp +70 -1
  54. metadata +27 -7
data/Doxyfile CHANGED
@@ -23,7 +23,7 @@ PROJECT_NAME = Rice
23
23
  # This could be handy for archiving the generated documentation or
24
24
  # if some version control system is used.
25
25
 
26
- PROJECT_NUMBER = 1.1
26
+ PROJECT_NUMBER = 1.2
27
27
 
28
28
  # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
29
29
  # base path where the generated documentation will be put.
@@ -1,4 +1,4 @@
1
- # Makefile.in generated by automake 1.10.1 from Makefile.am.
1
+ # Makefile.in generated by automake 1.10.2 from Makefile.am.
2
2
  # @configure_input@
3
3
 
4
4
  # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -229,6 +229,7 @@ sharedstatedir = @sharedstatedir@
229
229
  srcdir = @srcdir@
230
230
  sysconfdir = @sysconfdir@
231
231
  target_alias = @target_alias@
232
+ top_build_prefix = @top_build_prefix@
232
233
  top_builddir = @top_builddir@
233
234
  top_srcdir = @top_srcdir@
234
235
  AUTOMAKE_OPTIONS = foreign 1.5
@@ -384,7 +385,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
384
385
  unique=`for i in $$list; do \
385
386
  if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
386
387
  done | \
387
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
388
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
388
389
  END { if (nonempty) { for (i in files) print i; }; }'`; \
389
390
  mkid -fID $$unique
390
391
  tags: TAGS
data/README CHANGED
@@ -15,13 +15,17 @@ What Rice gives you:
15
15
  \li Smart pointers for handling garbage collection
16
16
  \li Wrappers for most builtin types to simplify calling code
17
17
 
18
- \section installation Installation
18
+ \section project Project Details
19
+
20
+ The source is hosted on github: http://github.com/jameskilton/rice
21
+
22
+ Bug tracking: http://github.com/jameskilton/rice/issues
19
23
 
20
- There are two ways to install Rice. You can download the tarball from the project
21
- page:
24
+ Mailing List: http://groups.google.com/group/ruby-rice
22
25
 
23
- http://rubyforge.org/projects/rice
26
+ \section installation Installation
24
27
 
28
+ There are two ways to install Rice. You can download the tarball from the repository,
25
29
  extract it and:
26
30
 
27
31
  \code
@@ -36,7 +40,7 @@ or you can install via RubyGems
36
40
  gem install rice
37
41
  \endcode
38
42
 
39
- Note to Windows users: Rice is only known to properly compile and run under Cygwin and Mingw.
43
+ Note to Windows users: Rice is only known to properly compile and run under Cygwin and Mingw.
40
44
 
41
45
  \section tutorial Tutorial
42
46
 
@@ -53,7 +57,8 @@ The first step is to create an extconf.rb file:
53
57
  \endcode
54
58
 
55
59
  Note that we use mkmf-rice instead of mkmf. This will ensure that the
56
- extension will be linked with standard C++ library.
60
+ extension will be linked with standard C++ library along with the Rice
61
+ library, and allow access to the Rice header files.
57
62
 
58
63
  Next we create our extension and save it to test.cpp:
59
64
 
@@ -111,7 +116,7 @@ that this is a class and not some other type of object. Some other
111
116
  naming conventions that are commonly used:
112
117
 
113
118
  \li rb_c variable name prefix for a Class
114
- \li rb_M variable name prefix for a Module
119
+ \li rb_m variable name prefix for a Module
115
120
  \li rb_e variable name prefix for an Exception type
116
121
  \li rb_ function prefix for a function in the Ruby C API
117
122
  \li rb_f_ function prefix to differentiate between an API function that
@@ -147,7 +152,7 @@ Now let's add a method to our class:
147
152
  {
148
153
  Class rb_cTest =
149
154
  define_class("Test")
150
- .define_method("hello", test_hello);
155
+ .define_method("hello", &test_hello);
151
156
  }
152
157
  \endcode
153
158
 
@@ -179,8 +184,8 @@ We could also add an #initialize method to our class:
179
184
  {
180
185
  Class rb_cTest =
181
186
  define_class("Test")
182
- .define_method("initialize", test_initialize);
183
- .define_method("hello", test_hello);
187
+ .define_method("initialize", &test_initialize);
188
+ .define_method("hello", &test_hello);
184
189
  }
185
190
  \endcode
186
191
 
@@ -338,7 +343,7 @@ The Data_Object class can be used to wrap a newly-created object:
338
343
 
339
344
  \code
340
345
  Data_Object<Foo> foo(new Foo);
341
- \endcode
346
+ \endcode
342
347
 
343
348
  or to unwrap an already-created object:
344
349
 
@@ -354,7 +359,7 @@ A Data_Object functions like a smart pointer:
354
359
  foo->foo();
355
360
  std::cout << *foo << std::endl;
356
361
  \endcode
357
-
362
+
358
363
  Like a VALUE or an Object, data stored in a Data_Object will be marked
359
364
  by the garbage collector as long as the Data_Object is on the stack.
360
365
 
@@ -597,7 +602,7 @@ If we write this:
597
602
  extern "C"
598
603
  void Init_Test()
599
604
  {
600
- define_global_function("foo", foo);
605
+ define_global_function("foo", &foo);
601
606
  }
602
607
  \endcode
603
608
 
@@ -612,11 +617,11 @@ To avoid this problem, it is necessary to write a wrapper function:
612
617
  foo(&c);
613
618
  return to_ruby(c);
614
619
  }
615
-
620
+
616
621
  extern "C"
617
622
  void Init_Test()
618
623
  {
619
- define_global_function("foo", wrap_foo);
624
+ define_global_function("foo", &wrap_foo);
620
625
  }
621
626
  \endcode
622
627
 
@@ -625,6 +630,232 @@ have pass-by-variable-reference (it uses pass-by-object-reference).
625
630
 
626
631
  Future versions of Rice will have a cleaner way of dealing with this.
627
632
 
633
+
634
+ \section default_arguments Default Arguments
635
+
636
+ Going back to our initial C++ class example, lets say that hello() now
637
+ take a few arguments for what to return, one which has a default value:
638
+
639
+ \code
640
+ class Test
641
+ {
642
+ public:
643
+ Test();
644
+ std::string hello(std::string first, std::string second = "world");
645
+ };
646
+ \endcode
647
+
648
+ As default parameter information is not available through templates,
649
+ it's necessary to define this in Rice explicitly using Rice::Arg:
650
+
651
+ \code
652
+ #include "rice/Data_Type.hpp"
653
+ #include "rice/Constructor.hpp"
654
+
655
+ using namespace Rice;
656
+
657
+ extern "C"
658
+ void Init_Test()
659
+ {
660
+ Data_Type<Test> rb_cTest =
661
+ define_class<Test>("Test")
662
+ .define_constructor(Constructor<Test>())
663
+ .define_method("hello",
664
+ &Test::hello,
665
+ (Arg("hello"), Arg("second") = "world")
666
+ );
667
+ }
668
+ \endcode
669
+
670
+ The syntax here is simply Arg(nameOfParameter)[ = defaultValue]. The name of the
671
+ parameter is not important (more for readability, and the future for when/if Ruby
672
+ gets named arguments), but the value set via operator= must match the type
673
+ of the given parameter.
674
+
675
+ These Rice::Arg objects must be in the correct order, and if there are more than
676
+ one of them they must be surrounded in parentheses, as above, or the compilation
677
+ will fail.
678
+
679
+ It may be required to explicitly cast the default argument values to their
680
+ appropriate types:
681
+
682
+ \code
683
+ .define_method("hello",
684
+ &Test::hello,
685
+ (Arg("hello"), Arg("second") = (std::string)"world")
686
+ );
687
+ \endcode
688
+
689
+ With this, Ruby will now know about the default arguments, and this wrapper
690
+ can be used as expected:
691
+
692
+ \code
693
+ t = Test.new
694
+ t.hello("hello")
695
+ t.hello("goodnight", "moon")
696
+ \endcode
697
+
698
+
699
+ \section director Director
700
+
701
+ As polymorphism is the most important tennant of Object Oriented Programming,
702
+ it's important that Rice supports polymorphic calls travelling between C++
703
+ and Ruby seemlessly. Super calls from Ruby subclasses back into C++ already work,
704
+ but enabling the other direction requires some extra work. While this isn't
705
+ something Rice can do on it's own, the Rice::Director class hides most of the
706
+ details.
707
+
708
+ Like SWIG_Director, Rice::Director is a class that is used to build a proxy class
709
+ to properly send execution up or down the object heiarchy for that class. Take
710
+ the following class:
711
+
712
+ \code
713
+ class VirtualBase {
714
+ public:
715
+ VirtualBase();
716
+ virtual int doWork();
717
+ virtual int processWorker() = 0;
718
+ };
719
+ \endcode
720
+
721
+ Due to the abstract nature of this class, it will not work at all with Rice
722
+ in it's current form. Any attempt to do so will cause a compilation error due to
723
+ this class not being constructable. Even without the pure virtual function, any
724
+ call to VirtualBase::doWork will stop at the C++ level and not pass down into
725
+ any Ruby subclasses.
726
+
727
+ To properly wrap both of these methods, you'll need to build a proxy class
728
+ that subclasses Rice::Director:
729
+
730
+ \code
731
+ #include "rice/Director.hpp"
732
+
733
+ class VirtualBaseProxy : public VirtualBase, public Rice::Director {
734
+ public:
735
+ VirtualBaseProxy(Object self) : Rice::Director(self) { }
736
+
737
+ virtual int doWork() {
738
+ if(callIsFromRuby("do_work")) {
739
+ return VirtualBase::doWork();
740
+ } else {
741
+ return from_ruby<int>( getSelf().call("do_work") );
742
+ }
743
+ }
744
+
745
+ virtual int processWorker() {
746
+ if(callIsFromRuby("process_worker")) {
747
+ raisePureVirtual();
748
+ } else {
749
+ return from_ruby<int>( getSelf().call("process_worker") );
750
+ }
751
+ }
752
+ };
753
+ \endcode
754
+
755
+ There is a lot going on here, so we'll take go through each part.
756
+
757
+ \code
758
+ class VirtualBaseProxy : public Virtualbase, public Rice::Director {
759
+ \endcode
760
+
761
+ First, the class needs to subclass both the virtual class and Rice::Director.
762
+
763
+ \code
764
+ public:
765
+ VirtualBaseProxy(Object self) : Rice::Director(self) { }
766
+ \endcode
767
+
768
+ For Rice::Director to work its magic, every instance of this class needs to
769
+ have a handle to the Ruby instance of this class as well. The constructor
770
+ must take a Rice::Object as the first argument, then any other arguments follow
771
+ and should be passed back to the superclass as needed. The code here is the
772
+ minimum required for a Rice::Director proxy.
773
+
774
+ \code
775
+ virtual int doWork() {
776
+ if(callIsFromRuby("do_work")) {
777
+ // Call from Ruby via super, head up the stack
778
+ return VirtualBase::doWork();
779
+ } else {
780
+ // Call from C++ heading down the stack, get self
781
+ // and call the method in Ruby, taking care to
782
+ // convert types to and from ruby as needed.
783
+ return from_ruby<int>( getSelf().call("do_work") );
784
+ }
785
+ }
786
+ \endcode
787
+
788
+ Every virtual method needs to have a special definition inside of this proxy class.
789
+ Use Rice::Director::callIsFromRuby to check if execution is passing up or down
790
+ the heirarchy. The name passed to this method needs to be the name as exposed to Ruby
791
+ (which will be seen in the wrapper code below).
792
+
793
+ A special case as seen in the proxy method for processWorker is the raisePureVirtual
794
+ method. In the case of pure virtual methods, the proxy is the top of the heirarchy.
795
+ This proxy could be written more simply:
796
+
797
+ \code
798
+ virtual int processWorker() {
799
+ return from_ruby<int>( getSelf().call("process_worker") );
800
+ }
801
+ \endcode
802
+
803
+ but if the Ruby code accidentally calls #super, the code will get stuck in an infinite loop.
804
+ To prevent this from happening, use Rice::Director::raisePureVirtual to inform users of the
805
+ extension that they should not be calling up into C++ for that method.
806
+
807
+ Once the proxy class is built, it's time to wrap it into Ruby:
808
+
809
+ \code
810
+ extern "C"
811
+ void Init_virtual() {
812
+ // See Caveat below
813
+ define_class<VirtualBase>("__VirtualBase__");
814
+
815
+ define_class<VirtualBaseProxy, VirtualBase>("VirtualBase")
816
+ .define_method("do_work", &VirtualBaseProxy::doWork)
817
+ .define_method("process_worker", &VirtualBaseProxy::processWorker);
818
+ }
819
+ \endcode
820
+
821
+ The wrapping is the same as is described earlier in this document. Expose the class
822
+ VirtualBaseProxy named as VirtualBase, register it as a subclass of VirtualBase,
823
+ and define methods pointing to the proxy object.
824
+
825
+ <b>Caveat</b>: Rice figures out inheritance and class heirarchies solely through
826
+ the types given in define_class. Ideally Rice would be able to handle this edge
827
+ case automatically, but for now you'll still need to tell Rice about the base class
828
+ being wrapped into a Rice::Director proxy, or type casting will throw an exception
829
+ during execution. So as a general rule, make sure that any class you use as SuperClass
830
+ in define_class<Class, SuperClass> is also itself
831
+ exposed.
832
+
833
+ Following this, if you have subclasses of virtual classes that themselves have virtual
834
+ methods, you need to set the Rice::Director proxy as the superclass of that class,
835
+ something like:
836
+
837
+ \code
838
+ // Given a class like this
839
+ class SubVirtual : public VirtualBase {
840
+ public:
841
+ virtual int doMoreWork();
842
+ }
843
+
844
+ // You'd need another Director proxy
845
+ class SubVirtualDirector : public SubVirtual, public VirtualBase, public Rice::Director {
846
+ ...
847
+ }
848
+
849
+ // And expose it in Rice as such
850
+ define_class<SubVirtual, VirtualBaseProxy>("__SubVirtual__");
851
+ define_class<SubVirtualDirector, SubVirtual>("SubVirtual")
852
+ ...
853
+
854
+ \endcode
855
+
856
+ This situation has not been fully tested
857
+
858
+
628
859
  \section motivation Motivation
629
860
 
630
861
  There are a number of common problems when writing C or C++ extensions
@@ -840,7 +1071,7 @@ class:
840
1071
  vm.run()
841
1072
  }
842
1073
  \endcode
843
-
1074
+
844
1075
  If the VM is not initialized from main() -- from a callback, for example
845
1076
  -- then you may need to initialize the stack whenever you use Rice or
846
1077
  the Ruby API:
data/aclocal.m4 CHANGED
@@ -1,4 +1,4 @@
1
- # generated automatically by aclocal 1.10.1 -*- Autoconf -*-
1
+ # generated automatically by aclocal 1.10.2 -*- Autoconf -*-
2
2
 
3
3
  # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4
4
  # 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
@@ -13,13 +13,13 @@
13
13
 
14
14
  m4_ifndef([AC_AUTOCONF_VERSION],
15
15
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
16
- m4_if(AC_AUTOCONF_VERSION, [2.61],,
17
- [m4_warning([this file was generated for autoconf 2.61.
16
+ m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],,
17
+ [m4_warning([this file was generated for autoconf 2.63.
18
18
  You have another version of autoconf. It may work, but is not guaranteed to.
19
19
  If you have problems, you may need to regenerate the build system entirely.
20
20
  To do so, use the procedure documented by the package, typically `autoreconf'.])])
21
21
 
22
- # Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
22
+ # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
23
23
  #
24
24
  # This file is free software; the Free Software Foundation
25
25
  # gives unlimited permission to copy and/or distribute it,
@@ -34,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
34
34
  [am__api_version='1.10'
35
35
  dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
36
36
  dnl require some minimum version. Point them to the right macro.
37
- m4_if([$1], [1.10.1], [],
37
+ m4_if([$1], [1.10.2], [],
38
38
  [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
39
39
  ])
40
40
 
@@ -48,12 +48,12 @@ m4_define([_AM_AUTOCONF_VERSION], [])
48
48
  # AM_SET_CURRENT_AUTOMAKE_VERSION
49
49
  # -------------------------------
50
50
  # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
51
- # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
51
+ # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
52
52
  AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
53
- [AM_AUTOMAKE_VERSION([1.10.1])dnl
53
+ [AM_AUTOMAKE_VERSION([1.10.2])dnl
54
54
  m4_ifndef([AC_AUTOCONF_VERSION],
55
55
  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
56
- _AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
56
+ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
57
57
 
58
58
  # AM_AUX_DIR_EXPAND -*- Autoconf -*-
59
59
 
@@ -303,57 +303,68 @@ _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
303
303
 
304
304
  # Generate code to set up dependency tracking. -*- Autoconf -*-
305
305
 
306
- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
306
+ # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
307
307
  # Free Software Foundation, Inc.
308
308
  #
309
309
  # This file is free software; the Free Software Foundation
310
310
  # gives unlimited permission to copy and/or distribute it,
311
311
  # with or without modifications, as long as this notice is preserved.
312
312
 
313
- #serial 3
313
+ #serial 5
314
314
 
315
315
  # _AM_OUTPUT_DEPENDENCY_COMMANDS
316
316
  # ------------------------------
317
317
  AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
318
- [for mf in $CONFIG_FILES; do
319
- # Strip MF so we end up with the name of the file.
320
- mf=`echo "$mf" | sed -e 's/:.*$//'`
321
- # Check whether this is an Automake generated Makefile or not.
322
- # We used to match only the files named `Makefile.in', but
323
- # some people rename them; so instead we look at the file content.
324
- # Grep'ing the first line is not enough: some people post-process
325
- # each Makefile.in and add a new line on top of each file to say so.
326
- # Grep'ing the whole file is not good either: AIX grep has a line
327
- # limit of 2048, but all sed's we know have understand at least 4000.
328
- if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
329
- dirpart=`AS_DIRNAME("$mf")`
330
- else
331
- continue
332
- fi
333
- # Extract the definition of DEPDIR, am__include, and am__quote
334
- # from the Makefile without running `make'.
335
- DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
336
- test -z "$DEPDIR" && continue
337
- am__include=`sed -n 's/^am__include = //p' < "$mf"`
338
- test -z "am__include" && continue
339
- am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
340
- # When using ansi2knr, U may be empty or an underscore; expand it
341
- U=`sed -n 's/^U = //p' < "$mf"`
342
- # Find all dependency output files, they are included files with
343
- # $(DEPDIR) in their names. We invoke sed twice because it is the
344
- # simplest approach to changing $(DEPDIR) to its actual value in the
345
- # expansion.
346
- for file in `sed -n "
347
- s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
348
- sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
349
- # Make sure the directory exists.
350
- test -f "$dirpart/$file" && continue
351
- fdir=`AS_DIRNAME(["$file"])`
352
- AS_MKDIR_P([$dirpart/$fdir])
353
- # echo "creating $dirpart/$file"
354
- echo '# dummy' > "$dirpart/$file"
318
+ [{
319
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
320
+ # are listed without --file. Let's play safe and only enable the eval
321
+ # if we detect the quoting.
322
+ case $CONFIG_FILES in
323
+ *\'*) eval set x "$CONFIG_FILES" ;;
324
+ *) set x $CONFIG_FILES ;;
325
+ esac
326
+ shift
327
+ for mf
328
+ do
329
+ # Strip MF so we end up with the name of the file.
330
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
331
+ # Check whether this is an Automake generated Makefile or not.
332
+ # We used to match only the files named `Makefile.in', but
333
+ # some people rename them; so instead we look at the file content.
334
+ # Grep'ing the first line is not enough: some people post-process
335
+ # each Makefile.in and add a new line on top of each file to say so.
336
+ # Grep'ing the whole file is not good either: AIX grep has a line
337
+ # limit of 2048, but all sed's we know have understand at least 4000.
338
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
339
+ dirpart=`AS_DIRNAME("$mf")`
340
+ else
341
+ continue
342
+ fi
343
+ # Extract the definition of DEPDIR, am__include, and am__quote
344
+ # from the Makefile without running `make'.
345
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
346
+ test -z "$DEPDIR" && continue
347
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
348
+ test -z "am__include" && continue
349
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
350
+ # When using ansi2knr, U may be empty or an underscore; expand it
351
+ U=`sed -n 's/^U = //p' < "$mf"`
352
+ # Find all dependency output files, they are included files with
353
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
354
+ # simplest approach to changing $(DEPDIR) to its actual value in the
355
+ # expansion.
356
+ for file in `sed -n "
357
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
358
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
359
+ # Make sure the directory exists.
360
+ test -f "$dirpart/$file" && continue
361
+ fdir=`AS_DIRNAME(["$file"])`
362
+ AS_MKDIR_P([$dirpart/$fdir])
363
+ # echo "creating $dirpart/$file"
364
+ echo '# dummy' > "$dirpart/$file"
365
+ done
355
366
  done
356
- done
367
+ }
357
368
  ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
358
369
 
359
370
 
@@ -659,13 +670,13 @@ esac
659
670
 
660
671
  # Helper functions for option handling. -*- Autoconf -*-
661
672
 
662
- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
673
+ # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc.
663
674
  #
664
675
  # This file is free software; the Free Software Foundation
665
676
  # gives unlimited permission to copy and/or distribute it,
666
677
  # with or without modifications, as long as this notice is preserved.
667
678
 
668
- # serial 3
679
+ # serial 4
669
680
 
670
681
  # _AM_MANGLE_OPTION(NAME)
671
682
  # -----------------------
@@ -682,7 +693,7 @@ AC_DEFUN([_AM_SET_OPTION],
682
693
  # ----------------------------------
683
694
  # OPTIONS is a space-separated list of Automake options.
684
695
  AC_DEFUN([_AM_SET_OPTIONS],
685
- [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
696
+ [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
686
697
 
687
698
  # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
688
699
  # -------------------------------------------