build: verify #include <libelf.h> works before deciding to use it

This check is necessary for Solaris & illumos, where 32-bit libelf
is incompatible with large-file mode, which meson forces to be enabled,
but 64-bit libelf works fine.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
This commit is contained in:
Alan Coopersmith 2024-10-14 18:16:57 -07:00
parent b6004c70cc
commit f46ea74586

View File

@ -969,6 +969,9 @@ else
have_libelf = have_libelf and cc.has_function('elf_getshdrstrndx', dependencies : libelf)
have_libelf = have_libelf and cc.has_function('elf_getshdrnum', dependencies : libelf)
have_libelf = have_libelf and cc.has_header('libelf.h')
# This check is necessary for Solaris & illumos, where 32-bit libelf
# is incompatible with large-file mode, which meson forces to be enabled
have_libelf = have_libelf and cc.compiles('#include <libelf.h>', name: 'libelf.h')
endif
if have_libelf