freebsd 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 [ $NGX_FILE_AIO = YES ]; then
  31. if [ $osreldate -gt 502103 ]; then
  32. echo " + sendfile()'s SF_NODISKIO found"
  33. have=NGX_HAVE_AIO_SENDFILE . auto/have
  34. fi
  35. fi
  36. # POSIX semaphores
  37. # http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545
  38. if [ $osreldate -ge 701106 ]; then
  39. echo " + POSIX semaphores should work"
  40. else
  41. have=NGX_HAVE_POSIX_SEM . auto/nohave
  42. fi
  43. # kqueue
  44. if [ \( $osreldate -lt 500000 -a $osreldate -ge 410000 \) \
  45. -o $osreldate -ge 500011 ]
  46. then
  47. echo " + kqueue found"
  48. have=NGX_HAVE_KQUEUE . auto/have
  49. have=NGX_HAVE_CLEAR_EVENT . auto/have
  50. EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
  51. CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
  52. EVENT_FOUND=YES
  53. fi
  54. NGX_KQUEUE_CHECKED=YES
  55. # kqueue's NOTE_LOWAT
  56. if [ \( $version -lt 500000 -a $version -ge 430000 \) \
  57. -o $version -ge 500018 ]
  58. then
  59. echo " + kqueue's NOTE_LOWAT found"
  60. have=NGX_HAVE_LOWAT_EVENT . auto/have
  61. fi
  62. # kqueue's EVFILT_TIMER
  63. if [ \( $version -lt 500000 -a $version -ge 440001 \) \
  64. -o $version -ge 500023 ]
  65. then
  66. echo " + kqueue's EVFILT_TIMER found"
  67. have=NGX_HAVE_TIMER_EVENT . auto/have
  68. fi
  69. # cpuset_setaffinity()
  70. if [ $version -ge 701000 ]; then
  71. echo " + cpuset_setaffinity() found"
  72. have=NGX_HAVE_CPUSET_SETAFFINITY . auto/have
  73. fi