1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
--- a/meson.build
+++ b/meson.build
@@ -300,7 +300,6 @@ endif
# Google Test
GTEST_DEP = dependency(
'gtest',
- fallback: ['gtest', 'gtest_dep'],
required: FUZZ_OPT.enabled() or TESTS_OPT.enabled(),
)
@@ -363,167 +362,80 @@ conf_data.set('HAVE_PGSQL', POSTGRESQL_D
#### Compiler Checks
-# The required keyword in cpp.run() is an 1.5.0 feature.
-result = cpp.run(
- fs.read('compiler-checks/get-cpp-standard.cc'),
- name: 'Get cpp standard',
-)
-if result.returncode() == 0
- cpp_standard = result.stdout().strip()
-else
- error('C++ standard is unknown')
-endif
-message(f'Detected C++ standard (__cplusplus value) is @cpp_standard@.')
-cpp_std_opt = get_option('cpp_std')
-no_cpp_std_opt_msg = 'Please set a C++ standard by passing the -D cpp_std argument to meson.'
-cpp_std_opt_msg = f'-D cpp_std=@cpp_std_opt@ is not enough.'
-if cpp_standard.version_compare('<201100')
- msgs = [
- 'Kea requires at least C++11 to build.',
- 'Recommended C++ standard is C++14 but some dependencies require at least C++20',
- ]
- if cpp_std_opt == 'none'
- msgs += no_cpp_std_opt_msg
- else
- msgs += cpp_std_opt_msg
- endif
- error('\n'.join(msgs))
-endif
-if cpp_standard.version_compare('<201400')
- result = cpp.run(
- fs.read('compiler-checks/boost-math-cpp14.cc'),
- name: 'BOOST_MATH_REQUIRES_CPP14',
- dependencies: [boost_dep, threads_dep],
- )
- if result.returncode() != 0
- msgs = ['Boost Math requires at least C++14.']
- if cpp_std_opt == 'none'
- msgs += no_cpp_std_opt_msg
- else
- msgs += cpp_std_opt_msg
- endif
- error('\n'.join(msgs))
- endif
-endif
-if NETCONF_DEP.found() and cpp_standard.version_compare('<202000')
- msgs = ['NETCONF dependency requires at least C++20.']
- if cpp_std_opt == 'none'
- msgs += no_cpp_std_opt_msg
- else
- msgs += cpp_std_opt_msg
- endif
- if netconf_opt.enabled()
- error('\n'.join(msgs))
- else
- msgs += 'Disabling NETCONF.'
- warning('\n'.join(msgs))
- NETCONF_DEP = disabler()
- endif
-endif
-if CRYPTO_DEP.name() == botan.name() and cpp_standard.version_compare('<202000')
- msgs = ['Botan dependency requires at least C++20.']
- if cpp_std_opt == 'none'
- msgs += no_cpp_std_opt_msg
- else
- msgs += cpp_std_opt_msg
- endif
- error('\n'.join(msgs))
-endif
-
-result = cpp.run(
- fs.read('compiler-checks/boost-has-threads.cc'),
- dependencies: [boost_dep, threads_dep],
- name: 'BOOST_HAS_THREADS',
-)
-if result.returncode() != 0
- error('boost is not configured to use threads')
-endif
-
-if cpp.has_header('boost/regex.h', dependencies: [boost_dep], required: false)
- result = cpp.run(
- fs.read('compiler-checks/boost-regex.cc'),
- dependencies: [boost_dep, threads_dep],
- name: 'GET_SYSTEM_VS_BOOST_REGEX_HEADER',
- )
- if result.returncode() != 0
- error('boost/regex.h is used in place of system regex.h')
- endif
-endif
-
-result = cpp.run(
+result = cpp.compiles(
fs.read('compiler-checks/chrono-same-duration.cc'),
name: 'CHRONO_SAME_DURATION',
)
-conf_data.set('CHRONO_SAME_DURATION', result.returncode() == 0)
+conf_data.set('CHRONO_SAME_DURATION', result)
if CRYPTO_DEP.name() == openssl.name()
- result1 = cpp.run(
+ result1 = cpp.compiles(
fs.read('compiler-checks/have-generic-tls-method.cc'),
name: 'HAVE_GENERIC_TLS_METHOD',
dependencies: [boost_dep, CRYPTO_DEP, threads_dep],
)
- result2 = cpp.run(
+ result2 = cpp.compiles(
fs.read('compiler-checks/stream-truncated-error.cc'),
name: 'HAVE_STREAM_TRUNCATED_ERROR',
dependencies: [boost_dep, CRYPTO_DEP, threads_dep],
)
- if result1.returncode() != 0 or result2.returncode() != 0
+ if not result1 or not result2
error('Boost TLS support broken.')
endif
endif
if CRYPTO_DEP.name() == botan.name()
- result = cpp.run(
+ result = cpp.compiles(
fs.read('compiler-checks/botan-hash.cc'),
name: 'CHECK_BOTAN_LIBRARY',
dependencies: [boost_dep, CRYPTO_DEP, threads_dep],
)
- if result.returncode() != 0
+ if not result
error('Botan library does not work.')
endif
endif
-result = cpp.run(
+result = cpp.compiles(
fs.read('compiler-checks/have-optreset.cc'),
name: 'HAVE_OPTRESET',
)
-conf_data.set('HAVE_OPTRESET', result.returncode() == 0)
+conf_data.set('HAVE_OPTRESET', result)
-result = cpp.run(fs.read('compiler-checks/have-sa-len.cc'), name: 'HAVE_SA_LEN')
-conf_data.set('HAVE_SA_LEN', result.returncode() == 0)
+result = cpp.compiles(fs.read('compiler-checks/have-sa-len.cc'), name: 'HAVE_SA_LEN')
+conf_data.set('HAVE_SA_LEN', result)
-result = cpp.run(
+result = cpp.compiles(
fs.read('compiler-checks/log4cplus-initializer.cc'),
name: 'LOG4CPLUS_INITIALIZER_H',
dependencies: [LOG4CPLUS_DEP],
)
-conf_data.set('LOG4CPLUS_INITIALIZER_H', result.returncode() == 0)
+conf_data.set('LOG4CPLUS_INITIALIZER_H', result)
if MYSQL_DEP.found()
- result = cpp.run(
+ result = cpp.compiles(
fs.read('compiler-checks/mysql-my-bool.cc'),
name: 'MYSQL_MY_BOOL',
dependencies: [MYSQL_DEP],
)
- conf_data.set('HAVE_MYSQL_MY_BOOL', result.returncode() == 0)
+ conf_data.set('HAVE_MYSQL_MY_BOOL', result)
- result = cpp.run(
+ result = cpp.compiles(
fs.read('compiler-checks/mysql-get-option.cc'),
name: 'HAVE_MYSQL_GET_OPTION',
dependencies: [MYSQL_DEP],
)
- conf_data.set('HAVE_MYSQL_GET_OPTION', result.returncode() == 0)
+ conf_data.set('HAVE_MYSQL_GET_OPTION', result)
endif
-result = cpp.run(
+result = cpp.compiles(
fs.read('compiler-checks/fuzzing-with-clusterfuzzlite.cc'),
name: 'FUZZING_WITH_CLUSTERFUZZLITE',
)
-FUZZING_WITH_CLUSTERFUZZLITE = result.returncode() == 0
+FUZZING_WITH_CLUSTERFUZZLITE = result
have_afl = false
-result = cpp.run(fs.read('compiler-checks/have-afl.cc'), name: 'HAVE_AFL')
-if result.returncode() == 0
+result = cpp.compiles(fs.read('compiler-checks/have-afl.cc'), name: 'HAVE_AFL')
+if result
have_afl = true
endif
conf_data.set('HAVE_AFL', have_afl)
@@ -534,22 +446,22 @@ if GTEST_DEP.found()
if GTEST_DEP.type_name() == 'internal'
conf_data.set('HAVE_CREATE_UNIFIED_DIFF', true)
else
- result = cpp.run(
+ result = cpp.compiles(
fs.read('compiler-checks/have-create-unified-diff.cc'),
name: 'HAVE_CREATE_UNIFIED_DIFF',
dependencies: [GTEST_DEP],
)
- conf_data.set('HAVE_CREATE_UNIFIED_DIFF', result.returncode() == 0)
+ conf_data.set('HAVE_CREATE_UNIFIED_DIFF', result)
endif
endif
if KRB5_DEP.found()
- result = cpp.run(
+ result = cpp.compiles(
fs.read('compiler-checks/have-gss-str-to-oid.cc'),
name: 'HAVE_GSS_STR_TO_OID',
dependencies: [KRB5_DEP],
)
- conf_data.set('HAVE_GSS_STR_TO_OID', result.returncode() == 0)
+ conf_data.set('HAVE_GSS_STR_TO_OID', result)
endif
#### Other checks.
@@ -753,7 +665,7 @@ if result.returncode() == 0
else
report_conf_data.set('CXX_VERSION', 'unknown')
endif
-report_conf_data.set('CXX_STANDARD', cpp_standard)
+report_conf_data.set('CXX_STANDARD', '20')
compile_args += cpp_args_opt
report_conf_data.set('CXX_ARGS', ' '.join(compile_args))
report_conf_data.set('LD_ID', cpp.get_linker_id())
@@ -762,29 +674,25 @@ report_conf_data.set('LD_ARGS', ' '.join
report_conf_data.set('PYTHON_PATH', PYTHON.full_path())
report_conf_data.set('PYTHON_VERSION', PYTHON.version())
report_conf_data.set('PKGPYTHONDIR', PKGPYTHONDIR)
-result = cpp.run(
+result = cpp.compiles(
fs.read('compiler-checks/get-boost-version.cc'),
dependencies: [boost_dep, threads_dep],
name: 'Get Boost version',
)
-if result.returncode() == 0
- report_conf_data.set('BOOST_VERSION', result.stdout().strip())
+if result
+ report_conf_data.set('BOOST_VERSION', boost_dep.version())
else
report_conf_data.set('BOOST_VERSION', 'unknown version')
endif
if CRYPTO_DEP.name() == botan.name()
report_conf_data.set('CRYPTO_NAME', 'Botan')
report_conf_data.set('SPACES', ' ')
- result = cpp.run(
+ result = cpp.compiles(
fs.read('compiler-checks/get-botan-version.cc'),
name: 'Get Botan version',
dependencies: [CRYPTO_DEP],
)
- if result.returncode() == 0
- version = result.stdout().strip()
- else
- version = botan.version()
- endif
+ version = botan.version()
if version == 'unknown'
version = 'unknown version'
endif
@@ -792,31 +700,23 @@ if CRYPTO_DEP.name() == botan.name()
elif CRYPTO_DEP.name() == openssl.name()
report_conf_data.set('CRYPTO_NAME', 'OpenSSL')
report_conf_data.set('SPACES', ' ')
- result = cpp.run(
+ result = cpp.compiles(
fs.read('compiler-checks/get-openssl-version.cc'),
name: 'Get OpenSSL version',
dependencies: [CRYPTO_DEP],
)
- if result.returncode() == 0
- version = result.stdout().strip()
- else
- version = openssl.version()
- endif
+ version = openssl.version()
if version == 'unknown'
version = 'unknown version'
endif
report_conf_data.set('CRYPTO_VERSION', version)
endif
-result = cpp.run(
+result = cpp.compiles(
fs.read('compiler-checks/get-log4cplus-version.cc'),
name: 'Get Log4cplus version',
dependencies: [LOG4CPLUS_DEP],
)
-if result.returncode() == 0
- version = result.stdout().strip()
-else
- version = log4cplus.version()
-endif
+version = LOG4CPLUS_DEP.version()
if version == 'unknown'
version = 'unknown version'
endif
@@ -1091,13 +991,6 @@ pkg.generate(
#### More Custom Targets
-if TARGETS_GEN_MESSAGES.length() > 0
- alias_target('messages', TARGETS_GEN_MESSAGES)
-else
- error(
- 'No messages to generate. This is probably an error in the meson.build files.',
- )
-endif
if TARGETS_GEN_PARSER.length() > 0
alias_target('parser', TARGETS_GEN_PARSER)
else
|