diff options
| author | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-01-21 06:03:09 -0500 |
|---|---|---|
| committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2006-01-21 06:03:09 -0500 |
| commit | 3835f82183eab8b67ddda6b32c127859a546c82d (patch) | |
| tree | 25d3e5179e13548b034213c54ed0a17db448e9b2 /scripts/kconfig/lxdialog | |
| parent | 3ee68c4af3fd7228c1be63254b9f884614f9ebb2 (diff) | |
kconfig: fix /dev/null breakage
While running "make menuconfig" and "make mrproper"
some people experienced that /dev/null suddenly changed
permissions or suddenly became a regular file.
The main reason was that /dev/null was used as output
to gcc in the check-lxdialog.sh script and gcc did
some strange things with the output file; in this
case /dev/null when it errorred out.
Following patch implements a suggestion
from Bryan O'Sullivan <bos@serpentine.com> to
use gcc -print-file-name=libxxx.so.
Also the Makefile is adjusted to not resolve value of
HOST_EXTRACFLAGS and HOST_LOADLIBES until they are actually used.
This prevents us from calling gcc when running make *clean/mrproper
Thanks to Eyal Lebedinsky <eyal@eyal.emu.id.au> and
Jean Delvare <khali@linux-fr.org> for the first error reports.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
Diffstat (limited to 'scripts/kconfig/lxdialog')
| -rw-r--r-- | scripts/kconfig/lxdialog/Makefile | 7 | ||||
| -rw-r--r-- | scripts/kconfig/lxdialog/check-lxdialog.sh | 14 |
2 files changed, 14 insertions, 7 deletions
diff --git a/scripts/kconfig/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile index fae3e29fc92..bbf4887cff7 100644 --- a/scripts/kconfig/lxdialog/Makefile +++ b/scripts/kconfig/lxdialog/Makefile | |||
| @@ -2,8 +2,11 @@ | |||
| 2 | # | 2 | # |
| 3 | 3 | ||
| 4 | check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh | 4 | check-lxdialog := $(srctree)/$(src)/check-lxdialog.sh |
| 5 | HOST_EXTRACFLAGS:= $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) | 5 | |
| 6 | HOST_LOADLIBES := $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | 6 | # Use reursively expanded variables so we do not call gcc unless |
| 7 | # we really need to do so. (Do not call gcc as part of make mrproper) | ||
| 8 | HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) | ||
| 9 | HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | ||
| 7 | 10 | ||
| 8 | HOST_EXTRACFLAGS += -DLOCALE | 11 | HOST_EXTRACFLAGS += -DLOCALE |
| 9 | 12 | ||
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index 448e353923f..120d624e672 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
| @@ -4,17 +4,17 @@ | |||
| 4 | # What library to link | 4 | # What library to link |
| 5 | ldflags() | 5 | ldflags() |
| 6 | { | 6 | { |
| 7 | echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null | 7 | $cc -print-file-name=libncursesw.so | grep -q / |
| 8 | if [ $? -eq 0 ]; then | 8 | if [ $? -eq 0 ]; then |
| 9 | echo '-lncursesw' | 9 | echo '-lncursesw' |
| 10 | exit | 10 | exit |
| 11 | fi | 11 | fi |
| 12 | echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null | 12 | $cc -print-file-name=libncurses.so | grep -q / |
| 13 | if [ $? -eq 0 ]; then | 13 | if [ $? -eq 0 ]; then |
| 14 | echo '-lncurses' | 14 | echo '-lncurses' |
| 15 | exit | 15 | exit |
| 16 | fi | 16 | fi |
| 17 | echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null | 17 | $cc -print-file-name=libcurses.so | grep -q / |
| 18 | if [ $? -eq 0 ]; then | 18 | if [ $? -eq 0 ]; then |
| 19 | echo '-lcurses' | 19 | echo '-lcurses' |
| 20 | exit | 20 | exit |
| @@ -36,10 +36,13 @@ ccflags() | |||
| 36 | fi | 36 | fi |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | compiler="" | 39 | # Temp file, try to clean up after us |
| 40 | tmp=.lxdialog.tmp | ||
| 41 | trap "rm -f $tmp" 0 1 2 3 15 | ||
| 42 | |||
| 40 | # Check if we can link to ncurses | 43 | # Check if we can link to ncurses |
| 41 | check() { | 44 | check() { |
| 42 | echo "main() {}" | $cc -xc - -o /dev/null 2> /dev/null | 45 | echo "main() {}" | $cc -xc - -o $tmp 2> /dev/null |
| 43 | if [ $? != 0 ]; then | 46 | if [ $? != 0 ]; then |
| 44 | echo " *** Unable to find the ncurses libraries." 1>&2 | 47 | echo " *** Unable to find the ncurses libraries." 1>&2 |
| 45 | echo " *** make menuconfig require the ncurses libraries" 1>&2 | 48 | echo " *** make menuconfig require the ncurses libraries" 1>&2 |
| @@ -59,6 +62,7 @@ if [ $# == 0 ]; then | |||
| 59 | exit 1 | 62 | exit 1 |
| 60 | fi | 63 | fi |
| 61 | 64 | ||
| 65 | cc="" | ||
| 62 | case "$1" in | 66 | case "$1" in |
| 63 | "-check") | 67 | "-check") |
| 64 | shift | 68 | shift |
