diff --git a/util/kconfig/Makefile b/util/kconfig/Makefile index 4ad9486934..9a61e6a61c 100644 --- a/util/kconfig/Makefile +++ b/util/kconfig/Makefile @@ -15,6 +15,10 @@ # Kernel configuration targets # These targets are used from top-level makefile +CONFIG_SHELL := sh +check-lxdialog := $(src)/util/kconfig/lxdialog/check-lxdialog.sh +CURSESLIBS := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) + .PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config xconfig: $(obj)/util/kconfig/.tmp_qtcheck $(obj)/util/kconfig/qconf @@ -98,11 +102,11 @@ gconf-objects := gconf.o kconfig_load.o zconf.tab.o $(obj)/util/kconfig/mconf: $(patsubst %,$(obj)/util/kconfig/%,$(mconf-objects)) $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) -lncurses -o $@ $^ + $(Q)$(HOSTCC) $(CURSESLIBS) -o $@ $^ $(obj)/util/kconfig/conf: $(patsubst %,$(obj)/util/kconfig/%,$(conf-objects)) $(Q)printf " HOSTCC $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(HOSTCC) -lncurses -o $@ $^ + $(Q)$(HOSTCC) $(CURSESLIBS) -o $@ $^ $(obj)/util/kconfig/qconf: $(patsubst %,$(obj)/util/kconfig/%,$(qconf-objects)) $(Q)printf " HOSTCXX $(subst $(shell pwd)/,,$(@))\n" diff --git a/util/kconfig/lxdialog/check-lxdialog.sh b/util/kconfig/lxdialog/check-lxdialog.sh index c9afe889c1..0efecbe622 100644 --- a/util/kconfig/lxdialog/check-lxdialog.sh +++ b/util/kconfig/lxdialog/check-lxdialog.sh @@ -4,17 +4,17 @@ # What library to link ldflags() { - $cc -print-file-name=libncursesw.so | grep -q / + $cc -print-file-name=libncursesw.so | grep / >/dev/null if [ $? -eq 0 ]; then echo '-lncursesw' exit fi - $cc -print-file-name=libncurses.so | grep -q / + $cc -print-file-name=libncurses.so | grep / >/dev/null if [ $? -eq 0 ]; then echo '-lncurses' exit fi - $cc -print-file-name=libcurses.so | grep -q / + $cc -print-file-name=libcurses.so | grep / >/dev/null if [ $? -eq 0 ]; then echo '-lcurses' exit @@ -60,7 +60,7 @@ usage() { printf "Usage: $0 [-check compiler options|-header|-library]\n" } -if [ $# == 0 ]; then +if [ $# -eq 0 ]; then usage exit 1 fi