File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / nginx / auto / os / darwin
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 09:20:38 2013 UTC (11 years ago) by misho
Branches: nginx, MAIN
CVS tags: v1_4_3p0, v1_4_3, HEAD
v 1.4.3

    1: 
    2: # Copyright (C) Igor Sysoev
    3: # Copyright (C) Nginx, Inc.
    4: 
    5: 
    6: have=NGX_DARWIN . auto/have_headers
    7: 
    8: CORE_INCS="$UNIX_INCS"
    9: CORE_DEPS="$UNIX_DEPS $DARWIN_DEPS"
   10: CORE_SRCS="$UNIX_SRCS $DARWIN_SRCS"
   11: 
   12: 
   13: 
   14: ngx_spacer='
   15: '
   16: 
   17: # kqueue
   18: 
   19: echo " + kqueue found"
   20: have=NGX_HAVE_KQUEUE . auto/have
   21: have=NGX_HAVE_CLEAR_EVENT . auto/have
   22: EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
   23: CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
   24: EVENT_FOUND=YES
   25: NGX_KQUEUE_CHECKED=YES
   26: 
   27: ngx_feature="kqueue's EVFILT_TIMER"
   28: ngx_feature_name="NGX_HAVE_TIMER_EVENT"
   29: ngx_feature_run=yes
   30: ngx_feature_incs="#include <sys/event.h>
   31:                   #include <sys/time.h>"
   32: ngx_feature_path=
   33: ngx_feature_libs=
   34: ngx_feature_test="int      kq;
   35:                   struct kevent    kev;
   36:                   struct timespec  ts;
   37: 
   38:                   if ((kq = kqueue()) == -1) return 1;
   39: 
   40:                   kev.ident = 0;
   41:                   kev.filter = EVFILT_TIMER;
   42:                   kev.flags = EV_ADD|EV_ENABLE;
   43:                   kev.fflags = 0;
   44:                   kev.data = 1000;
   45:                   kev.udata = 0;
   46: 
   47:                   ts.tv_sec = 0;
   48:                   ts.tv_nsec = 0;
   49: 
   50:                   if (kevent(kq, &kev, 1, &kev, 1, &ts) == -1) return 1;
   51: 
   52:                   if (kev.flags & EV_ERROR) return 1;"
   53: 
   54: . auto/feature
   55: 
   56: 
   57: ngx_feature="Darwin 64-bit kqueue millisecond timeout bug"
   58: ngx_feature_name=NGX_DARWIN_KEVENT_BUG
   59: ngx_feature_run=bug
   60: ngx_feature_incs="#include <sys/event.h>
   61:                   #include <sys/time.h>"
   62: ngx_feature_path=
   63: ngx_feature_libs=
   64: ngx_feature_test="int  kq;
   65:                   struct kevent    kev;
   66:                   struct timespec  ts;
   67:                   struct timeval   tv, tv0;
   68: 
   69:                   kq = kqueue();
   70: 
   71:                   ts.tv_sec = 0;
   72:                   ts.tv_nsec = 999000000;
   73: 
   74:                   gettimeofday(&tv, 0);
   75:                   kevent(kq, NULL, 0, &kev, 1, &ts);
   76:                   gettimeofday(&tv0, 0);
   77:                   timersub(&tv0, &tv, &tv);
   78: 
   79:                   if (tv.tv_sec * 1000000 + tv.tv_usec < 900000) return 1;"
   80: 
   81: . auto/feature
   82: 
   83: 
   84: # sendfile()
   85: 
   86: CC_AUX_FLAGS="$CC_AUX_FLAGS"
   87: ngx_feature="sendfile()"
   88: ngx_feature_name="NGX_HAVE_SENDFILE"
   89: ngx_feature_run=yes
   90: ngx_feature_incs="#include <sys/types.h>
   91:                   #include <sys/socket.h>
   92:                   #include <sys/uio.h>
   93:                   #include <sys/errno.h>"
   94: ngx_feature_path=
   95: ngx_feature_libs=
   96: ngx_feature_test="int s = 0, fd = 1;
   97:                   off_t n; off_t off = 0;
   98:                   n = sendfile(s, fd, off, &n, NULL, 0);
   99:                   if (n == -1 && errno == ENOSYS) return 1"
  100: . auto/feature
  101: 
  102: if [ $ngx_found = yes ]; then
  103:     have=NGX_HAVE_SENDFILE . auto/have
  104:     CORE_SRCS="$CORE_SRCS $DARWIN_SENDFILE_SRCS"
  105: fi
  106: 
  107: 
  108: ngx_feature="atomic(3)"
  109: ngx_feature_name=NGX_DARWIN_ATOMIC
  110: ngx_feature_run=no
  111: ngx_feature_incs="#include <libkern/OSAtomic.h>"
  112: ngx_feature_path=
  113: ngx_feature_libs=
  114: ngx_feature_test="int32_t  lock, n;
  115:                   n = OSAtomicCompareAndSwap32Barrier(0, 1, lock)"
  116: . auto/feature

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