From 62b7418e09fbce6c2f9ea5cf237c980a849c58fe Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Fri, 30 Oct 2020 02:48:08 -0400 Subject: [PATCH] Cleanup: Use pkg-config to detect liburcu MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Michael Jeanson Signed-off-by: Jérémie Galarneau Change-Id: I88d3f853c8ee0e14a38a462ce24626800e0a4caf --- configure.ac | 33 +++---------------- src/bin/lttng-relayd/Makefile.am | 2 +- src/bin/lttng-sessiond/Makefile.am | 2 +- src/common/hashtable/Makefile.am | 2 +- .../regression/ust/multi-session/Makefile.am | 2 +- tests/unit/Makefile.am | 6 ++-- .../utils/testapp/gen-ust-events/Makefile.am | 2 +- .../testapp/gen-ust-nevents-str/Makefile.am | 2 +- .../utils/testapp/gen-ust-nevents/Makefile.am | 2 +- 9 files changed, 14 insertions(+), 39 deletions(-) diff --git a/configure.ac b/configure.ac index 2d4fcb7b9..fa58cbb16 100644 --- a/configure.ac +++ b/configure.ac @@ -481,35 +481,10 @@ PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7.6]) AC_CHECK_FUNC([clock_gettime], [AC_DEFINE_UNQUOTED([LTTNG_HAVE_CLOCK_GETTIME], 1, [Has clock_gettime() support.])]) # URCU library version needed or newer -m4_define([WRONG_LIBURCU_MSG], [Userspace RCU (liburcu) >= 0.9.0 is needed]) - -# Check liburcu needed function calls -AC_CHECK_DECL([cds_list_add], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) -AC_CHECK_DECL([cds_wfcq_init], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) -AC_CHECK_DECL([cds_wfcq_dequeue_blocking], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) -AC_CHECK_DECL([futex_async], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) -AC_CHECK_DECL([rcu_thread_offline], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) -AC_CHECK_DECL([rcu_thread_online], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) -AC_CHECK_DECL([caa_likely], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]]) -AC_CHECK_LIB([urcu-cds], [_cds_lfht_new], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])]) - -#Function added in urcu 0.7.0 -AC_CHECK_DECL([cmm_smp_mb__before_uatomic_or], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]] -) - -#Function added in urcu 0.9.0 -AC_CHECK_DECL([urcu_ref_get_unless_zero], [], - [AC_MSG_ERROR([WRONG_LIBURCU_MSG])], [[#include ]] -) +PKG_CHECK_MODULES([URCU], [liburcu >= 0.9]) +PKG_CHECK_MODULES([URCU_BP], [liburcu-bp >= 0.9]) +PKG_CHECK_MODULES([URCU_CDS], [liburcu-cds >= 0.9]) +AM_CPPFLAGS="$AM_CPPFLAGS $URCU_CFLAGS" # Check for libkmod, it will be auto-neabled if found but won't fail if it's not, # it can be explicitly disabled with --without-kmod diff --git a/src/bin/lttng-relayd/Makefile.am b/src/bin/lttng-relayd/Makefile.am index 9bc1523e0..f6d5b2950 100644 --- a/src/bin/lttng-relayd/Makefile.am +++ b/src/bin/lttng-relayd/Makefile.am @@ -28,7 +28,7 @@ lttng_relayd_SOURCES = main.c lttng-relayd.h utils.h utils.c cmd.h \ backward-compatibility-group-by.c backward-compatibility-group-by.h # link on liblttngctl for check if relayd is already alive. -lttng_relayd_LDADD = -lurcu-common -lurcu \ +lttng_relayd_LDADD = $(URCU_LIBS) \ $(top_builddir)/src/common/libcommon.la \ $(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \ $(top_builddir)/src/common/hashtable/libhashtable.la \ diff --git a/src/bin/lttng-sessiond/Makefile.am b/src/bin/lttng-sessiond/Makefile.am index dd807125b..d8e3b715d 100644 --- a/src/bin/lttng-sessiond/Makefile.am +++ b/src/bin/lttng-sessiond/Makefile.am @@ -68,7 +68,7 @@ endif lttng_sessiond_SOURCES += lttng-sessiond.h main.c # link on liblttngctl for check if sessiond is already alive. -lttng_sessiond_LDADD = -lurcu-common -lurcu $(KMOD_LIBS) \ +lttng_sessiond_LDADD = -lurcu-common $(URCU_LIBS) $(KMOD_LIBS) \ $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ $(top_builddir)/src/common/sessiond-comm/libsessiond-comm.la \ $(top_builddir)/src/common/kernel-ctl/libkernel-ctl.la \ diff --git a/src/common/hashtable/Makefile.am b/src/common/hashtable/Makefile.am index ba002b6c3..5f6770a81 100644 --- a/src/common/hashtable/Makefile.am +++ b/src/common/hashtable/Makefile.am @@ -6,4 +6,4 @@ libhashtable_la_SOURCES = hashtable.c hashtable.h \ utils.c utils.h \ hashtable-symbols.h -libhashtable_la_LIBADD = -lurcu-common -lurcu -lurcu-cds +libhashtable_la_LIBADD = $(URCU_LIBS) $(URCU_CDS_LIBS) diff --git a/tests/regression/ust/multi-session/Makefile.am b/tests/regression/ust/multi-session/Makefile.am index b27e05b79..c50233fa8 100644 --- a/tests/regression/ust/multi-session/Makefile.am +++ b/tests/regression/ust/multi-session/Makefile.am @@ -4,7 +4,7 @@ AM_CFLAGS += -I$(srcdir) noinst_PROGRAMS = gen-nevents gen_nevents_SOURCES = gen-nevents.c tp.c ust_gen_nevents.h -gen_nevents_LDADD = $(UST_LIBS) -lurcu-bp $(DL_LIBS) +gen_nevents_LDADD = $(UST_LIBS) $(URCU_BP_LIBS) $(DL_LIBS) noinst_SCRIPTS = test_multi_session EXTRA_DIST = test_multi_session diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 8dc4748a4..a91b4dbd9 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -114,7 +114,7 @@ RELAYD_OBJS = $(top_builddir)/src/bin/lttng-relayd/backward-compatibility-group- test_session_SOURCES = test_session.c test_session_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \ - $(LIBHASHTABLE) $(DL_LIBS) -lrt -lurcu-common -lurcu \ + $(LIBHASHTABLE) $(DL_LIBS) -lrt $(URCU_LIBS) \ $(KMOD_LIBS) \ $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ $(top_builddir)/src/common/kernel-ctl/libkernel-ctl.la \ @@ -134,7 +134,7 @@ endif 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 \ + $(LIBHASHTABLE) $(DL_LIBS) -lrt $(URCU_LIBS) \ $(UST_CTL_LIBS) \ $(KMOD_LIBS) \ $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \ @@ -205,7 +205,7 @@ test_relayd_backward_compat_group_by_session_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_s # fd tracker unit test test_fd_tracker_SOURCES = test_fd_tracker.c -test_fd_tracker_LDADD = $(LIBTAP) $(LIBFDTRACKER) $(DL_LIBS) -lurcu $(LIBCOMMON) $(LIBHASHTABLE) +test_fd_tracker_LDADD = $(LIBTAP) $(LIBFDTRACKER) $(DL_LIBS) $(URCU_LIBS) $(LIBCOMMON) $(LIBHASHTABLE) # uuid unit test test_uuid_SOURCES = test_uuid.c diff --git a/tests/utils/testapp/gen-ust-events/Makefile.am b/tests/utils/testapp/gen-ust-events/Makefile.am index d6327d5b2..4b1c2173b 100644 --- a/tests/utils/testapp/gen-ust-events/Makefile.am +++ b/tests/utils/testapp/gen-ust-events/Makefile.am @@ -6,7 +6,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 = $(UST_LIBS) -lurcu-bp \ +gen_ust_events_LDADD = $(UST_LIBS) $(URCU_BP_LIBS) \ $(top_builddir)/tests/utils/libtestutils.la \ $(DL_LIBS) endif diff --git a/tests/utils/testapp/gen-ust-nevents-str/Makefile.am b/tests/utils/testapp/gen-ust-nevents-str/Makefile.am index ed278a6ca..84198bedd 100644 --- a/tests/utils/testapp/gen-ust-nevents-str/Makefile.am +++ b/tests/utils/testapp/gen-ust-nevents-str/Makefile.am @@ -6,7 +6,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 = $(UST_LIBS) -lurcu-bp \ +gen_ust_nevents_str_LDADD = $(UST_LIBS) $(URCU_BP_LIBS) \ $(top_builddir)/tests/utils/libtestutils.la \ $(DL_LIBS) endif diff --git a/tests/utils/testapp/gen-ust-nevents/Makefile.am b/tests/utils/testapp/gen-ust-nevents/Makefile.am index d160d920d..6788b1f36 100644 --- a/tests/utils/testapp/gen-ust-nevents/Makefile.am +++ b/tests/utils/testapp/gen-ust-nevents/Makefile.am @@ -6,7 +6,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 = $(UST_LIBS) -lurcu-bp \ +gen_ust_nevents_LDADD = $(UST_LIBS) $(URCU_BP_LIBS) \ $(top_builddir)/tests/utils/libtestutils.la \ $(DL_LIBS) endif -- 2.34.1