qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] ivshmem-server: Detect and use if there is required -lrt linking
@ 2017-05-13  0:46 Kamil Rytarowski
  2017-05-13 21:09 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Kamil Rytarowski @ 2017-05-13  0:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: peter.maydell, Kamil Rytarowski

ivshmem-server makes use of the POSIX shared memory object interfaces.
This library is provided on NetBSD in -lrt (POSIX Real-time Library).
Add ./configure check if there is needed -lrt linking for shm_open()
and if so use it. Introduce new configure generated variable LIBS_SHMLIB.

This fixes build issue on NetBSD.

Signed-off-by: Kamil Rytarowski <n54@gmx.com>
---
 Makefile  |  1 +
 configure | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/Makefile b/Makefile
index 31d41a7eae..3248cb53d7 100644
--- a/Makefile
+++ b/Makefile
@@ -473,6 +473,7 @@ ivshmem-client$(EXESUF): $(ivshmem-client-obj-y) $(COMMON_LDADDS)
 	$(call LINK, $^)
 ivshmem-server$(EXESUF): $(ivshmem-server-obj-y) $(COMMON_LDADDS)
 	$(call LINK, $^)
+ivshmem-server$(EXESUF): LIBS += $(LIBS_SHMLIB)
 
 module_block.h: $(SRC_PATH)/scripts/modules/module_block.py config-host.mak
 	$(call quiet-command,$(PYTHON) $< $@ \
diff --git a/configure b/configure
index 7c020c076b..50c3aee746 100755
--- a/configure
+++ b/configure
@@ -179,6 +179,7 @@ audio_pt_int=""
 audio_win_int=""
 cc_i386=i386-pc-linux-gnu-gcc
 libs_qga=""
+libs_shmlib=""
 debug_info="yes"
 stack_protector=""
 
@@ -4133,6 +4134,24 @@ elif compile_prog "" "$pthread_lib -lrt" ; then
   libs_qga="$libs_qga -lrt"
 fi
 
+##########################################
+# Do we need librt for shm_open()
+cat > $TMPC <<EOF
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <stddef.h>
+int main(void) {
+  return shm_open(NULL, O_RDWR, 0644);
+}
+EOF
+
+if compile_prog "" "" ; then
+  :
+elif compile_prog "" "-lrt" ; then
+  libs_shmlib="$libs_shmlib -lrt"
+fi
+
 if test "$darwin" != "yes" -a "$mingw32" != "yes" -a "$solaris" != yes -a \
         "$aix" != "yes" -a "$haiku" != "yes" ; then
     libs_softmmu="-lutil $libs_softmmu"
@@ -5949,6 +5968,7 @@ echo "EXESUF=$EXESUF" >> $config_host_mak
 echo "DSOSUF=$DSOSUF" >> $config_host_mak
 echo "LDFLAGS_SHARED=$LDFLAGS_SHARED" >> $config_host_mak
 echo "LIBS_QGA+=$libs_qga" >> $config_host_mak
+echo "LIBS_SHMLIB+=$libs_shmlib" >> $config_host_mak
 echo "TASN1_LIBS=$tasn1_libs" >> $config_host_mak
 echo "TASN1_CFLAGS=$tasn1_cflags" >> $config_host_mak
 echo "POD2MAN=$POD2MAN" >> $config_host_mak
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2017-05-31 13:53 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-13  0:46 [Qemu-devel] [PATCH] ivshmem-server: Detect and use if there is required -lrt linking Kamil Rytarowski
2017-05-13 21:09 ` Philippe Mathieu-Daudé
2017-05-17  7:28 ` Markus Armbruster
2017-05-20 23:05   ` Kamil Rytarowski
2017-05-22  6:28     ` Markus Armbruster
2017-05-22 16:46       ` Kamil Rytarowski
2017-05-23  5:37         ` Markus Armbruster
2017-05-23 14:33           ` Kamil Rytarowski
2017-05-23 15:07             ` Markus Armbruster
2017-05-23 15:08               ` Kamil Rytarowski
2017-05-26  5:40 ` [Qemu-devel] [PATCH] ivshmem-server: ivshmem-clean: Install only when eventfd() is available Kamil Rytarowski
2017-05-26  6:31   ` Marc-André Lureau
2017-05-29  8:57     ` Markus Armbruster
2017-05-30  6:20   ` [Qemu-devel] [PATCH] ivshmem-server: ivshmem-client: Build " Kamil Rytarowski
2017-05-30 12:53     ` Eric Blake
2017-05-30 13:11       ` Kamil Rytarowski
2017-05-30 14:05         ` Eric Blake
2017-05-31 11:11           ` Markus Armbruster
2017-05-31 11:20             ` Kamil Rytarowski
2017-05-31 13:53               ` Markus Armbruster

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).