From patchwork Tue Jul 6 14:57:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 470451 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp5079625jao; Tue, 6 Jul 2021 07:59:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEvpn7aJKHnGlhns0Zr4oiTLNki1ChpsBNVAxTbQtxNRRiyp08ahreadDppK3ly4ccGSIv X-Received: by 2002:a67:cd85:: with SMTP id r5mr8600535vsl.44.1625583553748; Tue, 06 Jul 2021 07:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625583553; cv=none; d=google.com; s=arc-20160816; b=iPH5GiP0CREzYElwMWjSe/ZQF6ChC9YHMpoAVNQtew/Z+iE6zWyrY7gfCM5UV8wKYK AxIcyBjaai9fccgt1hqb4p80EDex+l17Lx7kF8J225iQuL+b5MClU91QxhwpuzuRgB5d QblCW24trfKWF3kmZ2eQCjEUNJuE29XT8y8FcqPjY1RTZBRnLwEGSYq2JCbL2Nq3eMCf NaINNDk6HPqiokOvRBYf2S+YtzMdhuL0VIb9F9SHq8gfmvuejXM+daOzzhUDOFERRoH0 OiDKrPq4EpsJ5JUTPINtlF0KhRc7bZ0T7h+TN7tVg6pgic/2EPMk6/FGMwD4LhB0A36d lD8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=X6XYeRZ0RRlPFd/72iPoC9h0a9yGfi2XY4pmA13N9sM=; b=0eF6w3zVopQBzPSTFBR62+tiaUZ2j/EPqLLYM4z9rd777p/YHwUnU6GN4iC+m9PKrm qvZPEmrLiqn8CZBNasdjMi1QVXUCO7ar/eKhvNjIzzB1kvgVlG7/PTflV2cbjvfooatT q37DtHDGzgJoNmtQOtYyEsfDh87uQFhf81w74haWrbtw0v8H5OrZM1UVA9/6JtwZw1jX 4YVUMZ7xyB0+LCf63dem8gnNpbBg3/Vmf3D4NMtxJTvLYpYWoYDWpcP4abtwXbLo8L9w IUbn3wYarnIfBFcSCrAB8LEn1JcSt5ZOUQv+9cHx5EOEZEyvLkkECICDp7EqezCIP/7p 13ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CbXCJ8Ya; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 65si11464868uaf.110.2021.07.06.07.59.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Jul 2021 07:59:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=CbXCJ8Ya; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0mXZ-0004jL-0d for patch@linaro.org; Tue, 06 Jul 2021 10:59:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33214) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0mX0-0004ez-CS for qemu-devel@nongnu.org; Tue, 06 Jul 2021 10:58:38 -0400 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:45750) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m0mWt-000237-FB for qemu-devel@nongnu.org; Tue, 06 Jul 2021 10:58:38 -0400 Received: by mail-wr1-x42f.google.com with SMTP id i8so13547589wrp.12 for ; Tue, 06 Jul 2021 07:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X6XYeRZ0RRlPFd/72iPoC9h0a9yGfi2XY4pmA13N9sM=; b=CbXCJ8YaRX3KP6VPziblomeo/5M4vdKJnHQcMifN9E/vdwt7f2sFyCi95J9ezyoTxp 7C3aie32E6eAcevr2n2HQWkxbuivXWyjmXaiWC2jvHW/wsxq/pyt4gk3W3ntpRpot4GI ea3ofLjSosMuUBF6B1NkKltw+HkgntAfWDBFTr3/jdku3TdacSKhn9PAjdyjxSI87urS VvDQlj8JxW55+kdoagG4BtehDKMKn+EnHEdjaxAaAcjhoAHW5dL1ax2YPmew6RjqXUvG pikVRLwvorjqTCcXrhhS7gyToQovVrenvc/gLFG3Od3LyAKGFB0mFivp4cA3GrsPwl09 agTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X6XYeRZ0RRlPFd/72iPoC9h0a9yGfi2XY4pmA13N9sM=; b=tHCh6WhxjZ4Sq8+9oHDDxfAQGFCm1sUQaEIewsOAkfBmjMn21yOULNw8dseCtTQWH5 Uulc0GofVp7JH/oxCByypEzmJJzLBM/vp6uC3lA0q0wg1X9tmTRb/2InvKTy6OrEBAhI HEqQbqBj0EA8KH8HWNwAZ5FyzLxCpLV5bowjH3q1P3T2ET1zicrHJJJJzT8EiPLFhwa6 cZBwNwpLWjyQu4ygmBaQ5IeppHXn8KH/c8SKAGoSH9LhqSPEbhEKK3ubGn8ELV/7gYHP m/WZu6fy2AfDj6fovh46XUh84EU6N34oXJoU77F7bYXsdM8RaDlFzbE5XJvSsLCCRQ5r wUUA== X-Gm-Message-State: AOAM530jNHICR++7JVU0OjQUMAcnzhBT9IwleYPuUz+RHrLnd/knhGfZ wA86X1N9EG9PBcmGDbaxEaMahg== X-Received: by 2002:a5d:5088:: with SMTP id a8mr19996266wrt.153.1625583505222; Tue, 06 Jul 2021 07:58:25 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id c1sm16964984wrp.94.2021.07.06.07.58.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jul 2021 07:58:21 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 67E761FF92; Tue, 6 Jul 2021 15:58:18 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 06/39] build: validate that system capstone works before using it Date: Tue, 6 Jul 2021 15:57:44 +0100 Message-Id: <20210706145817.24109-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210706145817.24109-1-alex.bennee@linaro.org> References: <20210706145817.24109-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: fam@euphon.net, Thomas Huth , berrange@redhat.com, f4bug@amsat.org, Willian Rampazzo , stefanha@redhat.com, crosa@redhat.com, pbonzini@redhat.com, =?utf-8?q?Alex_Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Daniel P. Berrangé Some versions of capstone have shipped a broken pkg-config file which puts the -I path without the trailing '/capstone' suffix. This breaks the ability to "#include ". Upstream and most distros have fixed this, but a few stragglers remain, notably FreeBSD. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Reviewed-by: Willian Rampazzo Message-Id: <20210625172211.451010-2-berrange@redhat.com> Signed-off-by: Alex Bennée --- meson.build | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.20.1 diff --git a/meson.build b/meson.build index 7e12de01be..2748721d71 100644 --- a/meson.build +++ b/meson.build @@ -1641,6 +1641,19 @@ if capstone_opt in ['enabled', 'auto', 'system'] kwargs: static_kwargs, method: 'pkg-config', required: capstone_opt == 'system' or capstone_opt == 'enabled' and not have_internal) + + # Some versions of capstone have broken pkg-config file + # that reports a wrong -I path, causing the #include to + # fail later. If the system has such a broken version + # do not use it. + if capstone.found() and not cc.compiles('#include ', + dependencies: [capstone]) + capstone = not_found + if capstone_opt == 'system' + error('system capstone requested, it it does not appear to work') + endif + endif + if capstone.found() capstone_opt = 'system' elif have_internal