Skip to content

Commit

Permalink
kconfig/lxdialog: get ncurses CFLAGS with pkg-config and fixed button…
Browse files Browse the repository at this point in the history
… color

Fixed from vanilla kernel commit: be8af2d54a669

This makes "make menuconfig" also work on systems where ncurses is not
installed in a standard location (such as on NixOS).

This patch changes ldflags() and ccflags() so that it tries pkg-config first,
and only if pkg-config fails does it go back to the fallback/manual checks.

And, adding -DNCURSES_WIDECHAR=1 CFLAGS to prevent ncurses rendering
wrong color on button when changing dialog color by wbkgdset().
  • Loading branch information
Louie Lu committed Oct 1, 2016
1 parent 3f73349 commit 888047b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions external/kconfig/lxdialog/check-lxdialog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# What library to link
ldflags()
{
pkg-config --libs ncursesw 2>/dev/null && exit
pkg-config --libs ncurses 2>/dev/null && exit
for ext in so a dylib ; do
for lib in ncursesw ncurses curses ; do
$cc -print-file-name=lib${lib}.${ext} | grep -q /
Expand All @@ -19,12 +21,17 @@ ldflags()
# Where is ncurses.h?
ccflags()
{
if [ -f /usr/include/ncurses/ncurses.h ]; 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
echo '-DCURSES_LOC="<ncurses.h>"'
elif [ -f /usr/include/ncursesw/curses.h ]; then
echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"'
echo ' -DNCURSES_WIDECHAR=1'
elif [ -f /usr/include/ncurses/ncurses.h ]; then
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
elif [ -f /usr/include/ncurses/curses.h ]; then
echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
elif [ -f /usr/include/ncursesw/curses.h ]; then
echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
echo '-I/usr/include/ncurses -DCURSES_LOC="<curses.h>"'
elif [ -f /usr/include/ncurses.h ]; then
echo '-DCURSES_LOC="<ncurses.h>"'
else
Expand Down

0 comments on commit 888047b

Please sign in to comment.