mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-08 10:40:30 +01:00
build: autodetect ebpf support
This commit is contained in:
parent
c7c3acf280
commit
81a565ebe5
5 changed files with 27 additions and 11 deletions
|
|
@ -48,7 +48,7 @@ addons:
|
|||
coverity_scan:
|
||||
project:
|
||||
name: NetworkManager/NetworkManager
|
||||
build_command_prepend: sh autogen.sh --with-systemd-logind=no --enable-more-warnings=no --disable-ovs --without-ebpf
|
||||
build_command_prepend: sh autogen.sh --with-systemd-logind=no --enable-more-warnings=no --disable-ovs
|
||||
build_command: make -j4
|
||||
branch_pattern: .*coverity.*
|
||||
|
||||
|
|
@ -114,7 +114,6 @@ script:
|
|||
-D ifcfg_rh=false \
|
||||
-D ibft=true \
|
||||
-D ifupdown=true \
|
||||
-D ebpf=false \
|
||||
&&
|
||||
ninja -C build &&
|
||||
ninja -C build test
|
||||
|
|
@ -137,7 +136,6 @@ script:
|
|||
--enable-more-warnings=no \
|
||||
--enable-tests=yes \
|
||||
--with-crypto=$CRYPTO \
|
||||
--without-ebpf \
|
||||
\
|
||||
--with-libnm-glib=yes \
|
||||
--with-iwd=yes \
|
||||
|
|
|
|||
17
configure.ac
17
configure.ac
|
|
@ -520,12 +520,17 @@ esac
|
|||
|
||||
# eBPF support
|
||||
AC_ARG_WITH(ebpf,
|
||||
AS_HELP_STRING([--with-ebpf=yes|no], [Build with eBPF support (default: yes)]),
|
||||
[], [with_ebpf=yes])
|
||||
if test "$with_ebpf" != "yes" -a "$with_ebpf" != "no"; then
|
||||
AC_MSG_ERROR(--with-ebpf must be one of [yes, no])
|
||||
AS_HELP_STRING([--with-ebpf=yes|no|auto], [Build with eBPF support (default: auto)]),
|
||||
[], [with_ebpf=auto])
|
||||
if test "$with_ebpf" = "yes" -o "$with_ebpf" = "auto"; then
|
||||
AC_CHECK_HEADER(linux/bpf.h, [have_ebpf=yes], [have_ebpf=no])
|
||||
else
|
||||
have_ebpf=no
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_EBPF, test "${with_ebpf}" = "yes")
|
||||
if test "$with_ebpf" = "yes" -a "$have_ebpf" = "no"; then
|
||||
AC_MSG_ERROR([--with-ebpf=yes requires eBPF kernel header])
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_EBPF, test "${have_ebpf}" = "yes")
|
||||
|
||||
# SELinux support
|
||||
AC_ARG_WITH(selinux,
|
||||
|
|
@ -1362,5 +1367,5 @@ echo " JSON validation for libnm: $enable_json_validation"
|
|||
echo " crypto: $with_crypto (have-gnutls: $have_crypto_gnutls, have-nss: $have_crypto_nss)"
|
||||
echo " sanitizers: $sanitizers"
|
||||
echo " Mozilla Public Suffix List: $with_libpsl"
|
||||
echo " eBPF: $with_ebpf"
|
||||
echo " eBPF: $have_ebpf"
|
||||
echo
|
||||
|
|
|
|||
13
meson.build
13
meson.build
|
|
@ -423,6 +423,18 @@ if enable_selinux
|
|||
endif
|
||||
config_h.set10('HAVE_SELINUX', enable_selinux)
|
||||
|
||||
# eBPF support
|
||||
ebpf_opt = get_option('ebpf')
|
||||
if ebpf_opt == 'false'
|
||||
enable_ebpf = false
|
||||
else
|
||||
enable_ebpf = true
|
||||
if not cc.has_header('linux/bpf.h')
|
||||
assert(ebpf_opt != 'true', 'eBPF requires kernel support')
|
||||
enable_ebpf = false
|
||||
endif
|
||||
endif
|
||||
|
||||
# libaudit support
|
||||
libaudit = get_option('libaudit')
|
||||
enable_libaudit = libaudit.contains('yes')
|
||||
|
|
@ -994,4 +1006,5 @@ output += ' crypto: ' + crypto + ' (have-gnutls: ' + crypto_gnutls_dep.found().
|
|||
output += ' sanitizers: ' + get_option('b_sanitize') + '\n'
|
||||
output += ' Mozilla Public Suffix List: ' + enable_libpsl.to_string() + '\n'
|
||||
output += ' vapi: ' + enable_vapi.to_string() + '\n'
|
||||
output += ' ebpf: ' + enable_ebpf.to_string() + '\n'
|
||||
message(output)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ option('libnm_glib', type: 'boolean', value: false, description: 'build legacy l
|
|||
option('nmcli', type: 'boolean', value: true, description: 'Build nmcli')
|
||||
option('nmtui', type: 'boolean', value: true, description: 'Build nmtui')
|
||||
option('bluez5_dun', type: 'boolean', value: false, description: 'enable Bluez5 DUN support')
|
||||
option('ebpf', type: 'boolean', value: true, description: 'Enable or disable eBPF support')
|
||||
option('ebpf', type: 'combo', choices : ['auto', 'true', 'false'], description: 'Enable eBPF support')
|
||||
|
||||
# configuration plugins
|
||||
option('config_plugins_default', type: 'string', value: '', description: 'Default configuration option for main.plugins setting, used as fallback if the configuration option is unset')
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ shared_c_rbtree_dep = declare_dependency(
|
|||
)
|
||||
|
||||
|
||||
if get_option('ebpf')
|
||||
if enable_ebpf
|
||||
shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf.c')
|
||||
else
|
||||
shared_n_acd_bpf_files = files('n-acd/src/n-acd-bpf-fallback.c')
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue