]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Instead of detecting MUSL libc, detect padding in struct msghdr
authorOndrej Sury <ondrej@isc.org>
Thu, 13 Jan 2022 21:43:20 +0000 (22:43 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 13 Jan 2022 22:06:09 +0000 (23:06 +0100)
The detection of MUSL libc via autoconf $host turned out to be
not reliable.

Convert the autoconf check from $host detection to actually detect
the padding used in the struct msghdr.

configure.ac

index 035a7d0cff3da0232da3919dbd7aebebdc659f39..4e6220d499ca0aedc294188900afd5642a06030e 100644 (file)
@@ -552,9 +552,15 @@ PKG_CHECK_MODULES([LIBUV], [libuv >= 1.0.0], [],
                  [AC_MSG_ERROR([libuv not found])])
 
 # libuv recvmmsg support
-AC_CHECK_DECLS([UV_UDP_RECVMMSG, UV_UDP_MMSG_FREE, UV_UDP_MMSG_CHUNK], [], [], [[#include <uv.h>]])
-AS_CASE([$host],
-       [*-musl],[AC_DEFINE([HAVE_DECL_UV_UDP_RECVMMSG], [0], [Disable recvmmsg support on systems with MUSL glibc])])
+AC_CHECK_DECLS([UV_UDP_MMSG_FREE, UV_UDP_MMSG_CHUNK], [], [], [[#include <uv.h>]])
+AC_MSG_CHECKING([whether struct msghdr uses padding for alignment])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <sys/socket.h>],
+                                  [const struct msghdr h = { .__pad1 = 0, .__pad2 = 0 };])],
+                 [AC_MSG_RESULT([yes])
+                  AC_DEFINE([HAVE_DECL_UV_UDP_RECVMMSG],
+                            [0], [Disable recvmmsg support on systems with MUSL glibc])],
+                 [AC_MSG_RESULT([no])
+                  AC_CHECK_DECLS([UV_UDP_RECVMMSG], [], [], [[#include <uv.h>]])])
 
 # [pairwise: --enable-doh --with-libnghttp2=auto, --enable-doh --with-libnghttp2=yes, --disable-doh]
 AC_ARG_ENABLE([doh],