summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-21 04:35:58 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-21 04:35:58 +0000
commit73997d38f41e05c8ebe614cc062d5355662320a1 (patch)
tree25713ac01cdbac5ec70bb547a5838a2ee3e4e97f
parentb32e8a5911d35b86916386e6b40f63d437ce8e2c (diff)
* ruby.c (ruby_init_loadpath_safe): use real path for non-shared
build. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--configure.in5
-rw-r--r--ruby.c9
3 files changed, 13 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index acf01fb034..aa06fd8e9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/ruby.c b/ruby.c
index dbae66e1ac..fadb7cc0fe 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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);