#include <type_traits>
int main() {
- static_assert(std::is_same<std::chrono::system_clock::duration,
- std::chrono::steady_clock::duration>::value,
- "");
+ return(std::is_same<std::chrono::system_clock::duration,
+ std::chrono::steady_clock::duration>::value ? 0 : 1);
}
/* Whether you have the <unistd.h> header file. */
#mesondefine HAVE_UNISTD_H
-/* Whether you have the <utils/errcodes.h> header file. */
-#mesondefine HAVE_UTILS_ERRCODES_H
-
/* Check valgrind headers */
#mesondefine HAVE_VALGRIND_HEADERS
TOP_SOURCE_DIR = meson.current_source_dir()
KEA_ADMIN = f'@TOP_BUILD_DIR@/src/bin/admin/kea-admin'
KEA_LFC = f'@TOP_BUILD_DIR@/src/bin/lfc/kea-lfc'
+TEST_CA_DIR = f'@TOP_SOURCE_DIR@/src/lib/asiolink/testutils/ca'
#### Configuration Data
# 'HAVE_SYS_TYPES_H': false,
# 'HAVE_TLS_': false,
# 'HAVE_UNISTD_H': false,
- # 'HAVE_UTILS_ERRCODES_H': false,
# 'HAVE_VALGRIND_HEADERS': false,
# 'HAVE_VALGRIND_VALGRIND_H': false,
# 'HAVE__BOOL': false,
# Cryptography
crypto = disabler()
botan = disabler()
-foreach dep : ['botan-2', 'botan', 'botan-3']
+foreach dep : ['botan-2', 'botan']
botan = dependency(dep, required: false)
if botan.found()
break
endif
endforeach
openssl = dependency('openssl', required: false)
-if botan.found() and false # remove "or flase" when botan+mariadb gets fixes
- crypto = botan
- conf_data.set('WITH_BOTAN', true)
- message('Using Botan.')
-elif openssl.found()
+if openssl.found()
crypto = openssl
conf_data.set('WITH_OPENSSL', true)
message('Using OpenSSL.')
+elif botan.found()
+ crypto = botan
+ conf_data.set('WITH_BOTAN', true)
+ message('Using Botan.')
+ message('Checking Botan Boost support.')
+ cpp.has_header(
+ 'botan/asio_stream.h',
+ dependencies: botan,
+ required: true)
endif
if not crypto.found()
error('Build failed: Could not find neither botan nor openssl libraries.')
cflags = run_command([pg_config, '--cflags'], check: false)
libs = run_command([pg_config, '--libs'], check: false)
if cflags.returncode() == 0 and libs.returncode() == 0
- krb5 = declare_dependency(
+ postgresql = declare_dependency(
compile_args: cflags.stdout().split(),
link_args: libs.stdout().split(),
)
endif
endif
-postgresql_server_header = disabler()
-foreach dir : ['/usr/include/pgsql/server', '/usr/include/postgresql/server']
- if not fs.is_dir(dir)
- continue
- endif
- exists = cpp.has_header(
- 'utils/errcodes.h',
- include_directories: [include_directories(dir)],
- required: false,
- )
- if exists
- postgresql_server_header = declare_dependency(include_directories: dir)
- break
- endif
-endforeach
if postgresql.found()
conf_data.set('HAVE_PGSQL', true)
endif
--- /dev/null
+kea_admin_conf_data = configuration_data()
+kea_admin_conf_data.set('prefix', get_option('prefix'))
+kea_admin_conf_data.set('exec_prefix', '${prefix}')
+kea_admin_conf_data.set('datarootdir', '${prefix}/' + get_option('datadir'))
+kea_admin_conf_data.set('PACKAGE', 'kea')
+kea_admin_conf_data.set('PACKAGE_NAME', 'kea')
+kea_admin_conf_data.set('PACKAGE_VERSION', project_version)
+kea_admin_conf_data.set('EXTENDED_VERSION', project_version + ' (tarball)')
+kea_admin_conf_data.set('abs_top_builddir', TOP_BUILD_DIR)
+kea_admin_conf_data.set('abs_top_srcdir', TOP_SOURCE_DIR)
+kea_admin_conf_data.set('sbindir', '${prefix}/' + get_option('sbindir'))
+kea_admin_conf_data.set('variables', 'variables')
+configure_file(
+ input: 'kea-admin.in',
+ output: 'kea-admin',
+ configuration: kea_admin_conf_data
+)
+configure_file(
+ input: 'admin-utils.sh.in',
+ output: 'admin-utils.sh',
+ copy: true
+)
+# install?
+subdir('lfc')
subdir('dhcp4')
subdir('dhcp6')
-subdir('lfc')
+# subdir('d2')
+# subdir('agent')
+subdir('admin')
+# subdir('keactrl')
subdir('perfdhcp')
+# subdir('shell')
+# subdir('netconf')
install: true,
install_dir: 'lib/kea/hooks',
link_with: LIBS_BUILT_SO_FAR,
+ name_suffix: 'so'
)
-if not postgresql.found() or not postgresql_server_header.found()
+if not postgresql.found()
subdir_done()
endif
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_asiolink_lib] + LIBS_BUILT_SO_FAR
+subdir('testutils')
+subdir('tests')
--- /dev/null
+CURRENT_BUILD_DIR = meson.current_build_dir()
+configure_file(
+ input: 'process_spawn_app.sh.in',
+ output: 'process_spawn_app.sh',
+ copy: true
+)
+kea_asiolink_tests = executable(
+ 'kea-asiolink-tests',
+ 'addr_utilities_unittest.cc',
+ 'dummy_io_callback_unittest.cc',
+ 'hash_address_unittest.cc',
+ 'interval_timer_unittest.cc',
+ 'io_address_unittest.cc',
+ 'io_endpoint_unittest.cc',
+ 'io_service_mgr_unittest.cc',
+ 'io_service_signal_unittests.cc',
+ 'io_service_thread_pool_unittests.cc',
+ 'io_service_unittest.cc',
+ 'io_socket_unittest.cc',
+ 'process_spawn_unittest.cc',
+ 'run_unittests.cc',
+ 'tcp_acceptor_unittest.cc',
+ 'tcp_endpoint_unittest.cc',
+ 'tcp_socket_unittest.cc',
+ 'tls_acceptor_unittest.cc',
+ 'tls_socket_unittest.cc',
+ 'tls_unittest.cc',
+ 'udp_endpoint_unittest.cc',
+ 'udp_socket_unittest.cc',
+ 'unix_domain_socket_unittest.cc',
+ cpp_args: [f'-DTEST_SCRIPT_SH="@CURRENT_BUILD_DIR@/process_spawn_app.sh"',
+ f'-DINVALID_TEST_SCRIPT_SH="@TOP_SOURCE_DIR@/README"',
+ f'-DTEST_CA_DIR="@TEST_CA_DIR@"'],
+ dependencies: [gtest, crypto],
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: LIBS_BUILT_SO_FAR + [kea_asiolink_testutils_lib, kea_util_unittests_lib]
+)
+test('kea_asiolink_tests', kea_asiolink_tests, protocol: 'gtest')
--- /dev/null
+kea_asiolink_testutils_lib = static_library(
+ 'kea-asiolink-testutils',
+ 'test_tls.cc',
+ 'test_server_unix_socket.cc',
+ 'timed_signal.cc',
+ cpp_args: [f'-DTEST_CA_DIR="@TEST_CA_DIR@"'],
+ dependencies: [gtest, crypto],
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: LIBS_BUILT_SO_FAR
+)
+kea_cc_lib_cpp_args = []
+if gtest.found()
+ kea_cc_lib_cpp_args = ['-DALLOW_KEATEST']
+endif
kea_cc_lib = library(
'kea-cc',
'base_stamped_element.cc',
'stamped_value.h',
'user_context.cc',
'user_context.h',
+ cpp_args: kea_cc_lib_cpp_args,
include_directories: [include_directories('.')] + INCLUDES,
install: true,
install_dir: 'lib',
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_database_lib] + LIBS_BUILT_SO_FAR
+subdir('testutils')
subdir('tests')
--- /dev/null
+kea_database_testutils_lib = static_library(
+ 'kea-database-testutils',
+ 'schema.cc',
+ cpp_args: [f'-DTEST_CA_DIR="@TEST_CA_DIR@"'],
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: LIBS_BUILT_SO_FAR
+)
'ncr_unittests.cc',
'run_unittests.cc',
'test_utils.cc',
- 'test_utils.h',
dependencies: [gtest],
include_directories: [include_directories('.')] + INCLUDES,
link_with: LIBS_BUILT_SO_FAR + [kea_testutils_lib, kea_util_unittests_lib],
'tsigrecord_unittest.cc',
'tsig_unittest.cc',
'unittest_util.cc',
- 'unittest_util.h',
cpp_args: [
f'-DTEST_DATA_BUILDDIR="@TOP_BUILD_DIR@/src/lib/dns/tests/testdata"',
f'-DTEST_DATA_SRCDIR="@TOP_SOURCE_DIR@/src/lib/dns/tests/testdata"',
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_log_interprocess_lib] + LIBS_BUILT_SO_FAR
+subdir('tests')
--- /dev/null
+kea_log_interprocess_tests = executable(
+ 'kea-log-interprocess-tests',
+ 'interprocess_sync_file_unittest.cc',
+ 'interprocess_sync_null_unittest.cc',
+ 'run_unittests.cc',
+ cpp_args: [f'-DTEST_DATA_TOPBUILDDIR="@TOP_BUILD_DIR@"'],
+ dependencies: [gtest],
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: LIBS_BUILT_SO_FAR + [kea_util_unittests_lib],
+)
+test('kea_log_interprocess_tests', kea_log_interprocess_tests, protocol: 'gtest')
link_with: LIBS_BUILT_SO_FAR,
)
LIBS_BUILT_SO_FAR = [kea_mysql_lib] + LIBS_BUILT_SO_FAR
+subdir('testutils')
+subdir('tests')
--- /dev/null
+LIBS_TESTUTILS = [
+ kea_mysql_testutils_lib,
+ kea_database_testutils_lib,
+ kea_testutils_lib
+]
+kea_mysql_tests = executable(
+ 'kea-mysql-tests',
+ 'mysql_binding_unittest.cc',
+ 'mysql_connection_unittest.cc',
+ 'run_unittests.cc',
+ cpp_args: [f'-DTEST_CA_DIR="@TEST_CA_DIR@"',
+ f'-DKEA_ADMIN="@KEA_ADMIN@"'],
+ dependencies: [gtest, mysql],
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: LIBS_BUILT_SO_FAR + LIBS_TESTUTILS + [kea_util_unittests_lib],
+)
+test('kea_mysql_tests', kea_mysql_tests, protocol: 'gtest')
--- /dev/null
+DATABASE_SCRIPTS_DIR = f'@TOP_BUILD_DIR@/src/share/database/scripts'
+kea_mysql_testutils_lib = static_library(
+ 'kea-mysql-testutils',
+ 'mysql_schema.cc',
+ cpp_args: [f'-DDATABASE_SCRIPTS_DIR="@DATABASE_SCRIPTS_DIR@"',
+ f'-DDATABASE_WIPE_DIR="@DATABASE_SCRIPTS_DIR@"'],
+ dependencies: [mysql],
+ include_directories: [include_directories('.')] + INCLUDES,
+ link_with: LIBS_BUILT_SO_FAR + [kea_database_testutils_lib]
+)
-if not postgresql.found() or not postgresql_server_header.found()
+if not postgresql.found()
subdir_done()
endif
'pgsql_exchange.cc',
'pgsql_exchange.h',
cpp_args: [f'-DKEA_ADMIN="@KEA_ADMIN@"'],
- dependencies: [postgresql, postgresql_server_header],
+ dependencies: [postgresql],
include_directories: [include_directories('.')] + INCLUDES,
install: true,
install_dir: 'lib',
-kea_testutils_lib = library(
+kea_testutils_lib = static_library(
'kea-testutils',
- 'gtest_utils.h',
'io_utils.cc',
- 'io_utils.h',
'log_utils.cc',
- 'log_utils.h',
- 'multi_threading_utils.h',
- 'sandbox.h',
'test_to_element.cc',
- 'test_to_element.h',
'threaded_test.cc',
- 'threaded_test.h',
'unix_control_client.cc',
- 'unix_control_client.h',
'user_context_utils.cc',
- 'user_context_utils.h',
dependencies: [gtest],
include_directories: [include_directories('.')] + INCLUDES,
- install: true,
- install_dir: 'lib',
- link_with: LIBS_BUILT_SO_FAR,
+ link_with: LIBS_BUILT_SO_FAR + [kea_util_unittests_lib]
)
kea_util_lib = library(
'kea-util',
- 'bigints.h',
'boost_time_utils.cc',
+ 'chrono_time_utils.cc',
+ 'csv_file.cc',
+ 'dhcp_space.cc',
+ 'encode/encode.cc',
+ 'encode/utf8.cc',
+ 'filesystem.cc',
+ 'labeled_value.cc',
+ 'memory_segment_local.cc',
+ 'multi_threading_mgr.cc',
+ 'pid_file.cc',
+ 'reconnect_ctl.cc',
+ 'state_model.cc',
+ 'stopwatch.cc',
+ 'stopwatch_impl.cc',
+ 'str.cc',
+ 'versioned_csv_file.cc',
+ 'watched_thread.cc',
+ 'watch_socket.cc',
+ include_directories: [include_directories('.')] + INCLUDES,
+ install: true,
+ install_dir: 'lib',
+ link_with: LIBS_BUILT_SO_FAR,
+)
+kea_util_headers = [
+ 'bigints.h',
'boost_time_utils.h',
'buffer.h',
- 'chrono_time_utils.cc',
'chrono_time_utils.h',
- 'csv_file.cc',
'csv_file.h',
- 'dhcp_space.cc',
'dhcp_space.h',
'doubles.h',
- 'encode/encode.cc',
'encode/encode.h',
- 'encode/utf8.cc',
'encode/utf8.h',
- 'filesystem.cc',
'filesystem.h',
'hash.h',
'io.h',
- 'labeled_value.cc',
'labeled_value.h',
'memory_segment.h',
- 'memory_segment_local.cc',
'memory_segment_local.h',
- 'multi_threading_mgr.cc',
'multi_threading_mgr.h',
'optional.h',
- 'pid_file.cc',
'pid_file.h',
'pointer_util.h',
'range_utilities.h',
'readwrite_mutex.h',
- 'reconnect_ctl.cc',
'reconnect_ctl.h',
'staged_value.h',
- 'state_model.cc',
'state_model.h',
- 'stopwatch.cc',
'stopwatch.h',
- 'stopwatch_impl.cc',
'stopwatch_impl.h',
- 'str.cc',
'str.h',
'thread_pool.h',
'triplet.h',
'unlock_guard.h',
- 'versioned_csv_file.cc',
'versioned_csv_file.h',
- 'watched_thread.cc',
'watched_thread.h',
- 'watch_socket.cc',
- 'watch_socket.h',
- include_directories: [include_directories('.')] + INCLUDES,
- install: true,
- install_dir: 'lib',
- link_with: LIBS_BUILT_SO_FAR,
-)
+ 'watch_socket.h'
+]
+install_headers(kea_util_headers, preserve_path: true, subdir: 'kea/util')
subdir('io')
subdir('unittests')
LIBS_BUILT_SO_FAR = [kea_util_lib] + LIBS_BUILT_SO_FAR
-kea_util_unittests_lib = library(
+kea_util_unittests_lib = static_library(
'kea-util-unittests',
'check_valgrind.cc',
'check_valgrind.h',
--- /dev/null
+subdir('mysql')
+# subdir('pgsql')
--- /dev/null
+mysql_script_conf_data = configuration_data()
+mysql_script_conf_data.set('prefix', get_option('prefix'))
+mysql_script_conf_data.set('abs_top_builddir', TOP_BUILD_DIR)
+mysql_script_conf_data.set('datarootdir', '${prefix}/' + get_option('datadir'))
+mysql_script_conf_data.set('PACKAGE_NAME', 'kea')
+configure_file(
+ input: 'wipe_data.sh.in',
+ output: 'wipe_data.sh',
+ configuration: mysql_script_conf_data
+)
+configure_file(
+ input: 'dhcpdb_create.mysql',
+ output: 'dhcpdb_create.mysql',
+ copy: true
+)
+configure_file(
+ input: 'dhcpdb_drop.mysql',
+ output: 'dhcpdb_drop.mysql',
+ copy: true
+)
+# configure upgrade scripts
+# install