+# Qt detection
+have_qt=no
+if test -n "$QTDIR" -a -f $QTDIR/include/qglobal.h; then
+ have_qt=yes
+ DBUS_QT_CXXFLAGS=-I$QTDIR/include
+fi
+
+dnl linking to kdecore will give us a bit of help from libtool
+kdelibs=`kde-config --install lib --expandvars 2>/dev/null`
+if test -z $kdelibs -a -f $kdelibs/libkdecore.la; then
+ have_qt=no
+else
+ DBUS_QT_LIBS=$kdelibs/libkdecore.la
+fi
+
+if test x$have_qt = xno ; then
+ AC_MSG_WARN([Qt development libraries not found])
+fi
+
+if test x$enable_qt = xyes; then
+ if test x$have_qt = xno; then
+ AC_MSG_ERROR([Qt integration explicitly required, and Qt libraries not found])
+ fi
+fi
+
+if test x$enable_qt = xno; then
+ have_qt=no;
+fi
+
+AM_CONDITIONAL(HAVE_QT, test x$have_qt = xyes)
+
+dnl Qt flags
+AC_SUBST(DBUS_QT_CXXFLAGS)
+AC_SUBST(DBUS_QT_LIBS)
+