Index: ruby/xapian.rb
===================================================================
--- ruby/xapian.rb	(revision 227)
+++ ruby/xapian.rb	(working copy)
@@ -36,7 +36,7 @@
 
 module Xapian
   ######## load the SWIG-generated library
-  require '.libs/xapian'
+  require '_xapian'
 
 
   # iterate over two dangerous iterators (i.e. those that can cause segfaults if used
Index: ruby/Makefile.am
===================================================================
--- ruby/Makefile.am	(revision 227)
+++ ruby/Makefile.am	(working copy)
@@ -1,40 +1,42 @@
 ## Process this file with automake to produce Makefile.in
 
-# Override system php.ini with one which just makes sure we can use dl().
-#TESTS_ENVIRONMENT = $(RUBY) -c php.ini -d extension_dir=.libs
+TESTS_ENVIRONMENT = $(RUBY) -I.libs
 
 ## Test programs to be run
-#TESTS = smoketest.rb
+TESTS = smoketest.rb
 
-#if OVERRIDE_MACOSX_DEPLOYMENT_TARGET
+if OVERRIDE_MACOSX_DEPLOYMENT_TARGET
 # This requires GNU make, but apparently that's the default on OS X.
-#export MACOSX_DEPLOYMENT_TARGET=@OVERRIDE_MACOSX_DEPLOYMENT_TARGET@
-#endif
+export MACOSX_DEPLOYMENT_TARGET=@OVERRIDE_MACOSX_DEPLOYMENT_TARGET@
+endif
+
+BUILT_SOURCES = xapian_wrap.cc xapian_wrap.h
+
+EXTRA_DIST = util.i $(TESTS) $(BUILT_SOURCES)
 
-#EXTRA_DIST = php.ini util.i xapian.php $(TESTS)
 #SUBDIRS = docs
 
-#phpextdir = @PHP_EXTENSION_DIR@
+rubylibdir = $(RUBY_LIB)
+rubylib_DATA = xapian.rb
 
-#phpext_LTLIBRARIES = xapian.la
+rubylibarchdir = $(RUBY_LIB_ARCH)
+rubylibarch_LTLIBRARIES = _xapian.la
 
-# Remove the .la file - xapian.la is never linked against (it's a module)
-# and PHP doesn't use libltdl.  Note that the library gets installed by
+# Remove the .la file - _xapian.la is never linked against (it's a module)
+# and Ruby doesn't use libltdl.  Note that the library gets installed by
 # install-data, so that's where we need to hook.
 install-data-hook:
-	rm -f $(DESTDIR)$(rubyextdir)/xapian.la
+	rm -f $(DESTDIR)$(rubylibarchdir)/_xapian.la
 
-#AM_CPPFLAGS = @RUBY_INC@
+AM_CPPFLAGS = -I$(RUBY_INC)
 AM_CXXFLAGS = @SWIG_CXXFLAGS@ $(XAPIAN_CXXFLAGS)
-xapian_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
-xapian_la_SOURCES = xapian_wrap.cc ruby_xapian.h
-xapian_la_LIBADD = $(XAPIAN_LIBS) $(RUBY_LIBS)
-
-BUILT_SOURCES = xapian_wrap.cc ruby_xapian.h
+_xapian_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
+_xapian_la_SOURCES = xapian_wrap.cc xapian_wrap.h
+_xapian_la_LIBADD = $(XAPIAN_LIBS)
 
 if MAINTAINER_MODE
-xapian_wrap.cc ruby_xapian.h xapian.rb: ../xapian.i util.i
-	$(SWIG) -I$(srcdir) @SWIG_FLAGS@ -c++ -ruby -noproxy -o xapian_wrap.cc $(srcdir)/../xapian.i
+xapian_wrap.cc xapian_wrap.h: ../xapian.i util.i
+	$(SWIG) -I$(srcdir) @SWIG_FLAGS@ -c++ -feature _xapian -ruby -o xapian_wrap.cc $(srcdir)/../xapian.i
 endif
 
-MAINTAINERCLEANFILES = $(BUILT_SOURCES) xapian.ruby
+MAINTAINERCLEANFILES = $(BUILT_SOURCES)
Index: configure.ac
===================================================================
--- configure.ac	(revision 227)
+++ configure.ac	(working copy)
@@ -444,10 +444,12 @@
     dnl  not sure about 1.6 but hardly anyone uses <1.8.
     version=`$RUBY --version 2>/dev/null`
     case $version in
-    ["ruby 1.[89]*"|"ruby 1.[1-9][0-9]*"|"ruby [2-9]*"|"ruby 1[0-9]*"])
-      dnl OK
-      ;;
+    [ruby\ 1.[89]*]) ;; # Ruby 1.8, 1.9
+    [ruby\ 1.[1-9][0-9]*]) ;; # Ruby 1.10+
+    [ruby\ [2-9]*]) ;; # Ruby 2-Ruby 9
+    [ruby\ 1[0-9]*]) ;; # Ruby 10+
     *)
+      echo "|$version|"
       if test yes = "$with_ruby" ; then
 	AC_MSG_ERROR([Only Ruby 1.8 or newer is supported ($ruby is $version)])
       fi
@@ -455,17 +457,19 @@
       ;;
     esac
     if test -n "$RUBY" ; then
-      RUBY_INC=`$RUBY -rrbconfig -e 'puts Config::CONFIG["archdir"]'`
+      RUBY_INC=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["archdir"]]'`
       AC_SUBST(RUBY_INC)
       dnl Check that ruby.h is there, which is a good way to check that
       dnl the appropriate ruby-dev package has been installed.
       AC_MSG_CHECKING([for $RUBY_INC/ruby.h])
       if test -f "$RUBY_INC/ruby.h" ; then
 	AC_MSG_RESULT(yes)
+	RUBY_LIB=`$RUBY -rrbconfig -e 'puts Config::CONFIG[["rubylibdir"]]'`
+	AC_SUBST(RUBY_LIB)
 	dnl Ruby seems to keep ruby.h in the same directory where C/C++
 	dnl extensions shared libraries go.
-	RUBY_LIB=$RUBY_INC
-	AC_SUBST(RUBY_LIB)
+	RUBY_LIB_ARCH=$RUBY_INC
+	AC_SUBST(RUBY_LIB_ARCH)
 	BINDINGS="$BINDINGS ruby"
       else
 	AC_MSG_RESULT([no (install ruby-dev or ruby-devel package or similar)])
Index: README
===================================================================
--- README	(revision 227)
+++ README	(working copy)
@@ -27,6 +27,8 @@
 PHP		Requires PHP 4 or 5.
 Python		Requires Python 2.1 or later (Python 2.0 could be made to work
 		without too much work).
+Ruby		Requires Ruby 1.8 or later (early Ruby versions haven't been
+		tested, but hardly anyone uses < 1.8).
 Tcl		Requires Tcl 8.1 or later (Tcl 8.0 could be made to work
 		without too much work).
 C#		Tested with Mono C# 1.0.8.
Index: HACKING
===================================================================
--- HACKING	(revision 227)
+++ HACKING	(working copy)
@@ -55,7 +55,6 @@
 worked on producing Xapian bindings for (from http://www.swig.org/compare.html
 and SWIG release notes):
 
-Ruby		Supported by SWIG 1.3.6 onwards
 Mzscheme	Supported by SWIG 1.3.6 onwards
 Ocaml		Supported by SWIG 1.3.14 onwards
 Pike		Supported by SWIG 1.3.14 onwards
Index: xapian.i
===================================================================
--- xapian.i	(revision 227)
+++ xapian.i	(working copy)
@@ -178,7 +178,6 @@
 
 
 // Setters
-%rename("backtrace=") set_backtrace;
 %rename("bias=") set_bias;
 %rename("collapse_key=") set_collapse_key;
 %rename("cutoff=") set_cutoff;
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 227)
+++ Makefile.am	(working copy)
@@ -1,47 +1,5 @@
 ## Process this file with automake to produce Makefile.in
 
-TESTS_ENVIRONMENT = $(RUBY) -r .libs/xapian.so
-
-## Test programs to be run
-TESTS = smoketest.rb
-
-if OVERRIDE_MACOSX_DEPLOYMENT_TARGET
-# This requires GNU make, but apparently that's the default on OS X.
-export MACOSX_DEPLOYMENT_TARGET=@OVERRIDE_MACOSX_DEPLOYMENT_TARGET@
-endif
-
-BUILT_SOURCES = xapian_wrap.cc xapian_wrap.h
-
-EXTRA_DIST = util.i $(TESTS) $(BUILT_SOURCES)
-
-#SUBDIRS = docs
-
-rubylibdir = $(RUBY_LIB)
-
-rubylib_LTLIBRARIES = xapian.la
-
-# Remove the .la file - xapian.la is never linked against (it's a module)
-# and Ruby doesn't use libltdl.  Note that the library gets installed by
-# install-data, so that's where we need to hook.
-install-data-hook:
-	rm -f $(DESTDIR)$(rubylibdir)/xapian.la
-
-AM_CPPFLAGS = -I$(RUBY_INC)
-AM_CXXFLAGS = @SWIG_CXXFLAGS@ $(XAPIAN_CXXFLAGS)
-xapian_la_LDFLAGS = -avoid-version -module $(NO_UNDEFINED)
-xapian_la_SOURCES = xapian_wrap.cc xapian_wrap.h
-xapian_la_LIBADD = $(XAPIAN_LIBS)
-
-BUILT_SOURCES = xapian_wrap.cc ruby_xapian.h
-
-if MAINTAINER_MODE
-xapian_wrap.cc xapian_wrap.h: ../xapian.i util.i
-	$(SWIG) -I$(srcdir) @SWIG_FLAGS@ -c++ -ruby -o xapian_wrap.cc $(srcdir)/../xapian.i
-endif
-
-MAINTAINERCLEANFILES = $(BUILT_SOURCES)
-## Process this file with automake to produce Makefile.in
-
 AUTOMAKE_OPTIONS = 1.8.5
 
 EXTRA_DIST = xapian.i xapian-bindings.spec.in xapian-bindings.spec skiptest\
@@ -49,4 +7,4 @@
 DISTCLEANFILES = xapian-version.h
 
 SUBDIRS = @BINDINGS@
-DIST_SUBDIRS = python php java guile tcl8 csharp
+DIST_SUBDIRS = python php java guile ruby tcl8 csharp
