2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-22 09:57:41 +00:00

[#3731] Some improvements

This commit is contained in:
Francis Dupont 2025-03-13 00:03:28 +01:00
parent f5cb4eeb2d
commit 4228626061
6 changed files with 137 additions and 54 deletions

View File

@ -34,20 +34,14 @@ C++ Compiler:
LD_ID: @LD_ID@
LD_ARGS: @LD_ARGS@
'
if test '@HAVE_PYTHON@' != 'no'; then
add_to_report '
Python:
PYTHON: @PYTHON_PATH@
PYTHON_VERSION: @PYTHON_VERSION@
PKGPYTHONDIR: @PKGPYTHONDIR@
'
fi
add_to_report '
Boost:
BOOST_VERSION: @BOOST_VERSION@
BOOST_INCLUDE: @BOOST_INCLUDE@
BOOST_LIBDIR: @BOOST_LIBDIR@
@CRYPTO_NAME@:
CRYPTO_VERSION: @CRYPTO_VERSION@
@ -92,10 +86,18 @@ PostgreSQL:
'
fi
if test '@HAVE_NETCONF@' != 'no'; then
add_to_report '
NETCONF:
@HAVE_NETCONF@
Netconf:
LIBYANG_PREFIX: @LIBYANG_PREFIX@
SYSREPO_PREFIX: @SYSREPO_PREFIX@
'
else
add_to_report '
Netconf:
no
'
fi
if test '@HAVE_GTEST@' != 'no'; then
add_to_report '
@ -110,3 +112,26 @@ Google Test:
no
'
fi
if test '@HAVE_KRB5@' != 'no'; then
add_to_report '
Kerberos5 GSS-API support:
KRB5_GSSAPI_VERSION: @KRB5_GSSAPI_VERSION@
KRB5_GSSAPI_CFLAGS: @KRB5_GSSAPI_CFLAGS@
KRB5_GSSAPI_LIBS: @KRB5_GSSAPI_LIBS@
KRB5_GSSAPI_VENDOR: @KRB5_GSSAPI_VENDOR@
'
else
add_to_report '
Kerberos5 GSS-API support:
no
'
fi
add_to_report '
Developer:
Tests: @TESTS_ENABLED@
Valgrind: @VALGRIND@
Fuzzing: @FUZZ_ENABLED@
AFL: @HAVE_AFL@
'

View File

@ -35,7 +35,6 @@ netconf_opt = get_option('netconf')
postgresql_opt = get_option('postgresql')
FUZZ_OPT = get_option('fuzz')
SHELL_OPT = get_option('shell')
TESTS_OPT = get_option('tests')
#### Configuration Data
@ -117,7 +116,7 @@ INSTALL = find_program('install', required: true)
PDFLATEX = find_program('pdflatex', required: false)
PIP_COMPILE = find_program('pip-compile', required: false)
PLANTUML = find_program('plantuml', required: false)
PYTHON = find_program('python3', 'python', required: false)
PYTHON = find_program('python3', 'python', required: true)
SPHINX = find_program('sphinx-build', 'sphinx-build-3', required: false)
XMLLINT = find_program('xmllint', required: false)
@ -211,11 +210,6 @@ GTEST_DEP = dependency(
required: TESTS_OPT.enabled() or FUZZ_OPT.enabled(),
)
# Kea shell
if SHELL_OPT.enabled() and not PYTHON.found()
error('kea-shell requires python. Python not found.')
endif
# Crypto
if crypto_opt == 'botan'
if botan.found()
@ -337,9 +331,13 @@ result = cpp.run(
)
FUZZING_WITH_CLUSTERFUZZLITE = result.returncode() == 0
have_afl = false
if FUZZ_OPT.enabled()
result = cpp.run(fs.read('compiler-checks/have-afl.cc'), name: 'HAVE_AFL')
conf_data.set('HAVE_AFL', result.returncode() == 0)
if result.returncode() == 0
have_afl = true
endif
conf_data.set('HAVE_AFL', have_afl)
endif
if GTEST_DEP.found()
@ -474,22 +472,18 @@ endif
report_conf_data.set('CXX_ARGS', ' '.join(compile_args))
report_conf_data.set('LD_ID', cpp.get_linker_id())
report_conf_data.set('LD_ARGS', ' '.join(link_args))
if PYTHON.found()
report_conf_data.set('HAVE_PYTHON', 'yes')
report_conf_data.set('PYTHON_PATH', PYTHON.full_path())
result = run_command(
PYTHON,
'-c',
'import sysconfig; print(sysconfig.get_paths()[\'purelib\'])',
check: false,
)
if result.returncode() == 0
report_conf_data.set('PKGPYTHONDIR', result.stdout().strip() + '/kea')
else
report_conf_data.set('PKGPYTHONDIR', 'unknown')
endif
report_conf_data.set('PYTHON_PATH', PYTHON.full_path())
report_conf_data.set('PYTHON_VERSION', PYTHON.version())
result = run_command(
PYTHON,
'-c',
'import sysconfig; print(sysconfig.get_paths()[\'purelib\'])',
check: false,
)
if result.returncode() == 0
report_conf_data.set('PKGPYTHONDIR', result.stdout().strip() + '/kea')
else
report_conf_data.set('HAVE_PYTHON', 'no')
report_conf_data.set('PKGPYTHONDIR', 'unknown')
endif
result = cpp.run(
fs.read('compiler-checks/get-boost-version.cc'),
@ -501,14 +495,6 @@ if result.returncode() == 0
else
report_conf_data.set('BOOST_VERSION', 'unknown')
endif
report_conf_data.set(
'BOOST_INCLUDE',
boost_dep.get_variable('includedir', default_value: 'unknown'),
)
report_conf_data.set(
'BOOST_LIBDIR',
boost_dep.get_variable('libdir', default_value: 'unknown'),
)
report_conf_data.set(
'CRYPTO_INCLUDE',
CRYPTO_DEP.get_variable('includedir', default_value: 'unknown'),
@ -611,8 +597,18 @@ else
endif
if NETCONF_DEP.found()
report_conf_data.set('HAVE_NETCONF', 'yes')
report_conf_data.set(
'LIBYANG_PREFIX',
NETCONF_DEP.get_variable('libyang_prefix', default_value: 'unknown'),
)
report_conf_data.set(
'SYSREPO_PREFIX',
NETCONF_DEP.get_variable('sysrepo_prefix', default_value: 'unknown'),
)
else
report_conf_data.set('HAVE_NETCONF', 'no')
report_conf_data.set('LIBYANG_PREFIX', 'unknown')
report_conf_data.set('SYSREPO_PREFIX', 'unknown')
endif
if FUZZ_OPT.enabled() or TESTS_OPT.enabled()
report_conf_data.set('HAVE_GTEST', 'yes')
@ -631,6 +627,48 @@ else
report_conf_data.set('GTEST_INCLUDE', 'unknown')
report_conf_data.set('GTEST_LIBDIR', 'unknown')
endif
if KRB5_DEP.found()
report_conf_data.set('HAVE_KRB5', 'yes')
report_conf_data.set('KRB5_GSSAPI_VERSION', KRB5_DEP.version())
report_conf_data.set(
'KRB5_GSSAPI_CFLAGS',
KRB5_DEP.get_variable('cflags', default_value: 'unknown'),
)
report_conf_data.set(
'KRB5_GSSAPI_LIBS',
KRB5_DEP.get_variable('libs', default_value: 'unknown'),
)
report_conf_data.set(
'KRB5_GSSAPI_VENDOR',
KRB5_DEP.get_variable('vendor', default_value: 'unknown'),
)
else
report_conf_data.set('HAVE_KRB5', 'no')
report_conf_data.set('KRB5_GSSAPI_VERSION', 'unknown')
report_conf_data.set('KRB5_GSSAPI_CFLAGS', 'unknown')
report_conf_data.set('KRB5_GSSAPI_LIBS', 'unknown')
report_conf_data.set('KRB5_GSSAPI_VENDOR', 'unknown')
endif
if TESTS_OPT.enabled()
report_conf_data.set('TESTS_ENABLED', 'enabled')
else
report_conf_data.set('TESTS_ENABLED', 'disabled')
endif
if valgrind.found()
report_conf_data.set('VALGRIND', valgrind.full_path())
else
report_conf_data.set('VALGRIND', 'no')
endif
if FUZZ_OPT.enabled()
report_conf_data.set('FUZZ_ENABLED', 'enabled')
else
report_conf_data.set('FUZZ_ENABLED', 'disabled')
endif
if have_afl
report_conf_data.set('HAVE_AFL', 'yes')
else
report_conf_data.set('HAVE_AFL', 'no')
endif
#### Custom Targets

View File

@ -19,7 +19,16 @@ option(
description: 'Support for PostgreSQL backends.',
)
# Options for enabling various parts of code.
option('fuzz', type: 'feature', description: 'Support for fuzz testing.')
option('shell', type: 'feature', description: 'Builds kea-shell.')
option('tests', type: 'feature', description: 'Support for tests.')
# Options for enabling testing code (not real features).
option(
'fuzz',
type: 'feature',
value: 'disabled',
description: 'Support for fuzz testing.',
)
option(
'tests',
type: 'feature',
value: 'disabled',
description: 'Support for tests.',
)

View File

@ -1,7 +1,3 @@
if not SHELL_OPT.enabled()
subdir_done()
endif
kea_shell_conf_data = configuration_data()
kea_shell_conf_data.set('PYTHON', PYTHON.full_path())
kea_shell_conf_data.set('PACKAGE_VERSION', PROJECT_VERSION)

View File

@ -23,7 +23,11 @@ if krb5_config.found()
compile_args: cflags.stdout().split(),
link_args: libs.stdout().split(),
version: krb5_version,
variables: {'vendor': vendor},
variables: {
'cflags': cflags.stdout().strip(),
'libs': libs.stdout().strip(),
'vendor': vendor,
},
)
endif
endif

View File

@ -54,6 +54,19 @@ foreach dep : ['yang', 'yang-cpp', 'sysrepo', 'sysrepo-cpp']
endforeach
if all_deps_found
variables = {}
if netconf_deps['yang'].found()
libyang_prefix = netconf_deps['yang'].get_variable('prefix')
else
libyang_prefix = 'unknown'
endif
variables += {'libyang_prefix': libyang_prefix}
if netconf_deps['sysrepo'].found()
sysrepo_prefix = netconf_deps['sysrepo'].get_variable('prefix')
else
sysrepo_prefix = 'unknown'
endif
variables += {'sysrepo_prefix': sysrepo_prefix}
netconf = declare_dependency(
dependencies: [
netconf_deps['yang'],
@ -61,12 +74,10 @@ if all_deps_found
netconf_deps['sysrepo'],
netconf_deps['sysrepo-cpp'],
],
variables: {
'libyang_prefix': netconf_deps['yang'].found() ? netconf_deps['yang'].get_variable('prefix') : 'unknown',
'sysrepo_prefix': netconf_deps['sysrepo'].found() ? netconf_deps['sysrepo'].get_variable('prefix') : 'unknown',
},
variables: variables,
)
else
netconf = disabler()
# Can't use a disabler here?
netconf = declare_dependency('', required: false)
endif