nginx 0.7.60
[nginx-catap.git] / auto / os / features
blob140e26b89f40bf98f08b4014765b70c99318c2b9
2 # Copyright (C) Igor Sysoev
5 NGX_USER=${NGX_USER:-nobody}
7 if [ -z "$NGX_GROUP" ]; then
8     if [ $NGX_USER = nobody ]; then
9         if grep nobody /etc/group 2>&1 >/dev/null; then
10             echo "checking for nobody group ... found"
11             NGX_GROUP=nobody
12         else
13             echo "checking for nobody group ... not found"
15             if grep nogroup /etc/group 2>&1 >/dev/null; then
16                 echo "checking for nogroup group ... found"
17                 NGX_GROUP=nogroup
18             else
19                 echo "checking for nogroup group ... not found"
20                 NGX_GROUP=nobody
21             fi
22         fi
23     else
24         NGX_GROUP=$NGX_USER
25     fi
29 ngx_feature="poll()"
30 ngx_feature_name=
31 ngx_feature_run=no
32 ngx_feature_incs="#include <poll.h>"
33 ngx_feature_path=
34 ngx_feature_libs=
35 ngx_feature_test="int  n, dp; struct pollfd  pl;
36                   dp = 0;
37                   pl.fd = 0;
38                   pl.events = 0;
39                   pl.revents = 0;
40                   n = poll(&pl, 1, 0)"
41 . auto/feature
43 if [ $ngx_found = no ]; then
44     EVENT_POLL=NONE
48 ngx_feature="/dev/poll"
49 ngx_feature_name="NGX_HAVE_DEVPOLL"
50 ngx_feature_run=no
51 ngx_feature_incs="#include <sys/devpoll.h>"
52 ngx_feature_path=
53 ngx_feature_libs=
54 ngx_feature_test="int  n, dp; struct dvpoll  dvp;
55                   dp = 0;
56                   dvp.dp_fds = NULL;
57                   dvp.dp_nfds = 0;
58                   dvp.dp_timeout = 0;
59                   n = ioctl(dp, DP_POLL, &dvp)"
60 . auto/feature
62 if [ $ngx_found = yes ]; then
63     CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
64     EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
65     EVENT_FOUND=YES
69 if test -z "$NGX_KQUEUE_CHECKED"; then
70     ngx_feature="kqueue"
71     ngx_feature_name="NGX_HAVE_KQUEUE"
72     ngx_feature_run=no
73     ngx_feature_incs="#include <sys/event.h>"
74     ngx_feature_path=
75     ngx_feature_libs=
76     ngx_feature_test="int kq; kq = kqueue()"
77     . auto/feature
79     if [ $ngx_found = yes ]; then
81         have=NGX_HAVE_CLEAR_EVENT . auto/have
82         EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
83         CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
84         EVENT_FOUND=YES
86         ngx_feature="kqueue's NOTE_LOWAT"
87         ngx_feature_name="NGX_HAVE_LOWAT_EVENT"
88         ngx_feature_run=no
89         ngx_feature_incs="#include <sys/event.h>"
90         ngx_feature_path=
91         ngx_feature_libs=
92         ngx_feature_test="struct kevent  kev;
93                           kev.fflags = NOTE_LOWAT;"
94         . auto/feature
97         ngx_feature="kqueue's EVFILT_TIMER"
98         ngx_feature_name="NGX_HAVE_TIMER_EVENT"
99         ngx_feature_run=yes
100         ngx_feature_incs="#include <sys/event.h>
101                           #include <sys/time.h>"
102         ngx_feature_path=
103         ngx_feature_libs=
104         ngx_feature_test="int      kq;
105                   struct kevent    kev;
106                   struct timespec  ts;
108                   if ((kq = kqueue()) == -1) return 1;
110                   kev.ident = 0;
111                   kev.filter = EVFILT_TIMER;
112                   kev.flags = EV_ADD|EV_ENABLE;
113                   kev.fflags = 0;
114                   kev.data = 1000;
115                   kev.udata = 0;
117                   ts.tv_sec = 0;
118                   ts.tv_nsec = 0;
120                   if (kevent(kq, &kev, 1, &kev, 1, &ts) == -1) return 1;
122                   if (kev.flags & EV_ERROR) return 1;"
124         . auto/feature
125     fi
129 if [ "$NGX_SYSTEM" = "NetBSD" ]; then
131     # NetBSD 2.0 incompatibly defines kevent.udata as "intptr_t"
133     cat << END >> $NGX_AUTO_CONFIG_H
135 #define NGX_KQUEUE_UDATA_T
139 else
140     cat << END >> $NGX_AUTO_CONFIG_H
142 #define NGX_KQUEUE_UDATA_T  (void *)
149 ngx_feature="crypt()"
150 ngx_feature_name=
151 ngx_feature_run=no
152 ngx_feature_incs=
153 ngx_feature_path=
154 ngx_feature_libs=
155 ngx_feature_test="crypt(\"test\", \"salt\");"
156 . auto/feature
159 if [ $ngx_found = no ]; then
161     ngx_feature="crypt() in libcrypt"
162     ngx_feature_name=
163     ngx_feature_run=no
164     ngx_feature_incs=
165     ngx_feature_path=
166     ngx_feature_libs=-lcrypt
167     . auto/feature
169     if [ $ngx_found = yes ]; then
170         CRYPT_LIB="-lcrypt"
171     fi
175 ngx_feature="O_DIRECT"
176 ngx_feature_name="NGX_HAVE_O_DIRECT"
177 ngx_feature_run=no
178 ngx_feature_incs="#include <fcntl.h>"
179 ngx_feature_path=
180 ngx_feature_libs=
181 ngx_feature_test="fcntl(0, F_SETFL, O_DIRECT);"
182 . auto/feature
185 if [ $ngx_found = yes -a "$NGX_SYSTEM" = "Linux" ]; then
186     have=NGX_HAVE_ALIGNED_DIRECTIO . auto/have
189 ngx_feature="F_NOCACHE"
190 ngx_feature_name="NGX_HAVE_F_NOCACHE"
191 ngx_feature_run=no
192 ngx_feature_incs="#include <fcntl.h>"
193 ngx_feature_path=
194 ngx_feature_libs=
195 ngx_feature_test="fcntl(0, F_NOCACHE, 1);"
196 . auto/feature
199 ngx_feature="directio()"
200 ngx_feature_name="NGX_HAVE_DIRECTIO"
201 ngx_feature_run=no
202 ngx_feature_incs="#include <sys/types.h>
203                   #include <sys/fcntl.h>"
204 ngx_feature_path=
205 ngx_feature_libs=
206 ngx_feature_test="directio(0, DIRECTIO_ON);"
207 . auto/feature
210 ngx_feature="statfs()"
211 ngx_feature_name="NGX_HAVE_STATFS"
212 ngx_feature_run=no
213 ngx_feature_incs="$NGX_INCLUDE_SYS_PARAM_H
214                   $NGX_INCLUDE_SYS_MOUNT_H
215                   $NGX_INCLUDE_SYS_VFS_H"
216 ngx_feature_path=
217 ngx_feature_libs=
218 ngx_feature_test="struct statfs  fs;
219                   statfs(NULL, &fs);"
220 . auto/feature
223 ngx_feature="statvfs()"
224 ngx_feature_name="NGX_HAVE_STATVFS"
225 ngx_feature_run=no
226 ngx_feature_incs="#include <sys/types.h>
227                   #include <sys/statvfs.h>"
228 ngx_feature_path=
229 ngx_feature_libs=
230 ngx_feature_test="struct statvfs  fs;
231                   statvfs(NULL, &fs);"
232 . auto/feature
235 ngx_feature="dlopen()"
236 ngx_feature_name=
237 ngx_feature_run=no
238 ngx_feature_incs="#include <dlfcn.h>"
239 ngx_feature_path=
240 ngx_feature_libs=
241 ngx_feature_test="dlopen(NULL, 0)"
242 . auto/feature
245 if [ $ngx_found != yes ]; then
247     ngx_feature="dlopen() in libdl"
248     ngx_feature_libs="-ldl"
249     . auto/feature
251     if [ $ngx_found = yes ]; then
252         NGX_LIBDL="-ldl"
253     fi
257 ngx_feature="sched_yield()"
258 ngx_feature_name="NGX_HAVE_SCHED_YIELD"
259 ngx_feature_run=no
260 ngx_feature_incs="#include <sched.h>"
261 ngx_feature_path=
262 ngx_feature_libs=
263 ngx_feature_test="sched_yield()"
264 . auto/feature
267 if [ $ngx_found != yes ]; then
269     ngx_feature="sched_yield() in librt"
270     ngx_feature_libs="-lrt"
271     . auto/feature
273     if [ $ngx_found = yes ]; then
274         CORE_LIBS="$CORE_LIBS -lrt"
275     fi