[PATCH] fixup! kconfig: refactor ncurses package checks for building mconf and nconf
From: Masahiro Yamada
Date: Tue May 22 2018 - 21:19:06 EST
It is redundant to pass -DNCURSES_WIDECHAR=1 explicitly; when we use
'pkg-config --cflags', it takes care of appropriate flags.
Actually, 'pkg-config --cflags' will add -D_GNU_SOURCE, which will
define _XOPEN_SOURCE_EXTENDED, and NCURSES_WIDECHAR=1, anyway.
I added -D_GNU_SOURCE to follow the suggestion of pkg-config
for cases where pkg-config is not useful.
Signed-off-by: Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx>
---
The v3 (https://patchwork.kernel.org/patch/10417413/) was
reviewed and tested.
I'd like to squash this into it.
scripts/kconfig/mconf-cfg.sh | 8 ++++----
scripts/kconfig/nconf-cfg.sh | 7 ++++---
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/scripts/kconfig/mconf-cfg.sh b/scripts/kconfig/mconf-cfg.sh
index 1c2fe90..e6f9fac 100755
--- a/scripts/kconfig/mconf-cfg.sh
+++ b/scripts/kconfig/mconf-cfg.sh
@@ -5,7 +5,7 @@ PKG="ncursesw"
PKG2="ncurses"
if pkg-config --exists $PKG; then
- echo cflags=\"-DNCURSES_WIDECHAR=1 $(pkg-config --cflags $PKG)\"
+ echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
exit 0
fi
@@ -19,19 +19,19 @@ fi
# Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses
# by pkg-config.
if [ -f /usr/include/ncursesw/ncurses.h ]; then
- echo cflags=\"-DNCURSES_WIDECHAR=1 -I/usr/include/ncursesw\"
+ echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
echo libs=\"-lncursesw\"
exit 0
fi
if [ -f /usr/include/ncurses/ncurses.h ]; then
- echo cflags=\"-I/usr/include/ncurses\"
+ echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncurses\"
echo libs=\"-lncurses\"
exit 0
fi
if [ -f /usr/include/ncurses.h ]; then
- echo cflags=\"\"
+ echo cflags=\"-D_GNU_SOURCE\"
echo libs=\"-lncurses\"
exit 0
fi
diff --git a/scripts/kconfig/nconf-cfg.sh b/scripts/kconfig/nconf-cfg.sh
index 4c95b4e..42f5ac7 100644
--- a/scripts/kconfig/nconf-cfg.sh
+++ b/scripts/kconfig/nconf-cfg.sh
@@ -5,7 +5,7 @@ PKG="ncursesw menuw panelw"
PKG2="ncurses menu panel"
if pkg-config --exists $PKG; then
- echo cflags=\"-DNCURSES_WIDECHAR=1 $(pkg-config --cflags $PKG)\"
+ echo cflags=\"$(pkg-config --cflags $PKG)\"
echo libs=\"$(pkg-config --libs $PKG)\"
exit 0
fi
@@ -19,18 +19,19 @@ fi
# Unfortunately, some distributions (e.g. openSUSE) cannot find ncurses
# by pkg-config.
if [ -f /usr/include/ncursesw/ncurses.h ]; then
- echo cflags=\"-DNCURSES_WIDECHAR=1 -I/usr/include/ncursesw\"
+ echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncursesw\"
echo libs=\"-lncursesw -lmenuw -lpanelw\"
exit 0
fi
if [ -f /usr/include/ncurses/ncurses.h ]; then
- echo cflags=\"-I/usr/include/ncurses\"
+ echo cflags=\"-D_GNU_SOURCE -I/usr/include/ncurses\"
echo libs=\"-lncurses -lmenu -lpanel\"
exit 0
fi
if [ -f /usr/include/ncurses.h ]; then
+ echo cflags=\"-D_GNU_SOURCE\"
echo libs=\"-lncurses -lmenu -lpanel\"
exit 0
fi
--
2.7.4