Skip to content

Commit fd65465

Browse files
committed
kconfig: do not require pkg-config on make {menu,n}config
Meelis Roos reported a {menu,n}config regression: "I have libncurses devel package installed in the default system location (as do 99%+ on actual developers probably) and in this case, pkg-config is useless. pkg-config is needed only when libraries and headers are installed in non-default locations but it is bad to require installation of pkg-config on all the machines where make menuconfig would be possibly run." For {menu,n}config, do not use pkg-config if it is not installed. For {g,x}config, keep checking pkg-config since we really rely on it for finding the installation paths of the required packages. Fixes: 4ab3b80 ("kconfig: check for pkg-config on make {menu,n,g,x}config") Reported-by: Meelis Roos <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Tested-by: Meelis Roos <[email protected]> Tested-by: Randy Dunlap <[email protected]>
1 parent bc8d2e2 commit fd65465

File tree

7 files changed

+43
-32
lines changed

7 files changed

+43
-32
lines changed

Documentation/process/changes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pkg-config
8686

8787
The build system, as of 4.18, requires pkg-config to check for installed
8888
kconfig tools and to determine flags settings for use in
89-
'make {menu,n,g,x}config'. Previously pkg-config was being used but not
89+
'make {g,x}config'. Previously pkg-config was being used but not
9090
verified or documented.
9191

9292
Flex

scripts/kconfig/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c
221221

222222
# check if necessary packages are available, and configure build flags
223223
define filechk_conf_cfg
224-
$(CONFIG_SHELL) $(srctree)/scripts/kconfig/check-pkgconfig.sh; \
225224
$(CONFIG_SHELL) $<
226225
endef
227226

scripts/kconfig/check-pkgconfig.sh

Lines changed: 0 additions & 8 deletions
This file was deleted.

scripts/kconfig/gconf-cfg.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33

44
PKG="gtk+-2.0 gmodule-2.0 libglade-2.0"
55

6+
if [ -z "$(command -v pkg-config)" ]; then
7+
echo >&2 "*"
8+
echo >&2 "* 'make gconfig' requires 'pkg-config'. Please install it."
9+
echo >&2 "*"
10+
exit 1
11+
fi
12+
613
if ! pkg-config --exists $PKG; then
714
echo >&2 "*"
815
echo >&2 "* Unable to find the GTK+ installation. Please make sure that"

scripts/kconfig/mconf-cfg.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44
PKG="ncursesw"
55
PKG2="ncurses"
66

7-
if pkg-config --exists $PKG; then
8-
echo cflags=\"$(pkg-config --cflags $PKG)\"
9-
echo libs=\"$(pkg-config --libs $PKG)\"
10-
exit 0
11-
fi
7+
if [ -n "$(command -v pkg-config)" ]; then
8+
if pkg-config --exists $PKG; then
9+
echo cflags=\"$(pkg-config --cflags $PKG)\"
10+
echo libs=\"$(pkg-config --libs $PKG)\"
11+
exit 0
12+
fi
1213

13-
if pkg-config --exists $PKG2; then
14-
echo cflags=\"$(pkg-config --cflags $PKG2)\"
15-
echo libs=\"$(pkg-config --libs $PKG2)\"
16-
exit 0
14+
if pkg-config --exists $PKG2; then
15+
echo cflags=\"$(pkg-config --cflags $PKG2)\"
16+
echo libs=\"$(pkg-config --libs $PKG2)\"
17+
exit 0
18+
fi
1719
fi
1820

19-
# Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses
20-
# by pkg-config.
21+
# Check the default paths in case pkg-config is not installed.
22+
# (Even if it is installed, some distributions such as openSUSE cannot
23+
# find ncurses by pkg-config.)
2124
if [ -f /usr/include/ncursesw/ncurses.h ]; then
2225
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
2326
echo libs=\"-lncursesw\"

scripts/kconfig/nconf-cfg.sh

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44
PKG="ncursesw menuw panelw"
55
PKG2="ncurses menu panel"
66

7-
if pkg-config --exists $PKG; then
8-
echo cflags=\"$(pkg-config --cflags $PKG)\"
9-
echo libs=\"$(pkg-config --libs $PKG)\"
10-
exit 0
11-
fi
7+
if [ -n "$(command -v pkg-config)" ]; then
8+
if pkg-config --exists $PKG; then
9+
echo cflags=\"$(pkg-config --cflags $PKG)\"
10+
echo libs=\"$(pkg-config --libs $PKG)\"
11+
exit 0
12+
fi
1213

13-
if pkg-config --exists $PKG2; then
14-
echo cflags=\"$(pkg-config --cflags $PKG2)\"
15-
echo libs=\"$(pkg-config --libs $PKG2)\"
16-
exit 0
14+
if pkg-config --exists $PKG2; then
15+
echo cflags=\"$(pkg-config --cflags $PKG2)\"
16+
echo libs=\"$(pkg-config --libs $PKG2)\"
17+
exit 0
18+
fi
1719
fi
1820

19-
# Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses
20-
# by pkg-config.
21+
# Check the default paths in case pkg-config is not installed.
22+
# (Even if it is installed, some distributions such as openSUSE cannot
23+
# find ncurses by pkg-config.)
2124
if [ -f /usr/include/ncursesw/ncurses.h ]; then
2225
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
2326
echo libs=\"-lncursesw -lmenuw -lpanelw\"

scripts/kconfig/qconf-cfg.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
PKG="Qt5Core Qt5Gui Qt5Widgets"
55
PKG2="QtCore QtGui"
66

7+
if [ -z "$(command -v pkg-config)" ]; then
8+
echo >&2 "*"
9+
echo >&2 "* 'make xconfig' requires 'pkg-config'. Please install it."
10+
echo >&2 "*"
11+
exit 1
12+
fi
13+
714
if pkg-config --exists $PKG; then
815
echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\"
916
echo libs=\"$(pkg-config --libs $PKG)\"

0 commit comments

Comments
 (0)