freebsd 2.6 KB

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