This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1 of 1] kconfig/lxdialog/check-lxdialog.sh: more portable and use ncurses from macports on MacOS


# HG changeset patch
# User Titus von Boxberg <titus@v9g.de>
# Date 1274603207 -7200
# Node ID b573df44cce6f9beb85e438a652eac5e47acdf3d
# Parent  ab72df28f3630f4c577d3f3a4fd40e11320f78d3
kconfig/lxdialog/check-lxdialog.sh: 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.

diff -r ab72df28f363 -r b573df44cce6 kconfig/kconfig.mk
--- a/kconfig/kconfig.mk	Sat May 22 02:20:36 2010 +0200
+++ b/kconfig/kconfig.mk	Sun May 23 10:26:47 2010 +0200
@@ -65,7 +65,7 @@
 check_lxdialog = $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh
 
 # Build flags
-CFLAGS = 
+CFLAGS =
 LDFLAGS =
 
 # Compiler flags to use gettext
diff -r ab72df28f363 -r b573df44cce6 kconfig/lxdialog/check-lxdialog.sh
--- a/kconfig/lxdialog/check-lxdialog.sh	Sat May 22 02:20:36 2010 +0200
+++ b/kconfig/lxdialog/check-lxdialog.sh	Sun May 23 10:26:47 2010 +0200
@@ -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 @@
 # 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 @@
 
 # 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

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]