---
 configure.ac                        |   59 +++++++++++++++++++-----------------
 starpu-top/communicationmanager.cpp |    4 ++
 starpu-top/main.cpp                 |    2 -
 starpu-top/qwt/qwt_knob.cpp         |    2 +
 starpu-top/qwt/qwt_painter.cpp      |    4 +-
 starpu-top/qwt/qwt_plot.cpp         |    4 +-
 starpu-top/qwt/qwt_plot_layout.cpp  |    2 -
 starpu-top/qwt/qwt_scale_map.cpp    |    4 +-
 starpu-top/qwt/qwt_scale_map.h      |    4 +-
 starpu-top/qwt/qwt_series_data.cpp  |    4 +-
 starpu-top/qwt/qwt_slider.cpp       |    2 +
 starpu-top/qwt/qwt_thermo.cpp       |    2 +
 12 files changed, 54 insertions(+), 39 deletions(-)

--- a/starpu-top/qwt/qwt_scale_map.h
+++ b/starpu-top/qwt/qwt_scale_map.h
@@ -101,8 +101,8 @@ public:
     double pDist() const;
     double sDist() const;
 
-    QT_STATIC_CONST double LogMin;
-    QT_STATIC_CONST double LogMax;
+    static const double LogMin;
+    static const double LogMax;
 
     static QRectF transform( const QwtScaleMap &,
         const QwtScaleMap &, const QRectF & );
--- a/starpu-top/qwt/qwt_scale_map.cpp
+++ b/starpu-top/qwt/qwt_scale_map.cpp
@@ -17,8 +17,8 @@
 #define qExp(x) ::exp(x)
 #endif
 
-QT_STATIC_CONST_IMPL double QwtScaleMap::LogMin = 1.0e-150;
-QT_STATIC_CONST_IMPL double QwtScaleMap::LogMax = 1.0e150;
+const double QwtScaleMap::LogMin = 1.0e-150;
+const double QwtScaleMap::LogMax = 1.0e150;
 
 //! Constructor for a linear transformation
 QwtScaleTransformation::QwtScaleTransformation( Type type ):
--- a/starpu-top/main.cpp
+++ b/starpu-top/main.cpp
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fi
 */
 
 
-#include <QtGui/QApplication>
+#include <QApplication>
 #include "mainwindow.h"
 #include <string.h>
 #include <config.h>
--- a/starpu-top/qwt/qwt_slider.cpp
+++ b/starpu-top/qwt/qwt_slider.cpp
@@ -333,7 +333,9 @@ void QwtSlider::scaleChange()
 //! Notify change in font
 void QwtSlider::fontChange( const QFont &f )
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QwtAbstractSlider::fontChange( f );
+#endif
     layoutSlider();
 }
 
--- a/starpu-top/qwt/qwt_series_data.cpp
+++ b/starpu-top/qwt/qwt_series_data.cpp
@@ -294,10 +294,10 @@ QwtPointArrayData::QwtPointArrayData( co
         const double *y, size_t size )
 {
     d_x.resize( size );
-    qMemCopy( d_x.data(), x, size * sizeof( double ) );
+    memcpy( d_x.data(), x, size * sizeof( double ) );
 
     d_y.resize( size );
-    qMemCopy( d_y.data(), y, size * sizeof( double ) );
+    memcpy( d_y.data(), y, size * sizeof( double ) );
 }
 
 /*!
--- a/starpu-top/qwt/qwt_plot_layout.cpp
+++ b/starpu-top/qwt/qwt_plot_layout.cpp
@@ -1131,7 +1131,7 @@ void QwtPlotLayout::activate( const QwtP
         // subtract d_data->legendRect from rect
 
         const QRegion region( rect.toRect() );
-        rect = region.subtract( d_data->legendRect.toRect() ).boundingRect();
+        rect = region.subtracted( d_data->legendRect.toRect() ).boundingRect();
 
         switch ( d_data->legendPos )
         {
--- a/starpu-top/qwt/qwt_thermo.cpp
+++ b/starpu-top/qwt/qwt_thermo.cpp
@@ -428,7 +428,9 @@ QwtThermo::ScalePos QwtThermo::scalePosi
 //! Notify a font change.
 void QwtThermo::fontChange( const QFont &f )
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QWidget::fontChange( f );
+#endif
     layoutThermo();
 }
 
--- a/starpu-top/qwt/qwt_plot.cpp
+++ b/starpu-top/qwt/qwt_plot.cpp
@@ -372,9 +372,9 @@ void QwtPlot::updateLayout()
             {
                 QRegion r( scaleRect[axisId] );
                 if ( axisEnabled( yLeft ) )
-                    r = r.subtract( QRegion( scaleRect[yLeft] ) );
+                    r = r.subtracted( QRegion( scaleRect[yLeft] ) );
                 if ( axisEnabled( yRight ) )
-                    r = r.subtract( QRegion( scaleRect[yRight] ) );
+                    r = r.subtracted( QRegion( scaleRect[yRight] ) );
                 r.translate( -d_data->layout->scaleRect( axisId ).x(),
                     -scaleRect[axisId].y() );
 
--- a/starpu-top/qwt/qwt_knob.cpp
+++ b/starpu-top/qwt/qwt_knob.cpp
@@ -492,7 +492,9 @@ void QwtKnob::scaleChange()
 */
 void QwtKnob::fontChange( const QFont &f )
 {
+#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
     QwtAbstractSlider::fontChange( f );
+#endif
     layoutKnob();
 }
 
--- a/starpu-top/qwt/qwt_painter.cpp
+++ b/starpu-top/qwt/qwt_painter.cpp
@@ -224,7 +224,7 @@ void QwtPainter::fillRect( QPainter *pai
 
     QRectF r = rect;
     if ( deviceClipping )
-        r = r.intersect( clipRect );
+        r = r.intersected( clipRect );
 
     if ( r.isValid() )
         painter->fillRect( r, brush );
@@ -398,7 +398,7 @@ void QwtPainter::drawPolyline( QPainter
     if ( deviceClipping )
     {
         QPolygonF polygon( pointCount );
-        qMemCopy( polygon.data(), points, pointCount * sizeof( QPointF ) );
+        memcpy( polygon.data(), points, pointCount * sizeof( QPointF ) );
 
         polygon = QwtClipper::clipPolygonF( clipRect, polygon );
         ::drawPolyline( painter,
--- a/starpu-top/communicationmanager.cpp
+++ b/starpu-top/communicationmanager.cpp
@@ -1296,7 +1296,11 @@ void CommunicationManager::sendMessage(Q
 {
     messageString.append(COM_MSG_ENDL);
 
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+    write(messageString.toLatin1());
+#else
     write(messageString.toAscii());
+#endif
 }
 
 void CommunicationManager::sendGoMessage()
--- a/configure.ac
+++ b/configure.ac
@@ -1989,43 +1989,48 @@ AC_MSG_CHECKING(for StarPU-Top)
 
 if test "x$enable_starpu_top" != "xno" ; then
 	can_build_starpu_top=no
-	AC_PATH_PROGS([QMAKE], [qmake-qt4 qmake], [not-found])
+	AC_PATH_PROGS([QMAKE], [qmake], [not-found])
 	if test x$QMAKE != xnot-found; then
 		QMAKE_VERSION=`$QMAKE --version 2>&1 | head -n 1 | cut -d '.' -f 1 | cut -d ' ' -f 3`
-		if test $QMAKE_VERSION -ge 2 ; then
+		QT_VERSION=`$QMAKE --version 2>&1 | tail -n 1 | cut -d '.' -f 1 | cut -d ' ' -f 4`
+		if test $QT_VERSION -ge 5 ; then
+			can_build_starpu_top=yes
+		elif test $QMAKE_VERSION -ge 2 ; then
 			PKG_CHECK_EXISTS([QtGui QtNetwork QtOpenGL QtSql], [
 				QT_MAJVERSION=`$PKG_CONFIG --modversion QtGui | cut -d '.' -f 1`
 				QT_MINVERSION=`$PKG_CONFIG --modversion QtGui | cut -d '.' -f 2`
 				if test $QT_MAJVERSION -gt 4 -o \( $QT_MAJVERSION -eq 4 -a $QT_MINVERSION -ge 7 \) ; then
 					can_build_starpu_top=yes
 				fi
-				QWT_PRI=embed
-				AC_ARG_WITH(qwt-include-dir,
-					[AS_HELP_STRING([--with-qwt-include-dir=<path>],
-					[specify installed libqwt include path])],
-					[
-						STARPU_QWT_INCLUDE="$withval"
-						AC_SUBST(STARPU_QWT_INCLUDE)
-						QWT_PRI=system
-					])
-				AC_ARG_WITH(qwt-lib-dir,
-					[AS_HELP_STRING([--with-qwt-lib-dir=<path>],
-					[specify installed libqwt library path])],
-					[
-						STARPU_QWT_LDFLAGS="-L$withval"
-						QWT_PRI=system
-					])
-				AC_ARG_WITH(qwt-lib,
-					[AS_HELP_STRING([--with-qwt-lib=<name>],
-					[specify installed libqwt library name])],
-					[
-						STARPU_QWT_LDFLAGS="${STARPU_QWT_LDFLAGS} -l$withval"
-						QWT_PRI=system
-					])
-				AC_SUBST(STARPU_QWT_LDFLAGS)
-				AC_SUBST(QWT_PRI)
 			])
 		fi
+		if test x$can_build_starpu_top = xyes; then
+			QWT_PRI=embed
+			AC_ARG_WITH(qwt-include-dir,
+				[AS_HELP_STRING([--with-qwt-include-dir=<path>],
+				[specify installed libqwt include path])],
+				[
+					STARPU_QWT_INCLUDE="$withval"
+					AC_SUBST(STARPU_QWT_INCLUDE)
+					QWT_PRI=system
+				])
+			AC_ARG_WITH(qwt-lib-dir,
+				[AS_HELP_STRING([--with-qwt-lib-dir=<path>],
+				[specify installed libqwt library path])],
+				[
+					STARPU_QWT_LDFLAGS="-L$withval"
+					QWT_PRI=system
+				])
+			AC_ARG_WITH(qwt-lib,
+				[AS_HELP_STRING([--with-qwt-lib=<name>],
+				[specify installed libqwt library name])],
+				[
+					STARPU_QWT_LDFLAGS="${STARPU_QWT_LDFLAGS} -l$withval"
+					QWT_PRI=system
+				])
+			AC_SUBST(STARPU_QWT_LDFLAGS)
+			AC_SUBST(QWT_PRI)
+		fi
 	fi
 fi
 
