qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] block/io_uring: use pkg-config for liburing


From: Stefan Hajnoczi
Subject: [Qemu-devel] [PATCH] block/io_uring: use pkg-config for liburing
Date: Sat, 25 May 2019 10:05:59 +0100

Now that liburing has pkg-config support, use it instead of hardcoding
compiler flags in QEMU's build scripts.  This way distros can customize
the location of liburing's headers and libraries without requiring
changes to QEMU.

Signed-off-by: Stefan Hajnoczi <address@hidden>
---
Hi Aarushi,
This change is needed to take advantage of the pkg-config patch that
I've just sent to liburing.  It works like this:

  $ cd liburing
  $ ./configure --libdir=/usr/lib64 # needed on Fedora x86_64
  $ make && sudo make install

That puts liburing.pc into /usr/lib64/pkgconfig/ where QEMU's
./configure will find it:

  $ cd qemu
  $ ./configure --target-list=x86_64-softmmu # it should detect liburing
  $ make -j$(nproc)

Feel free to squash this patch into your patches, I don't mind if the
authorship information gets lost.  It will be easier for reviewers if
this is present from the start instead of added in a later patch.

 configure           | 12 ++++++------
 block/Makefile.objs |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 86383dc0b3..acbdf04168 100755
--- a/configure
+++ b/configure
@@ -3972,15 +3972,13 @@ fi
 # linux-io-uring probe
 
 if test "$linux_io_uring" != "no" ; then
-  cat > $TMPC <<EOF
-#include <liburing.h>
-int main(void) { io_uring_queue_init(0, NULL, 0); io_uring_submit(NULL); 
return 0; }
-EOF
-  if compile_prog "" "-luring" ; then
+  if $pkg_config liburing; then
+    linux_io_uring_cflags=$($pkg_config --cflags liburing)
+    linux_io_uring_libs=$($pkg_config --libs liburing)
     linux_io_uring=yes
   else
     if test "$linux_io_uring" = "yes" ; then
-      feature_not_found "linux io_uring" "Install liburing"
+      feature_not_found "linux io_uring" "Install liburing devel"
     fi
     linux_io_uring=no
   fi
@@ -6884,6 +6882,8 @@ if test "$linux_aio" = "yes" ; then
 fi
 if test "$linux_io_uring" = "yes" ; then
   echo "CONFIG_LINUX_IO_URING=y" >> $config_host_mak
+  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
diff --git a/block/Makefile.objs b/block/Makefile.objs
index 262d413c6d..eed8043740 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -62,6 +62,7 @@ block-obj-$(if $(CONFIG_LZFSE),m,n) += dmg-lzfse.o
 dmg-lzfse.o-libs   := $(LZFSE_LIBS)
 qcow.o-libs        := -lz
 linux-aio.o-libs   := -laio
-io_uring.o-libs    := -luring
+io_uring.o-flags   := $(LINUX_IO_URING_CFLAGS)
+io_uring.o-libs    := $(LINUX_IO_URING_LIBS)
 parallels.o-cflags := $(LIBXML2_CFLAGS)
 parallels.o-libs   := $(LIBXML2_LIBS)
-- 
2.21.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]