]> CyberLeo.Net >> Repos - FreeBSD/releng/9.3.git/blob - contrib/bind9/config.threads.in
Fix typo: s/ata/ichsmb/
[FreeBSD/releng/9.3.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.
38         #  Don't use it by default.
39         use_threads=false ;;
40 *-netbsd*)
41         use_threads=true ;;
42 *-openbsd*)
43         # OpenBSD users have reported that named dumps core on
44         # startup when built with threads.
45         use_threads=false ;;
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
49         # on. YMMV
50         use_threads=false ;;
51 *-freebsd*)
52         use_threads=true ;;
53 [*-bsdi[234]*])
54         # Thread signals do not work reliably on some versions of BSD/OS.
55         use_threads=false ;;
56 *-bsdi5*)
57         use_threads=true ;;
58 *-linux*)
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().
62         use_threads=false ;;    
63 *-darwin[[123456789]].*)
64         use_threads=false ;;
65 *-darwin*.*)
66         use_threads=true ;;
67 *)
68         use_threads=false ;;
69 esac
70
71 AC_ARG_ENABLE(threads,
72         [  --enable-threads        enable multithreading])
73 case "$enable_threads" in
74         yes)
75                 use_threads=true
76                 ;;
77         no)
78                 use_threads=false
79                 ;;
80         '')
81                 # Use system-dependent default
82                 ;;
83         *)
84                 AC_MSG_ERROR([--enable-threads takes yes or no])
85                 ;;
86 esac
87
88 if $use_threads
89 then
90         AC_MSG_RESULT(yes)
91 else
92         AC_MSG_RESULT(no)       
93 fi
94
95 if $use_threads
96 then
97         #
98         # Search for / configure pthreads in a system-dependent fashion.
99         #
100         case "$host" in
101                 *-freebsd*)
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.
105                         
106                         PTHREAD=
107                         if test "X$GCC" = "Xyes"; then
108                                 saved_cc="$CC"
109                                 CC="$CC -pthread"
110                                 AC_MSG_CHECKING(for gcc -pthread support);
111                                 AC_TRY_LINK([#include <pthread.h>],
112                                             [printf("%x\n", pthread_create);],
113                                             PTHREAD="yes"
114                                             AC_MSG_RESULT(yes),
115                                             AC_MSG_RESULT(no))
116                                 CC="$saved_cc"
117                         fi
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")))))
124                         fi
125                         ;;
126                 *)
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"))))))
133                 ;;
134         esac
135 fi