fi
if test "$nonroot_support" = "yes"; then
- ARG_ENABLE_BETAFTPD(nonroot,[ --enable-nonroot Do not need root access (implies --disable-shadow)],AC_DEFINE(WANT_NONROOT))
+ ARG_ENABLE_BETAFTPD(nonroot,[ --enable-nonroot Do not need root access (EXPERIMENTAL)],AC_DEFINE(WANT_NONROOT))
else
enableval=no
fi
dnl sendfile() is not standard -- we'll have to check the different
dnl versions one by one :-)
dnl
-AC_CHECK_HEADER(sys/sendfile.h,result=yes,result=no)
-
-dnl
-dnl For some reason, we have to check it AGAIN... Otherwise it's never defined!
+dnl Unfortunately, we'll have to run the program too -- this is a
+dnl problem with newer libc's and not-so-new kernels :-)
dnl
-AC_CHECK_HEADERS(sys/sendfile.h)
+AC_CHECK_HEADERS(sys/sendfile.h,result=yes,result=no)
if test "$result" = "yes"; then
AC_MSG_CHECKING([for Linux sendfile()])
#include <sys/types.h>
#endif
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
#if HAVE_SYS_UIO_H
#include <sys/uio.h>
-#endif],[
+#endif
+],[
int out_fd = 1, in_fd = 0;
off_t offset = 0;
size_t size = 1024;
AC_MSG_RESULT($enableval)
if test "$enableval" = "yes"; then
- AC_DEFINE(HAVE_LINUX_SENDFILE, 1, [Define if you have sendfile() with the Linux semantics.])
+ dnl
+ dnl If the compile fails now, we assume sendfile() exists (since this
+ dnl is by far the most common case)
+ dnl
+ AC_MSG_CHECKING([that sendfile() really is implemented])
+
+ AC_TRY_RUN([
+#if HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#if HAVE_SYS_LIMITS_H
+#include <sys/limits.h>
+#endif
+
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#if HAVE_SYS_SENDFILE_H
+#include <sys/sendfile.h>
+#endif
+
+#if HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#if HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+
+int main() {
+ int out_fd = 1, in_fd = 0;
+ off_t offset = 0;
+ size_t size = 1024;
+
+ errno = 0;
+ sendfile(out_fd, in_fd, &offset, size);
+ if (errno == ENOSYS)
+ return 0;
+ else
+ return 1;
+}],
+ enableval=no,enableval=yes,[enableval="cross-compiling, not checked"])
+ AC_MSG_RESULT($enableval)
+
+ has_sendfile=$enableval
+
+ dnl
+ dnl Force sendfile() `state' if the user tells us to
+ dnl
+ AC_ARG_WITH(linux-sendfile,[ --with-linux-sendfile Force sendfile() support],has_sendfile=$withval)
+
+ if test $has_sendfile != "no"; then
+ AC_DEFINE(HAVE_LINUX_SENDFILE, 1, [Define if you have sendfile() with the Linux semantics.])
+ has_sendfile=enabled
+ else
+ has_sendfile=disabled
+ fi
+ AC_MSG_CHECKING([final status of Linux sendfile() support])
+ AC_MSG_RESULT($has_sendfile)
fi
fi