X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=configure.in;h=6767a1328fd20f1aa7a8cb775db286350d113a0f;hb=HEAD;hp=763e05dd6b83a3d2ac4cdb9a9becf3e44014ff07;hpb=943a09508352718751ae80804d0519d3da5f07bd;p=betaftpd diff --git a/configure.in b/configure.in index 763e05d..6767a13 100644 --- a/configure.in +++ b/configure.in @@ -92,7 +92,7 @@ else 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 @@ -167,7 +167,7 @@ if test "$result" = "yes"; then fi if test "$result" = "no"; then - AC_CHECK_HEADER(linux/socket.h) + AC_CHECK_HEADERS(linux/socket.h linux/tcp.h) fi AC_CHECK_HEADERS(sys/poll.h) @@ -194,6 +194,9 @@ dnl dnl sendfile() is not standard -- we'll have to check the different dnl versions one by one :-) dnl +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,result=yes,result=no) if test "$result" = "yes"; then @@ -219,9 +222,14 @@ if test "$result" = "yes"; then #include #endif +#if HAVE_ERRNO_H +#include +#endif + #if HAVE_SYS_UIO_H #include -#endif],[ +#endif +],[ int out_fd = 1, in_fd = 0; off_t offset = 0; size_t size = 1024; @@ -231,7 +239,71 @@ if test "$result" = "yes"; then 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 +#endif + +#if HAVE_SYS_LIMITS_H +#include +#endif + +#if HAVE_UNISTD_H +#include +#endif + +#if HAVE_SYS_SENDFILE_H +#include +#endif + +#if HAVE_SYS_TYPES_H +#include +#endif + +#if HAVE_ERRNO_H +#include +#endif + +#if HAVE_SYS_UIO_H +#include +#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