From nobody Fri Nov 7 09:07:02 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547745334772954.4179739640749; Thu, 17 Jan 2019 09:15:34 -0800 (PST) Received: from localhost ([127.0.0.1]:48433 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkBGF-00021E-IL for importer@patchew.org; Thu, 17 Jan 2019 12:15:23 -0500 Received: from eggs.gnu.org ([209.51.188.92]:36819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gkBFA-0001d5-0K for qemu-devel@nongnu.org; Thu, 17 Jan 2019 12:14:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gkBF9-0006nR-5z for qemu-devel@nongnu.org; Thu, 17 Jan 2019 12:14:16 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48750) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gkBF8-0006jn-S7 for qemu-devel@nongnu.org; Thu, 17 Jan 2019 12:14:15 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8946380F8F; Thu, 17 Jan 2019 17:14:12 +0000 (UTC) Received: from thuth.com (ovpn-116-101.ams2.redhat.com [10.36.116.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3191F600C6; Thu, 17 Jan 2019 17:14:10 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Thu, 17 Jan 2019 18:14:08 +0100 Message-Id: <1547745248-1750-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 17 Jan 2019 17:14:12 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] configure: Add a proper check for openpty() in libutil 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 , Paolo Bonzini Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On Linux (and maybe some BSDs), we require libutil for the openpty() function. However, this library is not available on some other systems, so we currently use a fragile if-statement in the configure script to check whether we need the library or not. Unfortunately, we also hard-coded a "-lutil" in the tests/Makefile.include file, so this breaks the build on Solaris, for example (see buglink below). To fix the issue, add the "-lutil" to "libs_tools" in the configure script instead, then this gets properly propagated to the tests, too. And while we're at it, also replace the fragile if-statement in the confi- gure script with a proper link-check for the availablity of this function. Buglink: https://bugs.launchpad.net/qemu/+bug/1777252 Signed-off-by: Thomas Huth Reviewed-by: Eric Blake Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- configure | 12 ++++++++++-- tests/Makefile.include | 4 ---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 3c28bae..0f4e42a 100755 --- a/configure +++ b/configure @@ -4595,9 +4595,17 @@ elif compile_prog "" "$pthread_lib -lrt" ; then libs_qga=3D"$libs_qga -lrt" fi =20 -if test "$darwin" !=3D "yes" -a "$mingw32" !=3D "yes" -a "$solaris" !=3D y= es -a \ - "$haiku" !=3D "yes" ; then +# Check whether we need to link libutil for openpty() +cat > $TMPC << EOF +extern int openpty(int *am, int *as, char *name, void *termp, void *winp); +int main(void) { return openpty(0, 0, 0, 0, 0); } +EOF + +if ! compile_prog "" "" ; then + if compile_prog "" "-lutil" ; then libs_softmmu=3D"-lutil $libs_softmmu" + libs_tools=3D"-lutil $libs_tools" + fi fi =20 ########################################## diff --git a/tests/Makefile.include b/tests/Makefile.include index f403a65..8f8e3b4 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -793,10 +793,6 @@ tests/migration/initrd-stress.img: tests/migration/str= ess$(EXESUF) rm $(INITRD_WORK_DIR)/init rmdir $(INITRD_WORK_DIR) =20 -ifeq ($(CONFIG_POSIX),y) -LIBS +=3D -lutil -endif - # QTest rules =20 TARGETS=3D$(patsubst %-softmmu,%, $(filter %-softmmu,$(TARGET_DIRS))) --=20 1.8.3.1