mirror of
https://github.com/crosstool-ng/crosstool-ng.git
synced 2025-02-20 09:06:19 +00:00
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.
This commit is contained in:
parent
d2d3c15c14
commit
5428b220d6
@ -65,7 +65,7 @@ check_gettext = $(CT_LIB_DIR)/kconfig/check-gettext.sh
|
||||
check_lxdialog = $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh
|
||||
|
||||
# Build flags
|
||||
CFLAGS =
|
||||
CFLAGS =
|
||||
LDFLAGS =
|
||||
|
||||
# Compiler flags to use gettext
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user