libmicrohttpd

HTTP/1.x server C library (MHD 1.x, stable)
Log | Files | Refs | Submodules | README | LICENSE

commit 7738609fe2e0c465769bbfd2763eba01855ddd98
parent 7a66082eeeb55ebef8caff1588145d99cd2d37d1
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
Date:   Sun, 26 Nov 2017 17:06:04 +0300

configure: added parameter to disable sendfile().

Diffstat:
Mconfigure.ac | 64++++++++++++++++++++++++++++++++++++++++------------------------
1 file changed, 40 insertions(+), 24 deletions(-)

diff --git a/configure.ac b/configure.ac @@ -1248,11 +1248,22 @@ AC_FUNC_FSEEKO AC_CHECK_FUNCS([lseek64 pread64 pread]) # check for various sendfile functions -found_sendfile="no" -AC_MSG_CHECKING([[for Linux-style sendfile(2)]]) -AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ +AC_ARG_ENABLE([sendfile], + [AS_HELP_STRING([--disable-sendfile], + [disable usage of sendfile() for HTTP connections [auto]])], + [], + [enable_sendfile="auto"]) +AS_CASE([$enable_sendfile], + [[auto | yes]],[[found_sendfile="no"]], + [[no]],[[found_sendfile="disabled"]], + [AC_MSG_ERROR([[unknown value specified: --enable-sendfile=$enable_sendfile]])] +) +AS_VAR_IF([[found_sendfile]], [["no"]], + [ + AC_MSG_CHECKING([[for Linux-style sendfile(2)]]) + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ #include <sys/sendfile.h> static void empty_func(void) @@ -1262,25 +1273,27 @@ static void empty_func(void) } /* Declare again to check form match */ ssize_t sendfile(int, int, off_t*, size_t); - ]], - [[ - int fd1=0, fd2=2; - off_t o = 0; - size_t s = 5; - ssize_t r; - r = sendfile (fd1, fd2, &o, s); - if (r) - empty_func(); - ]] - ) - ], - [ - AC_DEFINE([HAVE_LINUX_SENDFILE], [1], [Define to 1 if you have linux-style sendfile(2).]) - found_sendfile="yes, Linux-style" - AC_MSG_RESULT([[yes]]) - AC_CHECK_FUNCS([sendfile64]) - ], - [AC_MSG_RESULT([[no]]) + ]], + [[ + int fd1=0, fd2=2; + off_t o = 0; + size_t s = 5; + ssize_t r; + r = sendfile (fd1, fd2, &o, s); + if (r) + empty_func(); + ]] + ) + ], + [ + AC_DEFINE([HAVE_LINUX_SENDFILE], [1], [Define to 1 if you have linux-style sendfile(2).]) + found_sendfile="yes, Linux-style" + AC_MSG_RESULT([[yes]]) + AC_CHECK_FUNCS([sendfile64]) + ], + [AC_MSG_RESULT([[no]]) + ] + ) ] ) AS_VAR_IF([[found_sendfile]], [["no"]], @@ -1411,6 +1424,9 @@ ssize_t sendfile(int out_fd, int in_fd, LIBS="$SAVE_LIBS" ] ) +AS_IF([[test "x$found_sendfile" = "xno" && test "x$enable_sendfile" = "xyes"]], + AC_MSG_ERROR([[sendfile() usage was requested by configure parameter, but no usable sendfile() function is detected]]) +) # optional: have error messages ? AC_MSG_CHECKING([[whether to generate error messages]])