0001-build-clock_gettime-might-need-librt.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 188049ac7adcabfa66e5b6a674ac28a2f7da81f3 Mon Sep 17 00:00:00 2001
  2. From: Gustavo Zacarias <gustavo@zacarias.com.ar>
  3. Date: Fri, 12 Feb 2016 11:06:58 -0300
  4. Subject: [PATCH] build: clock_gettime might need librt
  5. In older glibc versions (< 2.17) clock_gettime is in librt.
  6. Add a check for this to avoid build breakage for programs/libraries that
  7. use libbsd on such systems.
  8. Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
  9. ---
  10. Patch status: submitted upstream
  11. configure.ac | 5 +++++
  12. src/Makefile.am | 2 ++
  13. 2 files changed, 7 insertions(+)
  14. diff --git a/configure.ac b/configure.ac
  15. index d334774..1862d19 100644
  16. --- a/configure.ac
  17. +++ b/configure.ac
  18. @@ -44,6 +44,11 @@ AC_SUBST([TESTU01_LIBS])
  19. AM_CONDITIONAL([HAVE_LIBTESTU01],
  20. [test "x$ac_cv_lib_testu01_unif01_CreateExternGenBits" = "xyes"])
  21. +# In old glibc versions (< 2.17) clock_gettime() is in librt
  22. +AC_SEARCH_LIBS([clock_gettime], [rt],
  23. + [LIB_CLOCK_GETTIME="-lrt"])
  24. +AC_SUBST([LIB_CLOCK_GETTIME])
  25. +
  26. # Checks for header files.
  27. AC_CHECK_HEADERS([sys/ndir.h sys/dir.h ndir.h dirent.h])
  28. diff --git a/src/Makefile.am b/src/Makefile.am
  29. index 4649937..6b705f0 100644
  30. --- a/src/Makefile.am
  31. +++ b/src/Makefile.am
  32. @@ -52,6 +52,8 @@ hash/md5hl.c: $(srcdir)/hash/helper.c
  33. libbsd_la_DEPENDENCIES = \
  34. $(libbsd_la_included_sources) \
  35. libbsd.map
  36. +libbsd_la_LIBADD = \
  37. + $(LIB_CLOCK_GETTIME)
  38. libbsd_la_LDFLAGS = \
  39. -Wl,--version-script=$(srcdir)/libbsd.map \
  40. -version-number $(LIBBSD_ABI)
  41. --
  42. 2.4.10