Add check to detect clock_nanosleep() in librt

With glibc versions before 2.17, we get following build error:

  canfdtest.o: In function `millisleep':
  canfdtest.c:(.text+0x212): undefined reference to `clock_nanosleep'
  collect2: error: ld returned 1 exit status
  make[1]: *** [canfdtest] Error 1
  make[1]: *** Waiting for unfinished jobs....

glibc versions before 2.17 needs to link with -lrt for
clock_nanosleep(). This patch adds support to detect if linking with
librt is required.

This build issue is detected by Buildroot autobuilder:
http://autobuild.buildroot.net/results/0e5/0e5242376ff6aa82e89ed1172350e05009d48156/build-end.log

Signed-off-by: Rahul Bedarkar <rahul.bedarkar@imgtec.com>
pull/36/head
Rahul Bedarkar 2016-12-20 18:29:11 +05:30
parent 64edc021d2
commit 5f4785c2ac
1 changed files with 2 additions and 0 deletions

View File

@ -73,6 +73,8 @@ AC_CHECK_FUNCS([ \
strtoul \
])
# glibc versions before 2.17 needs to link with -lrt for clock_nanosleep
AC_SEARCH_LIBS([clock_nanosleep], [rt])
AC_CHECK_DECL(SO_RXQ_OVFL,,
[AC_DEFINE([SO_RXQ_OVFL], [40], [SO_RXQ_OVFL])]