On Thu, Jan 25, 2018 at 11:47 AM, Ferenc Wágner <wf...@niif.hu> wrote:
> Zack Weinberg <za...@panix.com> writes:
>
>> ...
>>> You could try setting -Wl,--as-needed (which really should be the
>>> default) in your makefiles.
>>
>> That was unnecessarily cryptic, sorry.
>
> Nevermind, it was fine, I met --as-needed before, but I was somewhat
> wary about using it for no concrete reason (FUD).
>
>> The GNU linker accepts an option --as-needed

Testing for -Wl,--as-needed is like testing for other linker options
like -Wl,--exclude-libs,ALL. The extra gyrations below are due to
problems on AIX, OS X and Solaris. The tools report "illegal option"
or similar but Autotools does not detect the failure.

if test "$IS_APPLE_OS" -eq "0"; then
if test "$IS_SUN_OS" -eq "0"; then
if test "$IS_AIX_OS" -eq "0"; then

SAVED_LDFLAGS="$LDFLAGS"
LDFLAGS="-Wl,--as-needed"

AC_MSG_CHECKING([if $LDNAME supports $LDFLAGS])
  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
    [AC_MSG_RESULT([yes]); AC_SUBST([tr_RESULT], [1])],
    [AC_MSG_RESULT([no]); AC_SUBST([tr_RESULT], [0])]
)

if test "$tr_RESULT" -eq "1"; then
  AM_LDFLAGS="$AM_LDFLAGS $LDFLAGS"
fi

LDFLAGS="$SAVED_LDFLAGS"
fi
fi
fi

_______________________________________________
Autoconf mailing list
Autoconf@gnu.org
https://lists.gnu.org/mailman/listinfo/autoconf

Reply via email to