]> git.ipfire.org Git - thirdparty/libbsd.git/commitdiff
build: Fix check for clock_gettime() within librt
authorGuillem Jover <guillem@hadrons.org>
Tue, 6 Aug 2019 21:11:50 +0000 (23:11 +0200)
committerGuillem Jover <guillem@hadrons.org>
Tue, 6 Aug 2019 22:03:25 +0000 (00:03 +0200)
The check was always setting the libraries to link to include -lrt,
as the success case includes the builtin one. Handle the various
values.

configure.ac

index 6b2bb6cda157804787333de859fd2cd17995f72c..1654072c2a6cd38f9a6573a4136a9a2ee99a1849 100644 (file)
@@ -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"
   ],