From: Donald Sharp Date: Fri, 7 Sep 2018 17:11:02 +0000 (-0400) Subject: lib: Detect if pthread_condattr_setclock is available X-Git-Tag: frr-7.1-dev~385^2~2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=afc9534f6727f9298da4881d2e1c8279f6ca315f;p=mirror%2Ffrr.git 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 --- diff --git a/configure.ac b/configure.ac index 09a6f364fb..f1ffd43f5b 100755 --- a/configure.ac +++ b/configure.ac @@ -313,6 +313,13 @@ AX_PTHREAD([ 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 Check programs dnl -------------- diff --git a/lib/frr_pthread.h b/lib/frr_pthread.h index cc4fc74337..732e2925fe 100644 --- a/lib/frr_pthread.h +++ b/lib/frr_pthread.h @@ -234,4 +234,8 @@ void frr_pthread_yield(void); */ uint32_t frr_pthread_get_id(void); +#ifndef HAVE_PTHREAD_CONDATTR_SETCLOCK +#define pthread_condattr_setclock(A, B) +#endif + #endif /* _FRR_PTHREAD_H */