Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kconfig/lxdialog: get ncurses CFLAGS with pkg-config

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

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

Signed-off-by: Bjørn Forsman <bjorn.forsman@gmail.com>
Signed-off-by: Michal Marek <mmarek@suse.cz>

authored by

Bjørn Forsman and committed by
Michal Marek
be8af2d5 7285996a

+5 -1
+5 -1
scripts/kconfig/lxdialog/check-lxdialog.sh
··· 21 21 # Where is ncurses.h? 22 22 ccflags() 23 23 { 24 - if [ -f /usr/include/ncursesw/curses.h ]; then 24 + if pkg-config --cflags ncursesw 2>/dev/null; then 25 + echo '-DCURSES_LOC="<ncurses.h>" -DNCURSES_WIDECHAR=1' 26 + elif pkg-config --cflags ncurses 2>/dev/null; then 27 + echo '-DCURSES_LOC="<ncurses.h>"' 28 + elif [ -f /usr/include/ncursesw/curses.h ]; then 25 29 echo '-I/usr/include/ncursesw -DCURSES_LOC="<curses.h>"' 26 30 echo ' -DNCURSES_WIDECHAR=1' 27 31 elif [ -f /usr/include/ncurses/ncurses.h ]; then