+ AC_SUBST(configure_args, "`echo "${ac_configure_args}" | sed 's/\\$/$$/g'`")dnl
+
+diff --git a/loadpath.c b/loadpath.c
+index 623dc9d..74c5d9e 100644
+--- a/loadpath.c
++++ b/loadpath.c
+@@ -94,6 +94,10 @@ const char ruby_initial_load_paths[] =
+ #endif
+ #endif
+
++#ifdef RUBYGEMS_DIR
++ RUBYGEMS_DIR "\0"
++#endif
++
+ RUBY_LIB "\0"
+ #ifdef RUBY_THINARCH
+ RUBY_ARCH_LIB_FOR(RUBY_THINARCH) "\0"
+diff --git a/template/verconf.h.in b/template/verconf.h.in
+index 79c003e..34f2382 100644
+--- a/template/verconf.h.in
++++ b/template/verconf.h.in
+@@ -34,6 +34,9 @@
+ % if C["RUBY_SEARCH_PATH"]
+ #define RUBY_SEARCH_PATH "${RUBY_SEARCH_PATH}"
+ % end
++% if C["rubygemsdir"]
++#define RUBYGEMS_DIR "${rubygemsdir}"
++% end
+ %
+ % R = {}
+ % R["ruby_version"] = '"RUBY_LIB_VERSION"'