Cleanup: lttng-ust library detection
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 11 May 2017 18:30:09 +0000 (14:30 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 1 Jun 2017 20:59:06 +0000 (16:59 -0400)
Simplify lttng-ust detection code.

Also remove the --with-lttng-ust-prefix configure option since we don't
offer it for other libs and it's based on user variables which the build
system shouldn't be messing with.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
configure.ac

index 92e4a37cbae4d41011d6aa42f2b5bbd8322f6384..6773a8714890e46af5da1b19d4b136f09f051af6 100644 (file)
@@ -434,31 +434,31 @@ AS_IF([test "x$with_kmod" != "xno"],
 )
 AC_SUBST(KMOD_LIBS)
 
-AC_ARG_WITH(lttng-ust-prefix,
-  AS_HELP_STRING([--with-lttng-ust-prefix=PATH],
-                 [Specify the installation prefix of the lttng-ust library.
-                 Headers must be in PATH/include; libraries in PATH/lib.]),
-                 [
-                   AM_CPPFLAGS="$AM_CPPFLAGS -I${withval}/include"
-                   LDFLAGS="$LDFLAGS -L${withval}/lib64 -L${withval}/lib"
-                 ])
+# Check for liblttng-ust-ctl, fail if it's not found,
+# it can be explicitly disabled with --without-lttng-ust
+AH_TEMPLATE([HAVE_LIBLTTNG_UST_CTL], [Define if you have LTTng-UST control support])
+AC_ARG_WITH([lttng-ust],
+  [AS_HELP_STRING([--without-lttng-ust], [build without LTTng-UST (Userspace Tracing) support])],
+  [],
+  [with_lttng_ust=yes]
+)
+
+AS_IF([test "x$with_lttng_ust" = "xyes"],
+  [
+    AC_CHECK_LIB([lttng-ust-ctl], [ustctl_recv_channel_from_consumer],
+      [
+        AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1])
+      ],
+      [
+        AC_MSG_FAILURE([Cannot find LTTng-UST >= 2.2.x. Use [LDFLAGS]=-Ldir and [CPPFLAGS]=-Idir to specify its location, or specify --without-lttng-ust to build lttng-tools without LTTng-UST support.])
+      ],
+      [-lurcu-common -lurcu-bp -lurcu-cds -lrt -ldl]
+    )
+  ]
+)
+AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$with_lttng_ust" = "xyes"])
+
 
-# Check liblttng-ust-ctl library
-AC_ARG_WITH(lttng-ust,
-       AS_HELP_STRING([--without-lttng-ust],[build without LTTng-UST (Userspace Tracing) support]),
-       lttng_ust_support=$withval, lttng_ust_support=yes)
-
-AS_IF([test "x$lttng_ust_support" = "xyes"], [
-       AC_CHECK_LIB([lttng-ust-ctl], [ustctl_recv_channel_from_consumer],
-               [
-                       AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1], [has LTTng-UST control support])
-                       lttng_ust_ctl_found=yes
-               ],
-               [AC_MSG_ERROR([Cannot find LTTng-UST >= 2.2.x. Use --with-lttng-ust-prefix=PREFIX to specify its location, or specify --without-lttng-ust to build lttng-tools without LTTng-UST support.])],
-               [-lurcu-common -lurcu-bp -lurcu-cds -lrt -ldl]
-       )
-])
-AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$lttng_ust_ctl_found" = xyes])
 AC_CHECK_FUNCS([sched_getcpu sysconf sync_file_range])
 
 # check for dlopen
@@ -861,7 +861,7 @@ AS_IF([test x$build_lib_consumer = xyes],
        build_lib_hashtable=yes
        build_lib_compat=yes
        build_lib_relayd=yes
-       AS_IF([test x$lttng_ust_ctl_found = xyes],[build_lib_ust_consumer=yes])
+       AS_IF([test "x$with_lttng_ust" = "xyes"], [build_lib_ust_consumer=yes])
       ]
 )
 
@@ -1127,7 +1127,7 @@ test "x$with_kmod" != "xno" && value=1 || value=0
 PPRINT_PROP_BOOL([libkmod support], $value)
 
 # LTTng-UST enabled/disabled
-test "x$lttng_ust_support" = "xyes" && value=1 || value=0
+test "x$with_lttng_ust" = "xyes" && value=1 || value=0
 PPRINT_PROP_BOOL([LTTng-UST support], $value)
 
 AS_ECHO
This page took 0.026709 seconds and 4 git commands to generate.