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"
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"
19
echo "checking for nogroup group ... not found"
32
ngx_feature_incs="#include <poll.h>"
35
ngx_feature_test="int n, dp; struct pollfd pl;
43
if [ $ngx_found = no ]; then
48
ngx_feature="/dev/poll"
49
ngx_feature_name="NGX_HAVE_DEVPOLL"
51
ngx_feature_incs="#include <sys/devpoll.h>"
54
ngx_feature_test="int n, dp; struct dvpoll dvp;
59
n = ioctl(dp, DP_POLL, &dvp)"
62
if [ $ngx_found = yes ]; then
63
CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
64
EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
69
if test -z "$NGX_KQUEUE_CHECKED"; then
71
ngx_feature_name="NGX_HAVE_KQUEUE"
73
ngx_feature_incs="#include <sys/event.h>"
76
ngx_feature_test="int kq; kq = kqueue()"
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"
86
ngx_feature="kqueue's NOTE_LOWAT"
87
ngx_feature_name="NGX_HAVE_LOWAT_EVENT"
89
ngx_feature_incs="#include <sys/event.h>"
92
ngx_feature_test="struct kevent kev;
93
kev.fflags = NOTE_LOWAT;"
97
ngx_feature="kqueue's EVFILT_TIMER"
98
ngx_feature_name="NGX_HAVE_TIMER_EVENT"
100
ngx_feature_incs="#include <sys/event.h>
101
#include <sys/time.h>"
104
ngx_feature_test="int kq;
108
if ((kq = kqueue()) == -1) return 1;
111
kev.filter = EVFILT_TIMER;
112
kev.flags = EV_ADD|EV_ENABLE;
120
if (kevent(kq, &kev, 1, &kev, 1, &ts) == -1) return 1;
122
if (kev.flags & EV_ERROR) return 1;"
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
140
cat << END >> $NGX_AUTO_CONFIG_H
142
#define NGX_KQUEUE_UDATA_T (void *)
149
ngx_feature="crypt()"
155
ngx_feature_test="crypt(\"test\", \"salt\");"
159
if [ $ngx_found = no ]; then
161
ngx_feature="crypt() in libcrypt"
166
ngx_feature_libs=-lcrypt
169
if [ $ngx_found = yes ]; then
175
ngx_feature="F_READAHEAD"
176
ngx_feature_name="NGX_HAVE_F_READAHEAD"
178
ngx_feature_incs="#include <fcntl.h>"
181
ngx_feature_test="fcntl(0, F_READAHEAD, 1);"
185
ngx_feature="posix_fadvise()"
186
ngx_feature_name="NGX_HAVE_POSIX_FADVISE"
188
ngx_feature_incs="#include <fcntl.h>"
191
ngx_feature_test="posix_fadvise(0, 0, 0, POSIX_FADV_SEQUENTIAL);"
195
ngx_feature="O_DIRECT"
196
ngx_feature_name="NGX_HAVE_O_DIRECT"
198
ngx_feature_incs="#include <fcntl.h>"
201
ngx_feature_test="fcntl(0, F_SETFL, O_DIRECT);"
205
if [ $ngx_found = yes -a "$NGX_SYSTEM" = "Linux" ]; then
206
have=NGX_HAVE_ALIGNED_DIRECTIO . auto/have
209
ngx_feature="F_NOCACHE"
210
ngx_feature_name="NGX_HAVE_F_NOCACHE"
212
ngx_feature_incs="#include <fcntl.h>"
215
ngx_feature_test="fcntl(0, F_NOCACHE, 1);"
219
ngx_feature="directio()"
220
ngx_feature_name="NGX_HAVE_DIRECTIO"
222
ngx_feature_incs="#include <sys/types.h>
223
#include <sys/fcntl.h>"
226
ngx_feature_test="directio(0, DIRECTIO_ON);"
230
ngx_feature="statfs()"
231
ngx_feature_name="NGX_HAVE_STATFS"
233
ngx_feature_incs="$NGX_INCLUDE_SYS_PARAM_H
234
$NGX_INCLUDE_SYS_MOUNT_H
235
$NGX_INCLUDE_SYS_VFS_H"
238
ngx_feature_test="struct statfs fs;
243
ngx_feature="statvfs()"
244
ngx_feature_name="NGX_HAVE_STATVFS"
246
ngx_feature_incs="#include <sys/types.h>
247
#include <sys/statvfs.h>"
250
ngx_feature_test="struct statvfs fs;
255
ngx_feature="dlopen()"
258
ngx_feature_incs="#include <dlfcn.h>"
261
ngx_feature_test="dlopen(NULL, 0)"
265
if [ $ngx_found != yes ]; then
267
ngx_feature="dlopen() in libdl"
268
ngx_feature_libs="-ldl"
271
if [ $ngx_found = yes ]; then
277
ngx_feature="sched_yield()"
278
ngx_feature_name="NGX_HAVE_SCHED_YIELD"
280
ngx_feature_incs="#include <sched.h>"
283
ngx_feature_test="sched_yield()"
287
if [ $ngx_found != yes ]; then
289
ngx_feature="sched_yield() in librt"
290
ngx_feature_libs="-lrt"
293
if [ $ngx_found = yes ]; then
294
CORE_LIBS="$CORE_LIBS -lrt"
298
ngx_feature="SO_SETFIB"
299
ngx_feature_name="NGX_HAVE_SETFIB"
301
ngx_feature_incs="#include <sys/socket.h>"
304
ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 4)"
308
if [ $NGX_FILE_AIO = YES ]; then
310
ngx_feature="kqueue AIO support"
311
ngx_feature_name="NGX_HAVE_FILE_AIO"
313
ngx_feature_incs="#include <aio.h>"
316
ngx_feature_test="int n; struct aiocb iocb;
317
iocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
321
if [ $ngx_found = yes ]; then
322
CORE_SRCS="$CORE_SRCS $FILE_AIO_SRCS"
324
elif [ $ngx_found = no ]; then
326
ngx_feature="Linux AIO support"
327
ngx_feature_name="NGX_HAVE_FILE_AIO"
329
ngx_feature_incs="#include <linux/aio_abi.h>
330
#include <sys/syscall.h>"
333
ngx_feature_test="int n = SYS_eventfd;
335
iocb.aio_lio_opcode = IOCB_CMD_PREAD;
336
iocb.aio_flags = IOCB_FLAG_RESFD;
337
iocb.aio_resfd = -1;"
340
if [ $ngx_found = yes ]; then
341
have=NGX_HAVE_EVENTFD . auto/have
342
CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS"
347
$0: no supported file AIO was found
348
Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only