nginx 0.1.19
[nginx-catap.git] / auto / os / freebsd
blobdfb547f3bb2cd3c2bd6effcd30e62f012e62f1e1
2 # Copyright (C) Igor Sysoev
5 cat << END >> $NGX_AUTO_HEADERS_H
7 #ifndef NGX_FREEBSD
8 #define NGX_FREEBSD  1
9 #endif
11 END
14 CORE_INCS="$UNIX_INCS"
15 CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS"
16 CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"
18 ngx_spacer='
22 # __FreeBSD_version and sysctl kern.osreldate are the best ways
23 # to determine whether some capability exists and is safe to use.
24 # __FreeBSD_version is used for the testing of the build enviroment.
25 # sysctl kern.osreldate is used for the testing of the kernel capabilities.
27 version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
28          | sed -e 's/^.* \(.*\)$/\1/'`
30 osreldate=`/sbin/sysctl -n kern.osreldate`
33 # setproctitle() in libutil
35 if [ \( $version -ge 500000 -a $version -lt 500012 \) \
36      -o $version -lt 410002 ]
37 then
38     echo " + setproctitle() in libutil"
40     CORE_LIBS="$CORE_LIBS -lutil"
43 # sendfile
45 if [ $osreldate -gt 300007 ]; then
46     echo " + using sendfile()"
48     have=NGX_HAVE_SENDFILE . auto/have
49     CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS"
53 # kqueue
55 if [ \( $osreldate -lt 500000 -a $osreldate -ge 410000 \) \
56      -o $osreldate -ge 500011 ]
57 then
58     echo " + using kqueue"
60     have=NGX_HAVE_KQUEUE . auto/have
61     have=NGX_HAVE_CLEAR_EVENT . auto/have
62     EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
63     CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
64     EVENT_FOUND=YES
68 NGX_KQUEUE_CHECKED=YES
71 # kqueue's NOTE_LAWAT
73 if [ \( $version -lt 500000 -a $version -ge 430000 \) \
74      -o $version -ge 500018 ]
75 then
76     echo " + using kqueue's NOTE_LOWAT"
77     have=NGX_HAVE_LOWAT_EVENT . auto/have
81 if [ $USE_THREADS = "rfork" ]; then
83     echo " + using rfork()"
85 #    # kqueue's EVFILT_SIGNAL is safe
87 #    if [ $version -gt 460101 ]; then
88 #        echo " + kqueue's EVFILT_SIGNAL is safe"
89 #        have=NGX_HAVE_SAFE_EVFILT_SIGNAL . auto/have
90 #    else
91 #        echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this"
92 #        echo "FreeBSD version, so --with-threads=rfork could not be used"
93 #        echo
95 #        exit 1
96 #    fi
100 if [ $EVENT_AIO = YES ]; then
101     if [ \( $version -lt 500000 -a $version -ge 430000 \) \
102          -o $version -ge 500014 ]
103     then
104         have=NGX_HAVE_AIO . auto/have
105         EVENT_MODULES="$EVENT_MODULES $AIO_MODULE"
106         CORE_SRCS="$CORE_SRCS $AIO_SRCS"
107     else
109 cat << END
111 $0: error: the kqueue does not support AIO on this FreeBSD version
115         exit 1
116     fi