bug#36214: Linking problem with AC_LIB_HAVE_LINKFLAGS

Bruno Haible <[email protected]>
Newsgroups gmane.comp.gnu.libtool.bugs
Message-ID <1976054.RuX2S2ljAY@omega>
[CCing bug-libtool]

Mohammad Akhlaghi wrote:
> Upon further inspection, I noticed that because `AC_LIB_HAVE_LINKFLAGS' 
> actually returns the absolute address of the shared libraries, there is 
> also no reference to the GSL library (often linked with `-lgsl 
> -lgslcblas') in the `dependency_libs' variable of the created and 
> installed `libgnuastro.la'.
> 
> The fact that there is no reference to GSL (as a mandatory dependency of 
> libgnuastro) in `libgnuastro.la' is not good, because calls to libtool 
> that use the `.la' files will not know they should link with GSL.

Yes, such a libgnuastro.la file would be incorrect.

Here's the way to make sure libgnuastro.la contains the right dependencies:
  * For libraries that are provided by the same package:
    libgnuastro_la_LDFLAGS = ... ../gsl/libgsl.la ...
  * For libraries that are provided by other packages:
    libgnuastro_la_LDFLAGS = ... -lgsl ...
    Here, if you used AC_LIB_HAVE_LINKFLAGS([gsl], ...), you would use
    libgnuastro_la_LDFLAGS = ... @LTLIBGSL@ ...

To make sure your libgnuastro_la_LDFLAGS are complete, it's a good idea to
add   -lc -no-undefined  at the end:
    libgnuastro_la_LDFLAGS = ... -lc -no-undefined

> Do you know any library that uses `AC_LIB_HAVE_LINKFLAGS'? So far, I 
> have only seen Wget which uses it. I am really curious to see what I am 
> doing wrong, or how they solve all these problems it causes.

There are unit tests in gnulib/tests/havelib/rpathy/ and
gnulib/tests/havelib/rpathz. Also, the following packages use it:
  - gettext, uses $(LTLIBUNISTRING) @LTLIBICONV@ @LTLIBTHREAD@.
  - guile, uses $(LTLIBUNISTRING) $(LTLIBICONV) $(LTLIBINTL) $(LTLIBGMP) $(LTLIBLTDL).
  - gawk, uses $(LTLIBINTL).
  - texinfo, uses $(LTLIBICONV).
  - libffcall, uses $(LTLIBTHREAD).
  - recutils, uses $(LTLIBGCRYPT) $(LTLIBINTL) $(LTLIBREADLINE) $(LTLIBTHREAD).
  - gdbm, uses @LTLIBINTL@.
  - taler, uses $(LTLIBINTL).
  - and surely more.

Bruno




_______________________________________________
Bug-libtool mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-libtool
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.