From nobody Sun Feb 8 02:26:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1621929724; cv=none; d=zohomail.com; s=zohoarc; b=mukWDDv8avV1K9gie+QFLUCKDTZpZVlF3+3NuO3vbINCo88M5yBBy+vXiTFok9AK1Bt1UCW+kXRLdNuHbwgVII1aEZhUAK+UOPLHnzTU8jmI7QP3OeV0pD0kWjSQM3/dpPOUk5oyBCVxUXEBxaQ7zLLt1RX1G4hiGNCWgawxf30= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621929724; 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=nvWV0Dg1Tw/v/6Po+mn9GUr5a2bAJqkKSKRfjw8rJbY=; b=iNd/4DiXDAErRg8w0mMrTAdJX/qStvfb418W1OEViD8XydCGikShIjR5auBv3rEokdQ8Y8qfRBLfPgEMr78TjzkcpzLConUr9AvZkwLFY7EE7OFRVHbXZtGsYrgtvsUrmEVHSTJ+C0Xz9oz91Dc9mdEi9I3da19D6bB66lcP/nM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 162192972456593.77872760053049; Tue, 25 May 2021 01:02:04 -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-148-J_DgiRsBPWClTy4RyoiYJA-1; Tue, 25 May 2021 04:01:13 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 868481074649; Tue, 25 May 2021 08:01:08 +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 632426C32D; Tue, 25 May 2021 08:01:08 +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 1A306180140D; Tue, 25 May 2021 08:01:08 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14P80r3l021846 for ; Tue, 25 May 2021 04:00:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id A1902189C7; Tue, 25 May 2021 08:00:53 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.193.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 21D5A59443 for ; Tue, 25 May 2021 08:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621929723; 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=nvWV0Dg1Tw/v/6Po+mn9GUr5a2bAJqkKSKRfjw8rJbY=; b=Hwud4oeF4+4oU/pKCNKzYsUmBiG6jAio3Tuusyg4B9/u/6sOnvDbAf97RiD/wJwmf3Vd01 uKz6iU557I+kt1K1DwN5V8m0TV1hufYZgmA8uTzau2mSvQwHJoFwShj3TRW/NpxXTCC7/Z Bza1RrlKS8TuD/g0831XK2idrisel30= X-MC-Unique: J_DgiRsBPWClTy4RyoiYJA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [PATCH RESEND v3 6/8] meson: use runtime binaries to only resolve features with "auto" value Date: Tue, 25 May 2021 10:00:45 +0200 Message-Id: <2a975b2ec39a0bbd636d2019036cbb52e2d6f649.1621929489.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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" This way meson will try to do the right thing by default but we will allow users to change this behavior by using -Dname=3Denabled. This comes with two benefits compared to the previous behavior: - no need to install the binaries if developers would like to check that the code compiles correctly - package maintainers can drop some build dependencies Signed-off-by: Pavel Hrdina Reviewed-by: Andrea Bolognani --- meson.build | 102 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 39 deletions(-) diff --git a/meson.build b/meson.build index 2900b6e1a8..8e8d31953d 100644 --- a/meson.build +++ b/meson.build @@ -977,12 +977,6 @@ endif =20 libparted_version =3D '1.8.0' libparted_dep =3D dependency('libparted', version: '>=3D' + libparted_vers= ion, required: false) -if libparted_dep.found() - parted_prog =3D find_program('parted', required: false, dirs: libvirt_sb= in_path) - if not parted_prog.found() - libparted_dep =3D dependency('', required: false) - endif -endif =20 libpcap_version =3D '1.5.0' if not get_option('libpcap').disabled() @@ -1420,11 +1414,17 @@ if not get_option('driver_libvirtd').disabled() endif =20 if not get_option('driver_bhyve').disabled() and host_machine.system() =3D= =3D 'freebsd' - bhyve_prog =3D find_program('bhyve', required: get_option('driver_bhyve'= )) - bhyvectl_prog =3D find_program('bhyvectl', required: get_option('driver_= bhyve')) - bhyveload_prog =3D find_program('bhyveload', required: get_option('drive= r_bhyve')) + bhyve_enable =3D true =20 - if bhyve_prog.found() and bhyvectl_prog.found() and bhyveload_prog.found= () + if get_option('driver_bhyve').auto() + bhyve_prog =3D find_program('bhyve', required: false) + bhyvectl_prog =3D find_program('bhyvectl', required: false) + bhyveload_prog =3D find_program('bhyveload', required: false) + + bhyve_enable =3D bhyve_prog.found() and bhyvectl_prog.found() and bhyv= eload_prog.found() + endif + + if bhyve_enable conf.set('WITH_BHYVE', 1) endif elif get_option('driver_bhyve').enabled() @@ -1680,8 +1680,17 @@ if conf.has('WITH_LIBVIRTD') endif =20 if not get_option('storage_disk').disabled() and devmapper_dep.found() a= nd libparted_dep.found() - use_storage =3D true - conf.set('WITH_STORAGE_DISK', 1) + disk_enable =3D true + + if get_option('storage_disk').auto() + parted_prog =3D find_program('parted', required: false, dirs: libvir= t_sbin_path) + disk_enable =3D parted_prog.found() + endif + + if disk_enable + use_storage =3D true + conf.set('WITH_STORAGE_DISK', 1) + endif elif get_option('storage_disk').enabled() error('You must install libparted and libdevmapper to compile libvirt = with disk storage driver') endif @@ -1702,10 +1711,10 @@ if conf.has('WITH_LIBVIRTD') endif endif =20 - if fs_enable - mount_prog =3D find_program('mount', required: get_option('storage_f= s'), dirs: libvirt_sbin_path) - umount_prog =3D find_program('umount', required: get_option('storage= _fs'), dirs: libvirt_sbin_path) - mkfs_prog =3D find_program('mkfs', required: get_option('storage_fs'= ), dirs: libvirt_sbin_path) + if fs_enable and get_option('storage_fs').auto() + mount_prog =3D find_program('mount', required: false, dirs: libvirt_= sbin_path) + umount_prog =3D find_program('umount', required: false, dirs: libvir= t_sbin_path) + mkfs_prog =3D find_program('mkfs', required: false, dirs: libvirt_sb= in_path) =20 if not mount_prog.found() or not umount_prog.found() or not mkfs_pro= g.found() fs_enable =3D false @@ -1727,14 +1736,11 @@ if conf.has('WITH_LIBVIRTD') =20 if not get_option('storage_iscsi').disabled() iscsi_enable =3D true - iscsiadm_prog =3D find_program('iscsiadm', required: false, dirs: libv= irt_sbin_path) =20 - if not iscsiadm_prog.found() - if get_option('storage_iscsi').enabled() - error('We need iscsiadm for iSCSI storage driver') - else - iscsi_enable =3D false - endif + if get_option('storage_iscsi').auto() + iscsiadm_prog =3D find_program('iscsiadm', required: false, dirs: li= bvirt_sbin_path) + + iscsi_enable =3D iscsiadm_prog.found() endif =20 if iscsi_enable @@ -1758,12 +1764,15 @@ if conf.has('WITH_LIBVIRTD') 'lvchange', 'vgchange', 'vgscan', 'pvs', 'vgs', 'lvs', ] - foreach name : lvm_progs - lvm_prog =3D find_program(name, required: get_option('storage_lvm'),= dirs: libvirt_sbin_path) - if not lvm_prog.found() - lvm_enable =3D false - endif - endforeach + + if get_option('storage_lvm').auto() + foreach name : lvm_progs + lvm_prog =3D find_program(name, required: false, dirs: libvirt_sbi= n_path) + if not lvm_prog.found() + lvm_enable =3D false + endif + endforeach + endif =20 if lvm_enable use_storage =3D true @@ -1791,9 +1800,15 @@ if conf.has('WITH_LIBVIRTD') endif =20 if not get_option('storage_sheepdog').disabled() - sheepdogcli_prog =3D find_program('dog', required: get_option('storage= _sheepdog'), dirs: libvirt_sbin_path) + sheepdog_enable =3D true =20 - if sheepdogcli_prog.found() + if get_option('storage_sheepdog').auto() + sheepdogcli_prog =3D find_program('dog', required: false, dirs: libv= irt_sbin_path) + + sheepdog_enable =3D sheepdogcli_prog.found() + endif + + if sheepdog_enable use_storage =3D true conf.set('WITH_STORAGE_SHEEPDOG', 1) endif @@ -1817,12 +1832,15 @@ if conf.has('WITH_LIBVIRTD') =20 if not get_option('storage_zfs').disabled() zfs_enable =3D true - foreach name : ['zfs', 'zpool'] - zfs_prog =3D find_program(name, required: get_option('storage_zfs'),= dirs: libvirt_sbin_path) - if not zfs_prog.found() - zfs_enable =3D false - endif - endforeach + + if get_option('storage_zfs').auto() + foreach name : ['zfs', 'zpool'] + zfs_prog =3D find_program(name, required: false, dirs: libvirt_sbi= n_path) + if not zfs_prog.found() + zfs_enable =3D false + endif + endforeach + endif =20 if zfs_enable use_storage =3D true @@ -1937,8 +1955,14 @@ if not get_option('nss').disabled() endif =20 if not get_option('numad').disabled() and numactl_dep.found() - numad_prog =3D find_program('numad', required: get_option('numad'), dirs= : libvirt_sbin_path) - if numad_prog.found() + numad_enable =3D true + + if get_option('numad').auto() + numad_prog =3D find_program('numad', required: false, dirs: libvirt_sb= in_path) + numad_enable =3D numad_prog.found() + endif + + if numad_enable conf.set('WITH_NUMAD', 1) endif elif get_option('numad').enabled() --=20 2.31.1