4

I'm building some packages with autoconf and automake, and would like to make sure libraries are dynamically linked (i.e. no static links).

How should one set up the autotools to force dynamic library linking?

durron597
  • 31,968
  • 17
  • 99
  • 158
ajwood
  • 18,227
  • 15
  • 61
  • 104

2 Answers2

3

Something like this comes to mind:

# Makefile.am
lib_LTLIBRARIES = libpart.la
libpart_la_SOURCES = lgpl_chunk.c

bin_PROGRAMS = prop
prop_SOURCES = prop.c
prop_LDADD = libpart.la

And make sure that you always build a shared library. Best by disabling static builds by default,

#configure.ac
AC_DISABLE_STATIC
if test "$enable_static" != "no"; then
  echo "Sorry Dave, I can't let you do that";
  exit 1;
fi; 
user502515
  • 4,346
  • 24
  • 20
0

You don't necessarily have to rely on autotools for this. You could use dlopen or some other facility to load the dynamic lib.

ldav1s
  • 15,885
  • 2
  • 53
  • 56