diff mbox series

[4/6] configure.ac: Add <sys/socket.h> header when checking sizeof(socklen_t)

Message ID 42879dea46c255025fb579dcf7b15335fd77291c.1566976047.git.ps@pks.im (mailing list archive)
State New, archived
Headers show
Series Fixes for various compiler warnings | expand

Commit Message

Patrick Steinhardt Aug. 28, 2019, 7:10 a.m. UTC
We're checking for various sizes in configure.ac, among them the size of
the socklen_t type. If socklen_t's size is not found and thus reported
to be zero, we will typedef our own socklen_t as "unsigned int".

The check for socklen_t is insufficient, though. While the type is
declared via <sys/socket.h>, we only search AC_INCLUDES_DEFAULT for its
declaration, which doesn't include <sys/socket.h>. On musl libc, this
causes us to not find the declaration and redeclare it with an
incompatible type.

Fix the issue by searching both the default includes as well as
<sys/socket.h>.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 configure.ac | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/configure.ac b/configure.ac
index 50002b4a..37096944 100644
--- a/configure.ac
+++ b/configure.ac
@@ -545,7 +545,10 @@  AC_CHECK_SIZEOF(short)
 AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(size_t)
-AC_CHECK_SIZEOF(socklen_t)
+AC_CHECK_SIZEOF(socklen_t,, [AC_INCLUDES_DEFAULT
+                             #ifdef HAVE_SYS_SOCKET_H
+                             # include <sys/socket.h>
+                             #endif])
 
 
 dnl *************************************************************