1 AC_DEFUN([OPENAFS_PTHREAD_CHECKS],
3 AS_IF([test "x$MKAFS_OSTYPE" = OBSD],
4 [PTHREAD_LIBS="-pthread"])
5 AS_IF([test "x$MKAFS_OSTYPE" = xDFBSD],
6 [PTHREAD_LIBS="-pthread"])
7 AS_IF([test "x$PTHREAD_LIBS" = xerror],
8 [AC_CHECK_LIB([pthread], [pthread_attr_init],
9 [PTHREAD_LIBS="-lpthread"])])
10 AS_IF([test "x$PTHREAD_LIBS" = xerror],
11 [AC_CHECK_LIB([pthreads], [pthread_attr_init],
12 [PTHREAD_LIBS="-lpthreads"])])
13 AS_IF([test "x$PTHREAD_LIBS" = xerror],
14 [AC_CHECK_LIB([c_r], [pthread_attr_init],
15 [PTHREAD_LIBS="-lc_r"])])
16 AS_IF([test "x$PTHREAD_LIBS" = xerror],
17 [AC_CHECK_FUNC([pthread_attr_init], [PTHREAD_LIBS=""])])
18 AS_IF([test "x$PTHREAD_LIBS" = xerror],
19 [# pthread_attr_init is a macro under HPUX 11.0 and 11.11
20 AC_CHECK_LIB([pthread], [pthread_attr_destroy],
21 [PTHREAD_LIBS="-lpthread"])])
22 AS_IF([test "x$PTHREAD_LIBS" = xerror],
23 [AC_MSG_WARN([*** Unable to locate working posix thread library ***])])
24 AC_SUBST([PTHREAD_LIBS])
25 ]) # OPENAFS_PTHREADS_CHECKS
27 AC_DEFUN([OPENAFS_MORE_PTHREAD_CHECKS],
28 [dnl Look for "non-portable" pthreads functions.
30 LIBS="$LIBS $PTHREAD_LIBS"
35 dnl Sadly, there are three different versions of pthread_setname_np.
36 dnl Try to cater for all of them.
37 AS_IF([test "$ac_cv_func_pthread_setname_np" = "yes"],
38 [AC_MSG_CHECKING([for signature of pthread_setname_np])
42 #ifdef HAVE_PTHREAD_NP_H
43 #include <pthread_np.h>
45 [pthread_setname_np(pthread_self(), "test", (void *)0)])],
46 [AC_MSG_RESULT([three arguments])
47 pthread_setname_np_args=3],
51 #ifdef HAVE_PTHREAD_NP_H
52 #include <pthread_np.h>
54 [pthread_setname_np(pthread_self(), "test")])],
55 [AC_MSG_RESULT([two arguments])
56 pthread_setname_np_args=2],
60 #ifdef HAVE_PTHREAD_NP_H
61 #include <pthread_np.h>
63 [pthread_setname_np("test")])],
64 [AC_MSG_RESULT([one argument])
65 pthread_setname_np_args=1],
66 [pthread_setname_np_args=0])])])
68 [PTHREAD_SETNAME_NP_ARGS],
69 [$pthread_setname_np_args],
70 [Number of arguments required by pthread_setname_np() function])])
71 ]) # OPENAFS_MORE_PTHREAD_CHECKS