Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7274009

Browse files
committed
meson: fix openssl detection issues in 6a30027
When not detecting openssl via pkg-config, we'd error out if the headers weren't found, even if -Dssl=auto. When detecting via pkg-config, but the headers could not be found, we'd error out because the ssl_int variable would not exist. Reported-by: Nathan Bossart <nathandbossart@gmail.com> Discussion: https://postgr.es/m/20230313180432.GA246741@nathanxps13
1 parent 25a7812 commit 7274009

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

meson.build

+12-6
Original file line numberDiff line numberDiff line change
@@ -1189,23 +1189,29 @@ if sslopt in ['auto', 'openssl']
11891189

11901190
# via pkg-config et al
11911191
ssl = dependency('openssl', required: false)
1192+
# only meson >= 0.57 supports declare_dependency() in cc.has_function(), so
1193+
# we pass cc.find_library() results if necessary
1194+
ssl_int = []
11921195

11931196
# via library + headers
11941197
if not ssl.found()
11951198
ssl_lib = cc.find_library('ssl',
11961199
dirs: test_lib_d,
11971200
header_include_directories: postgres_inc,
1198-
has_headers: ['openssl/ssl.h', 'openssl/err.h'])
1201+
has_headers: ['openssl/ssl.h', 'openssl/err.h'],
1202+
required: openssl_required)
11991203
crypto_lib = cc.find_library('crypto',
12001204
dirs: test_lib_d,
1201-
header_include_directories: postgres_inc)
1202-
ssl_int = [ssl_lib, crypto_lib]
1203-
1204-
ssl = declare_dependency(dependencies: ssl_int,
1205-
include_directories: postgres_inc)
1205+
required: openssl_required)
1206+
if ssl_lib.found() and crypto_lib.found()
1207+
ssl_int = [ssl_lib, crypto_lib]
1208+
ssl = declare_dependency(dependencies: ssl_int, include_directories: postgres_inc)
1209+
endif
12061210
elif cc.has_header('openssl/ssl.h', args: test_c_args, dependencies: ssl, required: openssl_required) and \
12071211
cc.has_header('openssl/err.h', args: test_c_args, dependencies: ssl, required: openssl_required)
12081212
ssl_int = [ssl]
1213+
else
1214+
ssl = not_found_dep
12091215
endif
12101216

12111217
if ssl.found()

0 commit comments

Comments
 (0)