diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | configure.in | 5 | ||||
-rw-r--r-- | ruby.c | 9 |
3 files changed, 13 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Fri May 21 13:35:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * ruby.c (ruby_init_loadpath_safe): use real path for non-shared + build. + Fri May 21 12:25:58 2010 Nobuyoshi Nakada <nobu@ruby-lang.org> * marshal.c (w_float): use dtoa directly instead of stripping diff --git a/configure.in b/configure.in index c37e8523be..8a3c344b66 100644 --- a/configure.in +++ b/configure.in @@ -2049,6 +2049,7 @@ AC_ARG_ENABLE(shared, AS_HELP_STRING([--enable-shared], [build a shared library for Ruby]), [enable_shared=$enableval]) LIBRUBYARG_SHARED='-l$(RUBY_SO_NAME)' +libprefix='$(libdir)' if test "$enable_shared" = 'yes'; then LIBRUBY='$(LIBRUBY_SO)' LIBRUBYARG='$(LIBRUBYARG_SHARED)' @@ -2117,8 +2118,6 @@ if test "$enable_shared" = 'yes'; then LIBRUBY_LDSHARED='$(CC) -dynamiclib' if test "$load_relative" = yes; then libprefix='@executable_path/../lib' - else - libprefix='$(libdir)' fi LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-install_name '${libprefix}'/$(LIBRUBY_SO)' LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-current_version $(MAJOR).$(MINOR).$(TEENY)' @@ -2134,7 +2133,7 @@ if test "$enable_shared" = 'yes'; then ]) fi if test "$enable_rpath" = yes; then - LIBRUBY_RPATHFLAGS="${linker_flag}-R ${linker_flag}\$(libdir) -L\$(libdir)" + LIBRUBY_RPATHFLAGS="${linker_flag}-R ${linker_flag}${libprefix} -L\$(libdir)" LIBRUBYARG_SHARED="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_SHARED" LIBRUBYARG_STATIC="$LIBRUBY_RPATHFLAGS $LIBRUBYARG_STATIC" fi @@ -370,9 +370,12 @@ ruby_init_loadpath_safe(int safe_level) #elif defined(HAVE_DLADDR) Dl_info dli; if (dladdr(expand_include_path, &dli)) { - VALUE fname = rb_str_new_cstr(dli.dli_fname); - sopath = rb_file_absolute_path(fname, Qnil); - rb_str_resize(fname, 0); + VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict); + char fbuf[MAXPATHLEN]; + char *f = dln_find_file_r(dli.dli_fname, getenv(PATH_ENV), fbuf, sizeof(fbuf)); + VALUE fname = rb_str_new_cstr(f); + rb_str_freeze(fname); + sopath = rb_realpath_internal(Qnil, fname, 1); } else { sopath = rb_str_new(0, 0); |