summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2018-09-19 16:38:38 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2018-09-19 17:23:11 +0200
commit81a565ebe5ded63c1da77500808d44dfd73d9df8 (patch)
treeae8c83d905cd5a0456bc274a9734d1358646631f /configure.ac
parentc7c3acf28029aef8a839ec7629a62e53e963ea81 (diff)
downloadNetworkManager-81a565ebe5ded63c1da77500808d44dfd73d9df8.tar.gz
build: autodetect ebpf support
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac17
1 files changed, 11 insertions, 6 deletions
diff --git a/configure.ac b/configure.ac
index 49d2e5a02f..946f6b35e5 100644
--- a/configure.ac
+++ b/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
+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 "${with_ebpf}" = "yes")
+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