Просмотр исходного кода

meson: fix build failure on glibc >= 2.34 without standalone libanl (#2484)

On glibc >= 2.34, getaddrinfo_a is no longer provided by a standalone
libanl shared library — it is built directly into libc.  Newer
architectures (e.g. loongarch64, riscv64) have never shipped a separate
libanl, causing the meson build to fail with:

    C++ shared or static library 'anl' not found

Signed-off-by: Pluto Yang <yangyj.ee@gmail.com>
Yanjun Yang(Pluto) 1 месяц назад
Родитель
Сommit
9a5321aadb
1 измененных файлов с 6 добавлено и 1 удалено
  1. 6 1
      meson.build

+ 6 - 1
meson.build

@@ -107,7 +107,12 @@ if host_machine.system() == 'windows'
 elif host_machine.system() == 'darwin'
 elif host_machine.system() == 'darwin'
   async_ns_dep = dependency('appleframeworks', modules: ['CFNetwork', 'CoreFoundation'], required: async_ns_opt)
   async_ns_dep = dependency('appleframeworks', modules: ['CFNetwork', 'CoreFoundation'], required: async_ns_opt)
 else
 else
-  async_ns_dep = cxx.find_library('anl', required: async_ns_opt)
+  has_gai_a = cxx.has_function('getaddrinfo_a', args: '-D_GNU_SOURCE')
+  if has_gai_a
+    async_ns_dep = declare_dependency()
+  else
+    async_ns_dep = cxx.find_library('anl', required: async_ns_opt)
+  endif
 endif
 endif
 
 
 if async_ns_dep.found()
 if async_ns_dep.found()