qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org, Aarushi Mehta <mehta.aaru20@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Julia Suvorova <jusual@mail.ru>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	qemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH] block/io_uring: use pkg-config for liburing
Date: Sat, 25 May 2019 10:05:59 +0100	[thread overview]
Message-ID: <20190525090559.31914-1-stefanha@redhat.com> (raw)

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 <stefanha@redhat.com>
---
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	other threads:[~2019-05-25  9:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-25  9:05 Stefan Hajnoczi [this message]
2019-05-25  9:15 ` [Qemu-devel] [Qemu-block] [PATCH] block/io_uring: use pkg-config for liburing Stefan Hajnoczi
2019-06-05 15:56 ` [Qemu-devel] " Daniel P. Berrangé

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=20190525090559.31914-1-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=jusual@mail.ru \
    --cc=kwolf@redhat.com \
    --cc=mehta.aaru20@gmail.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --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).