2 # Begin pthreads checking.
4 # First, decide whether to use multithreading or not.
6 # Enable multithreading by default on systems where it is known
7 # to work well, and where debugging of multithreaded programs
11 AC_MSG_CHECKING(whether to build with thread support)
17 # Thread signals are broken on Solaris 2.6; they are sometimes
18 # delivered to the wrong thread.
30 *-sco-sysv*uw*|*-*-sysv*UnixWare*)
37 # NetBSD earlier than NetBSD 5.0 has poor pthreads.
38 # Don't use it by default.
43 # OpenBSD users have reported that named dumps core on
44 # startup when built with threads.
46 [*-freebsd[1234567].*])
47 # Threads are broken at least up to FreeBSD 4.11.
48 # FreeBSD 5, 6 and 7 we have never officially supported threads
54 # Thread signals do not work reliably on some versions of BSD/OS.
59 # Threads are disabled on Linux by default because most
60 # Linux kernels produce unusable core dumps from multithreaded
61 # programs, and because of limitations in setuid().
63 *-darwin[[123456789]].*)
71 AC_ARG_ENABLE(threads,
72 [ --enable-threads enable multithreading])
73 case "$enable_threads" in
81 # Use system-dependent default
84 AC_MSG_ERROR([--enable-threads takes yes or no])
98 # Search for / configure pthreads in a system-dependent fashion.
102 # We don't want to set -lpthread as that break
103 # the ability to choose threads library at final
104 # link time and is not valid for all architectures.
107 if test "X$GCC" = "Xyes"; then
110 AC_MSG_CHECKING(for gcc -pthread support);
111 AC_TRY_LINK([#include <pthread.h>],
112 [printf("%x\n", pthread_create);],
118 if test "X$PTHREAD" != "Xyes"; then
119 AC_CHECK_LIB(pthread, pthread_create,,
120 AC_CHECK_LIB(thr, thread_create,,
121 AC_CHECK_LIB(c_r, pthread_create,,
122 AC_CHECK_LIB(c, pthread_create,,
123 AC_MSG_ERROR("could not find thread libraries")))))
127 AC_CHECK_LIB(pthread, pthread_create,,
128 AC_CHECK_LIB(pthread, __pthread_create,,
129 AC_CHECK_LIB(pthread, __pthread_create_system,,
130 AC_CHECK_LIB(c_r, pthread_create,,
131 AC_CHECK_LIB(c, pthread_create,,
132 AC_MSG_ERROR("could not find thread libraries"))))))