On 1/25/18, Ferenc Wágner <wf...@niif.hu> wrote:
> Jeffrey Walton <noloa...@gmail.com> writes:
>
>> 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])]
>> )
>
> Thanks for the example!  Why is AC_COMPILE_IFELSE enough?

It isn't.  You will definitely should use AC_LINK_IFELSE to test if the
linker accepts the option.  By itself that won't tell you if the option
actually did anything useful but that likely won't matter for this test.

> Don't you have to invoke the linker itself to see if it accepts the
> option passed through?  And is the "-Wl," part applicable to most/all
> compilers?

There may exist toolchains where this won't work.  They probably don't
support as-needed anyway.  I wouldn't worry about it at all, since normally
this feature is strictly optional and the consequence of a false negative
on the test is essentially zero (the as-needed flag won't be set, the build
will work fine anyway, and your users are happy).  This is in line with the
Autoconf philosophy.

Cheers,
  Nick

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

Reply via email to