Fix: Conditionally disable tests requiring shared libs support
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 5 Nov 2012 15:36:14 +0000 (10:36 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 5 Nov 2012 15:38:58 +0000 (10:38 -0500)
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.

[ Edit by Mathieu Desnoyers: add "" in configure.ac to follow the local
  coding style. ]

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
configure.ac
tests/demo/Makefile.am

index 39530db4e0d16ae6213df9fe718c24266f4a455f..b8b23d21b888f9066ed0ec63e77344c5e2b76875 100644 (file)
@@ -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
index 04b6e8c990f541c71e3d1f87c2c94a67f3c8e8a7..5adafdc5ff31e892e768a030633ce5cff0e3367c 100644 (file)
@@ -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 \
@@ -35,3 +39,4 @@ noinst_PROGRAMS = demo
 demo_SOURCES = demo.c ust_tests_demo.h
 # The demo program only depends on libdl.
 demo_LDFLAGS = -ldl
+endif
This page took 0.026745 seconds and 4 git commands to generate.