Skip to content

Commit f6748bb

Browse files
authored
Merge pull request #439 from igaw/add-libressl-support
build: Add support to build against LibreSSL
2 parents 920c3fc + 8a7cf44 commit f6748bb

1 file changed

Lines changed: 26 additions & 8 deletions

File tree

meson.build

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,32 @@ openssl_dep = dependency('openssl',
6868
required: get_option('openssl'),
6969
fallback : ['openssl', 'libssl_dep'])
7070
if openssl_dep.found()
71-
conf.set('CONFIG_OPENSSL', true, description: 'Is OpenSSL available?')
72-
conf.set('CONFIG_OPENSSL_1',
73-
openssl_dep.version().version_compare('<2.0.0') and
74-
openssl_dep.version().version_compare('>=1.1.0'),
75-
description: 'OpenSSL version 1.x')
76-
conf.set('CONFIG_OPENSSL_3',
77-
openssl_dep.version().version_compare('>=3.0.0'),
78-
description: 'OpenSSL version 3.x')
71+
conf.set('CONFIG_OPENSSL', true,
72+
description: 'Is OpenSSL/LibreSSL available?')
73+
74+
if openssl_dep.version().version_compare('<2.0.0')
75+
api_version = 1
76+
endif
77+
78+
if openssl_dep.version().version_compare('>=3.0.0')
79+
api_version = 3
80+
81+
# Test for LibreSSL v3.x with incomplete OpenSSL v3 APIs
82+
is_libressl = cc.has_header_symbol('openssl/opensslv.h',
83+
'LIBRESSL_VERSION_NUMBER',
84+
dependencies: openssl_dep,
85+
args: '-nostdinc')
86+
has_header = cc.has_header('openssl/core_names.h',
87+
dependencies: openssl_dep,
88+
args: '-nostdinc')
89+
if is_libressl and not has_header
90+
api_version = 1
91+
endif
92+
93+
endif
94+
95+
conf.set('CONFIG_OPENSSL_@0@'.format(api_version), true,
96+
description: 'OpenSSL/LibreSSL API version @0@'.format(api_version))
7997
endif
8098

8199
# Check for libsystemd availability. Optional, only required for MCTP dbus scan

0 commit comments

Comments
 (0)