Change in libosmocore[master]: configure.ac: Fix HAVE_CLOCK_GETTIME undef when func in -lrt

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Fri May 1 14:56:00 UTC 2020


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/17993 )


Change subject: configure.ac: Fix HAVE_CLOCK_GETTIME undef when func in -lrt
......................................................................

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
---
M configure.ac
1 file changed, 4 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/93/17993/1

diff --git a/configure.ac b/configure.ac
index 352648b..cba0a41 100644
--- a/configure.ac
+++ b/configure.ac
@@ -77,7 +77,9 @@
 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 @@
 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(

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/17993
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: Iced1e0542cee6beb9f08f5299aad49fab142cfb4
Gerrit-Change-Number: 17993
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200501/6f9869cd/attachment.htm>


More information about the gerrit-log mailing list