From 94fad53de961e0cfa29a85e6923bbf0d9d4646b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fred=20Helmesj=C3=B6?= Date: Thu, 1 Sep 2022 10:38:24 +0200 Subject: [PATCH] Add socklen_t (GH PR #39) --- .../libbuild2/autoconf/checks/socklen_t.h | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 libbuild2-autoconf/libbuild2/autoconf/checks/socklen_t.h diff --git a/libbuild2-autoconf/libbuild2/autoconf/checks/socklen_t.h b/libbuild2-autoconf/libbuild2/autoconf/checks/socklen_t.h new file mode 100644 index 0000000..cef454d --- /dev/null +++ b/libbuild2-autoconf/libbuild2/autoconf/checks/socklen_t.h @@ -0,0 +1,31 @@ +// socklen_t : BUILD2_AUTOCONF_LIBC_VERSION + +#ifndef BUILD2_AUTOCONF_LIBC_VERSION +# error BUILD2_AUTOCONF_LIBC_VERSION appears to be conditionally included +#endif + +#undef socklen_t + +/* Since 4.xBSD, SunOS + * The Single UNIX Specification, Version 2 + * makes available a type, socklen_t, which is + * an unsigned opaque integral type of length of at least 32 bits. + * To forestall portability problems, it is recommended that + * applications should not use values larger than 232 - 1. + */ +#if defined(__linux__) || \ + defined(__FreeBSD__) || \ + defined(__OpenBSD__) || \ + defined(__NetBSD__) || \ + defined(BUILD2_AUTOCONF_MACOS) || \ + (defined(__sun) && defined(__SVR4)) || \ + defined(__CYGWIN__) +# include + /* If available, we do nothing. */ +#elif defined(_WIN32) +# include + /* If available, we do nothing. */ +#else + /* Else define it to unsigned int (suggested fallback by libevent). */ +# define socklen_t unsigned int +#endif