[lttng-dev] [PATCH lttng-tools 2/2] Fix: Missing libs dependencies in configure check for lttng-ust-ctl

Christian Babeux christian.babeux at efficios.com
Fri Aug 3 16:31:28 EDT 2012


The lttng-ust-ctl library depends on liburcu-{common,bp,cds}.
The AC_CHECK_LIBRARY macro can't automatically resolve dependents
libraries (ala libtool), so any additionnals dependencies must
be manually specified.

Also, the AC_CHECK_LIB action-if-found case for the lttng-ust-ctl
check is modified to have a similar behavior as the default action,
which is to define HAVE_LIBxxx and append -lxxx to $LIBS, *except*
for the later step. This is to ensure that any future addition of
AC_CHECK_LIB after the one for lttng-ust-ctl will not need to append
the liburcu dependencies or fail unexpectedly.

Signed-off-by: Christian Babeux <christian.babeux at efficios.com>
---
 configure.ac | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3a023cd..e4b9eb1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -138,13 +138,16 @@ AC_ARG_ENABLE(lttng-ust,
 	lttng_ust_support=$enableval, lttng_ust_support=yes)
 
 AS_IF([test "x$lttng_ust_support" = "xyes"], [
-	AC_CHECK_LIB([lttng-ust-ctl], [ustctl_create_session], [],
-		[AC_MSG_ERROR([Cannot find LTTng-UST. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])]
+	AC_CHECK_LIB([lttng-ust-ctl], [ustctl_create_session],
+		[
+			AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
+			lttng_ust_ctl_found=yes
+		],
+		[AC_MSG_ERROR([Cannot find LTTng-UST. Use [LDFLAGS]=-Ldir to specify its location, or specify --disable-lttng-ust to build lttng-tools without LTTng-UST support.])],
+		[-lurcu-common -lurcu-bp -lurcu-cds]
 	)
 ])
-
-AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [ test "x$ac_cv_lib_lttng_ust_ctl_ustctl_create_session" = "xyes" ])
-
+AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
 AC_CHECK_FUNCS([sched_getcpu sysconf])
 
 # check for dlopen
-- 
1.7.11.3




More information about the lttng-dev mailing list