From patchwork Wed Jul 14 15:00:00 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: 476749 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp651540jao; Wed, 14 Jul 2021 08:02:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxh/r/iXfiAM5VswJw/zJj5XtiqSuFmuwYw0Q/D6VdNI1DDbys8btY2f5cddsljoXOSsNk7 X-Received: by 2002:ab0:377a:: with SMTP id o26mr14460692uat.103.1626274977056; Wed, 14 Jul 2021 08:02:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626274977; cv=none; d=google.com; s=arc-20160816; b=HMjDJimIAjwwXQxp4sRtz4AO/QNRHZr/wJVgw8At1D6uHLrk0QSOiDLx1RHAxA+WJp 0u1WjQQyKRTPnxGZJow7DCBkOsSOxqtTSywJ2MSM0BnPzRqa5vyX3CaDuONMe2k3yzZf /Z2Sr7voYeLlabVZOM1ykI1ZBAFcH2WssgriXgAlvQ3xqq8eJxfJBHTzTh2uu4mBfzt+ TwtKuONtcYwQp6dp68Xyzy2gJYr+uduKWwxDRBXn7DcG+dmmaOzTtVEQ4YODI8GxStnQ aSBwdhee+Acet/yDs/lIiiBa45fWssSbc0lLhGhC2DpKUVkLotNS5PEnmILoxkdI8FRl SwsQ== 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=f5eU90RHoit+tKKWWo0rk9BGq4kZjn+oIHBSezhYgfs=; b=vFjnMptKEah2xCDa8ZtLDFhn/vajfUyfJL+cby+tV0ZpuOVNo4MrfmDVEJmBZL+BYu CXZdVWakqRzE3NFpSAzaUZU8iKOWgX9LKikrXT7qMD2/xqKRsl/+ycXAgOW6199JU7BF WKNsi8vfjwHiVry40KpdvkP557IxfDjzBrGjI2yoiYPXe4wwKF8Bxu/iV8fKVgt8yae2 N9Bf1uc/XWbNYWChnNx50N3tUvpE9W6D0ksSahu4r05bSfH0v2gvuYw9Ea010exVq95B L8+8UJMJLfCsAe6NKuntpdCCk1FeqOEz+p7jILplj3e8XVQxN5nSJcE+4OTO9bZDgyu3 ltLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Bg1/SDkb"; 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 az13si3980970uab.192.2021.07.14.08.02.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Jul 2021 08:02:57 -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="Bg1/SDkb"; 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]:47188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m3gPY-0000Wb-B5 for patch@linaro.org; Wed, 14 Jul 2021 11:02:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m3gNY-000799-13 for qemu-devel@nongnu.org; Wed, 14 Jul 2021 11:00:52 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:40859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m3gNW-0007Tx-74 for qemu-devel@nongnu.org; Wed, 14 Jul 2021 11:00:51 -0400 Received: by mail-wm1-x32a.google.com with SMTP id f8-20020a1c1f080000b029022d4c6cfc37so2796078wmf.5 for ; Wed, 14 Jul 2021 08:00:49 -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=f5eU90RHoit+tKKWWo0rk9BGq4kZjn+oIHBSezhYgfs=; b=Bg1/SDkbjehOECDO/t5PfYKJDvz6NSQMEpjfuwUbTq0jQvGfCaUlCTeR8pjk3boPKy ZdzprR1rxcbTVdcP4DhDpA/79bdZ1iVn4B0KWLgTo/+b610BoLxoaRHuL/wgRL9idM+i PzrFR1Z/WotdbtnTuISt2PjFABGxdoUgQywA1SscVgG/0x45TItZBZ8VtPpGi/yCJpWg G7Vst/QcJVVkJ90YJmsJ4SXLjKaWAO26CsyXIQSxxD1XdO7CeuzsnEEVhnule6d/D61b ZaUjhXjzitRlmVLaw21BxW6sLHQReeSSUrKxUROjcok2s2xd0Qd7UjGy0YBBqetTXOCQ cdUw== 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=f5eU90RHoit+tKKWWo0rk9BGq4kZjn+oIHBSezhYgfs=; b=jq+SrziW4r3hEIXf2Xnek3vY3aFwTEJYTXI1uXRmA9u6S8MeSoWpvCU4TLAs25ws9E PpQR1qNezMds1/cY1GLtaIACrKf5UCK2Az2VQP8m3p45MyiBBopeTLJfEJpIQmttFloV a3BEWlMUHB7hcJ+CFwVLrnFG9QoIpzSuMNZbLNtpDFbmj8umS1xIZsiLvleUp+d1Y7i0 URwu21G4fputrcXHrxPjIOwrFMd3iOWP1vqkz+u99hq2FYQL0kjK725/4R7gJP4IlQHZ geQMMuQhAcF6MD+eVm7FgarYNbSmVSrF5x3OA7G2q9J5d92P/0kLx8+0jVSaMYZ6EYQm 4oPA== X-Gm-Message-State: AOAM532pSn5AANypU8dsWJPMyvKp2911SGW+ukEmD7zU/uSi8xXat9zY SZxBZBCCqyL/NwKJ5ZkJmpr8GA== X-Received: by 2002:a05:600c:3644:: with SMTP id y4mr4726941wmq.85.1626274848197; Wed, 14 Jul 2021 08:00:48 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p3sm5427019wmq.17.2021.07.14.08.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jul 2021 08:00:42 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 82AE61FF96; Wed, 14 Jul 2021 16:00:37 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL v5 08/44] build: validate that system capstone works before using it Date: Wed, 14 Jul 2021 16:00:00 +0100 Message-Id: <20210714150036.21060-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210714150036.21060-1-alex.bennee@linaro.org> References: <20210714150036.21060-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32a; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32a.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: Thomas Huth , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Richard Henderson , qemu-devel@nongnu.org, Willian Rampazzo , =?utf-8?q?Alex_Benn=C3=A9e?= 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é Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth Reviewed-by: Willian Rampazzo Reviewed-by: Richard Henderson Message-Id: <20210625172211.451010-2-berrange@redhat.com> Message-Id: <20210709143005.1554-7-alex.bennee@linaro.org> -- 2.20.1 diff --git a/meson.build b/meson.build index 512ee2e926..89c09ed7ea 100644 --- a/meson.build +++ b/meson.build @@ -1657,6 +1657,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 does not appear to work') + endif + endif + if capstone.found() capstone_opt = 'system' elif have_internal