meson: make AF_INET6 check work with stricter compiler flags

Previously it failed with:
_build/meson-private/tmpr7qpcbo1/testfile.c: In function 'main':
_build/meson-private/tmpr7qpcbo1/testfile.c:7:5:
 error: old-style function definition [-Werror=old-style-definition]
    7 | int main() { int foo = AF_INET6; }
      |     ^~~~
_build/meson-private/tmpr7qpcbo1/testfile.c:7:18:
 warning: unused variable 'foo' [-Wunused-variable]
    7 | int main() { int foo = AF_INET6; }
      |                  ^~~

Fixes: bc55a98d6 ("meson: explicitly check whether AF_INET6 is available")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1627>
This commit is contained in:
Alan Coopersmith 2024-07-27 11:59:34 -07:00
parent ed9c48a030
commit f3b43adf3a

View File

@ -291,7 +291,7 @@ have_AF_INET6 = cc.compiles('''
#else
#include <sys/socket.h>
#endif
int main() { int foo = AF_INET6; }''')
int main(void) { int foo = AF_INET6; return foo; }''')
if get_option('ipv6') == 'auto'
build_ipv6 = cc.has_function('getaddrinfo') and have_AF_INET6
else