summaryrefslogtreecommitdiffstats
path: root/package/lirc-tools/0002-configure-check-for-clock_gettime-in-librt.patch
blob: 710dfd3b05e2474c04f2dc5db28f2e6ad75e1d6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
From e654ae139cec42a6f1b5684261787d0c241cfd3b Mon Sep 17 00:00:00 2001
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Date: Fri, 19 Aug 2016 15:25:48 +0200
Subject: [PATCH] configure: check for clock_gettime in librt

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 configure.ac        | 3 +++
 daemons/Makefile.am | 2 +-
 plugins/Makefile.am | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 73340c7..466e638 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,9 @@ AC_CHECK_FUNCS(gethostname gettimeofday mkfifo select socket strdup \
 AC_SEARCH_LIBS([dlopen], [dl dld], [], [
   AC_MSG_ERROR([unable to find the dlopen() function])
 ])
+# glibc < 2.17 needs librt for clock_gettime()
+AC_CHECK_LIB(rt, clock_gettime, LIBCLOCK_GETTIME="-lrt")
+AC_SUBST(LIBCLOCK_GETTIME)
 AC_CHECK_FUNCS(daemon)
 if test "$ac_cv_func_daemon" != yes; then
   daemon=""
diff --git a/daemons/Makefile.am b/daemons/Makefile.am
index 5625627..85a28f3 100644
--- a/daemons/Makefile.am
+++ b/daemons/Makefile.am
@@ -21,7 +21,7 @@ sbin_PROGRAMS           += lircd-uinput
 endif
 
 lircd_SOURCES           = lircd.cpp
-lircd_LDADD             = ../lib/liblirc.la
+lircd_LDADD             = ../lib/liblirc.la @LIBCLOCK_GETTIME@
 
 lircd_uinput_SOURCES    = lircd-uinput.cpp
 lircd_uinput_LDADD     = ../lib/liblirc.la
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index ddff01d..45c012a 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -127,6 +127,7 @@ zotac_la_SOURCES            = zotac.c
 
 plugin_LTLIBRARIES          += mplay.la
 mplay_la_SOURCES            = mplay.c
+mplay_la_LIBADD             = @LIBCLOCK_GETTIME@
 endif
 
 $(srcdir)/pluginlist.am:
-- 
2.7.4

OpenPOWER on IntegriCloud