qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 09/30] configure, meson: move libnuma detection to meson
Date: Tue, 15 Feb 2022 10:32:02 +0100	[thread overview]
Message-ID: <20220215093223.110827-10-pbonzini@redhat.com> (raw)
In-Reply-To: <20220215093223.110827-1-pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 31 -------------------------------
 meson.build                   | 25 ++++++++++++++++++++-----
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  3 +++
 4 files changed, 25 insertions(+), 36 deletions(-)

diff --git a/configure b/configure
index 07ea08cd08..f536f53106 100755
--- a/configure
+++ b/configure
@@ -332,7 +332,6 @@ debug_stack_usage="no"
 tls_priority="NORMAL"
 tpm="$default_feature"
 live_block_migration=${default_feature:-yes}
-numa="$default_feature"
 replication=${default_feature:-yes}
 bochs=${default_feature:-yes}
 cloop=${default_feature:-yes}
@@ -1048,10 +1047,6 @@ for opt do
   ;;
   --enable-live-block-migration) live_block_migration="yes"
   ;;
-  --disable-numa) numa="no"
-  ;;
-  --enable-numa) numa="yes"
-  ;;
   --disable-replication) replication="no"
   ;;
   --enable-replication) replication="yes"
@@ -1384,7 +1379,6 @@ cat << EOF
   live-block-migration   Block migration in the main migration stream
   coroutine-pool  coroutine freelist (better performance)
   tpm             TPM support
-  numa            libnuma support
   replication     replication support
   opengl          opengl support
   qom-cast-debug  cast debugging support
@@ -2455,26 +2449,6 @@ EOF
   fi
 fi
 
-##########################################
-# libnuma probe
-
-if test "$numa" != "no" ; then
-  cat > $TMPC << EOF
-#include <numa.h>
-int main(void) { return numa_available(); }
-EOF
-
-  if compile_prog "" "-lnuma" ; then
-    numa=yes
-    numa_libs="-lnuma"
-  else
-    if test "$numa" = "yes" ; then
-      feature_not_found "numa" "install numactl devel"
-    fi
-    numa=no
-  fi
-fi
-
 # check for usbfs
 have_usbfs=no
 if test "$linux_user" = "yes"; then
@@ -3442,11 +3416,6 @@ if test "$default_targets" = "yes"; then
   echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
 fi
 
-if test "$numa" = "yes"; then
-  echo "CONFIG_NUMA=y" >> $config_host_mak
-  echo "NUMA_LIBS=$numa_libs" >> $config_host_mak
-fi
-
 if test "$ccache_cpp2" = "yes"; then
   echo "export CCACHE_CPP2=y" >> $config_host_mak
 fi
diff --git a/meson.build b/meson.build
index 9e1acb98aa..f8b83f64db 100644
--- a/meson.build
+++ b/meson.build
@@ -1164,14 +1164,28 @@ if lzo.found() and not cc.links('''
   endif
 endif
 
+numa = not_found
+if not get_option('numa').auto() or have_system or have_tools
+  numa = cc.find_library('numa', has_headers: ['numa.h'],
+                              required: get_option('numa'),
+                              kwargs: static_kwargs)
+endif
+if numa.found() and not cc.links('''
+   #include <numa.h>
+   int main(void) { return numa_available(); }
+   ''', dependencies: numa)
+  numa = not_found
+  if get_option('numa').enabled()
+    error('could not link numa')
+  else
+    warning('could not link numa, disabling')
+  endif
+endif
+
 rdma = not_found
 if 'CONFIG_RDMA' in config_host
   rdma = declare_dependency(link_args: config_host['RDMA_LIBS'].split())
 endif
-numa = not_found
-if 'CONFIG_NUMA' in config_host
-  numa = declare_dependency(link_args: config_host['NUMA_LIBS'].split())
-endif
 xen = not_found
 if 'CONFIG_XEN_BACKEND' in config_host
   xen = declare_dependency(compile_args: config_host['XEN_CFLAGS'].split(),
@@ -1472,6 +1486,7 @@ config_host_data.set('CONFIG_LIBSSH', libssh.found())
 config_host_data.set('CONFIG_LINUX_AIO', libaio.found())
 config_host_data.set('CONFIG_LINUX_IO_URING', linux_io_uring.found())
 config_host_data.set('CONFIG_LIBPMEM', libpmem.found())
+config_host_data.set('CONFIG_NUMA', numa.found())
 config_host_data.set('CONFIG_RBD', rbd.found())
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
@@ -3548,7 +3563,7 @@ summary_info += {'snappy support':    snappy}
 summary_info += {'bzip2 support':     libbzip2}
 summary_info += {'lzfse support':     liblzfse}
 summary_info += {'zstd support':      zstd}
-summary_info += {'NUMA host support': config_host.has_key('CONFIG_NUMA')}
+summary_info += {'NUMA host support': numa}
 summary_info += {'capstone':          capstone_opt == 'internal' ? capstone_opt : capstone}
 summary_info += {'libpmem support':   libpmem}
 summary_info += {'libdaxctl support': libdaxctl}
diff --git a/meson_options.txt b/meson_options.txt
index 6efad01528..bb443023b5 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -103,6 +103,8 @@ option('libnfs', type : 'feature', value : 'auto',
        description: 'libnfs block device driver')
 option('mpath', type : 'feature', value : 'auto',
        description: 'Multipath persistent reservation passthrough')
+option('numa', type : 'feature', value : 'auto',
+       description: 'libnuma support')
 option('iconv', type : 'feature', value : 'auto',
        description: 'Font glyph conversion support')
 option('curses', type : 'feature', value : 'auto',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index a20d40e685..d46d7181e7 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -71,6 +71,7 @@ meson_options_help() {
   printf "%s\n" '  multiprocess    Out of process device emulation support'
   printf "%s\n" '  netmap          netmap network backend support'
   printf "%s\n" '  nettle          nettle cryptography support'
+  printf "%s\n" '  numa            libnuma support'
   printf "%s\n" '  nvmm            NVMM acceleration support'
   printf "%s\n" '  oss             OSS sound support'
   printf "%s\n" '  pa              PulseAudio sound support'
@@ -218,6 +219,8 @@ _meson_option_parse() {
     --disable-netmap) printf "%s" -Dnetmap=disabled ;;
     --enable-nettle) printf "%s" -Dnettle=enabled ;;
     --disable-nettle) printf "%s" -Dnettle=disabled ;;
+    --enable-numa) printf "%s" -Dnuma=enabled ;;
+    --disable-numa) printf "%s" -Dnuma=disabled ;;
     --enable-nvmm) printf "%s" -Dnvmm=enabled ;;
     --disable-nvmm) printf "%s" -Dnvmm=disabled ;;
     --enable-oss) printf "%s" -Doss=enabled ;;
-- 
2.34.1




  parent reply	other threads:[~2022-02-15  9:47 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15  9:31 [PULL 00/30] Misc mostly build system patches for 2022-02-15 Paolo Bonzini
2022-02-15  9:31 ` [PULL 01/30] target/i386: add TCG support for UMIP Paolo Bonzini
2022-02-15  9:31 ` [PULL 02/30] memory: Fix qemu crash on starting dirty log twice with stopped VM Paolo Bonzini
2022-02-15  9:31 ` [PULL 03/30] tests/qemu-iotests/testrunner: Print diff to stderr in TAP mode Paolo Bonzini
2022-02-15  9:31 ` [PULL 04/30] meson: use .allowed() method for features Paolo Bonzini
2022-02-15  9:31 ` [PULL 05/30] meson: use .require() and .disable_auto_if() " Paolo Bonzini
2022-02-15  9:31 ` [PULL 06/30] configure, meson: move AVX tests to meson Paolo Bonzini
2022-02-15  9:32 ` [PULL 07/30] configure, meson: move membarrier test " Paolo Bonzini
2022-02-15  9:32 ` [PULL 08/30] configure, meson: move AF_ALG " Paolo Bonzini
2022-02-15  9:32 ` Paolo Bonzini [this message]
2022-02-15  9:32 ` [PULL 10/30] configure, meson: move TPM check " Paolo Bonzini
2022-02-15  9:32 ` [PULL 11/30] configure, meson: cleanup qemu-ga libraries Paolo Bonzini
2022-02-15  9:32 ` [PULL 12/30] configure, meson: move image format options to meson_options.txt Paolo Bonzini
2022-02-15  9:32 ` [PULL 13/30] configure, meson: move block layer " Paolo Bonzini
2022-02-15  9:32 ` [PULL 14/30] meson: define qemu_cflags/qemu_ldflags Paolo Bonzini
2022-02-15  9:32 ` [PULL 15/30] configure, meson: move some default-disabled options to meson_options.txt Paolo Bonzini
2023-04-11  9:42   ` Peter Maydell
2022-02-15  9:32 ` [PULL 16/30] configure, meson: move coroutine " Paolo Bonzini
2022-02-15  9:32 ` [PULL 17/30] configure, meson: move smbd " Paolo Bonzini
2022-02-15  9:32 ` [PULL 18/30] configure, meson: move guest-agent, tools to meson Paolo Bonzini
2022-03-17 22:34   ` Brad Smith
2022-02-15  9:32 ` [PULL 19/30] meson: refine check for whether to look for virglrenderer Paolo Bonzini
2022-02-15  9:32 ` [PULL 20/30] configure, meson: move OpenGL check to meson Paolo Bonzini
2022-02-15  9:32 ` [PULL 21/30] qga/vss-win32: fix midl arguments Paolo Bonzini
2022-02-15  9:32 ` [PULL 22/30] meson: drop --with-win-sdk Paolo Bonzini
2022-02-15  9:32 ` [PULL 23/30] qga/vss-win32: use widl if available Paolo Bonzini
2022-02-15  9:32 ` [PULL 24/30] qga/vss: use standard windows headers location Paolo Bonzini
2022-02-15  9:32 ` [PULL 25/30] configure, meson: replace VSS SDK checks and options with --enable-vss-sdk Paolo Bonzini
2022-02-15  9:32 ` [PULL 26/30] meson: do not make qga/vss-win32/meson.build conditional on C++ presence Paolo Bonzini
2022-02-15  9:32 ` [PULL 27/30] qga/vss-win32: require widl/midl, remove pre-built TLB file Paolo Bonzini
2022-02-15  9:32 ` [PULL 28/30] meson: require dynamic linking for VSS support Paolo Bonzini
2022-02-15  9:32 ` [PULL 29/30] meson, configure: move ntddscsi API check to meson Paolo Bonzini
2022-02-15  9:32 ` [PULL 30/30] configure, meson: move CONFIG_IASL to a Meson option Paolo Bonzini
2022-02-16  9:56 ` [PULL 00/30] Misc mostly build system patches for 2022-02-15 Peter Maydell
2022-02-16 14:03   ` Paolo Bonzini
2022-02-16 14:41     ` Peter Maydell
2022-02-16 21:06       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220215093223.110827-10-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).