From 61e2fd8af7f4788b2563c31a3baba4cc4c17d510 Mon Sep 17 00:00:00 2001 From: Kamil Rytarowski Date: Tue, 30 May 2017 08:20:22 +0200 Subject: [PATCH] ivshmem-server: ivshmem-client: Build when eventfd() is available Currently ivshmem requires eventfd() which is Linux specific. Do not and build it unconditionally on every Linux/BSD/Solaris. This patch indirectly fixes build failure on NetBSD, where these tools additionally require -lrt for shm_open(3). In future there should be added support for NetBSD and the linking addressed appropriately. Signed-off-by: Kamil Rytarowski Reviewed-by: Markus Armbruster --- Makefile | 2 ++ configure | 2 ++ contrib/ivshmem-client/Makefile.objs | 2 +- contrib/ivshmem-server/Makefile.objs | 2 +- tests/Makefile.include | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 16a0430c6c..5d5bd6a31f 100644 --- a/Makefile +++ b/Makefile @@ -470,10 +470,12 @@ ifneq ($(EXESUF),) qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI) endif +ifdef CONFIG_IVSHMEM ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS) $(call LINK, $^) ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS) $(call LINK, $^) +endif vhost-user-scsi$(EXESUF): $(vhost-user-scsi-obj-y) $(call LINK, $^) diff --git a/configure b/configure index ff0f8b915c..0914f0899e 100755 --- a/configure +++ b/configure @@ -4886,6 +4886,8 @@ if test "$want_tools" = "yes" ; then tools="qemu-img\$(EXESUF) qemu-io\$(EXESUF) $tools" if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" ] ; then tools="qemu-nbd\$(EXESUF) $tools" + fi + if [ "$eventfd" = "yes" ]; then tools="ivshmem-client\$(EXESUF) ivshmem-server\$(EXESUF) $tools" fi fi diff --git a/contrib/ivshmem-client/Makefile.objs b/contrib/ivshmem-client/Makefile.objs index bfab2d20dd..13d864082d 100644 --- a/contrib/ivshmem-client/Makefile.objs +++ b/contrib/ivshmem-client/Makefile.objs @@ -1 +1 @@ -ivshmem-client-obj-y = ivshmem-client.o main.o +ivshmem-client-obj-$(CONFIG_IVSHMEM) = ivshmem-client.o main.o diff --git a/contrib/ivshmem-server/Makefile.objs b/contrib/ivshmem-server/Makefile.objs index c060dd3698..d9469fd777 100644 --- a/contrib/ivshmem-server/Makefile.objs +++ b/contrib/ivshmem-server/Makefile.objs @@ -1 +1 @@ -ivshmem-server-obj-y = ivshmem-server.o main.o +ivshmem-server-obj-$(CONFIG_IVSHMEM) = ivshmem-server.o main.o diff --git a/tests/Makefile.include b/tests/Makefile.include index ae889cae02..c1e99570a3 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -201,7 +201,7 @@ gcov-files-pci-y += hw/display/virtio-gpu-pci.c gcov-files-pci-$(CONFIG_VIRTIO_VGA) += hw/display/virtio-vga.c check-qtest-pci-y += tests/intel-hda-test$(EXESUF) gcov-files-pci-y += hw/audio/intel-hda.c hw/audio/hda-codec.c -check-qtest-pci-$(CONFIG_EVENTFD) += tests/ivshmem-test$(EXESUF) +check-qtest-pci-$(CONFIG_IVSHMEM) += tests/ivshmem-test$(EXESUF) gcov-files-pci-y += hw/misc/ivshmem.c check-qtest-pci-y += tests/megasas-test$(EXESUF) gcov-files-pci-y += hw/scsi/megasas.c -- 2.13.1