From nobody Mon Feb 9 01:01:15 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1618852519; cv=none; d=zohomail.com; s=zohoarc; b=IHIqleaI75aWkhqaMMMxNIbR4Ha9TK6skohItlXpCBcEtOfiy7Fn3PU5cRTMGzEuTmyzickq3LgqUalceav/o9vNl6FJhCJvqEz/y7m0eiOKZiSUnU7tIIowxhrZeJrdbPrBPb3wEP/LZ8bngKAvBubHuu4EoiDabN+O93i0Tbo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618852519; 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=EACQbbUR1t6T6sCTKa9vHT/uu7nS3zAqfi1e5Q0EJVk=; b=ONYpXb5JO1CSd8Z9JiBYwW8HkEZOURm+/xF/ZiKrPngWXQ4W/+bQzEWrFr4pBveEOOs1GcmSxS4EmSXsZ+mS8vGZ07kEGpg0mpO8mNs2sB/c0bLkod8DLfocwgUOiQOTSIsP7b5y94uQPhqIK0MwvNbzozB+2VtnzAnkKNdyeI0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 161885251910548.73673657000688; Mon, 19 Apr 2021 10:15:19 -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-73-_TE_r2y0OkWMQHdGGVK3rA-1; Mon, 19 Apr 2021 13:15:14 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6137618397AD; Mon, 19 Apr 2021 17:15:05 +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 3CBC860BF1; Mon, 19 Apr 2021 17:15:05 +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 E82C155344; Mon, 19 Apr 2021 17:15:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13JHEue1022060 for ; Mon, 19 Apr 2021 13:14:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id A227A5D743; Mon, 19 Apr 2021 17:14:56 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.195.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2116F5D742 for ; Mon, 19 Apr 2021 17:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618852517; 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=EACQbbUR1t6T6sCTKa9vHT/uu7nS3zAqfi1e5Q0EJVk=; b=bD6ML6w5YBAh5hEsg927wuM0FAbVdNH6TE2+4XtNLdgtgHr/PsQaD/D3WaAn+13x66bWdR hfHr168ZVvyd9tXtVqTZiqyerg5H0DEM0BG08DWBUT1mgQJKjBdBrNONCWXRVH145Zojwz fNJRwvhZkLF3VQaLRsVYGzq3Ki3S7iU= X-MC-Unique: _TE_r2y0OkWMQHdGGVK3rA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH v2 19/21] meson: use runtime binaries to only resolve features with "auto" value Date: Mon, 19 Apr 2021 19:14:22 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.12 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 --- meson.build | 102 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 39 deletions(-) diff --git a/meson.build b/meson.build index 5d8eb7f95c..a7d402cd31 100644 --- a/meson.build +++ b/meson.build @@ -1072,12 +1072,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() @@ -1480,11 +1474,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() @@ -1740,8 +1740,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 @@ -1762,10 +1771,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 @@ -1787,14 +1796,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 @@ -1818,12 +1824,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 @@ -1851,9 +1860,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 @@ -1877,12 +1892,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 @@ -1997,8 +2015,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.30.2