]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3731] Some improvements
authorFrancis Dupont <fdupont@isc.org>
Fri, 14 Mar 2025 23:30:58 +0000 (00:30 +0100)
committerAndrei Pavel <andrei@isc.org>
Mon, 17 Mar 2025 10:16:26 +0000 (12:16 +0200)
compiler-checks/boost-has-threads.cc [new file with mode: 0644]
meson.build
subprojects/netconf/meson.build

diff --git a/compiler-checks/boost-has-threads.cc b/compiler-checks/boost-has-threads.cc
new file mode 100644 (file)
index 0000000..e0203a9
--- /dev/null
@@ -0,0 +1,8 @@
+#include <boost/config.hpp>
+#ifndef BOOST_HAS_THREADS
+#error "boost will not use threads"
+#endif
+
+int main() {
+    return 0;
+}
index df24e0f41de219a3fac3573806d10cf65ebbe087..0208d9e7322e4eb1e718c94744d6d2ddc111d812 100644 (file)
@@ -136,6 +136,7 @@ add_project_dependencies(boost_dep, dl_dep, threads_dep, language: ['cpp'])
 boost_headers = [
     'boost/asio.hpp',
     'boost/asio/coroutine.hpp',
+    'boost/asio/io_context.hpp',
     'boost/asio/ip/address.hpp',
     'boost/asio/signal_set.hpp',
     'boost/circular_buffer.hpp',
@@ -268,10 +269,19 @@ conf_data.set('HAVE_PGSQL', POSTGRESQL_DEP.found())
 
 #### Compiler Checks
 
+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],
+        dependencies: [boost_dep, threads_dep],
         name: 'GET_SYSTEM_VS_BOOST_REGEX_HEADER',
     )
     if result.returncode() != 0
@@ -427,21 +437,14 @@ else
     add_project_link_arguments(link_arg, language: 'cpp')
 endif
 
-# Use dependencies as meson format -r does not traverse subdir with if_found.
-if fs.is_dir('premium')
-    premium = declare_dependency()
+premium = fs.is_dir('premium')
+if premium
     conf_data.set('PREMIUM', 'yes')
     conf_data.set('PREMIUM_EXTENDED_VERSION', f'"@PROJECT_VERSION@"')
 else
-    premium = disabler()
     conf_data.set('PREMIUM', 'no')
     conf_data.set('PREMIUM_EXTENDED_VERSION', '"no"')
 endif
-if fs.is_dir('contrib')
-    contrib = declare_dependency()
-else
-    contrib = disabler()
-endif
 
 #### Default Includes
 
@@ -464,11 +467,7 @@ report_conf_data.set('PACKAGE_VERSION_TYPE', 'development')
 report_conf_data.set('OS_TYPE', OS_TYPE)
 report_conf_data.set('PREFIX', PREFIX)
 report_conf_data.set('HOOKS_DIR', DEFAULT_HOOKS_PATH)
-if premium.found()
-    report_conf_data.set('PREMIUM', 'yes')
-else
-    report_conf_data.set('PREMIUM', 'no')
-endif
+report_conf_data.set('PREMIUM', premium ? 'yes' : 'no')
 report_conf_data.set('BUILD_OPTIONS', meson.build_options())
 report_conf_data.set('MESON_VERSION', meson.version())
 report_conf_data.set('CXX', ' '.join(cpp.cmd_array()))
@@ -497,7 +496,7 @@ report_conf_data.set('PYTHON_VERSION', PYTHON.version())
 report_conf_data.set('PKGPYTHONDIR', PKGPYTHONDIR)
 result = cpp.run(
     fs.read('compiler-checks/get-boost-version.cc'),
-    dependencies: [boost_dep],
+    dependencies: [boost_dep, threads_dep],
     name: 'Get Boost version',
 )
 if result.returncode() == 0
@@ -800,8 +799,9 @@ subdir('tools')
 subdir('src')
 subdir('fuzz')
 subdir('doc')
-subdir('premium', if_found: premium)
-subproject('contrib', required: false)
+if premium
+    subdir('premium')
+endif
 
 #### More Custom Targets
 
index e81fdd238850318e5013feb8eb252d5d9508bde8..3e1f6c7fced489e4782a6b815b4bcd1489f7f328 100644 (file)
@@ -78,6 +78,6 @@ if all_deps_found
     )
 else
     # Can't use a disabler here?
-    netconf = declare_dependency('')
+    netconf = dependency('')
 endif