Re: Linux 2.6.16-rc1

From: Sam Ravnborg
Date: Wed Jan 18 2006 - 07:41:17 EST


Hi Eyal, Jean.


>
> content of /tmp/xxx
> ===================
>
> ldflags 1
> crw-rw-rw- 1 root root 1, 3 Jan 18 22:20 /dev/null
> ldflags 3
> ls: /dev/null: No such file or directory
> ldflags 4
> -rwxr-xr-x 1 root root 11650 Jan 18 22:20 /dev/null

Following patch fix it.
We now evaluate the value of the variabls only when needed.
And gcc do not use '-o /dev/null' since this is not good.

Sam

diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile
index fae3e29..3441b56 100644
--- a/scripts/kconfig/lxdialog/Makefile
+++ b/scripts/kconfig/lxdialog/Makefile
@@ -2,8 +2,11 @@
#

check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh
-HOST_EXTRACFLAGS:= $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
-HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
+
+#ยค Use reursively expanded variables so we do not call gcc unless
+# we really need to do so. (Do not call gcc as part of make mrproper)
+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 448e353..0ec6552 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -1,20 +1,24 @@
#!/bin/sh
# Check ncurses compatibility

+# Temp file, try to clean up after us
+tmp=.lxdialog.tmp
+trap "rm -f $tmp" 0 1 2 3 15
+
# What library to link
ldflags()
{
- echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null
+ echo "main() {}" | $cc -lncursesw -xc - -o $tmp 2> /dev/null
if [ $? -eq 0 ]; then
echo '-lncursesw'
exit
fi
- echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null
+ echo "main() {}" | $cc -lncurses -xc - -o $tmp 2> /dev/null
if [ $? -eq 0 ]; then
echo '-lncurses'
exit
fi
- echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null
+ echo "main() {}" | $cc -lcurses -xc - -o $tmp 2> /dev/null
if [ $? -eq 0 ]; then
echo '-lcurses'
exit
@@ -39,7 +43,7 @@ ccflags()
compiler=""
# Check if we can link to ncurses
check() {
- echo "main() {}" | $cc -xc - -o /dev/null 2> /dev/null
+ echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null
if [ $? != 0 ]; then
echo " *** Unable to find the ncurses libraries." 1>&2
echo " *** make menuconfig require the ncurses libraries" 1>&2
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/