@@ -787,6 +787,24 @@ AC_DEFUN([RUBY_TRY_LDFLAGS], [
787787 save_LDFLAGS=
788788])
789789
790+ : ${RPATHFLAG=''}
791+ rpathflag=''
792+ AS_IF([test x"${RPATHFLAG}" = x], [
793+ AS_CASE(["$target_os"],
794+ [hpux*], [AS_IF([test "$rb_cv_prog_gnu_ld" = no], [rpathflag='+b '])],
795+ [aix*], [rpathflag='-blibpath:'],
796+ [for rpathflag in -R "-rpath "; do
797+ AS_CASE("$rpathflag",
798+ [*" "], [AS_CASE(["${linker_flag}"],
799+ [*,], [rpathflag=`echo "$rpathflag" | tr ' ' ,`])])
800+ rpathflag="${linker_flag}${rpathflag}"
801+ RUBY_TRY_LDFLAGS([${rpathflag}.], [], [rpathflag=])
802+ AS_IF([test "x${rpathflag}" != x], [])
803+ done])
804+ ], [
805+ rpathflag=`echo "$RPATHFLAG" | sed 's/%.*//'`
806+ ])
807+
790808AS_CASE([$RUBY_PATCHLEVEL], [-*],
791809 [particular_werror_flags=yes], [particular_werror_flags=no])
792810AC_ARG_ENABLE(werror,
@@ -986,7 +1004,7 @@ AC_ARG_WITH(opt-dir,
9861004 [
9871005 val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -I\1/include|g;s/^ //"`
9881006 CPPFLAGS="$CPPFLAGS $val"
989- val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib|g;s/^ //"`
1007+ val=`echo "$PATH_SEPARATOR$withval" | sed "s|$PATH_SEPARATOR\([[^$PATH_SEPARATOR]*]\)| -L\1/lib${rpathflag:+ $rpathflag\\\\1/lib} |g;s/^ //"`
9901008 LDFLAGS="$LDFLAGS $val"
9911009 LDFLAGS_OPTDIR="$val"
9921010 OPT_DIR="$withval"
@@ -1319,15 +1337,15 @@ AC_ARG_WITH([gmp],
13191337AS_IF([test "x$with_gmp" != xno],
13201338 [AC_CHECK_HEADERS(gmp.h)
13211339 AS_IF([test "x$ac_cv_header_gmp_h" != xno],
1322- AC_CHECK_LIB([gmp], [__gmpz_init]))
1323- with_gmp="$ac_cv_lib_gmp___gmpz_init"
1324- AS_IF([test -z "$with_gmp"], [with_gmp=no])])
1340+ AC_SEARCH_LIBS([__gmpz_init], [gmp],
1341+ [AC_DEFINE(HAVE_LIBGMP, 1)]))])
13251342
13261343AC_ARG_WITH([jemalloc],
13271344 [AS_HELP_STRING([--with-jemalloc],[use jemalloc allocator])],
13281345 [with_jemalloc=$withval], [with_jemalloc=no])
13291346AS_IF([test "x$with_jemalloc" = xyes],[
1330- AC_CHECK_LIB([jemalloc], [malloc_conf], [], [with_jemalloc=no])
1347+ AC_SEARCH_LIBS([malloc_conf], [jemalloc],
1348+ [AC_DEFINE(HAVE_LIBJEMALLOC, 1)], [with_jemalloc=no])
13311349 AC_CHECK_HEADER(jemalloc/jemalloc.h, [
13321350 AC_DEFINE(RUBY_ALTERNATIVE_MALLOC_HEADER, [<jemalloc/jemalloc.h>])
13331351 ])
@@ -3158,7 +3176,6 @@ AC_SUBST(LIBEXT)dnl
31583176AC_SUBST(ASMEXT, S)dnl
31593177
31603178STATIC=
3161- : ${PATHFLAG=''}
31623179
31633180if test "$with_dln_a_out" != yes; then
31643181 rb_cv_dlopen=unknown
@@ -3197,9 +3214,6 @@ if test "$with_dln_a_out" != yes; then
31973214 : ${LDSHARED='$(LD) -b'}
31983215 XLDFLAGS="$XLDFLAGS -Wl,-E"
31993216 : ${LIBPATHENV=SHLIB_PATH}
3200- if test "$rb_cv_prog_gnu_ld" = no; then
3201- RPATHFLAG=' +b %1$-s'
3202- fi
32033217 rb_cv_dlopen=yes],
32043218 [solaris*], [ if test "$GCC" = yes; then
32053219 : ${LDSHARED='$(CC) -shared'}
@@ -3270,7 +3284,6 @@ if test "$with_dln_a_out" != yes; then
32703284 TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
32713285 TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
32723286 : ${LIBPATHENV=LIBPATH}
3273- RPATHFLAG=" ${linker_flag}-blibpath:%1\$-s:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}"
32743287 rb_cv_dlopen=yes],
32753288 [nto-qnx*], [ DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
32763289 : ${LDSHARED='$(LD) -Bshareable -x'}
@@ -3306,21 +3319,11 @@ if test "$with_dln_a_out" != yes; then
33063319 ])
33073320 fi
33083321
3309- if test "$enable_rpath" = yes; then
3310- if test x"${RPATHFLAG}" = x; then
3311- for rpathflag in -R "-rpath "; do
3312- AS_CASE("$rpathflag",
3313- [*" "], [AS_CASE(["${linker_flag}"],
3314- [*,], [rpathflag=`echo "$rpathflag" | tr ' ' ,`])])
3315- rpathflag="${linker_flag}${rpathflag}"
3316- RUBY_TRY_LDFLAGS([${rpathflag}.], [], [rpathflag=])
3317- if test "x${rpathflag}" != x; then
3322+ AS_IF([test "$enable_rpath:${RPATHFLAG}" = yes:], [
3323+ AS_IF([test "x$rpathflag" != x], [
33183324 RPATHFLAG=" ${rpathflag}%1\$-s"
3319- break
3320- fi
3321- done
3322- fi
3323- fi
3325+ ])
3326+ ])
33243327fi
33253328if test "${LDSHAREDXX}" = ""; then
33263329 AS_CASE(["${LDSHARED}"],
@@ -4045,12 +4048,6 @@ AS_CASE(["$target_os"],
40454048 FIRSTMAKEFILE=GNUmakefile:nacl/GNUmakefile.in
40464049 ])
40474050
4048- AS_CASE(["$with_gmp: $SOLIBS "], [no:* | *' -lgmp '*|*' $(LIBS) '*], [],
4049- [SOLIBS="-lgmp $SOLIBS"])
4050-
4051- AS_CASE(["$with_jemalloc: $LIBS "], [no:* | *' -ljemalloc '*], [],
4052- [LIBS="-ljemalloc $LIBS"])
4053-
40544051MINIOBJS="$MINIDLNOBJ"
40554052
40564053AS_CASE(["$THREAD_MODEL"],
0 commit comments