Skip to content

Commit

Permalink
kconfig: do not require pkg-config on make {menu,n}config
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
masahir0y committed Sep 2, 2018
1 parent bc8d2e2 commit fd65465
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Documentation/process/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pkg-config

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

Flex
Expand Down
1 change: 0 additions & 1 deletion scripts/kconfig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c

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

Expand Down
8 changes: 0 additions & 8 deletions scripts/kconfig/check-pkgconfig.sh

This file was deleted.

7 changes: 7 additions & 0 deletions scripts/kconfig/gconf-cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@

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

if [ -z "$(command -v pkg-config)" ]; then
echo >&2 "*"
echo >&2 "* 'make gconfig' requires 'pkg-config'. Please install it."
echo >&2 "*"
exit 1
fi

if ! pkg-config --exists $PKG; then
echo >&2 "*"
echo >&2 "* Unable to find the GTK+ installation. Please make sure that"
Expand Down
25 changes: 14 additions & 11 deletions scripts/kconfig/mconf-cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
PKG="ncursesw"
PKG2="ncurses"

if pkg-config --exists $PKG; then
echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
exit 0
fi
if [ -n "$(command -v pkg-config)" ]; then
if pkg-config --exists $PKG; then
echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
exit 0
fi

if pkg-config --exists $PKG2; then
echo cflags=\"$(pkg-config --cflags $PKG2)\"
echo libs=\"$(pkg-config --libs $PKG2)\"
exit 0
if pkg-config --exists $PKG2; then
echo cflags=\"$(pkg-config --cflags $PKG2)\"
echo libs=\"$(pkg-config --libs $PKG2)\"
exit 0
fi
fi

# Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses
# by pkg-config.
# Check the default paths in case pkg-config is not installed.
# (Even if it is installed, some distributions such as openSUSE cannot
# find ncurses by pkg-config.)
if [ -f /usr/include/ncursesw/ncurses.h ]; then
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
echo libs=\"-lncursesw\"
Expand Down
25 changes: 14 additions & 11 deletions scripts/kconfig/nconf-cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@
PKG="ncursesw menuw panelw"
PKG2="ncurses menu panel"

if pkg-config --exists $PKG; then
echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
exit 0
fi
if [ -n "$(command -v pkg-config)" ]; then
if pkg-config --exists $PKG; then
echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
exit 0
fi

if pkg-config --exists $PKG2; then
echo cflags=\"$(pkg-config --cflags $PKG2)\"
echo libs=\"$(pkg-config --libs $PKG2)\"
exit 0
if pkg-config --exists $PKG2; then
echo cflags=\"$(pkg-config --cflags $PKG2)\"
echo libs=\"$(pkg-config --libs $PKG2)\"
exit 0
fi
fi

# Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses
# by pkg-config.
# Check the default paths in case pkg-config is not installed.
# (Even if it is installed, some distributions such as openSUSE cannot
# find ncurses by pkg-config.)
if [ -f /usr/include/ncursesw/ncurses.h ]; then
echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
echo libs=\"-lncursesw -lmenuw -lpanelw\"
Expand Down
7 changes: 7 additions & 0 deletions scripts/kconfig/qconf-cfg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
PKG="Qt5Core Qt5Gui Qt5Widgets"
PKG2="QtCore QtGui"

if [ -z "$(command -v pkg-config)" ]; then
echo >&2 "*"
echo >&2 "* 'make xconfig' requires 'pkg-config'. Please install it."
echo >&2 "*"
exit 1
fi

if pkg-config --exists $PKG; then
echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\"
echo libs=\"$(pkg-config --libs $PKG)\"
Expand Down

0 comments on commit fd65465

Please sign in to comment.