summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--scripts/kconfig/lxdialog/Makefile6
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh23
2 files changed, 21 insertions, 8 deletions
diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile
index 8f41d9a57aa..fae3e29fc92 100644
--- a/scripts/kconfig/lxdialog/Makefile
+++ b/scripts/kconfig/lxdialog/Makefile
@@ -1,9 +1,9 @@
# Makefile to build lxdialog package
#
-check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh
-HOST_EXTRACFLAGS := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
-HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags)
+check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh
+HOST_EXTRACFLAGS:= $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
+HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
HOST_EXTRACFLAGS += -DLOCALE
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index a3c141b4967..448e353923f 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -4,11 +4,22 @@
# What library to link
ldflags()
{
- if [ `uname` == SunOS ]; then
- echo '-lcurses'
- else
+ echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null
+ if [ $? -eq 0 ]; then
+ echo '-lncursesw'
+ exit
+ fi
+ echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null
+ if [ $? -eq 0 ]; then
echo '-lncurses'
+ exit
fi
+ echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null
+ if [ $? -eq 0 ]; then
+ echo '-lcurses'
+ exit
+ fi
+ exit 1
}
# Where is ncurses.h?
@@ -28,7 +39,7 @@ ccflags()
compiler=""
# Check if we can link to ncurses
check() {
- echo "main() {}" | $compiler -xc -
+ echo "main() {}" | $cc -xc - -o /dev/null 2> /dev/null
if [ $? != 0 ]; then
echo " *** Unable to find the ncurses libraries." 1>&2
echo " *** make menuconfig require the ncurses libraries" 1>&2
@@ -51,13 +62,15 @@ fi
case "$1" in
"-check")
shift
- compiler="$@"
+ cc="$@"
check
;;
"-ccflags")
ccflags
;;
"-ldflags")
+ shift
+ cc="$@"
ldflags
;;
"*")