From patchwork Sat May 13 00:46:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kamil Rytarowski X-Patchwork-Id: 9724961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D979360348 for ; Sat, 13 May 2017 00:54:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF434288A2 for ; Sat, 13 May 2017 00:54:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B3F33288A8; Sat, 13 May 2017 00:54:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 01FA0288A2 for ; Sat, 13 May 2017 00:54:57 +0000 (UTC) Received: from localhost ([::1]:55875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9LKi-00020J-D8 for patchwork-qemu-devel@patchwork.kernel.org; Fri, 12 May 2017 20:54:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44821) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9LK9-0001zu-0K for qemu-devel@nongnu.org; Fri, 12 May 2017 20:54:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9LK4-0006nx-6F for qemu-devel@nongnu.org; Fri, 12 May 2017 20:54:21 -0400 Received: from mout.gmx.net ([212.227.15.15]:64848) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d9LK3-0006n6-RQ for qemu-devel@nongnu.org; Fri, 12 May 2017 20:54:16 -0400 Received: from localhost.localdomain ([185.58.161.191]) by mail.gmx.com (mrgmx001 [212.227.17.184]) with ESMTPSA (Nemesis) id 0MVvi4-1dXTu0291c-00X3n9; Sat, 13 May 2017 02:54:12 +0200 From: Kamil Rytarowski To: qemu-devel@nongnu.org Date: Sat, 13 May 2017 02:46:16 +0200 Message-Id: <20170513004616.25749-1-n54@gmx.com> X-Mailer: git-send-email 2.12.2 X-Provags-ID: V03:K0:3U0PmeN7eaVvdBD5wzgpW0AnI8x+XwUuaBoaatbFCyPP1ChezDl cQP4gGDYEJIjHg9qwITei7awnYK4g5i52/X6zdNxWdj1mtCLJX4TGSuNjnaGc3wnbUz61rm NGlGyXInX7E4UFxTpOCaQbRc5cn2/tR29Pj8civMo6bHIOA78C4agbQpu2uf9oEj1rdYXJq nXdiVjz/9qw3wdcMlsNcw== X-UI-Out-Filterresults: notjunk:1; V01:K0:m6GsxftIuHM=:S5S5VqiYVNx54sGOYJOclo eW1RqA3s4dALAocKeyMZiOxh5SPoUDLu7YGJqx+YB0m34ErxXd883qfB2i9/2u71s0Iymf9b8 77JxXMG3XXNU3P7YZfoB9cHkA6eXpN9cCxwx+xlQvjSlVrllIgh9aetZWSwu3KUyJ0JcsGdGZ jUp0vVIsMNSsjoT8ILKU8PDwmlz+HreprF5MqTZwhpyQdGUdwIxFIDlBrdfgYHINEXRK1iYt3 3MclfAe+OpSUb8nihJyXTBctM7FDd1WnqPhNRzGQyDNMsFfapqVOj+L416cfBmJKhJv8YfY4+ Pyp239bnZ9KqNU1k7JHWBUxIrSx+3FRtjzYbLC6B1SlsnMei7ScPxis3B18MKrrzoVtgdkGuN Dvzv3rTdIT62Vj+Pzh/AY3qWIrMEjfR1J5xowKBXxEzuGvrWMVoq/rG+F9Qb0PWs+QG4zmQHV 8ztSMMlAKgm04Wm417zUfRz2Trhk1V+Mh4JxiOVPuk07BBtG5Qqn/GeYzBRF6vfBfUrMbsXu7 T01JJUpA9lfNQTwRGo2B6ubvY4HRJErP2Rng8K7iobHaLqfHwRtsJJLvvgqn13R+ZMMIGU/vy YAEAMY+M7UONvGjVQ54NlcVGuuyK2dTLWAugwENAVGwPuy1J7307Dyunf2b6QmAtUl8BPFGDU AJEfoVSiCClEmVxyPhym4LBksbEi7NxhT9F6QGupiu9sp8IwmaDKlLl23Q6f9NAV+NNCGMWjc H2tJVSGp1U8Ffs0jb7eStHotJdUhy6suXjFCV8XCpXz1C2cI2ud6vZWS0So= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.15 Subject: [Qemu-devel] [PATCH] ivshmem-server: Detect and use if there is required -lrt linking X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Kamil Rytarowski Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Philippe Mathieu-Daudé --- 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 < +#include +#include +#include +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