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
This commit is contained in:
Pau Espin 2020-05-01 16:51:20 +02:00
parent d87d6f1778
commit 47eb4e18d0
1 changed files with 4 additions and 2 deletions

View File

@ -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(