mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-14 23:28:43 +00:00
Autoconf: check whether pthread spinlock is implemented
This check is needed to build with pthreads on Android
This commit is contained in:
parent
2312622923
commit
aa5f58ce89
26
aclocal.m4
vendored
26
aclocal.m4
vendored
@ -17,8 +17,6 @@ AC_DEFUN([BIRD_CHECK_PTHREADS],
|
||||
[
|
||||
pthread_t pt;
|
||||
pthread_create(&pt, NULL, NULL, NULL);
|
||||
pthread_spinlock_t lock;
|
||||
pthread_spin_lock(&lock);
|
||||
]
|
||||
)
|
||||
],
|
||||
@ -31,6 +29,30 @@ AC_DEFUN([BIRD_CHECK_PTHREADS],
|
||||
CFLAGS="$bird_tmp_cflags"
|
||||
])
|
||||
|
||||
dnl ** Android API before version 24 doesn't implement spinlocks.
|
||||
AC_DEFUN([BIRD_CHECK_PTHREAD_SPINLOCK],
|
||||
[
|
||||
AC_CACHE_CHECK(
|
||||
[whether POSIX threads provide spinlocks],
|
||||
[bird_cv_lib_pthread_spinlock],
|
||||
[
|
||||
AC_LINK_IFELSE(
|
||||
[
|
||||
AC_LANG_PROGRAM(
|
||||
[ #include <pthread.h> ],
|
||||
[
|
||||
pthread_spinlock_t lock;
|
||||
pthread_spin_lock(&lock);
|
||||
]
|
||||
)
|
||||
],
|
||||
[bird_cv_lib_pthread_spinlock=yes],
|
||||
[bird_cv_lib_pthread_spinlock=no]
|
||||
)
|
||||
]
|
||||
)
|
||||
])
|
||||
|
||||
AC_DEFUN([BIRD_CHECK_MPLS_KERNEL],
|
||||
[
|
||||
AC_CACHE_CHECK(
|
||||
|
@ -120,7 +120,13 @@ if test "$enable_pthreads" != no ; then
|
||||
AC_DEFINE([USE_PTHREADS], [1], [Define to 1 if pthreads are enabled])
|
||||
CFLAGS="$CFLAGS -pthread"
|
||||
LDFLAGS="$LDFLAGS -pthread"
|
||||
proto_bfd=bfd
|
||||
|
||||
BIRD_CHECK_PTHREAD_SPINLOCK
|
||||
if test "$bird_cv_lib_pthread_spinlock" = yes ; then
|
||||
AC_DEFINE([USE_PTHREAD_SPINLOCK], [1], [Define to 1 if pthreads provide spinlocks])
|
||||
proto_bfd=bfd
|
||||
fi
|
||||
|
||||
elif test "$enable_pthreads" = yes ; then
|
||||
AC_MSG_ERROR([POSIX threads not available.])
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user