[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 4/4] ruby: Move checks from autoconf to mkmf; add extra check for rb_alloc_func_t



---
 configure.ac                   |    8 --------
 generator/ruby.ml              |    5 +++--
 ruby/ext/guestfs/extconf.rb.in |    4 ++++
 3 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5129f4f..4c06d32 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1143,14 +1143,6 @@ AS_IF([test "x$enable_ruby" != "xno"],[
             AC_MSG_RESULT([-l$libruby])
             AC_CHECK_LIB([$libruby],[ruby_init],
                          [have_libruby=1],[have_libruby=])
-
-            dnl Symbols that we substitute when missing.
-            AS_IF([test -n "$have_libruby"],[
-                old_LIBS="$LIBS"
-                LIBS="$LIBS -l$libruby"
-                AC_CHECK_FUNCS([rb_hash_lookup])
-                LIBS="$old_LIBS"
-            ])
         ],[
             AC_MSG_RESULT([not found])
         ])
diff --git a/generator/ruby.ml b/generator/ruby.ml
index 4f2c60b..2b15d8c 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -35,8 +35,6 @@ let rec generate_ruby_c () =
   generate_header CStyle LGPLv2plus;
 
   pr "\
-#include <config.h>
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdint.h>
@@ -693,6 +691,9 @@ Init__guestfs (void)
   e_Error = rb_define_class_under (m_guestfs, \"Error\", rb_eStandardError);
 
 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+#ifndef HAVE_TYPE_RB_ALLOC_FUNC_T
+#define rb_alloc_func_t void*
+#endif
   rb_define_alloc_func (c_guestfs, (rb_alloc_func_t) ruby_guestfs_create);
 #endif
 
diff --git a/ruby/ext/guestfs/extconf.rb.in b/ruby/ext/guestfs/extconf.rb.in
index c638a85..afd76ba 100644
--- a/ruby/ext/guestfs/extconf.rb.in
+++ b/ruby/ext/guestfs/extconf.rb.in
@@ -33,5 +33,9 @@ $CFLAGS =
   "#{$CFLAGS} @CFLAGS@ -DGUESTFS_PRIVATE=1 " <<
   "@WARN_CFLAGS@"
 
+have_func("rb_hash_lookup")
+have_func("rb_define_alloc_func")
+have_type("rb_alloc_func_t")
+
 create_header
 create_makefile(extension_name, "@abs_srcdir@")
-- 
1.7.10.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]