freebsd 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 1100093 ]; then
  31. echo " + sendfile()'s SF_NODISKIO found"
  32. have=NGX_HAVE_SENDFILE_NODISKIO . 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_LOWAT
  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. # cpuset_setaffinity()
  68. if [ $version -ge 701000 ]; then
  69. echo " + cpuset_setaffinity() found"
  70. have=NGX_HAVE_CPUSET_SETAFFINITY . auto/have
  71. fi