]> CyberLeo.Net >> Repos - FreeBSD/releng/9.0.git/blob - contrib/bind9/config.threads.in
Copy stable/9 to releng/9.0 as part of the FreeBSD 9.0-RELEASE release
[FreeBSD/releng/9.0.git] / contrib / bind9 / config.threads.in
1 #
2 # Begin pthreads checking.
3 #
4 # First, decide whether to use multithreading or not.
5 #
6 # Enable multithreading by default on systems where it is known
7 # to work well, and where debugging of multithreaded programs
8 # is supported.
9 #
10
11 AC_MSG_CHECKING(whether to build with thread support)
12
13 case $host in
14 *-dec-osf*)
15         use_threads=true ;;
16 [*-solaris2.[0-6]])
17         # Thread signals are broken on Solaris 2.6; they are sometimes
18         # delivered to the wrong thread.
19         use_threads=false ;;
20 *-solaris*)
21         use_threads=true ;;
22 *-ibm-aix*)
23         use_threads=true ;;
24 *-hp-hpux10*)
25         use_threads=false ;;
26 *-hp-hpux11*)
27         use_threads=true ;;
28 *-sgi-irix*)
29         use_threads=true ;;
30 *-sco-sysv*uw*|*-*-sysv*UnixWare*)
31         # UnixWare
32         use_threads=false ;;
33 *-*-sysv*OpenUNIX*)
34         # UnixWare
35         use_threads=true ;;
36 *-netbsd[1234].*)
37         # NetBSD earlier than NetBSD 5.0 has poor pthreads.  Don't use it by default.
38         use_threads=false ;;
39 *-netbsd*)
40         use_threads=true ;;
41 *-openbsd*)
42         # OpenBSD users have reported that named dumps core on
43         # startup when built with threads.
44         use_threads=false ;;
45 *-freebsd*)
46         use_threads=false ;;
47 *-bsdi[234]*)
48         # Thread signals do not work reliably on some versions of BSD/OS.
49         use_threads=false ;;
50 *-bsdi5*)
51         use_threads=true ;;
52 *-linux*)
53         # Threads are disabled on Linux by default because most
54         # Linux kernels produce unusable core dumps from multithreaded
55         # programs, and because of limitations in setuid().
56         use_threads=false ;;    
57 *)
58         use_threads=false ;;
59 esac
60
61 AC_ARG_ENABLE(threads,
62         [  --enable-threads     enable multithreading])
63 case "$enable_threads" in
64         yes)
65                 use_threads=true
66                 ;;
67         no)
68                 use_threads=false
69                 ;;
70         '')
71                 # Use system-dependent default
72                 ;;
73         *)
74                 AC_MSG_ERROR([--enable-threads takes yes or no])
75                 ;;
76 esac
77
78 if $use_threads
79 then
80         AC_MSG_RESULT(yes)
81 else
82         AC_MSG_RESULT(no)       
83 fi
84
85 if $use_threads
86 then
87         #
88         # Search for / configure pthreads in a system-dependent fashion.
89         #
90         case "$host" in
91                 *-freebsd*)
92                         # We don't want to set -lpthread as that break
93                         # the ability to choose threads library at final
94                         # link time and is not valid for all architectures.
95                         
96                         PTHREAD=
97                         if test "X$GCC" = "Xyes"; then
98                                 saved_cc="$CC"
99                                 CC="$CC -pthread"
100                                 AC_MSG_CHECKING(for gcc -pthread support);
101                                 AC_TRY_LINK([#include <pthread.h>],
102                                             [printf("%x\n", pthread_create);],
103                                             PTHREAD="yes"
104                                             AC_MSG_RESULT(yes),
105                                             AC_MSG_RESULT(no))
106                                 CC="$saved_cc"
107                         fi
108                         if test "X$PTHREAD" != "Xyes"; then
109                                 AC_CHECK_LIB(pthread, pthread_create,,
110                                 AC_CHECK_LIB(thr, thread_create,,
111                                 AC_CHECK_LIB(c_r, pthread_create,,
112                                 AC_CHECK_LIB(c, pthread_create,,
113                                 AC_MSG_ERROR("could not find thread libraries")))))
114                         fi
115                         ;;
116                 *)
117                         AC_CHECK_LIB(pthread, pthread_create,,
118                                 AC_CHECK_LIB(pthread, __pthread_create,,
119                                 AC_CHECK_LIB(pthread, __pthread_create_system,,
120                                 AC_CHECK_LIB(c_r, pthread_create,,
121                                 AC_CHECK_LIB(c, pthread_create,,
122                                 AC_MSG_ERROR("could not find thread libraries"))))))
123                 ;;
124         esac
125 fi