From 5c3e9e44432697b9f638c5367e01bdde47adf0f2 Mon Sep 17 00:00:00 2001 From: Justin Lecher Date: Sun, 24 Feb 2013 16:02:00 +0100 Subject: [PATCH] Use config scripts to detect ncurses libs for menuconfig/nconfig dialogs When building ncurses with --with-termlib several symbols get moved from libncurses.so to libtinfo.so. Thus when linking with libncurses.so, one additionally needs to link with libtinfo.so. Ncurses provides a config script (ncurses5-config) and an interface with pkg-config. This patch makes use of those to detect the necessary libs for linking of the ncurses menuconfig and nconfig dialogs. Signed-off-by: Justin Lecher --- scripts/kconfig/Makefile | 2 +- scripts/kconfig/lxdialog/check-lxdialog.sh | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 3091794..7649047 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -216,7 +216,7 @@ HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) -HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses +HOSTLOADLIBES_nconf = `pkg-config --libs menu panel ncurses` $(obj)/qconf.o: $(obj)/.tmp_qtcheck ifeq ($(qconf-target),1) diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index c8e8a71..4699c1b 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh @@ -4,15 +4,21 @@ # What library to link ldflags() { - for ext in so a dll.a dylib ; do - for lib in ncursesw ncurses curses ; do - $cc -print-file-name=lib${lib}.${ext} | grep -q / - if [ $? -eq 0 ]; then - echo "-l${lib}" - exit - fi + if type -p ncurses5-config &> /dev/null ; then + ncurses5-config --libs + exit 0 + else + for ext in so a dll.a dylib ; do + for lib in ncursesw ncurses curses ; do + $cc -print-file-name=lib${lib}.${ext} | \ + grep -q / + if [ $? -eq 0 ]; then + echo "-l${lib}" + exit + fi + done done - done + fi exit 1 } -- 1.8.1.4