[Libguestfs] [PATCH 8/9] ruby: fix detection of ruby library

Pino Toscano ptoscano at redhat.com
Tue Nov 4 15:35:31 UTC 2014


Query RbConfig::CONFIG for "libdir", and use that when trying to link to
the ruby library.  This fixes the libruby detection when it is installed
in a non-standard library directory.
---
 configure.ac | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 1bf291c..e3de428 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1252,9 +1252,15 @@ AS_IF([test "x$enable_ruby" != "xno"],[
         libruby="$(cat conftest)"
         rm conftest
         AS_IF([test -n "$libruby"],[
+            ruby_cmd='puts RbConfig::CONFIG@<:@"libdir"@:>@'
+            echo running: $RUBY -rrbconfig -e \'$ruby_cmd\' >&AS_MESSAGE_LOG_FD
+            $RUBY -rrbconfig -e "$ruby_cmd" >conftest 2>&AS_MESSAGE_LOG_FD
+            libruby_libdir="$(cat conftest)"
+            rm conftest
+            test -n "$libruby_libdir" && libruby_libdir="-L$libruby_libdir"
             AC_MSG_RESULT([-l$libruby])
             AC_CHECK_LIB([$libruby],[ruby_init],
-                         [have_libruby=1],[have_libruby=])
+                         [have_libruby=1],[have_libruby=],[$libruby_libdir])
         ],[
             AC_MSG_RESULT([not found])
         ])
-- 
1.9.3




More information about the Libguestfs mailing list