aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbootstrap5
-rw-r--r--configure.ac335
-rw-r--r--m4/ax_have_epoll.m4104
-rw-r--r--m4/mhd_bool.m4135
-rw-r--r--m4/mhd_check_func.m455
-rw-r--r--m4/mhd_check_func_run.m4120
-rw-r--r--m4/mhd_check_link_run.m46
-rw-r--r--src/examples/demo.c2
-rw-r--r--src/examples/demo_https.c2
-rw-r--r--src/include/microhttpd.h13
-rw-r--r--src/microhttpd/daemon.c2
11 files changed, 443 insertions, 336 deletions
diff --git a/bootstrap b/bootstrap
index 990c6447..e99483af 100755
--- a/bootstrap
+++ b/bootstrap
@@ -55,6 +55,11 @@ else
echo "Uncrustify not detected, hook not installed. Please install uncrustify if you plan on doing development."
fi
+WANT_AUTOCONF=latest
+WANT_AUTOMAKE=latest
+export WANT_AUTOCONF
+export WANT_AUTOMAKE
+
aclocal -I m4 --install && \
libtoolize -c -i -v && \
autoconf && \
diff --git a/configure.ac b/configure.ac
index 932f8add..424ec8a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -48,6 +48,8 @@ AC_SUBST([PACKAGE_VERSION_SUBMINOR])
AC_SUBST([MHD_W32_DLL_SUFF])
AC_CONFIG_FILES([src/microhttpd/microhttpd_dll_res.rc])
+CONF_FINAL_WARNS=""
+
MHD_LIB_CPPFLAGS=""
MHD_LIB_CFLAGS=""
MHD_LIB_LDFLAGS=""
@@ -159,6 +161,15 @@ CPPFLAGS_ac=""
MHD_SYS_EXT([CPPFLAGS_ac])
CPPFLAGS="${CPPFLAGS_ac} ${user_CPPFLAGS}"
+m4_version_prereq([2.72],
+ [
+AC_SYS_YEAR2038
+ ],
+ [
+AC_SYS_LARGEFILE
+ ]
+)
+AC_FUNC_FSEEKO
LT_INIT([win32-dll])
LT_LANG([Windows Resource])
@@ -749,102 +760,7 @@ AS_VAR_IF([enable_linker_hardening],["yes"],
]
)
-
-AH_TEMPLATE([[HAVE_STDBOOL_H]], [Define to 1 if you have the <stdbool.h> header file and <stdbool.h> defines 'bool' type.])
-AH_TEMPLATE([[HAVE_BUILTIN_TYPE_BOOL]], [Define to 1 if you have the real boolean type.])
-AH_TEMPLATE([[bool]], [Define to type name which will be used as boolean type.])
-AC_CHECK_HEADER([stdbool.h],
- [
- AC_CHECK_TYPE([bool],
- [
- AC_DEFINE([[HAVE_STDBOOL_H]], [[1]])
- AC_DEFINE([[HAVE_BUILTIN_TYPE_BOOL]], [[1]])
- ],
- [
- AC_MSG_WARN([[Header <stdbool.h> is present, but "bool" type cannot be detected. Check compiler flags.]])
- AC_DEFINE([[bool]], [[int]])
- ], [
-#include <stdbool.h>
- ]
- )
- ],
- [
- AC_CHECK_TYPE([bool],
- [AC_DEFINE([[HAVE_BUILTIN_TYPE_BOOL]], [[1]])],
- [
- AC_CHECK_TYPE([_Bool],
- [
- AC_DEFINE([[HAVE_BUILTIN_TYPE_BOOL]], [[1]])
- AC_DEFINE([[bool]], [[_Bool]])
- ],
- [
- AC_DEFINE([[bool]], [[int]])
- ], []
- )
- ], []
- )
- ],
- [AC_INCLUDES_DEFAULT]
-)
-
-AC_CACHE_CHECK([[whether "true" is defined or builtin]], [[mhd_cv_macro_true_defined]],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
- ]], [[
-#if defined(true)
- /* dummy */
-#else
- (void)true;
-#endif
- ]])
- ], [[mhd_cv_macro_true_defined='yes']], [[mhd_cv_macro_true_defined='no']])
- ])
-AS_VAR_IF([[mhd_cv_macro_true_defined]], [["yes"]], [[:]],
- [AC_DEFINE([[true]],[[(!0)]], [Define to value interpreted by compiler as boolean "true", if "true" is not defined by system headers.])])
-
-AC_CACHE_CHECK([[whether "false" is defined or builtin]], [[mhd_cv_macro_false_defined]],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
- ]], [[
-#if !defined(false)
- (void)false;
-#else
- /* dummy */
-#endif
- ]])
- ], [[mhd_cv_macro_false_defined='yes']], [[mhd_cv_macro_false_defined='no']])
- ])
-AS_VAR_IF([[mhd_cv_macro_false_defined]], [["yes"]], [[:]],
- [AC_DEFINE([[false]],[[0]], [Define to value interpreted by compiler as boolean "false", if "false" is not defined by system headers.])])
-
-AC_CACHE_CHECK([[whether "true" and "false" could be used]], [[mhd_cv_macro_true_false_valid]],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h>
-#endif
- ]], [[
- int var1[true ? 1 : -1] = { 1 };
- int var2[false ? -1 : 1] = { 2 };
- int var3[!true ? -1 : 1] = { 3 };
- int var4[!false ? 1 : -1] = { 4 };
- if (var1[0] == var2[0] || var3[0] == var4[0])
- return 1;
- ]])
- ], [[mhd_cv_macro_true_false_valid='yes']], [[mhd_cv_macro_true_false_valid='no']])
- ])
-AS_VAR_IF([[mhd_cv_macro_true_false_valid]], [["yes"]], [[:]],
- [AC_MSG_ERROR([[Value of "true" or value of "false" is not valid. Check config.log for details.]])])
-
+MHD_BOOL
AX_CHECK_COMPILE_FLAG([[-Werror=attributes]],
[
@@ -993,6 +909,14 @@ AS_CASE(["$host_os"],
AC_DEFINE([_REENTRANT],[1],[Need with solaris or errno does not work])
mhd_host_os='Solaris'
AC_MSG_RESULT([[$mhd_host_os]])],
+ [linux-gnu],
+ [AC_DEFINE([LINUX],[1],[This is a Linux kernel])
+ mhd_host_os='GNU/Linux'
+ AC_MSG_RESULT([[$mhd_host_os]])],
+ [linux-android*],
+ [AC_DEFINE([LINUX],[1],[This is a Linux kernel])
+ mhd_host_os='Android'
+ AC_MSG_RESULT([[$mhd_host_os]])],
[*linux*],
[AC_DEFINE([LINUX],[1],[This is a Linux kernel])
mhd_host_os='Linux'
@@ -1275,30 +1199,28 @@ AS_CASE([[$with_threads]],
[AC_MSG_ERROR([[incorrect parameter "$with_threads" specified for --with-threads]])]
)
-# Check for posix threads support, regardless of configure parameters as
-# testsuite uses only posix threads.
+# Check for posix threads support.
+# As the testsuite uses only posix threads, the checks are required even
+# if the library does not use posit threads.
AX_PTHREAD(
[
mhd_have_posix_threads='yes'
AC_DEFINE([[HAVE_PTHREAD_H]],[[1]],[Define to 1 if you have the <pthread.h> header file.])
- AC_CACHE_CHECK([[whether pthread_sigmask(3) is available]],
- [[mhd_cv_func_pthread_sigmask]], [dnl
- save_LIBS="$LIBS"
- LIBS="$PTHREAD_LIBS $LIBS"
- CFLAGS="${CFLAGS_ac} ${PTHREAD_CFLAGS} ${user_CFLAGS}"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <signal.h>]],
- [[
- sigset_t nset, oset;
- sigemptyset (&nset);
- sigaddset (&nset, SIGPIPE);
- if (0 != pthread_sigmask(SIG_BLOCK, &nset, &oset)) return 1;
- ]])],
- [[mhd_cv_func_pthread_sigmask="yes"]],[[mhd_cv_func_pthread_sigmask="no"]])
- LIBS="${save_LIBS}"
- CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
- ])
- AS_VAR_IF([mhd_cv_func_pthread_sigmask],["yes"],
- [AC_DEFINE([[HAVE_PTHREAD_SIGMASK]],[[1]],[Define to 1 if you have the pthread_sigmask(3) function.])])
+ CFLAGS="${CFLAGS_ac} ${PTHREAD_CFLAGS} ${user_CFLAGS}"
+ MHD_CHECK_FUNC([pthread_sigmask],
+ [[
+#include <pthread.h>
+#include <signal.h>
+ ]],
+ [[
+ sigset_t nset, oset;
+ sigemptyset (&nset);
+ sigaddset (&nset, SIGPIPE);
+ i][f (0 != pthread_sigmask(SIG_BLOCK, &nset, &oset)) return 1;
+ ]],
+ [AC_DEFINE([[HAVE_PTHREAD_SIGMASK]],[[1]],[Define to 1 if you have the pthread_sigmask(3) function.])]
+ )
+ CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
],[[mhd_have_posix_threads='no']])
AM_CONDITIONAL([HAVE_POSIX_THREADS],[test "x$mhd_have_posix_threads" = "xyes"])
@@ -2405,8 +2327,18 @@ AC_ARG_ENABLE([[epoll]],
AS_IF([test "$enable_epoll" != "no"],
[
- AX_HAVE_EPOLL
- AS_IF([test "${ax_cv_have_epoll}" = "yes"],
+ MHD_CHECK_FUNC_RUN([epoll_create],
+ [[
+#include <sys/epoll.h>
+#include <unistd.h>
+ ]],
+ [[
+ int epfd = epoll_create(64);
+ i][f (0 > epfd) return -epfd;
+ (void) close(epfd);
+ return 0;
+ ]],
+ [cacheVar="assuming yes"],
[
AC_DEFINE([[EPOLL_SUPPORT]],[[1]],[Define to 1 to enable epoll support])
enable_epoll='yes'
@@ -2418,6 +2350,23 @@ AS_IF([test "$enable_epoll" != "no"],
enable_epoll='no'
]
)
+ AS_UNSET([warn_msg])
+ AS_VAR_IF([mhd_cv_works_func_epoll_create],["assuming yes"],
+ [[warn_msg="When cross-compiling it is not possible to check whether 'epoll_create()' really works on the host (final) platform.
+'epoll' is enabled as most probably the host kernel supports it (CONFIG_EPOLL option enabled in case of Linux kernel).
+Use './configure mhd_cv_works_func_epoll_create=yes' to mute this warning."]]
+ )
+ AS_VAR_SET_IF([warn_msg],[AC_MSG_WARN([$warn_msg])
+ AS_IF([test -n "${CONF_FINAL_WARNS}" ],
+ [
+ CONF_FINAL_WARNS="${CONF_FINAL_WARNS}
+
+WARNING: "
+ ]
+ )
+ CONF_FINAL_WARNS="${CONF_FINAL_WARNS}${warn_msg}"
+ ]
+ )
]
)
@@ -2495,7 +2444,8 @@ AC_CACHE_CHECK([size of tv_sec member of struct timeval], [mhd_cv_size_timeval_t
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
-static struct timeval test_var;
+extern struct timeval test_var; /* Declaration */
+struct timeval test_var = {0, 0}; /* Definition */
]],
[
# The size is used only to exclude additional checks/comparison in code
@@ -2573,14 +2523,12 @@ AC_CHECK_MEMBERS([struct sockaddr.sa_len, struct sockaddr_storage.ss_len,
#endif
])
-MHD_CHECK_LINK_RUN([[f][or working getsockname()]],[[mhd_cv_getsockname_usable]],
- [[mhd_cv_getsockname_usable='assuming yes']],
- [
- AC_LANG_SOURCE(
- [[
+MHD_CHECK_FUNC_RUN([getsockname],
+ [[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#include <string.h>
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
@@ -2603,12 +2551,8 @@ MHD_CHECK_LINK_RUN([[f][or working getsockname()]],[[mhd_cv_getsockname_usable]]
#include <arpa/inet.h>
#endif
-
-static void zr_mem(void *ptr, socklen_t size)
-{ char *mem = ptr; while(size--) {mem[0] = 0; mem++;} }
-
-int main(void)
-{
+ ]],
+ [[
const socklen_t c_addr_size = (socklen_t)sizeof(struct sockaddr_in);
struct sockaddr_in sa;
socklen_t addr_size;
@@ -2621,35 +2565,35 @@ int main(void)
const SOCKET invld_sckt = INVALID_SOCKET;
WSADATA wsa_data;
- if (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion)
+ i][f (0 != WSAStartup(MAKEWORD(2, 2), &wsa_data) || MAKEWORD(2, 2) != wsa_data.wVersion)
return 20;
#endif
sckt = socket (PF_INET, SOCK_STREAM, 0);
- if (invld_sckt != sckt)
+ i][f (invld_sckt != sckt)
{
- zr_mem(&sa, c_addr_size);
+ memset(&sa, 0, c_addr_size);
sa.sin_family = AF_INET;
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
sa.sin_len = c_addr_size;
#endif
- if (0 == bind (sckt, (struct sockaddr *)&sa, c_addr_size))
+ i][f (0 == bind (sckt, (struct sockaddr *)&sa, c_addr_size))
{
- if (0 == listen (sckt, 1))
+ i][f (0 == listen (sckt, 1))
{
addr_size = c_addr_size;
- if (0 == getsockname (sckt, (struct sockaddr *)&sa, &addr_size))
+ i][f (0 == getsockname (sckt, (struct sockaddr *)&sa, &addr_size))
{
- if (c_addr_size >= addr_size)
+ i][f (c_addr_size >= addr_size)
{
- if (0 != ntohs(sa.sin_port))
+ i][f (0 != ntohs(sa.sin_port))
{ ret = 0;
- } else ret = 7;
- } else ret = 6;
- } else ret = 5;
- } else ret = 4;
- } else ret = 3;
- } else ret = 2;
+ } el][se ret = 7;
+ } el][se ret = 6;
+ } el][se ret = 5;
+ } el][se ret = 4;
+ } el][se ret = 3;
+ } el][se ret = 2;
#if !defined(_WIN32) || defined(__CYGWIN__)
close (sckt);
#else
@@ -2657,10 +2601,8 @@ int main(void)
WSACleanup();
#endif
return ret;
-}
- ]]
- )
- ],
+ ]],
+ [cacheVar='assuming yes'],
[AC_DEFINE([[MHD_USE_GETSOCKNAME]], [[1]], [Define if you have usable `getsockname' function.])]
)
@@ -2823,45 +2765,60 @@ AS_UNSET([[use_itc]])
AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]],
[
- MHD_CHECK_LINK_RUN([[f][or working eventfd(2)]],[[mhd_cv_eventfd_usable]],[[mhd_cv_eventfd_usable='assuming no']],
- [
- AC_LANG_SOURCE([[
+ MHD_CHECK_FUNC_RUN([eventfd],[[
#include <sys/eventfd.h>
#include <unistd.h>
-
-int main(void)
-{
- unsigned char buf[8];
+ ]],
+ [[
+ static unsigned char buf[8];
int ret;
int efd = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK);
- if (0 > efd)
+ i][f (0 > efd)
return 2;
ret = 0;
buf[3] = 1;
- if (8 != write(efd, buf, 8))
+ i][f (8 != write(efd, buf, 8))
ret = 3;
- else
+ el][se
{
- if (8 != read(efd, buf, 8))
+ i][f (8 != read(efd, buf, 8))
ret = 4;
}
close(efd);
return ret;
-}
- ]]
+ ]],
+ [
+ AS_VAR_IF([enable_itc],["eventfd"],
+ [cacheVar="assuming yes"],[cacheVar="assuming no"]
)
],
[
use_itc='eventfd'
enable_itc="$use_itc"
- AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for inter-thread communication])
- ],
- [
- AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is not usable, consider using other type of inter-thread communication]])])
+ AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD f][or inter-thread communication])
]
)
- AS_VAR_IF([mhd_cv_eventfd_usable],["assuming no"],
- [AC_MSG_WARN([if you have 'eventfd' support enabled on your target system consider overriding test result by "mhd_cv_eventfd_usable=yes" configure parameter])]
+ AS_UNSET([warn_msg])
+ AS_VAR_IF([mhd_cv_works_func_eventfd],["assuming yes"],
+ [[warn_msg="When cross-compiling it is not possible to check whether 'eventfd()' really works on the host (final) platform.
+'eventfd' is enabled as requested by configure parameters.
+Use './configure mhd_cv_works_func_eventfd=yes' to mute this warning."]]
+ )
+ AS_VAR_IF([mhd_cv_works_func_eventfd],["assuming no"],
+ [[warn_msg="When cross-compiling it is not possible to check whether 'eventfd()' really works on the host (final) platform.
+'eventfd()' is disabled. If it is available use './configure mhd_cv_works_func_eventfd=yes' to enable.
+Use './configure mhd_cv_works_func_eventfd=no' to mute this warning."]]
+ )
+ AS_VAR_SET_IF([warn_msg],[AC_MSG_WARN([$warn_msg])
+ AS_IF([test -n "${CONF_FINAL_WARNS}" ],
+ [
+ CONF_FINAL_WARNS="${CONF_FINAL_WARNS}
+
+WARNING: "
+ ]
+ )
+ CONF_FINAL_WARNS="${CONF_FINAL_WARNS}${warn_msg}"
+ ]
)
]
)
@@ -2889,32 +2846,29 @@ AC_INCLUDES_DEFAULT
use_itc='pipe'
enable_itc="$use_itc"
AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication])
- MHD_CHECK_LINK_RUN([[whether pipe2(2) is usable]],[[mhd_cv_pipe2_usable]],
- [
- # Cross-compiling
- AS_CASE([${host_os}], [kfreebsd*-gnu], [[mhd_cv_pipe2_usable='assuming no']],
- [[mhd_cv_pipe2_usable='assuming yes']])
- ],
- [
- AC_LANG_PROGRAM([
+ MHD_CHECK_FUNC_RUN([pipe2],[
AC_INCLUDES_DEFAULT
+[
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
- ], [[
- int arr[2];
- int res;
- res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
- if (res != 0) return 33;
- close (arr[0]);
- close (arr[1]);
- ]]
- )
+ ]],[[
+ int arr[2];
+ int res;
+ res = pipe2(arr, O_CLOEXEC | O_NONBLOCK);
+ i][f (res != 0) return 33;
+ close (arr[0]);
+ close (arr[1]);
+ return 0;
+ ]],[
+ # Cross-compiling
+ AS_CASE([${host_os}], [kfreebsd*-gnu], [cacheVar='assuming no'],
+ [cacheVar='assuming yes'])
],
- [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define if you have usable pipe2(2) function])]
+ [AC_DEFINE([[HAVE_PIPE2_FUNC]], [[1]], [Define i][f you have usable pipe2(2) function])],
)
], [
AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])])
@@ -3340,11 +3294,9 @@ MHD_CHECK_FUNC([magic_open],
[],
[-lmagic]
)
-AM_CONDITIONAL([MHD_HAVE_LIBMAGIC], [[test "x$mhd_cv_func_magic_open" = "xyes"]])
+AM_CONDITIONAL([MHD_HAVE_LIBMAGIC], [[test "x$mhd_cv_have_func_magic_open" = "xyes"]])
# large file support (> 4 GB)
-AC_SYS_LARGEFILE
-AC_FUNC_FSEEKO
MHD_CHECK_FUNC([lseek64],
[[
#if defined(HAVE_SYS_TYPES_H)
@@ -4000,7 +3952,7 @@ AS_VAR_IF([enable_dauth], ["yes"],
AC_MSG_CHECKING([[for Digest Authentication default nonce timeout value]])
AC_ARG_ENABLE([dauth-def-timeout],
[AS_HELP_STRING([--enable-dauth-def-timeout=NNN],
- [set default Digest Auth nonce validity time to NNN seconds])],
+ [set default Digest Auth nonce validity time to NNN seconds [90]])],
[enable_dauth_def_timeout="${enableval}"],
[enable_dauth_def_timeout=""]
)
@@ -4043,7 +3995,7 @@ AS_VAR_IF([enable_dauth], ["yes"],
AC_MSG_CHECKING([[for Digest Authentication default maximum nc value]])
AC_ARG_ENABLE([dauth-def-max-nc],
[AS_HELP_STRING([--enable-dauth-def-max-nc=NNN],
- [set default Digest Auth maximum nc (nonce count) value to NNN])],
+ [set default Digest Auth maximum nc (nonce count) value to NNN [1000]])],
[enable_dauth_def_max_nc="${enableval}"],
[enable_dauth_def_max_nc=""]
)
@@ -4710,7 +4662,7 @@ AS_VAR_IF([enable_tools],["yes"],
)
]
)
- AS_VAR_IF([mhd_cv_func_CPU_COUNT_S],["yes"],
+ AS_VAR_IF([mhd_cv_have_func_CPU_COUNT_S],["yes"],
[
AC_CACHE_CHECK([whether CPU_COUNT_S() expects max CPU number as 'size' parameter],[mhd_cv_func_cpu_count_s_cpus],
[
@@ -6068,3 +6020,4 @@ AS_IF([test "x$enable_bauth" != "xyes" || \
test "x$enable_postprocessor" != "xyes"],
[AC_MSG_WARN([This will be a custom build with missing symbols. Do NOT use this build in a distribution. Building with these kinds of configure options is only for custom builds for embedded systems.])]
)
+AS_IF([test -n "${CONF_FINAL_WARNS}"],[AC_MSG_WARN([${CONF_FINAL_WARNS}])])
diff --git a/m4/ax_have_epoll.m4 b/m4/ax_have_epoll.m4
deleted file mode 100644
index 3098de69..00000000
--- a/m4/ax_have_epoll.m4
+++ /dev/null
@@ -1,104 +0,0 @@
-# ===========================================================================
-# https://www.gnu.org/software/autoconf-archive/ax_have_epoll.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-# AX_HAVE_EPOLL([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-# AX_HAVE_EPOLL_PWAIT([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
-#
-# DESCRIPTION
-#
-# This macro determines whether the system supports the epoll I/O event
-# interface. A neat usage example would be:
-#
-# AX_HAVE_EPOLL(
-# [AX_CONFIG_FEATURE_ENABLE(epoll)],
-# [AX_CONFIG_FEATURE_DISABLE(epoll)])
-# AX_CONFIG_FEATURE(
-# [epoll], [This platform supports epoll(7)],
-# [HAVE_EPOLL], [This platform supports epoll(7).])
-#
-# The epoll interface was added to the Linux kernel in version 2.5.45, and
-# the macro verifies that a kernel newer than this is installed. This
-# check is somewhat unreliable if <linux/version.h> doesn't match the
-# running kernel, but it is necessary regardless, because glibc comes with
-# stubs for the epoll_create(), epoll_wait(), etc. that allow programs to
-# compile and link even if the kernel is too old; the problem would then
-# be detected only at runtime.
-#
-# Linux kernel version 2.6.19 adds the epoll_pwait() call in addition to
-# epoll_wait(). The availability of that function can be tested with the
-# second macro. Generally speaking, it is safe to assume that
-# AX_HAVE_EPOLL would succeed if AX_HAVE_EPOLL_PWAIT has, but not the
-# other way round.
-#
-# LICENSE
-#
-# Copyright (c) 2008 Peter Simons <simons@cryp.to>
-#
-# Copying and distribution of this file, with or without modification, are
-# permitted in any medium without royalty provided the copyright notice
-# and this notice are preserved. This file is offered as-is, without any
-# warranty.
-
-#serial 12
-
-AC_DEFUN([AX_HAVE_EPOLL], [dnl
- ax_have_epoll_cppflags="${CPPFLAGS}"
- AC_CHECK_HEADER([linux/version.h], [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"], [], [AC_INCLUDES_DEFAULT])
- AC_MSG_CHECKING([for Linux epoll(7) interface])
- AC_CACHE_VAL([ax_cv_have_epoll], [dnl
- AC_LINK_IFELSE([dnl
- AC_LANG_PROGRAM([dnl
-#include <sys/epoll.h>
-#ifdef HAVE_LINUX_VERSION_H
-# include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,45)
-# error linux kernel version is too old to have epoll
-# endif
-#endif
-], [dnl
-int fd;
-struct epoll_event ev;
-fd = epoll_create(128);
-epoll_wait(fd, &ev, 1, 0);])],
- [ax_cv_have_epoll=yes],
- [ax_cv_have_epoll=no])])
- CPPFLAGS="${ax_have_epoll_cppflags}"
- AS_IF([test "${ax_cv_have_epoll}" = "yes"],
- [AC_MSG_RESULT([yes])
-$1],[AC_MSG_RESULT([no])
-$2])
-])dnl
-
-AC_DEFUN([AX_HAVE_EPOLL_PWAIT], [dnl
- ax_have_epoll_cppflags="${CPPFLAGS}"
- AC_CHECK_HEADER([linux/version.h],
- [CPPFLAGS="${CPPFLAGS} -DHAVE_LINUX_VERSION_H"])
- AC_MSG_CHECKING([for Linux epoll(7) interface with signals extension])
- AC_CACHE_VAL([ax_cv_have_epoll_pwait], [dnl
- AC_LINK_IFELSE([dnl
- AC_LANG_PROGRAM([dnl
-#ifdef HAVE_LINUX_VERSION_H
-# include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
-# error linux kernel version is too old to have epoll_pwait
-# endif
-#endif
-#include <sys/epoll.h>
-#include <signal.h>
-], [dnl
-int fd;
-struct epoll_event ev;
-fd = epoll_create(128);
-epoll_wait(fd, &ev, 1, 0);
-epoll_pwait(fd, &ev, 1, 0, (sigset_t const *)(0));])],
- [ax_cv_have_epoll_pwait=yes],
- [ax_cv_have_epoll_pwait=no])])
- CPPFLAGS="${ax_have_epoll_cppflags}"
- AS_IF([test "${ax_cv_have_epoll_pwait}" = "yes"],
- [AC_MSG_RESULT([yes])
-$1],[AC_MSG_RESULT([no])
-$2])
-])dnl
diff --git a/m4/mhd_bool.m4 b/m4/mhd_bool.m4
new file mode 100644
index 00000000..ef500e37
--- /dev/null
+++ b/m4/mhd_bool.m4
@@ -0,0 +1,135 @@
+# SYNOPSIS
+#
+# MHD_BOOL
+#
+# DESCRIPTION
+#
+# This macro checks whether the boolean keywords "bool", "true", "false"
+# are supported by compiler. If they are not supported, suitable replacement
+# macros are defined.
+#
+# Example usage:
+#
+# MHD_BOOL
+#
+# The cache variables are used in the checks so if any test will not work
+# correctly on some platform, user may simply fix it by giving cache
+# variable in configure parameters, for example:
+#
+# ./configure mhd_cv_bool_native=no
+#
+# This simplify building from source on exotic platforms as patching
+# of configure.ac is not required to change results of tests.
+#
+# LICENSE
+#
+# Copyright (c) 2024 Karlson2k (Evgeny Grin) <k2k@narod.ru>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 2
+
+AC_DEFUN([MHD_BOOL],[dnl
+AC_PREREQ([2.64])dnl for AS_VAR_IF
+m4_newline([[# Expansion of macro $0 starts here]])
+AC_LANG_ASSERT([C])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AH_TEMPLATE([[HAVE_STDBOOL_H]], [Define to 1 i][f you have the <stdbool.h> header file and <stdbool.h> is required to use 'bool' type.])dnl
+AH_TEMPLATE([[HAVE_BUILTIN_TYPE_BOOL]], [Define to 1 i][f you have the boolean type that takes only 'true' and 'false'.])dnl
+AH_TEMPLATE([[bool]], [Define to the name of the type which is used as a replacemnt f][or boolean type.])dnl
+[mhd_bool_test_code='
+static bool get_false(void)
+{
+ static bool test_arr[sizeof(bool)*2 - 1] = {false};
+ return test_arr[0];
+}
+
+int main(void)
+{
+ static bool var1 = true;
+ static bool var2 = false;
+ static int int_arr[2 - 3 * ((int) (false))] = {(int) true, (int) false};
+ static bool bool_arr[2 - 3 * ((int) (!true))] = {false, true};
+ i][f(!var1 || var2 || !int_arr[0] || int_arr[1] || bool_arr[0] ||
+ !bool_arr[1] || get_false() || 0 == sizeof(bool) || false || !true)
+ return 5;
+ return 0;
+}
+']
+AC_CACHE_CHECK([[whether "bool", "true" and "false" work natively]],[[mhd_cv_bool_native]],
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[${mhd_bool_test_code}]])],[mhd_cv_bool_native="yes"],
+[mhd_cv_bool_native="no"])dnl AC_COMPILE_IFELSE
+])
+AS_VAR_IF([mhd_cv_bool_native],["yes"],[
+AC_DEFINE([[HAVE_BUILTIN_TYPE_BOOL]],[1])],[dnl mhd_cv_bool_native "yes"
+AC_CACHE_CHECK([[whether <stdbool.h> is present and defines proper "bool", "true" and "false"]],[[mhd_cv_bool_stdbool]],
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+#include <stdbool.h>
+
+${mhd_bool_test_code}
+]])],[mhd_cv_bool_stdbool="yes"],[mhd_cv_bool_stdbool="no"])dnl AC_COMPILE_IFELSE
+])
+dnl end of AC_CACHE_CHECK
+AS_VAR_IF([mhd_cv_bool_stdbool],["yes"],[
+AC_DEFINE([[HAVE_STDBOOL_H]],[1])
+AC_DEFINE([[HAVE_BUILTIN_TYPE_BOOL]],[1])],[dnl mhd_cv_bool_stdbool "yes"
+# Need 'bool', 'false' and 'true'.
+AC_CHECK_TYPE([bool],[AC_DEFINE([[HAVE_BUILTIN_TYPE_BOOL]], [[1]])],[dnl AC_CHECK_TYPE bool
+AC_CHECK_TYPE([_Bool],[AC_DEFINE([[HAVE_BUILTIN_TYPE_BOOL]], [[1]])
+AC_DEFINE([[bool]], [[_Bool]])],[AC_DEFINE([[bool]], [[int]])
+],[[]])dnl AC_CHECK_TYPE _Bool
+],[[]])dnl AC_CHECK_TYPE bool
+# Have 'bool'. Need 'false' and 'true'.
+AC_CACHE_CHECK([[whether "false" keyword available and works]],[[mhd_cv_keyword_false_works]],
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+int main(void)
+{
+ static bool var1 = false || false;
+ static bool var2 = false;
+ static bool bool_arr[2 - 3 * ((int) (false))] = {false, !false};
+ i][f(var1 || var2 || bool_arr[0] || !bool_arr[1] || false)
+ return 5;
+ return 0;
+}
+]])], [[mhd_cv_keyword_false_works='yes']], [[mhd_cv_keyword_false_works='no']])])
+dnl end of AC_CACHE_CHECK
+AS_VAR_IF([[mhd_cv_keyword_false_works]], [["no"]],[dnl
+AC_DEFINE([[false]],[[(0)]], [Define to value interpreted by compiler as boolean "false", i][f "false" is not a keyword and not defined by headers.])])
+dnl AS_VAR_IF mhd_cv_keyword_false_works
+# Have 'bool' and 'false'. Need 'true'.
+AC_CACHE_CHECK([[whether "true" keyword available and works]],[[mhd_cv_keyword_true_works]],
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+int main(void)
+{
+ static bool var1 = true && true;
+ static bool var2 = true;
+ static bool bool_arr[2 - 3 * ((int) (!true))] = {true, !true};
+ i][f(!var1 || !var2 || !bool_arr[0] || bool_arr[1] || !true)
+ return 5;
+ return 0;
+}
+]])], [[mhd_cv_keyword_true_works='yes']], [[mhd_cv_keyword_true_works='no']])])
+dnl end of AC_CACHE_CHECK
+AS_VAR_IF([[mhd_cv_keyword_true_works]], [["no"]],[dnl
+AC_DEFINE([[true]],[[(!false)]], [Define to value interpreted by compiler as boolean "true", i][f "true" is not a keyword and not defined by headers.])])
+dnl AS_VAR_IF mhd_cv_keyword_false_works
+# Have 'bool', 'false' and 'true'.
+AC_CACHE_CHECK([[whether the defined "bool", "true" and "false" can work together]],[[mhd_cv_bool_true_false_work]],
+[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[${mhd_bool_test_code}]])],[mhd_cv_bool_true_false_work="yes"],
+[mhd_cv_bool_true_false_work="no"])dnl AC_COMPILE_IFELSE
+])
+dnl end of AC_CACHE_CHECK
+AS_VAR_IF([[mhd_cv_bool_true_false_work]], [["yes"]],[[:]],[dnl
+AC_MSG_FAILURE([cannot find suitable replacements for "bool", "true" and "false"])
+])
+dnl end of AS_VAR_IF mhd_cv_bool_true_false_work "yes"
+])
+dnl end of AS_VAR_IF mhd_cv_bool_stdbool "yes"
+])
+dnl end of AS_VAR_IF mhd_cv_bool_native "yes"
+AS_UNSET([mhd_bool_test_code])
+m4_newline([[# Expansion of macro $0 ends here]])
+])dnl AC_DEFUN MHD_BOOL
diff --git a/m4/mhd_check_func.m4 b/m4/mhd_check_func.m4
index 77e6baca..23a18130 100644
--- a/m4/mhd_check_func.m4
+++ b/m4/mhd_check_func.m4
@@ -8,16 +8,17 @@
# DESCRIPTION
#
# This macro checks for presence of specific function by including
-# specified headers and compiling and linking CHECK_CODE.
+# specified headers, checking for declaration of the function and then
+# compiling and linking CHECK_CODE.
# This checks both declaration and presence in library.
# If function is available then macro HAVE_function_name (the name
-# of the function convetedd to all uppercase characters) is defined
+# of the function conveted to all uppercase characters) is defined
# automatically.
# Unlike AC_CHECK_FUNCS macro, this macro do not produce false
# negative result if function is declared with specific calling
# conventions like __stdcall' or attribute like
# __attribute__((__dllimport__)) and linker failing to build test
-# program due to the different calling conventions.
+# program due to the different calling conventions.
# By using definition from provided headers, this macro ensures that
# correct calling convention is used for detection.
#
@@ -32,10 +33,10 @@
# correctly on some platform, user may simply fix it by giving cache
# variable in configure parameters, for example:
#
-# ./configure mhd_cv_func_memmem_have=no
+# ./configure mhd_cv_have_func_memmem=no
#
# This simplifies building from source on exotic platforms as patching
-# of configure.ac is not required to change results of tests.
+# of configure.ac is not required to change the results of the tests.
#
# LICENSE
#
@@ -46,7 +47,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 5
+#serial 6
AC_DEFUN([MHD_CHECK_FUNC],[dnl
AC_PREREQ([2.64])dnl for AS_VAR_IF, m4_ifblank, m4_ifnblank
@@ -59,18 +60,16 @@ m4_bmatch(m4_normalize([$1]), [\s],dnl
m4_if(m4_index([$3], m4_normalize(m4_translit([$1],[()],[ ]))), [-1], dnl
[m4_fatal([CHECK_CODE parameter (third macro argument) does not contain ']m4_normalize([$1])[' token])])dnl
AS_VAR_PUSHDEF([decl_cv_Var],[ac_cv_have_decl_]m4_bpatsubst(_mhd_norm_expd(m4_translit([$1],[()],[ ])),[[^a-zA-Z0-9]],[_]))dnl
-AS_VAR_PUSHDEF([cv_Var],[mhd_cv_func_]m4_bpatsubst(_mhd_norm_expd(m4_translit([$1],[()],[ ])),[[^a-zA-Z0-9]],[_]))dnl
-AS_VAR_SET_IF([cv_Var],[],[AC_CHECK_DECL(_mhd_norm_expd([$1]),[],[],[$2])])
-AC_CACHE_CHECK([for function $1], [cv_Var],dnl
+AS_VAR_PUSHDEF([cv_Var],[mhd_cv_have_func_]m4_bpatsubst(_mhd_norm_expd(m4_translit([$1],[()],[ ])),[[^a-zA-Z0-9]],[_]))dnl
+AS_VAR_SET_IF([cv_Var],[],[AC_CHECK_DECL(_mhd_norm_expd([$1]),[],[cv_Var="no"],[$2])])
+AC_CACHE_CHECK([f][or function $1], [cv_Var],dnl
[dnl
- AS_VAR_IF([decl_cv_Var],["yes"],dnl
- [dnl
- m4_ifnblank([$6],[dnl
- mhd_check_func_SAVE_LIBS="$LIBS"
- LIBS="_mhd_norm_expd([$6]) $LIBS"
- ])dnl
- AC_LINK_IFELSE(
- [AC_LANG_SOURCE([
+ m4_ifnblank([$6],[dnl
+ mhd_check_func_SAVE_LIBS="$LIBS"
+ LIBS="_mhd_norm_expd([$6]) $LIBS"
+ ])dnl
+ AC_LINK_IFELSE(
+ [AC_LANG_SOURCE([
m4_default_nblank([$2],[AC_INCLUDES_DEFAULT])
[int main(void)
@@ -80,18 +79,16 @@ m4_default_nblank([$2],[AC_INCLUDES_DEFAULT])
return 0;
}
- ]])
- ],
- [AS_VAR_SET([cv_Var],["yes"])],
- [AS_VAR_SET([cv_Var],["no"])]dnl
- )
- m4_ifnblank([$6],[dnl
- LIBS="${mhd_check_func_SAVE_LIBS}"
- AS_UNSET([mhd_check_func_SAVE_LIBS])
- ])dnl
- ],[AS_VAR_SET([cv_Var],["no"])]dnl
- )dnl
- ]dnl
+ ]])
+ ],
+ [AS_VAR_SET([cv_Var],["yes"])],
+ [AS_VAR_SET([cv_Var],["no"])]dnl
+ )
+ m4_ifnblank([$6],[dnl
+ LIBS="${mhd_check_func_SAVE_LIBS}"
+ AS_UNSET([mhd_check_func_SAVE_LIBS])
+ ])dnl
+ ],[AS_VAR_SET([cv_Var],["no"])]dnl
)
AS_VAR_IF([cv_Var], ["yes"],
[AC_DEFINE([[HAVE_]]m4_bpatsubst(m4_toupper(_mhd_norm_expd(m4_translit([$1],[()],[ ]))),[[^A-Z0-9]],[_]),
diff --git a/m4/mhd_check_func_run.m4 b/m4/mhd_check_func_run.m4
new file mode 100644
index 00000000..d935ee85
--- /dev/null
+++ b/m4/mhd_check_func_run.m4
@@ -0,0 +1,120 @@
+# SYNOPSIS
+#
+# MHD_CHECK_FUNC_RUN(FUNCTION_NAME,
+# [INCLUDES=AC_INCLUDES_DEFAULT], CHECK_CODE
+# COMMAND_IF_CROSS_COMPILING,
+# [ACTION_IF_AVAILABLE], [ACTION_IF_NOT_AVAILABLE],
+# [ADDITIONAL_LIBS])
+#
+# DESCRIPTION
+#
+# This macro checks for presence of specific function by including
+# specified headers, checking for declaration of the function and then
+# compiling and linking CHECK_CODE. If all previous steps succeed,
+# the binary is executed.
+# The CHECK_CODE is full body of the "main" function and must include
+# the final "return" keyword.
+# This checks the declaration, the presence in library and the functionality.
+# If function is available then macro HAVE_function_name (the name
+# of the function conveted to all uppercase characters) is defined
+# automatically.
+# By using definition from provided headers, this macro ensures that
+# correct calling convention is used for detection.
+# The compilation and linking is tried even if cross-compiling. If they
+# failed then the result is "no".
+# The COMMAND_IF_CROSS_COMPILING commands are executed if and only if
+# the compilation and linking succeed. These commands must set 'cacheVar'
+# variable to "yes", "no", "assuming yes" or "assuming no".
+# ACTION_IF_SUCCEED is executed if result is "yes" or "assuming yes".
+# ACTION_IF_FAILED is executed if result is "no" or "assuming no".
+#
+# Example usage:
+#
+# MHD_CHECK_FUNC_RUN([memmem],
+# [[#include <string.h>]],
+# [[const void *ptr = memmem("aa", 2, "a", 1);
+# if (((void*)0) == ptr) return 1;
+# return 0;]],
+# [cacheVar="assuming yes"],
+# [var_use_memmem='yes'], [var_use_memmem='no'])
+#
+# The cache variable used in check so if any test will not work
+# correctly on some platform, user may simply fix it by giving cache
+# variable in configure parameters, for example:
+#
+# ./configure mhd_cv_works_func_memmem=no
+#
+# This simplifies building from source on exotic platforms as patching
+# of configure.ac is not required to change the results of the tests.
+#
+# LICENSE
+#
+# Copyright (c) 2024 Karlson2k (Evgeny Grin) <k2k@narod.ru>
+#
+# Copying and distribution of this file, with or without modification, are
+# permitted in any medium without royalty provided the copyright notice
+# and this notice are preserved. This file is offered as-is, without any
+# warranty.
+
+#serial 1
+
+dnl $1: FUNCTION_NAME
+dnl $2: INCLUDES
+dnl $3: CHECK_CODE
+dnl $4: COMMAND_IF_CROSS_COMPILING
+dnl $5: ACTION_IF_AVAILABLE
+dnl $6: ACTION_IF_NOT_AVAILABLE
+dnl $7: ADDITIONAL_LIBS
+AC_DEFUN([MHD_CHECK_FUNC_RUN],[dnl
+AC_PREREQ([2.64])dnl for AS_VAR_SET_IF, m4_ifblank, m4_ifnblank, m4_default_nblank
+m4_newline([[# Expansion of $0 macro starts here]])
+AC_LANG_ASSERT([C])dnl
+m4_ifblank(m4_translit([$1],[()],[ ]), [m4_fatal([$0: First macro argument ("FUNCTION_NAME") must not be empty])])dnl
+m4_ifblank([$3], [m4_fatal([$0: Third macro argument ("CHECK_CODE") must not be empty])])dnl
+m4_bmatch(m4_normalize([$1]), [\s],dnl
+ [m4_fatal([$0: First macro argument ("FUNCTION_NAME") must not contain whitespaces])])dnl
+m4_if(m4_index([$3], m4_normalize(m4_translit([$1],[()],[ ]))), [-1], dnl
+ [m4_fatal([$0: "CHECK_CODE" macro parameter (third argument) does not contain ']m4_normalize([$1])[' token])])dnl
+m4_if(m4_index([$3],return), [-1], dnl
+ [m4_fatal([$0: "CHECK_CODE" macro parameter (third argument) does not contain 'return' token])])dnl
+m4_bmatch(_mhd_norm_expd([$4]),[\<]cacheVar[\>],[],dnl
+[m4_fatal([$0: The fourth macro argument ("COMMAND_IF_CROSS_COMPILING") must assign ]dnl
+[a value to the cache variable 'cacheVar'. The variable must be not overquoted.])])dnl
+AS_VAR_PUSHDEF([decl_cv_Var],[ac_cv_have_decl_]m4_bpatsubst(_mhd_norm_expd(m4_translit([$1],[()],[ ])),[[^a-zA-Z0-9]],[_]))dnl
+AS_VAR_PUSHDEF([cacheVar],[mhd_cv_works_func_]m4_bpatsubst(_mhd_norm_expd(m4_translit([$1],[()],[ ])),[[^a-zA-Z0-9]],[_]))dnl
+AS_VAR_SET_IF([cacheVar],[],[AC_CHECK_DECL(_mhd_norm_expd([$1]),[],[cacheVar="no"],[$2])])
+AC_CACHE_CHECK([whether '$1' available and works],[cacheVar],dnl
+[
+AC_LANG_CONFTEST([AC_LANG_SOURCE([
+m4_default_nblank([$2],[AC_INCLUDES_DEFAULT])
+
+[int main(void)
+{
+ ]$3[
+}
+]])])
+m4_ifnblank([$7],[dnl
+mhd_check_func_SAVE_LIBS="$LIBS"
+LIBS="_mhd_norm_expd([$7]) $LIBS"
+])dnl m4_ifnblank
+AS_VAR_IF([cross_compiling],["yes"],
+[AC_LINK_IFELSE([],[
+$4
+],[cacheVar='no'])dnl AC_LINK_IFELSE
+],dnl
+[AC_RUN_IFELSE([],[cacheVar='yes'],[cacheVar='no'],[[# Dummy placeholder]])
+])
+rm -f conftest.$ac_ext
+m4_ifnblank([$7],[dnl
+ LIBS="${mhd_check_func_SAVE_LIBS}"
+ AS_UNSET([mhd_check_func_SAVE_LIBS])
+])dnl m4_ifnblank
+])dnl AC_CACHE_CHECK
+m4_ifnblank([$5],[
+AS_IF([test "x$cacheVar" = "xyes" || test "x$cacheVar" = "xassuming yes"],[$5])dnl AS_IF
+])dnl m4_ifnblank
+m4_ifnblank([$6],[
+AS_IF([test "x$cacheVar" = "xno" || test "x$cacheVar" = "xassuming no"],[$6])dnl AS_IF
+])dnl m4_ifnblank
+m4_newline([[# Expansion of $0 macro ends here]])
+])dnl AC_DEFUN MHD_CHECK_FUNC_RUN
diff --git a/m4/mhd_check_link_run.m4 b/m4/mhd_check_link_run.m4
index 25ff1290..5eb12d16 100644
--- a/m4/mhd_check_link_run.m4
+++ b/m4/mhd_check_link_run.m4
@@ -17,10 +17,10 @@
# Example usage:
#
# MHD_CHECK_LINK_RUN([for valid snprintf()], [mhd_cv_snprintf_valid],
+# [mhd_cv_snprintf_valid='assuming no'],
# [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
# [if (4 != snprintf(NULL, 0, "test"))
-# return 2;])],
-# [mhd_cv_snprintf_valid='assuming no'])
+# return 2;])])
#
#
# LICENSE
@@ -32,7 +32,7 @@
# and this notice are preserved. This file is offered as-is, without any
# warranty.
-#serial 2
+#serial 3
AC_DEFUN([MHD_CHECK_LINK_RUN],[dnl
m4_ifblank([$1],[m4_fatal([$0: The first macro argument ("MESSAGE") must not be empty])])dnl
diff --git a/src/examples/demo.c b/src/examples/demo.c
index bae63d74..ded2cf01 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -413,7 +413,7 @@ update_directory (void)
update_cached_response (NULL);
return;
}
- memcpy (rdc.buf, INDEX_PAGE_FOOTER, len);
+ memcpy (&rdc.buf[rdc.off], INDEX_PAGE_FOOTER, len);
rdc.off += len;
initial_allocation = rdc.buf_len; /* remember for next time */
response =
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 4b937af1..22821e95 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -415,7 +415,7 @@ update_directory (void)
update_cached_response (NULL);
return;
}
- memcpy (rdc.buf, INDEX_PAGE_FOOTER, len);
+ memcpy (&rdc.buf[rdc.off], INDEX_PAGE_FOOTER, len);
rdc.off += len;
initial_allocation = rdc.buf_len; /* remember for next time */
response =
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 12b872fc..fa837221 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -3966,8 +3966,9 @@ MHD_create_response_from_callback (uint64_t size,
* @deprecated use #MHD_create_response_from_buffer instead
* @ingroup response
*/
-_MHD_DEPR_FUNC ("MHD_create_response_from_data() is deprecated, " \
- "use MHD_create_response_from_buffer()") \
+_MHD_DEPR_FUNC ( \
+ "MHD_create_response_from_data() is deprecated, use MHD_create_response_from_buffer()" \
+ ) \
_MHD_EXTERN struct MHD_Response *
MHD_create_response_from_data (size_t size,
void *data,
@@ -4240,8 +4241,9 @@ MHD_create_response_from_fd64 (uint64_t size,
* @return NULL on error (i.e. invalid arguments, out of memory)
* @ingroup response
*/
-_MHD_DEPR_FUNC ("Function MHD_create_response_from_fd_at_offset() is " \
- "deprecated, use MHD_create_response_from_fd_at_offset64()") \
+_MHD_DEPR_FUNC ( \
+ "Function MHD_create_response_from_fd_at_offset() is deprecated, use MHD_create_response_from_fd_at_offset64()" \
+ ) \
_MHD_EXTERN struct MHD_Response *
MHD_create_response_from_fd_at_offset (size_t size,
int fd,
@@ -6505,8 +6507,7 @@ enum MHD_FEATURE
};
#define MHD_FEATURE_HTTPS_COOKIE_PARSING _MHD_DEPR_IN_MACRO ( \
- "Value MHD_FEATURE_HTTPS_COOKIE_PARSING is deprecated, " \
- "use MHD_FEATURE_COOKIE_PARSING" \
+ "Value MHD_FEATURE_HTTPS_COOKIE_PARSING is deprecated, use MHD_FEATURE_COOKIE_PARSING" \
) MHD_FEATURE_COOKIE_PARSING
/**
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 19e77e78..94ecb1b7 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -9718,7 +9718,7 @@ MHD_is_feature_supported (enum MHD_FEATURE feature)
#else
return MHD_NO;
#endif
- case MHD_FEATURE_HTTPS_COOKIE_PARSING:
+ case MHD_FEATURE_COOKIE_PARSING:
#if defined(COOKIE_SUPPORT)
return MHD_YES;
#else