freebsd 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. # Copyright (C) Igor Sysoev
  2. # Copyright (C) Nginx, Inc.
  3. have=NGX_FREEBSD . auto/have_headers
  4. CORE_INCS="$UNIX_INCS"
  5. CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS"
  6. CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"
  7. ngx_spacer='
  8. '
  9. # __FreeBSD_version and sysctl kern.osreldate are the best ways
  10. # to determine whether some capability exists and is safe to use.
  11. # __FreeBSD_version is used for the testing of the build environment.
  12. # sysctl kern.osreldate is used for the testing of the kernel capabilities.
  13. version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
  14. | sed -e 's/^.* \(.*\)$/\1/'`
  15. osreldate=`/sbin/sysctl -n kern.osreldate`
  16. # setproctitle() in libutil
  17. if [ \( $version -ge 500000 -a $version -lt 500012 \) \
  18. -o $version -lt 410002 ]
  19. then
  20. echo " + setproctitle() in libutil"
  21. CORE_LIBS="$CORE_LIBS -lutil"
  22. NGX_SETPROCTITLE_LIB="-lutil"
  23. fi
  24. # sendfile
  25. if [ $osreldate -gt 300007 ]; then
  26. echo " + sendfile() found"
  27. have=NGX_HAVE_SENDFILE . auto/have
  28. CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS"
  29. fi
  30. if [ $osreldate -gt 502103 ]; then
  31. echo " + sendfile()'s SF_NODISKIO found"
  32. have=NGX_HAVE_AIO_SENDFILE . auto/have
  33. fi
  34. # POSIX semaphores
  35. # http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545
  36. if [ $osreldate -ge 701106 ]; then
  37. echo " + POSIX semaphores should work"
  38. else
  39. have=NGX_HAVE_POSIX_SEM . auto/nohave
  40. fi
  41. # kqueue
  42. if [ \( $osreldate -lt 500000 -a $osreldate -ge 410000 \) \
  43. -o $osreldate -ge 500011 ]
  44. then
  45. echo " + kqueue found"
  46. have=NGX_HAVE_KQUEUE . auto/have
  47. have=NGX_HAVE_CLEAR_EVENT . auto/have
  48. EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
  49. CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
  50. EVENT_FOUND=YES
  51. fi
  52. NGX_KQUEUE_CHECKED=YES
  53. # kqueue's NOTE_LAWAT
  54. if [ \( $version -lt 500000 -a $version -ge 430000 \) \
  55. -o $version -ge 500018 ]
  56. then
  57. echo " + kqueue's NOTE_LOWAT found"
  58. have=NGX_HAVE_LOWAT_EVENT . auto/have
  59. fi
  60. # kqueue's EVFILT_TIMER
  61. if [ \( $version -lt 500000 -a $version -ge 440001 \) \
  62. -o $version -ge 500023 ]
  63. then
  64. echo " + kqueue's EVFILT_TIMER found"
  65. have=NGX_HAVE_TIMER_EVENT . auto/have
  66. fi
  67. if [ $USE_THREADS = "rfork" ]; then
  68. echo " + using rfork()"
  69. # # kqueue's EVFILT_SIGNAL is safe
  70. #
  71. # if [ $version -gt 460101 ]; then
  72. # echo " + kqueue's EVFILT_SIGNAL is safe"
  73. # have=NGX_HAVE_SAFE_EVFILT_SIGNAL . auto/have
  74. # else
  75. # echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this"
  76. # echo "FreeBSD version, so --with-threads=rfork could not be used"
  77. # echo
  78. #
  79. # exit 1
  80. # fi
  81. fi
  82. if [ $EVENT_AIO = YES ]; then
  83. if [ \( $version -lt 500000 -a $version -ge 430000 \) \
  84. -o $version -ge 500014 ]
  85. then
  86. have=NGX_HAVE_AIO . auto/have
  87. EVENT_MODULES="$EVENT_MODULES $AIO_MODULE"
  88. CORE_SRCS="$CORE_SRCS $AIO_SRCS"
  89. else
  90. cat << END
  91. $0: error: the kqueue does not support AIO on this FreeBSD version
  92. END
  93. exit 1
  94. fi
  95. fi