[PATCH] Be consistent with pkg-config usage

Kylie McClain somasissounds at gmail.com
Fri Apr 8 02:54:33 UTC 2016


From: Kylie McClain <somasis at exherbo.org>

The top-level makefile uses and sets PKG_CONFIG. The scripts and makefiles which are
used by it, or may be used by it should adhere to this.
---
 scripts/kconfig/Makefile                   | 20 ++++++++++----------
 scripts/kconfig/lxdialog/check-lxdialog.sh | 10 ++++++----
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 38bae80..fecab6e 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -150,8 +150,8 @@ HOSTCFLAGS_zconf.tab.o	:= -I$(src)
 HOSTLOADLIBES_qconf	= $(KC_QT_LIBS) -ldl
 HOSTCXXFLAGS_qconf.o	= $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK
 
-HOSTLOADLIBES_gconf	= `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
-HOSTCFLAGS_gconf.o	= `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
+HOSTLOADLIBES_gconf	= `$(PKG_CONFIG) --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
+HOSTCFLAGS_gconf.o	= `$(PKG_CONFIG) --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
                           -D LKC_DIRECT_LINK
 
 $(obj)/qconf.o: $(obj)/.tmp_qtcheck
@@ -163,13 +163,13 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
 # QT needs some extra effort...
 $(obj)/.tmp_qtcheck:
 	@set -e; echo "  CHECK   qt"; dir=""; pkg=""; \
-	pkg-config --exists qt 2> /dev/null && pkg=qt; \
-	pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
+	$(PKG_CONFIG) --exists qt 2> /dev/null && pkg=qt; \
+	$(PKG_CONFIG) --exists qt-mt 2> /dev/null && pkg=qt-mt; \
 	if [ -n "$$pkg" ]; then \
-	  cflags="\$$(shell pkg-config $$pkg --cflags)"; \
-	  libs="\$$(shell pkg-config $$pkg --libs)"; \
-	  moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
-	  dir="$$(pkg-config $$pkg --variable=prefix)"; \
+	  cflags="\$$(shell $(PKG_CONFIG) $$pkg --cflags)"; \
+	  libs="\$$(shell $(PKG_CONFIG) $$pkg --libs)"; \
+	  moc="\$$(shell $(PKG_CONFIG) $$pkg --variable=prefix)/bin/moc"; \
+	  dir="$$($(PKG_CONFIG) $$pkg --variable=prefix)"; \
 	else \
 	  for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
 	    if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
@@ -210,8 +210,8 @@ ifeq ($(gconf-target),1)
 
 # GTK needs some extra effort, too...
 $(obj)/.tmp_gtkcheck:
-	@if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then		\
-		if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then			\
+	@if `$(PKG_CONFIG) --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then		\
+		if `$(PKG_CONFIG) --atleast-version=2.0.0 gtk+-2.0`; then			\
 			touch $@;								\
 		else									\
 			echo "*"; 							\
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index 5075ebf..23abfa7 100755
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -1,11 +1,13 @@
 #!/bin/sh
 # Check ncurses compatibility
 
+PKG_CONFIG=${PKG_CONFIG-pkg-config}
+
 # What library to link
 ldflags()
 {
-	pkg-config --libs ncursesw 2>/dev/null && exit
-	pkg-config --libs ncurses 2>/dev/null && exit
+	"${PKG_CONFIG}" --libs ncursesw 2>/dev/null && exit
+	"${PKG_CONFIG}" --libs ncurses 2>/dev/null && exit
 	for ext in so a dll.a dylib ; do
 		for lib in ncursesw ncurses curses ; do
 			$cc -print-file-name=lib${lib}.${ext} | grep -q /
@@ -21,9 +23,9 @@ ldflags()
 # Where is ncurses.h?
 ccflags()
 {
-	if pkg-config --cflags ncursesw 2>/dev/null; then
+	if "${PKG_CONFIG}" --cflags ncursesw 2>/dev/null; then
 		echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1'
-	elif pkg-config --cflags ncurses 2>/dev/null; then
+	elif "${PKG_CONFIG}" --cflags ncurses 2>/dev/null; then
 		echo '-DCURSES_LOC="<ncurses.h>"'
 	elif [ -f /usr/include/ncursesw/curses.h ]; then
 		echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
-- 
2.7.4



More information about the busybox mailing list