From patchwork Mon Mar 12 18:18:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dylan Baker X-Patchwork-Id: 10276961 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51D1960211 for ; Mon, 12 Mar 2018 18:18:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C20428AE8 for ; Mon, 12 Mar 2018 18:18:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F11A28AF1; Mon, 12 Mar 2018 18:18:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A340D28AE8 for ; Mon, 12 Mar 2018 18:18:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4D6386E164; Mon, 12 Mar 2018 18:18:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0494E6E164 for ; Mon, 12 Mar 2018 18:18:30 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 2828A20D2A; Mon, 12 Mar 2018 14:18:30 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Mon, 12 Mar 2018 14:18:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pnwbakers.com; h=cc:date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=mesmtp; bh=pI04YQ7ahuI0sNchvt/ThWP32bi5N1znt63t0E YpKbQ=; b=fRbA0w+EHX4eNVU8HfrOdfZXz3PgSIJJtsFhmvytqdVBUfmWasiUaM h5kg+KLXsFJZjDQLlLVGipTjxfKJr3K1UN48YX4DNqPvCVVyV6Me9W0448zVe5c2 2XN4jHEhFCSW+cDrPC1oZoE5P/2DwQcuMchtofgqFGaLDTqji8+34= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=pI04YQ7ahuI0sNchv t/ThWP32bi5N1znt63t0EYpKbQ=; b=PVCndSWE8mb0sCF4rkEhbBA1vSHAjIfq5 h5oLO0AA/CnUwKBC18MJI0+Xm0bas259Xknf+qmjo6oa31RsaYd+VoZ1NjwW77Mu ++0UDWoacgSxovLlpmuAyRzfxVBK1l36nyaAiTQ+zWh727BVg1HIcuzRPHXdxtQH mZeSH+qoi9Vfx5FxnFn+jmaa0+CTOVCAd3J2+/lFOaXN1TjyBsKoJkQX5aUKL+Je /ALu7L1BId2/1hPpM2+ONTq42W3HhyFE/ShOcHaTnNRfpuSW76JpaYYDoXj4wIvU 9SryCqQA7DHC3zHk3ioUlPVlK/m0VfrQXIJbPM/UkIXQSI9XhTNaQ== X-ME-Sender: Received: from localhost (unknown [134.134.139.83]) by mail.messagingengine.com (Postfix) with ESMTPA id A22567E1CF; Mon, 12 Mar 2018 14:18:29 -0400 (EDT) From: Dylan Baker To: dri-devel@lists.freedesktop.org Subject: [PATCH libdrm] meson: don't use compiler.has_header Date: Mon, 12 Mar 2018 11:18:27 -0700 Message-Id: <20180312181827.24549-1-dylan@pnwbakers.com> X-Mailer: git-send-email 2.16.2 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dylan Baker MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Meson's compiler.has_header is completely useless, it only checks that a header exists, not whether it's usable. This creates problems if a header contains a conditional #error declaration, like so: > #if __x86_64__ > # error "Doesn't work with x86_64!" > #endif Compiler.has_header will return true in this case, even when compiling for x86_64. This is useless. Instead, we'll do a compile check so that any #error declarations will be treated as errors, and compilation will work. Fixes compilation on x32 architecture. Gentoo Bugzilla: https://bugs.gentoo.org/show_bug.cgi?id=649746 meson bug: https://github.com/mesonbuild/meson/issues/2246 CC: Matt Turner Signed-off-by: Dylan Baker Reviewed-by: Eric Engestrom --- meson.build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index df6f2bd2..a0c79e30 100644 --- a/meson.build +++ b/meson.build @@ -186,10 +186,10 @@ else dep_rt = [] endif dep_m = cc.find_library('m', required : false) -if cc.has_header('sys/sysctl.h') +if cc.compiles('#include ', name : 'sys/sysctl.h works') config.set10('HAVE_SYS_SYSCTL_H', true) endif -if cc.has_header('sys/select.h') +if cc.compiles('#include ', name : 'sys/select.h works') config.set10('HAVE_SYS_SELECT_H', true) endif if cc.has_header_symbol('sys/sysmacros.h', 'major')