From d47a8b3b692a06852bd70fd7832bd22adfcb2431 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 3 Jun 2021 12:02:00 +0200 Subject: [PATCH] configure: convert compiler tests to meson, part 6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 75 ----------------------------------------------------- meson.build | 11 ++++++++ 2 files changed, 11 insertions(+), 75 deletions(-) diff --git a/configure b/configure index 1cac47399d..0e487ae091 100755 --- a/configure +++ b/configure @@ -3763,65 +3763,6 @@ else # "$safe_stack" = "" fi fi -########################################## -# check if we have open_by_handle_at - -open_by_handle_at=no -cat > $TMPC << EOF -#include -#if !defined(AT_EMPTY_PATH) -# error missing definition -#else -int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } -#endif -EOF -if compile_prog "" "" ; then - open_by_handle_at=yes -fi - -######################################## -# check if we have linux/magic.h - -linux_magic_h=no -cat > $TMPC << EOF -#include -int main(void) { - return 0; -} -EOF -if compile_prog "" "" ; then - linux_magic_h=yes -fi - -######################################## -# check if we have valgrind/valgrind.h - -valgrind_h=no -cat > $TMPC << EOF -#include -int main(void) { - return 0; -} -EOF -if compile_prog "" "" ; then - valgrind_h=yes -fi - -######################################## -# check if environ is declared - -has_environ=no -cat > $TMPC << EOF -#include -int main(void) { - environ = 0; - return 0; -} -EOF -if compile_prog "" "" ; then - has_environ=yes -fi - ######################################## # check if cpuid.h is usable. @@ -4761,18 +4702,6 @@ if test "$crypto_afalg" = "yes" ; then echo "CONFIG_AF_ALG=y" >> $config_host_mak fi -if test "$open_by_handle_at" = "yes" ; then - echo "CONFIG_OPEN_BY_HANDLE=y" >> $config_host_mak -fi - -if test "$linux_magic_h" = "yes" ; then - echo "CONFIG_LINUX_MAGIC_H=y" >> $config_host_mak -fi - -if test "$valgrind_h" = "yes" ; then - echo "CONFIG_VALGRIND_H=y" >> $config_host_mak -fi - if test "$have_asan_iface_fiber" = "yes" ; then echo "CONFIG_ASAN_IFACE_FIBER=y" >> $config_host_mak fi @@ -4781,10 +4710,6 @@ if test "$have_tsan" = "yes" && test "$have_tsan_iface_fiber" = "yes" ; then echo "CONFIG_TSAN=y" >> $config_host_mak fi -if test "$has_environ" = "yes" ; then - echo "CONFIG_HAS_ENVIRON=y" >> $config_host_mak -fi - if test "$cpuid_h" = "yes" ; then echo "CONFIG_CPUID_H=y" >> $config_host_mak fi diff --git a/meson.build b/meson.build index 12162264db..1651496800 100644 --- a/meson.build +++ b/meson.build @@ -1260,6 +1260,8 @@ config_host_data.set('HAVE_HOST_BLOCK_DEVICE', have_host_block_device) # has_header config_host_data.set('CONFIG_EPOLL', cc.has_header('sys/epoll.h')) +config_host_data.set('CONFIG_LINUX_MAGIC_H', cc.has_header('linux/magic.h')) +config_host_data.set('CONFIG_VALGRIND_H', cc.has_header('valgrind/valgrind.h')) config_host_data.set('HAVE_BTRFS_H', cc.has_header('linux/btrfs.h')) config_host_data.set('HAVE_DRM_H', cc.has_header('libdrm/drm.h')) config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h')) @@ -1292,6 +1294,8 @@ config_host_data.set('CONFIG_BYTESWAP_H', cc.has_header_symbol('byteswap.h', 'bswap_32')) config_host_data.set('CONFIG_EPOLL_CREATE1', cc.has_header_symbol('sys/epoll.h', 'epoll_create1')) +config_host_data.set('CONFIG_HAS_ENVIRON', + cc.has_header_symbol('unistd.h', 'environ', prefix: gnu_source_prefix)) config_host_data.set('CONFIG_FALLOCATE_PUNCH_HOLE', cc.has_header_symbol('linux/falloc.h', 'FALLOC_FL_PUNCH_HOLE') and cc.has_header_symbol('linux/falloc.h', 'FALLOC_FL_KEEP_SIZE')) @@ -1350,6 +1354,13 @@ config_host_data.set('CONFIG_MADVISE', cc.compiles(gnu_source_prefix + ''' config_host_data.set('CONFIG_MEMFD', cc.compiles(gnu_source_prefix + ''' #include int main(void) { return memfd_create("foo", MFD_ALLOW_SEALING); }''')) +config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.compiles(gnu_source_prefix + ''' + #include + #if !defined(AT_EMPTY_PATH) + # error missing definition + #else + int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh, 0); } + #endif''')) config_host_data.set('CONFIG_PIPE2', cc.compiles(gnu_source_prefix + ''' #include #include