bug-gnulib
[Top][All Lists]
Advanced

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

Re: lib-link.m4: prepend to LIBS


From: Bruno Haible
Subject: Re: lib-link.m4: prepend to LIBS
Date: Wed, 14 Sep 2005 18:39:59 +0200
User-agent: KMail/1.5

Hello Ralf,

> In general, $LIBS needs to be prepended to, not appended, to allow for
> static linking to succeed in the presence of deplibs already in $LIBS.

Thanks for the suggestion. I don't remember having thought about this
issue. But

1) This is not the expected use of AC_LIB_HAVE_LINKFLAGS. The user is
   expected to put the dependencies into the second argument to
   AC_LIB_HAVE_LINKFLAGS, not into $LIBS.

2) Do we have a guarantee that the user, in his Makefile.am, will write
      $(LIBFOOBAR) $(LIBS)
   ? No, he might just as well write
      $(LIBS) $(LIBFOOBAR)

   With the current lib-link.m4 we err on the unhappy but safe side:
   the macro may fail to detect the presence of the library.

   With your proposed patch, we err on the unsafe side: the macro may
   detect the library, but attempts to use it via
      $(LIBS) $(LIBFOOBAR)
   would fail.

   Btw, many people write   $(LIBS) $(LIBFOOBAR)   because $(LIBS)
   often contains -L options, and it's usually better to put -L
   options first. Many people also add $(LIBFOOBAR) to LDADD, where 

I _do_ agree that in pre-pending to $LIBS is better than _ap_pending to $LIBS.
The question is whether we can assume that everyone does it?

Bruno





reply via email to

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