Index: branches/qt_gui/acinclude.m4
===================================================================
--- branches/qt_gui/acinclude.m4	(revision 7607)
+++ branches/qt_gui/acinclude.m4	(revision 7608)
@@ -10,8 +10,8 @@
     if [test "x$_header_check" = "xyes" && test "x$_lib_check" = "xyes"] ; then
          LIBS="$LIBS -l$2"
-	 $4
+         $4
     else
          echo "no Support for $2"
-	 $5
+         $5
     fi
 ])
@@ -34,5 +34,5 @@
     if [test x$_header_check = "xyes" && test "x$_lib_check" = "xyes"] ; then
          LIBS="$LIBS -l$2"
-	 $4
+         $4
     else
          echo "------------------"
@@ -40,6 +40,167 @@
          echo "please install the $2-LIBRARY-package which can be found at $6"
          echo "------------------"
-	 $5
+         $5
          exit -1
     fi
 ])
+
+
+
+dnl AX_CHECK_REQUIRED_LIB([LIBRARY-NAME], [FUNCTION-IN-LIB], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
+AC_DEFUN([AX_CHECK_REQUIRED_LIB], [
+    _lib_check=""
+    _found_lib=""
+
+
+    for _lib in $1
+    do
+      AC_CHECK_LIB([$_lib], [$2], [_lib_check="yes"], [_lib_check="no"])
+      if test "x$_lib_check" = "xyes" ; then
+        _found_lib=$_lib
+        break
+      fi
+    done
+
+    if [test "x$_lib_check" = "xyes"] ; then
+         LIBS="$LIBS -l$_found_lib"
+         $3
+    else
+         echo "------------------"
+         echo "LIBRARY $1 not found."
+         echo "please install the $1-LIBRARY-package which can be found at $5"
+         echo "------------------"
+         $4
+         exit -1
+    fi
+])
+
+
+
+
+dnl AX_CHECK_QT([QTDIR], [LIBRARIES], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [LIB-WEB-PAGE])
+AC_DEFUN([AX_CHECK_QT], [
+    _lib_check=""
+    _found_lib=""
+    QT_PREFIX="$1"
+    QT_INCLUDE_DIRECTORY=""
+    QT_LIB_DIRECTORY=""
+
+
+    QT_COMMON_INCLUDE_DIRECTORIES="
+      `ls -dr ${QT_PREFIX}/include     2>/dev/null`
+      /usr/include
+      `ls -dr /usr/include/qt*         2>/dev/null`
+      `ls -dr /usr/lib/qt*/include     2>/dev/null`
+      `ls -dr /usr/local/qt*/include   2>/dev/null`
+      `ls -dr /opt/qt*/include         2>/dev/null`
+      `ls -dr /Developer/qt*/include   2>/dev/null`
+    "
+
+    QT_COMMON_LIB_DIRECTORIES="
+      `ls -dr ${QT_PREFIX}/lib         2>/dev/null`
+      /usr/include
+      `ls -dr /usr/lib/qt*             2>/dev/null`
+      `ls -dr /usr/lib/qt*             2>/dev/null`
+      `ls -dr /usr/local/qt*/lib       2>/dev/null`
+      `ls -dr /opt/qt*/lib             2>/dev/null`
+      `ls -dr /Developer/qt*/lib       2>/dev/null`
+    "
+
+    ## Search in all IncludeDirectories for QT-includes
+    for _include_directory in ${QT_COMMON_INCLUDE_DIRECTORIES}
+    do
+      if test -e ${_include_directory}/Qt/QtCore ; then
+        QT_INCLUDE_DIRECTORY=${_include_directory}
+        break
+      fi
+    done
+    if test -n ${QT_INCLUDE_DIRECTORY} ; then
+      echo "Qt-Include Directory is: ${QT_INCLUDE_DIRECTORY}"
+    else
+      AC_MSG_ERROR([Qt Headers not found])
+    fi
+
+## Search in all LibraryDirectories for QT-includes
+    for _lib_directory in ${QT_COMMON_LIB_DIRECTORIES}
+    do
+      if test -e ${_lib_directory}/libQtCore.so || test -e ${_lib_directory}/libQtCore.dll ; then
+        QT_LIB_DIRECTORY=${_lib_directory}
+        break
+      fi
+    done
+    if test -n ${QT_LIB_DIRECTORY} ; then
+      echo "Qt-Library Directory is: ${QT_LIB_DIRECTORY}"
+    else
+      AC_MSG_ERROR([Qt LIB not found])
+    fi
+
+## Setting up the Environment Variables.
+    QT_LIBS=""
+    QT_CXXFLAGS="-I${QT_INCLUDE_DIRECTORY}"
+    LDFLAGS="${LDFLAGS} -L${QT_LIB_DIRECTORY} -Wl,-rpath -Wl,${QT_LIB_DIRECTORY}"
+    QT_BIN_DIR="${QT_PREFIX}/bin"
+
+    CACHED_CPPFLAG=${CPPFLAGS}
+    CACHED_LDFLAGS=${LDFLAGS}
+
+    LDFLAGS="${LDFLAGS} ${QT_LDFLAGS}"
+    for _lib in $2
+    do
+      AC_CHECK_LIB([$_lib], [main], [_lib_check="yes"], [_lib_check="no"])
+      if test "x$_lib_check" = "xyes" ; then
+        _found_lib=$_lib
+        break
+      fi
+    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
+    else
+         echo "------------------"
+         echo "LIBRARY $2 not found.in $1"
+         echo "please install the $1-LIBRARY-package which can be found at $5"
+         echo "------------------"
+         $4
+         exit -1
+    fi
+
+    echo "QT_LIBS = ${QT_LIBS}"
+    echo "QT_CXXFLAGS = ${QT_CXXFLAGS}"
+    echo "QT_LD_FLAGS = ${QT_LDFLAGS}"
+
+    AC_SUBST([QT_LIBS])
+    AC_SUBST([QT_CXXFLAGS])
+    AC_SUBST([QT_LDFLAGS])
+
+    #----------#
+    # QT - MOC #
+    #----------#
+    AC_PATH_PROG([QT_MOC], [moc], [no], ["${QT_BIN_DIR}:${PATH}"])
+      if test x${QT_MOC} = xno ; then
+        AC_MSG_ERROR([QT MOC not found])
+      fi
+    AC_SUBST([QT_MOC])
+
+    AC_PATH_PROG([QT_UIC], [uic], [no], ["${QT_BIN_DIR}:${PATH}"])
+ #     if test x${QT_UIC} = xno ; then
+ #       AC_MSG_WARN([QT UIC not found])
+ #     fi
+    AC_SUBST([QT_UIC])
+
+    AC_PATH_PROG([QT_RCC], [rcc], [no], ["${QT_BIN_DIR}:${PATH}"])
+#      if test x${QT_RCC} = xno ; then
+#        AC_MSG_WARN([QT RCC not found])
+#      fi
+    AC_SUBST([QT_RCC])
+
+
+
+    # Restore Values of CPPFLAGS and LDFLAGS
+    CPPFLAGS=${CACHED_CPPFLAG}
+    LDFLAGS=${CACHED_LDFLAGS}
+])
