ElementalStorm
ElementalStorm

Reputation: 828

Tell autoconf that (only) one library must be statically linked

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 ?

Upvotes: 2

Views: 269

Answers (2)

ElementalStorm
ElementalStorm

Reputation: 828

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.

Upvotes: 0

William Pursell
William Pursell

Reputation: 212248

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.

Upvotes: 1

Related Questions