cd0fd5
diff --git a/bindings/Makefile.am b/bindings/Makefile.am
cd0fd5
index 54f5c23..ee85c23 100644
cd0fd5
--- a/bindings/Makefile.am
cd0fd5
+++ b/bindings/Makefile.am
cd0fd5
@@ -35,8 +35,9 @@ install-data-local:
cd0fd5
                 && $(MAKE) install ) \
cd0fd5
            || true
cd0fd5
 	$(AM_V_GEN)test -f ${builddir}/ruby/Makefile \
cd0fd5
-           && ( cd ${builddir}/ruby \
cd0fd5
-                && $(MAKE) EPREFIX=$(DESTDIR)$(exec_prefix) $(RUBY_MAKE_OPTIONS) install ) \
cd0fd5
+           && ( $(MKDIR_P) $(DESTDIR)$(libdir)/ruby/vendor_ruby && cd ${builddir}/ruby \
cd0fd5
+                && $(MAKE) EPREFIX=$(DESTDIR)$(exec_prefix) $(RUBY_MAKE_OPTIONS) \
cd0fd5
+                hdrdir="$(includedir)" rubyhdrdir="$(includedir)" includedir="$(includedir)" install ) \
cd0fd5
            || true
cd0fd5
 	$(AM_V_GEN)test -d ${builddir}/python/build \
cd0fd5
            && ( cd ${builddir}/python \
cd0fd5
@@ -57,7 +58,8 @@ ruby:
cd0fd5
              EPREFIX=$(exec_prefix) \
cd0fd5
              ABS_TOP_SRCDIR=${abs_top_srcdir} \
cd0fd5
              ABS_TOP_BUILDDIR=${abs_top_builddir} \
cd0fd5
-             $(RUBY_MAKE_OPTIONS) RUBYARCHDIR= )
cd0fd5
+             $(RUBY_MAKE_OPTIONS) hdrdir="$(includedir)" \
cd0fd5
+             rubyhdrdir="$(includedir)" includedir="$(includedir)" RUBYARCHDIR= )
cd0fd5
 
cd0fd5
 # rules for building the python module
cd0fd5
 python: