build: fix OpenSSL version detection

Fix OpenSSL version detection in `configure.py` when `pkg-config` is
used to configure building with a shared OpenSSL library.

PR-URL: https://github.com/nodejs/node/pull/59353
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Richard Lau 2025-08-06 20:47:18 +01:00 committed by GitHub
parent 31aacfa67c
commit 2b4a09ef8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1205,7 +1205,7 @@ def get_gas_version(cc):
warn(f'Could not recognize `gas`: {gas_ret}')
return '0.0'
def get_openssl_version():
def get_openssl_version(o):
"""Parse OpenSSL version from opensslv.h header file.
Returns the version as a number matching OPENSSL_VERSION_NUMBER format:
@ -1219,6 +1219,9 @@ def get_openssl_version():
args = ['-I', 'deps/openssl/openssl/include'] + args
elif options.shared_openssl_includes:
args = ['-I', options.shared_openssl_includes] + args
else:
for dir in o['include_dirs']:
args = ['-I', dir] + args
proc = subprocess.Popen(
shlex.split(CC) + args,
@ -1887,10 +1890,10 @@ def configure_openssl(o):
if options.quic:
o['defines'] += ['NODE_OPENSSL_HAS_QUIC']
o['variables']['openssl_version'] = get_openssl_version()
configure_library('openssl', o)
o['variables']['openssl_version'] = get_openssl_version(o)
def configure_sqlite(o):
o['variables']['node_use_sqlite'] = b(not options.without_sqlite)
if options.without_sqlite: