10Sigor@sysoev.ru 20Sigor@sysoev.ru# Copyright (C) Igor Sysoev 30Sigor@sysoev.ru# Copyright (C) NGINX, Inc. 40Sigor@sysoev.ru 50Sigor@sysoev.ru 60Sigor@sysoev.ruNXT_HAVE_LINUX_SENDFILE=NO 70Sigor@sysoev.ruNXT_HAVE_FREEBSD_SENDFILE=NO 80Sigor@sysoev.ruNXT_HAVE_MACOSX_SENDFILE=NO 90Sigor@sysoev.ruNXT_HAVE_SOLARIS_SENDFILEV=NO 100Sigor@sysoev.ruNXT_HAVE_AIX_SEND_FILE=NO 110Sigor@sysoev.ruNXT_HAVE_HPUX_SENDFILE=NO 120Sigor@sysoev.ru 130Sigor@sysoev.ru 140Sigor@sysoev.ru# Linux sendfile(). 150Sigor@sysoev.ru 160Sigor@sysoev.runxt_feature="Linux sendfile()" 170Sigor@sysoev.runxt_feature_name=NXT_HAVE_LINUX_SENDFILE 180Sigor@sysoev.runxt_feature_test="#include <sys/sendfile.h> 190Sigor@sysoev.ru 20*2228Sa.clayton@nginx.com int main(void) { 210Sigor@sysoev.ru off_t offset; 220Sigor@sysoev.ru 230Sigor@sysoev.ru sendfile(-1, -1, &offset, 0); 240Sigor@sysoev.ru return 0; 250Sigor@sysoev.ru }" 260Sigor@sysoev.ru. auto/feature 270Sigor@sysoev.ru 280Sigor@sysoev.ruif [ $nxt_found = yes ]; then 290Sigor@sysoev.ru NXT_HAVE_LINUX_SENDFILE=YES 300Sigor@sysoev.rufi 310Sigor@sysoev.ru 320Sigor@sysoev.ru 330Sigor@sysoev.ruif [ $nxt_found = no ]; then 340Sigor@sysoev.ru # FreeBSD sendfile(). 350Sigor@sysoev.ru 360Sigor@sysoev.ru nxt_feature="FreeBSD sendfile()" 370Sigor@sysoev.ru nxt_feature_name=NXT_HAVE_FREEBSD_SENDFILE 380Sigor@sysoev.ru nxt_feature_run= 390Sigor@sysoev.ru nxt_feature_incs= 400Sigor@sysoev.ru nxt_feature_libs= 410Sigor@sysoev.ru nxt_feature_test="#include <sys/types.h> 420Sigor@sysoev.ru #include <sys/socket.h> 430Sigor@sysoev.ru #include <sys/uio.h> 440Sigor@sysoev.ru #include <stdlib.h> 450Sigor@sysoev.ru 46*2228Sa.clayton@nginx.com int main(void) { 470Sigor@sysoev.ru off_t sent; 480Sigor@sysoev.ru 491413Smax.romanov@nginx.com sendfile(-1, -1, 0, 0, NULL, &sent, 0); 500Sigor@sysoev.ru return 0; 510Sigor@sysoev.ru }" 520Sigor@sysoev.ru . auto/feature 530Sigor@sysoev.ru 540Sigor@sysoev.ru if [ $nxt_found = yes ]; then 550Sigor@sysoev.ru NXT_HAVE_FREEBSD_SENDFILE=YES 560Sigor@sysoev.ru fi 570Sigor@sysoev.rufi 580Sigor@sysoev.ru 590Sigor@sysoev.ru 601413Smax.romanov@nginx.comif [ $nxt_found = no ]; then 611413Smax.romanov@nginx.com 621413Smax.romanov@nginx.com # MacOSX sendfile(). 631413Smax.romanov@nginx.com 641413Smax.romanov@nginx.com nxt_feature="MacOSX sendfile()" 651413Smax.romanov@nginx.com nxt_feature_name=NXT_HAVE_MACOSX_SENDFILE 661413Smax.romanov@nginx.com nxt_feature_libs= 671413Smax.romanov@nginx.com nxt_feature_test="#include <sys/types.h> 681413Smax.romanov@nginx.com #include <sys/socket.h> 691413Smax.romanov@nginx.com #include <sys/uio.h> 701413Smax.romanov@nginx.com #include <stdlib.h> 711413Smax.romanov@nginx.com 72*2228Sa.clayton@nginx.com int main(void) { 731413Smax.romanov@nginx.com off_t sent; 741413Smax.romanov@nginx.com 751413Smax.romanov@nginx.com sendfile(-1, -1, 0, &sent, NULL, 0); 761413Smax.romanov@nginx.com return 0; 771413Smax.romanov@nginx.com }" 781413Smax.romanov@nginx.com . auto/feature 791413Smax.romanov@nginx.com 801413Smax.romanov@nginx.com if [ $nxt_found = yes ]; then 811413Smax.romanov@nginx.com NXT_HAVE_MACOSX_SENDFILE=YES 821413Smax.romanov@nginx.com fi 831413Smax.romanov@nginx.comfi 841413Smax.romanov@nginx.com 851413Smax.romanov@nginx.com 861413Smax.romanov@nginx.comif [ $nxt_found = no ]; then 871577Smax.romanov@nginx.com # No supported sendfile() found. Using our replacement. 881577Smax.romanov@nginx.com nxt_found=yes 891413Smax.romanov@nginx.comfi 901413Smax.romanov@nginx.com 911413Smax.romanov@nginx.com 920Sigor@sysoev.ruNXT_LIBSENDFILE= 930Sigor@sysoev.ru 940Sigor@sysoev.ruif [ $nxt_found = no ]; then 950Sigor@sysoev.ru 960Sigor@sysoev.ru # Solaris 8 sendfilev(). 970Sigor@sysoev.ru 980Sigor@sysoev.ru nxt_feature="Solaris sendfilev()" 990Sigor@sysoev.ru nxt_feature_name=NXT_HAVE_SOLARIS_SENDFILEV 1000Sigor@sysoev.ru nxt_feature_libs="-lsendfile" 1010Sigor@sysoev.ru nxt_feature_test="#include <sys/sendfile.h> 1020Sigor@sysoev.ru 103*2228Sa.clayton@nginx.com int main(void) { 1040Sigor@sysoev.ru size_t sent; 1050Sigor@sysoev.ru struct sendfilevec vec; 1060Sigor@sysoev.ru 1070Sigor@sysoev.ru sendfilev(-1, &vec, 0, &sent); 1080Sigor@sysoev.ru return 0; 1090Sigor@sysoev.ru }" 1100Sigor@sysoev.ru . auto/feature 1110Sigor@sysoev.ru 1120Sigor@sysoev.ru if [ $nxt_found = yes ]; then 1130Sigor@sysoev.ru NXT_HAVE_SOLARIS_SENDFILEV=YES 1140Sigor@sysoev.ru NXT_LIBSENDFILE=$nxt_feature_libs 1150Sigor@sysoev.ru fi 1160Sigor@sysoev.rufi 1170Sigor@sysoev.ru 1180Sigor@sysoev.ru 1190Sigor@sysoev.ruif [ $nxt_found = no ]; then 1200Sigor@sysoev.ru 1210Sigor@sysoev.ru # AIX send_file(). 1220Sigor@sysoev.ru 1230Sigor@sysoev.ru nxt_feature="AIX send_file()" 1240Sigor@sysoev.ru nxt_feature_name=NXT_HAVE_AIX_SEND_FILE 1250Sigor@sysoev.ru nxt_feature_test="#include <sys/socket.h> 1260Sigor@sysoev.ru 127*2228Sa.clayton@nginx.com int main(void) { 1280Sigor@sysoev.ru int s; 1290Sigor@sysoev.ru struct sf_parms sf_iobuf; 1300Sigor@sysoev.ru 1310Sigor@sysoev.ru send_file(&s, &sf_iobuf, 0); 1320Sigor@sysoev.ru return 0; 1330Sigor@sysoev.ru }" 1340Sigor@sysoev.ru . auto/feature 1350Sigor@sysoev.ru 1360Sigor@sysoev.ru if [ $nxt_found = yes ]; then 1370Sigor@sysoev.ru NXT_HAVE_AIX_SEND_FILE=YES 1380Sigor@sysoev.ru fi 1390Sigor@sysoev.rufi 1400Sigor@sysoev.ru 1410Sigor@sysoev.ru 1420Sigor@sysoev.ruif [ $nxt_found = no ]; then 1430Sigor@sysoev.ru 1440Sigor@sysoev.ru # HP-UX sendfile(). 1450Sigor@sysoev.ru 1460Sigor@sysoev.ru nxt_feature="HP-UX sendfile()" 1470Sigor@sysoev.ru nxt_feature_name=NXT_HAVE_HPUX_SENDFILE 1480Sigor@sysoev.ru nxt_feature_libs= 1490Sigor@sysoev.ru nxt_feature_test="#include <sys/socket.h> 1500Sigor@sysoev.ru #include <stdlib.h> 1510Sigor@sysoev.ru 1520Sigor@sysoev.ru sbsize_t sendfile(int s, int fd, off_t offset, 1530Sigor@sysoev.ru bsize_t nbytes, const struct iovec *hdtrl, int flags); 1540Sigor@sysoev.ru 155*2228Sa.clayton@nginx.com int main(void) { 1560Sigor@sysoev.ru sendfile(-1, -1, 0, 0, NULL, 0); 1570Sigor@sysoev.ru return 0; 1580Sigor@sysoev.ru }" 1590Sigor@sysoev.ru . auto/feature 1600Sigor@sysoev.ru 1610Sigor@sysoev.ru if [ $nxt_found = yes ]; then 1620Sigor@sysoev.ru NXT_HAVE_HPUX_SENDFILE=YES 1630Sigor@sysoev.ru fi 1640Sigor@sysoev.rufi 165