2
votes

I am building a c++ program using automake. It uses many libraries, that I want to dynamically link.

There is, hovewere, a single library that I want to link statically. I am not building this library, I have a .a file provided by third party that I want to use.

Is there an easy way, in configure.ac or Makefile.am, to specify that this library must be linked statically, leaving the normal dynamic linking behaviour unchanged for all other libraries ?

2

2 Answers

1
votes

The decision to link statically or dynamically is a decision that is for the user to make, not the maintainer, so it makes no sense to attempt to make that decision in the autotool meta files. If the user wants to link statically, the most reliable thing to do is to ensure that no dynamic library exists in the directories searched by the linker.

0
votes

I found the answer.

It works by adding the library path, in Makefile.am:

programname_LDADD = /usr/lib/libneeded.a

This will work only if the path is EXACTLY the specified one.