aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-05-01 16:51:20 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-05-01 16:51:26 +0200
commit47eb4e18d05e6b6362639a3a1454a5a354745f39 (patch)
treeaec625dc0b77a02f41e185e6669d2385cc822462
parentd87d6f177837c848381e362d3880509ba275cac8 (diff)
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
-rw-r--r--configure.ac6
1 files 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(