venus: Remove dedebug
[openafs.git] / src / cf / pthread.m4
1 AC_DEFUN([OPENAFS_PTHREAD_CHECKS],
2 [PTHREAD_LIBS=error
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
26
27 AC_DEFUN([OPENAFS_MORE_PTHREAD_CHECKS],
28 [dnl Look for "non-portable" pthreads functions.
29 save_LIBS="$LIBS"
30 LIBS="$LIBS $PTHREAD_LIBS"
31 AC_CHECK_FUNCS([ \
32   pthread_set_name_np \
33   pthread_setname_np \
34 ])
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])
39   AC_COMPILE_IFELSE(
40     [AC_LANG_PROGRAM(
41       [#include <pthread.h>
42        #ifdef HAVE_PTHREAD_NP_H
43        #include <pthread_np.h>
44        #endif],
45       [pthread_setname_np(pthread_self(), "test", (void *)0)])],
46     [AC_MSG_RESULT([three arguments])
47      pthread_setname_np_args=3],
48     [AC_COMPILE_IFELSE(
49       [AC_LANG_PROGRAM(
50         [#include <pthread.h>
51          #ifdef HAVE_PTHREAD_NP_H
52          #include <pthread_np.h>
53          #endif],
54         [pthread_setname_np(pthread_self(), "test")])],
55       [AC_MSG_RESULT([two arguments])
56        pthread_setname_np_args=2],
57       [AC_COMPILE_IFELSE(
58         [AC_LANG_PROGRAM(
59           [#include <pthread.h>
60            #ifdef HAVE_PTHREAD_NP_H
61            #include <pthread_np.h>
62            #endif],
63           [pthread_setname_np("test")])],
64           [AC_MSG_RESULT([one argument])
65            pthread_setname_np_args=1],
66           [pthread_setname_np_args=0])])])
67   AC_DEFINE_UNQUOTED(
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