blob: 20985294f50628d87a0b0569a543a93eecd11c14 [file] [log] [blame]
Igor Sysoeva8fa0a62003-11-25 20:44:56 +00001
Igor Sysoevff8da912004-09-29 16:00:49 +00002# Copyright (C) Igor Sysoev
3
4
Igor Sysoev899b44e2005-05-12 14:58:06 +00005have=NGX_FREEBSD . auto/have_headers
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00006
Igor Sysoeva8fa0a62003-11-25 20:44:56 +00007CORE_INCS="$UNIX_INCS"
8CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS"
Igor Sysoev5c8c52f2004-01-23 09:26:18 +00009CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000010
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000011ngx_spacer='
12'
Igor Sysoev24b56c92004-03-10 17:55:19 +000013
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000014
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000015# __FreeBSD_version and sysctl kern.osreldate are the best ways
16# to determine whether some capability exists and is safe to use.
Igor Sysoeve2f30be2006-09-06 19:07:31 +000017# __FreeBSD_version is used for the testing of the build environment.
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000018# sysctl kern.osreldate is used for the testing of the kernel capabilities.
Igor Sysoev9139cd22004-02-17 17:53:12 +000019
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000020version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
21 | sed -e 's/^.* \(.*\)$/\1/'`
22
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000023osreldate=`/sbin/sysctl -n kern.osreldate`
24
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000025
Igor Sysoev48fef662004-02-24 17:31:46 +000026# setproctitle() in libutil
27
28if [ \( $version -ge 500000 -a $version -lt 500012 \) \
29 -o $version -lt 410002 ]
30then
31 echo " + setproctitle() in libutil"
32
33 CORE_LIBS="$CORE_LIBS -lutil"
Igor Sysoev899b44e2005-05-12 14:58:06 +000034 NGX_SETPROCTITLE_LIB="-lutil"
Igor Sysoev48fef662004-02-24 17:31:46 +000035fi
36
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000037# sendfile
38
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000039if [ $osreldate -gt 300007 ]; then
Igor Sysoevc2068d02005-10-19 12:33:58 +000040 echo " + sendfile() found"
Igor Sysoev48fef662004-02-24 17:31:46 +000041
Igor Sysoevf6906042004-11-25 16:17:31 +000042 have=NGX_HAVE_SENDFILE . auto/have
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000043 CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS"
44fi
45
Igor Sysoevbfff0342009-08-30 09:52:39 +000046if [ $osreldate -gt 502103 ]; then
47 echo " + sendfile()'s SF_NODISKIO found"
48
49 have=NGX_HAVE_AIO_SENDFILE . auto/have
50fi
51
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000052
53# kqueue
54
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000055if [ \( $osreldate -lt 500000 -a $osreldate -ge 410000 \) \
56 -o $osreldate -ge 500011 ]
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000057then
Igor Sysoevc2068d02005-10-19 12:33:58 +000058 echo " + kqueue found"
Igor Sysoev48fef662004-02-24 17:31:46 +000059
Igor Sysoevf6906042004-11-25 16:17:31 +000060 have=NGX_HAVE_KQUEUE . auto/have
61 have=NGX_HAVE_CLEAR_EVENT . auto/have
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000062 EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
Igor Sysoev6881bfb2004-03-30 06:27:36 +000063 CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
Igor Sysoeva4b16df2004-02-02 21:19:52 +000064 EVENT_FOUND=YES
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000065fi
66
Igor Sysoev1ebfead2005-02-16 13:40:36 +000067
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000068NGX_KQUEUE_CHECKED=YES
69
Igor Sysoeva8fa0a62003-11-25 20:44:56 +000070
71# kqueue's NOTE_LAWAT
72
73if [ \( $version -lt 500000 -a $version -ge 430000 \) \
74 -o $version -ge 500018 ]
75then
Igor Sysoevc2068d02005-10-19 12:33:58 +000076 echo " + kqueue's NOTE_LOWAT found"
Igor Sysoevf6906042004-11-25 16:17:31 +000077 have=NGX_HAVE_LOWAT_EVENT . auto/have
Igor Sysoeva4b16df2004-02-02 21:19:52 +000078fi
79
Igor Sysoevc2068d02005-10-19 12:33:58 +000080# kqueue's EVFILT_TIMER
81
82if [ \( $version -lt 500000 -a $version -ge 440001 \) \
83 -o $version -ge 500023 ]
84then
85 echo " + kqueue's EVFILT_TIMER found"
86 have=NGX_HAVE_TIMER_EVENT . auto/have
87fi
88
Igor Sysoeva4b16df2004-02-02 21:19:52 +000089
Igor Sysoev32fcd5c2004-07-05 06:55:54 +000090if [ $USE_THREADS = "rfork" ]; then
91
92 echo " + using rfork()"
93
Igor Sysoevff8da912004-09-29 16:00:49 +000094# # kqueue's EVFILT_SIGNAL is safe
95#
96# if [ $version -gt 460101 ]; then
97# echo " + kqueue's EVFILT_SIGNAL is safe"
Igor Sysoevf6906042004-11-25 16:17:31 +000098# have=NGX_HAVE_SAFE_EVFILT_SIGNAL . auto/have
Igor Sysoevff8da912004-09-29 16:00:49 +000099# else
100# echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this"
101# echo "FreeBSD version, so --with-threads=rfork could not be used"
102# echo
103#
104# exit 1
105# fi
Igor Sysoev32fcd5c2004-07-05 06:55:54 +0000106fi
107
108
Igor Sysoeva4b16df2004-02-02 21:19:52 +0000109if [ $EVENT_AIO = YES ]; then
Igor Sysoevd43bee82004-11-20 19:52:20 +0000110 if [ \( $version -lt 500000 -a $version -ge 430000 \) \
111 -o $version -ge 500014 ]
112 then
Igor Sysoevf6906042004-11-25 16:17:31 +0000113 have=NGX_HAVE_AIO . auto/have
Igor Sysoevd43bee82004-11-20 19:52:20 +0000114 EVENT_MODULES="$EVENT_MODULES $AIO_MODULE"
115 CORE_SRCS="$CORE_SRCS $AIO_SRCS"
116 else
117
118cat << END
119
120$0: error: the kqueue does not support AIO on this FreeBSD version
121
122END
123
124 exit 1
125 fi
Igor Sysoeva8fa0a62003-11-25 20:44:56 +0000126fi