1.1 --- a/kconfig/lxdialog/check-lxdialog.sh Wed Mar 04 18:56:07 2009 +0000
1.2 +++ b/kconfig/lxdialog/check-lxdialog.sh Tue Jun 15 20:04:01 2010 +0200
1.3 @@ -1,14 +1,24 @@
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 - $cc -print-file-name=lib${lib}.${ext} | grep -q /
1.24 - if [ $? -eq 0 ]; then
1.25 - echo "-l${lib}"
1.26 + if [ -f "${LIBPATH}/lib${lib}.${ext}" ]; then
1.27 + echo "-L${LIBPATH} -l${lib}"
1.28 exit
1.29 fi
1.30 done
1.31 @@ -19,14 +29,20 @@
1.32 # Where is ncurses.h?
1.33 ccflags()
1.34 {
1.35 - if [ -f /usr/include/ncurses/ncurses.h ]; then
1.36 - echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
1.37 - elif [ -f /usr/include/ncurses/curses.h ]; then
1.38 - echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
1.39 - elif [ -f /usr/include/ncurses.h ]; then
1.40 - echo '-DCURSES_LOC="<ncurses.h>"'
1.41 + if [ -f "${INCLUDEPATH}/ncursesw/ncurses.h" ]; then
1.42 + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncursesw/ncurses.h>\""
1.43 + elif [ -f "${INCLUDEPATH}/ncurses/ncurses.h" ]; then
1.44 + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses/ncurses.h>\""
1.45 + elif [ -f "${INCLUDEPATH}/ncursesw/curses.h" ]; then
1.46 + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncursesw/curses.h>\""
1.47 + elif [ -f "${INCLUDEPATH}/ncurses/curses.h" ]; then
1.48 + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses/curses.h>\""
1.49 + elif [ -f "${INCLUDEPATH}/ncurses.h" ]; then
1.50 + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses.h>\""
1.51 + elif [ -f "${INCLUDEPATH}/curses.h" ]; then
1.52 + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<curses.h>\""
1.53 else
1.54 - echo '-DCURSES_LOC="<curses.h>"'
1.55 + exit 1
1.56 fi
1.57 }
1.58
1.59 @@ -36,7 +52,8 @@
1.60
1.61 # Check if we can link to ncurses
1.62 check() {
1.63 - $cc -xc - -o $tmp 2>/dev/null <<'EOF'
1.64 + IF=`echo $(ccflags) | sed -e 's/"//g'`
1.65 + $cc $IF $(ldflags) -xc - -o $tmp 2>/dev/null <<'EOF'
1.66 #include CURSES_LOC
1.67 main() {}
1.68 EOF