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 <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1539>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-04-17 18:46:15 +02:00 committed by Marge Bot
parent 88b2257cc4
commit bc55a98d62

View File

@ -281,11 +281,23 @@ if build_xquartz
build_rootless = true
endif
# IPv6 support
have_AF_INET6 = cc.compiles('''
#ifdef WIN32
#include <winsock2.h>
#else
#include <sys/socket.h>
#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'