Re: meson: Non-feature feature options

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: meson: Non-feature feature options
Date: 2023-03-13 20:25:44
Message-ID: 20230313202544.GA373446@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Mar 13, 2023 at 01:13:31PM -0700, Andres Freund wrote:
> On 2023-03-13 11:04:32 -0700, Nathan Bossart wrote:
>> I noticed that after 6a30027, if you don't have the OpenSSL headers
>> installed, 'meson setup' will fail:
>>
>> meson.build:1195:4: ERROR: C header 'openssl/ssl.h' not found
>>
>> Shouldn't "auto" cause Postgres to be built without OpenSSL if the required
>> headers are not present?
>
> Yea. I found another thing: When dependency() found something, but the headers
> weren't present, ssl_int wouldn't exist.
>
> Maybe something like the attached?

> ssl_lib = cc.find_library('ssl',
> dirs: test_lib_d,
> header_include_directories: postgres_inc,
> - has_headers: ['openssl/ssl.h', 'openssl/err.h'])
> + has_headers: ['openssl/ssl.h', 'openssl/err.h'],
> + required: openssl_required)
> crypto_lib = cc.find_library('crypto',
> dirs: test_lib_d,
> - header_include_directories: postgres_inc)
> - ssl_int = [ssl_lib, crypto_lib]
> -
> - ssl = declare_dependency(dependencies: ssl_int,
> - include_directories: postgres_inc)
> + required: openssl_required)
> + if ssl_lib.found() and crypto_lib.found()
> + ssl_int = [ssl_lib, crypto_lib]
> + ssl = declare_dependency(dependencies: ssl_int, include_directories: postgres_inc)
> + endif

I was just about to post a patch to set "required" like you have for
ssl_lib and crypto_lib. It seemed to work alright without the 'if
ssl_lib.found() and crypto_lib.found()' line, but I haven't worked with
these meson files very much, so what you have is probably better form.

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Cramer 2023-03-13 20:33:05 Re: Request for comment on setting binary format output per session
Previous Message Peter Eisentraut 2023-03-13 20:22:29 Re: Transparent column encryption