aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Marc-Antoine Perennou <Marc-Antoine@Perennou.com> 2012-01-20 15:53:50 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-02-19 13:17:40 +0000
commit5484572bbf04e0008f3f9200dd9f082fb7d7c1ad (patch)
treeccb24ff653b3e18422e117d8cdd93dd2f39b2198
parent9777bd7a2393017baf0c3fdf41cfe0d13d9cc66c (diff)
downloadpaludis-5484572bbf04e0008f3f9200dd9f082fb7d7c1ad.tar.gz
paludis-5484572bbf04e0008f3f9200dd9f082fb7d7c1ad.tar.xz
ruby: Fix build with ruby 1.9
And btw, refactor a little 1.8 autotools chain Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
-rw-r--r--configure.ac91
-rw-r--r--ruby/Makefile.am10
2 files changed, 53 insertions, 48 deletions
diff --git a/configure.ac b/configure.ac
index 19d5863..ed5a6cc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1169,18 +1169,51 @@ AC_ARG_ENABLE([ruby],
AC_MSG_RESULT($enable_ruby)
if test "x$enable_ruby" = "xyes" ; then
- AC_CHECK_PROGS(RUBY, ruby, )
- if test "x$RUBY" = "x" ; then
- AC_MSG_ERROR([Ruby is required for --enable-ruby])
- fi
+ PKG_CHECK_MODULES(RUBY, [ruby-1.9], [
+ RUBY=`pkg-config --variable=ruby ruby-1.9`
+ ], [
+ AC_CHECK_PROGS(RUBY, ruby, )
+ if test "x$RUBY" = "x" ; then
+ AC_MSG_ERROR([Ruby is required for --enable-ruby])
+ fi
- AC_MSG_CHECKING([for Ruby archdir])
- RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'puts Config::CONFIG@<:@"archdir"@:>@'`
- if test "x$RUBY_ARCHDIR" = "x" ; then
- AC_MSG_ERROR([Could not find Ruby archdir])
- fi
- AC_MSG_RESULT([$RUBY_ARCHDIR])
- AC_SUBST([RUBY_ARCHDIR])
+ AC_MSG_CHECKING([for Ruby archdir])
+ RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'puts Config::CONFIG@<:@"archdir"@:>@'`
+ if test "x$RUBY_ARCHDIR" = "x" ; then
+ AC_MSG_ERROR([Could not find Ruby archdir])
+ fi
+ AC_MSG_RESULT([$RUBY_ARCHDIR])
+
+ AC_MSG_CHECKING([for Ruby soname])
+ RUBY_SONAME=`$RUBY -r rbconfig -e 'puts Config::CONFIG@<:@"RUBY_SO_NAME"@:>@'`
+ if test "x$RUBY_SONAME" = "x" ; then
+ AC_MSG_ERROR([Could not find Ruby soname])
+ fi
+ AC_MSG_RESULT([$RUBY_SONAME])
+
+ AC_MSG_CHECKING([for Ruby hdrdir])
+ RUBY_HDRDIR=`$RUBY -r rbconfig -e 'puts Config::CONFIG@<:@"rubyhdrdir"@:>@'`
+ if test "x$RUBY_HDRDIR" = "x" ; then
+ AC_MSG_ERROR([Could not find Ruby hdrdir])
+ elif test "x$RUBY_HDRDIR" = "xnil" ; then
+ RUBY_HDRDIR=$RUBY_ARCHDIR
+ fi
+ AC_MSG_RESULT([$RUBY_HDRDIR])
+
+ AC_MSG_CHECKING([for Ruby hdrarchdir])
+ if test "x$RUBY_ARCHDIR" = "x$RUBY_HDRDIR"; then
+ RUBY_HDRARCHDIR=$RUBY_ARCHDIR
+ else
+ RUBY_HDRARCHDIR=`$RUBY -r rbconfig -e 'puts File.join(Config::CONFIG@<:@"rubyhdrdir"@:>@, Config::CONFIG@<:@"arch"@:>@'\)`
+ if test "x$RUBY_HDRARCHDIR" = "x" ; then
+ AC_MSG_ERROR([Could not find Ruby hdrarchdir])
+ fi
+ fi
+ AC_MSG_RESULT([$RUBY_HDRARCHDIR])
+
+ RUBY_CFLAGS="-I${RUBY_HDRDIR} -I${RUBY_HDRARCHDIR}"
+ RUBY_LIBS="-l${RUBY_SONAME}"
+ ])
AC_MSG_CHECKING([for Ruby sitearchdir])
RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'puts Config::CONFIG@<:@"sitearchdir"@:>@'`
@@ -1188,15 +1221,6 @@ if test "x$enable_ruby" = "xyes" ; then
AC_MSG_ERROR([Could not find Ruby sitearchdir])
fi
AC_MSG_RESULT([$RUBY_SITEARCHDIR])
- AC_SUBST([RUBY_SITEARCHDIR])
-
- AC_MSG_CHECKING([for Ruby soname])
- RUBY_SONAME=`$RUBY -r rbconfig -e 'puts Config::CONFIG@<:@"RUBY_SO_NAME"@:>@'`
- if test "x$RUBY_SONAME" = "x" ; then
- AC_MSG_ERROR([Could not find Ruby soname])
- fi
- AC_MSG_RESULT([$RUBY_SONAME])
- AC_SUBST([RUBY_SONAME])
AC_ARG_WITH([ruby-install-dir],
AS_HELP_STRING([--with-ruby-install-dir=dir], [Specify Ruby installation dir]),
@@ -1207,30 +1231,11 @@ if test "x$enable_ruby" = "xyes" ; then
RUBY_INSTALL_DIR=$RUBY_SITEARCHDIR
fi
AC_MSG_RESULT([$RUBY_INSTALL_DIR])
- AC_SUBST([RUBY_INSTALL_DIR])
-
- AC_MSG_CHECKING([for Ruby hdrdir])
- RUBY_HDRDIR=`$RUBY -r rbconfig -e 'puts Config::CONFIG@<:@"rubyhdrdir"@:>@'`
- if test "x$RUBY_HDRDIR" = "x" ; then
- AC_MSG_ERROR([Could not find Ruby hdrdir])
- elif test "x$RUBY_HDRDIR" = "xnil" ; then
- RUBY_HDRDIR=$RUBY_ARCHDIR
- fi
- AC_MSG_RESULT([$RUBY_HDRDIR])
- AC_SUBST([RUBY_HDRDIR])
-
- AC_MSG_CHECKING([for Ruby hdrarchdir])
- if test "x$RUBY_ARCHDIR" = "x$RUBY_HDRDIR"; then
- RUBY_HDRARCHDIR=$RUBY_ARCHDIR
- else
- RUBY_HDRARCHDIR=`$RUBY -r rbconfig -e 'puts File.join(Config::CONFIG@<:@"rubyhdrdir"@:>@, Config::CONFIG@<:@"arch"@:>@'\)`
- if test "x$RUBY_HDRARCHDIR" = "x" ; then
- AC_MSG_ERROR([Could not find Ruby hdrarchdir])
- fi
- fi
- AC_MSG_RESULT([$RUBY_HDRARCHDIR])
- AC_SUBST([RUBY_HDRARCHDIR])
+ AC_SUBST([RUBY])
+ AC_SUBST([RUBY_CFLAGS])
+ AC_SUBST([RUBY_LIBS])
+ AC_SUBST([RUBY_INSTALL_DIR])
fi
AM_CONDITIONAL([ENABLE_RUBY], test "x$enable_ruby" = "xyes")
dnl }}}
diff --git a/ruby/Makefile.am b/ruby/Makefile.am
index eae6ac1..5e8e79d 100644
--- a/ruby/Makefile.am
+++ b/ruby/Makefile.am
@@ -76,12 +76,12 @@ if ENABLE_RUBY
lib_LTLIBRARIES = libpaludisruby_@PALUDIS_PC_SLOT@.la
-libpaludisruby_@PALUDIS_PC_SLOT@_la_CXXFLAGS = $(AM_CXXFLAGS) -I. -I@RUBY_HDRDIR@ -I@RUBY_HDRARCHDIR@
+libpaludisruby_@PALUDIS_PC_SLOT@_la_CXXFLAGS = $(AM_CXXFLAGS) -I. $(RUBY_CFLAGS)
libpaludisruby_@PALUDIS_PC_SLOT@_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
paludis_ruby_so.o : paludis_ruby_so.cc
if $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) \
- $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) -I$(RUBY_HDRDIR) -I$(RUBY_HDRARCHDIR) -c \
+ $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) $(RUBY_CFLAGS) -c \
-o $@ $(srcdir)/paludis_ruby_so.cc ; then ln -fs .libs/paludis_ruby_so.o $@ ; else rm -f $@ ; exit 1 ; fi
libpaludisruby_@PALUDIS_PC_SLOT@_la_SOURCES = $(IF_RUBY_SOURCES)
@@ -93,7 +93,7 @@ libpaludisruby_@PALUDIS_PC_SLOT@_la_LIBADD = \
$(PTHREAD_LIBS)
check_DATA = .libs/Paludis.so
-rubylibdir = @RUBY_INSTALL_DIR@
+rubylibdir = $(RUBY_INSTALL_DIR)
rubylib_DATA = Paludis.so
.libs/Paludis.so : libpaludisruby_@PALUDIS_PC_SLOT@.la paludis_ruby_so.o
@@ -101,7 +101,7 @@ rubylib_DATA = Paludis.so
$(CXX) -fPIC -shared $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) $(PTHREAD_LIBS) \
- -l@RUBY_SONAME@ \
+ $(RUBY_LIBS) \
-o $@ \
.libs/paludis_ruby_so.o \
-L$(top_builddir)/ruby/.libs -lpaludisruby_@PALUDIS_PC_SLOT@
@@ -110,7 +110,7 @@ Paludis.so : libpaludisruby_@PALUDIS_PC_SLOT@.la paludis_ruby_so.o
$(CXX) -fPIC -shared $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) $(PTHREAD_LIBS) \
- -l@RUBY_SONAME@ \
+ $(RUBY_LIBS) \
-o $@ \
.libs/paludis_ruby_so.o \
-L$(top_builddir)/ruby/.libs -lpaludisruby_@PALUDIS_PC_SLOT@