# Checks for libraries.
AC_CHECK_LIB([dl], [dlopen], [
- have_libdl=yes
libdl_name=dl
+ DL_LIBS="-ldl"
], [
#libdl not found, check for dlopen in libc.
AC_CHECK_LIB([c], [dlopen], [
- have_libc_dl=yes
libdl_name=c
+ DL_LIBS="-lc"
], [
AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
])
])
+AC_SUBST(DL_LIBS)
# Check if libdl has dlmopen support.
AH_TEMPLATE([HAVE_DLMOPEN], ["Define to 1 if dlmopen is available."])
[AC_DEFINE([HAVE_DLMOPEN], [1])]
)
-AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBDL], [test "x$have_libdl" = "xyes"])
-AM_CONDITIONAL([LTTNG_UST_BUILD_WITH_LIBC_DL], [test "x$have_libc_dl" = "xyes"])
-
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([pthread], [pthread_setname_np],
AC_DEFINE([HAVE_PTHREAD_SETNAME_NP], [1], [Define to 1 if pthread_setname_np is available.]),
liblttng_ust_cyg_profile_la_SOURCES = \
lttng-ust-cyg-profile.c \
lttng-ust-cyg-profile.h
+
liblttng_ust_cyg_profile_la_LIBADD = \
-L$(top_builddir)/liblttng-ust/.libs \
- -llttng-ust
+ -llttng-ust \
+ $(DL_LIBS)
liblttng_ust_cyg_profile_fast_la_SOURCES = \
lttng-ust-cyg-profile-fast.c \
lttng-ust-cyg-profile-fast.h
+
liblttng_ust_cyg_profile_fast_la_LIBADD = \
-L$(top_builddir)/liblttng-ust/.libs \
- -llttng-ust
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_cyg_profile_la_LIBADD += -ldl
-liblttng_ust_cyg_profile_fast_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_cyg_profile_la_LIBADD += -lc
-liblttng_ust_cyg_profile_fast_la_LIBADD += -lc
-endif
+ -llttng-ust \
+ $(DL_LIBS)
noinst_SCRIPTS = run run-fast
EXTRA_DIST = run run-fast
lttng-ust-dl.c \
ust_dl.c \
ust_dl.h
-liblttng_ust_dl_la_LIBADD = \
- $(top_builddir)/liblttng-ust/liblttng-ust.la
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_dl_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_dl_la_LIBADD += -lc
-endif
+liblttng_ust_dl_la_LIBADD = \
+ $(top_builddir)/liblttng-ust/liblttng-ust.la \
+ $(DL_LIBS)
liblttng_ust_dl_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-dl $(AM_CFLAGS)
lib_LTLIBRARIES = liblttng-ust-fd.la
liblttng_ust_fd_la_SOURCES = \
lttng-ust-fd.c
-liblttng_ust_fd_la_LIBADD = \
- $(top_builddir)/liblttng-ust/liblttng-ust.la
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_fd_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_fd_la_LIBADD += -lc
-endif
+liblttng_ust_fd_la_LIBADD = \
+ $(top_builddir)/liblttng-ust/liblttng-ust.la \
+ $(DL_LIBS)
liblttng_ust_fd_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-fd $(AM_CFLAGS)
lib_LTLIBRARIES = liblttng-ust-fork.la
liblttng_ust_fork_la_SOURCES = ustfork.c
liblttng_ust_fork_la_LIBADD = \
- $(top_builddir)/liblttng-ust/liblttng-ust.la
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_fork_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_fork_la_LIBADD += -lc
-endif
+ $(top_builddir)/liblttng-ust/liblttng-ust.la \
+ $(DL_LIBS)
liblttng_ust_fork_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-fork $(AM_CFLAGS)
lib_LTLIBRARIES = liblttng-ust-libc-wrapper.la \
liblttng-ust-pthread-wrapper.la
+
liblttng_ust_libc_wrapper_la_SOURCES = \
lttng-ust-malloc.c \
ust_libc.h
+
liblttng_ust_libc_wrapper_la_LIBADD = \
-L$(top_builddir)/liblttng-ust/.libs \
- -llttng-ust
+ -llttng-ust \
+ $(DL_LIBS)
liblttng_ust_pthread_wrapper_la_SOURCES = \
lttng-ust-pthread.c \
ust_pthread.h
+
liblttng_ust_pthread_wrapper_la_LIBADD = \
-L$(top_builddir)/liblttng-ust/.libs \
- -llttng-ust
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_libc_wrapper_la_LIBADD += -ldl
-liblttng_ust_pthread_wrapper_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_libc_wrapper_la_LIBADD += -lc
-liblttng_ust_pthread_wrapper_la_LIBADD += -lc
-endif
+ -llttng-ust \
+ $(DL_LIBS)
noinst_SCRIPTS = run
EXTRA_DIST = run
lttng-tracer-core.h \
jhash.h \
error.h
+
liblttng_ust_tracepoint_la_LIBADD = \
-lurcu-bp \
-lpthread \
- $(top_builddir)/snprintf/libustsnprintf.la
+ $(top_builddir)/snprintf/libustsnprintf.la \
+ $(DL_LIBS)
+
liblttng_ust_tracepoint_la_LDFLAGS = -no-undefined -version-info $(LTTNG_UST_LIBRARY_VERSION)
liblttng_ust_tracepoint_la_CFLAGS = -DUST_COMPONENT="liblttng_ust_tracepoint" $(AM_CFLAGS)
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_tracepoint_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_tracepoint_la_LIBADD += -lc
-endif
-
liblttng_ust_runtime_la_SOURCES = \
lttng-ust-comm.c \
lttng-ust-abi.c \
$(top_builddir)/snprintf/libustsnprintf.la \
$(top_builddir)/liblttng-ust-comm/liblttng-ust-comm.la \
liblttng-ust-tracepoint.la \
- liblttng-ust-runtime.la liblttng-ust-support.la
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-liblttng_ust_la_LIBADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-liblttng_ust_la_LIBADD += -lc
-endif
+ liblttng-ust-runtime.la liblttng-ust-support.la \
+ $(DL_LIBS)
liblttng_ust_la_CFLAGS = -DUST_COMPONENT="liblttng_ust" $(AM_CFLAGS)
noinst_PROGRAMS = bench1 bench2
bench1_SOURCES = bench.c tp.c ust_tests_benchmark.h
-bench1_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+bench1_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
+
bench2_SOURCES = bench.c tp.c ust_tests_benchmark.h
-bench2_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+bench2_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
bench2_CFLAGS = -DTRACING $(AM_CFLAGS)
dist_noinst_SCRIPTS = test_benchmark ptime
extra_DIST = README
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-bench1_LDADD += -ldl
-bench2_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-bench1_LDADD += -lc
-bench2_LDADD += -lc
-endif
noinst_PROGRAMS = ctf-types
ctf_types_SOURCES = ctf-types.c tp.c ust_tests_ctf_types.h
-ctf_types_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+ctf_types_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
ctf_types_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-ctf_types_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-ctf_types_LDADD += -lc
-endif
noinst_PROGRAMS = hello-many
hello_many_SOURCES = hello-many.c tp.c ust_tests_hello_many.h
-hello_many_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+hello_many_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
hello_many_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-hello_many_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-hello_many_LDADD += -lc
-endif
noinst_PROGRAMS = hello
hello_SOURCES = hello.cpp tp-cpp.cpp ust_tests_hello.h
-hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-hello_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-hello_LDADD += -lc
-endif
+hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
noinst_PROGRAMS = hello
hello_SOURCES = hello.c tp.c ust_tests_hello.h
-hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
hello_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-hello_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-hello_LDADD += -lc
-endif
noinst_PROGRAMS = same_line_tracepoint
same_line_tracepoint_SOURCES = same_line_tracepoint.c ust_tests_sameline.h
-same_line_tracepoint_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-same_line_tracepoint_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-same_line_tracepoint_LDADD += -lc
-endif
+same_line_tracepoint_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
noinst_PROGRAMS = hello
hello_SOURCES = hello.c tp.c ust_tests_hello.h
-hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+hello_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
hello_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-hello_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-hello_LDADD += -lc
-endif
noinst_PROGRAMS = ust-variant
ust_variant_SOURCES = ust-variant.c
-ust_variant_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la
+ust_variant_LDADD = $(top_builddir)/liblttng-ust/liblttng-ust.la $(DL_LIBS)
ust_variant_CFLAGS = -Werror=old-style-definition $(AM_CFLAGS)
-
-if LTTNG_UST_BUILD_WITH_LIBDL
-ust_variant_LDADD += -ldl
-endif
-if LTTNG_UST_BUILD_WITH_LIBC_DL
-ust_variant_LDADD += -lc
-endif