Use pkgconfig to detect and configure liblttng-ust
authorMichael Jeanson <mjeanson@efficios.com>
Thu, 24 Oct 2019 15:36:22 +0000 (11:36 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 5 Nov 2019 03:33:55 +0000 (22:33 -0500)
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
23 files changed:
configure.ac
src/bin/lttng-consumerd/Makefile.am
src/bin/lttng-sessiond/Makefile.am
src/common/ust-consumer/Makefile.am
tests/regression/tools/filtering/Makefile.am
tests/regression/ust/baddr-statedump/Makefile.am
tests/regression/ust/daemon/Makefile.am
tests/regression/ust/exit-fast/Makefile.am
tests/regression/ust/fork/Makefile.am
tests/regression/ust/high-throughput/Makefile.am
tests/regression/ust/libc-wrapper/Makefile.am
tests/regression/ust/linking/Makefile.am
tests/regression/ust/low-throughput/Makefile.am
tests/regression/ust/multi-lib/Makefile.am
tests/regression/ust/multi-session/Makefile.am
tests/regression/ust/overlap/demo/Makefile.am
tests/regression/ust/type-declarations/Makefile.am
tests/unit/Makefile.am
tests/utils/testapp/gen-ust-events-ns/Makefile.am
tests/utils/testapp/gen-ust-events/Makefile.am
tests/utils/testapp/gen-ust-nevents-str/Makefile.am
tests/utils/testapp/gen-ust-nevents/Makefile.am
tests/utils/testapp/gen-ust-tracef/Makefile.am

index dc7c87c4d8818554402f295e15983f04404d789c..c2176cb4e6cb5bff3431af03c0a778769bbda04f 100644 (file)
@@ -557,18 +557,18 @@ AC_ARG_WITH([lttng-ust],
   [with_lttng_ust=yes]
 )
 
-AS_IF([test "x$with_lttng_ust" = "xyes"],
-  [
-    AC_CHECK_LIB([lttng-ust-ctl], [lttng_ust_enum_get_from_desc],
-      [
-        AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1])
-      ],
-      [
-        AC_MSG_FAILURE([Cannot find LTTng-UST >= 2.11.x. Use [LDFLAGS]=-Ldir and [CPPFLAGS]=-Idir to specify its location, or specify --without-lttng-ust to build lttng-tools without LTTng-UST support.])
-      ]
-    )
-  ]
-)
+AS_IF([test "x$with_lttng_ust" = "xyes"], [
+  AC_DEFINE([HAVE_LIBLTTNG_UST_CTL], [1])
+
+  # Check for liblttng-ust
+  PKG_CHECK_MODULES([UST], [lttng-ust >= $major_version.$minor_version])
+
+  # Check for liblttng-ust-ctl
+  PKG_CHECK_MODULES([UST_CTL], [lttng-ust-ctl >= $major_version.$minor_version])
+
+  AM_CPPFLAGS="$AM_CPPFLAGS $UST_CFLAGS"
+])
+
 AM_CONDITIONAL([HAVE_LIBLTTNG_UST_CTL], [test "x$with_lttng_ust" = "xyes"])
 
 
index 9d54309cf1b85751be5810007ad5ee3fc3f40322..0659a34a0b3469c41c077fa11d4fd09d67167d67 100644 (file)
@@ -16,5 +16,5 @@ lttng_consumerd_LDADD = \
 lttng_consumerd_LDFLAGS = -rdynamic
 
 if HAVE_LIBLTTNG_UST_CTL
-lttng_consumerd_LDADD += -llttng-ust-ctl
+lttng_consumerd_LDADD += $(UST_CTL_LIBS)
 endif
index 296ec148b7163022f9dbca696d5186c4c2dcae62..ebb8cb284049ff8a92e73d622d0a8f5f49c3e0e5 100644 (file)
@@ -78,5 +78,5 @@ lttng_sessiond_LDADD = -lurcu-common -lurcu $(KMOD_LIBS) \
 
 
 if HAVE_LIBLTTNG_UST_CTL
-lttng_sessiond_LDADD += -llttng-ust-ctl
+lttng_sessiond_LDADD += $(UST_CTL_LIBS)
 endif
index 1acdc7f12f3a49f9f9aa38cca9b8630951d6b6f4..1df8b53c0836b2857ba7a3e85ac3658b03e83a4e 100644 (file)
@@ -5,7 +5,7 @@ noinst_LTLIBRARIES = libust-consumer.la
 libust_consumer_la_SOURCES = ust-consumer.c ust-consumer.h
 
 libust_consumer_la_LIBADD = \
-                       -llttng-ust-ctl \
+                       $(UST_CTL_LIBS) \
                        $(top_builddir)/src/common/relayd/librelayd.la
 
 endif
index b214fc1d69c0be70d554547bccafb3ab70ee0edb..5900a209359b86bdf83ec718b29040d437fcb35f 100644 (file)
@@ -3,7 +3,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/tests -I$(srcdir)
 if HAVE_LIBLTTNG_UST_CTL
 noinst_PROGRAMS = gen-ust-events
 gen_ust_events_SOURCES = gen-ust-events.c tp.c tp.h
-gen_ust_events_LDADD = -llttng-ust -lurcu-bp $(DL_LIBS)
+gen_ust_events_LDADD = $(UST_LIBS) $(DL_LIBS)
 endif
 
 noinst_SCRIPTS = test_unsupported_op test_invalid_filter test_valid_filter
index bf51f94837f31feda2598298f006451802d7ecf0..253c9029fa2484e9eb34fab245d206bd5bd61671 100644 (file)
@@ -6,7 +6,7 @@ AM_CPPFLAGS += -I$(srcdir) -g
 
 noinst_PROGRAMS = prog
 prog_SOURCES = prog.c tp.c tp.h
-prog_LDADD = -llttng-ust $(DL_LIBS)
+prog_LDADD = $(UST_LIBS) $(DL_LIBS)
 
 noinst_SCRIPTS = test_baddr-statedump test_baddr-statedump.py
 EXTRA_DIST = test_baddr-statedump test_baddr-statedump.py
index 1a52b634b0e8e1ea1a9ff53b6c01006e3bcf106d..632f131d89f92d5790849c7d87360e367789c1c1 100644 (file)
@@ -2,7 +2,7 @@ AM_CPPFLAGS += -I$(srcdir)
 
 noinst_PROGRAMS = daemon
 daemon_SOURCES = daemon.c ust_tests_daemon.h
-daemon_LDADD = -llttng-ust -llttng-ust-fork $(DL_LIBS)
+daemon_LDADD = $(UST_LIBS) -llttng-ust-fork $(DL_LIBS)
 
 noinst_SCRIPTS = test_daemon test_daemon.py
 EXTRA_DIST = test_daemon test_daemon.py
index 06cda46a585a8a4900823745d4e54bf36707e131..c39dc9a44e3b129005ae72e5355e600d4aaac853 100644 (file)
@@ -2,7 +2,7 @@ AM_CPPFLAGS += -I$(srcdir)
 
 noinst_PROGRAMS = exit-fast
 exit_fast_SOURCES = exit-fast.c ust_tests_exitfast.h
-exit_fast_LDADD = -llttng-ust $(DL_LIBS)
+exit_fast_LDADD = $(UST_LIBS) $(DL_LIBS)
 
 noinst_SCRIPTS = test_exit-fast test_exit-fast.py
 EXTRA_DIST = test_exit-fast test_exit-fast.py
index 2c79db658f30852c3c7d03bbb31764ecaf9b5e45..0c6ca2aa770b40881e3b4dcdce92ddce88c50718 100644 (file)
@@ -2,10 +2,10 @@ AM_CPPFLAGS += -I$(srcdir)
 
 noinst_PROGRAMS = fork fork2
 fork_SOURCES = fork.c ust_tests_fork.h
-fork_LDADD = -llttng-ust -llttng-ust-fork $(DL_LIBS)
+fork_LDADD = $(UST_LIBS) -llttng-ust-fork $(DL_LIBS)
 
 fork2_SOURCES = fork2.c
-fork2_LDADD = -llttng-ust -llttng-ust-fork $(DL_LIBS)
+fork2_LDADD = $(UST_LIBS) -llttng-ust-fork $(DL_LIBS)
 
 noinst_SCRIPTS = test_fork test_fork.py
 EXTRA_DIST = test_fork test_fork.py
index f71dfd4dfeb7dd76d3f566f08a7ac1ef6224bbcf..1bb87af49487dc87dfcc914223e43226480524d6 100644 (file)
@@ -2,7 +2,7 @@ AM_CPPFLAGS += -I$(srcdir)
 
 noinst_PROGRAMS = gen-events
 gen_events_SOURCES = main.c tp.c tp.h
-gen_events_LDADD = -llttng-ust $(DL_LIBS)
+gen_events_LDADD = $(UST_LIBS) $(DL_LIBS)
 
 noinst_SCRIPTS = test_high_throughput
 EXTRA_DIST = test_high_throughput
index 2a800728eb0fd6f5cd6d57500ac101ecffce2dfe..e1f1fec5890d9151ada7c961b6867e67e54dd8d9 100644 (file)
@@ -1,6 +1,6 @@
 noinst_PROGRAMS = prog
 prog_SOURCES = prog.c
-prog_LDADD = -llttng-ust -llttng-ust-libc-wrapper
+prog_LDADD = $(UST_LIBS) -llttng-ust-libc-wrapper
 
 noinst_SCRIPTS = test_libc-wrapper test_libc-wrapper.py
 EXTRA_DIST = test_libc-wrapper test_libc-wrapper.py
index c8585698dab6e50f2c8a71badffce7ad177f71eb..febb6e3c11dadc9749c579358f7813b619b4cc40 100644 (file)
@@ -9,7 +9,7 @@ LIBS =
 # Build a version of the test app with built-in tracepoints
 demo_builtin_SOURCES = demo.c tp.c tp2.c tp3.c ust_tests_demo.h \
        ust_tests_demo2.h ust_tests_demo3.h
-demo_builtin_LDADD = -llttng-ust $(DL_LIBS)
+demo_builtin_LDADD = $(UST_LIBS) $(DL_LIBS)
 demo_builtin_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
 
 # Build a version statically linked to the providers
@@ -21,13 +21,13 @@ liblttng_ust_provider_ust_tests_demo_static_la_SOURCES = \
        tp.c ust_tests_demo.h \
        tp2.c ust_tests_demo2.h
 liblttng_ust_provider_ust_tests_demo_static_la_LIBADD = \
-       -llttng-ust
+       $(UST_LIBS)
 
 # contains ust_tests_demo3.h provider probes
 liblttng_ust_provider_ust_tests_demo3_static_la_SOURCES = \
        tp3.c ust_tests_demo3.h
 liblttng_ust_provider_ust_tests_demo3_static_la_LIBADD = \
-       -llttng-ust
+       $(UST_LIBS)
 
 demo_static_SOURCES = demo.c
 demo_static_LDADD = liblttng-ust-provider-ust-tests-demo-static.la \
@@ -58,14 +58,14 @@ noinst_LTLIBRARIES += liblttng-ust-provider-ust-tests-demo.la \
 liblttng_ust_provider_ust_tests_demo_la_SOURCES = \
        tp.c ust_tests_demo.h \
        tp2.c ust_tests_demo2.h
-liblttng_ust_provider_ust_tests_demo_la_LIBADD = -llttng-ust
+liblttng_ust_provider_ust_tests_demo_la_LIBADD = $(UST_LIBS)
 liblttng_ust_provider_ust_tests_demo_la_LDFLAGS = \
        $(FORCE_SHARED_LIB_OPTIONS)
 
 #contains ust_tests_demo3.h provider probes
 liblttng_ust_provider_ust_tests_demo3_la_SOURCES = \
        tp3.c ust_tests_demo3.h
-liblttng_ust_provider_ust_tests_demo3_la_LIBADD = -llttng-ust
+liblttng_ust_provider_ust_tests_demo3_la_LIBADD = $(UST_LIBS)
 liblttng_ust_provider_ust_tests_demo3_la_LDFLAGS = \
        $(FORCE_SHARED_LIB_OPTIONS)
 
index 95022b9f98e9ede50fe48d9cf1722a6efd3077d6..aacb83716cd8e8528674c3ad7cad7a3da29d6f07 100644 (file)
@@ -2,7 +2,7 @@ AM_CPPFLAGS += -I$(srcdir)
 
 noinst_PROGRAMS = gen-events
 gen_events_SOURCES = main.c tp.c tp.h
-gen_events_LDADD = -llttng-ust -lurcu $(DL_LIBS)
+gen_events_LDADD = $(UST_LIBS) $(DL_LIBS)
 
 noinst_SCRIPTS = test_low_throughput
 EXTRA_DIST = test_low_throughput
index 17ccf3e648fda66dc6188e7edfde95bc79931377..0ce46a7ffe376ce53094120a03085974fe561d20 100644 (file)
@@ -7,12 +7,12 @@ exec_with_callsites_LDFLAGS = -ldl $(POPT_LIBS)
 exec_with_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=1
 
 exec_without_callsites_SOURCES = multi-lib-test.c
-exec_without_callsites_LDFLAGS = -ldl $(POPT_LIBS) -llttng-ust
+exec_without_callsites_LDFLAGS = -ldl $(POPT_LIBS) $(UST_LIBS)
 exec_without_callsites_LDADD = probes.o
 exec_without_callsites_CFLAGS = $(POPT_CFLAGS) $(AM_CFLAGS) -DHAS_CALLSITES=0
 
 PROBES_SRC=probes.c probes.h
-PROBES_LDF=-shared -module -llttng-ust -avoid-version -rpath $(abs_builddir)/.libs/
+PROBES_LDF=-shared -module $(UST_LIBS) -avoid-version -rpath $(abs_builddir)/.libs/
 PROBES_CF=$(AM_CFLAGS) $(AM_CPPFLAGS) $(CFLAGS) $(CPPFLAGS) -c -I$(srcdir)/
 
 probes.o: probes.c probes.h
@@ -29,7 +29,7 @@ noinst_LTLIBRARIES = libprobes_a.la libprobes_a_prime.la \
 noinst_LTLIBRARIES += libcallsites_1.la libcallsites_2.la
 
 CALLSITES_SRC=callsites.c callsites.h
-CALLSITES_LDF=-shared -module -llttng-ust -avoid-version -rpath $(abs_builddir)/.libs/
+CALLSITES_LDF=-shared -module $(UST_LIBS) -avoid-version -rpath $(abs_builddir)/.libs/
 CALLSITES_CF=-c -I.
 
 libprobes_a_la_SOURCES = $(PROBES_SRC)
index 204ae7bcf2f96cb28a61725b3215cf254dc4de4e..0d807a87858bff46b16438262f3e71e13a789079 100644 (file)
@@ -2,7 +2,7 @@ AM_CFLAGS += -I$(srcdir)
 
 noinst_PROGRAMS = gen-nevents
 gen_nevents_SOURCES = gen-nevents.c tp.c ust_gen_nevents.h
-gen_nevents_LDADD = -llttng-ust -lurcu-bp $(DL_LIBS)
+gen_nevents_LDADD = $(UST_LIBS) $(DL_LIBS)
 
 noinst_SCRIPTS = test_multi_session
 EXTRA_DIST = test_multi_session
index fbb399cd4e3fae2ccaa457614a3ec74f3c0c3b21..348adbe903acc70884887c827233699b9e534685 100644 (file)
@@ -21,12 +21,12 @@ FORCE_SHARED_LIB_OPTIONS = -module -shared -avoid-version \
 liblttng_ust_provider_ust_tests_demo_la_SOURCES = \
        tp.c ust_tests_demo.h \
        tp2.c ust_tests_demo2.h
-liblttng_ust_provider_ust_tests_demo_la_LIBADD = -llttng-ust
+liblttng_ust_provider_ust_tests_demo_la_LIBADD = $(UST_LIBS)
 liblttng_ust_provider_ust_tests_demo_la_LDFLAGS = $(FORCE_SHARED_LIB_OPTIONS)
 
 #contains ust_tests_demo3.h provider probes
 liblttng_ust_provider_ust_tests_demo3_la_SOURCES = tp3.c ust_tests_demo3.h
-liblttng_ust_provider_ust_tests_demo3_la_LIBADD = -llttng-ust
+liblttng_ust_provider_ust_tests_demo3_la_LIBADD = $(UST_LIBS)
 liblttng_ust_provider_ust_tests_demo3_la_LDFLAGS = $(FORCE_SHARED_LIB_OPTIONS)
 
 noinst_LTLIBRARIES = liblttng-ust-provider-ust-tests-demo.la \
index db39b1cc3aac4e6c79bbb122d07cd41f2cb14fe0..dd4eda26bfba225dffd8102e06c97b9017732a61 100644 (file)
@@ -2,7 +2,8 @@ AM_CPPFLAGS += -I$(srcdir)
 
 noinst_PROGRAMS = type-declarations
 type_declarations_SOURCES = type-declarations.c ust_tests_td.h
-type_declarations_LDADD = -llttng-ust $(DL_LIBS)
+type_declarations_LDADD = $(UST_LIBS) $(DL_LIBS)
+type_declarations_CPPFLAGS = $(UST_CFLAGS) $(DL_CFLAGS) $(AM_CPPFLAGS)
 
 noinst_SCRIPTS = test_type_declarations test_type_declarations.py
 EXTRA_DIST = test_type_declarations test_type_declarations.py
index 460e2f752045656926831500497f27dc7c7618e8..dd83bc636e4ce984f75dea1236da2bccbaf40c92 100644 (file)
@@ -105,7 +105,7 @@ test_session_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
 test_session_LDADD += $(SESSIOND_OBJS)
 
 if HAVE_LIBLTTNG_UST_CTL
-test_session_LDADD += -llttng-ust-ctl
+test_session_LDADD += $(UST_CTL_LIBS)
 endif
 
 # UST data structures unit test
@@ -113,7 +113,7 @@ if HAVE_LIBLTTNG_UST_CTL
 test_ust_data_SOURCES = test_ust_data.c
 test_ust_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
                      $(LIBHASHTABLE) $(DL_LIBS) -lrt -lurcu-common -lurcu \
-                     -llttng-ust-ctl \
+                     $(UST_CTL_LIBS) \
                      $(KMOD_LIBS) \
                      $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
                      $(top_builddir)/src/common/kernel-ctl/libkernel-ctl.la \
index 39f991240912166bf2cabcbb78f8ad3311f06b9e..ad9203c4e9bbd8e630de74a912217f2055e47957 100644 (file)
@@ -4,7 +4,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/tests/utils -I$(srcdir) \
 if HAVE_LIBLTTNG_UST_CTL
 noinst_PROGRAMS = gen-ust-events-ns
 gen_ust_events_ns_SOURCES = gen-ust-events-ns.c tp.c tp.h
-gen_ust_events_ns_LDADD = -llttng-ust -lurcu-bp -llttng-ust-fork \
+gen_ust_events_ns_LDADD = $(UST_LIBS) -llttng-ust-fork \
                $(top_builddir)/tests/utils/libtestutils.la \
                $(DL_LIBS) $(POPT_LIBS)
 endif
index 3169b6ef450781b0069d6f994a53a327b0c5a73d..38e620d75274515d5635b5381013b199664595a1 100644 (file)
@@ -4,7 +4,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/tests/utils -I$(srcdir) \
 if HAVE_LIBLTTNG_UST_CTL
 noinst_PROGRAMS = gen-ust-events
 gen_ust_events_SOURCES = gen-ust-events.c tp.c tp.h
-gen_ust_events_LDADD = -llttng-ust -lurcu-bp \
+gen_ust_events_LDADD = $(UST_LIBS) \
                $(top_builddir)/tests/utils/libtestutils.la \
                $(DL_LIBS)
 endif
index 5f07e795be18ece2137d422968c3de69d3a41a40..0e961b4c4df3f4f86ef7e60f260ee0cec4565e8f 100644 (file)
@@ -4,7 +4,7 @@ AM_CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/tests/utils \
 if HAVE_LIBLTTNG_UST_CTL
 noinst_PROGRAMS = gen-ust-nevents-str
 gen_ust_nevents_str_SOURCES = gen-ust-nevents-str.c tp.c tp.h
-gen_ust_nevents_str_LDADD = -llttng-ust -lurcu-bp \
+gen_ust_nevents_str_LDADD = $(UST_LIBS) \
                $(top_builddir)/tests/utils/libtestutils.la \
                $(DL_LIBS)
 endif
index 33c2d41efa8795b960ea08ccc864373a7fbeaf06..c20910bd87e91721480d0d22f65b5192cf30f5f2 100644 (file)
@@ -4,7 +4,7 @@ AM_CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/tests/utils \
 if HAVE_LIBLTTNG_UST_CTL
 noinst_PROGRAMS = gen-ust-nevents
 gen_ust_nevents_SOURCES = gen-ust-nevents.c tp.c tp.h
-gen_ust_nevents_LDADD = -llttng-ust -lurcu-bp \
+gen_ust_nevents_LDADD = $(UST_LIBS) \
                $(top_builddir)/tests/utils/libtestutils.la \
                $(DL_LIBS)
 endif
index 60ed301d1741110fa390f95a39043f9e3c730805..8e88c0e0c3b37e03e21cf7079f3e296ea4c86ebc 100644 (file)
@@ -4,5 +4,5 @@ AM_CPPFLAGS += -I$(srcdir) \
 if HAVE_LIBLTTNG_UST_CTL
 noinst_PROGRAMS = gen-ust-tracef
 gen_ust_tracef_SOURCES = gen-ust-tracef.c
-gen_ust_tracef_LDADD = -llttng-ust $(DL_LIBS)
+gen_ust_tracef_LDADD = $(UST_LIBS) $(DL_LIBS)
 endif
This page took 0.038079 seconds and 5 git commands to generate.