From patchwork Thu Jul 8 19:09:08 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: 471302 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp579170jao; Thu, 8 Jul 2021 12:21:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvQgLNG3W15u82Ll6G8Uet7hbUU+5sbIdwGtlCmLrtHoOd6b6usDPeU/yALqU+gw2BRgBw X-Received: by 2002:a17:907:1c1b:: with SMTP id nc27mr22605569ejc.294.1625772064224; Thu, 08 Jul 2021 12:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625772064; cv=none; d=google.com; s=arc-20160816; b=UU4w0lBYx0teCg0cetvFYn5qgXR3SV104sz8mLQoI970v0oP6W8EvYUXGSm6ONGagE 8qKkW4A1XahPWBbutoOcZIifK5CHt2gx9IAIjxJWbNMR39VLUwXDylIpsDRVZzqVnnkV oLJH6YTpmUSTL+n5oij9NhZlEx7jlkaDQyPqvdU1xXbLrplSQS3HR9XOvnJvDVvb8/As 3A7aFUNlsEQRIZUJ5+xF/7ln/os5ZhwdNirQmRIOhBplVadmmT9vyMUlglmERW7DdIyY +hkA1Bm43dsqJs5JY/GNV+7YNseGayf8RP8uq7p1CltiofHhsJCbDaWR+LRMrku+2C5G aHEA== 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=mT3mcqLOAnApKtAKtETbhg88KZBSfVR94gAjCWER5/RoHgBA8Hs8B+q9P7dV/BNjik XcKVqMNujcuXt9dysNqhMRsJQ+EZ8aEFnGxsdhtU983T9lbuCJy/sL0xci+MfdUI1sMQ fkt+97QIkDjhpit8A3qVurlDfOLmP1hZXqt3xirtvf5JXk2XrbJEjTQ0VnYq++GsXy0m 1D+XbjX4dSzywBC1WjGBEun0nAh4GnfEaGPLf2u8t5JzEZ6RhIgATOIYEoyzVoftUsKc DJpZmG8LFFTqeXLpkfIo+eo0QJAwdjR8XnIfHgwenL44HmJS7Lj6RK0zizSd3XBMBBUY 8ZlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=AukL+zxr; 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 cx24si3905756edb.114.2021.07.08.12.21.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 08 Jul 2021 12:21:04 -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=AukL+zxr; 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]:55834 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m1Za3-0008Ga-3t for patch@linaro.org; Thu, 08 Jul 2021 15:21:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m1ZPJ-0003SX-9h for qemu-devel@nongnu.org; Thu, 08 Jul 2021 15:09:57 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:46948) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m1ZPF-0004n9-CT for qemu-devel@nongnu.org; Thu, 08 Jul 2021 15:09:57 -0400 Received: by mail-wm1-x32e.google.com with SMTP id k16-20020a05600c1c90b02901f4ed0fcfe7so4709267wms.5 for ; Thu, 08 Jul 2021 12:09:52 -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=AukL+zxr98vjE78dHRflnNM72T2N4ziy1hDnwtQHmq4X8CJFJHZDR2E6vVIjTzx6Wn 2ynoAEIttMwJl+NsV6zJ09I0KenrLf9iSfSWDB+s2VFKlMZS4c5cQ2/o6W/6uFF4GqqG 1L/uTw43L1r90H6hmYEaEeU/d/+L64aCDaFzaWpZslruPAAFy42XQ2d1jmf0p74RZ5E6 QhDiHUbmGRZG23SnKkGsqeKsgd98dsbvmq8LIaNTUN0mKjmo9IVyH2ZePe13FxVI8Nzy R+Qhd71UOTnAjEberw0usUP//zf3y4soMTRLixrallFPm9mSo99uA52aQYdntzaspXgT ax8Q== 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=BMy9xbdhHD0RBT3ssYO+mrKCKKmN4esK0o/GVngqu0jGIFNwcPt1aQ+T7JSI5LlZtT rlMIMMIClecYxlUP08HCO5oY+hwFKiHBNovNGayIqTI+3yqeH3TSyFy/YTvyV88OlULy 3UOo9/yjkW4p3AzjjMGb55YnpHuq619Pp780lRU+OI7b+UKhhkR1v4SwvK9SkiVIgsWT LSDgrQBHrQTC3p+idqgsoJ3/qG576qg2rsHKpydNxlwKxOqNRts8vjLGM7it5eABIQdR s7aRNH2HmiBMCAGFnl2FCBlSrG4+SFQUADmwTqBBo9StDUx4UdYCHP4Ui1DBnthCdlZv wpnw== X-Gm-Message-State: AOAM530RDNw2vKvicnJ15d6Jss3ouSX9KHfqN3cQbVUkDWBohhNsum9D gPfnmaMOESFVrNjFG1w4QQuVGQ== X-Received: by 2002:a05:600c:b48:: with SMTP id k8mr7089444wmr.180.1625771391276; Thu, 08 Jul 2021 12:09:51 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id b12sm3026194wrx.60.2021.07.08.12.09.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jul 2021 12:09:45 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 828741FF92; Thu, 8 Jul 2021 20:09:42 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v2 06/39] build: validate that system capstone works before using it Date: Thu, 8 Jul 2021 20:09:08 +0100 Message-Id: <20210708190941.16980-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210708190941.16980-1-alex.bennee@linaro.org> References: <20210708190941.16980-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32e.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 , minyihh@uci.edu, berrange@redhat.com, kuhn.chenqun@huawei.com, f4bug@amsat.org, robhenry@microsoft.com, Willian Rampazzo , mahmoudabdalghany@outlook.com, aaron@os.amperecomputing.com, cota@braap.org, stefanha@redhat.com, crosa@redhat.com, pbonzini@redhat.com, ma.mandourr@gmail.com, =?utf-8?q?Alex_Benn=C3=A9?= =?utf-8?q?e?= , 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 Reviewed-by: Richard Henderson 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