From patchwork Mon Jul 12 12:26:19 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: 473081 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp2891815jao; Mon, 12 Jul 2021 05:28:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxC4qpR6FXmo4WZN1LwPdK2uXGac48ql73ZYfdDPteMZgdtKosEULxtqCHdlvznBmsfkQno X-Received: by 2002:a1f:9c54:: with SMTP id f81mr42126114vke.11.1626092889097; Mon, 12 Jul 2021 05:28:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626092889; cv=none; d=google.com; s=arc-20160816; b=Qw4kYhZ+P19P6mXQip0+CWEYL2GQQCRXBwwVZG+o4M+j7OEMfP4JMMCFZSZ2GhTNZb veRbS/zoXW/7FKsMIrr8hhoyBFT3tsIpOd/Y+DwcBpMK7ckHR7X1L5y70QxLMVvS38hb E3iaAh9YRV62S934uQ466CVi0Aktk8rJjQyNgeqYUg4BRZfmScRW8Ckyx+VziBjmw/3Q ixiaCl8AAr4g92WBG8gyEsMMhcLUWYSopdzF1b+WH7YeZ6GMhYQvFsduFxrkW/sRV27o 49QBrc8PKzqL3jyTKEJGtHZDAicuGbvi6L7u0Z5J4Zm6aEeFLYhJx+OB/C9vpNIXCuF9 JgKg== 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=vfMIiyHNfTwBacCZ/Z5kXuUc3K4JlBoxSMTzFBkGMIE=; b=KClPCYh0eVfCxR4MSwDWziRSnaUTnOTiaODkSxYPu35ul9PJ8cRFdlSd2YsUQUsqjn LW4ELvyX9USsP7Oi3mV74MWMZ2tfECV7PrAyyu6TavOkRi4TXIQWYtFDUIYw3MudbdIp 7wVKVrs5KpS2ubhaC6EbMfqxZI33Dzn9x2R0jifHMfG8yPyub8aRua+oVsR92QBecj6Z p/QSEHJBX3bkObkGsVTBaIK4aM5vYfQg9XmowlcQTtyhSo5C6lz4IRVAlTJVjBEUnVNQ 4twHPSxILWJnV2K7Cfqk96THj3lEDdlOkHKeNs+Y5U935D2bXJ1jFLTmWT17b7w/uv07 IXMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=U8kaS19z; 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 t15si13777957vsl.253.2021.07.12.05.28.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Jul 2021 05:28:09 -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=U8kaS19z; 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]:48238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2v2Y-0004Bo-Ts for patch@linaro.org; Mon, 12 Jul 2021 08:28:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2v1f-00047n-4C for qemu-devel@nongnu.org; Mon, 12 Jul 2021 08:27:07 -0400 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]:46017) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2v1d-0007vf-EL for qemu-devel@nongnu.org; Mon, 12 Jul 2021 08:27:06 -0400 Received: by mail-wm1-x32a.google.com with SMTP id u8-20020a7bcb080000b02901e44e9caa2aso11380095wmj.4 for ; Mon, 12 Jul 2021 05:27:05 -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=vfMIiyHNfTwBacCZ/Z5kXuUc3K4JlBoxSMTzFBkGMIE=; b=U8kaS19zVZwGOyfBs4xSViFZJK4/UO5JjcrFwKvrE+iLdxpetjxf8DnkOBh6hUXcDm B8DwhwCJLr6DtiGqoceG71EN7wVI5HQ9BVwJ3pJ85YqCcvy2ZDZ+jJxKmeGc+yfX3q2B YfKeXfS9Yj4oE9n1r/H8OP9+U7XfNrS7C60ZnDVqy9hCd/U5w7v3MXi/27gXHMuLx7WD gmKx/pzpw30c4S1WBFkVmmZEC7qGdyEnyAPO4gX7EaNdbSGPGHJvEv8M6m/dktbAP3JK QrAFmUIHKQP0YzyRjTuNaxKZuPSEUNADaHeZJP/oILkQi+B2g5R2sq9L6Td5PqDqOOGs GaQg== 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=vfMIiyHNfTwBacCZ/Z5kXuUc3K4JlBoxSMTzFBkGMIE=; b=cWsnqyt6wkXOex9HYdNhvr2FyI6It3Uxh9FDcKCGrTz4ksKKVn13eoPCn13F1iyvYU 7bCf3bUW1tyaXPTibacOUs0nZk762UrysXzabLSectXsl0RbqvOPANcQLXpvHX9Dy64i 5foFV2jrWjjkD6TjmBqmaCZh6y81Mp2OOHymvhIPE3FbBxKASY+Cmd1ASQa2o+wvQgYH TjFJle2E38j37lOdCvQOSvYtsNHWFlupuJvClUv497wXBAMQtktdIKB3gOL82wl412kT 4H2t1BiQLwEvMrAxIA8SpCxOmiE9oNA5HrEOn+J2itr9bkdfLVeEZduPlvU4Qk4a96Fo luvg== X-Gm-Message-State: AOAM530cB1Mq0/jivXhUIe/pYB8bp/nehCDsiWy7NEXCj9Txcmnt/IwW DVgD//gxxTp60tBpC51GeK9QLw== X-Received: by 2002:a1c:4b04:: with SMTP id y4mr2945735wma.185.1626092824194; Mon, 12 Jul 2021 05:27:04 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id o14sm8309852wrj.66.2021.07.12.05.26.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jul 2021 05:27:02 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 5A96C1FF92; Mon, 12 Jul 2021 13:26:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Subject: [PULL 06/40] build: validate that system capstone works before using it Date: Mon, 12 Jul 2021 13:26:19 +0100 Message-Id: <20210712122653.11354-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210712122653.11354-1-alex.bennee@linaro.org> References: <20210712122653.11354-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 eb362ee5eb..cea8196e53 100644 --- a/meson.build +++ b/meson.build @@ -1644,6 +1644,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