Index: branches/terrain/acinclude.m4
===================================================================
--- branches/terrain/acinclude.m4	(revision 8697)
+++ branches/terrain/acinclude.m4	(revision 8715)
@@ -105,4 +105,5 @@
       `ls -dr /usr/local/qt*/include   2>/dev/null`
       `ls -dr /opt/qt*/include         2>/dev/null`
+      `ls -dr /opt/local/include       2>/dev/null`
       `ls -dr /Developer/qt*/include   2>/dev/null`
       `ls -dr /c/Qt/*/include          2>/dev/null`
@@ -115,4 +116,5 @@
       `ls -dr /usr/local/qt*/lib       2>/dev/null`
       `ls -dr /opt/qt*/lib             2>/dev/null`
+      `ls -dr /opt/local/lib  		   2>/dev/null`
       `ls -dr /Developer/qt*/lib       2>/dev/null`
       `ls -dr /c/Qt/*/lib              2>/dev/null`
@@ -125,4 +127,5 @@
       `ls -dr /usr/local/qt*/bin       2>/dev/null`
       `ls -dr /opt/qt*/bin             2>/dev/null`
+      `ls -dr /opt/local/bin		      2>/dev/null`
       `ls -dr /Developer/qt*/bin       2>/dev/null`
       `ls -dr /c/Qt/*/bin              2>/dev/null`
@@ -175,6 +178,9 @@
     QT_LIBS=""
     QT_CXXFLAGS="-I${QT_INCLUDE_DIRECTORY}"
-    LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}"
-
+	 if test x$osX = xyes ; then
+		LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY}"
+	 else
+    	LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}"
+	 fi
     CACHED_CPPFLAG=${CPPFLAGS}
     CACHED_LDFLAGS=${LDFLAGS}
@@ -190,11 +196,17 @@
     done
 
-    if [test "x$_lib_check" = "xyes"] ; then
-         QT_LIBS="${QT_LIBS} -l$_found_lib"
-         AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] )
-         AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] )
-         AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] )
-
-         $3
+    if [test "x$_lib_check" = "xyes" || test "x$osX" = "xyes"] ; then
+			if [test x$osX = xyes] ; then
+# kraus: Need to add a check here. For the moment this just works fine...
+				QT_LIBS="${QT_LIBS} -framework QtCore -framework QtGui -framework QtOpenGL"
+				QT_LD_FLAGS="${QT_LD_FLAGS} -L${QT_LIB_DIRECTORY}"
+			else
+         	QT_LIBS="${QT_LIBS} -l$_found_lib"
+         	AX_CHECK_REQUIRED_LIB([QtCore QtCore4], [main],,,[http://www.trolltech.com] )
+         	AX_CHECK_REQUIRED_LIB([QtGui QtGui4], [main],,,[http://www.trolltech.com] )
+         	AX_CHECK_REQUIRED_LIB([QtOpenGL QtOpenGL4], [main],,,[http://www.trolltech.com] )
+
+         	$3
+			fi
     else
          echo "------------------"
@@ -205,5 +217,5 @@
          exit -1
     fi
-
+	 echo "configuration for qt: "
     echo "QT_LIBS          = ${QT_LIBS}"
     echo "QT_CXXFLAGS      = ${QT_CXXFLAGS}"
@@ -251,5 +263,5 @@
 dnl Check for Lua.
 
-LUA_INCLUDE_DIRECTORY="/usr/include"
+LUA_INCLUDE_DIRECTORY="/$prefix/include"
 LUA_COMMON_INCLUDE_DIRECTORIES="
       `ls -dr $1                       2>/dev/null`
@@ -259,4 +271,5 @@
       `ls -dr /usr/local/include/lua   2>/dev/null`
       `ls -dr /opt/lua*/include        2>/dev/null`
+      `ls -dr /opt/local/include       2>/dev/null`
       `ls -dr /Developer/lua*/include  2>/dev/null`
     "
@@ -276,5 +289,23 @@
     fi
 
-
+if [ test x$osX = xyes ] ; then
+	LUA_COMMON_LIB_DIRECTORIES="
+     	`ls -dr $1                    2>/dev/null`
+      /usr/lib
+      `ls -dr /usr/lib/lua*        2>/dev/null`
+      `ls -dr /usr/local/lib/lua   2>/dev/null`
+      `ls -dr /opt/lua*/lib        2>/dev/null`
+      `ls -dr /opt/local/lib       2>/dev/null`
+      `ls -dr /Developer/lua*/lib  2>/dev/null`
+	 "
+  for _lua_lib_directory in ${LUA_COMMON_LIB_DIRECTORIES}
+    do
+      if test -e ${_lua_lib_directory}/liblua.a  || test -e ${_lua_lib_directory}/liblua.dylib ; then
+        LUA_LIB_DIRECTORY=${_lua_lib_directory}
+        LDFLAGS="${LDFLAGS} -L${LUA_LIB_DIRECTORY} -llua"
+        break
+      fi
+  done	
+else
 AC_CHECK_LIB([dl], [dlopen])
 AX_CHECK_REQUIRED_HEADER_LIB([lua.h], [lua lua50], [lua_open],,,)
@@ -288,5 +319,5 @@
 #       [AX_GET_INSTALL_NECESSARY_LIB([http://www.lua.org/ftp], [lua-5.0.tar.gz], [lua-5.0], [extern_libs/], [include/*.h lib/*.a])
 #       LUA_LIBS="-llualib -llua"  LUA_INCLUDES="-I$(top_build_dir)/extern_libs" ], [http://www.lua.org])
-
+fi
 AC_SUBST([LUA_LIBS])
 AC_SUBST([LUA_INCLUDES])
