[vlc-devel] [PATCH] configure.ac: add option to disable Qt check

Alexandre Janniaux ajanni at videolabs.io
Thu Sep 26 16:03:56 CEST 2019


Qt check is useless for static build and can take some time during the
startup or fail when using development tools.
---
 configure.ac               |  5 +++++
 modules/gui/qt/Makefile.am |  4 ++++
 modules/gui/qt/qt.cpp      | 18 +++++++++++-------
 3 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 210b4ca5371..8b7da87a3a7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3932,6 +3932,11 @@ AC_ARG_ENABLE([qt-qml-debug],
   AS_HELP_STRING([--enable-qt-qml-debug], [enable qml debuger]))
 AM_CONDITIONAL(QT_QML_DEBUG, [test "${enable_qt_qml_debug}" = "yes"])
 
+AC_ARG_ENABLE([qt-check],
+  AS_HELP_STRING([--enable-qt-check],
+    [enable Qt check before starting the interface]))
+AM_CONDITIONAL([HAVE_QT_CHECK], [test "${enable_qt_check}" != "no"])
+
 AS_IF([test "${enable_qt}" != "no"], [
   ALIASES="${ALIASES} qvlc"
 ])
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index af4a5d05cc8..06c372d6cbb 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -681,16 +681,20 @@ gui/qt/resources.cpp: gui/qt/vlc.qrc $(libqt_plugin_la_RES) $(libqt_plugin_la_QM
 
 endif
 
+if HAVE_QT_CHECK
 vlc_qt_check_SOURCES = gui/qt/vlc-qt-check.cpp
 vlc_qt_check_CXXFLAGS = $(AM_CXXFLAGS) $(QT_CFLAGS) -fPIC
 vlc_qt_check_LDADD = $(QT_LIBS)
+endif
 
 if ENABLE_QT
 gui_LTLIBRARIES += libqt_plugin.la
 BUILT_SOURCES += $(nodist_libqt_plugin_la_SOURCES)
 if !HAVE_WIN32
 if !HAVE_OS2
+if HAVE_QT_CHECK
 pkglibexec_PROGRAMS += vlc-qt-check
 endif
 endif
 endif
+endif
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index 798f1c41e82..a5796fbd535 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -29,14 +29,16 @@
 
 #include <stdlib.h>
 #include <unistd.h>
-#ifndef _POSIX_SPAWN
-# define _POSIX_SPAWN (-1)
-#endif
-#if (_POSIX_SPAWN >= 0)
-# include <spawn.h>
-# include <sys/wait.h>
 
+#ifdef HAVE_QT_CHECK
+# ifndef _POSIX_SPAWN
+#  define _POSIX_SPAWN (-1)
+# endif
+# if (_POSIX_SPAWN >= 0)
+#  include <spawn.h>
+#  include <sys/wait.h>
 extern "C" char **environ;
+# endif
 #endif
 
 #include <QApplication>
@@ -411,7 +413,8 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
         return VLC_EGENERIC;
 #endif
 
-#if (_POSIX_SPAWN >= 0)
+#ifdef HAVE_QT_CHECK
+# if (_POSIX_SPAWN >= 0)
     /* Check if QApplication works */
     char *path = config_GetSysPath(VLC_PKG_LIBEXEC_DIR, "vlc-qt-check");
     if (unlikely(path == NULL))
@@ -433,6 +436,7 @@ static int Open( vlc_object_t *p_this, bool isDialogProvider )
         msg_Dbg(p_this, "Qt check failed (%d). Skipping.", status);
         return VLC_EGENERIC;
     }
+# endif
 #endif
 
     /* Get the playlist before the lock to avoid a lock-order-inversion */
-- 
2.23.0



More information about the vlc-devel mailing list