libattr: convert to meson

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2020-11-17 14:45:24 +01:00
parent 727c8bb809
commit f7f2d65135
3 changed files with 41 additions and 44 deletions

45
configure vendored
View file

@ -331,8 +331,7 @@ xen_pci_passthrough="auto"
linux_aio="$default_feature"
linux_io_uring="$default_feature"
cap_ng="auto"
attr="$default_feature"
libattr="$default_feature"
attr="auto"
xfs="$default_feature"
tcg="enabled"
membarrier="$default_feature"
@ -1229,9 +1228,9 @@ for opt do
;;
--enable-linux-io-uring) linux_io_uring="yes"
;;
--disable-attr) attr="no"
--disable-attr) attr="disabled"
;;
--enable-attr) attr="yes"
--enable-attr) attr="enabled"
;;
--disable-membarrier) membarrier="no"
;;
@ -3575,36 +3574,6 @@ elif test "$tpm" = "yes"; then
fi
fi
##########################################
# attr probe
libattr_libs=
if test "$attr" != "no" ; then
cat > $TMPC <<EOF
#include <stdio.h>
#include <sys/types.h>
#ifdef CONFIG_LIBATTR
#include <attr/xattr.h>
#else
#include <sys/xattr.h>
#endif
int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }
EOF
if compile_prog "" "" ; then
attr=yes
# Older distros have <attr/xattr.h>, and need -lattr:
elif compile_prog "-DCONFIG_LIBATTR" "-lattr" ; then
attr=yes
libattr_libs="-lattr"
libattr=yes
else
if test "$attr" = "yes" ; then
feature_not_found "ATTR" "Install libc6 or libattr devel"
fi
attr=no
fi
fi
##########################################
# iovec probe
cat > $TMPC <<EOF
@ -5899,13 +5868,6 @@ if test "$linux_io_uring" = "yes" ; then
echo "LINUX_IO_URING_CFLAGS=$linux_io_uring_cflags" >> $config_host_mak
echo "LINUX_IO_URING_LIBS=$linux_io_uring_libs" >> $config_host_mak
fi
if test "$attr" = "yes" ; then
echo "CONFIG_ATTR=y" >> $config_host_mak
echo "LIBATTR_LIBS=$libattr_libs" >> $config_host_mak
fi
if test "$libattr" = "yes" ; then
echo "CONFIG_LIBATTR=y" >> $config_host_mak
fi
if test "$vhost_scsi" = "yes" ; then
echo "CONFIG_VHOST_SCSI=y" >> $config_host_mak
fi
@ -6578,6 +6540,7 @@ NINJA=$ninja $meson setup \
-Dlibnfs=$libnfs -Diconv=$iconv -Dcurses=$curses -Dlibudev=$libudev\
-Drbd=$rbd -Dlzo=$lzo -Dsnappy=$snappy -Dlzfse=$lzfse \
-Dzstd=$zstd -Dseccomp=$seccomp -Dvirtfs=$virtfs -Dcap_ng=$cap_ng \
-Dattr=$attr \
-Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
-Dvhost_user_blk_server=$vhost_user_blk_server \
-Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \

View file

@ -328,10 +328,40 @@ if not get_option('libnfs').auto() or have_block
required: get_option('libnfs'),
method: 'pkg-config', static: enable_static)
endif
libattr_test = '''
#include <stddef.h>
#include <sys/types.h>
#ifdef CONFIG_LIBATTR
#include <attr/xattr.h>
#else
#include <sys/xattr.h>
#endif
int main(void) { getxattr(NULL, NULL, NULL, 0); setxattr(NULL, NULL, NULL, 0, 0); return 0; }'''
libattr = not_found
if 'CONFIG_ATTR' in config_host
libattr = declare_dependency(link_args: config_host['LIBATTR_LIBS'].split())
have_old_libattr = false
if not get_option('attr').disabled()
if cc.links(libattr_test)
libattr = declare_dependency()
else
libattr = cc.find_library('attr', has_headers: ['attr/xattr.h'],
required: get_option('attr'),
static: enable_static)
if libattr.found() and not \
cc.links(libattr_test, dependencies: libattr, args: '-DCONFIG_LIBATTR')
libattr = not_found
if get_option('attr').enabled()
error('could not link libattr')
else
warning('could not link libattr, disabling')
endif
else
have_old_libattr = libattr.found()
endif
endif
endif
seccomp = not_found
if not get_option('seccomp').auto() or have_system or have_tools
seccomp = dependency('libseccomp', version: '>=2.3.0',
@ -1014,6 +1044,7 @@ config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefix') /
config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / qemu_moddir)
config_host_data.set_quoted('CONFIG_SYSCONFDIR', get_option('prefix') / get_option('sysconfdir'))
config_host_data.set('CONFIG_ATTR', libattr.found())
config_host_data.set('CONFIG_BRLAPI', brlapi.found())
config_host_data.set('CONFIG_COCOA', cocoa.found())
config_host_data.set('CONFIG_LIBUDEV', libudev.found())
@ -1031,6 +1062,7 @@ if glusterfs.found()
config_host_data.set('CONFIG_GLUSTERFS_FTRUNCATE_HAS_STAT', glusterfs_ftruncate_has_stat)
config_host_data.set('CONFIG_GLUSTERFS_IOCB_HAS_STAT', glusterfs_iocb_has_stat)
endif
config_host_data.set('CONFIG_LIBATTR', have_old_libattr)
config_host_data.set('CONFIG_LIBCAP_NG', libcap_ng.found())
config_host_data.set('CONFIG_LIBISCSI', libiscsi.found())
config_host_data.set('CONFIG_LIBNFS', libnfs.found())
@ -2352,7 +2384,7 @@ summary_info += {'vde support': config_host.has_key('CONFIG_VDE')}
summary_info += {'netmap support': config_host.has_key('CONFIG_NETMAP')}
summary_info += {'Linux AIO support': config_host.has_key('CONFIG_LINUX_AIO')}
summary_info += {'Linux io_uring support': config_host.has_key('CONFIG_LINUX_IO_URING')}
summary_info += {'ATTR/XATTR support': config_host.has_key('CONFIG_ATTR')}
summary_info += {'ATTR/XATTR support': libattr.found()}
summary_info += {'Install blobs': get_option('install_blobs')}
summary_info += {'KVM support': config_all.has_key('CONFIG_KVM')}
summary_info += {'HAX support': config_all.has_key('CONFIG_HAX')}

View file

@ -40,6 +40,8 @@ option('cfi', type: 'boolean', value: 'false',
option('cfi_debug', type: 'boolean', value: 'false',
description: 'Verbose errors in case of CFI violation')
option('attr', type : 'feature', value : 'auto',
description: 'attr/xattr support')
option('brlapi', type : 'feature', value : 'auto',
description: 'brlapi character device driver')
option('bzip2', type : 'feature', value : 'auto',