Re: [PATCH 01/11] kconfig: factor out ncurses check in a shell script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux