[vlc-devel] [PATCH] configure.ac: add option to disable Qt check
Alexandre Janniaux
ajanni at videolabs.io
Fri Sep 27 10:18:46 CEST 2019
Qt check is useless for builds that require the Qt interface to be used
like embedded systems targets or that cannot fail to start like for
Windows static builds. As it takes time to start the vlc-qt-check, this
patch provides a way to disable this.
This shouldn't be used for any other build or test.
---
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..b864ab2e483 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([--disable-qt-check],
+ [Disable Qt check before starting the interface. This will prevent Qt module from determining if it can start correctly, and crash if it cannot.]))
+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