Update and clean Tomato RAF files
[tomato.git] / release / src / router / nginx / auto / os / freebsd
blob6aa823f92507655d95ed25b5a8f306a168ec486c
2 # Copyright (C) Igor Sysoev
3 # Copyright (C) Nginx, Inc.
6 have=NGX_FREEBSD . auto/have_headers
8 CORE_INCS="$UNIX_INCS"
9 CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS"
10 CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"
12 ngx_spacer='
16 # __FreeBSD_version and sysctl kern.osreldate are the best ways
17 # to determine whether some capability exists and is safe to use.
18 # __FreeBSD_version is used for the testing of the build environment.
19 # sysctl kern.osreldate is used for the testing of the kernel capabilities.
21 version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
22          | sed -e 's/^.* \(.*\)$/\1/'`
24 osreldate=`/sbin/sysctl -n kern.osreldate`
27 # setproctitle() in libutil
29 if [ \( $version -ge 500000 -a $version -lt 500012 \) \
30      -o $version -lt 410002 ]
31 then
32     echo " + setproctitle() in libutil"
34     CORE_LIBS="$CORE_LIBS -lutil"
35     NGX_SETPROCTITLE_LIB="-lutil"
38 # sendfile
40 if [ $osreldate -gt 300007 ]; then
41     echo " + sendfile() found"
43     have=NGX_HAVE_SENDFILE . auto/have
44     CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS"
47 if [ $osreldate -gt 502103 ]; then
48     echo " + sendfile()'s SF_NODISKIO found"
50     have=NGX_HAVE_AIO_SENDFILE . auto/have
53 # POSIX semaphores
54 # http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545
56 if [ $osreldate -ge 701106 ]; then
57     echo " + POSIX semaphores should work"
58 else
59     have=NGX_HAVE_POSIX_SEM . auto/nohave
63 # kqueue
65 if [ \( $osreldate -lt 500000 -a $osreldate -ge 410000 \) \
66      -o $osreldate -ge 500011 ]
67 then
68     echo " + kqueue found"
70     have=NGX_HAVE_KQUEUE . auto/have
71     have=NGX_HAVE_CLEAR_EVENT . auto/have
72     EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
73     CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
74     EVENT_FOUND=YES
78 NGX_KQUEUE_CHECKED=YES
81 # kqueue's NOTE_LAWAT
83 if [ \( $version -lt 500000 -a $version -ge 430000 \) \
84      -o $version -ge 500018 ]
85 then
86     echo " + kqueue's NOTE_LOWAT found"
87     have=NGX_HAVE_LOWAT_EVENT . auto/have
90 # kqueue's EVFILT_TIMER
92 if [ \( $version -lt 500000 -a $version -ge 440001 \) \
93      -o $version -ge 500023 ]
94 then
95     echo " + kqueue's EVFILT_TIMER found"
96     have=NGX_HAVE_TIMER_EVENT . auto/have
100 if [ $USE_THREADS = "rfork" ]; then
102     echo " + using rfork()"
104 #    # kqueue's EVFILT_SIGNAL is safe
106 #    if [ $version -gt 460101 ]; then
107 #        echo " + kqueue's EVFILT_SIGNAL is safe"
108 #        have=NGX_HAVE_SAFE_EVFILT_SIGNAL . auto/have
109 #    else
110 #        echo "$0: error: the kqueue's EVFILT_SIGNAL is unsafe on this"
111 #        echo "FreeBSD version, so --with-threads=rfork could not be used"
112 #        echo
114 #        exit 1
115 #    fi
119 if [ $EVENT_AIO = YES ]; then
120     if [ \( $version -lt 500000 -a $version -ge 430000 \) \
121          -o $version -ge 500014 ]
122     then
123         have=NGX_HAVE_AIO . auto/have
124         EVENT_MODULES="$EVENT_MODULES $AIO_MODULE"
125         CORE_SRCS="$CORE_SRCS $AIO_SRCS"
126     else
128 cat << END
130 $0: error: the kqueue does not support AIO on this FreeBSD version
134         exit 1
135     fi
139 # cpuset_setaffinity()
141 if [ $version -ge 701000 ]; then
142     echo " + cpuset_setaffinity() found"
143     have=NGX_HAVE_CPUSET_SETAFFINITY . auto/have