@@ -160,6 +160,9 @@ help:
@echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support'
@echo ' tinyconfig - Configure the tiniest possible kernel'
+# pkg-config check
+check-pkgconfig := $(srctree)/$(src)/check-pkgconfig.sh
+
# lxdialog stuff
check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
@@ -205,7 +208,17 @@ $(addprefix $(obj)/, mconf.o $(lxdialog)
$(obj)/dochecklxdialog:
$(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
-always := dochecklxdialog
+# Check that we have pkg-config (used by each of menu/n/g/xconfig)
+PHONY += $(obj)/docheckpkgconfig
+$(addprefix $(obj)/, mconf.o): $(obj)/docheckpkgconfig
+$(addprefix $(obj)/, nconf.o): $(obj)/docheckpkgconfig
+$(addprefix $(obj)/, gconf.o): $(obj)/docheckpkgconfig
+$(addprefix $(obj)/, qconf.o): $(obj)/docheckpkgconfig
+
+$(obj)/docheckpkgconfig:
+ $(Q)$(CONFIG_SHELL) $(check-pkgconfig)
+
+always := docheckpkgconfig dochecklxdialog
# Add environment specific flags
HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS))
@@ -0,0 +1,13 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+# Check for pkg-config presence
+
+pkgcfg=`which pkg-config >/dev/null 2>&1`
+found=$?
+
+if [ $found -ne 0 ]; then
+ echo "'make *config' requires 'pkg-config'. Please install it." 1>&2
+ exit 1 # error
+fi
+
+exit 0