meson: add functions check

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
This commit is contained in:
Pavel Hrdina 2020-07-10 09:48:30 +02:00
parent 6639943b23
commit d0fd4f55ed
2 changed files with 47 additions and 33 deletions

View File

@ -207,38 +207,6 @@ LIBVIRT_CHECK_YAJL
AC_CHECK_SIZEOF([long]) AC_CHECK_SIZEOF([long])
dnl Availability of various common functions (non-fatal if missing),
dnl and various less common threadsafe functions
AC_CHECK_FUNCS_ONCE([\
elf_aux_info \
fallocate \
getauxval \
getegid \
geteuid \
getgid \
getifaddrs \
getmntent_r \
getpwuid_r \
getrlimit \
getuid \
getutxid \
if_indextoname \
mmap \
newlocale \
posix_fallocate \
posix_memalign \
pipe2 \
prlimit \
sched_getaffinity \
sched_setscheduler \
setgroups \
setns \
setrlimit \
symlink \
sysctlbyname \
unshare \
])
dnl Availability of various common headers (non-fatal if missing). dnl Availability of various common headers (non-fatal if missing).
AC_CHECK_HEADERS([\ AC_CHECK_HEADERS([\
asm/hwcap.h \ asm/hwcap.h \
@ -263,7 +231,6 @@ AC_CHECK_HEADERS([\
AC_CHECK_HEADERS([net/if.h], [], [], [[#include <sys/socket.h>]]) AC_CHECK_HEADERS([net/if.h], [], [], [[#include <sys/socket.h>]])
dnl Check whether endian provides handy macros. dnl Check whether endian provides handy macros.
AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]]) AC_CHECK_DECLS([htole64], [], [], [[#include <endian.h>]])
AC_CHECK_FUNCS([stat stat64 __xstat __xstat64 lstat lstat64 __lxstat __lxstat64])
AC_CHECK_TYPE([struct ifreq], AC_CHECK_TYPE([struct ifreq],
[AC_DEFINE([HAVE_STRUCT_IFREQ],[1], [AC_DEFINE([HAVE_STRUCT_IFREQ],[1],

View File

@ -630,6 +630,53 @@ libvirt_export_dynamic = cc.first_supported_link_argument([
]) ])
# check availability of various common functions (non-fatal if missing)
functions = [
'__lxstat',
'__lxstat64',
'__xstat',
'__xstat64',
'elf_aux_info',
'fallocate',
'getauxval',
'getegid',
'geteuid',
'getgid',
'getifaddrs',
'getmntent_r',
'getpwuid_r',
'getrlimit',
'getuid',
'getutxid',
'if_indextoname',
'lstat',
'lstat64',
'mmap',
'newlocale',
'pipe2',
'posix_fallocate',
'posix_memalign',
'prlimit',
'sched_getaffinity',
'sched_setscheduler',
'setgroups',
'setns',
'setrlimit',
'stat',
'stat64',
'symlink',
'sysctlbyname',
'unshare',
]
foreach function : functions
if cc.has_function(function)
conf.set('HAVE_@0@'.format(function.to_upper()), 1)
endif
endforeach
# define top include directory # define top include directory
top_inc_dir = include_directories('.') top_inc_dir = include_directories('.')