[vlc-devel] [PATCH] Configure script learn "--with-qt-version=(4|5)" option.

Paweł Stankowski aambitny at gmail.com
Mon Nov 10 11:52:13 CET 2014


New option may be used to enforce installation of specific Qt version.
This is useful when both qt4 and qt5 are installed in the system.

---
 configure.ac | 64 ++++++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 23 deletions(-)

diff --git a/configure.ac b/configure.ac
index 620d49a..200d444 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3788,33 +3788,51 @@ AC_ARG_ENABLE(qt, [
     enable_qt="no"
   ])
 ])
-AS_IF([test "${enable_qt}" != "no"], [
-  PKG_CHECK_MODULES([QT], [Qt5Core >= 5.1.0 Qt5Widgets Qt5Gui], [
-      PKG_CHECK_MODULES([QTX11], [Qt5X11Extras], [
-          VLC_ADD_LIBS([qt4],[${QTX11_LIBS}])
-          VLC_ADD_CXXFLAGS([qt4],[${QTX11_CFLAGS} -DQT5_HAS_X11])
-      ],[
-          AC_MSG_WARN([Not building Qt Interface with X11 helpers.])
-      ])
-      QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
-      QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
-      AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}"
"${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
-      AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}"
"${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
-      AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}"
"${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
-    ], [
-      PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0],, [
-        AS_IF([test -n "${enable_qt}"],[
-          AC_MSG_ERROR([${QT_PKG_ERRORS}.])
+AC_ARG_WITH(qt-version, [
+  AS_HELP_STRING([--with-qt-version=MAJOR_VERSION], [Qt version to
link against (default auto)])],, [
+    with_qt_version="auto"
+])
+AS_IF([test "x${enable_qt}" != "xno"], [
+  have_qt_version="no"
+  AS_IF([test "x${with_qt_version}" = "xauto" || test
"x${with_qt_version}" = "x5"], [
+    PKG_CHECK_MODULES([QT], [Qt5Core >= 5.1.0 Qt5Widgets Qt5Gui], [
+        have_qt_version="5"
+        with_qt_version="5"
+        PKG_CHECK_MODULES([QTX11], [Qt5X11Extras], [
+            VLC_ADD_LIBS([qt4],[${QTX11_LIBS}])
+            VLC_ADD_CXXFLAGS([qt4],[${QTX11_CFLAGS} -DQT5_HAS_X11])
         ],[
-          AC_MSG_WARN([${QT_PKG_ERRORS}.])
+            AC_MSG_WARN([Not building Qt Interface with X11 helpers.])
         ])
-        enable_qt="no"
+        QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix Qt5Core)"
+        QT_HOST_PATH="$(eval $PKG_CONFIG --variable=host_bins Qt5Core)"
+        AC_PATH_PROGS(MOC, [moc-qt5 moc], moc, ["${QT_HOST_PATH}"
"${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
+        AC_PATH_PROGS(RCC, [rcc-qt5 rcc], rcc, ["${QT_HOST_PATH}"
"${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
+        AC_PATH_PROGS(UIC, [uic-qt5 uic], uic, ["${QT_HOST_PATH}"
"${QT_PATH}/bin" "${CONTRIB_DIR}/bin"])
+    ], [
+        AC_MSG_WARN([${QT_PKG_ERRORS}.])
       ])
-      QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
-      AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, ["${QT_PATH}/bin"
"${CONTRIB_DIR}/bin"])
-      AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
-      AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, ["${QT_PATH}/bin"
"${CONTRIB_DIR}/bin"])
+  ])
+  AS_IF([test "x${with_qt_version}" = "xauto" || test
"x${with_qt_version}" = "x4"], [
+    PKG_CHECK_MODULES([QT], [QtCore QtGui >= 4.6.0], [
+        have_qt_version="4"
+        with_qt_version="4"
+        QT_PATH="$(eval $PKG_CONFIG --variable=exec_prefix QtCore)"
+        AC_PATH_PROGS(MOC, [moc-qt4 moc], moc, ["${QT_PATH}/bin"
"${CONTRIB_DIR}/bin"])
+        AC_PATH_PROG(RCC, rcc, rcc, [${QT_PATH}/bin ${CONTRIB_DIR}/bin])
+        AC_PATH_PROGS(UIC, [uic-qt4 uic], uic, ["${QT_PATH}/bin"
"${CONTRIB_DIR}/bin"])
+      ], [
+        AC_MSG_WARN([${QT_PKG_ERRORS}.])
+      ])
+  ])
+  AS_IF([test "x${have_qt_version}" = "xno"], [
+    AS_IF([test -n "${enable_qt}"],[
+      AC_MSG_ERROR([Could not find Qt libraries.])
+    ],[
+      AC_MSG_WARN([Could not find Qt libraries.])
     ])
+    enable_qt="no"
+  ])
 ])
 AS_IF([test "${enable_qt}" != "no"], [
   VLC_ADD_PLUGIN([qt4])
--
2.0.4



More information about the vlc-devel mailing list