From 8cf292e721a287567ff3e8dfd8dca03f3f3c93fb Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Mon, 6 Mar 2017 20:26:26 +0100 Subject: [PATCH] cmd: use libtool for the internal library This just cuts some hassle integration with how the helper library is built. I could never get to pass the right -fPIC/-fpie combination otherwise. Signed-off-by: Zygmunt Krynicki --- cmd/Makefile.am | 16 ++++++++-------- cmd/configure.ac | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 90ee4b9..7c7dbbb 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -58,12 +58,12 @@ snap-seccomp/snap-seccomp: snap-seccomp/*.go cd snap-seccomp && GOPATH=$(or $(GOPATH),$(realpath $(srcdir)/../../../../..)) go build -i -v ## -## libsnap-confine-private.a +## libsnap-confine-private.la ## -noinst_LIBRARIES += libsnap-confine-private.a +noinst_LTLIBRARIES = libsnap-confine-private.la -libsnap_confine_private_a_SOURCES = \ +libsnap_confine_private_la_SOURCES = \ libsnap-confine-private/cgroup-freezer-support.c \ libsnap-confine-private/cgroup-freezer-support.h \ libsnap-confine-private/classic.c \ @@ -138,7 +138,7 @@ noinst_PROGRAMS += decode-mount-opts/decode-mount-opts decode_mount_opts_decode_mount_opts_SOURCES = \ decode-mount-opts/decode-mount-opts.c -decode_mount_opts_decode_mount_opts_LDADD = libsnap-confine-private.a +decode_mount_opts_decode_mount_opts_LDADD = libsnap-confine-private.la decode_mount_opts_decode_mount_opts_STATIC = if STATIC_LIBCAP @@ -192,7 +192,7 @@ snap_confine_snap_confine_SOURCES = \ snap_confine_snap_confine_CFLAGS = -Wall -Werror $(AM_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" snap_confine_snap_confine_LDFLAGS = $(AM_LDFLAGS) -snap_confine_snap_confine_LDADD = libsnap-confine-private.a +snap_confine_snap_confine_LDADD = libsnap-confine-private.la snap_confine_snap_confine_CFLAGS += $(LIBUDEV_CFLAGS) snap_confine_snap_confine_LDADD += $(LIBUDEV_LIBS) # _STATIC is where we collect statically linked in libraries @@ -364,7 +364,7 @@ snap_discard_ns_snap_discard_ns_SOURCES = \ snap-discard-ns/snap-discard-ns.c snap_discard_ns_snap_discard_ns_CFLAGS = -Wall -Werror $(AM_CFLAGS) snap_discard_ns_snap_discard_ns_LDFLAGS = $(AM_LDFLAGS) -snap_discard_ns_snap_discard_ns_LDADD = libsnap-confine-private.a +snap_discard_ns_snap_discard_ns_LDADD = libsnap-confine-private.la snap_discard_ns_snap_discard_ns_STATIC = if APPARMOR @@ -405,7 +405,7 @@ system_shutdown_system_shutdown_SOURCES = \ system-shutdown/system-shutdown-utils.c \ system-shutdown/system-shutdown-utils.h \ system-shutdown/system-shutdown.c -system_shutdown_system_shutdown_LDADD = libsnap-confine-private.a +system_shutdown_system_shutdown_LDADD = libsnap-confine-private.la system_shutdown_system_shutdown_CFLAGS = $(filter-out -fPIE -pie,$(CFLAGS)) -static system_shutdown_system_shutdown_LDFLAGS = $(filter-out -fPIE -pie,$(LDFLAGS)) -static @@ -415,7 +415,7 @@ system_shutdown_unit_tests_SOURCES = \ libsnap-confine-private/unit-tests-main.c \ libsnap-confine-private/unit-tests.c \ system-shutdown/system-shutdown-utils-test.c -system_shutdown_unit_tests_LDADD = libsnap-confine-private.a +system_shutdown_unit_tests_LDADD = libsnap-confine-private.la system_shutdown_unit_tests_CFLAGS = $(GLIB_CFLAGS) system_shutdown_unit_tests_LDADD += $(GLIB_LIBS) endif diff --git a/cmd/configure.ac b/cmd/configure.ac index f2e6ce6..976e1d0 100644 --- a/cmd/configure.ac +++ b/cmd/configure.ac @@ -11,7 +11,8 @@ AC_PROG_CC_C99 AC_PROG_CPP AC_PROG_INSTALL AC_PROG_MAKE_SET -AC_PROG_RANLIB +AC_PROG_LIBTOOL +AC_CONFIG_MACRO_DIR([m4]) AC_LANG([C]) # Checks for libraries. -- 2.14.3