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