etc/services - sync with NetBSD-8
[minix.git] / external / bsd / bind / dist / config.threads.in
blob30cf7cda523475e2e1e5924c65cd65e3ea05d3d9
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
8 # is supported.
11 AC_MSG_CHECKING(whether to build with thread support)
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         use_threads=true ;;     
60 *-darwin[[123456789]].*)
61         use_threads=false ;;
62 *-darwin*.*)
63         use_threads=true ;;
65         use_threads=true ;;
66 esac
68 AC_ARG_ENABLE(threads,
69         [  --enable-threads        enable multithreading])
70 case "$enable_threads" in
71         yes)
72                 use_threads=true
73                 ;;
74         no)
75                 use_threads=false
76                 ;;
77         '')
78                 # Use system-dependent default
79                 ;;
80         *)
81                 AC_MSG_ERROR([--enable-threads takes yes or no])
82                 ;;
83 esac
85 if $use_threads
86 then
87         AC_MSG_RESULT(yes)
88 else
89         AC_MSG_RESULT(no)       
92 if $use_threads
93 then
94         #
95         # Search for / configure pthreads in a system-dependent fashion.
96         #
97         case "$host" in
98                 *-freebsd*)
99                         # We don't want to set -lpthread as that break
100                         # the ability to choose threads library at final
101                         # link time and is not valid for all architectures.
102                         
103                         PTHREAD=
104                         if test "X$GCC" = "Xyes"; then
105                                 saved_cc="$CC"
106                                 CC="$CC -pthread"
107                                 AC_MSG_CHECKING(for gcc -pthread support);
108                                 AC_TRY_LINK([#include <pthread.h>],
109                                             [printf("%x\n", pthread_create);],
110                                             PTHREAD="yes"
111                                             AC_MSG_RESULT(yes),
112                                             AC_MSG_RESULT(no))
113                                 CC="$saved_cc"
114                         fi
115                         if test "X$PTHREAD" != "Xyes"; then
116                                 AC_CHECK_LIB(pthread, pthread_create,,
117                                 AC_CHECK_LIB(thr, thread_create,,
118                                 AC_CHECK_LIB(c_r, pthread_create,,
119                                 AC_CHECK_LIB(c, pthread_create,,
120                                 AC_MSG_ERROR("could not find thread libraries")))))
121                         fi
122                         ;;
123                 *)
124                         AC_CHECK_LIB(pthread, pthread_create,,
125                                 AC_CHECK_LIB(pthread, __pthread_create,,
126                                 AC_CHECK_LIB(pthread, __pthread_create_system,,
127                                 AC_CHECK_LIB(c_r, pthread_create,,
128                                 AC_CHECK_LIB(c, pthread_create,,
129                                 AC_MSG_ERROR("could not find thread libraries"))))))
130                 ;;
131         esac