Re: LIBS or LDLIBS ?

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

 



Hi Paul, many thanks for your response.

Paul Smith (2021/01/14 08:56 -0500):
> On Thu, 2021-01-14 at 12:56 +0100, Sébastien Hinderer wrote:
> > My question is: between LIBS and LDLIBS, which one is a build system
> > supposed to honour?
>
> "Supposed to" according to whom?

Is there a standard or convention as there is for CFLAGS, say.

> The GNU make manual, and the built-in GNU make rules, all use LDLIBS.
>  There is no mention of LIBS there.
>
> So, if you're following basic GNU make guidelines and you want to use,
> or emulate, the built-in rules for GNU make you should use LDLIBS.
>
> If you're using other build environments they may have other rules or
> traditions.  Insofar as you're using those environments, you may want
> to follow their traditional names.
>
> With respect to autoconf, libraries that are detected by configure
> scripts as being required and present on the system are added to LIBS
> so if you're writing a makefile to be used with autoconf (say you're
> writing a Makefile.in) then you will want to include $(LIBS) in your
> link line, so that the configure script can inform your makefile of
> which libraries to link.

That's my situation, yes. But what if the user wants to pass additional
libraries at configure-time? Shoudl configure take such libraries from
LIBS or LDLIBS? Or both?

> You may also want to add $(LDLIBS) as well: perhaps this would be
> useful for users who needed to add extra link libraries that the
> configure script didn't find: it could be set on the make command line
> for example.

Well if configure had failed to detect, say, -lfoo, then I think I'd
prefer to re-run it with a LIBS=-lfoo (or LDLIBS=-lfoo, that's my whole
question) as arguemnt than running just make LDLIBS=-lfoo, because
running configure has the advantage of storing the value in the build
system, which make does not do as far as I know, at least not out of the
box.

Sébastien.




[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux