lib: Detect if pthread_condattr_setclock is available

Auto-detect if pthread_condattr_setclock is available and if
it is not allow the code to compile around the issue.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
Donald Sharp 2018-09-07 13:11:02 -04:00
parent 7b90f00cce
commit afc9534f67
2 changed files with 11 additions and 0 deletions

View file

@ -313,6 +313,13 @@ AX_PTHREAD([
AC_MSG_FAILURE([This FRR version needs pthreads]) AC_MSG_FAILURE([This FRR version needs pthreads])
]) ])
AC_SEARCH_LIBS([pthread_condattr_setclock], [],
[frr_cv_pthread_condattr_setclock=yes],
[frr_cv_pthread_condattr_setclock=no])
if test "$frr_cv_pthread_condattr_setclock" = yes; then
AC_DEFINE(HAVE_PTHREAD_CONDATTR_SETCLOCK, 1, [Have pthread.h pthread_condattr_setclock])
fi
dnl -------------- dnl --------------
dnl Check programs dnl Check programs
dnl -------------- dnl --------------

View file

@ -234,4 +234,8 @@ void frr_pthread_yield(void);
*/ */
uint32_t frr_pthread_get_id(void); uint32_t frr_pthread_get_id(void);
#ifndef HAVE_PTHREAD_CONDATTR_SETCLOCK
#define pthread_condattr_setclock(A, B)
#endif
#endif /* _FRR_PTHREAD_H */ #endif /* _FRR_PTHREAD_H */