From e9227902208d2ab96349b60788596dfc2222941a Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Thu, 28 Jan 2016 22:48:44 +0100 Subject: [PATCH] configure: replace buggy AX_RUBY_EXT by a proper implementation This actually allows to get the proper DLEXT expected by Ruby on the target system. --- Makefile.am | 6 +++--- configure.ac | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile.am b/Makefile.am index 808a2369..9ce6760a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -660,7 +660,7 @@ RDIR = bindings/ruby RDOC = $(RDIR)/doc.i RWRAP = $(RDIR)/classes_wrap.cpp ROBJ = $(RWRAP:.cpp=.o) -REXT = $(RDIR)/sigrok.so +REXT = $(RDIR)/sigrok.$(RUBY_DLEXT) $(RDOC): $(srcdir)/bindings/swig/doc.py $(CPPXMLDOC) $(AM_V_GEN)$(PYTHON) $(srcdir)/bindings/swig/doc.py ruby $(CPPXMLDOC) > $@ @@ -683,8 +683,8 @@ $(REXT): $(ROBJ) @ORDER@ bindings/cxx/libsigrokcxx.la ruby-build: $(REXT) ruby-install: $(REXT) - $(INSTALL) -d $(prefix)/$(RBSIGROK_EXTDIR) - $(INSTALL) $< $(prefix)/$(RBSIGROK_EXTDIR) + $(INSTALL) -d $(DESTDIR)$(prefix)/$(RBSIGROK_EXTDIR) + $(INSTALL) $< $(DESTDIR)$(prefix)/$(RBSIGROK_EXTDIR) ruby-clean: -$(AM_V_at)rm -fr $(RDIR)/doc diff --git a/configure.ac b/configure.ac index 88424a8b..c60e403d 100644 --- a/configure.ac +++ b/configure.ac @@ -403,10 +403,16 @@ AS_IF([test "x$BINDINGS_CXX" = xyes], [sr_ruby_missing=], [sr_ruby_missing='C++ bindings']) -AX_RUBY_EXT +AC_PATH_PROGS(RUBY, ["${RUBY-ruby}"], []) +AS_IF([test "x$RUBY" != x], + AC_MSG_CHECKING([for Ruby version]) + [RUBY_VERSION=`$RUBY -e 'puts RUBY_VERSION'`] + AC_MSG_RESULT([$RUBY_VERSION]) + [RUBY_DLEXT=`$RUBY -rrbconfig -e 'puts RbConfig::CONFIG[["DLEXT"]]'`] + AC_SUBST(RUBY_DLEXT)) AS_IF([test "x$RUBY" = x], - [SR_APPEND([sr_ruby_missing], [', '], ['Ruby'])]) + [SR_APPEND([sr_ruby_missing], [', '], [Ruby])]) # Extract major and minor version number of the Ruby interpreter. sr_rbmajor=${RUBY_VERSION%%.*} @@ -430,7 +436,6 @@ AS_IF([test "x$SWIG" = x], AS_IF([test -z "$sr_ruby_missing"], [BINDINGS_RUBY=$enable_ruby], [BINDINGS_RUBY=no]) AM_CONDITIONAL([BINDINGS_RUBY], [test "x$BINDINGS_RUBY" = xyes]) -# AC_SUBST(RUBY_EXT_DLEXT, $RUBY_EXT_DLEXT) #################### ## Java bindings ##