features 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. # Copyright (C) Igor Sysoev
  2. NGX_USER=${NGX_USER:-nobody}
  3. if [ -z "$NGX_GROUP" ]; then
  4. if [ $NGX_USER = nobody ]; then
  5. if grep nobody /etc/group 2>&1 >/dev/null; then
  6. echo "checking for nobody group ... found"
  7. NGX_GROUP=nobody
  8. else
  9. echo "checking for nobody group ... not found"
  10. if grep nogroup /etc/group 2>&1 >/dev/null; then
  11. echo "checking for nogroup group ... found"
  12. NGX_GROUP=nogroup
  13. else
  14. echo "checking for nogroup group ... not found"
  15. NGX_GROUP=nobody
  16. fi
  17. fi
  18. else
  19. NGX_GROUP=$NGX_USER
  20. fi
  21. fi
  22. ngx_feature="poll()"
  23. ngx_feature_name=
  24. ngx_feature_run=no
  25. ngx_feature_incs="#include <poll.h>"
  26. ngx_feature_path=
  27. ngx_feature_libs=
  28. ngx_feature_test="int n, dp; struct pollfd pl;
  29. dp = 0;
  30. pl.fd = 0;
  31. pl.events = 0;
  32. pl.revents = 0;
  33. n = poll(&pl, 1, 0)"
  34. . auto/feature
  35. if [ $ngx_found = no ]; then
  36. EVENT_POLL=NONE
  37. fi
  38. ngx_feature="/dev/poll"
  39. ngx_feature_name="NGX_HAVE_DEVPOLL"
  40. ngx_feature_run=no
  41. ngx_feature_incs="#include <sys/devpoll.h>"
  42. ngx_feature_path=
  43. ngx_feature_libs=
  44. ngx_feature_test="int n, dp; struct dvpoll dvp;
  45. dp = 0;
  46. dvp.dp_fds = NULL;
  47. dvp.dp_nfds = 0;
  48. dvp.dp_timeout = 0;
  49. n = ioctl(dp, DP_POLL, &dvp)"
  50. . auto/feature
  51. if [ $ngx_found = yes ]; then
  52. CORE_SRCS="$CORE_SRCS $DEVPOLL_SRCS"
  53. EVENT_MODULES="$EVENT_MODULES $DEVPOLL_MODULE"
  54. EVENT_FOUND=YES
  55. fi
  56. if test -z "$NGX_KQUEUE_CHECKED"; then
  57. ngx_feature="kqueue"
  58. ngx_feature_name="NGX_HAVE_KQUEUE"
  59. ngx_feature_run=no
  60. ngx_feature_incs="#include <sys/event.h>"
  61. ngx_feature_path=
  62. ngx_feature_libs=
  63. ngx_feature_test="int kq; kq = kqueue()"
  64. . auto/feature
  65. if [ $ngx_found = yes ]; then
  66. have=NGX_HAVE_CLEAR_EVENT . auto/have
  67. EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
  68. CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
  69. EVENT_FOUND=YES
  70. ngx_feature="kqueue's NOTE_LOWAT"
  71. ngx_feature_name="NGX_HAVE_LOWAT_EVENT"
  72. ngx_feature_run=no
  73. ngx_feature_incs="#include <sys/event.h>"
  74. ngx_feature_path=
  75. ngx_feature_libs=
  76. ngx_feature_test="struct kevent kev;
  77. kev.fflags = NOTE_LOWAT;"
  78. . auto/feature
  79. ngx_feature="kqueue's EVFILT_TIMER"
  80. ngx_feature_name="NGX_HAVE_TIMER_EVENT"
  81. ngx_feature_run=yes
  82. ngx_feature_incs="#include <sys/event.h>
  83. #include <sys/time.h>"
  84. ngx_feature_path=
  85. ngx_feature_libs=
  86. ngx_feature_test="int kq;
  87. struct kevent kev;
  88. struct timespec ts;
  89. if ((kq = kqueue()) == -1) return 1;
  90. kev.ident = 0;
  91. kev.filter = EVFILT_TIMER;
  92. kev.flags = EV_ADD|EV_ENABLE;
  93. kev.fflags = 0;
  94. kev.data = 1000;
  95. kev.udata = 0;
  96. ts.tv_sec = 0;
  97. ts.tv_nsec = 0;
  98. if (kevent(kq, &kev, 1, &kev, 1, &ts) == -1) return 1;
  99. if (kev.flags & EV_ERROR) return 1;"
  100. . auto/feature
  101. if [ "$NGX_SYSTEM" = "Darwin" ]; then
  102. ngx_feature="Darwin 64-bit kqueue millisecond timeout bug"
  103. ngx_feature_name=NGX_DARWIN_KEVENT_BUG
  104. ngx_feature_run=bug
  105. ngx_feature_incs="#include <sys/event.h>
  106. #include <sys/time.h>"
  107. ngx_feature_path=
  108. ngx_feature_libs=
  109. ngx_feature_test="int kq;
  110. struct kevent kev;
  111. struct timespec ts;
  112. struct timeval tv, tv0;
  113. kq = kqueue();
  114. ts.tv_sec = 0;
  115. ts.tv_nsec = 999000000;
  116. gettimeofday(&tv, 0);
  117. kevent(kq, NULL, 0, &kev, 1, &ts);
  118. gettimeofday(&tv0, 0);
  119. timersub(&tv0, &tv, &tv);
  120. if (tv.tv_sec * 1000000 + tv.tv_usec < 900000) return 1;"
  121. . auto/feature
  122. fi
  123. fi
  124. fi
  125. if [ "$NGX_SYSTEM" = "NetBSD" ]; then
  126. # NetBSD 2.0 incompatibly defines kevent.udata as "intptr_t"
  127. cat << END >> $NGX_AUTO_CONFIG_H
  128. #define NGX_KQUEUE_UDATA_T
  129. END
  130. else
  131. cat << END >> $NGX_AUTO_CONFIG_H
  132. #define NGX_KQUEUE_UDATA_T (void *)
  133. END
  134. fi
  135. ngx_feature="crypt()"
  136. ngx_feature_name=
  137. ngx_feature_run=no
  138. ngx_feature_incs=
  139. ngx_feature_path=
  140. ngx_feature_libs=
  141. ngx_feature_test="crypt(\"test\", \"salt\");"
  142. . auto/feature
  143. if [ $ngx_found = no ]; then
  144. ngx_feature="crypt() in libcrypt"
  145. ngx_feature_name=
  146. ngx_feature_run=no
  147. ngx_feature_incs=
  148. ngx_feature_path=
  149. ngx_feature_libs=-lcrypt
  150. . auto/feature
  151. if [ $ngx_found = yes ]; then
  152. CRYPT_LIB="-lcrypt"
  153. fi
  154. fi