configure, meson: move AF_ALG test to meson

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2021-11-08 14:02:42 +01:00
parent b87df9043c
commit 34b52615a0
5 changed files with 23 additions and 38 deletions

36
configure vendored
View file

@ -329,7 +329,6 @@ want_tools="$default_feature"
coroutine="" coroutine=""
coroutine_pool="$default_feature" coroutine_pool="$default_feature"
debug_stack_usage="no" debug_stack_usage="no"
crypto_afalg="no"
tls_priority="NORMAL" tls_priority="NORMAL"
tpm="$default_feature" tpm="$default_feature"
live_block_migration=${default_feature:-yes} live_block_migration=${default_feature:-yes}
@ -976,10 +975,6 @@ for opt do
;; ;;
--enable-debug-stack-usage) debug_stack_usage="yes" --enable-debug-stack-usage) debug_stack_usage="yes"
;; ;;
--enable-crypto-afalg) crypto_afalg="yes"
;;
--disable-crypto-afalg) crypto_afalg="no"
;;
--disable-vhost-net) vhost_net="no" --disable-vhost-net) vhost_net="no"
;; ;;
--enable-vhost-net) vhost_net="yes" --enable-vhost-net) vhost_net="yes"
@ -1402,7 +1397,6 @@ cat << EOF
vvfat vvfat image format support vvfat vvfat image format support
qed qed image format support qed qed image format support
parallels parallels image format support parallels parallels image format support
crypto-afalg Linux AF_ALG crypto backend driver
debug-mutex mutex debugging support debug-mutex mutex debugging support
rng-none dummy RNG, avoid using /dev/(u)random and getrandom() rng-none dummy RNG, avoid using /dev/(u)random and getrandom()
gio libgio support gio libgio support
@ -2817,32 +2811,6 @@ if test "$fortify_source" != "no"; then
fi fi
fi fi
##########################################
# check for usable AF_ALG environment
have_afalg=no
cat > $TMPC << EOF
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if_alg.h>
int main(void) {
int sock;
sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
return sock;
}
EOF
if compile_prog "" "" ; then
have_afalg=yes
fi
if test "$crypto_afalg" = "yes"
then
if test "$have_afalg" != "yes"
then
error_exit "AF_ALG requested but could not be detected"
fi
fi
########################################## ##########################################
# checks for sanitizers # checks for sanitizers
@ -3308,10 +3276,6 @@ if test "$debug_stack_usage" = "yes" ; then
echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak echo "CONFIG_DEBUG_STACK_USAGE=y" >> $config_host_mak
fi fi
if test "$crypto_afalg" = "yes" ; then
echo "CONFIG_AF_ALG=y" >> $config_host_mak
fi
if test "$have_asan_iface_fiber" = "yes" ; then if test "$have_asan_iface_fiber" = "yes" ; then
echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak
fi fi

View file

@ -35,7 +35,9 @@ else
endif endif
crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c')) crypto_ss.add(when: 'CONFIG_SECRET_KEYRING', if_true: files('secret_keyring.c'))
crypto_ss.add(when: 'CONFIG_AF_ALG', if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c')) if have_afalg
crypto_ss.add(if_true: files('afalg.c', 'cipher-afalg.c', 'hash-afalg.c'))
endif
crypto_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c')) crypto_ss.add(when: gnutls, if_true: files('tls-cipher-suites.c'))
util_ss.add(files('aes.c')) util_ss.add(files('aes.c'))

View file

@ -1828,6 +1828,20 @@ config_host_data.set('CONFIG_MEMBARRIER', get_option('membarrier') \
.require(have_membarrier, error_message: 'membarrier system call not available') \ .require(have_membarrier, error_message: 'membarrier system call not available') \
.allowed()) .allowed())
have_afalg = get_option('crypto_afalg') \
.require(cc.compiles(gnu_source_prefix + '''
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if_alg.h>
int main(void) {
int sock;
sock = socket(AF_ALG, SOCK_SEQPACKET, 0);
return sock;
}
'''), error_message: 'AF_ALG requested but could not be detected').allowed()
config_host_data.set('CONFIG_AF_ALG', have_afalg)
config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + ''' config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
@ -3453,7 +3467,7 @@ summary_info += {'nettle': nettle}
if nettle.found() if nettle.found()
summary_info += {' XTS': xts != 'private'} summary_info += {' XTS': xts != 'private'}
endif endif
summary_info += {'crypto afalg': config_host.has_key('CONFIG_AF_ALG')} summary_info += {'AF_ALG support': have_afalg}
summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')} summary_info += {'rng-none': config_host.has_key('CONFIG_RNG_NONE')}
summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')} summary_info += {'Linux keyring': config_host.has_key('CONFIG_SECRET_KEYRING')}
summary(summary_info, bool_yn: true, section: 'Crypto') summary(summary_info, bool_yn: true, section: 'Crypto')

View file

@ -113,6 +113,8 @@ option('nettle', type : 'feature', value : 'auto',
description: 'nettle cryptography support') description: 'nettle cryptography support')
option('gcrypt', type : 'feature', value : 'auto', option('gcrypt', type : 'feature', value : 'auto',
description: 'libgcrypt cryptography support') description: 'libgcrypt cryptography support')
option('crypto_afalg', type : 'feature', value : 'disabled',
description: 'Linux AF_ALG crypto backend driver')
option('libdaxctl', type : 'feature', value : 'auto', option('libdaxctl', type : 'feature', value : 'auto',
description: 'libdaxctl support') description: 'libdaxctl support')
option('libpmem', type : 'feature', value : 'auto', option('libpmem', type : 'feature', value : 'auto',

View file

@ -34,6 +34,7 @@ meson_options_help() {
printf "%s\n" ' cap-ng cap_ng support' printf "%s\n" ' cap-ng cap_ng support'
printf "%s\n" ' cocoa Cocoa user interface (macOS only)' printf "%s\n" ' cocoa Cocoa user interface (macOS only)'
printf "%s\n" ' coreaudio CoreAudio sound support' printf "%s\n" ' coreaudio CoreAudio sound support'
printf "%s\n" ' crypto-afalg Linux AF_ALG crypto backend driver'
printf "%s\n" ' curl CURL block device driver' printf "%s\n" ' curl CURL block device driver'
printf "%s\n" ' curses curses UI' printf "%s\n" ' curses curses UI'
printf "%s\n" ' dbus-display -display dbus support' printf "%s\n" ' dbus-display -display dbus support'
@ -135,6 +136,8 @@ _meson_option_parse() {
--disable-cocoa) printf "%s" -Dcocoa=disabled ;; --disable-cocoa) printf "%s" -Dcocoa=disabled ;;
--enable-coreaudio) printf "%s" -Dcoreaudio=enabled ;; --enable-coreaudio) printf "%s" -Dcoreaudio=enabled ;;
--disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;; --disable-coreaudio) printf "%s" -Dcoreaudio=disabled ;;
--enable-crypto-afalg) printf "%s" -Dcrypto_afalg=enabled ;;
--disable-crypto-afalg) printf "%s" -Dcrypto_afalg=disabled ;;
--enable-curl) printf "%s" -Dcurl=enabled ;; --enable-curl) printf "%s" -Dcurl=enabled ;;
--disable-curl) printf "%s" -Dcurl=disabled ;; --disable-curl) printf "%s" -Dcurl=disabled ;;
--enable-curses) printf "%s" -Dcurses=enabled ;; --enable-curses) printf "%s" -Dcurses=enabled ;;