1
2# Copyright (C) Igor Sysoev
3# Copyright (C) Nginx, Inc.
4
5
6have=NGX_FREEBSD . auto/have_headers
7
8CORE_INCS="$UNIX_INCS"
9CORE_DEPS="$UNIX_DEPS $FREEBSD_DEPS"
10CORE_SRCS="$UNIX_SRCS $FREEBSD_SRCS"
11
12ngx_spacer='
13'
14
15
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.
20
21version=`grep "#define __FreeBSD_version" /usr/include/osreldate.h \
22         | sed -e 's/^.* \(.*\)$/\1/'`
23
24osreldate=`/sbin/sysctl -n kern.osreldate`
25
26
27# setproctitle() in libutil
28
29if [ \( $version -ge 500000 -a $version -lt 500012 \) \
30     -o $version -lt 410002 ]
31then
32    echo " + setproctitle() in libutil"
33
34    CORE_LIBS="$CORE_LIBS -lutil"
35    NGX_SETPROCTITLE_LIB="-lutil"
36fi
37
38# sendfile
39
40if [ $osreldate -gt 300007 ]; then
41    echo " + sendfile() found"
42
43    have=NGX_HAVE_SENDFILE . auto/have
44    CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS"
45fi
46
47if [ $NGX_FILE_AIO = YES ]; then
48    if [ $osreldate -gt 502103 ]; then
49        echo " + sendfile()'s SF_NODISKIO found"
50
51        have=NGX_HAVE_AIO_SENDFILE . auto/have
52    fi
53fi
54
55# POSIX semaphores
56# http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127545
57
58if [ $osreldate -ge 701106 ]; then
59    echo " + POSIX semaphores should work"
60else
61    have=NGX_HAVE_POSIX_SEM . auto/nohave
62fi
63
64
65# kqueue
66
67if [ \( $osreldate -lt 500000 -a $osreldate -ge 410000 \) \
68     -o $osreldate -ge 500011 ]
69then
70    echo " + kqueue found"
71
72    have=NGX_HAVE_KQUEUE . auto/have
73    have=NGX_HAVE_CLEAR_EVENT . auto/have
74    EVENT_MODULES="$EVENT_MODULES $KQUEUE_MODULE"
75    CORE_SRCS="$CORE_SRCS $KQUEUE_SRCS"
76    EVENT_FOUND=YES
77fi
78
79
80NGX_KQUEUE_CHECKED=YES
81
82
83# kqueue's NOTE_LOWAT
84
85if [ \( $version -lt 500000 -a $version -ge 430000 \) \
86     -o $version -ge 500018 ]
87then
88    echo " + kqueue's NOTE_LOWAT found"
89    have=NGX_HAVE_LOWAT_EVENT . auto/have
90fi
91
92# kqueue's EVFILT_TIMER
93
94if [ \( $version -lt 500000 -a $version -ge 440001 \) \
95     -o $version -ge 500023 ]
96then
97    echo " + kqueue's EVFILT_TIMER found"
98    have=NGX_HAVE_TIMER_EVENT . auto/have
99fi
100
101
102# cpuset_setaffinity()
103
104if [ $version -ge 701000 ]; then
105    echo " + cpuset_setaffinity() found"
106    have=NGX_HAVE_CPUSET_SETAFFINITY . auto/have
107fi
108