From 637f18fb8219d1e333de2297736c07aee6a54599 Mon Sep 17 00:00:00 2001 From: Lars Wendler Date: Mon, 1 Apr 2024 11:52:15 +0200 Subject: [PATCH] meson: Add ipv6 option --- meson.build | 29 +++++++++++++++++------------ meson_options.txt | 5 +++++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/meson.build b/meson.build index 35a939a813..676f2f0a0d 100644 --- a/meson.build +++ b/meson.build @@ -403,22 +403,27 @@ else bcrypt_lib_dep = [] endif -if c_compiler.has_function('getaddrinfo', - dependencies: net_dep, - args: ['-O']) - 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); }''', - include_directories: include_directories(cross_inc_path), - name: 'getaddrinfo() as a macro') +if get_option('ipv6') + if c_compiler.has_function('getaddrinfo', + dependencies: net_dep, + args: ['-O']) priv_conf_data.set('HAVE_GETADDRINFO', 1) pub_conf_data.set('FREECIV_IPV6_SUPPORT', 1) else - warning('IPv6 support not enabled') + # Maybe it exist as a macro instead? + if c_compiler.compiles(net_incl + ''' + int main(void) { getaddrinfo(NULL, NULL, NULL, NULL); }''', + include_directories: include_directories(cross_inc_path), + name: 'getaddrinfo() as a macro') + priv_conf_data.set('HAVE_GETADDRINFO', 1) + pub_conf_data.set('FREECIV_IPV6_SUPPORT', 1) + else + warning('IPv6 support not enabled') + endif endif +else + priv_conf_data.set('HAVE_GETADDRINFO', 0) + pub_conf_data.set('FREECIV_IPV6_SUPPORT', 0) endif if c_compiler.has_header('libcharset.h', args: header_arg) diff --git a/meson_options.txt b/meson_options.txt index 5169a92cbb..1cb6a70b10 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -91,3 +91,8 @@ option('localeprefix', type: 'string', value: '', description: 'Localedir prefix to use instead of regular prefix') + +option('ipv6', + type: 'boolean', + value: true, + description: 'Disable ipv6 support') -- 2.44.0