2 # Copyright (C) Igor Sysoev
3 # Copyright (C) Nginx, Inc.
6 have=NGX_LINUX . auto/have_headers
9 CORE_DEPS="$UNIX_DEPS $LINUX_DEPS"
10 CORE_SRCS="$UNIX_SRCS $LINUX_SRCS"
15 cc_aux_flags="$CC_AUX_FLAGS"
16 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
19 # Linux kernel version
21 version=$((`uname -r \
22 | sed -n -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/ \
23 \1*256*256+\2*256+\3/p' \
24 -e 's/^\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/\1*256*256+\2*256/p'`))
29 # enable the rt signals on Linux between 2.2.19 and 2.6.17
31 if [ \( $version -ge 131603 -a $version -lt 132626 \) -o $EVENT_RTSIG = YES ]
33 echo " + rt signals found"
34 have=NGX_HAVE_RTSIG . auto/have
35 EVENT_MODULES="$EVENT_MODULES $RTSIG_MODULE"
36 CORE_SRCS="$CORE_SRCS $RTSIG_SRCS"
41 # posix_fadvise64() had been implemented in 2.5.60
43 if [ $version -lt 132412 ]; then
44 have=NGX_HAVE_POSIX_FADVISE . auto/nohave
47 # epoll, EPOLLET version
50 ngx_feature_name="NGX_HAVE_EPOLL"
52 ngx_feature_incs="#include <sys/epoll.h>"
55 ngx_feature_test="int efd = 0;
56 struct epoll_event ee;
57 ee.events = EPOLLIN|EPOLLOUT|EPOLLET;
59 efd = epoll_create(100);
60 if (efd == -1) return 1;"
63 if [ $ngx_found = yes ]; then
64 have=NGX_HAVE_CLEAR_EVENT . auto/have
65 CORE_SRCS="$CORE_SRCS $EPOLL_SRCS"
66 EVENT_MODULES="$EVENT_MODULES $EPOLL_MODULE"
70 # EPOLLRDHUP appeared in Linux 2.6.17, glibc 2.8
72 ngx_feature="EPOLLRDHUP"
73 ngx_feature_name="NGX_HAVE_EPOLLRDHUP"
75 ngx_feature_incs="#include <sys/epoll.h>"
78 ngx_feature_test="int efd = 0, fd = 0;
79 struct epoll_event ee;
80 ee.events = EPOLLIN|EPOLLRDHUP|EPOLLET;
82 epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)"
87 # O_PATH and AT_EMPTY_PATH were introduced in 2.6.39, glibc 2.14
90 ngx_feature_name="NGX_HAVE_O_PATH"
92 ngx_feature_incs="#include <sys/types.h>
97 ngx_feature_test="int fd; struct stat sb;
98 fd = openat(AT_FDCWD, \".\", O_PATH|O_DIRECTORY|O_NOFOLLOW);
99 if (fstatat(fd, \"\", &sb, AT_EMPTY_PATH) != 0) return 1"
105 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE"
106 ngx_feature="sendfile()"
107 ngx_feature_name="NGX_HAVE_SENDFILE"
109 ngx_feature_incs="#include <sys/sendfile.h>
113 ngx_feature_test="int s = 0, fd = 1;
114 ssize_t n; off_t off = 0;
115 n = sendfile(s, fd, &off, 1);
116 if (n == -1 && errno == ENOSYS) return 1"
119 if [ $ngx_found = yes ]; then
120 CORE_SRCS="$CORE_SRCS $LINUX_SENDFILE_SRCS"
126 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
127 ngx_feature="sendfile64()"
128 ngx_feature_name="NGX_HAVE_SENDFILE64"
130 ngx_feature_incs="#include <sys/sendfile.h>
134 ngx_feature_test="int s = 0, fd = 1;
135 ssize_t n; off_t off = 0;
136 n = sendfile(s, fd, &off, 1);
137 if (n == -1 && errno == ENOSYS) return 1"
141 ngx_include="sys/prctl.h"; . auto/include
143 # prctl(PR_SET_DUMPABLE)
145 ngx_feature="prctl(PR_SET_DUMPABLE)"
146 ngx_feature_name="NGX_HAVE_PR_SET_DUMPABLE"
148 ngx_feature_incs="#include <sys/prctl.h>"
151 ngx_feature_test="if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) return 1"
155 # sched_setaffinity()
157 ngx_feature="sched_setaffinity()"
158 ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY"
160 ngx_feature_incs="#include <sched.h>"
163 ngx_feature_test="cpu_set_t mask;
165 sched_setaffinity(0, sizeof(cpu_set_t), &mask)"
171 ngx_feature="crypt_r()"
172 ngx_feature_name="NGX_HAVE_GNU_CRYPT_R"
174 ngx_feature_incs="#include <crypt.h>"
176 ngx_feature_libs=-lcrypt
177 ngx_feature_test="struct crypt_data cd;
178 crypt_r(\"key\", \"salt\", &cd);"
182 ngx_include="sys/vfs.h"; . auto/include
185 CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"