X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=scripts%2Fkconfig%2Flxdialog%2Fcheck-lxdialog.sh;h=120d624e672c5740faf2aa744aa7785c5edbecab;hb=94171db1d2f23c22b6050d210b72db3bb2f0b81e;hp=a3c141b49670f698fa541a44227dc100d89b6a02;hpb=d936cfc72032fb4af03d1edd99596d18ea1f081c;p=powerpc.git diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index a3c141b496..120d624e67 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 + $cc -print-file-name=libncursesw.so | grep -q / + if [ $? -eq 0 ]; then + echo '-lncursesw' + exit + fi + $cc -print-file-name=libncurses.so | grep -q / + if [ $? -eq 0 ]; then echo '-lncurses' + exit + fi + $cc -print-file-name=libcurses.so | grep -q / + if [ $? -eq 0 ]; then + echo '-lcurses' + exit fi + exit 1 } # Where is ncurses.h? @@ -25,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() {}" | $compiler -xc - + 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 @@ -48,16 +62,19 @@ if [ $# == 0 ]; then exit 1 fi +cc="" case "$1" in "-check") shift - compiler="$@" + cc="$@" check ;; "-ccflags") ccflags ;; "-ldflags") + shift + cc="$@" ldflags ;; "*")