From 347e0f146d848f8e5a6b2cb07c016d3f4085f310 Mon Sep 17 00:00:00 2001 From: Christian Babeux Date: Tue, 6 Nov 2012 13:32:05 -0500 Subject: [PATCH] Fix: Do not install health tests helper libraries The libraries libhealthexit and libhealthstall should not be installed on the user system. They are only useful for the health check tests. Furthermore, when adding libraries to noinst_LTLIBRARIES, libtool will only build these as static libraries (see [1] for a workaround). This is fine for most use cases, but for the health tests, we _must_ have shared libraries (the nature of the tests require LD_PRELOAD), hence we force the build of a shared object. Forcing shared object has the unfortunate side-effect of breaking builds where configure was invoked with "--disable-shared" flag. Instead of failing badly, detect this flag and skip the health tests altogether. noinst shared libs: [1] - https://lists.gnu.org/archive/html/libtool/2008-06/msg00082.html Acked-by: Mathieu Desnoyers Signed-off-by: Christian Babeux Signed-off-by: David Goulet --- configure.ac | 2 ++ tests/tools/health/Makefile.am | 20 ++++++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/configure.ac b/configure.ac index 72daf7e0f..a3120fc04 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,8 @@ AS_IF([test "x$libtool_fixup" = "xyes"], ]) ]) +AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno]) + AC_CHECK_HEADERS([ \ sys/types.h unistd.h fcntl.h string.h pthread.h limits.h \ signal.h stdlib.h sys/un.h sys/socket.h stdlib.h stdio.h \ diff --git a/tests/tools/health/Makefile.am b/tests/tools/health/Makefile.am index 9fab58234..f1a5d915d 100644 --- a/tests/tools/health/Makefile.am +++ b/tests/tools/health/Makefile.am @@ -8,23 +8,27 @@ if LTTNG_TOOLS_BUILD_WITH_LIBC_DL AM_LDFLAGS += -lc endif -UTILS= - -lib_LTLIBRARIES=libhealthexit.la libhealthstall.la +if NO_SHARED +# Do not build this test if shared libraries support was +# explicitly disabled. +else +# In order to test the health check feature, the libhealth* libs +# must be built as .so to be able to LD_PRELOAD them. +FORCE_SHARED_LIB_OPTIONS = -module -shared -avoid-version \ + -rpath $(abs_builddir) # Health thread exit ld_preloaded test lib libhealthexit_la_SOURCES=health_exit.c -libhealthexit_la_LDFLAGS= -module +libhealthexit_la_LDFLAGS= $(FORCE_SHARED_LIB_OPTIONS) # Health thread stall ld_preloaded test lib libhealthstall_la_SOURCES=health_stall.c -libhealthstall_la_LDFLAGS= -module +libhealthstall_la_LDFLAGS= $(FORCE_SHARED_LIB_OPTIONS) noinst_PROGRAMS = health_check +noinst_LTLIBRARIES = libhealthexit.la libhealthstall.la health_check_SOURCES = health_check.c $(UTILS) health_check_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ $(top_builddir)/src/common/libcommon.la - -noinst_SCRIPTS = -EXTRA_DIST = +endif -- 2.34.1