From nobody Mon Feb 9 09:18:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1594893751; cv=none; d=zohomail.com; s=zohoarc; b=QO5yytbithbqrzM/Iwgd0eX/sF2q68B4iTaxxcxg3gxiHNwN9tbAd9IV4S+tckYq85iXgDM0v+296pKJ64UsB4o3zkvrG4CammvxHcI/D7e0hWMFl3/2NEGeKBGp/j9BG5fG3Pjx6VoyXF47PUCipgJvAkMRI5hPOdBDglA68sc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594893751; 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=u6Tk1pdjYbP2KEVenZenULLqQ7ux5nb+9vZKuJ/6eMM=; b=IkimEpA+QHk13fL3Fd/WCBelXRgdRrhyxumyZ7CYZ1BlO/JqY3qBwbmmg/4MGXMF2LUSPUHX8aerDxaWixe3w/bYXyJ/0WjWs5yyUooUVJ234PdncRxH9lRUOjTB86mQ3d6S/rcXRMWTcMJTFaYS6ZNntBpRRcyYhn29CdQFrhc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594893751373228.51464362481215; Thu, 16 Jul 2020 03:02:31 -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-48-YisXcZDSPyGxXjteonfbYQ-1; Thu, 16 Jul 2020 06:00:57 -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 007941092; Thu, 16 Jul 2020 10:00:52 +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 D38A278490; Thu, 16 Jul 2020 10:00:51 +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 A0078180531F; Thu, 16 Jul 2020 10:00:51 +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 06GA0liH015480 for ; Thu, 16 Jul 2020 06:00:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id C74A82DE72; Thu, 16 Jul 2020 10:00:47 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.194.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F92D2DE6F for ; Thu, 16 Jul 2020 10:00:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594893750; 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=u6Tk1pdjYbP2KEVenZenULLqQ7ux5nb+9vZKuJ/6eMM=; b=UepzDAassQm4ouJZGG+CnZlcD4tmuro4a4CmS8pTMWHFanFpt8iip+C15opRekTywGquC5 9bR3METXs70e2+kvTUR94AjMzBPLeOpQP3tsrprL/3lTTF7noaPKt1stRCWpcDggfy21BA 8b0Cq2ZNpZI96kA6Pd5b8SbTg1dGRcA= X-MC-Unique: YisXcZDSPyGxXjteonfbYQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 026/351] meson: add headers check Date: Thu, 16 Jul 2020 11:54:22 +0200 Message-Id: <9b66dcbd9c24d593777f173730b15450234b2e65.1594891445.git.phrdina@redhat.com> 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.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" Signed-off-by: Pavel Hrdina --- configure.ac | 90 ---------------------------------------------------- meson.build | 72 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 90 deletions(-) diff --git a/configure.ac b/configure.ac index 904c2a0fdcf..4a40f3fc34e 100644 --- a/configure.ac +++ b/configure.ac @@ -207,28 +207,6 @@ LIBVIRT_CHECK_YAJL =20 AC_CHECK_SIZEOF([long]) =20 -dnl Availability of various common headers (non-fatal if missing). -AC_CHECK_HEADERS([\ - asm/hwcap.h \ - ifaddrs.h \ - libtasn1.h \ - util.h \ - libutil.h \ - linux/magic.h \ - mntent.h \ - net/ethernet.h \ - net/if.h \ - pty.h \ - pwd.h \ - stdarg.h \ - syslog.h \ - sys/ioctl.h \ - sys/mount.h \ - sys/syscall.h \ - sys/sysctl.h \ - sys/ucred.h \ - xlocale.h \ - ]) dnl Check whether endian provides handy macros. AC_CHECK_DECLS([htole64], [], [], [[#include ]]) =20 @@ -256,11 +234,6 @@ AC_CHECK_DECLS([SEEK_HOLE], [], [], #include ]) =20 =20 -dnl Our only use of libtasn1.h is in the testsuite, and can be skipped -dnl if the header is not present. Assume -ltasn1 is present if the -dnl header could be found. -AM_CONDITIONAL([HAVE_LIBTASN1], [test "x$ac_cv_header_libtasn1_h" =3D "xye= s"]) - AC_CHECK_LIB([intl],[gettext],[]) AC_CHECK_LIB([util],[openpty],[]) =20 @@ -344,54 +317,6 @@ LIBVIRT_CHECK_SYSCTL_CONFIG LIBVIRT_CHECK_NSS =20 =20 - - -dnl -dnl check for kvm headers -dnl -AC_CHECK_HEADERS([linux/kvm.h]) - - -dnl -dnl check for kernel headers required by src/bridge.c -dnl -if test "$with_linux" =3D "yes"; then - # Various kernel versions have headers that are not self-standing, but - # yet are incompatible with the corresponding glibc headers. In order - # to guarantee compilation across a wide range of versions (from RHEL 5 - # to rawhide), we first have to probe whether glibc and kernel can be - # used in tandem; and if not, provide workarounds that ensure that - # ABI-compatible IPv6 types are present for use by the kernel headers. - # These probes mirror the usage in virnetdevbridge.c - AC_CACHE_CHECK( - [whether and headers are compatible], - [lv_cv_netinet_linux_compatible], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #include - #include - ]])], - [lv_cv_netinet_linux_compatible=3Dyes], - [lv_cv_netinet_linux_compatible=3Dno])]) - if test "x$lv_cv_netinet_linux_compatible" !=3D xyes; then - AC_DEFINE([NETINET_LINUX_WORKAROUND], [1], - [define to 1 if Linux kernel headers require a workaround to avoid - compilation errors when mixed with glibc netinet headers]) - fi - AC_CHECK_HEADERS([linux/param.h linux/sockios.h linux/if_bridge.h linu= x/if_tun.h],, - [AC_MSG_ERROR([You must install kernel-headers in order to compile l= ibvirt with QEMU or LXC support])], - [[#include - #if NETINET_LINUX_WORKAROUND - # define in6_addr in6_addr_ - # define sockaddr_in6 sockaddr_in6_ - # define ipv6_mreq ipv6_mreq_ - # define in6addr_any in6addr_any_ - # define in6addr_loopback in6addr_loopback_ - #endif - #include - ]]) -fi - - dnl Need to test if pkg-config exists PKG_PROG_PKG_CONFIG =20 @@ -482,20 +407,6 @@ if test $with_storage =3D yes; then fi AM_CONDITIONAL([WITH_STORAGE], [test "$with_storage" =3D "yes"]) =20 -dnl -dnl check for kernel headers required by btrfs ioctl -dnl -if test "$with_linux" =3D "yes"; then - AC_CHECK_HEADERS([linux/btrfs.h]) -fi - -dnl -dnl check for xfs dev headers required by xfs ioctl -dnl -if test "$with_linux" =3D "yes"; then - AC_CHECK_HEADERS([xfs/xfs.h]) -fi - dnl dnl check for DEVLINK_CMD_ESWITCH_GET dnl @@ -505,7 +416,6 @@ dnl along with the original spelling of this constant dnl (DEVLINK_CMD_ESWITCH_MODE_GET, not supported by libvirt) dnl if test "$with_linux" =3D "yes"; then - AC_CHECK_HEADERS([linux/devlink.h]) AC_CHECK_DECLS([DEVLINK_CMD_ESWITCH_GET], [], [], [[#include ]]) fi diff --git a/meson.build b/meson.build index eb71a66cdf2..62e51230888 100644 --- a/meson.build +++ b/meson.build @@ -664,6 +664,78 @@ foreach function : functions endforeach =20 =20 +# various header checks + +headers =3D [ + 'asm/hwcap.h', + 'ifaddrs.h', + 'libtasn1.h', + 'libutil.h', + 'linux/kvm.h', + 'linux/magic.h', + 'mntent.h', + 'net/ethernet.h', + 'net/if.h', + 'pty.h', + 'pwd.h', + 'stdarg.h', + 'sys/ioctl.h', + 'sys/mount.h', + 'sys/syscall.h', + 'sys/sysctl.h', + 'sys/ucred.h', + 'syslog.h', + 'util.h', + 'xlocale.h', +] + +if host_machine.system() =3D=3D 'linux' + # check for kernel headers required by btrfs ioctl + headers +=3D 'linux/btrfs.h' + # check for xfs dev headers required by xfs ioctl + headers +=3D 'xfs/xfs.h' + # check for DEVLINK_CMD_ESWITCH_GET + headers +=3D 'linux/devlink.h' +endif + +foreach name : headers + if cc.has_header(name) + conf.set('HAVE_@0@'.format(name.underscorify().to_upper()), 1) + endif +endforeach + +# check for kernel headers required by src/util/virnetdevbridge.c +if host_machine.system() =3D=3D 'linux' + # Various kernel versions have headers that are not self-standing, but + # yet are incompatible with the corresponding glibc headers. In order + # to guarantee compilation across a wide range of versions (from RHEL 5 + # to rawhide), we first have to probe whether glibc and kernel can be + # used in tandem; and if not, provide workarounds that ensure that + # ABI-compatible IPv6 types are present for use by the kernel headers. + netinet_workaround_code =3D ''' + #include + #include + + int main(void) { return 0; } + ''' + if not cc.compiles(netinet_workaround_code) + conf.set('NETINET_LINUX_WORKAROUND', 1) + endif + + required_headers =3D [ + 'linux/param.h', + 'linux/sockios.h', + 'linux/if_bridge.h', + 'linux/if_tun.h', + ] + foreach name : required_headers + if not cc.has_header(name) + error('You must install kernel-headers in order to compile libvirt w= ith QEMU or LXC support') + endif + endforeach +endif + + # define top include directory =20 top_inc_dir =3D include_directories('.') --=20 2.26.2