[PATCH 8/8] configure: detect libdl and librt

Leonid Bobrov mazocomp at disroot.org
Fri Feb 8 13:13:41 UTC 2019


Signed-off-by: Leonid Bobrov <mazocomp at disroot.org>
---
 Makefile.am  |  6 +++---
 configure.ac | 16 ++++++++++++++++
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 426e20a..b973cbe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -71,7 +71,7 @@ nodist_include_HEADERS =			\
 	protocol/wayland-client-protocol.h
 
 libwayland_server_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread
-libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
+libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm
 libwayland_server_la_LDFLAGS = -version-info 1:0:1
 libwayland_server_la_SOURCES =			\
 	src/wayland-server.c			\
@@ -84,7 +84,7 @@ nodist_libwayland_server_la_SOURCES =		\
 	protocol/wayland-protocol.c
 
 libwayland_client_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread
-libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la -lrt -lm
+libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm
 libwayland_client_la_LDFLAGS = -version-info 3:0:3
 libwayland_client_la_SOURCES =			\
 	src/wayland-client.c
@@ -216,7 +216,7 @@ noinst_LTLIBRARIES +=				\
 	libtest-helpers.la
 
 libtest_helpers_la_SOURCES = tests/test-helpers.c
-libtest_helpers_la_LIBADD = -lrt -ldl $(FFI_LIBS) $(KVM_LIBS)
+libtest_helpers_la_LIBADD = $(RT_LIBS) $(DL_LIBS) $(FFI_LIBS) $(KVM_LIBS)
 
 libtest_runner_la_SOURCES =			\
 	tests/test-runner.c			\
diff --git a/configure.ac b/configure.ac
index 1d1a25b..40cbd08 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,6 +85,22 @@ if test "x$ac_cv_header_kvm_h" != "x" && test "x$ac_cv_lib_kvm_kvm_getfiles" !=
 	AC_DEFINE(USE_LIBKVM, 1, [use libkvm on BSD])
 fi
 
+# *BSD don't have libdl, but they have its functions
+SAVE_LIBS="$LIBS"
+LIBS=
+AC_CHECK_LIB([dl], [dlsym])
+DL_LIBS="$LIBS"
+LIBS="$SAVE_LIBS"
+AC_SUBST(DL_LIBS)
+
+# *BSD don't have librt, but they have its functions
+SAVE_LIBS="$LIBS"
+LIBS=
+AC_CHECK_LIB([rt], [clock_gettime])
+RT_LIBS="$LIBS"
+LIBS="$SAVE_LIBS"
+AC_SUBST(RT_LIBS)
+
 # Defines __FreeBSD__ if we're on FreeBSD, same for other *BSD
 AC_CHECK_HEADERS([sys/param.h])
 
-- 
2.20.1



More information about the wayland-devel mailing list