Skip to contentSkip to conversation

test if librt is required for clock_gettime

PATCH In review Jonathan Gray 2 participants 2 messages Jun 19, 2013 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test if librt is required for clock_gettime

clock_gettime is in libc not librt on OpenBSD so check to see if linking librt is required.

---
 configure.ac     | 4 ++++
 test/Makefile.am | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
configure.ac +4 -0
index 3f6f9bd..26688a3 100644
@@ -374,6 +374,10 @@ PKG_CHECK_MODULES(DRI, [xf86driproto], , DRI=no)
 PKG_CHECK_MODULES(DRI2, [dri2proto >= 2.6],, DRI2=no)
 PKG_CHECK_MODULES(PCIACCESS, [pciaccess >= 0.10])
 
+LIBS=""
+AC_SEARCH_LIBS(clock_gettime, rt, [CLOCK_GETTIME_LIBS=$LIBS])
+AC_SUBST(CLOCK_GETTIME_LIBS)
+
 sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
 
 if test "x$enable_dri" != "xno"; then
Makefile.am +1 -1
index c3610f2..f51967b 100644
@@ -25,7 +25,7 @@ check_PROGRAMS = $(stress_TESTS)
 noinst_PROGRAMS = lowlevel-blt-bench
 
 AM_CFLAGS = @CWARNFLAGS@ @X11_CFLAGS@ @DRM_CFLAGS@
-LDADD = libtest.la @X11_LIBS@ -lXfixes @DRM_LIBS@ -lrt
+LDADD = libtest.la @X11_LIBS@ -lXfixes @DRM_LIBS@ @CLOCK_GETTIME_LIBS@
 
 noinst_LTLIBRARIES = libtest.la
 libtest_la_SOURCES = \
Signature · 1 line
1.8.3
#1 lore raw
Quoted 4 lines · Jonathan Gray

clock_gettime is in libc not librt on OpenBSD so check to see if linking librt is required.

Thank you, pushed.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre