summaryrefslogtreecommitdiffstats
path: root/m4/pdns_with_ebpf.m4
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:34:30 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:34:30 +0000
commit4fc2f55f761d71aae1f145d5aa94ba929cc39676 (patch)
tree5c1e1db3b46dd4edbe11f612d93cb94b96891ce3 /m4/pdns_with_ebpf.m4
parentInitial commit. (diff)
downloaddnsdist-4b05eb2196d01b29234ea3da7b08514b75478e45.tar.xz
dnsdist-4b05eb2196d01b29234ea3da7b08514b75478e45.zip
Adding upstream version 1.7.3.upstream/1.7.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4/pdns_with_ebpf.m4')
-rw-r--r--m4/pdns_with_ebpf.m438
1 files changed, 38 insertions, 0 deletions
diff --git a/m4/pdns_with_ebpf.m4 b/m4/pdns_with_ebpf.m4
new file mode 100644
index 0000000..760bd65
--- /dev/null
+++ b/m4/pdns_with_ebpf.m4
@@ -0,0 +1,38 @@
+AC_DEFUN([PDNS_WITH_EBPF],[
+ AC_MSG_CHECKING([if we have eBPF support])
+ AC_ARG_WITH([ebpf],
+ AS_HELP_STRING([--with-ebpf],[enable eBPF support @<:@default=auto@:>@]),
+ [with_ebpf=$withval],
+ [with_ebpf=auto],
+ )
+ AC_MSG_RESULT([$with_ebpf])
+
+ AS_IF([test "x$with_ebpf" != "xno"], [
+ AS_IF([test "x$with_ebpf" = "xyes" -o "x$with_ebpf" = "xauto"], [
+ AC_CHECK_HEADERS([linux/bpf.h], bpf_headers=yes, bpf_headers=no)
+ ])
+ ])
+ AS_IF([test "x$with_ebpf" = "xyes"], [
+ AS_IF([test x"$bpf_headers" = "no"], [
+ AC_MSG_ERROR([EBPF support requested but required eBPF headers were not found])
+ ])
+ ])
+ AM_CONDITIONAL([HAVE_EBPF], [test x"$bpf_headers" = "xyes" ])
+ AS_IF([test x"$bpf_headers" = "xyes" ],
+ [AC_CHECK_DECL(BPF_FUNC_tail_call,
+ [ AC_CHECK_DECL(SO_ATTACH_BPF,
+ [ AC_DEFINE([HAVE_EBPF], [1], [Define if using eBPF.]) ],
+ [ AS_IF([test "x$with_ebpf" = "xyes"], [
+ AC_MSG_ERROR([EBPF support requested but SO_ATTACH_BPF not found])
+ ])],
+ [#include <sys/socket.h>
+ ]
+ )],
+ [ AS_IF([test "x$with_ebpf" = "xyes"], [
+ AC_MSG_ERROR([EBPF support requested but BPF_FUNC_tail_call not found in the eBPF headers])
+ ])],
+ [#include <linux/bpf.h>
+ ]
+ )]
+ )
+])