Richard W.M. Jones
2012-Jun-29 13:59 UTC
[Libguestfs] [PATCH libguestfs 0/3] Fix configure script detection of Ruby.
These three patches ought to fix configure script detection of Ruby, especially on Debian where the Ruby C extensions library can be something like '-lruby1.8'. Rich.
Richard W.M. Jones
2012-Jun-29 13:59 UTC
[Libguestfs] [PATCH libguestfs 1/3] ruby: Remove useless AC_SUBST in configure file.
From: "Richard W.M. Jones" <rjones at redhat.com>
---
configure.ac | 1 -
1 file changed, 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 7150583..439784a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -980,7 +980,6 @@ 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=])
- AC_SUBST([RAKE])
AS_IF([test -n "$HAVE_LIBRUBY"],[
old_LIBS="$LIBS"
LIBS="$LIBS -lruby"
--
1.7.10.2
Richard W.M. Jones
2012-Jun-29 13:59 UTC
[Libguestfs] [PATCH libguestfs 2/3] ruby: Changing spacing in configure file.
From: "Richard W.M. Jones" <rjones at redhat.com>
No functional change.
---
configure.ac | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 439784a..d3a8698 100644
--- a/configure.ac
+++ b/configure.ac
@@ -973,12 +973,12 @@ AM_CONDITIONAL([HAVE_PYTHON],
dnl Check for Ruby and rake (optional, for Ruby bindings).
AC_ARG_ENABLE([ruby],
- AS_HELP_STRING([--disable-ruby], [Disable Ruby language bindings]),
- [],
- [enable_ruby=yes])
+ AS_HELP_STRING([--disable-ruby], [Disable Ruby language bindings]),
+ [],
+ [enable_ruby=yes])
AS_IF([test "x$enable_ruby" != "xno"],[
- AC_CHECK_PROG([RUBY],[ruby],[ruby],[no])
- AC_CHECK_PROG([RAKE],[rake],[rake],[no])
+ 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"
--
1.7.10.2
Richard W.M. Jones
2012-Jun-29 13:59 UTC
[Libguestfs] [PATCH libguestfs 3/3] ruby: Fix detection of library (thanks Hilko Bengen).
From: "Richard W.M. Jones" <rjones at redhat.com>
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.
---
configure.ac | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index d3a8698..7d973aa 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,
--
1.7.10.2
Hilko Bengen
2012-Jun-29 19:58 UTC
[Libguestfs] [PATCH libguestfs 0/3] Fix configure script detection of Ruby.
* Richard W.M. Jones:> These three patches ought to fix configure script detection of Ruby, > especially on Debian where the Ruby C extensions library can be > something like '-lruby1.8'.I came up with a simpler patch. Just tested that it compiles. Will build now and upload 1.18.3-1. Cheers, -Hilko --- a/configure.ac +++ b/configure.ac @@ -1020,11 +1020,12 @@ 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=]) + ruby_soname=`$RUBY -rrbconfig -e 'puts RbConfig::CONFIG[["RUBY_SO_NAME"]]'` + AC_CHECK_LIB([$ruby_soname],[ruby_init],[HAVE_LIBRUBY=1],[HAVE_LIBRUBY=]) AC_SUBST([RAKE]) AS_IF([test -n "$HAVE_LIBRUBY"],[ old_LIBS="$LIBS" - LIBS="$LIBS -lruby" + LIBS="$LIBS -l$ruby_soname" AC_CHECK_FUNCS([rb_hash_lookup]) LIBS="$old_LIBS" ])
Seemingly Similar Threads
- [PATCH 0/2] hivex: small portability fixes
- [PATCH] configure: Move language binding detection to separate files.
- Some fixes for building the Debian package for 1.20.2
- Fixes from the patch queue of the Debian package
- [PATCH 0/9] Small bits of non-Linux porting - #2