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-06-29 14:54:44 +0100 |
commit | cba49169094f04dead9b165b6b5991afa92132ff (patch) | |
tree | 1474dd0858674812f8170cd45c4b273a60ff612e | |
parent | b07d0968823d008776345a1c724713d2320e1571 (diff) | |
download | libguestfs-cba49169094f04dead9b165b6b5991afa92132ff.tar.gz libguestfs-cba49169094f04dead9b165b6b5991afa92132ff.tar.xz libguestfs-cba49169094f04dead9b165b6b5991afa92132ff.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.
-rw-r--r-- | configure.ac | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/configure.ac b/configure.ac index d3a86985..7d973aa1 100644 --- a/configure.ac +++ b/configure.ac @@ -979,16 +979,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, |