autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to autoconf figure out what library need to be linked to?


From: Michael Orlitzky
Subject: Re: How to autoconf figure out what library need to be linked to?
Date: Thu, 06 May 2021 20:35:27 -0400
User-agent: Evolution 3.38.4

On Tue, 2021-03-30 at 11:47 -0500, Peng Yu wrote:
> Hi,
> 
> crypt(3) does not need -lcrypt on macOS, but need -lcrypt on Linux.
> How does autoconf determine what library needs to be linked based on
> the source code? Thanks.
> 

AC_SEARCH_LIBS doesn't use the source code; instead it tries to link a
test program -- first with no libraries at all, and then with each of
the libraries you've suggested to it, in succession. So on macOS, it
would succeed without -lcrypt immediately. On linux, the first attempt
would fail, but the second attempt with -lcrypt would succeed. The
necessary -l<library> flags are then prepended to the $LIBS variable
for use in the build system.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]