Annotation of embedaddon/nginx/auto/unix, revision 1.1

1.1     ! misho       1: 
        !             2: # Copyright (C) Igor Sysoev
        !             3: # Copyright (C) Nginx, Inc.
        !             4: 
        !             5: 
        !             6: NGX_USER=${NGX_USER:-nobody}
        !             7: 
        !             8: if [ -z "$NGX_GROUP" ]; then
        !             9:     if [ $NGX_USER = nobody ]; then
        !            10:         if grep nobody /etc/group 2>&1 >/dev/null; then
        !            11:             echo "checking for nobody group ... found"
        !            12:             NGX_GROUP=nobody
        !            13:         else
        !            14:             echo "checking for nobody group ... not found"
        !            15: 
        !            16:             if grep nogroup /etc/group 2>&1 >/dev/null; then
        !            17:                 echo "checking for nogroup group ... found"
        !            18:                 NGX_GROUP=nogroup
        !            19:             else
        !            20:                 echo "checking for nogroup group ... not found"
        !            21:                 NGX_GROUP=nobody
        !            22:             fi
        !            23:         fi
        !            24:     else
        !            25:         NGX_GROUP=$NGX_USER
        !            26:     fi
        !            27: fi
        !            28: 
        !            29: 
        !            30: ngx_feature="poll()"
        !            31: ngx_feature_name=
        !            32: ngx_feature_run=no
        !            33: ngx_feature_incs="#include <poll.h>"
        !            34: ngx_feature_path=
        !            35: ngx_feature_libs=
        !            36: ngx_feature_test="int  n; struct pollfd  pl;
        !            37:                   pl.fd = 0;
        !            38:                   pl.events = 0;
        !            39:                   pl.revents = 0;
        !            40:                   n = poll(&pl, 1, 0);
        !            41:                   if (n == -1) return 1"
        !            42: . auto/feature
        !            43: 
        !            44: if [ $ngx_found = no ]; then
        !            45:     EVENT_POLL=NONE
        !            46: fi
        !            47: 
        !            48: 
        !            49: ngx_feature="/dev/poll"
        !            50: ngx_feature_name="NGX_HAVE_DEVPOLL"
        !            51: ngx_feature_run=no
        !            52: ngx_feature_incs="#include <sys/devpoll.h>"
        !            53: ngx_feature_path=
        !            54: ngx_feature_libs=
        !            55: ngx_feature_test="int  n, dp; struct dvpoll  dvp;
        !            56:                   dp = 0;
        !            57:                   dvp.dp_fds = NULL;
        !            58:                   dvp.dp_nfds = 0;
        !            59:                   dvp.dp_timeout = 0;
        !            60:                   n = ioctl(dp, DP_POLL, &dvp);
        !            61:                   if (n == -1) return 1"
        !            62: . auto/feature
        !            63: 
        !            64: if [ $ngx_found = yes ]; then
        !            65:     CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
        !            66:     EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
        !            67:     EVENT_FOUND=YES
        !            68: fi
        !            69: 
        !            70: 
        !            71: if test -z "$NGX_KQUEUE_CHECKED"; then
        !            72:     ngx_feature="kqueue"
        !            73:     ngx_feature_name="NGX_HAVE_KQUEUE"
        !            74:     ngx_feature_run=no
        !            75:     ngx_feature_incs="#include <sys/event.h>"
        !            76:     ngx_feature_path=
        !            77:     ngx_feature_libs=
        !            78:     ngx_feature_test="int kq; kq = kqueue()"
        !            79:     . auto/feature
        !            80: 
        !            81:     if [ $ngx_found = yes ]; then
        !            82: 
        !            83:         have=NGX_HAVE_CLEAR_EVENT . auto/have
        !            84:         EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
        !            85:         CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
        !            86:         EVENT_FOUND=YES
        !            87: 
        !            88:         ngx_feature="kqueue's NOTE_LOWAT"
        !            89:         ngx_feature_name="NGX_HAVE_LOWAT_EVENT"
        !            90:         ngx_feature_run=no
        !            91:         ngx_feature_incs="#include <sys/event.h>"
        !            92:         ngx_feature_path=
        !            93:         ngx_feature_libs=
        !            94:         ngx_feature_test="struct kevent  kev;
        !            95:                           kev.fflags = NOTE_LOWAT;"
        !            96:         . auto/feature
        !            97: 
        !            98: 
        !            99:         ngx_feature="kqueue's EVFILT_TIMER"
        !           100:         ngx_feature_name="NGX_HAVE_TIMER_EVENT"
        !           101:         ngx_feature_run=yes
        !           102:         ngx_feature_incs="#include <sys/event.h>
        !           103:                           #include <sys/time.h>"
        !           104:         ngx_feature_path=
        !           105:         ngx_feature_libs=
        !           106:         ngx_feature_test="int      kq;
        !           107:                   struct kevent    kev;
        !           108:                   struct timespec  ts;
        !           109: 
        !           110:                   if ((kq = kqueue()) == -1) return 1;
        !           111: 
        !           112:                   kev.ident = 0;
        !           113:                   kev.filter = EVFILT_TIMER;
        !           114:                   kev.flags = EV_ADD|EV_ENABLE;
        !           115:                   kev.fflags = 0;
        !           116:                   kev.data = 1000;
        !           117:                   kev.udata = 0;
        !           118: 
        !           119:                   ts.tv_sec = 0;
        !           120:                   ts.tv_nsec = 0;
        !           121: 
        !           122:                   if (kevent(kq, &kev, 1, &kev, 1, &ts) == -1) return 1;
        !           123: 
        !           124:                   if (kev.flags & EV_ERROR) return 1;"
        !           125: 
        !           126:         . auto/feature
        !           127:     fi
        !           128: fi
        !           129: 
        !           130: 
        !           131: if [ "$NGX_SYSTEM" = "NetBSD" ]; then
        !           132: 
        !           133:     # NetBSD 2.0 incompatibly defines kevent.udata as "intptr_t"
        !           134: 
        !           135:     cat << END >> $NGX_AUTO_CONFIG_H
        !           136: 
        !           137: #define NGX_KQUEUE_UDATA_T
        !           138: 
        !           139: END
        !           140: 
        !           141: else
        !           142:     cat << END >> $NGX_AUTO_CONFIG_H
        !           143: 
        !           144: #define NGX_KQUEUE_UDATA_T  (void *)
        !           145: 
        !           146: END
        !           147: 
        !           148: fi
        !           149: 
        !           150: 
        !           151: ngx_feature="crypt()"
        !           152: ngx_feature_name=
        !           153: ngx_feature_run=no
        !           154: ngx_feature_incs=
        !           155: ngx_feature_path=
        !           156: ngx_feature_libs=
        !           157: ngx_feature_test="crypt(\"test\", \"salt\");"
        !           158: . auto/feature
        !           159: 
        !           160: 
        !           161: if [ $ngx_found = no ]; then
        !           162: 
        !           163:     ngx_feature="crypt() in libcrypt"
        !           164:     ngx_feature_name=
        !           165:     ngx_feature_run=no
        !           166:     ngx_feature_incs=
        !           167:     ngx_feature_path=
        !           168:     ngx_feature_libs=-lcrypt
        !           169:     . auto/feature
        !           170: 
        !           171:     if [ $ngx_found = yes ]; then
        !           172:         CRYPT_LIB="-lcrypt"
        !           173:     fi
        !           174: fi
        !           175: 
        !           176: 
        !           177: ngx_feature="F_READAHEAD"
        !           178: ngx_feature_name="NGX_HAVE_F_READAHEAD"
        !           179: ngx_feature_run=no
        !           180: ngx_feature_incs="#include <fcntl.h>"
        !           181: ngx_feature_path=
        !           182: ngx_feature_libs=
        !           183: ngx_feature_test="fcntl(0, F_READAHEAD, 1);"
        !           184: . auto/feature
        !           185: 
        !           186: 
        !           187: ngx_feature="posix_fadvise()"
        !           188: ngx_feature_name="NGX_HAVE_POSIX_FADVISE"
        !           189: ngx_feature_run=no
        !           190: ngx_feature_incs="#include <fcntl.h>"
        !           191: ngx_feature_path=
        !           192: ngx_feature_libs=
        !           193: ngx_feature_test="posix_fadvise(0, 0, 0, POSIX_FADV_SEQUENTIAL);"
        !           194: . auto/feature
        !           195: 
        !           196: 
        !           197: ngx_feature="O_DIRECT"
        !           198: ngx_feature_name="NGX_HAVE_O_DIRECT"
        !           199: ngx_feature_run=no
        !           200: ngx_feature_incs="#include <fcntl.h>"
        !           201: ngx_feature_path=
        !           202: ngx_feature_libs=
        !           203: ngx_feature_test="fcntl(0, F_SETFL, O_DIRECT);"
        !           204: . auto/feature
        !           205: 
        !           206: 
        !           207: if [ $ngx_found = yes -a "$NGX_SYSTEM" = "Linux" ]; then
        !           208:     have=NGX_HAVE_ALIGNED_DIRECTIO . auto/have
        !           209: fi
        !           210: 
        !           211: ngx_feature="F_NOCACHE"
        !           212: ngx_feature_name="NGX_HAVE_F_NOCACHE"
        !           213: ngx_feature_run=no
        !           214: ngx_feature_incs="#include <fcntl.h>"
        !           215: ngx_feature_path=
        !           216: ngx_feature_libs=
        !           217: ngx_feature_test="fcntl(0, F_NOCACHE, 1);"
        !           218: . auto/feature
        !           219: 
        !           220: 
        !           221: ngx_feature="directio()"
        !           222: ngx_feature_name="NGX_HAVE_DIRECTIO"
        !           223: ngx_feature_run=no
        !           224: ngx_feature_incs="#include <sys/types.h>
        !           225:                   #include <sys/fcntl.h>"
        !           226: ngx_feature_path=
        !           227: ngx_feature_libs=
        !           228: ngx_feature_test="directio(0, DIRECTIO_ON);"
        !           229: . auto/feature
        !           230: 
        !           231: 
        !           232: ngx_feature="statfs()"
        !           233: ngx_feature_name="NGX_HAVE_STATFS"
        !           234: ngx_feature_run=no
        !           235: ngx_feature_incs="$NGX_INCLUDE_SYS_PARAM_H
        !           236:                   $NGX_INCLUDE_SYS_MOUNT_H
        !           237:                   $NGX_INCLUDE_SYS_VFS_H"
        !           238: ngx_feature_path=
        !           239: ngx_feature_libs=
        !           240: ngx_feature_test="struct statfs  fs;
        !           241:                   statfs(\".\", &fs);"
        !           242: . auto/feature
        !           243: 
        !           244: 
        !           245: ngx_feature="statvfs()"
        !           246: ngx_feature_name="NGX_HAVE_STATVFS"
        !           247: ngx_feature_run=no
        !           248: ngx_feature_incs="#include <sys/types.h>
        !           249:                   #include <sys/statvfs.h>"
        !           250: ngx_feature_path=
        !           251: ngx_feature_libs=
        !           252: ngx_feature_test="struct statvfs  fs;
        !           253:                   statvfs(\".\", &fs);"
        !           254: . auto/feature
        !           255: 
        !           256: 
        !           257: ngx_feature="dlopen()"
        !           258: ngx_feature_name=
        !           259: ngx_feature_run=no
        !           260: ngx_feature_incs="#include <dlfcn.h>"
        !           261: ngx_feature_path=
        !           262: ngx_feature_libs=
        !           263: ngx_feature_test="dlopen(NULL, 0)"
        !           264: . auto/feature
        !           265: 
        !           266: 
        !           267: if [ $ngx_found != yes ]; then
        !           268: 
        !           269:     ngx_feature="dlopen() in libdl"
        !           270:     ngx_feature_libs="-ldl"
        !           271:     . auto/feature
        !           272: 
        !           273:     if [ $ngx_found = yes ]; then
        !           274:         NGX_LIBDL="-ldl"
        !           275:     fi
        !           276: fi
        !           277: 
        !           278: 
        !           279: ngx_feature="sched_yield()"
        !           280: ngx_feature_name="NGX_HAVE_SCHED_YIELD"
        !           281: ngx_feature_run=no
        !           282: ngx_feature_incs="#include <sched.h>"
        !           283: ngx_feature_path=
        !           284: ngx_feature_libs=
        !           285: ngx_feature_test="sched_yield()"
        !           286: . auto/feature
        !           287: 
        !           288: 
        !           289: if [ $ngx_found != yes ]; then
        !           290: 
        !           291:     ngx_feature="sched_yield() in librt"
        !           292:     ngx_feature_libs="-lrt"
        !           293:     . auto/feature
        !           294: 
        !           295:     if [ $ngx_found = yes ]; then
        !           296:         CORE_LIBS="$CORE_LIBS -lrt"
        !           297:     fi
        !           298: fi
        !           299: 
        !           300: 
        !           301: ngx_feature="SO_SETFIB"
        !           302: ngx_feature_name="NGX_HAVE_SETFIB"
        !           303: ngx_feature_run=no
        !           304: ngx_feature_incs="#include <sys/socket.h>"
        !           305: ngx_feature_path=
        !           306: ngx_feature_libs=
        !           307: ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_SETFIB, NULL, 4)"
        !           308: . auto/feature
        !           309: 
        !           310: 
        !           311: ngx_feature="SO_ACCEPTFILTER"
        !           312: ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT"
        !           313: ngx_feature_run=no
        !           314: ngx_feature_incs="#include <sys/socket.h>"
        !           315: ngx_feature_path=
        !           316: ngx_feature_libs=
        !           317: ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)"
        !           318: . auto/feature
        !           319: 
        !           320: 
        !           321: ngx_feature="TCP_DEFER_ACCEPT"
        !           322: ngx_feature_name="NGX_HAVE_DEFERRED_ACCEPT"
        !           323: ngx_feature_run=no
        !           324: ngx_feature_incs="#include <sys/socket.h>
        !           325:                   #include <netinet/in.h>
        !           326:                   #include <netinet/tcp.h>"
        !           327: ngx_feature_path=
        !           328: ngx_feature_libs=
        !           329: ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_DEFER_ACCEPT, NULL, 0)"
        !           330: . auto/feature
        !           331: 
        !           332: 
        !           333: ngx_feature="TCP_KEEPIDLE, TCP_KEEPINTVL, TCP_KEEPCNT"
        !           334: ngx_feature_name="NGX_HAVE_KEEPALIVE_TUNABLE"
        !           335: ngx_feature_run=no
        !           336: ngx_feature_incs="#include <sys/socket.h>
        !           337:                   #include <netinet/in.h>
        !           338:                   #include <netinet/tcp.h>"
        !           339: ngx_feature_path=
        !           340: ngx_feature_libs=
        !           341: ngx_feature_test="setsockopt(0, IPPROTO_TCP, TCP_KEEPIDLE, NULL, 0);
        !           342:                   setsockopt(0, IPPROTO_TCP, TCP_KEEPINTVL, NULL, 0);
        !           343:                   setsockopt(0, IPPROTO_TCP, TCP_KEEPCNT, NULL, 0)"
        !           344: . auto/feature
        !           345: 
        !           346: 
        !           347: ngx_feature="TCP_INFO"
        !           348: ngx_feature_name="NGX_HAVE_TCP_INFO"
        !           349: ngx_feature_run=no
        !           350: ngx_feature_incs="#include <sys/socket.h>
        !           351:                   #include <netinet/in.h>
        !           352:                   #include <netinet/tcp.h>"
        !           353: ngx_feature_path=
        !           354: ngx_feature_libs=
        !           355: ngx_feature_test="socklen_t optlen = sizeof(struct tcp_info);
        !           356:                   struct tcp_info ti;
        !           357:                   ti.tcpi_rtt = 0;
        !           358:                   ti.tcpi_rttvar = 0;
        !           359:                   ti.tcpi_snd_cwnd = 0;
        !           360:                   ti.tcpi_rcv_space = 0;
        !           361:                   getsockopt(0, IPPROTO_TCP, TCP_INFO, &ti, &optlen)"
        !           362: . auto/feature
        !           363: 
        !           364: 
        !           365: ngx_feature="accept4()"
        !           366: ngx_feature_name="NGX_HAVE_ACCEPT4"
        !           367: ngx_feature_run=no
        !           368: ngx_feature_incs="#include <sys/socket.h>"
        !           369: ngx_feature_path=
        !           370: ngx_feature_libs=
        !           371: ngx_feature_test="accept4(0, NULL, NULL, SOCK_NONBLOCK)"
        !           372: . auto/feature
        !           373: 
        !           374: if [ $NGX_FILE_AIO = YES ]; then
        !           375: 
        !           376:     ngx_feature="kqueue AIO support"
        !           377:     ngx_feature_name="NGX_HAVE_FILE_AIO"
        !           378:     ngx_feature_run=no
        !           379:     ngx_feature_incs="#include <aio.h>"
        !           380:     ngx_feature_path=
        !           381:     ngx_feature_libs=
        !           382:     ngx_feature_test="int  n; struct aiocb  iocb;
        !           383:                       iocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
        !           384:                       n = aio_read(&iocb)"
        !           385:     . auto/feature
        !           386: 
        !           387:     if [ $ngx_found = yes ]; then
        !           388:         CORE_SRCS="$CORE_SRCS $FILE_AIO_SRCS"
        !           389: 
        !           390:     elif [ $ngx_found = no ]; then
        !           391: 
        !           392:         ngx_feature="Linux AIO support"
        !           393:         ngx_feature_name="NGX_HAVE_FILE_AIO"
        !           394:         ngx_feature_run=no
        !           395:         ngx_feature_incs="#include <linux/aio_abi.h>
        !           396:                           #include <sys/syscall.h>"
        !           397:         ngx_feature_path=
        !           398:         ngx_feature_libs=
        !           399:         ngx_feature_test="int  n = SYS_eventfd;
        !           400:                           struct iocb  iocb;
        !           401:                           iocb.aio_lio_opcode = IOCB_CMD_PREAD;
        !           402:                           iocb.aio_flags = IOCB_FLAG_RESFD;
        !           403:                           iocb.aio_resfd = -1;"
        !           404:         . auto/feature
        !           405: 
        !           406:         if [ $ngx_found = yes ]; then
        !           407:             have=NGX_HAVE_EVENTFD . auto/have
        !           408:             CORE_SRCS="$CORE_SRCS $LINUX_AIO_SRCS"
        !           409: 
        !           410:         else
        !           411:             cat << END
        !           412: 
        !           413: $0: no supported file AIO was found
        !           414: Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only
        !           415: 
        !           416: END
        !           417:            exit 1
        !           418:         fi
        !           419:     fi
        !           420: fi
        !           421: 
        !           422: 
        !           423: have=NGX_HAVE_UNIX_DOMAIN . auto/have
        !           424: 
        !           425: ngx_feature_libs=
        !           426: 
        !           427: 
        !           428: # C types
        !           429: 
        !           430: ngx_type="int"; . auto/types/sizeof
        !           431: 
        !           432: ngx_type="long"; . auto/types/sizeof
        !           433: 
        !           434: ngx_type="long long"; . auto/types/sizeof
        !           435: 
        !           436: ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
        !           437: ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
        !           438: 
        !           439: 
        !           440: # POSIX types
        !           441: 
        !           442: case "$NGX_AUTO_CONFIG_H" in
        !           443:     /*)
        !           444:         NGX_INCLUDE_AUTO_CONFIG_H="#include \"$NGX_AUTO_CONFIG_H\""
        !           445:     ;;
        !           446:     *)
        !           447:         NGX_INCLUDE_AUTO_CONFIG_H="#include \"../$NGX_AUTO_CONFIG_H\""
        !           448:     ;;
        !           449: esac
        !           450: 
        !           451: ngx_type="uint64_t"; ngx_types="u_int64_t"; . auto/types/typedef
        !           452: 
        !           453: ngx_type="sig_atomic_t"; ngx_types="int"; . auto/types/typedef
        !           454: . auto/types/sizeof
        !           455: ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
        !           456: 
        !           457: ngx_type="socklen_t"; ngx_types="int"; . auto/types/typedef
        !           458: 
        !           459: ngx_type="in_addr_t"; ngx_types="uint32_t"; . auto/types/typedef
        !           460: 
        !           461: ngx_type="in_port_t"; ngx_types="u_short"; . auto/types/typedef
        !           462: 
        !           463: ngx_type="rlim_t"; ngx_types="int"; . auto/types/typedef
        !           464: 
        !           465: . auto/types/uintptr_t
        !           466: 
        !           467: . auto/endianness
        !           468: 
        !           469: ngx_type="size_t"; . auto/types/sizeof
        !           470: ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
        !           471: ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
        !           472: 
        !           473: ngx_type="off_t"; . auto/types/sizeof
        !           474: ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
        !           475: ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
        !           476: 
        !           477: ngx_type="time_t"; . auto/types/sizeof
        !           478: ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
        !           479: ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
        !           480: 
        !           481: 
        !           482: # syscalls, libc calls and some features
        !           483: 
        !           484: 
        !           485: if [ $NGX_IPV6 = YES ]; then
        !           486:     ngx_feature="AF_INET6"
        !           487:     ngx_feature_name="NGX_HAVE_INET6"
        !           488:     ngx_feature_run=no
        !           489:     ngx_feature_incs="#include <sys/socket.h>
        !           490:                       #include <netinet/in.h>
        !           491:                       #include <arpa/inet.h>"
        !           492:     ngx_feature_path=
        !           493:     ngx_feature_libs=
        !           494:     ngx_feature_test="struct sockaddr_in6  sin6;
        !           495:                       sin6.sin6_family = AF_INET6;"
        !           496:     . auto/feature
        !           497: fi
        !           498: 
        !           499: 
        !           500: ngx_feature="setproctitle()"
        !           501: ngx_feature_name="NGX_HAVE_SETPROCTITLE"
        !           502: ngx_feature_run=no
        !           503: ngx_feature_incs="#include <stdlib.h>"
        !           504: ngx_feature_path=
        !           505: ngx_feature_libs=$NGX_SETPROCTITLE_LIB
        !           506: ngx_feature_test="setproctitle(\"test\");"
        !           507: . auto/feature
        !           508: 
        !           509: 
        !           510: ngx_feature="pread()"
        !           511: ngx_feature_name="NGX_HAVE_PREAD"
        !           512: ngx_feature_run=no
        !           513: ngx_feature_incs=
        !           514: ngx_feature_path=
        !           515: ngx_feature_libs=
        !           516: ngx_feature_test="char buf[1]; ssize_t n; n = pread(0, buf, 1, 0);
        !           517:                   if (n == -1) return 1"
        !           518: . auto/feature
        !           519: 
        !           520: 
        !           521: ngx_feature="pwrite()"
        !           522: ngx_feature_name="NGX_HAVE_PWRITE"
        !           523: ngx_feature_run=no
        !           524: ngx_feature_incs=
        !           525: ngx_feature_path=
        !           526: ngx_feature_libs=
        !           527: ngx_feature_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0);
        !           528:                   if (n == -1) return 1"
        !           529: . auto/feature
        !           530: 
        !           531: 
        !           532: ngx_feature="sys_nerr"
        !           533: ngx_feature_name="NGX_SYS_NERR"
        !           534: ngx_feature_run=value
        !           535: ngx_feature_incs='#include <errno.h>
        !           536:                   #include <stdio.h>'
        !           537: ngx_feature_path=
        !           538: ngx_feature_libs=
        !           539: ngx_feature_test='printf("%d", sys_nerr);'
        !           540: . auto/feature
        !           541: 
        !           542: 
        !           543: if [ $ngx_found = no ]; then
        !           544: 
        !           545:     # Cygiwn defines _sys_nerr
        !           546:     ngx_feature="_sys_nerr"
        !           547:     ngx_feature_name="NGX_SYS_NERR"
        !           548:     ngx_feature_run=value
        !           549:     ngx_feature_incs='#include <errno.h>
        !           550:                       #include <stdio.h>'
        !           551:     ngx_feature_path=
        !           552:     ngx_feature_libs=
        !           553:     ngx_feature_test='printf("%d", _sys_nerr);'
        !           554:     . auto/feature
        !           555: fi
        !           556: 
        !           557: 
        !           558: if [ $ngx_found = no ]; then
        !           559: 
        !           560:     # Solaris has no sys_nerr
        !           561:     ngx_feature='maximum errno'
        !           562:     ngx_feature_name=NGX_SYS_NERR
        !           563:     ngx_feature_run=value
        !           564:     ngx_feature_incs='#include <errno.h>
        !           565:                       #include <string.h>
        !           566:                       #include <stdio.h>'
        !           567:     ngx_feature_path=
        !           568:     ngx_feature_libs=
        !           569:     ngx_feature_test='int  n;
        !           570:                       char *p;
        !           571:                       for (n = 1; n < 1000; n++) {
        !           572:                           errno = 0;
        !           573:                           p = strerror(n);
        !           574:                           if (errno == EINVAL
        !           575:                               || p == NULL
        !           576:                               || strncmp(p, "Unknown error", 13) == 0)
        !           577:                           {
        !           578:                               break;
        !           579:                           }
        !           580:                       }
        !           581:                       printf("%d", n);'
        !           582:     . auto/feature
        !           583: fi
        !           584: 
        !           585: 
        !           586: ngx_feature="localtime_r()"
        !           587: ngx_feature_name="NGX_HAVE_LOCALTIME_R"
        !           588: ngx_feature_run=no
        !           589: ngx_feature_incs="#include <time.h>"
        !           590: ngx_feature_path=
        !           591: ngx_feature_libs=
        !           592: ngx_feature_test="struct tm t; time_t c=0; localtime_r(&c, &t)"
        !           593: . auto/feature
        !           594: 
        !           595: 
        !           596: ngx_feature="posix_memalign()"
        !           597: ngx_feature_name="NGX_HAVE_POSIX_MEMALIGN"
        !           598: ngx_feature_run=no
        !           599: ngx_feature_incs="#include <stdlib.h>"
        !           600: ngx_feature_path=
        !           601: ngx_feature_libs=
        !           602: ngx_feature_test="void *p; int n; n = posix_memalign(&p, 4096, 4096);
        !           603:                   if (n != 0) return 1"
        !           604: . auto/feature
        !           605: 
        !           606: 
        !           607: ngx_feature="memalign()"
        !           608: ngx_feature_name="NGX_HAVE_MEMALIGN"
        !           609: ngx_feature_run=no
        !           610: ngx_feature_incs="#include <stdlib.h>
        !           611:                   #include <malloc.h>"
        !           612: ngx_feature_path=
        !           613: ngx_feature_libs=
        !           614: ngx_feature_test="void *p; p = memalign(4096, 4096);
        !           615:                   if (p == NULL) return 1"
        !           616: . auto/feature
        !           617: 
        !           618: 
        !           619: ngx_feature="mmap(MAP_ANON|MAP_SHARED)"
        !           620: ngx_feature_name="NGX_HAVE_MAP_ANON"
        !           621: ngx_feature_run=yes
        !           622: ngx_feature_incs="#include <sys/mman.h>"
        !           623: ngx_feature_path=
        !           624: ngx_feature_libs=
        !           625: ngx_feature_test="void *p;
        !           626:                   p = mmap(NULL, 4096, PROT_READ|PROT_WRITE,
        !           627:                            MAP_ANON|MAP_SHARED, -1, 0);
        !           628:                   if (p == MAP_FAILED) return 1;"
        !           629: . auto/feature
        !           630: 
        !           631: 
        !           632: ngx_feature='mmap("/dev/zero", MAP_SHARED)'
        !           633: ngx_feature_name="NGX_HAVE_MAP_DEVZERO"
        !           634: ngx_feature_run=yes
        !           635: ngx_feature_incs="#include <sys/mman.h>
        !           636:                   #include <sys/stat.h>
        !           637:                   #include <fcntl.h>"
        !           638: ngx_feature_path=
        !           639: ngx_feature_libs=
        !           640: ngx_feature_test='void *p; int  fd;
        !           641:                   fd = open("/dev/zero", O_RDWR);
        !           642:                   p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
        !           643:                   if (p == MAP_FAILED) return 1;'
        !           644: . auto/feature
        !           645: 
        !           646: 
        !           647: ngx_feature="System V shared memory"
        !           648: ngx_feature_name="NGX_HAVE_SYSVSHM"
        !           649: ngx_feature_run=yes
        !           650: ngx_feature_incs="#include <sys/ipc.h>
        !           651:                   #include <sys/shm.h>"
        !           652: ngx_feature_path=
        !           653: ngx_feature_libs=
        !           654: ngx_feature_test="int  id;
        !           655:                   id = shmget(IPC_PRIVATE, 4096, (SHM_R|SHM_W|IPC_CREAT));
        !           656:                   if (id == -1) return 1;
        !           657:                   shmctl(id, IPC_RMID, NULL);"
        !           658: . auto/feature
        !           659: 
        !           660: 
        !           661: ngx_feature="POSIX semaphores"
        !           662: ngx_feature_name="NGX_HAVE_POSIX_SEM"
        !           663: ngx_feature_run=yes
        !           664: ngx_feature_incs="#include <semaphore.h>"
        !           665: ngx_feature_path=
        !           666: ngx_feature_libs=
        !           667: ngx_feature_test="sem_t  sem;
        !           668:                   if (sem_init(&sem, 1, 0) == -1) return 1;
        !           669:                   sem_destroy(&sem);"
        !           670: . auto/feature
        !           671: 
        !           672: 
        !           673: if [ $ngx_found = no ]; then
        !           674: 
        !           675:     # Linux has POSIX semaphores in libpthread
        !           676:     ngx_feature="POSIX semaphores in libpthread"
        !           677:     ngx_feature_libs=-lpthread
        !           678:     . auto/feature
        !           679: 
        !           680:     if [ $ngx_found = yes ]; then
        !           681:         CORE_LIBS="$CORE_LIBS -lpthread"
        !           682:     fi
        !           683: fi
        !           684: 
        !           685: 
        !           686: if [ $ngx_found = no ]; then
        !           687: 
        !           688:     # Solaris has POSIX semaphores in librt
        !           689:     ngx_feature="POSIX semaphores in librt"
        !           690:     ngx_feature_libs=-lrt
        !           691:     . auto/feature
        !           692: 
        !           693:     if [ $ngx_found = yes ]; then
        !           694:         CORE_LIBS="$CORE_LIBS -lrt"
        !           695:     fi
        !           696: fi
        !           697: 
        !           698: 
        !           699: ngx_feature="struct msghdr.msg_control"
        !           700: ngx_feature_name="NGX_HAVE_MSGHDR_MSG_CONTROL"
        !           701: ngx_feature_run=no
        !           702: ngx_feature_incs="#include <sys/socket.h>
        !           703:                   #include <stdio.h>"
        !           704: ngx_feature_path=
        !           705: ngx_feature_libs=
        !           706: ngx_feature_test="struct msghdr  msg;
        !           707:                   printf(\"%d\", (int) sizeof(msg.msg_control))"
        !           708: . auto/feature
        !           709: 
        !           710: 
        !           711: ngx_feature="ioctl(FIONBIO)"
        !           712: ngx_feature_name="NGX_HAVE_FIONBIO"
        !           713: ngx_feature_run=no
        !           714: ngx_feature_incs="#include <sys/ioctl.h>
        !           715:                   #include <stdio.h>
        !           716:                   $NGX_INCLUDE_SYS_FILIO_H"
        !           717: ngx_feature_path=
        !           718: ngx_feature_libs=
        !           719: ngx_feature_test="int i = FIONBIO; printf(\"%d\", i)"
        !           720: . auto/feature
        !           721: 
        !           722: 
        !           723: ngx_feature="struct tm.tm_gmtoff"
        !           724: ngx_feature_name="NGX_HAVE_GMTOFF"
        !           725: ngx_feature_run=no
        !           726: ngx_feature_incs="#include <time.h>
        !           727:                   #include <stdio.h>"
        !           728: ngx_feature_path=
        !           729: ngx_feature_libs=
        !           730: ngx_feature_test="struct tm  tm; tm.tm_gmtoff = 0;
        !           731:                   printf(\"%d\", (int) tm.tm_gmtoff)"
        !           732: . auto/feature
        !           733: 
        !           734: 
        !           735: ngx_feature="struct dirent.d_namlen"
        !           736: ngx_feature_name="NGX_HAVE_D_NAMLEN"
        !           737: ngx_feature_run=no
        !           738: ngx_feature_incs="#include <dirent.h>
        !           739:                   #include <stdio.h>"
        !           740: ngx_feature_path=
        !           741: ngx_feature_libs=
        !           742: ngx_feature_test="struct dirent  dir; dir.d_namlen = 0;
        !           743:                   printf(\"%d\", (int) dir.d_namlen)"
        !           744: . auto/feature
        !           745: 
        !           746: 
        !           747: ngx_feature="struct dirent.d_type"
        !           748: ngx_feature_name="NGX_HAVE_D_TYPE"
        !           749: ngx_feature_run=no
        !           750: ngx_feature_incs="#include <dirent.h>
        !           751:                   #include <stdio.h>"
        !           752: ngx_feature_path=
        !           753: ngx_feature_libs=
        !           754: ngx_feature_test="struct dirent  dir; dir.d_type = DT_REG;
        !           755:                   printf(\"%d\", (int) dir.d_type)"
        !           756: . auto/feature
        !           757: 
        !           758: 
        !           759: ngx_feature="sysconf(_SC_NPROCESSORS_ONLN)"
        !           760: ngx_feature_name="NGX_HAVE_SC_NPROCESSORS_ONLN"
        !           761: ngx_feature_run=no
        !           762: ngx_feature_incs=
        !           763: ngx_feature_path=
        !           764: ngx_feature_libs=
        !           765: ngx_feature_test="sysconf(_SC_NPROCESSORS_ONLN)"
        !           766: . auto/feature
        !           767: 
        !           768: 
        !           769: ngx_feature="openat(), fstatat()"
        !           770: ngx_feature_name="NGX_HAVE_OPENAT"
        !           771: ngx_feature_run=no
        !           772: ngx_feature_incs="#include <sys/types.h>
        !           773:                   #include <sys/stat.h>
        !           774:                   #include <fcntl.h>"
        !           775: ngx_feature_path=
        !           776: ngx_feature_libs=
        !           777: ngx_feature_test="struct stat sb;
        !           778:                   openat(AT_FDCWD, \".\", O_RDONLY|O_NOFOLLOW);
        !           779:                   fstatat(AT_FDCWD, \".\", &sb, AT_SYMLINK_NOFOLLOW);"
        !           780: . auto/feature
        !           781: 
        !           782: 
        !           783: ngx_feature="getaddrinfo()"
        !           784: ngx_feature_name="NGX_HAVE_GETADDRINFO"
        !           785: ngx_feature_run=no
        !           786: ngx_feature_incs="#include <sys/types.h>
        !           787:                   #include <sys/socket.h>
        !           788:                   #include <netdb.h>"
        !           789: ngx_feature_path=
        !           790: ngx_feature_libs=
        !           791: ngx_feature_test='struct addrinfo *res;
        !           792:                   if (getaddrinfo("localhost", NULL, NULL, &res) != 0) return 1;
        !           793:                   freeaddrinfo(res)'
        !           794: . auto/feature

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>