]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - scripts/kconfig/lxdialog/check-lxdialog.sh
kconfig: fix /dev/null breakage
[linux-2.6-omap-h63xx.git] / scripts / kconfig / lxdialog / check-lxdialog.sh
index 448e353923f3b52545a7473d4ff5a4e342a7f959..120d624e672c5740faf2aa744aa7785c5edbecab 100644 (file)
@@ -4,17 +4,17 @@
 # What library to link
 ldflags()
 {
-       echo "main() {}" | $cc -lncursesw -xc - -o /dev/null 2> /dev/null
+       $cc -print-file-name=libncursesw.so | grep -q /
        if [ $? -eq 0 ]; then
                echo '-lncursesw'
                exit
        fi
-       echo "main() {}" | $cc -lncurses -xc - -o /dev/null 2> /dev/null
+       $cc -print-file-name=libncurses.so | grep -q /
        if [ $? -eq 0 ]; then
                echo '-lncurses'
                exit
        fi
-       echo "main() {}" | $cc -lcurses -xc - -o /dev/null 2> /dev/null
+       $cc -print-file-name=libcurses.so | grep -q /
        if [ $? -eq 0 ]; then
                echo '-lcurses'
                exit
@@ -36,10 +36,13 @@ ccflags()
        fi
 }
 
-compiler=""
+# Temp file, try to clean up after us
+tmp=.lxdialog.tmp
+trap "rm -f $tmp" 0 1 2 3 15
+
 # 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
@@ -59,6 +62,7 @@ if [ $# == 0 ]; then
        exit 1
 fi
 
+cc=""
 case "$1" in
        "-check")
                shift