1 AC_DEFUN([OPENAFS_PTHREAD_CHECKS],[
3 if test "x$MKAFS_OSTYPE" = OBSD; then
4 PTHREAD_LIBS="-pthread"
6 if test "x$MKAFS_OSTYPE" = xDFBSD; then
7 PTHREAD_LIBS="-pthread"
9 if test "x$PTHREAD_LIBS" = xerror; then
10 AC_CHECK_LIB(pthread, pthread_attr_init,
11 PTHREAD_LIBS="-lpthread")
13 if test "x$PTHREAD_LIBS" = xerror; then
14 AC_CHECK_LIB(pthreads, pthread_attr_init,
15 PTHREAD_LIBS="-lpthreads")
17 if test "x$PTHREAD_LIBS" = xerror; then
18 AC_CHECK_LIB(c_r, pthread_attr_init,
21 if test "x$PTHREAD_LIBS" = xerror; then
22 AC_CHECK_FUNC(pthread_attr_init, PTHREAD_LIBS="")
24 if test "x$PTHREAD_LIBS" = xerror; then
25 # pthread_attr_init is a macro under HPUX 11.0 and 11.11
26 AC_CHECK_LIB(pthread, pthread_attr_destroy,
27 PTHREAD_LIBS="-lpthread")
29 if test "x$PTHREAD_LIBS" = xerror; then
30 AC_MSG_WARN(*** Unable to locate working posix thread library ***)
32 AC_SUBST(PTHREAD_LIBS)
35 AC_DEFUN([OPENAFS_MORE_PTHREAD_CHECKS],[
36 dnl Look for "non-portable" pthreads functions.
38 LIBS="$LIBS $PTHREAD_LIBS"
44 dnl Sadly, there are three different versions of pthread_setname_np.
45 dnl Try to cater for all of them.
46 if test "$ac_cv_func_pthread_setname_np" = "yes" ; then
47 AC_MSG_CHECKING([for signature of pthread_setname_np])
50 #ifdef HAVE_PTHREAD_NP_H
51 #include <pthread_np.h>
53 ], [pthread_setname_np(pthread_self(), "test", (void *)0)], [
54 AC_MSG_RESULT([three arguments])
55 pthread_setname_np_args=3], [
58 #ifdef HAVE_PTHREAD_NP_H
59 #include <pthread_np.h>
61 ], [pthread_setname_np(pthread_self(), "test")], [
62 AC_MSG_RESULT([two arguments])
63 pthread_setname_np_args=2], [
66 #ifdef HAVE_PTHREAD_NP_H
67 #include <pthread_np.h>
69 ], [pthread_setname_np("test")], [
70 AC_MSG_RESULT([one argument])
71 pthread_setname_np_args=1], [pthread_setname_np_args=0])
74 AC_DEFINE_UNQUOTED([PTHREAD_SETNAME_NP_ARGS], $pthread_setname_np_args, [Number of arguments required by pthread_setname_np() function])