diff --git a/ChangeLog b/ChangeLog index 938a730570..fc42ede427 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Aug 29 15:03:04 2012 Nobuyoshi Nakada + + * configure.in (LIBDIR_BASENAME): use configured libdir value to fix + --enable-load-relative on systems where libdir is not default value, + overridden in config.site files. [ruby-core:47267] [Bug #6903] + + * ruby.c (ruby_init_loadpath_safe): ditto. + Wed Aug 29 14:34:41 2012 NARUSE, Yui * addr2line.c: SIZE_MAX is defined in stdint.h, so r36755 breaks diff --git a/configure.in b/configure.in index 9a01b70521..3235470908 100644 --- a/configure.in +++ b/configure.in @@ -2569,6 +2569,13 @@ AS_CASE("$enable_shared", [yes], [ SOLIBS='$(LIBS)' fi + # libdir can be overridden in config.site file (on OpenSUSE at least). + libdir_basename=lib + if test "$bindir" = '${exec_prefix}/bin'; then + AS_CASE(["$libdir"], ['${exec_prefix}/'*], [libdir_basename=`basename "$libdir"`]) + fi + AC_DEFINE(LIBDIR_BASENAME, ["${libdir_basename}"]) + AS_CASE(["$target_os"], [freebsd*|dragonfly*], [], [ @@ -2588,7 +2595,7 @@ AS_CASE("$enable_shared", [yes], [ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR)' LIBRUBY_ALIASES='lib$(RUBY_SO_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_SO_NAME).so' if test "$load_relative" = yes; then - LIBRUBY_RPATHFLAGS="'-Wl,-rpath,\$\${ORIGIN}/../lib'" + LIBRUBY_RPATHFLAGS="'-Wl,-rpath,\$\${ORIGIN}/../${libdir_basename}'" LIBRUBY_RELATIVE=yes fi ], @@ -2645,7 +2652,7 @@ AS_CASE("$enable_shared", [yes], [ RUBY_SO_NAME="$RUBY_SO_NAME"'.$(MAJOR).$(MINOR).$(TEENY)' LIBRUBY_LDSHARED='$(CC) -dynamiclib' if test "$load_relative" = yes; then - libprefix='@executable_path/../lib' + libprefix="@executable_path/../${libdir_basename}" LIBRUBY_RELATIVE=yes fi LIBRUBY_DLDFLAGS="$LIBRUBY_DLDFLAGS "'-install_name '${libprefix}'/$(LIBRUBY_SO)' diff --git a/ruby.c b/ruby.c index 0fc524708a..2fbd48f974 100644 --- a/ruby.c +++ b/ruby.c @@ -412,7 +412,11 @@ ruby_init_loadpath_safe(int safe_level) p = strrchr(libpath, '/'); if (p) { static const char bindir[] = "/bin"; +#ifdef LIBDIR_BASENAME + static const char libdir[] = "/"LIBDIR_BASENAME; +#else static const char libdir[] = "/lib"; +#endif const ptrdiff_t bindir_len = (ptrdiff_t)sizeof(bindir) - 1; const ptrdiff_t libdir_len = (ptrdiff_t)sizeof(libdir) - 1; *p = 0;