[PATCH v2 2/9] configure: detect libdl and librt
Leonid Bobrov
mazocomp at disroot.org
Sat Feb 9 05:49:39 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 f47d055..489f581 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 \
@@ -83,7 +83,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
@@ -227,7 +227,7 @@ libtest_runner_la_LIBADD = \
libwayland-client.la \
libwayland-server.la \
libtest-helpers.la \
- -lrt -ldl $(FFI_LIBS)
+ $(RT_LIBS) $(DL_LIBS) $(FFI_LIBS)
array_test_SOURCES = tests/array-test.c
array_test_LDADD = libtest-runner.la
diff --git a/configure.ac b/configure.ac
index 18fb649..f53408a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,22 @@ AC_SUBST(GCC_CFLAGS)
AC_CHECK_HEADERS([sys/prctl.h])
AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate prctl])
+# *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)
+
AC_ARG_ENABLE([libraries],
[AC_HELP_STRING([--disable-libraries],
[Disable compilation of wayland libraries])],
--
2.20.1
More information about the wayland-devel
mailing list