lkml.org 
[lkml]   [2006]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 01/11] kconfig: factor out ncurses check in a shell script
On Tue, Jan 10, 2006 at 09:27:42PM +0100, Jan Engelhardt wrote:
> >
> >Cleaning up the lxdialog Makefile by factoring out the
> >ncurses compatibility checks.
> >This made the checks much more obvious and easier to extend.
>
> BTW, do you know a nice way to detect ncursesw?
Something like this?

diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile
index 8f41d9a..fae3e29 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 a3c141b..3f172f1 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() {}" | $compiler -lncursesw -xc - 2> /dev/null
+ if [ $? -eq 0 ]; then
+ echo '-lncursesw'
+ exit
+ fi
+ echo "main() {}" | $compiler -lncurses -xc - 2> /dev/null
+ if [ $? -eq 0 ]; then
echo '-lncurses'
+ exit
+ fi
+ echo "main() {}" | $compiler -lcurses -xc - 2> /dev/null
+ if [ $? -eq 0 ]; then
+ echo '-lcurses'
+ exit
fi
+ exit 1
}

# Where is ncurses.h?
@@ -58,6 +69,8 @@ case "$1" in
ccflags
;;
"-ldflags")
+ shift
+ compiler="$@"
ldflags
;;
"*")
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2006-01-11 17:57    [W:0.243 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site