Skip to content

Commit

Permalink
autotools: build both a shared and static liblxc
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Serge Hallyn <serge@hallyn.com>
Cc: Tycho Andersen <tycho@tycho.ws>
  • Loading branch information
Christian Brauner committed Jul 11, 2018
1 parent 6e82433 commit da0353d
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions src/lxc/Makefile.am
Expand Up @@ -141,16 +141,20 @@ liblxc_la_SOURCES += \
../include/lxcmntent.c ../include/lxcmntent.h
endif

if !HAVE_GETLINE
if HAVE_FGETLN
liblxc_la_SOURCES += ../include/getline.c ../include/getline.h
endif
endif

if !HAVE_PRLIMIT
if HAVE_PRLIMIT64
liblxc_la_SOURCES += ../include/prlimit.c ../include/prlimit.h
endif
endif

if !HAVE_GETLINE
if HAVE_FGETLN
liblxc_la_SOURCES += ../include/getline.c ../include/getline.h
endif
if ENABLE_SECCOMP
liblxc_la_SOURCES += seccomp.c
endif

if !HAVE_STRLCPY
Expand Down Expand Up @@ -192,6 +196,10 @@ if ENABLE_GNUTLS
AM_CFLAGS += -DHAVE_LIBGNUTLS
endif

if ENABLE_SECCOMP
AM_CFLAGS += -DHAVE_SECCOMP $(SECCOMP_CFLAGS)
endif

if ENABLE_SELINUX
AM_CFLAGS += -DHAVE_SELINUX
endif
Expand All @@ -200,20 +208,20 @@ if USE_CONFIGPATH_LOGS
AM_CFLAGS += -DUSE_CONFIGPATH_LOGS
endif

if ENABLE_SECCOMP
AM_CFLAGS += -DHAVE_SECCOMP $(SECCOMP_CFLAGS)
liblxc_la_SOURCES += seccomp.c
endif

liblxc_la_CFLAGS = -fPIC -DPIC $(AM_CFLAGS) -pthread
# build the shared library
liblxc_la_CFLAGS = -fPIC \
-DPIC \
$(AM_CFLAGS) \
-pthread

liblxc_la_LDFLAGS = \
-pthread \
-shared \
-Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \
-version-info @LXC_ABI_MAJOR@
liblxc_la_LDFLAGS = -pthread \
-Wl,-soname,liblxc.so.$(firstword $(subst ., ,@LXC_ABI@)) \
-version-info @LXC_ABI_MAJOR@

liblxc_la_LIBADD = $(CAP_LIBS) $(GNUTLS_LIBS) $(SELINUX_LIBS) $(SECCOMP_LIBS)
liblxc_la_LIBADD = $(CAP_LIBS) \
$(GNUTLS_LIBS) \
$(SELINUX_LIBS) \
$(SECCOMP_LIBS)

bin_SCRIPTS=

Expand Down Expand Up @@ -322,10 +330,6 @@ if !HAVE_STRLCAT
init_lxc_static_SOURCES += ../include/strlcat.c ../include/strlcat.h
endif

if !HAVE_GETGRGID_R
liblxc_la_SOURCES += ../include/getgrgid_r.c ../include/getgrgid_r.h
endif

init_lxc_static_LDFLAGS = -all-static
init_lxc_static_LDADD = @CAP_LIBS@
init_lxc_static_CFLAGS = $(AM_CFLAGS) -DNO_LXC_CONF
Expand Down Expand Up @@ -356,6 +360,7 @@ install-exec-hook:

uninstall-local:
$(RM) $(DESTDIR)$(libdir)/liblxc.so*
$(RM) $(DESTDIR)$(libdir)/liblxc.a
if ENABLE_PAM
if HAVE_PAM
$(RM) $(DESTDIR)$(pamdir)/pam_cgfs.so*
Expand Down

0 comments on commit da0353d

Please sign in to comment.