build: respect $PKG_CONFIG settings

The build needs to respect $PKG_CONFIG env var like other standard
build systems and the the upstream pkg-config project itself.  This
allows the package builder to point it to the right tool when doing
a cross-compile build.  Otherwise the host pkg-config tool is used
which won't have access to the packages in the cross sysroot.

Signed-off-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2021-06-16 15:43:04 -04:00 committed by Andrei Vagin
parent 81a68ad3b2
commit 2967bed64e
7 changed files with 10 additions and 8 deletions

View file

@ -17,6 +17,7 @@ AR := $(CROSS_COMPILE)ar
STRIP := $(CROSS_COMPILE)strip
OBJCOPY := $(CROSS_COMPILE)objcopy
OBJDUMP := $(CROSS_COMPILE)objdump
PKG_CONFIG ?= pkg-config
NM := $(CROSS_COMPILE)nm
MAKE := make
MKDIR := mkdir -p

View file

@ -16,7 +16,7 @@ try-asm = $(call try-compile,assembler-with-cpp,$(1),$(2),$(3))
# pkg-config-check
# Usage: ifeq ($(call pkg-config-check, library),y)
pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y')
#
# Remove duplicates.