s3:configure: add Darwin sendfile() test
authorBjörn Jacke <bj@sernet.de>
Fri, 29 Jun 2012 18:13:57 +0000 (20:13 +0200)
committerBjörn Jacke <bj@sernet.de>
Thu, 26 Jul 2012 13:18:30 +0000 (15:18 +0200)
source3/configure.in

index 6a26038d68881d3843c83876128faea73303116b..bd21db916dbd0fb4fe00eab5bb6ad69f796d2ecc 100644 (file)
@@ -5649,7 +5649,39 @@ samba_cv_HAVE_SENDFILE=yes,samba_cv_HAVE_SENDFILE=no)])
                AC_MSG_RESULT(no);
        fi
        ;;
+       *darwin*)
+               AC_CACHE_CHECK([for Darwin sendfile support],
+                       samba_cv_HAVE_SENDFILE,
+                       [
+                       AC_TRY_LINK([
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/uio.h>
+                       ],
+                       [
+       int fromfd, tofd, ret;
+       off_t offset, nwritten;
+       struct sf_hdtr hdr;
+       struct iovec hdtrl;
+       hdr.headers = &hdtrl;
+       hdr.hdr_cnt = 1;
+       hdr.trailers = (void *)0;
+       hdr.trl_cnt = 0;
+       hdtrl.iov_base = (void *)0;
+       hdtrl.iov_len = 0;
+       ret = sendfile(fromfd, tofd, offset, &nwritten, &hdr, 0);
+                       ],
+                       samba_cv_HAVE_SENDFILE=yes,
+                       samba_cv_HAVE_SENDFILE=no)])
 
+       if test x"$samba_cv_HAVE_SENDFILE" = x"yes"; then
+               AC_DEFINE(HAVE_SENDFILE,1,[Whether sendfile() support is available])
+               AC_DEFINE(DARWIN_SENDFILE_API,1,[Whether the Darwin sendfile() API is available])
+               AC_DEFINE(WITH_SENDFILE,1,[Whether sendfile() support should be included])
+       else
+               AC_MSG_RESULT(no);
+       fi
+       ;;
        *hpux*|*osf*)
                AC_CACHE_CHECK([for osf/hpux sendfile support],samba_cv_HAVE_SENDFILE,[
                AC_TRY_LINK([\