From 7b9be4c9802a08d2ac521a88616f780e975b7604 Mon Sep 17 00:00:00 2001 From: LekKit <50500857+LekKit@users.noreply.github.com> Date: Sat, 22 Feb 2025 22:54:55 +0200 Subject: [PATCH] Makefile: Clear PKG_CONFIG if pkg-config is not present --- Makefile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index a3db5a45..96856da4 100644 --- a/Makefile +++ b/Makefile @@ -162,18 +162,17 @@ ifneq (,$(if $(PKG_CONFIG),,$(if $(TARGET_CROSS),$(PKG_CONFIG_LIBDIR)$(PKG_CONFI override PKG_CONFIG := pkg-config endif +# Check pkg-config presence via pkg-config --version +override PKG_CONFIG := $(if $(PKG_CONFIG),$(if $(shell $(PKG_CONFIG) --version $(NULL_STDERR)),$(PKG_CONFIG))) + +# For fully linked build, pkg-config dependency may be ignored via IGNORE_PKG_CONFIG=1 +override HAS_PKG_CONFIG := $(if $(IGNORE_PKG_CONFIG),1,$(if $(filter-out 0,$(USE_FULL_LINKING)),$(if $(PKG_CONFIG),1,0),1)) + # Pass -static to pkg-config if needed ifneq (,$(PKG_CONFIG)) override PKG_CONFIG := $(PKG_CONFIG) $(filter -static,$(LDFLAGS)) endif -# For fully linked build, pkg-config presence may be ignored via IGNORE_PKG_CONFIG=1 -ifneq (,$(if $(IGNORE_PKG_CONFIG),,$(filter-out 0,$(USE_FULL_LINKING)))) -override HAS_PKG_CONFIG := $(if $(PKG_CONFIG),$(if $(shell $(PKG_CONFIG) --version $(NULL_STDERR)),1,0),0) -else -override HAS_PKG_CONFIG := 1 -endif - # # Set up target-specific build options #