From fa1c97f879628d42d74c7f6dec1e0713ef551991 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Wed, 22 Jun 2022 22:13:13 +0300 Subject: [PATCH 50/50] Meson: Check if getaddrinfo() is a macro See osdn #44794 Signed-off-by: Marko Lindqvist --- meson.build | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 686c4162c2..d664d65162 100644 --- a/meson.build +++ b/meson.build @@ -163,7 +163,6 @@ pub_headers = [ 'libintl.h', 'inttypes.h', 'stdint.h', - 'ws2tcpip.h', 'sys/types.h', 'unistd.h', 'sys/time.h', @@ -219,6 +218,14 @@ foreach hdr : pub_headers endif endforeach +if c_compiler.has_header('ws2tcpip.h', args: header_arg) + net_incl = '''#include ''' + pub_conf_data.set('FREECIV_HAVE_WS2TCPIP_H', 1) + priv_conf_data.set('HAVE_WS2TCPIP_H', 1) +else + net_incl = '' +endif + foreach hdr : priv_headers if c_compiler.has_header(hdr, args: header_arg) priv_conf_data.set('HAVE_' + hdr.underscorify().to_upper(), 1) @@ -308,6 +315,13 @@ endif if c_compiler.has_function('getaddrinfo', dependencies: net_dep) priv_conf_data.set('HAVE_GETADDRINFO', 1) pub_conf_data.set('FREECIV_IPV6_SUPPORT', 1) +else + # Maybe it exist as a macro instead? + if c_compiler.compiles(net_incl + ''' +int main(void) { getaddrinfo(NULL, NULL, NULL, NULL); }''') + priv_conf_data.set('HAVE_GETADDRINFO', 1) + pub_conf_data.set('FREECIV_IPV6_SUPPORT', 1) + endif endif if c_compiler.has_header('libcharset.h', args: header_arg) -- 2.35.1