From nobody Tue Feb 10 19:14:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1554820088; cv=none; d=zoho.com; s=zohoarc; b=Ld7e719TIA3EO8cq2i5j5orrHVf7QTilr/UgJkdGqgR/vBAFOycv4mlFGFnA9SqodQ7xelFVfL/8dyxmBSw9Zbhao+8uI36JYcwSxIddy1farxv0GuqjgmG+o77A+pjuOOm3Y5AdEML3adZj/HToRyfOxdnwitU2txZKBTAvGoQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1554820088; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=tPzmG1IdB226W9c9mImcx5wVxsTBJE6gmh2ujFaawH4=; b=U5EXy2muIDImLbaHj1UeDkPEJSQZIXlwzr6qL7K3AeXjOzo25TS9BP07MEKFRh0ufkmqZumGOiGDIgtpByUak5kDMDGxSOBRj23t8YajHYwO9VPGhULD8ht0a9Pgn5RrpUkzJa2Xj9gOuexSlR7MPsdJTGTmnnW8ozysfcBhia4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554820088543846.9318403763269; Tue, 9 Apr 2019 07:28:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AC0D230018E6; Tue, 9 Apr 2019 14:28:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A2DF5D961; Tue, 9 Apr 2019 14:28:06 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1EDE7181B9E6; Tue, 9 Apr 2019 14:28:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x39ERxL0024278 for ; Tue, 9 Apr 2019 10:27:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id BE5C919731; Tue, 9 Apr 2019 14:27:59 +0000 (UTC) Received: from kinshicho.brq.redhat.com (unknown [10.43.2.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 46FEE19C7B for ; Tue, 9 Apr 2019 14:27:59 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 9 Apr 2019 16:27:49 +0200 Message-Id: <20190409142750.32034-7-abologna@redhat.com> In-Reply-To: <20190409142750.32034-1-abologna@redhat.com> References: <20190409142750.32034-1-abologna@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 6/7] m4: readline: Use pkg-config where possible X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 09 Apr 2019 14:28:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" With the 7.0 release, readline has finally started shipping pkg-config support in the form of a readline.pc file. Unfortunately, most downstreams have yet to catch up with this change: among Linux distributions in particular, Fedora Rawhide seems to be the only one installing it at the moment. Non-Linux operating systems have been faring much better in this regard: both FreeBSD (through ports) and macOS (through homebrew) include pkg-config support in their readline package. This is great news for us, since those are the platforms where pkg-config is more useful on account of them installing headers and libraries outside of the respective default search paths. Our implementation checks whether readline is registered as a pkg-config package, and if so obtains CFLAGS and LIBS using the tool; if not, we just keep using the existing logic. This commit is best viewed with 'git show -w'. Signed-off-by: Andrea Bolognani Reviewed-by: Daniel P. Berrang=C3=A9 --- m4/virt-readline.m4 | 47 +++++++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/m4/virt-readline.m4 b/m4/virt-readline.m4 index 6f0090056a..1bec5deb22 100644 --- a/m4/virt-readline.m4 +++ b/m4/virt-readline.m4 @@ -23,27 +23,36 @@ AC_DEFUN([LIBVIRT_ARG_READLINE],[ =20 AC_DEFUN([LIBVIRT_CHECK_READLINE],[ =20 - # This function is present in all reasonable (5.0+) readline versions; - # however, the macOS base system contains a library called libedit which - # takes over the readline name despite lacking many of its features. We - # want to make sure we only enable readline support when linking against - # the actual readline library, and the availability of this specific - # functions is as good a witness for that fact as any. - AC_CHECK_DECLS([rl_completion_quote_character], - [], [], - [[#include - #include ]]) - - if test "$ac_cv_have_decl_rl_completion_quote_character" =3D "no" ; then - if test "$with_readline" =3D "yes" ; then - AC_MSG_ERROR([readline is missing rl_completion_quote_character]) - else - with_readline=3Dno; + # We have to check for readline.pc's presence beforehand because for + # the longest time the library didn't ship a .pc file at all + PKG_CHECK_EXISTS([readline], [use_pkgconfig=3D1], [use_pkgconfig=3D0]) + + if test $use_pkgconfig =3D 1; then + # readline 7.0 is the first version which includes pkg-config support + LIBVIRT_CHECK_PKG([READLINE], [readline], [7.0]) + else + # This function is present in all reasonable (5.0+) readline versions; + # however, the macOS base system contains a library called libedit whi= ch + # takes over the readline name despite lacking many of its features. We + # want to make sure we only enable readline support when linking again= st + # the actual readline library, and the availability of this specific + # functions is as good a witness for that fact as any. + AC_CHECK_DECLS([rl_completion_quote_character], + [], [], + [[#include + #include ]]) + + if test "$ac_cv_have_decl_rl_completion_quote_character" =3D "no" ; th= en + if test "$with_readline" =3D "yes" ; then + AC_MSG_ERROR([readline is missing rl_completion_quote_character]) + else + with_readline=3Dno; + fi fi - fi =20 - # The normal library check... - LIBVIRT_CHECK_LIB([READLINE], [readline], [readline], [readline/readline= .h]) + # The normal library check... + LIBVIRT_CHECK_LIB([READLINE], [readline], [readline], [readline/readli= ne.h]) + fi =20 # We need this to avoid compilation issues with modern compilers. # See 9ea3424a178 for a more detailed explanation --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list