kconfig/lxdialog/check-lxdialog.sh
changeset 2125 4009fc9c47d5
parent 1973 20f02d426e15
child 2448 a103abae1560
     1.1 --- a/kconfig/lxdialog/check-lxdialog.sh	Mon May 24 16:33:45 2010 +0200
     1.2 +++ b/kconfig/lxdialog/check-lxdialog.sh	Mon Oct 04 00:16:56 2010 +0200
     1.3 @@ -1,24 +1,14 @@
     1.4  #!/bin/sh
     1.5  # Check ncurses compatibility
     1.6  
     1.7 -OS=`uname`
     1.8 -
     1.9 -# Under MACOS make sure that the macports-installed version is used.
    1.10 -case "$OS" in
    1.11 -	Darwin) BASEDIR="/opt/local";;
    1.12 -	*)      BASEDIR="/usr";;
    1.13 -esac
    1.14 -
    1.15 -INCLUDEPATH="${BASEDIR}/include"
    1.16 -LIBPATH="${BASEDIR}/lib"
    1.17 -
    1.18  # What library to link
    1.19  ldflags()
    1.20  {
    1.21  	for ext in so a dylib ; do
    1.22  		for lib in ncursesw ncurses curses ; do
    1.23 -			if [ -f "${LIBPATH}/lib${lib}.${ext}" ]; then
    1.24 -				echo "-L${LIBPATH} -l${lib}"
    1.25 +			$cc -print-file-name=lib${lib}.${ext} | grep -q /
    1.26 +			if [ $? -eq 0 ]; then
    1.27 +				echo "-l${lib}"
    1.28  				exit
    1.29  			fi
    1.30  		done
    1.31 @@ -29,20 +19,14 @@
    1.32  # Where is ncurses.h?
    1.33  ccflags()
    1.34  {
    1.35 -	if [ -f "${INCLUDEPATH}/ncursesw/ncurses.h" ]; then
    1.36 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncursesw/ncurses.h>\""
    1.37 -	elif [ -f "${INCLUDEPATH}/ncurses/ncurses.h" ]; then
    1.38 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses/ncurses.h>\""
    1.39 -	elif [ -f "${INCLUDEPATH}/ncursesw/curses.h" ]; then
    1.40 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncursesw/curses.h>\""
    1.41 -	elif [ -f "${INCLUDEPATH}/ncurses/curses.h" ]; then
    1.42 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses/curses.h>\""
    1.43 -	elif [ -f "${INCLUDEPATH}/ncurses.h" ]; then
    1.44 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses.h>\""
    1.45 -	elif [ -f "${INCLUDEPATH}/curses.h" ]; then
    1.46 -		echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<curses.h>\""
    1.47 +	if [ -f /usr/include/ncurses/ncurses.h ]; then
    1.48 +		echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
    1.49 +	elif [ -f /usr/include/ncurses/curses.h ]; then
    1.50 +		echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
    1.51 +	elif [ -f /usr/include/ncurses.h ]; then
    1.52 +		echo '-DCURSES_LOC="<ncurses.h>"'
    1.53  	else
    1.54 -		exit 1
    1.55 +		echo '-DCURSES_LOC="<curses.h>"'
    1.56  	fi
    1.57  }
    1.58  
    1.59 @@ -52,8 +36,7 @@
    1.60  
    1.61  # Check if we can link to ncurses
    1.62  check() {
    1.63 -        IF=`echo $(ccflags) | sed -e 's/"//g'`
    1.64 -        $cc $IF $(ldflags) -xc - -o $tmp 2>/dev/null <<'EOF'
    1.65 +        $cc -xc - -o $tmp 2>/dev/null <<'EOF'
    1.66  #include CURSES_LOC
    1.67  main() {}
    1.68  EOF