Commit 73aea4f8083e8c35ce1123e36a9967ecd6a26c97

Guillem Jover 2019-08-06T23:11:50

build: Fix check for clock_gettime() within librt The check was always setting the libraries to link to include -lrt, as the success case includes the builtin one. Handle the various values.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/configure.ac b/configure.ac
index 6b2bb6c..1654072 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,7 +48,11 @@ AS_CASE([$host_os],
   [*-gnu*], [
     # In old glibc versions (< 2.17) clock_gettime() is in librt.
     saved_LIBS="$LIBS"
-    AC_SEARCH_LIBS([clock_gettime], [rt], [CLOCK_GETTIME_LIBS="-lrt"])
+    AC_SEARCH_LIBS([clock_gettime], [rt], [
+      AS_IF([test "x$ac_cv_search_clock_gettime" != "xnone required"], [
+        CLOCK_GETTIME_LIBS="$ac_cv_search_clock_gettime"
+      ])
+    ])
     AC_SUBST([CLOCK_GETTIME_LIBS])
     LIBS="$saved_LIBS"
   ],