]> git.ipfire.org Git - thirdparty/pdns.git/blob - m4/pdns_with_ebpf.m4
dnsdist: Disable eBPF support when BPF_FUNC_tail_call is not found
[thirdparty/pdns.git] / m4 / pdns_with_ebpf.m4
1 AC_DEFUN([PDNS_WITH_EBPF],[
2 AC_MSG_CHECKING([if we have eBPF support])
3 AC_ARG_WITH([ebpf],
4 AS_HELP_STRING([--with-ebpf],[enable eBPF support @<:@default=auto@:>@]),
5 [with_ebpf=$withval],
6 [with_ebpf=auto],
7 )
8 AC_MSG_RESULT([$with_ebpf])
9
10 AS_IF([test "x$with_ebpf" != "xno"], [
11 AS_IF([test "x$with_ebpf" = "xyes" -o "x$with_ebpf" = "xauto"], [
12 AC_CHECK_HEADERS([linux/bpf.h], bpf_headers=yes, bpf_headers=no)
13 ])
14 ])
15 AS_IF([test "x$with_ebpf" = "xyes"], [
16 AS_IF([test x"$bpf_headers" = "no"], [
17 AC_MSG_ERROR([EBPF support requested but required eBPF headers were not found])
18 ])
19 ])
20 AM_CONDITIONAL([HAVE_EBPF], [test x"$bpf_headers" = "xyes" ])
21 AS_IF([test x"$bpf_headers" = "xyes" ],
22 [AC_CHECK_DECL(BPF_FUNC_tail_call,
23 [ AC_DEFINE([HAVE_EBPF], [1], [Define if using eBPF.]) ],
24 [ AS_IF([test "x$with_ebpf" = "xyes"], [
25 AC_MSG_ERROR([EBPF support requested but BPF_FUNC_tail_call not found in the eBPF headers])
26 ])
27 ],
28 [#include <linux/bpf.h>]
29 )]
30 )
31 ])