Quantcast

[PATCH] configure: check for clock_gettime in librt

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] configure: check for clock_gettime in librt

Thomas Petazzoni
Signed-off-by: Thomas Petazzoni <[hidden email]>
---
 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 8ea2ef9..42e8600 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,6 +74,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 64b1397..74b1eca 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 63206db..1109743 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -124,6 +124,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


------------------------------------------------------------------------------
Loading...