[lttng-dev] [PATCH lttng-ust] Fix: Conditionnally disable tests requiring shared libs support

Christian Babeux christian.babeux at efficios.com
Mon Nov 5 10:17:21 EST 2012


When building lttng-ust with shared library support explicitly
disabled (e.g.: ./configure --disable-shared), libtool fail with
a fatal error:

  CC       tp.lo
  CC       tp2.lo
  CCLD     liblttng-ust-provider-ust-tests-demo.la
libtool: link: can not build a shared library
libtool: link: See the libtool documentation for more information.
libtool: link: Fatal configuration error.

The build should not fail because some tests require explicit shared
library support, instead they should be skipped.

This patch detect that the --disable-shared flag was passed to the
configure script and toggle the "NO_SHARED" Automake variable.
Thus, the tests that require explicit shared library support can
be skipped when the NO_SHARED variable is true.

Signed-off-by: Christian Babeux <christian.babeux at efficios.com>
---
 configure.ac           | 2 ++
 tests/demo/Makefile.am | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/configure.ac b/configure.ac
index 91ad8d9..87e89d5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,8 @@ AS_IF([test "x$libtool_fixup" = "xyes"],
 		  ])
 	    ])
 
+AM_CONDITIONAL([NO_SHARED], [test x$enable_shared = xno])
+
 # Checks for programs.
 AC_PROG_CC
 AC_PROG_CXX
diff --git a/tests/demo/Makefile.am b/tests/demo/Makefile.am
index 0e43255..76ab598 100644
--- a/tests/demo/Makefile.am
+++ b/tests/demo/Makefile.am
@@ -6,6 +6,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -Wsystem-headers
 # libraries.
 LIBS =
 
+if NO_SHARED
+# Do not build this test if shared libraries support was
+# explicitly disabled.
+else
 # Force the shared flag on the noinst libraries since they are
 # only built static by default
 FORCE_SHARED_LIB_OPTIONS = -module -shared -avoid-version \
@@ -41,3 +45,4 @@ if LTTNG_UST_BUILD_WITH_LIBC_DL
 demo_LDADD = -lc
 endif
 
+endif
-- 
1.8.0




More information about the lttng-dev mailing list