# check for dlopen
AC_CHECK_LIB([dl], [dlopen],
-[
- have_libdl=yes
-],
-[
- #libdl not found, check for dlopen in libc.
- AC_CHECK_LIB([c], [dlopen],
- [
- have_libc_dl=yes
- ],
- [
- AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
- ])
-])
-AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
-AM_CONDITIONAL([LTTNG_TOOLS_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
+ [DL_LIBS="-ldl"],
+ [
+ #libdl not found, check for dlopen in libc.
+ AC_CHECK_LIB([c], [dlopen],
+ [DL_LIBS="-lc"],
+ [AC_MSG_FAILURE([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])]
+ )
+ ]
+)
+AC_SUBST(DL_LIBS)
# Check for fmemopen
AC_CHECK_LIB([c], [fmemopen],
AM_CPPFLAGS += -I$(top_srcdir)/tests -I$(srcdir)
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
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 = -llttng-ust -lurcu-bp $(DL_LIBS)
endif
noinst_SCRIPTS = test_unsupported_op test_invalid_filter test_valid_filter
AM_CPPFLAGS += -I. -I$(top_srcdir)/include
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
COPYSCRIPTS = test_thread_exit test_thread_stall test_tp_fail \
test_health.sh test_thread_ok
dist_noinst_SCRIPTS = $(COPYSCRIPTS)
# Health thread exit ld_preloaded test lib
libhealthexit_la_SOURCES=health_exit.c
libhealthexit_la_LDFLAGS= $(FORCE_SHARED_LIB_OPTIONS)
+libhealthexit_la_LIBADD = $(DL_LIBS)
# Health thread stall ld_preloaded test lib
libhealthstall_la_SOURCES=health_stall.c
libhealthstall_la_LDFLAGS= $(FORCE_SHARED_LIB_OPTIONS)
+libhealthstall_la_LIBADD = $(DL_LIBS)
# Health thread fail ld_preloaded test lib
libhealthtpfail_la_SOURCES=health_fail.c
libhealthtpfail_la_LDFLAGS= $(FORCE_SHARED_LIB_OPTIONS)
+libhealthtpfail_la_LIBADD = $(DL_LIBS)
noinst_PROGRAMS = health_check
noinst_LTLIBRARIES = libhealthexit.la libhealthstall.la libhealthtpfail.la
health_check_SOURCES = health_check.c $(UTILS)
health_check_LDADD = $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la \
- $(top_builddir)/src/common/libcommon.la
+ $(top_builddir)/src/common/libcommon.la \
+ $(DL_LIBS)
EXTRA_DIST = $(COPYSCRIPTS)
AM_CPPFLAGS += -I$(top_srcdir)/tests/utils/ -I$(srcdir)
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la
LIBCOMMON=$(top_builddir)/src/common/libcommon.la
live_test_SOURCES = live_test.c
live_test_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
- $(LIBHASHTABLE) $(LIBHEALTH) -lrt
+ $(LIBHASHTABLE) $(LIBHEALTH) $(DL_LIBS) -lrt
live_test_LDADD += $(LIVE) \
- $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la
+ $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la
all-local:
@if [ x"$(srcdir)" != x"$(builddir)" ]; then \
-rpath $(abs_builddir)
libpause_consumer_la_SOURCES = consumer_testpoints.c
-libpause_consumer_la_LIBADD = $(top_builddir)/src/common/libcommon.la
+libpause_consumer_la_LIBADD = $(top_builddir)/src/common/libcommon.la $(DL_LIBS)
libpause_consumer_la_LDFLAGS = $(FORCE_SHARED_LIB_OPTIONS)
noinst_LTLIBRARIES = libpause_consumer.la
notification_SOURCES = notification.c
notification_LDADD = $(LIB_LTTNG_CTL) $(LIBTAP) -lm
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
noinst_SCRIPTS = test_notification test_notification_multi_app
EXTRA_DIST = test_notification test_notification_multi_app
AM_CPPFLAGS += -I$(top_srcdir)/tests -I$(srcdir)
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
noinst_SCRIPTS = test_event_wildcard
EXTRA_DIST = test_event_wildcard
noinst_LTLIBRARIES = lttng-ust-clock-override-test.la
lttng_ust_clock_override_test_la_LDFLAGS = $(GETCPU_LIBTOOL_FLAGS)
lttng_ust_clock_override_test_la_SOURCES = lttng-ust-clock-override-test.c
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-lttng_ust_clock_override_test_la_LIBADD = -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-lttng_ust_clock_override_test_la_LIBADD = -lc
-endif
+lttng_ust_clock_override_test_la_LIBADD = $(DL_LIBS)
noinst_SCRIPTS = test_clock_override
EXTRA_DIST = test_clock_override
noinst_PROGRAMS = daemon
daemon_SOURCES = daemon.c ust_tests_daemon.h
-daemon_LDADD = -llttng-ust -llttng-ust-fork
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-daemon_LDADD += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-daemon_LDADD += -lc
-endif
+daemon_LDADD = -llttng-ust -llttng-ust-fork $(DL_LIBS)
noinst_SCRIPTS = test_daemon test_daemon.py
EXTRA_DIST = test_daemon test_daemon.py
noinst_PROGRAMS = exit-fast
exit_fast_SOURCES = exit-fast.c ust_tests_exitfast.h
-exit_fast_LDADD = -llttng-ust
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-exit_fast_LDADD += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-exit_fast_LDADD += -lc
-endif
+exit_fast_LDADD = -llttng-ust $(DL_LIBS)
noinst_SCRIPTS = test_exit-fast test_exit-fast.py
EXTRA_DIST = test_exit-fast test_exit-fast.py
noinst_PROGRAMS = fork fork2
fork_SOURCES = fork.c ust_tests_fork.h
-fork_LDADD = -llttng-ust -llttng-ust-fork
+fork_LDADD = -llttng-ust -llttng-ust-fork $(DL_LIBS)
fork2_SOURCES = fork2.c
-fork2_LDADD = -llttng-ust -llttng-ust-fork
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-fork_LDADD += -ldl
-fork2_LDADD += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-fork_LDADD += -lc
-fork2_LDADD += -lc
-endif
+fork2_LDADD = -llttng-ust -llttng-ust-fork $(DL_LIBS)
noinst_SCRIPTS = test_fork test_fork.py
EXTRA_DIST = test_fork test_fork.py
noinst_LTLIBRARIES = lttng-ust-getcpu-override-test.la
lttng_ust_getcpu_override_test_la_LDFLAGS = $(GETCPU_LIBTOOL_FLAGS)
lttng_ust_getcpu_override_test_la_SOURCES = lttng-ust-getcpu-override-test.c
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-lttng_ust_getcpu_override_test_la_LIBADD = -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-lttng_ust_getcpu_override_test_la_LIBADD = -lc
-endif
+lttng_ust_getcpu_override_test_la_LIBADD = $(DL_LIBS)
noinst_SCRIPTS = test_getcpu_override run-getcpu-override
EXTRA_DIST = test_getcpu_override run-getcpu-override
AM_CPPFLAGS += -I$(srcdir)
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
noinst_PROGRAMS = gen-events
gen_events_SOURCES = main.c tp.c tp.h
-gen_events_LDADD = -llttng-ust
+gen_events_LDADD = -llttng-ust $(DL_LIBS)
noinst_SCRIPTS = test_high_throughput
EXTRA_DIST = test_high_throughput
# 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
+demo_builtin_LDADD = -llttng-ust $(DL_LIBS)
demo_builtin_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
# Build a version statically linked to the providers
demo_static_SOURCES = demo.c
demo_static_LDADD = liblttng-ust-provider-ust-tests-demo-static.la \
- liblttng-ust-provider-ust-tests-demo3-static.la
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-demo_builtin_LDADD += -ldl
-demo_static_LDADD += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-demo_builtin_LDADD += -lc
-demo_static_LDADD += -lc
-endif
+ liblttng-ust-provider-ust-tests-demo3-static.la \
+ $(DL_LIBS)
noinst_PROGRAMS = demo_builtin demo_static
noinst_PROGRAMS += demo
demo_SOURCES = demo.c ust_tests_demo.h
demo_CFLAGS = -DTEST_DYNAMIC_LINKAGE $(AM_CFLAGS)
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-demo_LDADD = -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-demo_LDADD = -lc
-endif
+demo_LDADD = $(DL_LIBS)
EXTRA_DIST = $(COPYSCRIPTS)
AM_CPPFLAGS += -I$(srcdir)
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
noinst_PROGRAMS = gen-events
gen_events_SOURCES = main.c tp.c tp.h
-gen_events_LDADD = -llttng-ust -lurcu
+gen_events_LDADD = -llttng-ust -lurcu $(DL_LIBS)
noinst_SCRIPTS = test_low_throughput
EXTRA_DIST = test_low_throughput
AM_CFLAGS += -I$(srcdir)
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
noinst_PROGRAMS = gen-nevents
gen_nevents_SOURCES = gen-nevents.c tp.c ust_gen_nevents.h
-gen_nevents_LDADD = -llttng-ust -lurcu-bp
+gen_nevents_LDADD = -llttng-ust -lurcu-bp $(DL_LIBS)
noinst_SCRIPTS = test_multi_session
EXTRA_DIST = test_multi_session
noinst_PROGRAMS = demo
demo_SOURCES = demo.c ust_tests_demo.h
# The demo program only depends on libdl/libc for dlopen().
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-demo_LDADD = -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-demo_LDADD = -lc
-endif
+demo_LDADD = $(DL_LIBS)
noinst_SCRIPTS = demo-trace
EXTRA_DIST = demo-trace
noinst_PROGRAMS = type-declarations
type_declarations_SOURCES = type-declarations.c ust_tests_td.h
-type_declarations_LDADD = -llttng-ust
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-type_declarations_LDADD += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-type_declarations_LDADD += -lc
-endif
+type_declarations_LDADD = -llttng-ust $(DL_LIBS)
noinst_SCRIPTS = test_type_declarations test_type_declarations.py
EXTRA_DIST = test_type_declarations test_type_declarations.py
test_notification \
ini_config/test_ini_config
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la
LIBCOMMON=$(top_builddir)/src/common/libcommon.la
# URI unit tests
test_uri_SOURCES = test_uri.c
-test_uri_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBHASHTABLE)
+test_uri_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBHASHTABLE) $(DL_LIBS)
# Session unit test
SESSIONS=$(top_builddir)/src/bin/lttng-sessiond/session.$(OBJEXT) \
test_session_SOURCES = test_session.c
test_session_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
- $(LIBHASHTABLE) -lrt
+ $(LIBHASHTABLE) $(DL_LIBS) -lrt
test_session_LDADD += $(SESSIONS)
# UST data structures unit test
test_ust_data_SOURCES = test_ust_data.c
test_ust_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM)\
- $(LIBHASHTABLE) -lrt -llttng-ust-ctl
+ $(LIBHASHTABLE) $(DL_LIBS) -lrt -llttng-ust-ctl
test_ust_data_LDADD += $(UST_DATA_TRACE)
endif
test_kernel_data_SOURCES = test_kernel_data.c
test_kernel_data_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBRELAYD) $(LIBSESSIOND_COMM) \
- $(LIBHASHTABLE) -lrt
+ $(LIBHASHTABLE) $(DL_LIBS) -lrt
test_kernel_data_LDADD += $(KERN_DATA_TRACE)
# utils suffix for unit test
# parse_size_suffix unit test
test_utils_parse_size_suffix_SOURCES = test_utils_parse_size_suffix.c
-test_utils_parse_size_suffix_LDADD = $(LIBTAP) $(LIBHASHTABLE) $(LIBCOMMON)
+test_utils_parse_size_suffix_LDADD = $(LIBTAP) $(LIBHASHTABLE) $(LIBCOMMON) $(DL_LIBS)
test_utils_parse_size_suffix_LDADD += $(UTILS_SUFFIX)
# expand_path unit test
test_utils_expand_path_SOURCES = test_utils_expand_path.c
-test_utils_expand_path_LDADD = $(LIBTAP) $(LIBHASHTABLE) $(LIBCOMMON)
+test_utils_expand_path_LDADD = $(LIBTAP) $(LIBHASHTABLE) $(LIBCOMMON) $(DL_LIBS)
test_utils_expand_path_LDADD += $(UTILS_SUFFIX)
# string utilities unit test
test_string_utils_SOURCES = test_string_utils.c
-test_string_utils_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBSTRINGUTILS)
-#
+test_string_utils_LDADD = $(LIBTAP) $(LIBCOMMON) $(LIBSTRINGUTILS) $(DL_LIBS)
+
# Notification api
test_notification_SOURCES = test_notification.c
-test_notification_LDADD = $(LIBTAP) $(LIBLTTNG_CTL)
+test_notification_LDADD = $(LIBTAP) $(LIBLTTNG_CTL) $(DL_LIBS)
AM_CPPFLAGS += -I$(top_srcdir)/tests/utils -I$(srcdir)
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
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 \
- $(top_builddir)/tests/utils/libtestutils.la
+ $(top_builddir)/tests/utils/libtestutils.la \
+ $(DL_LIBS)
endif
AM_CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/tests/utils
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
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 \
- $(top_builddir)/tests/utils/libtestutils.la
+ $(top_builddir)/tests/utils/libtestutils.la \
+ $(DL_LIBS)
endif
AM_CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/tests/utils
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-LIBS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-LIBS += -lc
-endif
-
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 \
- $(top_builddir)/tests/utils/libtestutils.la
+ $(top_builddir)/tests/utils/libtestutils.la \
+ $(DL_LIBS)
endif
AM_CPPFLAGS += -I$(srcdir)
-AM_LDFLAGS =
-
-if LTTNG_TOOLS_BUILD_WITH_LIBDL
-AM_LDFLAGS += -ldl
-endif
-if LTTNG_TOOLS_BUILD_WITH_LIBC_DL
-AM_LDFLAGS += -lc
-endif
if HAVE_LIBLTTNG_UST_CTL
noinst_PROGRAMS = gen-ust-tracef
gen_ust_tracef_SOURCES = gen-ust-tracef.c
-gen_ust_tracef_LDADD = -llttng-ust
+gen_ust_tracef_LDADD = -llttng-ust $(DL_LIBS)
endif