aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-10-08 14:08:47 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-11-12 12:33:05 +0000
commit9c73329588d33a5e731d72b6eeae67201c7ce101 (patch)
treefdffe6c22c22336af535318c24094a5ee90df998 /build
parentdcb9fcfc64ab3b35f9ff6ca81cf40069a293d533 (diff)
build: better detection of libbpf dependencies
Type: fix Change-Id: Ib496e6eb0a76e6268aea09d5f4495f3ecd921ec2 Signed-off-by: Benoît Ganne <bganne@cisco.com> (cherry picked from commit 24b5107edd21b191fac3d6f9f2ae58c6ede59a9e)
Diffstat (limited to 'build')
-rw-r--r--build/external/packages/libbpf.mk10
1 files changed, 6 insertions, 4 deletions
diff --git a/build/external/packages/libbpf.mk b/build/external/packages/libbpf.mk
index 90ff54b433c..aa72832afe1 100644
--- a/build/external/packages/libbpf.mk
+++ b/build/external/packages/libbpf.mk
@@ -27,8 +27,10 @@ else
LIBBPF_CFLAGS+= -O2
endif
-IF_XDP:=$(shell echo "\#include <linux/if_xdp.h>" | $(CC) -E -xc - > /dev/null 2>&1)
-IF_XDP:=$(.SHELLSTATUS)
+# check for libelf, zlib and kernel if_xdp.h presence
+LIBBPF_DEPS_CHECK:="\#include <linux/if_xdp.h>\\n\#include <gelf.h>\\n\#include <zlib.h>\\nint main(void){return 0;}"
+LIBBPF_DEPS_CHECK:=$(shell echo -e $(LIBBPF_DEPS_CHECK) | $(CC) -xc -lelf -lz -o /dev/null - > /dev/null 2>&1)
+LIBBPF_DEPS_CHECK:=$(.SHELLSTATUS)
define libbpf_config_cmds
@true
@@ -46,8 +48,8 @@ define libbpf_install_cmds
$(call libbpf_build_cmds__,install,$(libbpf_install_log))
endef
-ifneq ($(IF_XDP),0)
- $(warning "linux/if_xdp.h was not found on this system. libbpf will be skipped.")
+ifneq ($(LIBBPF_DEPS_CHECK),0)
+ $(warning "Missing libbpf dependencies. libbpf will be skipped.")
libbpf-install:
@true
else