[Libguestfs] [PATCH 2/2] ruby: fix detection of ruby library

Pino Toscano ptoscano at redhat.com
Thu Nov 6 16:23:43 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.

(This is the same change as 3d02e53c48266669675cc237f61ae2c4e1816e66
in libguestfs.)
---
 configure.ac | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 3d85afe..554ff87 100644
--- a/configure.ac
+++ b/configure.ac
@@ -376,9 +376,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])
 
             dnl Symbols that we substitute when missing.
             AS_IF([test -n "$have_libruby"],[
-- 
1.9.3




More information about the Libguestfs mailing list