From nobody Mon Feb 9 01:12:02 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1594893882; cv=none; d=zohomail.com; s=zohoarc; b=fP3mlxclnf42J4tBkY12UoWsruffVkQDT8e5XpfXrhMpypkYJEzTBwpOyEtqX9FvrJ7HVpheb1P0j1jsQS1Pzm7/p/uRYDsrzxMrnUlvgn2/t/8T1wTQ08nDdjD+r4/dHOSEdwGjiAhs/3QGE8AwwNaF6tb/ce2mM2Mu4F1hBYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594893882; 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; bh=O2nNTf121TBTybPReiPk0ywRv0bNUHZ3bgTi+CX5g3k=; b=blBUsH8PudHcmh4uEo0IBIAydI8xAT7ecpYpoSNbk+5c0tf5j44LtcG9y2ZyXxaXpdSaABPl4agvroOLK/IiMuDAjhL8BDPU+acfbhk8mHT1yPwl5sJ8Rnhas33XhjnmHJop7ls5WjZtcRN0r4gaPzs/oRiLUzzIOlsvxCDUdEE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594893882780701.4429522054988; Thu, 16 Jul 2020 03:04:42 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-qNky_W_cO9Swpz2jlLA3ZA-1; Thu, 16 Jul 2020 06:02:52 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id F26841030C20; Thu, 16 Jul 2020 10:02:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D23BD74F64; Thu, 16 Jul 2020 10:02:18 +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 9B6A896221; Thu, 16 Jul 2020 10:02:18 +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 06GA0wiv015646 for ; Thu, 16 Jul 2020 06:00:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id AEDF72B6E6; Thu, 16 Jul 2020 10:00:58 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28BD82DE93 for ; Thu, 16 Jul 2020 10:00:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594893881; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=O2nNTf121TBTybPReiPk0ywRv0bNUHZ3bgTi+CX5g3k=; b=PTsy9XDqk7Nu7CbxXQaRX8VyyXqM75CTJtraEeuKq2mtx8PFzGizoE71/ZMRS6Kf8OQZ69 5ys8sBARyvFJoIez/vkV3NzAc6v3eoFU2UA85XSDqteWpeurT0fyiL+MxCGqH1jHfp+R1b Z3IZzkS+JjlRPZHqOWwvv2kWO/iOrvs= X-MC-Unique: qNky_W_cO9Swpz2jlLA3ZA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 038/351] meson: add bash_completion build options Date: Thu, 16 Jul 2020 11:54:34 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- configure.ac | 3 -- m4/virt-bash-completion.m4 | 70 -------------------------------------- meson.build | 30 ++++++++++++++++ meson_options.txt | 2 ++ 4 files changed, 32 insertions(+), 73 deletions(-) delete mode 100644 m4/virt-bash-completion.m4 diff --git a/configure.ac b/configure.ac index b822e862535..a8f838c0ccf 100644 --- a/configure.ac +++ b/configure.ac @@ -114,7 +114,6 @@ fi =20 # Check for compiler and library settings. =20 -LIBVIRT_ARG_BASH_COMPLETION LIBVIRT_ARG_BLKID LIBVIRT_ARG_CAPNG LIBVIRT_ARG_CURL @@ -146,7 +145,6 @@ LIBVIRT_ARG_VIRTUALPORT LIBVIRT_ARG_WIRESHARK LIBVIRT_ARG_YAJL =20 -LIBVIRT_CHECK_BASH_COMPLETION LIBVIRT_CHECK_BLKID LIBVIRT_CHECK_CAPNG LIBVIRT_CHECK_CURL @@ -471,7 +469,6 @@ LIBVIRT_RESULT_DRIVER_MODULES AC_MSG_NOTICE([]) AC_MSG_NOTICE([Libraries]) AC_MSG_NOTICE([]) -LIBVIRT_RESULT_BASH_COMPLETION LIBVIRT_RESULT_BLKID LIBVIRT_RESULT_CAPNG LIBVIRT_RESULT_CURL diff --git a/m4/virt-bash-completion.m4 b/m4/virt-bash-completion.m4 deleted file mode 100644 index c8342176f8b..00000000000 --- a/m4/virt-bash-completion.m4 +++ /dev/null @@ -1,70 +0,0 @@ -dnl Bash completion support -dnl -dnl Copyright (C) 2017 Red Hat, Inc. -dnl -dnl This library is free software; you can redistribute it and/or -dnl modify it under the terms of the GNU Lesser General Public -dnl License as published by the Free Software Foundation; either -dnl version 2.1 of the License, or (at your option) any later version. -dnl -dnl This library is distributed in the hope that it will be useful, -dnl but WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl Lesser General Public License for more details. -dnl -dnl You should have received a copy of the GNU Lesser General Public -dnl License along with this library. If not, see -dnl . -dnl -dnl Inspired by libguestfs code. -dnl - -AC_DEFUN([LIBVIRT_ARG_BASH_COMPLETION],[ - LIBVIRT_ARG_WITH_FEATURE([BASH_COMPLETION], [bash-completion], [check], = [2.0]) - LIBVIRT_ARG_WITH([BASH_COMPLETIONS_DIR], - [directory containing bash completions scripts], - [check]) -]) - -AC_DEFUN([LIBVIRT_CHECK_BASH_COMPLETION], [ - AC_REQUIRE([LIBVIRT_CHECK_READLINE]) - - if test "x$with_readline" !=3D "xyes" ; then - if test "x$with_bash_completion" =3D "xyes" ; then - AC_MSG_ERROR([readline is required for bash completion support]) - else - with_bash_completion=3Dno - fi - fi - - LIBVIRT_CHECK_PKG([BASH_COMPLETION], [bash-completion], [2.0]) - - if test "x$with_bash_completion" =3D "xyes" ; then - if test "x$with_bash_completions_dir" =3D "xcheck"; then - AC_MSG_CHECKING([for bash-completions directory]) - BASH_COMPLETIONS_DIR=3D"$($PKG_CONFIG --variable=3Dcompletionsdir ba= sh-completion)" - AC_MSG_RESULT([$BASH_COMPLETIONS_DIR]) - - dnl Replace bash completions's exec_prefix with our own. - dnl Note that ${exec_prefix} is kept verbatim at this point in time, - dnl and will only be expanded later, when make is called: this makes - dnl it possible to override such prefix at compilation or installati= on - dnl time - bash_completions_prefix=3D"$($PKG_CONFIG --variable=3Dprefix bash-co= mpletion)" - if test "x$bash_completions_prefix" =3D "x" ; then - bash_completions_prefix=3D"/usr" - fi - - BASH_COMPLETIONS_DIR=3D'${exec_prefix}'"${BASH_COMPLETIONS_DIR#$bash= _completions_prefix}" - elif test "x$with_bash_completions_dir" =3D "xno" || test "x$with_bash= _completions_dir" =3D "xyes"; then - AC_MSG_ERROR([bash-completions-dir must be used only with valid path= ]) - else - BASH_COMPLETIONS_DIR=3D$with_bash_completions_dir - fi - AC_SUBST([BASH_COMPLETIONS_DIR]) - fi -]) - -AC_DEFUN([LIBVIRT_RESULT_BASH_COMPLETION],[ - LIBVIRT_RESULT_LIB([BASH_COMPLETION]) -]) diff --git a/meson.build b/meson.build index c30b14c1643..5cca3b7d5c2 100644 --- a/meson.build +++ b/meson.build @@ -965,6 +965,9 @@ if audit_dep.found() conf.set('WITH_AUDIT', 1) endif =20 +bash_completion_version =3D '2.0' +bash_completion_dep =3D dependency('bash-completion', version: '>=3D' + ba= sh_completion_version, required: get_option('bash_completion')) + # readline 7.0 is the first version which includes pkg-config support readline_version =3D '7.0' readline_dep =3D dependency('readline', version: '>=3D' + readline_version= , required: false) @@ -1029,6 +1032,32 @@ if readline_dep.found() endif =20 =20 +# generic build dependencies checks + +if bash_completion_dep.found() and not readline_dep.found() + if get_option('bash_completion').enabled() + error('readline is required for bash completion support') + else + bash_completion_dep =3D dependency('', required: false) + endif +endif +if bash_completion_dep.found() + bash_completion_dir =3D get_option('bash_completion_dir') + if bash_completion_dir =3D=3D '' + bash_completion_dir =3D bash_completion_dep.get_pkgconfig_variable('co= mpletionsdir') + bash_completion_prefix =3D bash_completion_dep.get_pkgconfig_variable(= 'prefix') + rc =3D run_command( + 'python3', '-c', + 'print("@0@".replace("@1@", "@2@"))'.format( + bash_completion_dir, bash_completion_prefix, prefix, + ), + check: true, + ) + bash_completion_dir =3D rc.stdout().strip() + endif +endif + + # define top include directory =20 top_inc_dir =3D include_directories('.') @@ -1052,6 +1081,7 @@ libs_summary =3D { 'apparmor': apparmor_dep.found(), 'attr': attr_dep.found(), 'audit': audit_dep.found(), + 'bash_completion': bash_completion_dep.found(), 'readline': readline_dep.found(), } summary(libs_summary, section: 'Libraries', bool_yn: true) diff --git a/meson_options.txt b/meson_options.txt index aafc694533a..5313b9bb5fb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -12,4 +12,6 @@ option('test_coverage', type: 'boolean', value: false, de= scription: 'turn on cod option('apparmor', type: 'feature', value: 'auto', description: 'apparmor = support') option('attr', type: 'feature', value: 'auto', description: 'attr support') option('audit', type: 'feature', value: 'auto', description: 'audit suppor= t') +option('bash_completion', type: 'feature', value: 'auto', description: 'ba= sh-completion support') +option('bash_completion_dir', type: 'string', value: '', description: 'dir= ectory containing bash completion scripts') option('readline', type: 'feature', value: 'auto', description: 'readline = support') --=20 2.26.2