summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--configure.in20
-rw-r--r--ruby.c9
-rw-r--r--version.h4
4 files changed, 37 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f97d90c9bb..f5d24d9628 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Tue Mar 10 00:06:21 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in (load_relative): new option to enable load path
+ relative to libruby_so.
+
+ * ruby.c (ruby_init_loadpath_safe): added the case using dladdr().
+
Mon Mar 9 16:49:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rake: updated to rake code to rake-0.8.4 source code base.
diff --git a/configure.in b/configure.in
index fc2dab21f5..5b01e0fa69 100644
--- a/configure.in
+++ b/configure.in
@@ -198,6 +198,10 @@ if test $frame_address = yes; then
AC_DEFINE(USE_BUILTIN_FRAME_ADDRESS)
fi
+AC_ARG_ENABLE(load-relative,
+ [ --enable-load-relative resolve load paths at run time. ],
+ [load_relative=$enableval])
+
AC_ARG_PROGRAM
dnl Checks for programs.
@@ -1777,6 +1781,15 @@ else
DLEXT=so;;
esac
fi
+if test "$rb_cv_dlopen:$load_relative" = yes:yes; then
+ AC_CHECK_FUNCS(dladdr)
+ if test "$ac_cv_func_dladdr" = yes; then
+ LOAD_RELATIVE=1
+ else
+ unset load_relative
+ fi
+fi
+
len=2 # .rb
n=`expr "$DLEXT" : '.*'`; test "$n" -gt "$len" && len=$n
n=`expr "$DLEXT2" : '.*'`; test "$n" -gt "$len" && len=$n
@@ -1941,7 +1954,12 @@ if test "$enable_shared" = 'yes'; then
when(darwin*)
RUBY_SO_NAME="$RUBY_SO_NAME"'.$(MAJOR).$(MINOR).$(TEENY)'
LIBRUBY_LDSHARED='cc -dynamiclib -undefined suppress -flat_namespace'
- LIBRUBY_DLDFLAGS='-install_name $(libdir)/lib$(RUBY_SO_NAME).dylib'
+ if test "$load_relative" = yes; then
+ libprefix='@executable_path/..'
+ else
+ libprefix='$(libdir)'
+ fi
+ LIBRUBY_DLDFLAGS='-install_name '${libprefix}'/lib/lib$(RUBY_SO_NAME).dylib'
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(MAJOR).$(MINOR).$(TEENY)'
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-compatibility_version $(MAJOR).$(MINOR).$(TEENY)'
LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-Wl,-unexported_symbol,_Init_* $(XLDFLAGS)'
diff --git a/ruby.c b/ruby.c
index b9a8ce27a5..e712c2656d 100644
--- a/ruby.c
+++ b/ruby.c
@@ -26,6 +26,9 @@
#ifdef __hpux
#include <sys/pstat.h>
#endif
+#if defined(LOAD_RELATIVE) && defined(HAVE_DLADDR)
+#include <dlfcn.h>
+#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
@@ -352,10 +355,16 @@ ruby_init_loadpath_safe(int safe_level)
char *p;
int rest;
+ libpath[0] = '\0';
#if defined _WIN32 || defined __CYGWIN__
GetModuleFileName(libruby, libpath, sizeof libpath);
#elif defined(__EMX__)
_execname(libpath, sizeof(libpath) - 1);
+#elif defined(HAVE_DLADDR)
+ Dl_info dli;
+ if (dladdr(ruby_init_loadpath_safe, &dli)) {
+ strlcpy(libpath, dli.dli_fname, sizeof(libpath));
+ }
#endif
libpath[sizeof(libpath) - 1] = '\0';
diff --git a/version.h b/version.h
index a7ad468d6f..de40ddcac1 100644
--- a/version.h
+++ b/version.h
@@ -1,5 +1,5 @@
#define RUBY_VERSION "1.9.2"
-#define RUBY_RELEASE_DATE "2009-03-09"
+#define RUBY_RELEASE_DATE "2009-03-10"
#define RUBY_PATCHLEVEL -1
#define RUBY_BRANCH_NAME "trunk"
@@ -8,7 +8,7 @@
#define RUBY_VERSION_TEENY 1
#define RUBY_RELEASE_YEAR 2009
#define RUBY_RELEASE_MONTH 3
-#define RUBY_RELEASE_DAY 9
+#define RUBY_RELEASE_DAY 10
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];