Commit b7ce33cf authored by Guillem Jover's avatar Guillem Jover

build: Support clock_gettime() provided in librt

In older glibc versions (< 2.17) clock_gettime() is in librt. Add a
check for this to avoid build breakage for programs/libraries that
use libbsd on such systems.
Based-on-patch-by: 's avatarGustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Guillem Jover's avatarGuillem Jover <guillem@hadrons.org>
parent ed84bec5
......@@ -44,6 +44,16 @@ AC_SUBST([TESTU01_LIBS])
AM_CONDITIONAL([HAVE_LIBTESTU01],
[test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
# In old glibc versions (< 2.17) clock_gettime() is in librt.
AS_CASE([$host_os],
[*-gnu], [
saved_LIBS="$LIBS"
AC_SEARCH_LIBS([clock_gettime], [rt], [CLOCK_GETTIME_LIBS="-lrt"])
AC_SUBST([CLOCK_GETTIME_LIBS])
LIBS="$saved_LIBS"
]
)
# Checks for header files.
AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h])
......
......@@ -52,6 +52,8 @@ hash/md5hl.c: $(srcdir)/hash/helper.c
libbsd_la_DEPENDENCIES = \
$(libbsd_la_included_sources) \
libbsd.map
libbsd_la_LIBADD = \
$(CLOCK_GETTIME_LIBS)
libbsd_la_LDFLAGS = \
-Wl,--version-script=$(srcdir)/libbsd.map \
-version-number $(LIBBSD_ABI)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment