qmlglsink: Fix build error when don't have QPA installed.
authorHaihua Hu <jared.hu@nxp.com>
Mon, 27 Jun 2016 10:15:08 +0000 (18:15 +0800)
committerMatthew Waters <matthew@centricular.com>
Mon, 27 Jun 2016 12:44:56 +0000 (22:44 +1000)
Check header file existance and wrap the header file include
in the necessary #ifdef to avoid build error.

https://bugzilla.gnome.org/show_bug.cgi?id=767553

configure.ac
ext/qt/qtitem.cc

index 6da6f18..88f77d7 100644 (file)
@@ -2874,7 +2874,10 @@ AG_GST_CHECK_FEATURE(QT, [Qt elements], qt, [
         HAVE_QT_WINDOWING="no"
         QT_VERSION="`$PKG_CONFIG --modversion Qt5Core`"
         QPA_INCLUDE_PATH=`$PKG_CONFIG --variable=includedir Qt5Core`/QtGui/${QT_VERSION}/QtGui
-        AC_SUBST(QPA_INCLUDE_PATH)
+        AS_IF([test -f "$QPA_INCLUDE_PATH/qpa/qplatformnativeinterface.h"], [
+          AC_SUBST(QPA_INCLUDE_PATH)
+          HAVE_QT_QPA_HEADER="yes"
+        ], [AC_MSG_NOTICE([Cannot find QPA])])
         if test "x$GST_GL_HAVE_WINDOW_X11" = "x1" -a "x$GST_GL_HAVE_PLATFORM_GLX" = "x1"; then
           PKG_CHECK_MODULES(QT_X11, Qt5X11Extras, [
             AC_DEFINE([HAVE_QT_X11], [], [Define if Qt X11 integration is installed])
@@ -2883,7 +2886,7 @@ AG_GST_CHECK_FEATURE(QT, [Qt elements], qt, [
             HAVE_QT_WINDOWING="yes"
           ], [AC_MSG_NOTICE([Could not find Qt X11 integration])])
         fi
-        if test "x$GST_GL_HAVE_WINDOW_WAYLAND" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1"; then
+        if test "x$GST_GL_HAVE_WINDOW_WAYLAND" = "x1" -a "x$GST_GL_HAVE_PLATFORM_EGL" = "x1" -a "x$HAVE_QT_QPA_HEADER" = "xyes"; then
           PKG_CHECK_MODULES(QT_WAYLAND, Qt5WaylandClient, [
             AC_DEFINE([HAVE_QT_WAYLAND], [],
                 [Define if Qt Wayland integration is installed])
index 67820b9..c306c6d 100644 (file)
@@ -32,7 +32,6 @@
 #include <QtGui/QGuiApplication>
 #include <QtQuick/QQuickWindow>
 #include <QtQuick/QSGSimpleTextureNode>
-#include <qpa/qplatformnativeinterface.h>
 
 #if GST_GL_HAVE_WINDOW_X11 && GST_GL_HAVE_PLATFORM_GLX && defined (HAVE_QT_X11)
 #include <QX11Info>
@@ -41,6 +40,7 @@
 #endif
 
 #if GST_GL_HAVE_WINDOW_WAYLAND && GST_GL_HAVE_PLATFORM_EGL && defined (HAVE_QT_WAYLAND)
+#include <qpa/qplatformnativeinterface.h>
 #include <gst/gl/wayland/gstgldisplay_wayland.h>
 #endif