From d54da541b49d4deb712d8c8df3efe2e2c1efa510 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Sun, 26 Mar 2017 15:55:51 +0300 Subject: [PATCH] configure: improved detection and usage of 'librt' --- configure.ac | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 7a44c0d5..936550ce 100644 --- a/configure.ac +++ b/configure.ac @@ -918,9 +918,20 @@ AC_CHECK_DECLS([SOCK_NONBLOCK], [AC_DEFINE([HAVE_SOCK_NONBLOCK], [1], [SOCK_NONB ]) -AC_SEARCH_LIBS([clock_gettime], [rt], [ - AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Have clock_gettime]) -]) +AC_CHECK_DECL([[clock_gettime]], + [ + SAVE_LIBS="$LIBS" + AC_SEARCH_LIBS([clock_gettime], [rt], + [ + AC_DEFINE([HAVE_CLOCK_GETTIME], [1], [Have clock_gettime]) + AS_VAR_IF([[ac_cv_search_clock_gettime]],[["none required"]], [], + [ + MHD_LIBDEPS="$ac_cv_search_clock_gettime $MHD_LIBDEPS" + MHD_LIBDEPS_PKGCFG="$ac_cv_search_clock_gettime $MHD_LIBDEPS_PKGCFG" + ]) + ], [], [$MHD_LIBDEPS]) + LIBS="$SAVE_LIBS" + ], [], [[#include ]]) AC_MSG_CHECKING([[for clock_get_time]]) AC_LINK_IFELSE( @@ -939,8 +950,6 @@ AC_LINK_IFELSE( ], [ AC_DEFINE([HAVE_CLOCK_GET_TIME], [1], [Define to 1 if you have `clock_get_time', `host_get_clock_service' and `mach_port_deallocate' functions.]) -# For glibc < 2.17, we need -lrt: - MHD_LIBDEPS="-lrt $MHD_LIBDEPS" AC_MSG_RESULT([[yes]]) ], [AC_MSG_RESULT([[no]])