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 1nH9d8-0002G5-CR for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Feb 2022 19:24:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nH9d7-0003xB-3b for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Feb 2022 19:24:53 +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 1nH9d6-0003x1-Qf for pgsql-hackers@lists.postgresql.org; Mon, 07 Feb 2022 19:24:52 +0000 Received: from out2-smtp.messagingengine.com ([66.111.4.26]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nH9d4-0008TL-Mh for pgsql-hackers@postgresql.org; Mon, 07 Feb 2022 19:24:52 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 253C25C019A; Mon, 7 Feb 2022 14:24:49 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 07 Feb 2022 14:24:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; bh=7E1SkTiPM+eNoikftQJzBS/cz0Dv5j1GxGQ7+W ZueM4=; b=jxeNTejqH/1v+/MBfeWsVZcPU6ZGqNNtNOc8pm/HtoJZ+HkI3tOTVT 19VFjTH9krgcnWSrHdYBJdL1SK5O75LlbxvWtRd5zGE4bOPayjplYBwY3elA2At1 O89H2TbeEu3W98Wuy3bk/BhWU2mZTAKRX204rh1WIkE/fOvTyjpgaSmqehdeUwhH dEfLCBdaX0Xg9ILRK/iXxR3QBXhiuPQJhbK9jwv2i8L7mYsso6NGLTr8EyKfDqbu JpPIlVKPQCfinifnSKS5UnWNsb10Kh+UuMiZTh83P4OVK4YsApeWBEvCIX1pY+eb HI9gSmBVOtzrmoLAov+HCZGM1sRdNBMg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc: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=7E1SkTiPM+eNoikft QJzBS/cz0Dv5j1GxGQ7+WZueM4=; b=VU0ViqzbkkIcuQuliypSEYC07yRZ3bl4v aIlHpBBffDkHhahZpFOW+G7KwFXj4fiUBdlHHieZRtKYvJS2iYBiOTgU9sMJFYhz btk9b1FkqlyLjG1uK2Gp20MJbL2XJe1mGFzH/3z1yWOhJ+jq8OmaQUVBGda3Gdv2 3wJ0KlhGreNlDVls4P7eSxJ+FIBdaswOA6/T7qQLZPDDIOzUpM/+GXMZpBeKSmu6 bU+rzgloMr6ebVB7t0B3fwmmNlS9QEMOVPUf3Cplum3aIGFHP287/DC03qj7ryP+ rFb5l8kefvN1UPBkOQjITWZmWGsbIQkth/dA0weYyOFnbOAI8mLOA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrheehgdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujgesthdtre dttddtvdenucfhrhhomheptehnughrvghsucfhrhgvuhhnugcuoegrnhgurhgvshesrghn rghrrgiivghlrdguvgeqnecuggftrfgrthhtvghrnhepudekhfekleeugeevteehleffff ejgeelueduleeffeeutdelffeujeffhfeuffdunecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Feb 2022 14:24:48 -0500 (EST) Date: Mon, 7 Feb 2022 11:24:47 -0800 From: Andres Freund To: pgsql-hackers@postgresql.org, Tom Lane Subject: Re: [RFC] building postgres with meson - autogenerated headers Message-ID: <20220207192447.vngin653w5eobdqc@alap3.anarazel.de> References: <20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211012083721.hvixq4pnh2pixr3j@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, I've been wondering whether we should try to have the generated pg_config.h look as similar as possible to autoconf/autoheader's, or not. And whether the way autoconf/autoheader define symbols makes sense when not using either anymore. 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. So far I've tried to mirror the logic, but not the description / comment formatting of the individual macros. The "defined to 1 or not defined at all" behaviour is a mildly awkward to achieve with meson, because it doesn't match the behaviour for booleans options meson has (there are two builtin behaviours, one to define/undefine a macro, the other to set the macro to 0/1. But there's none that defines a macro to 1 or undefines it). Probably best to initially have the macros defined as similar as reasonably possible, but subsequently clean things up a bit. A second aspect that I'm wondering about is whether we should try to split pg_config.h output a bit: With meson it's easy to change options like whether to build with some dependency in an existing build tree and then still get a reliable build result (ninja rebuilds if the commandline changed from the last invocation). But right now doing so often ends up with way bigger rebuilds than necessary, because for a lot of options we add #define USE_LDAP 1 etc to pg_config.h, which of course requires rebuilding a lot of files. Even though most of these symbols are only checked in a handful of files, often only .c files. It seems like it might make sense to separate out defines that depend on the compiler / "standard libraries" (e.g. {SIZEOF,ALIGNOF}_*, HAVE_DECL_{STRNLEN,...}, HAVE_*_H) from feature defines (like USE_{LDAP,ICU,...}). The header containing the latter could then included in the places needing it (or we could have one header for each of the places using it). Perhaps we should also separate out configure-time settings like BLCKSZ, DEF_PGPORT, etc. Realistically most of them are going to require a "full tree" recompile anway, but it seems like it might make things easier to understand. I think a split into pg_config_{platform,features,settings}.h could make sense. Similar to above, it's probably best to do this separately after merging meson support. But knowing what the split should eventually look like would be helpful before, to ensure it's easy to do. Greetings, Andres Freund