diff --git a/configure.ac b/configure.ac index 0acadac2e6..9ce7538aae 100644 --- a/configure.ac +++ b/configure.ac @@ -3383,6 +3383,11 @@ AS_CASE("$enable_shared", [yes], [ AC_DEFINE_UNQUOTED(LIBDIR_BASENAME, ["${libdir_basename}"]) libdir_basename="${libdir_basename}"${multiarch+'/${arch}'} + RUBY_TRY_LDFLAGS([${linker_flag}--no-as-needed], [no_as_needed=yes], [no_as_needed=no]) + AS_IF([test "$no_as_needed" = yes], [ + RUBY_APPEND_OPTIONS(LDFLAGS, [${linker_flag}--no-as-needed]) + ]) + AS_CASE(["$target_os"], [freebsd*|dragonfly*], [], [