mirror of
https://github.com/netdata/libbpf.git
synced 2026-04-07 09:09:06 +08:00
Makefile: detect pkg-config availability
Detect whether build system has pkg-config tool, and if not, fallback to manually specifying -lelf -lz as dependency. Closes: https://github.com/libbpf/libbpf/issues/885 Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
This commit is contained in:
committed by
Andrii Nakryiko
parent
42a6ef6316
commit
4c893341f5
@@ -26,6 +26,7 @@ endef
|
|||||||
|
|
||||||
$(call allow-override,CC,$(CROSS_COMPILE)cc)
|
$(call allow-override,CC,$(CROSS_COMPILE)cc)
|
||||||
$(call allow-override,LD,$(CROSS_COMPILE)ld)
|
$(call allow-override,LD,$(CROSS_COMPILE)ld)
|
||||||
|
PKG_CONFIG ?= pkg-config
|
||||||
|
|
||||||
TOPDIR = ..
|
TOPDIR = ..
|
||||||
|
|
||||||
@@ -41,10 +42,12 @@ ALL_CFLAGS += $(CFLAGS) \
|
|||||||
$(EXTRA_CFLAGS)
|
$(EXTRA_CFLAGS)
|
||||||
ALL_LDFLAGS += $(LDFLAGS) $(EXTRA_LDFLAGS)
|
ALL_LDFLAGS += $(LDFLAGS) $(EXTRA_LDFLAGS)
|
||||||
|
|
||||||
|
ifeq ($(shell command -v $(PKG_CONFIG) 2> /dev/null),)
|
||||||
|
NO_PKG_CONFIG := 1
|
||||||
|
endif
|
||||||
ifdef NO_PKG_CONFIG
|
ifdef NO_PKG_CONFIG
|
||||||
ALL_LDFLAGS += -lelf -lz
|
ALL_LDFLAGS += -lelf -lz
|
||||||
else
|
else
|
||||||
PKG_CONFIG ?= pkg-config
|
|
||||||
ALL_CFLAGS += $(shell $(PKG_CONFIG) --cflags libelf zlib)
|
ALL_CFLAGS += $(shell $(PKG_CONFIG) --cflags libelf zlib)
|
||||||
ALL_LDFLAGS += $(shell $(PKG_CONFIG) --libs libelf zlib)
|
ALL_LDFLAGS += $(shell $(PKG_CONFIG) --libs libelf zlib)
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user