mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-02-17 14:00:30 +08:00
Add pthread_create consistency check.
This commit is contained in:
parent
fa96c5bacb
commit
70a4dd7f87
42
configure.in
42
configure.in
@ -517,9 +517,38 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
|
||||
thr_setconcurrency \
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING([if pthread_create() works])
|
||||
AC_CACHE_VAL(ol_cv_pthread_create_works,[
|
||||
AC_TRY_RUN([
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
static int g = 0;
|
||||
|
||||
static void task(void *p) {
|
||||
return g++;
|
||||
}
|
||||
|
||||
int main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
pthread_t t;
|
||||
exit(pthread_create(&t, NULL, (void *) task, NULL));
|
||||
}],
|
||||
[ol_cv_pthread_create_works=yes],
|
||||
[ol_cv_pthread_create_works=no],
|
||||
[dnl assume yes
|
||||
ol_cv_pthread_create_works=yes])])
|
||||
AC_MSG_RESULT($ol_cv_pthread_create_works)
|
||||
|
||||
if test $ol_cv_pthread_create_works = no ; then
|
||||
AC_MSG_ERROR([pthread.h and pthread_create are not compatible])
|
||||
fi
|
||||
|
||||
dnl Check if select causes an yield
|
||||
if test $ol_with_yielding_select = auto ; then
|
||||
AC_MSG_CHECKING([if select yields])
|
||||
AC_MSG_CHECKING([if select yields when using pthreads])
|
||||
AC_CACHE_VAL(ol_cv_pthread_select_yields,[
|
||||
AC_TRY_RUN([
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
@ -587,12 +616,13 @@ int main(argc, argv)
|
||||
#endif
|
||||
#endif
|
||||
exit(0);
|
||||
}
|
||||
], [ol_pthread_select_yields=yes], [ol_pthread_select_yields=no], [
|
||||
AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])
|
||||
AC_MSG_RESULT($ol_pthread_select_yields)
|
||||
}],
|
||||
[ol_cv_pthread_select_yields=yes],
|
||||
[ol_cv_pthread_select_yields=no], [
|
||||
AC_MSG_ERROR([crossing compiling: use --with-yielding_select=yes|no|manual])])])
|
||||
AC_MSG_RESULT($ol_cv_pthread_select_yields)
|
||||
|
||||
if test $ol_pthread_select_yields = yes ; then
|
||||
if test $ol_cv_pthread_select_yields = yes ; then
|
||||
ol_with_yielding_select=yes
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user