sendfile(*w->wfd, fd, &off, len) != len)
w->werr++;
} while (0);
-#elif defined(__sun)
-#ifdef HAVE_SENDFILEV
+#elif defined(__sun) && defined(HAVE_SENDFILEV)
do {
sendfilevec_t svvec[HTTP_HDR_MAX * 2 + 1];
size_t xferred = 0, expected = 0;
w->liov = 0;
w->niov = 0;
} while (0);
-#else
+#elif defined(__sun) && defined(HAVE_SENDFILE)
do {
if (WRK_Flush(w) == 0 &&
sendfile(*w->wfd, fd, &off, len) != len)
w->werr++;
} while (0);
-#endif
#else
#error Unknown sendfile() implementation
#endif
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
-AC_CHECK_HEADERS([sys/socket.h])
+AC_CHECK_HEADERS([sys/filio.h])
AC_CHECK_HEADERS([sys/mount.h])
+AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([sys/statvfs.h])
AC_CHECK_HEADERS([sys/vfs.h])
AC_CHECK_HEADERS([netinet/in.h])
AC_CHECK_FUNCS([pthread_mutex_isowned_np])
LIBS="${save_LIBS}"
-## This one is tricky, there are multiple versions
+# sendfile is tricky: there are multiple versions, and most of them
+# don't work.
case $target in
*-*-freebsd*)
AC_CACHE_CHECK([whether sendfile works],
[ac_cv_so_sendfile_works=yes],
[ac_cv_so_sendfile_works=no])
])
- if test "$ac_cv_so_sendfile_works" = yes; then
- AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works])
- fi
- ;;
+ ;;
+#*-*-solaris*)
+# save_LIBS="${LIBS}"
+# LIBS="${NET_LIBS}"
+# AC_CHECK_LIB(sendfile, sendfile)
+# AC_CHECK_FUNCS([sendfile])
+# AC_CHECK_FUNCS([sendfilev])
+# NET_LIBS="${LIBS}"
+# LIBS="${save_LIBS}"
+*)
+ AC_MSG_WARN([won't look for sendfile() on $target])
+ ;;
+esac
+if test "$ac_cv_so_sendfile_works" = yes; then
+ AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works])
+fi
+
+# Userland slab allocator, available only on Solaris
+case $target in
*-*-solaris*)
- AC_CHECK_HEADERS([sys/filio.h])
- AC_CHECK_LIB(sendfile, sendfile)
- AC_CHECK_LIB(umem, malloc)
AC_CHECK_HEADERS([umem.h])
-
- if test "$ac_cv_lib_sendfile_sendfile" = yes; then
+ if test "$ac_cv_have_umem_h" = yes; then
save_LIBS="${LIBS}"
- LIBS="${NET_LIBS}"
- AC_CHECK_FUNCS([sendfile])
- AC_CHECK_FUNCS([sendfilev])
+ LIBS=""
+ AC_CHECK_LIB(umem, umem_alloc)
+ LIBUMEM="${LIBS}"
LIBS="${save_LIBS}"
fi
;;
-*)
- AC_MSG_WARN([won't look for sendfile() on $target])
- ;;
esac
+AC_SUBST(LIBUMEM)
# These functions are provided by libcompat on platforms where they
# are not available