[PATCH] build: use -lrt for clock_gettime on glibc < 2.17

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Dirk-Jan C. Binnema" <djcb@xxxxxxxxxxxxxxx>

glibc before 2.17 (e.g., fedora 18) requires -lrt for clock_gettime;
add -lrt where needed in that case.
---
 Makefile.am  | 2 +-
 configure.ac | 6 ++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 61daec4..8069af2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -152,7 +152,7 @@ src_bluetoothd_SOURCES = $(builtin_sources) \
 			src/shared/util.h src/shared/util.c \
 			src/shared/mgmt.h src/shared/mgmt.c
 src_bluetoothd_LDADD = lib/libbluetooth-internal.la gdbus/libgdbus-internal.la \
-			@GLIB_LIBS@ @DBUS_LIBS@ -ldl -lrt
+			@GLIB_LIBS@ @DBUS_LIBS@ @RT_LIBS@ -ldl
 src_bluetoothd_LDFLAGS = $(AM_LDFLAGS) -Wl,--export-dynamic \
 				-Wl,--version-script=$(srcdir)/src/bluetooth.ver
 
diff --git a/configure.ac b/configure.ac
index 050d30d..e7a7b85 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,8 +40,10 @@ AC_ARG_ENABLE(threads, AC_HELP_STRING([--enable-threads],
 AC_CHECK_FUNC(signalfd, dummy=yes,
 			AC_MSG_ERROR(signalfd support is required))
 
-AC_CHECK_FUNC(clock_gettime, dummy=yes,
-			AC_MSG_ERROR(realtime clock support is required))
+AC_CHECK_FUNC(clock_gettime, [], [
+  AC_CHECK_LIB(rt, clock_gettime, RT_LIBS="-lrt",
+    AC_MSG_ERROR(realtime clock support is required))])
+AC_SUBST(RT_LIBS)
 
 AC_CHECK_LIB(pthread, pthread_create, dummy=yes,
 			AC_MSG_ERROR(posix thread support is required))
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux