os: if getaddrinfo() is available, use it, even if IPv6 support is disabled

Support for using getaddrinfo() was originally added to support IPv6,
and only used if IPv6 support was enabled.  Two decades later, support
for getaddrinfo() is ubiquitous and OS'es have marked gethostbyname()
as deprecated, so use the modern interface whenever we can now.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1760>
This commit is contained in:
Alan Coopersmith
2025-01-12 10:45:01 -08:00
committed by Marge Bot
parent 5397854877
commit 2ffe0f8a35
4 changed files with 39 additions and 21 deletions

View File

@@ -146,6 +146,7 @@ conf_data.set('HAVE_GETUID', cc.has_function('getuid') ? '1' : false)
conf_data.set('HAVE_GETEUID', cc.has_function('geteuid') ? '1' : false)
conf_data.set('HAVE_ISASTREAM', cc.has_function('isastream') ? '1' : false)
conf_data.set('HAVE_ISSETUGID', cc.has_function('issetugid') ? '1' : false)
conf_data.set('HAVE_GETADDRINFO', cc.has_function('getaddrinfo') ? '1' : false)
conf_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs') ? '1' : false)
conf_data.set('HAVE_GETPEEREID', cc.has_function('getpeereid') ? '1' : false)
conf_data.set('HAVE_GETPEERUCRED', cc.has_function('getpeerucred') ? '1' : false)