[vlc-devel] [PATCH] configure: test for getaddrinfo_a and libanl

Natanael Copa ncopa at alpinelinux.org
Wed Dec 20 13:21:02 CET 2017


Test for the existence of the GNU extension getaddrinf_a and libanl
instead of assuming that every Linux has it. Fall back to posix variant
if they are missing.

This fixes build with musl libc which does not implement this GNU
extension.

Fixes #19320

Signed-off-by: Natanael Copa <ncopa at alpinelinux.org>
---
 configure.ac    | 5 +++++
 src/Makefile.am | 5 ++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index acbee6c0b1..d3d9e20105 100644
--- a/configure.ac
+++ b/configure.ac
@@ -330,6 +330,7 @@ AM_CONDITIONAL(HAVE_OSX,     test "${HAVE_OSX}" = "1")
 AM_CONDITIONAL(HAVE_TVOS,    test "${HAVE_TVOS}" = "1")
 
 AM_CONDITIONAL(HAVE_NACL,    test "${SYS}" = "nacl")
+AM_CONDITIONAL(HAVE_LIBANL,  test "${HAVE_LIBANL}" = "1")
 
 AM_CONDITIONAL(HAVE_WIN32,   test "${SYS}" = "mingw32")
 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1") dnl Only used for the packaging
@@ -759,6 +760,10 @@ dnl __STDC_NO_THREADS__ can't be trusted on some platforms.
 dnl check for its availability explicitely
 AC_CHECK_HEADERS([threads.h])
 
+AC_CHECK_LIB([anl],[getaddrinfo_a],[
+  AC_DEFINE(HAVE_LIBANL, 1, [Define to 1 if you have the anl library])
+])
+
 dnl Check for dynamic plugins
 LIBDL=""
 have_dynamic_objects="no"
diff --git a/src/Makefile.am b/src/Makefile.am
index 096dfc2a24..b77ddf4132 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -429,8 +429,11 @@ if HAVE_LINUX
 libvlccore_la_SOURCES += \
 	linux/cpu.c \
 	linux/dirs.c \
-	linux/getaddrinfo.c \
 	linux/thread.c
+endif
+if HAVE_LIBANL
+libvlccore_la_SOURCES += \
+	linux/getaddrinfo.c
 libvlccore_la_LIBADD += -lanl
 else
 libvlccore_la_SOURCES += \
-- 
2.15.0



More information about the vlc-devel mailing list