darwin 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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. CC_AUX_FLAGS="$CC_AUX_FLAGS -D__APPLE_USE_RFC_3542"
  12. # kqueue
  13. echo " + kqueue found"
  14. have=NGX_HAVE_KQUEUE . auto/have
  15. have=NGX_HAVE_CLEAR_EVENT . auto/have
  16. EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
  17. CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
  18. EVENT_FOUND=YES
  19. NGX_KQUEUE_CHECKED=YES
  20. ngx_feature="kqueue's EVFILT_TIMER"
  21. ngx_feature_name="NGX_HAVE_TIMER_EVENT"
  22. ngx_feature_run=yes
  23. ngx_feature_incs="#include <sys/event.h>
  24. #include <sys/time.h>"
  25. ngx_feature_path=
  26. ngx_feature_libs=
  27. ngx_feature_test="int kq;
  28. struct kevent kev;
  29. struct timespec ts;
  30. if ((kq = kqueue()) == -1) return 1;
  31. kev.ident = 0;
  32. kev.filter = EVFILT_TIMER;
  33. kev.flags = EV_ADD|EV_ENABLE;
  34. kev.fflags = 0;
  35. kev.data = 1000;
  36. kev.udata = 0;
  37. ts.tv_sec = 0;
  38. ts.tv_nsec = 0;
  39. if (kevent(kq, &kev, 1, &kev, 1, &ts) == -1) return 1;
  40. if (kev.flags & EV_ERROR) return 1;"
  41. . auto/feature
  42. ngx_feature="Darwin 64-bit kqueue millisecond timeout bug"
  43. ngx_feature_name=NGX_DARWIN_KEVENT_BUG
  44. ngx_feature_run=bug
  45. ngx_feature_incs="#include <sys/event.h>
  46. #include <sys/time.h>"
  47. ngx_feature_path=
  48. ngx_feature_libs=
  49. ngx_feature_test="int kq;
  50. struct kevent kev;
  51. struct timespec ts;
  52. struct timeval tv, tv0;
  53. kq = kqueue();
  54. ts.tv_sec = 0;
  55. ts.tv_nsec = 999000000;
  56. gettimeofday(&tv, 0);
  57. kevent(kq, NULL, 0, &kev, 1, &ts);
  58. gettimeofday(&tv0, 0);
  59. timersub(&tv0, &tv, &tv);
  60. if (tv.tv_sec * 1000000 + tv.tv_usec < 900000) return 1;"
  61. . auto/feature
  62. # sendfile()
  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