@@ -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,13 @@ 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]))])
13251341
13261342AC_ARG_WITH([jemalloc],
13271343 [AS_HELP_STRING([--with-jemalloc],[use jemalloc allocator])],
13281344 [with_jemalloc=$withval], [with_jemalloc=no])
13291345AS_IF([test "x$with_jemalloc" = xyes],[
1330- AC_CHECK_LIB([jemalloc ], [malloc_conf ], [], [with_jemalloc=no])
1346+ AC_SEARCH_LIBS([malloc_conf ], [jemalloc ], [], [with_jemalloc=no])
13311347 AC_CHECK_HEADER(jemalloc/jemalloc.h, [
13321348 AC_DEFINE(RUBY_ALTERNATIVE_MALLOC_HEADER, [<jemalloc/jemalloc.h>])
13331349 ])
@@ -3158,7 +3174,6 @@ AC_SUBST(LIBEXT)dnl
31583174AC_SUBST(ASMEXT, S)dnl
31593175
31603176STATIC=
3161- : ${PATHFLAG=''}
31623177
31633178if test "$with_dln_a_out" != yes; then
31643179 rb_cv_dlopen=unknown
@@ -3197,9 +3212,6 @@ if test "$with_dln_a_out" != yes; then
31973212 : ${LDSHARED='$(LD) -b'}
31983213 XLDFLAGS="$XLDFLAGS -Wl,-E"
31993214 : ${LIBPATHENV=SHLIB_PATH}
3200- if test "$rb_cv_prog_gnu_ld" = no; then
3201- RPATHFLAG=' +b %1$-s'
3202- fi
32033215 rb_cv_dlopen=yes],
32043216 [solaris*], [ if test "$GCC" = yes; then
32053217 : ${LDSHARED='$(CC) -shared'}
@@ -3270,7 +3282,6 @@ if test "$with_dln_a_out" != yes; then
32703282 TRY_LINK='$(CC) $(LDFLAGS) -oconftest $(INCFLAGS) -I$(hdrdir) $(CPPFLAGS)'
32713283 TRY_LINK="$TRY_LINK"' $(CFLAGS) $(src) $(LIBPATH) $(LOCAL_LIBS) $(LIBS)'
32723284 : ${LIBPATHENV=LIBPATH}
3273- RPATHFLAG=" ${linker_flag}-blibpath:%1\$-s:${prefix}/lib:${LIBPATH:-/usr/lib:/lib}"
32743285 rb_cv_dlopen=yes],
32753286 [nto-qnx*], [ DLDFLAGS="$DLDFLAGS -L/lib -L/usr/lib -L/usr/local/lib"
32763287 : ${LDSHARED='$(LD) -Bshareable -x'}
@@ -3306,21 +3317,11 @@ if test "$with_dln_a_out" != yes; then
33063317 ])
33073318 fi
33083319
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
3320+ AS_IF([test "$enable_rpath:${RPATHFLAG}" = yes:], [
3321+ AS_IF([test "x$rpathflag" != x], [
33183322 RPATHFLAG=" ${rpathflag}%1\$-s"
3319- break
3320- fi
3321- done
3322- fi
3323- fi
3323+ ])
3324+ ])
33243325fi
33253326if test "${LDSHAREDXX}" = ""; then
33263327 AS_CASE(["${LDSHARED}"],
@@ -4045,12 +4046,6 @@ AS_CASE(["$target_os"],
40454046 FIRSTMAKEFILE=GNUmakefile:nacl/GNUmakefile.in
40464047 ])
40474048
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-
40544049MINIOBJS="$MINIDLNOBJ"
40554050
40564051AS_CASE(["$THREAD_MODEL"],
0 commit comments