diff options
author | Titus von Boxberg <titus@v9g.de> | 2010-05-24 16:33:45 +0200 |
---|---|---|
committer | Titus von Boxberg <titus@v9g.de> | 2010-05-24 16:33:45 +0200 |
commit | 5428b220d6ec522ed8fe3a893aa653ed9639bf57 (patch) | |
tree | f31d2822192ec99c19d465e87fcc38de6c797990 /kconfig/lxdialog | |
parent | d2d3c15c1409e70ed758aab0e5da31ff15c3f500 (diff) | |
download | crosstool-ng-5428b220d6ec522ed8fe3a893aa653ed9639bf57.tar.gz crosstool-ng-5428b220d6ec522ed8fe3a893aa653ed9639bf57.tar.bz2 crosstool-ng-5428b220d6ec522ed8fe3a893aa653ed9639bf57.zip |
kconfig/lxdialog: more portable and use ncurses from macports on MacOS
check-lxdialog.sh now correctly tests for ncurses and is a bit more portable.
On Darwin it uses the ncurses from macports.
Diffstat (limited to 'kconfig/lxdialog')
-rw-r--r-- | kconfig/lxdialog/check-lxdialog.sh | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/kconfig/lxdialog/check-lxdialog.sh b/kconfig/lxdialog/check-lxdialog.sh index fcef0f59..a576d1ce 100644 --- a/kconfig/lxdialog/check-lxdialog.sh +++ b/kconfig/lxdialog/check-lxdialog.sh @@ -1,14 +1,24 @@ #!/bin/sh # Check ncurses compatibility +OS=`uname` + +# Under MACOS make sure that the macports-installed version is used. +case "$OS" in + Darwin) BASEDIR="/opt/local";; + *) BASEDIR="/usr";; +esac + +INCLUDEPATH="${BASEDIR}/include" +LIBPATH="${BASEDIR}/lib" + # What library to link ldflags() { for ext in so a dylib ; do for lib in ncursesw ncurses curses ; do - $cc -print-file-name=lib${lib}.${ext} | grep -q / - if [ $? -eq 0 ]; then - echo "-l${lib}" + if [ -f "${LIBPATH}/lib${lib}.${ext}" ]; then + echo "-L${LIBPATH} -l${lib}" exit fi done @@ -19,14 +29,20 @@ ldflags() # Where is ncurses.h? ccflags() { - if [ -f /usr/include/ncurses/ncurses.h ]; then - echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' - elif [ -f /usr/include/ncurses/curses.h ]; then - echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' - elif [ -f /usr/include/ncurses.h ]; then - echo '-DCURSES_LOC="<ncurses.h>"' + if [ -f "${INCLUDEPATH}/ncursesw/ncurses.h" ]; then + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncursesw/ncurses.h>\"" + elif [ -f "${INCLUDEPATH}/ncurses/ncurses.h" ]; then + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses/ncurses.h>\"" + elif [ -f "${INCLUDEPATH}/ncursesw/curses.h" ]; then + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncursesw/curses.h>\"" + elif [ -f "${INCLUDEPATH}/ncurses/curses.h" ]; then + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses/curses.h>\"" + elif [ -f "${INCLUDEPATH}/ncurses.h" ]; then + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<ncurses.h>\"" + elif [ -f "${INCLUDEPATH}/curses.h" ]; then + echo "-I${INCLUDEPATH} \"-DCURSES_LOC=<curses.h>\"" else - echo '-DCURSES_LOC="<curses.h>"' + exit 1 fi } @@ -36,7 +52,8 @@ trap "rm -f $tmp" 0 1 2 3 15 # Check if we can link to ncurses check() { - $cc -xc - -o $tmp 2>/dev/null <<'EOF' + IF=`echo $(ccflags) | sed -e 's/"//g'` + $cc $IF $(ldflags) -xc - -o $tmp 2>/dev/null <<'EOF' #include CURSES_LOC main() {} EOF |