Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.13.12 ]​[ nginx-1.12.2 ]​

0001 
0002 # Copyright (C) Igor Sysoev
0003 # Copyright (C) Nginx, Inc.
0004 
0005 
0006 NGX_USER=${NGX_USER:-nobody}
0007 
0008 if [ -z "$NGX_GROUP" ]; then
0009     if [ $NGX_USER = nobody ]; then
0010         if grep nobody /etc/group 2>&1 >/dev/null; then
0011             echo "checking for nobody group ... found"
0012             NGX_GROUP=nobody
0013         else
0014             echo "checking for nobody group ... not found"
0015 
0016             if grep nogroup /etc/group 2>&1 >/dev/null; then
0017                 echo "checking for nogroup group ... found"
0018                 NGX_GROUP=nogroup
0019             else
0020                 echo "checking for nogroup group ... not found"
0021                 NGX_GROUP=nobody
0022             fi
0023         fi
0024     else
0025         NGX_GROUP=$NGX_USER
0026     fi
0027 fi
0028 
0029 
0030 ngx_feature="poll()"
0031 ngx_feature_name=
0032 ngx_feature_run=no
0033 ngx_feature_incs="#include <poll.h>"
0034 ngx_feature_path=
0035 ngx_feature_libs=
0036 ngx_feature_test="int  n; struct pollfd  pl;
0037                   pl.fd = 0;
0038                   pl.events = 0;
0039                   pl.revents = 0;
0040                   n = poll(&pl, 1, 0);
0041                   if (n == -1) return 1"
0042 . auto/feature
0043 
0044 if [ $ngx_found = no ]; then
0045     EVENT_POLL=NONE
0046 fi
0047 
0048 
0049 ngx_feature="/dev/poll"
0050 ngx_feature_name="NGX_HAVE_DEVPOLL"
0051 ngx_feature_run=no
0052 ngx_feature_incs="#include <sys/devpoll.h>"
0053 ngx_feature_path=
0054 ngx_feature_libs=
0055 ngx_feature_test="int  n, dp; struct dvpoll  dvp;
0056                   dp = 0;
0057                   dvp.dp_fds = NULL;
0058                   dvp.dp_nfds = 0;
0059                   dvp.dp_timeout = 0;
0060                   n = ioctl(dp, DP_POLL, &dvp);
0061                   if (n == -1) return 1"
0062 . auto/feature
0063 
0064 if [ $ngx_found = yes ]; then
0065     CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
0066     EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
0067     EVENT_FOUND=YES
0068 fi
0069 
0070 
0071 if test -z "$NGX_KQUEUE_CHECKED"; then
0072     ngx_feature="kqueue"
0073     ngx_feature_name="NGX_HAVE_KQUEUE"
0074     ngx_feature_run=no
0075     ngx_feature_incs="#include <sys/event.h>"
0076     ngx_feature_path=
0077     ngx_feature_libs=
0078     ngx_feature_test="(void) kqueue()"
0079     . auto/feature
0080 
0081     if [ $ngx_found = yes ]; then
0082 
0083         have=NGX_HAVE_CLEAR_EVENT . auto/have
0084         EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
0085         CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
0086         EVENT_FOUND=YES
0087 
0088         ngx_feature="kqueue's NOTE_LOWAT"
0089         ngx_feature_name="NGX_HAVE_LOWAT_EVENT"
0090         ngx_feature_run=no
0091         ngx_feature_incs="#include <sys/event.h>"
0092         ngx_feature_path=
0093         ngx_feature_libs=
0094         ngx_feature_test="struct kevent  kev;
0095                           kev.fflags = NOTE_LOWAT;
0096                           (void) kev"
0097         . auto/feature
0098 
0099 
0100         ngx_feature="kqueue's EVFILT_TIMER"
0101         ngx_feature_name="NGX_HAVE_TIMER_EVENT"
0102         ngx_feature_run=yes
0103         ngx_feature_incs="#include <sys/event.h>
0104                           #include <sys/time.h>"
0105         ngx_feature_path=
0106         ngx_feature_libs=
0107         ngx_feature_test="int      kq;
0108                   struct kevent    kev;
0109                   struct timespec  ts;
0110 
0111                   if ((kq = kqueue()) == -1) return 1;
0112 
0113                   kev.ident = 0;
0114                   kev.filter = EVFILT_TIMER;
0115                   kev.flags = EV_ADD|EV_ENABLE;
0116                   kev.fflags = 0;
0117                   kev.data = 1000;
0118                   kev.udata = 0;
0119 
0120                   ts.tv_sec = 0;
0121                   ts.tv_nsec = 0;
0122 
0123                   if (kevent(kq, &kev, 1, &kev, 1, &ts) == -1) return 1;
0124 
0125                   if (kev.flags & EV_ERROR) return 1;"
0126 
0127         . auto/feature
0128     fi
0129 fi
0130 
0131 
0132 if [ "$NGX_SYSTEM" = "NetBSD" ]; then
0133 
0134     # NetBSD 2.0 incompatibly defines kevent.udata as "intptr_t"
0135 
0136     cat << END >> $NGX_AUTO_CONFIG_H
0137 
0138 #define NGX_KQUEUE_UDATA_T
0139 
0140 END
0141 
0142 else
0143     cat << END >> $NGX_AUTO_CONFIG_H
0144 
0145 #define NGX_KQUEUE_UDATA_T  (void *)
0146 
0147 END
0148 
0149 fi
0150 
0151 
0152 ngx_feature="crypt()"
0153 ngx_feature_name=
0154 ngx_feature_run=no
0155 ngx_feature_incs=
0156 ngx_feature_path=
0157 ngx_feature_libs=
0158 ngx_feature_test="crypt(\"test\", \"salt\");"
0159 . auto/feature
0160 
0161 
0162 if [ $ngx_found = no ]; then
0163 
0164     ngx_feature="crypt() in libcrypt"
0165     ngx_feature_name=
0166     ngx_feature_run=no
0167     ngx_feature_incs=
0168     ngx_feature_path=
0169     ngx_feature_libs=-lcrypt
0170     . auto/feature
0171 
0172     if [ $ngx_found = yes ]; then
0173         CRYPT_LIB="-lcrypt"
0174     fi
0175 fi
0176 
0177 
0178 ngx_feature="F_READAHEAD"
0179 ngx_feature_name="NGX_HAVE_F_READAHEAD"
0180 ngx_feature_run=no
0181 ngx_feature_incs="#include <fcntl.h>"
0182 ngx_feature_path=
0183 ngx_feature_libs=
0184 ngx_feature_test="fcntl(0, F_READAHEAD, 1);"
0185 . auto/feature
0186 
0187 
0188 ngx_feature="posix_fadvise()"
0189 ngx_feature_name="NGX_HAVE_POSIX_FADVISE"
0190 ngx_feature_run=no
0191 ngx_feature_incs="#include <fcntl.h>"
0192 ngx_feature_path=
0193 ngx_feature_libs=
0194 ngx_feature_test="posix_fadvise(0, 0, 0, POSIX_FADV_SEQUENTIAL);"
0195 . auto/feature
0196 
0197 
0198 ngx_feature="O_DIRECT"
0199 ngx_feature_name="NGX_HAVE_O_DIRECT"
0200 ngx_feature_run=no
0201 ngx_feature_incs="#include <fcntl.h>"
0202 ngx_feature_path=
0203 ngx_feature_libs=
0204 ngx_feature_test="fcntl(0, F_SETFL, O_DIRECT);"
0205 . auto/feature
0206 
0207 
0208 if [ $ngx_found = yes -a "$NGX_SYSTEM" = "Linux" ]; then
0209     have=NGX_HAVE_ALIGNED_DIRECTIO . auto/have
0210 fi
0211 
0212 ngx_feature="F_NOCACHE"
0213 ngx_feature_name="NGX_HAVE_F_NOCACHE"
0214 ngx_feature_run=no
0215 ngx_feature_incs="#include <fcntl.h>"
0216 ngx_feature_path=
0217 ngx_feature_libs=
0218 ngx_feature_test="fcntl(0, F_NOCACHE, 1);"
0219 . auto/feature
0220 
0221 
0222 ngx_feature="directio()"
0223 ngx_feature_name="NGX_HAVE_DIRECTIO"
0224 ngx_feature_run=no
0225 ngx_feature_incs="#include <sys/types.h>
0226                   #include <sys/fcntl.h>"
0227 ngx_feature_path=
0228 ngx_feature_libs=
0229 ngx_feature_test="directio(0, DIRECTIO_ON);"
0230 . auto/feature
0231 
0232 
0233 ngx_feature="statfs()"
0234 ngx_feature_name="NGX_HAVE_STATFS"
0235 ngx_feature_run=no
0236 ngx_feature_incs="$NGX_INCLUDE_SYS_PARAM_H
0237                   $NGX_INCLUDE_SYS_MOUNT_H
0238                   $NGX_INCLUDE_SYS_VFS_H"
0239 ngx_feature_path=
0240 ngx_feature_libs=
0241 ngx_feature_test="struct statfs  fs;
0242                   statfs(\".\", &fs);"
0243 . auto/feature
0244 
0245 
0246 ngx_feature="statvfs()"
0247 ngx_feature_name="NGX_HAVE_STATVFS"
0248 ngx_feature_run=no
0249 ngx_feature_incs="#include <sys/types.h>
0250                   #include <sys/statvfs.h>"
0251 ngx_feature_path=
0252 ngx_feature_libs=
0253 ngx_feature_test="struct statvfs  fs;
0254                   statvfs(\".\", &fs);"
0255 . auto/feature
0256 
0257 
0258 ngx_feature="dlopen()"
0259 ngx_feature_name="NGX_HAVE_DLOPEN"
0260 ngx_feature_run=no
0261 ngx_feature_incs="#include <dlfcn.h>"
0262 ngx_feature_path=
0263 ngx_feature_libs=
0264 ngx_feature_test="dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, \"\")"
0265 . auto/feature
0266 
0267 
0268 if [ $ngx_found = no ]; then
0269 
0270     ngx_feature="dlopen() in libdl"
0271     ngx_feature_libs="-ldl"
0272     . auto/feature
0273 
0274     if [ $ngx_found = yes ]; then
0275         CORE_LIBS="$CORE_LIBS -ldl"
0276         NGX_LIBDL="-ldl"
0277     fi
0278 fi
0279 
0280 
0281 ngx_feature="sched_yield()"
0282 ngx_feature_name="NGX_HAVE_SCHED_YIELD"
0283 ngx_feature_run=no
0284 ngx_feature_incs="#include <sched.h>"
0285 ngx_feature_path=
0286 ngx_feature_libs=
0287 ngx_feature_test="sched_yield()"
0288 . auto/feature
0289 
0290 
0291 if [ $ngx_found = no ]; then
0292 
0293     ngx_feature="sched_yield() in librt"
0294     ngx_feature_libs="-lrt"
0295     . auto/feature
0296 
0297     if [ $ngx_found = yes ]; then
0298         CORE_LIBS="$CORE_LIBS -lrt"
0299     fi
0300 fi
0301 
0302 
0303 ngx_feature="sched_setaffinity()"
0304 ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY"
0305 ngx_feature_run=no
0306 ngx_feature_incs="#include <sched.h>"
0307 ngx_feature_path=
0308 ngx_feature_libs=
0309 ngx_feature_test="cpu_set_t mask;
0310                   CPU_ZERO(&mask);
0311                   sched_setaffinity(0, sizeof(cpu_set_t), &mask)"
0312 . auto/feature
0313 
0314 
0315 ngx_feature="SO_SETFIB"
0316 ngx_feature_name="NGX_HAVE_SETFIB"
0317 ngx_feature_run=no
0318 ngx_feature_incs="#include <sys/socket.h>"
0319 ngx_feature_path=
0320 ngx_feature_libs=
0321 ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 0)"
0322 . auto/feature
0323 
0324 
0325 ngx_feature="SO_REUSEPORT"
0326 ngx_feature_name="NGX_HAVE_REUSEPORT"
0327 ngx_feature_run=no
0328 ngx_feature_incs="#include <sys/socket.h>"
0329 ngx_feature_path=
0330 ngx_feature_libs=
0331 ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_REUSEPORT, NULL, 0)"
0332 . auto/feature
0333 
0334 
0335 ngx_feature="SO_ACCEPTFILTER"
0336 ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT"
0337 ngx_feature_run=no
0338 ngx_feature_incs="#include <sys/socket.h>"
0339 ngx_feature_path=
0340 ngx_feature_libs=
0341 ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)"
0342 . auto/feature
0343 
0344 
0345 # OpenBSD bind to any address for transparent proxying
0346 
0347 ngx_feature="SO_BINDANY"
0348 ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
0349 ngx_feature_run=no
0350 ngx_feature_incs="#include <sys/socket.h>"
0351 ngx_feature_path=
0352 ngx_feature_libs=
0353 ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_BINDANY, NULL, 0)"
0354 . auto/feature
0355 
0356 
0357 # Linux transparent proxying
0358 
0359 ngx_feature="IP_TRANSPARENT"
0360 ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
0361 ngx_feature_run=no
0362 ngx_feature_incs="#include <sys/socket.h>
0363                   #include <netinet/in.h>"
0364 ngx_feature_path=
0365 ngx_feature_libs=
0366 ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_TRANSPARENT, NULL, 0)"
0367 . auto/feature
0368 
0369 
0370 # FreeBSD bind to any address for transparent proxying
0371 
0372 ngx_feature="IP_BINDANY"
0373 ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
0374 ngx_feature_run=no
0375 ngx_feature_incs="#include <sys/socket.h>
0376                   #include <netinet/in.h>"
0377 ngx_feature_path=
0378 ngx_feature_libs=
0379 ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_BINDANY, NULL, 0)"
0380 . auto/feature
0381 
0382 
0383 # Linux IP_BIND_ADDRESS_NO_PORT
0384 
0385 ngx_feature="IP_BIND_ADDRESS_NO_PORT"
0386 ngx_feature_name="NGX_HAVE_IP_BIND_ADDRESS_NO_PORT"
0387 ngx_feature_run=no
0388 ngx_feature_incs="#include <sys/socket.h>
0389                   #include <netinet/in.h>"
0390 ngx_feature_path=
0391 ngx_feature_libs=
0392 ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT, NULL, 0)"
0393 . auto/feature
0394 
0395 
0396 # BSD way to get IPv4 datagram destination address
0397 
0398 ngx_feature="IP_RECVDSTADDR"
0399 ngx_feature_name="NGX_HAVE_IP_RECVDSTADDR"
0400 ngx_feature_run=no
0401 ngx_feature_incs="#include <sys/socket.h>
0402                   #include <netinet/in.h>"
0403 ngx_feature_path=
0404 ngx_feature_libs=
0405 ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, NULL, 0)"
0406 . auto/feature
0407 
0408 
0409 # BSD way to set IPv4 datagram source address
0410 
0411 ngx_feature="IP_SENDSRCADDR"
0412 ngx_feature_name="NGX_HAVE_IP_SENDSRCADDR"
0413 ngx_feature_run=no
0414 ngx_feature_incs="#include <sys/socket.h>
0415                   #include <netinet/in.h>"
0416 ngx_feature_path=
0417 ngx_feature_libs=
0418 ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_SENDSRCADDR, NULL, 0)"
0419 . auto/feature
0420 
0421 
0422 # Linux way to get IPv4 datagram destination address
0423 
0424 ngx_feature="IP_PKTINFO"
0425 ngx_feature_name="NGX_HAVE_IP_PKTINFO"
0426 ngx_feature_run=no
0427 ngx_feature_incs="#include <sys/socket.h>
0428                   #include <netinet/in.h>"
0429 ngx_feature_path=
0430 ngx_feature_libs=
0431 ngx_feature_test="struct in_pktinfo  pkt;
0432                   pkt.ipi_spec_dst.s_addr = INADDR_ANY;
0433                   (void) pkt;
0434                   setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)"
0435 . auto/feature
0436 
0437 
0438 # RFC 3542 way to get IPv6 datagram destination address
0439 
0440 ngx_feature="IPV6_RECVPKTINFO"
0441 ngx_feature_name="NGX_HAVE_IPV6_RECVPKTINFO"
0442 ngx_feature_run=no
0443 ngx_feature_incs="#include <sys/socket.h>
0444                   #include <netinet/in.h>"
0445 ngx_feature_path=
0446 ngx_feature_libs=
0447 ngx_feature_test="setsockopt(0, IPPROTO_IPV6, IPV6_RECVPKTINFO, NULL, 0)"
0448 . auto/feature
0449 
0450 
0451 ngx_feature="TCP_DEFER_ACCEPT"
0452 ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT"
0453 ngx_feature_run=no
0454 ngx_feature_incs="#include <sys/socket.h>
0455                   #include <netinet/in.h>
0456                   #include <netinet/tcp.h>"
0457 ngx_feature_path=
0458 ngx_feature_libs=
0459 ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_DEFER_ACCEPT, NULL, 0)"
0460 . auto/feature
0461 
0462 
0463 ngx_feature="TCP_KEEPIDLE"
0464 ngx_feature_name="NGX_HAVE_KEEPALIVE_TUNABLE"
0465 ngx_feature_run=no
0466 ngx_feature_incs="#include <sys/socket.h>
0467                   #include <netinet/in.h>
0468                   #include <netinet/tcp.h>"
0469 ngx_feature_path=
0470 ngx_feature_libs=
0471 ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_KEEPIDLE, NULL, 0);
0472                   setsockopt(0, IPPROTO_TCP, TCP_KEEPINTVL, NULL, 0);
0473                   setsockopt(0, IPPROTO_TCP, TCP_KEEPCNT, NULL, 0)"
0474 . auto/feature
0475 
0476 
0477 ngx_feature="TCP_FASTOPEN"
0478 ngx_feature_name="NGX_HAVE_TCP_FASTOPEN"
0479 ngx_feature_run=no
0480 ngx_feature_incs="#include <sys/socket.h>
0481                   #include <netinet/in.h>
0482                   #include <netinet/tcp.h>"
0483 ngx_feature_path=
0484 ngx_feature_libs=
0485 ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_FASTOPEN, NULL, 0)"
0486 . auto/feature
0487 
0488 
0489 ngx_feature="TCP_INFO"
0490 ngx_feature_name="NGX_HAVE_TCP_INFO"
0491 ngx_feature_run=no
0492 ngx_feature_incs="#include <sys/socket.h>
0493                   #include <netinet/in.h>
0494                   #include <netinet/tcp.h>"
0495 ngx_feature_path=
0496 ngx_feature_libs=
0497 ngx_feature_test="socklen_t optlen = sizeof(struct tcp_info);
0498                   struct tcp_info ti;
0499                   ti.tcpi_rtt = 0;
0500                   ti.tcpi_rttvar = 0;
0501                   ti.tcpi_snd_cwnd = 0;
0502                   ti.tcpi_rcv_space = 0;
0503                   getsockopt(0, IPPROTO_TCP, TCP_INFO, &ti, &optlen)"
0504 . auto/feature
0505 
0506 
0507 ngx_feature="accept4()"
0508 ngx_feature_name="NGX_HAVE_ACCEPT4"
0509 ngx_feature_run=no
0510 ngx_feature_incs="#include <sys/socket.h>"
0511 ngx_feature_path=
0512 ngx_feature_libs=
0513 ngx_feature_test="accept4(0, NULL, NULL, SOCK_NONBLOCK)"
0514 . auto/feature
0515 
0516 if [ $NGX_FILE_AIO = YES ]; then
0517 
0518     ngx_feature="kqueue AIO support"
0519     ngx_feature_name="NGX_HAVE_FILE_AIO"
0520     ngx_feature_run=no
0521     ngx_feature_incs="#include <aio.h>"
0522     ngx_feature_path=
0523     ngx_feature_libs=
0524     ngx_feature_test="struct aiocb  iocb;
0525                       iocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
0526                       (void) aio_read(&iocb)"
0527     . auto/feature
0528 
0529     if [ $ngx_found = yes ]; then
0530         CORE_SRCS="$CORE_SRCS $FILE_AIO_SRCS"
0531     fi
0532 
0533     if [ $ngx_found = no ]; then
0534 
0535         ngx_feature="Linux AIO support"
0536         ngx_feature_name="NGX_HAVE_FILE_AIO"
0537         ngx_feature_run=no
0538         ngx_feature_incs="#include <linux/aio_abi.h>
0539                           #include <sys/eventfd.h>"
0540         ngx_feature_path=
0541         ngx_feature_libs=
0542         ngx_feature_test="struct iocb  iocb;
0543                           iocb.aio_lio_opcode = IOCB_CMD_PREAD;
0544                           iocb.aio_flags = IOCB_FLAG_RESFD;
0545                           iocb.aio_resfd = -1;
0546                           (void) iocb;
0547                           (void) eventfd(0, 0)"
0548         . auto/feature
0549 
0550         if [ $ngx_found = yes ]; then
0551             have=NGX_HAVE_EVENTFD . auto/have
0552             have=NGX_HAVE_SYS_EVENTFD_H . auto/have
0553             CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS"
0554         fi
0555     fi
0556 
0557     if [ $ngx_found = no ]; then
0558 
0559         ngx_feature="Linux AIO support (SYS_eventfd)"
0560         ngx_feature_incs="#include <linux/aio_abi.h>
0561                           #include <sys/syscall.h>"
0562         ngx_feature_test="struct iocb  iocb;
0563                           iocb.aio_lio_opcode = IOCB_CMD_PREAD;
0564                           iocb.aio_flags = IOCB_FLAG_RESFD;
0565                           iocb.aio_resfd = -1;
0566                           (void) iocb;
0567                           (void) SYS_eventfd"
0568         . auto/feature
0569 
0570         if [ $ngx_found = yes ]; then
0571             have=NGX_HAVE_EVENTFD . auto/have
0572             CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS"
0573         fi
0574     fi
0575 
0576     if [ $ngx_found = no ]; then
0577         cat << END
0578 
0579 $0: no supported file AIO was found
0580 Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only
0581 
0582 END
0583         exit 1
0584     fi
0585 
0586 else
0587 
0588     ngx_feature="eventfd()"
0589     ngx_feature_name="NGX_HAVE_EVENTFD"
0590     ngx_feature_run=no
0591     ngx_feature_incs="#include <sys/eventfd.h>"
0592     ngx_feature_path=
0593     ngx_feature_libs=
0594     ngx_feature_test="(void) eventfd(0, 0)"
0595     . auto/feature
0596 
0597     if [ $ngx_found = yes ]; then
0598         have=NGX_HAVE_SYS_EVENTFD_H . auto/have
0599     fi
0600 
0601     if [ $ngx_found = no ]; then
0602 
0603         ngx_feature="eventfd() (SYS_eventfd)"
0604         ngx_feature_incs="#include <sys/syscall.h>"
0605         ngx_feature_test="(void) SYS_eventfd"
0606         . auto/feature
0607     fi
0608 fi
0609 
0610 
0611 have=NGX_HAVE_UNIX_DOMAIN . auto/have
0612 
0613 ngx_feature_libs=
0614 
0615 
0616 # C types
0617 
0618 ngx_type="int"; . auto/types/sizeof
0619 
0620 ngx_type="long"; . auto/types/sizeof
0621 
0622 ngx_type="long long"; . auto/types/sizeof
0623 
0624 ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
0625 ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
0626 
0627 
0628 # POSIX types
0629 
0630 NGX_INCLUDE_AUTO_CONFIG_H="#include \"ngx_auto_config.h\""
0631 
0632 ngx_type="uint32_t"; ngx_types="u_int32_t"; . auto/types/typedef
0633 ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
0634 
0635 ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
0636 . auto/types/sizeof
0637 ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
0638 
0639 ngx_type="socklen_t"; ngx_types="int"; . auto/types/typedef
0640 
0641 ngx_type="in_addr_t"; ngx_types="uint32_t u_int32_t"; . auto/types/typedef
0642 
0643 ngx_type="in_port_t"; ngx_types="u_short"; . auto/types/typedef
0644 
0645 ngx_type="rlim_t"; ngx_types="int"; . auto/types/typedef
0646 
0647 . auto/types/uintptr_t
0648 
0649 . auto/endianness
0650 
0651 ngx_type="size_t"; . auto/types/sizeof
0652 ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
0653 ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
0654 
0655 ngx_type="off_t"; . auto/types/sizeof
0656 ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
0657 ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
0658 
0659 ngx_type="time_t"; . auto/types/sizeof
0660 ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
0661 ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
0662 ngx_param=NGX_MAX_TIME_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
0663 
0664 
0665 # syscalls, libc calls and some features
0666 
0667 
0668 ngx_feature="AF_INET6"
0669 ngx_feature_name="NGX_HAVE_INET6"
0670 ngx_feature_run=no
0671 ngx_feature_incs="#include <sys/socket.h>
0672                   #include <netinet/in.h>
0673                   #include <arpa/inet.h>"
0674 ngx_feature_path=
0675 ngx_feature_libs=
0676 ngx_feature_test="struct sockaddr_in6  sin6;
0677                   sin6.sin6_family = AF_INET6;
0678                   (void) sin6"
0679 . auto/feature
0680 
0681 
0682 ngx_feature="setproctitle()"
0683 ngx_feature_name="NGX_HAVE_SETPROCTITLE"
0684 ngx_feature_run=no
0685 ngx_feature_incs="#include <stdlib.h>"
0686 ngx_feature_path=
0687 ngx_feature_libs=$NGX_SETPROCTITLE_LIB
0688 ngx_feature_test="setproctitle(\"test\");"
0689 . auto/feature
0690 
0691 
0692 ngx_feature="pread()"
0693 ngx_feature_name="NGX_HAVE_PREAD"
0694 ngx_feature_run=no
0695 ngx_feature_incs=
0696 ngx_feature_path=
0697 ngx_feature_libs=
0698 ngx_feature_test="char buf[1]; ssize_t n; n = pread(0, buf, 1, 0);
0699                   if (n == -1) return 1"
0700 . auto/feature
0701 
0702 
0703 ngx_feature="pwrite()"
0704 ngx_feature_name="NGX_HAVE_PWRITE"
0705 ngx_feature_run=no
0706 ngx_feature_incs=
0707 ngx_feature_path=
0708 ngx_feature_libs=
0709 ngx_feature_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0);
0710                   if (n == -1) return 1"
0711 . auto/feature
0712 
0713 
0714 # pwritev() was introduced in FreeBSD 6 and Linux 2.6.30, glibc 2.10
0715 
0716 ngx_feature="pwritev()"
0717 ngx_feature_name="NGX_HAVE_PWRITEV"
0718 ngx_feature_run=no
0719 ngx_feature_incs='#include <sys/uio.h>'
0720 ngx_feature_path=
0721 ngx_feature_libs=
0722 ngx_feature_test="char buf[1]; struct iovec vec[1]; ssize_t n;
0723                   vec[0].iov_base = buf;
0724                   vec[0].iov_len = 1;
0725                   n = pwritev(1, vec, 1, 0);
0726                   if (n == -1) return 1"
0727 . auto/feature
0728 
0729 
0730 ngx_feature="sys_nerr"
0731 ngx_feature_name="NGX_SYS_NERR"
0732 ngx_feature_run=value
0733 ngx_feature_incs='#include <errno.h>
0734                   #include <stdio.h>'
0735 ngx_feature_path=
0736 ngx_feature_libs=
0737 ngx_feature_test='printf("%d", sys_nerr);'
0738 . auto/feature
0739 
0740 
0741 if [ $ngx_found = no ]; then
0742 
0743     # Cygiwn defines _sys_nerr
0744     ngx_feature="_sys_nerr"
0745     ngx_feature_name="NGX_SYS_NERR"
0746     ngx_feature_run=value
0747     ngx_feature_incs='#include <errno.h>
0748                       #include <stdio.h>'
0749     ngx_feature_path=
0750     ngx_feature_libs=
0751     ngx_feature_test='printf("%d", _sys_nerr);'
0752     . auto/feature
0753 fi
0754 
0755 
0756 if [ $ngx_found = no ]; then
0757 
0758     # Solaris has no sys_nerr
0759     ngx_feature='maximum errno'
0760     ngx_feature_name=NGX_SYS_NERR
0761     ngx_feature_run=value
0762     ngx_feature_incs='#include <errno.h>
0763                       #include <string.h>
0764                       #include <stdio.h>'
0765     ngx_feature_path=
0766     ngx_feature_libs=
0767     ngx_feature_test='int  n;
0768                       char *p;
0769                       for (n = 1; n < 1000; n++) {
0770                           errno = 0;
0771                           p = strerror(n);
0772                           if (errno == EINVAL
0773                               || p == NULL
0774                               || strncmp(p, "Unknown error", 13) == 0)
0775                           {
0776                               break;
0777                           }
0778                       }
0779                       printf("%d", n);'
0780     . auto/feature
0781 fi
0782 
0783 
0784 ngx_feature="localtime_r()"
0785 ngx_feature_name="NGX_HAVE_LOCALTIME_R"
0786 ngx_feature_run=no
0787 ngx_feature_incs="#include <time.h>"
0788 ngx_feature_path=
0789 ngx_feature_libs=
0790 ngx_feature_test="struct tm t; time_t c=0; localtime_r(&c, &t)"
0791 . auto/feature
0792 
0793 
0794 ngx_feature="clock_gettime(CLOCK_MONOTONIC)"
0795 ngx_feature_name="NGX_HAVE_CLOCK_MONOTONIC"
0796 ngx_feature_run=no
0797 ngx_feature_incs="#include <time.h>"
0798 ngx_feature_path=
0799 ngx_feature_libs=
0800 ngx_feature_test="struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts)"
0801 . auto/feature
0802 
0803 
0804 if [ $ngx_found = no ]; then
0805 
0806     # Linux before glibc 2.17, notably CentOS 6
0807 
0808     ngx_feature="clock_gettime(CLOCK_MONOTONIC) in librt"
0809     ngx_feature_libs="-lrt"
0810     . auto/feature
0811 
0812     if [ $ngx_found = yes ]; then
0813         CORE_LIBS="$CORE_LIBS -lrt"
0814     fi
0815 fi
0816 
0817 
0818 ngx_feature="posix_memalign()"
0819 ngx_feature_name="NGX_HAVE_POSIX_MEMALIGN"
0820 ngx_feature_run=no
0821 ngx_feature_incs="#include <stdlib.h>"
0822 ngx_feature_path=
0823 ngx_feature_libs=
0824 ngx_feature_test="void *p; int n; n = posix_memalign(&p, 4096, 4096);
0825                   if (n != 0) return 1"
0826 . auto/feature
0827 
0828 
0829 ngx_feature="memalign()"
0830 ngx_feature_name="NGX_HAVE_MEMALIGN"
0831 ngx_feature_run=no
0832 ngx_feature_incs="#include <stdlib.h>
0833                   #include <malloc.h>"
0834 ngx_feature_path=
0835 ngx_feature_libs=
0836 ngx_feature_test="void *p; p = memalign(4096, 4096);
0837                   if (p == NULL) return 1"
0838 . auto/feature
0839 
0840 
0841 ngx_feature="mmap(MAP_ANON|MAP_SHARED)"
0842 ngx_feature_name="NGX_HAVE_MAP_ANON"
0843 ngx_feature_run=yes
0844 ngx_feature_incs="#include <sys/mman.h>"
0845 ngx_feature_path=
0846 ngx_feature_libs=
0847 ngx_feature_test="void *p;
0848                   p = mmap(NULL, 4096, PROT_READ|PROT_WRITE,
0849                            MAP_ANON|MAP_SHARED, -1, 0);
0850                   if (p == MAP_FAILED) return 1;"
0851 . auto/feature
0852 
0853 
0854 ngx_feature='mmap("/dev/zero", MAP_SHARED)'
0855 ngx_feature_name="NGX_HAVE_MAP_DEVZERO"
0856 ngx_feature_run=yes
0857 ngx_feature_incs="#include <sys/mman.h>
0858                   #include <sys/stat.h>
0859                   #include <fcntl.h>"
0860 ngx_feature_path=
0861 ngx_feature_libs=
0862 ngx_feature_test='void *p; int  fd;
0863                   fd = open("/dev/zero", O_RDWR);
0864                   p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
0865                   if (p == MAP_FAILED) return 1;'
0866 . auto/feature
0867 
0868 
0869 ngx_feature="System V shared memory"
0870 ngx_feature_name="NGX_HAVE_SYSVSHM"
0871 ngx_feature_run=yes
0872 ngx_feature_incs="#include <sys/ipc.h>
0873                   #include <sys/shm.h>"
0874 ngx_feature_path=
0875 ngx_feature_libs=
0876 ngx_feature_test="int  id;
0877                   id = shmget(IPC_PRIVATE, 4096, (SHM_R|SHM_W|IPC_CREAT));
0878                   if (id == -1) return 1;
0879                   shmctl(id, IPC_RMID, NULL);"
0880 . auto/feature
0881 
0882 
0883 ngx_feature="POSIX semaphores"
0884 ngx_feature_name="NGX_HAVE_POSIX_SEM"
0885 ngx_feature_run=yes
0886 ngx_feature_incs="#include <semaphore.h>"
0887 ngx_feature_path=
0888 ngx_feature_libs=
0889 ngx_feature_test="sem_t  sem;
0890                   if (sem_init(&sem, 1, 0) == -1) return 1;
0891                   sem_destroy(&sem);"
0892 . auto/feature
0893 
0894 
0895 if [ $ngx_found = no ]; then
0896 
0897     # Linux has POSIX semaphores in libpthread
0898     ngx_feature="POSIX semaphores in libpthread"
0899     ngx_feature_libs=-lpthread
0900     . auto/feature
0901 
0902     if [ $ngx_found = yes ]; then
0903         CORE_LIBS="$CORE_LIBS -lpthread"
0904         NGX_LIBPTHREAD="-lpthread"
0905     fi
0906 fi
0907 
0908 
0909 if [ $ngx_found = no ]; then
0910 
0911     # Solaris has POSIX semaphores in librt
0912     ngx_feature="POSIX semaphores in librt"
0913     ngx_feature_libs=-lrt
0914     . auto/feature
0915 
0916     if [ $ngx_found = yes ]; then
0917         CORE_LIBS="$CORE_LIBS -lrt"
0918     fi
0919 fi
0920 
0921 
0922 ngx_feature="struct msghdr.msg_control"
0923 ngx_feature_name="NGX_HAVE_MSGHDR_MSG_CONTROL"
0924 ngx_feature_run=no
0925 ngx_feature_incs="#include <sys/socket.h>
0926                   #include <stdio.h>"
0927 ngx_feature_path=
0928 ngx_feature_libs=
0929 ngx_feature_test="struct msghdr  msg;
0930                   printf(\"%d\", (int) sizeof(msg.msg_control))"
0931 . auto/feature
0932 
0933 
0934 ngx_feature="ioctl(FIONBIO)"
0935 ngx_feature_name="NGX_HAVE_FIONBIO"
0936 ngx_feature_run=no
0937 ngx_feature_incs="#include <sys/ioctl.h>
0938                   #include <stdio.h>
0939                   $NGX_INCLUDE_SYS_FILIO_H"
0940 ngx_feature_path=
0941 ngx_feature_libs=
0942 ngx_feature_test="int i = FIONBIO; printf(\"%d\", i)"
0943 . auto/feature
0944 
0945 
0946 ngx_feature="struct tm.tm_gmtoff"
0947 ngx_feature_name="NGX_HAVE_GMTOFF"
0948 ngx_feature_run=no
0949 ngx_feature_incs="#include <time.h>
0950                   #include <stdio.h>"
0951 ngx_feature_path=
0952 ngx_feature_libs=
0953 ngx_feature_test="struct tm  tm; tm.tm_gmtoff = 0;
0954                   printf(\"%d\", (int) tm.tm_gmtoff)"
0955 . auto/feature
0956 
0957 
0958 ngx_feature="struct dirent.d_namlen"
0959 ngx_feature_name="NGX_HAVE_D_NAMLEN"
0960 ngx_feature_run=no
0961 ngx_feature_incs="#include <dirent.h>
0962                   #include <stdio.h>"
0963 ngx_feature_path=
0964 ngx_feature_libs=
0965 ngx_feature_test="struct dirent  dir; dir.d_namlen = 0;
0966                   printf(\"%d\", (int) dir.d_namlen)"
0967 . auto/feature
0968 
0969 
0970 ngx_feature="struct dirent.d_type"
0971 ngx_feature_name="NGX_HAVE_D_TYPE"
0972 ngx_feature_run=no
0973 ngx_feature_incs="#include <dirent.h>
0974                   #include <stdio.h>"
0975 ngx_feature_path=
0976 ngx_feature_libs=
0977 ngx_feature_test="struct dirent  dir; dir.d_type = DT_REG;
0978                   printf(\"%d\", (int) dir.d_type)"
0979 . auto/feature
0980 
0981 
0982 ngx_feature="sysconf(_SC_NPROCESSORS_ONLN)"
0983 ngx_feature_name="NGX_HAVE_SC_NPROCESSORS_ONLN"
0984 ngx_feature_run=no
0985 ngx_feature_incs=
0986 ngx_feature_path=
0987 ngx_feature_libs=
0988 ngx_feature_test="sysconf(_SC_NPROCESSORS_ONLN)"
0989 . auto/feature
0990 
0991 
0992 ngx_feature="sysconf(_SC_LEVEL1_DCACHE_LINESIZE)"
0993 ngx_feature_name="NGX_HAVE_LEVEL1_DCACHE_LINESIZE"
0994 ngx_feature_run=no
0995 ngx_feature_incs=
0996 ngx_feature_path=
0997 ngx_feature_libs=
0998 ngx_feature_test="sysconf(_SC_LEVEL1_DCACHE_LINESIZE)"
0999 . auto/feature
1000 
1001 
1002 ngx_feature="openat(), fstatat()"
1003 ngx_feature_name="NGX_HAVE_OPENAT"
1004 ngx_feature_run=no
1005 ngx_feature_incs="#include <sys/types.h>
1006                   #include <sys/stat.h>
1007                   #include <fcntl.h>"
1008 ngx_feature_path=
1009 ngx_feature_libs=
1010 ngx_feature_test="struct stat sb;
1011                   openat(AT_FDCWD, \".\", O_RDONLY|O_NOFOLLOW);
1012                   fstatat(AT_FDCWD, \".\", &sb, AT_SYMLINK_NOFOLLOW);"
1013 . auto/feature
1014 
1015 
1016 ngx_feature="getaddrinfo()"
1017 ngx_feature_name="NGX_HAVE_GETADDRINFO"
1018 ngx_feature_run=no
1019 ngx_feature_incs="#include <sys/types.h>
1020                   #include <sys/socket.h>
1021                   #include <netdb.h>"
1022 ngx_feature_path=
1023 ngx_feature_libs=
1024 ngx_feature_test='struct addrinfo *res;
1025                   if (getaddrinfo("localhost", NULL, NULL, &res) != 0) return 1;
1026                   freeaddrinfo(res)'
1027 . auto/feature