| From 87427256640f806710dd97fc807a9a896147c617 Mon Sep 17 00:00:00 2001 | |
| From: Vinson Lee <vlee@freedesktop.org> | |
| Date: Sat, 12 Nov 2016 00:55:35 +0000 | |
| Subject: [PATCH] Check for bpf_attr map_flags. | |
| map_flags is not available until Linux 4.6. | |
| Signed-off-by: Vinson Lee <vlee@freedesktop.org> | |
| [Upstream commit: https://github.com/kernelslacker/trinity/commit/87427256640f806710dd97fc807a9a896147c617] | |
| Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | |
| --- | |
| configure | 28 +++++++++++++++++++++++++++- | |
| 1 file changed, 27 insertions(+), 1 deletion(-) | |
| diff --git a/configure b/configure | |
| index ca37e4ef..18d9df73 100755 | |
| --- a/configure | |
| +++ b/configure | |
| @@ -222,6 +222,33 @@ else | |
| fi | |
| ############################################################################################# | |
| +# is /usr/include/linux/bpf.h new enough to feature bpf | |
| +# | |
| +echo -n "[*] Checking if bpf_attr can use map_flags.. " | |
| +rm -f "$TMP" || exit 1 | |
| + | |
| +cat >"$TMP.c" << EOF | |
| +#include <stdio.h> | |
| +#include <linux/bpf.h> | |
| + | |
| +void main() | |
| +{ | |
| + union bpf_attr attr = { | |
| + .map_flags = 0, | |
| + }; | |
| +} | |
| +EOF | |
| + | |
| +${CC} ${CFLAGS} "$TMP.c" -o "$TMP" &>"$TMP.log" | |
| +if [ ! -x "$TMP" ]; then | |
| + echo $RED "[NO]" $COL_RESET | |
| + MISSING_DEFS=1 | |
| +else | |
| + echo $GREEN "[YES]" $COL_RESET | |
| + echo "#define USE_BPF 1" >> $CONFIGH | |
| +fi | |
| + | |
| +############################################################################################# | |
| check_header linux/caif/caif_socket.h USE_CAIF | |
| check_header linux/if_alg.h USE_IF_ALG | |
| @@ -239,7 +266,6 @@ check_header execinfo.h USE_BACKTRACE | |
| check_header netatalk/at.h USE_APPLETALK | |
| check_header netrom/netrom.h USE_NETROM | |
| check_header netrose/rose.h USE_ROSE | |
| -check_header linux/bpf.h USE_BPF | |
| rm -f "$TMP" "$TMP.log" "$TMP.c" | |