build: respect ${PKG_CONFIG} in Makefiles (#6173)

Allow overriding choice of pkg-config binary (this is useful
for cross-compilation in particular) within the Makefiles.

Not yet touching configure, so some work to be done still.

Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James 2022-01-03 16:15:06 +00:00 committed by GitHub
parent 5777dc9ef2
commit 4e0be8ecd5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View file

@ -1,7 +1,8 @@
HAS_JSON=$(shell pkg-config --exists json-c; echo $$?)
PKG_CONFIG?=pkg-config
HAS_JSON=$(shell $(PKG_CONFIG) --exists json-c; echo $$?)
ifeq ($(HAS_JSON), 0)
JSON_INC = $(shell pkg-config --cflags json-c)
JSON_LIB = $(shell pkg-config --libs json-c)
JSON_INC = $(shell $(PKG_CONFIG) --cflags json-c)
JSON_LIB = $(shell $(PKG_CONFIG) --libs json-c)
else
JSON_HOME=${PWD}/../../third-party/json-c
JSON_INC=-I$(JSON_HOME)