diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-06-29 14:54:44 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-07-07 11:20:50 +0100 |
commit | 293a2a108dac3865fcd8e44f92fcc2deb42f9eec (patch) | |
tree | ccabd4a48205446cb98589b9e67b6258caed5fa9 | |
parent | 4364f9825072af83397deae64aaab3a90c22614f (diff) | |
download | libguestfs-293a2a108dac3865fcd8e44f92fcc2deb42f9eec.tar.gz libguestfs-293a2a108dac3865fcd8e44f92fcc2deb42f9eec.tar.xz libguestfs-293a2a108dac3865fcd8e44f92fcc2deb42f9eec.zip |
ruby: Fix detection of library (thanks Hilko Bengen).
On Debian, the Ruby C extensions library isn't '-lruby', it's
something like '-lruby1.8' or '-lruby-1.9.1' and these can even be
parallel-installed.
Fix detection so we use Ruby's own rbconfig.rb file to find the right
library to use.
(cherry picked from commit cba49169094f04dead9b165b6b5991afa92132ff)
-rw-r--r-- | configure.ac | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index 9d603186..88bfc8ec 100644 --- a/configure.ac +++ b/configure.ac @@ -886,16 +886,34 @@ AC_ARG_ENABLE([ruby], AS_IF([test "x$enable_ruby" != "xno"],[ AC_CHECK_PROG([RUBY],[ruby],[ruby],[no]) AC_CHECK_PROG([RAKE],[rake],[rake],[no]) - AC_CHECK_LIB([ruby],[ruby_init],[HAVE_LIBRUBY=1],[HAVE_LIBRUBY=]) - AS_IF([test -n "$HAVE_LIBRUBY"],[ - old_LIBS="$LIBS" - LIBS="$LIBS -lruby" - AC_CHECK_FUNCS([rb_hash_lookup]) - LIBS="$old_LIBS" + + AS_IF([test -n "$RUBY" && test -n "$RAKE"],[ + dnl Find the library. Note on Debian it's not -lruby. + AC_MSG_CHECKING([for C library for Ruby extensions]) + ruby_cmd='puts RbConfig::CONFIG@<:@"RUBY_SO_NAME"@:>@' + echo running: $RUBY -rrbconfig -e \'$ruby_cmd\' >&AS_MESSAGE_LOG_FD + $RUBY -rrbconfig -e "$ruby_cmd" >conftest 2>&AS_MESSAGE_LOG_FD + libruby="$(cat conftest)" + rm conftest + AS_IF([test -n "$libruby"],[ + 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]) ]) + ]) ]) AM_CONDITIONAL([HAVE_RUBY], - [test "x$RAKE" != "xno" && test -n "$HAVE_LIBRUBY"]) + [test -n "$RUBY" && test -n "$RAKE" && test -n "$have_libruby"]) dnl Check for Java. AC_ARG_WITH(java_home, |