From bc55a98d62a5e1d695cbbd8741c35e6f5765c8be Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 17 Apr 2024 18:46:15 +0200 Subject: [PATCH] meson: explicitly check whether AF_INET6 is available We're currently not checking whether IPv6 is available before build, so it just gets silently disabled if AF_INET6 is missing - even when user wants to enable it explicitly. Adding explicit check into meson.build, so failing when ipv6 option enabled, but no IPv6 supported. Signed-off-by: Enrico Weigelt, metux IT consult Part-of: --- meson.build | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 338db91b3..2a66fb13c 100644 --- a/meson.build +++ b/meson.build @@ -281,11 +281,23 @@ if build_xquartz build_rootless = true endif +# IPv6 support +have_AF_INET6 = cc.compiles(''' +#ifdef WIN32 +#include +#else +#include +#endif +int main() { int foo = AF_INET6; }''') if get_option('ipv6') == 'auto' - build_ipv6 = cc.has_function('getaddrinfo') + build_ipv6 = cc.has_function('getaddrinfo') and have_AF_INET6 else build_ipv6 = get_option('ipv6') == 'true' endif +if build_ipv6 and not have_AF_INET6 + error('ipv6 support needs AF_INET6') +endif +message('IPv6 support: ' + (build_ipv6 ? 'YES' : 'NO')) int10 = get_option('int10') if int10 == 'auto'