fixup! kconfig: refactor ncurses package checks for building mconf and nconf

Message ID 1527041491-12647-1-git-send-email-yamada.masahiro@socionext.com
State New
Headers show
Series
  • fixup! kconfig: refactor ncurses package checks for building mconf and nconf
Related show

Commit Message

Masahiro Yamada May 23, 2018, 2:11 a.m.
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@socionext.com>

---

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(-)

-- 
2.7.4

Comments

Sam Ravnborg May 23, 2018, 4:48 a.m. | #1
On Wed, May 23, 2018 at 11:11:31AM +0900, Masahiro Yamada wrote:
> 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@socionext.com>

> ---

> 

> The v3 (https://patchwork.kernel.org/patch/10417413/) was

> reviewed and tested.

> 

> I'd like to squash this into it.


Looks good.
Reviewed-off-by: Sam Ravnborg <sam@ravnborg.org>

	Sam
Randy Dunlap May 23, 2018, 9:07 p.m. | #2
On 05/22/2018 07:11 PM, Masahiro Yamada wrote:
> 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@socionext.com>

> ---

> 

> The v3 (https://patchwork.kernel.org/patch/10417413/) was

> reviewed and tested.

> 

> I'd like to squash this into it.


Sure.  Works for me.  Thanks.

> 

> 

>  scripts/kconfig/mconf-cfg.sh | 8 ++++----

>  scripts/kconfig/nconf-cfg.sh | 7 ++++---

>  2 files changed, 8 insertions(+), 7 deletions(-)



-- 
~Randy

Patch

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