Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nHQPo-0006zQ-EC for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Feb 2022 13:20:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nHQPn-00025b-5r for pgsql-hackers@arkaria.postgresql.org; Tue, 08 Feb 2022 13:20:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nHQPl-00024m-Sa for pgsql-hackers@lists.postgresql.org; Tue, 08 Feb 2022 13:20:14 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nHQPf-0000FN-56 for pgsql-hackers@postgresql.org; Tue, 08 Feb 2022 13:20:13 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 2037C5C0197; Tue, 8 Feb 2022 08:20:04 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 08 Feb 2022 08:20:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=dsD6pFE1fWajpF7uxDx0mJb6tKaH3spNKxPZ3EJub5E=; b=YAN4eBDb sePpSlddpzLD+jIM83B58Xe9TVm5uounXWtuVfcCAw24PxPi/lHAl62wGcV9nlEV bQ5tqUxxZ/8V3k+KOdNpBcpsc9rFh34jARql9SskHKdAnjhcAB+pDkkWTyBLA4yY BCHOX/GcnIujJ8gndAMvbZ6RZ9DuqVkeeTzHgxqiyreyV4GQyjSEw4h2LnLWRnRB nmDBrEe9X08geJp2qW5kNdGztHE0P3Ye7ApxzYKVXK8PPJzoq9JDnQ6w5LO3urgn X8OrUk/Wxy7gsePc48ZY1S+LqKh25GXF5psKGmzmZORLSzWYw0S+e4eb1lN7Xzkp O/ueMtDwK5b3UA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrheejgdegkecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefkffggfgfuvfhfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpefrvghtvghr ucfgihhsvghnthhrrghuthcuoehpvghtvghrrdgvihhsvghnthhrrghuthesvghnthgvrh hprhhishgvuggsrdgtohhmqeenucggtffrrghtthgvrhhnpeefjeegheetuefhveevudel ueeftdejteeiffetvdduhfdtieefgfeutedtveeggfenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpvghtvghrrdgvihhsvghnthhrrghuthes vghnthgvrhhprhhishgvuggsrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 8 Feb 2022 08:20:01 -0500 (EST) Message-ID: <8ba72a3a-57c2-ac47-9a77-3b720c539adf@enterprisedb.com> Date: Tue, 8 Feb 2022 14:19:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [RFC] building postgres with meson - autogenerated headers Content-Language: en-US To: Andres Freund , pgsql-hackers@postgresql.org, Tom Lane References: <20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de> <20220207192447.vngin653w5eobdqc@alap3.anarazel.de> From: Peter Eisentraut In-Reply-To: <20220207192447.vngin653w5eobdqc@alap3.anarazel.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 07.02.22 20:24, Andres Freund wrote: > To be honest, I do not really understand the logic behind when autoconf ends > up with #defines that define a macro to 0/1 and when a macro ends defined/or > not and when we end up with a macro defined to 1 or not defined at all. The default is to define to 1 or not at all. The reason for this is presumably that originally, autoconf (or its predecessor practices) just populated the command line with a few -DHAVE_THIS options. Creating a header file came later. And -DFOO is equivalent to #define FOO 1. Also, this behavior allows code to use both the #ifdef HAVE_THIS and the #if HAVE_THIS style. The cases that deviate from this have a special reason for this. One issue to consider is that depending on how the configure script is set up or structured, a test might not run at all. But for example, if you have a check for a declaration of a function, and the test doesn't run in a particular configuration, the fallback in your own code would normally be to then manually declare the function yourself. But if you didn't even run the test, then adding a declaration of a function you didn't want in the first place might be bad. In that case, you can check with #ifdef whether the test was run, and then check the value of the macro for the test outcome.