From 47eb4e18d05e6b6362639a3a1454a5a354745f39 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 1 May 2020 16:51:20 +0200 Subject: configure.ac: Fix HAVE_CLOCK_GETTIME undef when func in -lrt AC_SEARCH_LIBS was finding the function correctly, but later on AC_CHECK_FUNCS was not including the found LIBRARY_RT so the function was not found, and hence HAVE_CLOCK_GETTIME ended up undefined (which in turns disables support for osmo_clock_gettime() API). This happened in systems like the soekris where the clock_gettime sybmol is available in external lib -lrt. Let's avoid double-checking for the function twice, and simply define HAVE_CLOCK_GETTIME when AC_SEARCH_LIBS succeeds (the success action is guaranteed to be called even if there's no extra lib required). Change-Id: Iced1e0542cee6beb9f08f5299aad49fab142cfb4 --- configure.ac | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 352648b0..cba0a419 100644 --- a/configure.ac +++ b/configure.ac @@ -77,7 +77,9 @@ AC_SUBST(BACKTRACE_LIB) AX_PTHREAD # check for old glibc < 2.17 to get clock_gettime -AC_SEARCH_LIBS([clock_gettime], [rt posix4], [LIBRARY_RT="$LIBS";LIBS=""]) +AC_SEARCH_LIBS([clock_gettime], [rt posix4], + [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if clock_gettime is available]) + LIBRARY_RT="$LIBS";LIBS="";]) AC_SUBST(LIBRARY_RT) AC_ARG_ENABLE(doxygen, @@ -103,7 +105,7 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([char foo;])], CFLAGS="$saved_CFLAGS" AC_SUBST(SYMBOL_VISIBILITY) -AC_CHECK_FUNCS(clock_gettime localtime_r) +AC_CHECK_FUNCS(localtime_r) AC_DEFUN([CHECK_TM_INCLUDES_TM_GMTOFF], [ AC_CACHE_CHECK( -- cgit v1.2.3