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