Build fails on Alpine Linux (with musl libc)
Build with musl libc (Alpine linux) on x86_64 fails with this error:
CC linux/getaddrinfo.lo
linux/getaddrinfo.c: In function 'vlc_getaddrinfo_i11e':
linux/getaddrinfo.c:43:12: error: variable 'req' has initializer but incomplete type
struct gaicb req =
^~~~~
linux/getaddrinfo.c:45:9: error: unknown field 'ar_name' specified in initializer
.ar_name = name,
^
linux/getaddrinfo.c:45:20: warning: excess elements in struct initializer
.ar_name = name,
^~~~
linux/getaddrinfo.c:45:20: note: (near initialization for 'req')
linux/getaddrinfo.c:46:9: error: unknown field 'ar_service' specified in initializer
.ar_service = NULL,
^
linux/getaddrinfo.c:46:23: warning: excess elements in struct initializer
.ar_service = NULL,
^~~~
linux/getaddrinfo.c:46:23: note: (near initialization for 'req')
linux/getaddrinfo.c:47:9: error: unknown field 'ar_request' specified in initializer
.ar_request = hints,
^
linux/getaddrinfo.c:47:23: warning: excess elements in struct initializer
.ar_request = hints,
^~~~~
linux/getaddrinfo.c:47:23: note: (near initialization for 'req')
linux/getaddrinfo.c:43:18: error: storage size of 'req' isn't known
struct gaicb req =
^~~
linux/getaddrinfo.c:70:15: error: implicit declaration of function 'getaddrinfo_a' [-Werror=implicit-function-declaration]
int val = getaddrinfo_a(GAI_NOWAIT, &(struct gaicb *){ &req }, 1, &sev);
^~~~~~~~~~~~~
linux/getaddrinfo.c:70:29: error: 'GAI_NOWAIT' undeclared (first use in this function)
int val = getaddrinfo_a(GAI_NOWAIT, &(struct gaicb *){ &req }, 1, &sev);
^~~~~~~~~~
linux/getaddrinfo.c:70:29: note: each undeclared identifier is reported only once for each function it appears in
linux/getaddrinfo.c:79:9: error: implicit declaration of function 'gai_cancel' [-Werror=implicit-function-declaration]
if (gai_cancel(&req) == EAI_CANCELED)
^~~~~~~~~~
linux/getaddrinfo.c:82:12: error: implicit declaration of function 'gai_suspend' [-Werror=implicit-function-declaration]
while (gai_suspend(&(const struct gaicb *){ &req }, 1, NULL) == EAI_INTR);
^~~~~~~~~~~
linux/getaddrinfo.c:84:11: error: implicit declaration of function 'gai_error' [-Werror=implicit-function-declaration]
val = gai_error(&req);
^~~~~~~~~
linux/getaddrinfo.c:43:18: warning: unused variable 'req' [-Wunused-variable]
struct gaicb req =
^~~
cc1: some warnings being treated as errors
Problem is that src/Makefile.am assumes that HAVE_LINUX has the GNU extension getaddrinfo_a in libanl. Musl does not implement those, but is still Linux, so build fails.
The configure script should do explicit test for getaddrinfo_a and libanl and fall back to the posix implementation otherwise.