darwin 2.9 KB

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