Ruby 2.0 has a few new RbConfig variables, {ruby,vendor,site}archhdrdir.
At least rubyarchhdrdir needs to be used to correctly locate
ruby/config.h, since it is architecture specific.

The attached patch adapts configure.ac to recognize ruby2.0/rdoc2.0 and
swig.m4 to use rubyarchhdrdir if it's available.

There's some additional work that may be needed in
build/ac-macros/swig.m4 and tools/dev/unix-build/Makefile.svn, as
sitearchdir isn't necessarily a subset of sitedir for ruby >=2.0.

$ ruby1.9.1 -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]'
/usr/local/lib/site_ruby/1.9.1/x86_64-linux

$ ruby1.9.1 -rrbconfig -e 'puts RbConfig::CONFIG["sitedir"]'
/usr/local/lib/site_ruby

$ ruby2.0 -rrbconfig -e 'puts RbConfig::CONFIG["sitearchdir"]'
/usr/local/lib/x86_64-linux-gnu/site_ruby

$ ruby2.0 -rrbconfig -e 'puts RbConfig::CONFIG["sitedir"]'
/usr/local/lib/site_ruby

Cheers,
-- 
James
GPG Key: 4096R/331BA3DB 2011-12-05 James McCoy <james...@debian.org>
Index: build/ac-macros/swig.m4
===================================================================
--- build/ac-macros/swig.m4	(revision 1583233)
+++ build/ac-macros/swig.m4	(working copy)
@@ -185,7 +185,7 @@
     rbconfig="$RUBY -rrbconfig -e "
 
     for var_name in arch archdir CC LDSHARED DLEXT LIBS LIBRUBYARG \
-                    rubyhdrdir sitedir sitelibdir sitearchdir libdir
+                    rubyhdrdir rubyarchhdrdir sitedir sitelibdir sitearchdir libdir
     do
       rbconfig_tmp=`$rbconfig "print RbConfig::CONFIG@<:@'$var_name'@:>@"`
       eval "rbconfig_$var_name=\"$rbconfig_tmp\""
@@ -196,7 +196,13 @@
     AC_CACHE_CHECK([for Ruby include path], [svn_cv_ruby_includes],[
     if test -d "$rbconfig_rubyhdrdir"; then
       dnl Ruby >=1.9
-      svn_cv_ruby_includes="-I. -I$rbconfig_rubyhdrdir -I$rbconfig_rubyhdrdir/ruby -I$rbconfig_rubyhdrdir/ruby/backward -I$rbconfig_rubyhdrdir/$rbconfig_arch"
+      svn_cv_ruby_includes="-I. -I$rbconfig_rubyhdrdir -I$rbconfig_rubyhdrdir/ruby -I$rbconfig_rubyhdrdir/ruby/backward"
+      if test -d "$rbconfig_rubyarchhdrdir"; then
+        dnl Ruby >=2.0
+        svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyarchhdrdir"
+      else
+        svn_cv_ruby_includes="$svn_cv_ruby_includes -I$rbconfig_rubyhdrdir/$rbconfig_arch"
+      fi
     else
       dnl Ruby 1.8
       svn_cv_ruby_includes="-I. -I$rbconfig_archdir"
Index: configure.ac
===================================================================
--- configure.ac	(revision 1583233)
+++ configure.ac	(working copy)
@@ -1306,7 +1306,7 @@
 if test -n "$RUBY"; then
   AC_PATH_PROG(RUBY, "$RUBY", none)
 else
-  AC_PATH_PROGS(RUBY, ruby ruby1.8 ruby18 ruby1.9 ruby1 ruby1.9.3 ruby193, none)
+  AC_PATH_PROGS(RUBY, ruby ruby1.8 ruby18 ruby1.9 ruby1 ruby1.9.3 ruby193, ruby2.0, none)
 fi
 if test "$RUBY" != "none"; then
   AC_MSG_CHECKING([rb_hash_foreach])
@@ -1315,7 +1315,7 @@
     if test -n "$RDOC"; then
       AC_PATH_PROG(RDOC, "$RDOC", none)
     else
-      AC_PATH_PROGS(RDOC, rdoc rdoc1.8 rdoc18 rdoc1.9 rdoc19 rdoc1.9.3 rdoc193, none)
+      AC_PATH_PROGS(RDOC, rdoc rdoc1.8 rdoc18 rdoc1.9 rdoc19 rdoc1.9.3 rdoc193, rdoc2.0, none)
     fi
     AC_CACHE_CHECK([for Ruby major version], [svn_cv_ruby_major],[
     svn_cv_ruby_major="`$RUBY -rrbconfig -e 'print RbConfig::CONFIG.fetch(%q(MAJOR))'`"

Reply via email to