0

Suppose I want to link the foo application with the bar and baz libs. Both support pkg-config and provide .pc files. The bar lib I want to link dynamically and the baz library I want to link statically. How can I achieve this with automake?

My current setup links both of them dinamycally and looks like this:

foo_SOURCES = main.c
foo_LDADD = @BAR_LIBS@ @BAZ_LIBS@
foo_CFLAGS = @BAR_CFLAGS@ @BAZ_CFLAGS@
ivarec
  • 2,542
  • 2
  • 34
  • 57

1 Answers1

0

There is no (justifiable) reason to not use shared libraries when they are available. automake provides no specific support here; there's is the -Wl,-Bstatic ${FOO_LIBS} -Wl,-Bdynamic hack, but it is what it is - a hack, and there is no guarantee it will work at all times.

jørgensen
  • 10,149
  • 2
  • 20
  • 27
  • Even libraries up to a few kilobytes? Libs that usually are not even packaged by common distributions? Static linking is a feature and can be used to solve problems or to create new ones. Why make it an evil thing? – ivarec Nov 12 '12 at 15:36