2008-08-27 20:38:55 +00:00
|
|
|
dnl
|
2014-01-16 11:02:57 +00:00
|
|
|
dnl Check for Qt 5
|
2008-08-27 20:38:55 +00:00
|
|
|
dnl
|
|
|
|
|
2019-11-07 20:28:34 +00:00
|
|
|
qt_min_ver=5.9.0
|
2016-12-17 11:40:49 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
check_qt5() {
|
|
|
|
AC_ARG_WITH(qmake,
|
|
|
|
AC_HELP_STRING([--with-qmake=prog],[use prog instead of looking for qmake for Qt 5]),
|
|
|
|
[ QMAKE="$with_qmake" ],)
|
2015-04-19 17:54:16 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if ! test -z "$QMAKE"; then
|
|
|
|
AC_MSG_CHECKING(for qmake)
|
|
|
|
AC_MSG_RESULT(using supplied $QMAKE)
|
2008-08-27 20:38:55 +00:00
|
|
|
else
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_PATH_TOOL(QMAKE, qmake-qt5,, $PATH)
|
|
|
|
if test -z "$QMAKE"; then
|
|
|
|
AC_PATH_TOOL(QMAKE, qmake,, $PATH)
|
2008-08-27 20:38:55 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if test x"$QMAKE" = x; then
|
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
|
|
|
AC_MSG_RESULT(no: qmake not found)
|
|
|
|
return
|
2008-08-27 20:38:55 +00:00
|
|
|
fi
|
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
qmake_properties="`mktemp`"
|
|
|
|
|
|
|
|
"$QMAKE" -query > "$qmake_properties"
|
|
|
|
|
|
|
|
qmake_ver="`$ac_cv_path_EGREP '^QT_VERSION:' "$qmake_properties" | sed 's/^QT_VERSION://'`"
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_CHECKING(for qmake's version)
|
|
|
|
if test -z "qmake_ver"; then
|
|
|
|
AC_MSG_RESULT(unknown; please contact the author)
|
|
|
|
return
|
|
|
|
elif ! check_version $qt_min_ver $qmake_ver; then
|
|
|
|
AC_MSG_RESULT(too old: $qmake_ver, neet at least $qt_mIN-ver)
|
|
|
|
return
|
2012-04-10 15:33:09 +00:00
|
|
|
else
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_RESULT($qmake_ver)
|
2012-04-10 15:33:09 +00:00
|
|
|
fi
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
qt_bindir="`$ac_cv_path_EGREP '^QT_INSTALL_BINS:' "$qmake_properties" | sed 's/^QT_INSTALL_BINS://'`"
|
|
|
|
qt_libexecdir="`$ac_cv_path_EGREP '^QT_INSTALL_LIBEXECS:' "$qmake_properties" | sed 's/^QT_INSTALL_LIBEXECS://'`"
|
|
|
|
qt_searchpath="$qt_libexecdir:$qt_bindir:$PATH"
|
2012-04-10 15:33:09 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
rm -f "$qmake_properties"
|
2012-04-10 15:33:09 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_PATH_PROG(LCONVERT, lconvert,, [$qt_searchpath])
|
|
|
|
AC_PATH_PROG(MOC, moc,, [$qt_searchpath])
|
|
|
|
AC_PATH_PROG(RCC, rcc,, [$qt_searchpath])
|
|
|
|
AC_PATH_PROG(UIC, uic,, [$qt_searchpath])
|
2012-04-10 15:33:09 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if test x"$MOC" = x; then
|
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
|
|
|
AC_MSG_RESULT(no: could not find the moc executable)
|
|
|
|
return
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
elif test x"$RCC" = x; then
|
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
|
|
|
AC_MSG_RESULT(no: could not find the rcc executable)
|
|
|
|
return
|
2017-03-09 20:51:06 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
elif test x"$UIC" = x; then
|
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
|
|
|
AC_MSG_RESULT(no: could not find the uic executable)
|
|
|
|
return
|
2017-03-09 20:51:06 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if test x"$enable_static_qt" = "xyes"; then
|
|
|
|
AC_DEFINE(HAVE_STATIC_QT,,[define if building against a static Qt library])
|
|
|
|
QT_PKG_CONFIG_STATIC=--static
|
2008-08-27 20:38:55 +00:00
|
|
|
else
|
2021-05-24 18:39:56 +00:00
|
|
|
QT_PKG_CONFIG_STATIC=
|
2012-04-15 08:42:05 +00:00
|
|
|
fi
|
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if test "x$with_qt_pkg_config" = xyes; then
|
2015-04-19 17:54:16 +00:00
|
|
|
with_qt_pkg_config_modules="`echo "$with_qt_pkg_config_modules" | sed -e 's/ /,/g'`"
|
2015-05-09 08:20:57 +00:00
|
|
|
if test x"$with_qt_pkg_config_modules" != x ; then
|
|
|
|
with_qt_pkg_config_modules="$with_qt_pkg_config_modules,"
|
|
|
|
fi
|
2015-07-04 16:21:26 +00:00
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
orig_with_qt_pkg_config_modules="$with_qt_pkg_config_modules,"
|
|
|
|
|
2017-04-03 20:20:39 +00:00
|
|
|
with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5Core,Qt5Gui,Qt5Widgets,Qt5Multimedia,Qt5Network,Qt5Concurrent"
|
2015-07-04 16:21:26 +00:00
|
|
|
|
|
|
|
if test x"$MINGW" = x1; then
|
|
|
|
with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5WinExtras"
|
|
|
|
fi
|
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
PKG_CHECK_EXISTS([$with_qt_pkg_config_modules],[ok=1],[ok=0])
|
2015-05-09 08:20:57 +00:00
|
|
|
PKG_CHECK_EXISTS([Qt5PlatformSupport],[with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5PlatformSupport"])
|
2015-05-10 08:43:32 +00:00
|
|
|
|
|
|
|
if test $ok = 0; then
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
2015-05-10 08:43:32 +00:00
|
|
|
AC_MSG_RESULT(no: not found by pkg-config)
|
2021-05-24 18:39:56 +00:00
|
|
|
return
|
2015-05-10 08:43:32 +00:00
|
|
|
fi
|
2012-04-15 08:42:05 +00:00
|
|
|
|
2018-11-05 08:08:47 +00:00
|
|
|
if test x"$MINGW" != x1 && ! echo "$host" | grep -q -i apple ; then
|
2020-07-30 11:34:06 +00:00
|
|
|
PKG_CHECK_EXISTS([Qt5DBus],[dbus_found=yes],[dbus_found=no])
|
|
|
|
if test x"$dbus_found" = xyes; then
|
|
|
|
with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5DBus"
|
|
|
|
AC_DEFINE(HAVE_QTDBUS, 1, [Define if QtDBus is present])
|
|
|
|
fi
|
2018-11-05 08:08:47 +00:00
|
|
|
fi
|
|
|
|
|
2015-04-19 17:54:16 +00:00
|
|
|
with_qt_pkg_config_modules="`echo "$with_qt_pkg_config_modules" | sed -e 's/,/ /g'`"
|
2015-05-09 08:20:57 +00:00
|
|
|
QT_CFLAGS="`$PKG_CONFIG --cflags $with_qt_pkg_config_modules $QT_PKG_CONFIG_STATIC`"
|
|
|
|
QT_LIBS="`$PKG_CONFIG --libs $with_qt_pkg_config_modules $QT_PKG_CONFIG_STATIC`"
|
2021-06-15 20:39:33 +00:00
|
|
|
QT_LIBS_NON_GUI="`$PKG_CONFIG --libs $orig_with_qt_pkg_config_modules,Qt5Core $QT_PKG_CONFIG_STATIC`"
|
2016-03-20 09:01:14 +00:00
|
|
|
fi
|
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
dnl compile test program
|
|
|
|
AC_LANG_PUSH(C++)
|
2021-05-24 19:08:22 +00:00
|
|
|
AC_CACHE_VAL(am_cv_qt5_compilation, [
|
2021-05-24 18:39:56 +00:00
|
|
|
run_qt_test=1
|
|
|
|
while true; do
|
|
|
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
|
|
|
ac_save_LIBS="$LIBS"
|
|
|
|
CXXFLAGS="$STD_CXX $CXXFLAGS $QT_CFLAGS -fPIC"
|
|
|
|
LIBS="$LDFLAGS $QT_LIBS"
|
|
|
|
unset ac_cv_qt_compilation
|
|
|
|
|
|
|
|
AC_TRY_LINK([
|
2008-08-27 20:38:55 +00:00
|
|
|
#include <QtCore>
|
2016-07-02 18:23:36 +00:00
|
|
|
#include <QCoreApplication>
|
2008-08-27 20:38:55 +00:00
|
|
|
class Config : public QCoreApplication {
|
|
|
|
public:
|
|
|
|
Config(int &argc, char **argv);
|
|
|
|
};
|
|
|
|
Config::Config(int &argc, char **argv)
|
|
|
|
: QCoreApplication(argc,argv) {setApplicationName("config");}
|
2021-05-24 18:39:56 +00:00
|
|
|
], [
|
2008-08-27 20:38:55 +00:00
|
|
|
int ai = 0;
|
|
|
|
char **ac = 0;
|
|
|
|
Config app(ai,ac);
|
|
|
|
return 0;
|
2021-05-24 19:08:22 +00:00
|
|
|
], [ am_cv_qt5_compilation=1 ], [ am_cv_qt5_compilation=0 ])
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
|
|
|
LIBS="$ac_save_LIBS"
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 19:08:22 +00:00
|
|
|
if test x"$am_cv_qt5_compilation" = x1; then
|
2021-05-24 18:39:56 +00:00
|
|
|
break
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
elif test x"$run_qt_test" = "x1"; then
|
|
|
|
QT_CFLAGS="$QT_CFLAGS -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtWidgets -I/usr/local/include/QtCore -I/usr/local/include/QtGui -I/usr/local/include/QtWidgets -I/usr/local/include/QtNetwork -I/usr/local/include/QtPlatformSupport"
|
|
|
|
run_qt_test=3
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
else
|
|
|
|
break
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
])
|
|
|
|
AC_LANG_POP()
|
2008-08-27 20:38:55 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
rm -f src/mkvtoolnix-gui/static_plugins.cpp
|
2017-04-03 20:20:39 +00:00
|
|
|
|
2021-05-24 19:08:22 +00:00
|
|
|
if ! test x"$am_cv_qt5_compilation" = x1; then
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
|
|
|
AC_MSG_RESULT(no: test program could not be compiled)
|
|
|
|
return
|
|
|
|
fi
|
2017-03-09 20:51:06 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if test x"$QT_PKG_CONFIG_STATIC" != x; then
|
|
|
|
qmake_dir="`mktemp -d`"
|
2016-10-28 22:22:04 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if test x"$MINGW" = x1 && check_version 5.10.0 $moc_ver; then
|
|
|
|
QTPLUGIN="qwindowsvistastyle"
|
|
|
|
else
|
|
|
|
QTPLUGIN=""
|
|
|
|
fi
|
2018-01-01 18:45:23 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
touch "$qmake_dir/empty.cpp"
|
|
|
|
cat > "$qmake_dir/dummy.pro" <<EOF
|
2017-04-03 20:20:39 +00:00
|
|
|
QT += core multimedia
|
2018-01-01 18:45:23 +00:00
|
|
|
QTPLUGIN += $QTPLUGIN
|
2017-04-03 20:20:39 +00:00
|
|
|
CONFIG += release static
|
|
|
|
TARGET = console
|
|
|
|
TEMPLATE = app
|
|
|
|
SOURCES += empty.cpp
|
|
|
|
EOF
|
2015-08-15 12:05:18 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
old_wd="$PWD"
|
|
|
|
cd "$qmake_dir"
|
2017-03-09 20:51:06 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
"$QMAKE" -makefile -nocache dummy.pro > /dev/null 2>&1
|
|
|
|
result=$?
|
2017-03-09 20:51:06 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
cd "$old_wd"
|
2017-03-09 20:51:06 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
makefile=""
|
|
|
|
if test x$result != x0; then
|
|
|
|
problem="qmake failed to create Makefile"
|
2018-04-07 08:03:58 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
elif ! test -f "$qmake_dir/console_plugin_import.cpp"; then
|
|
|
|
problem="static plugin list could not be generated via $QMAKE"
|
2017-03-09 20:51:06 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
elif test -f "$qmake_dir/Makefile.Release"; then
|
|
|
|
makefile="$qmake_dir/Makefile.Release"
|
2017-04-03 20:20:39 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
elif test -f "$qmake_dir/Makefile"; then
|
|
|
|
makefile="$qmake_dir/Makefile"
|
2017-03-09 20:51:06 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
else
|
|
|
|
problem="the Makefile created by $QMAKE could not be found"
|
|
|
|
fi
|
2017-04-03 20:20:39 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if test x"$problem" = x; then
|
|
|
|
qmake_libs="`grep '^LIBS' "$makefile" | sed -Ee 's/^LIBS[[ \t]]*=[[ \t]]*//'`"
|
|
|
|
QT_LIBS="$qmake_libs $QT_LIBS"
|
2017-04-03 20:20:39 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
cp "$qmake_dir/console_plugin_import.cpp" src/mkvtoolnix-gui/static_plugins.cpp
|
|
|
|
fi
|
2017-04-03 20:20:39 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
rm -rf "$qmake_dir"
|
2017-04-03 20:20:39 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
unset makefile qmake_libs qmake_dir
|
|
|
|
fi
|
2014-09-07 19:08:18 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
2017-04-03 20:20:39 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
if test x"$problem" = x; then
|
|
|
|
AC_DEFINE(HAVE_QT, 1, [Define if Qt is present])
|
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
have_qt5=yes
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT(no: $problem)
|
2008-08-27 20:38:55 +00:00
|
|
|
fi
|
2012-04-09 15:48:38 +00:00
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
unset problem
|
|
|
|
}
|
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
AC_ARG_ENABLE([qt5],
|
|
|
|
AC_HELP_STRING([--enable-qt5],[compile with Qt 5 (yes if Qt 6 is not found)]),
|
|
|
|
[],[enable_qt5=yes])
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_ARG_ENABLE([static_qt],
|
2021-06-15 20:39:33 +00:00
|
|
|
AC_HELP_STRING([--enable-static-qt],[link to static versions of the Qt 5 library (no)]))
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_ARG_WITH([qt_pkg_config_modules],
|
|
|
|
AC_HELP_STRING([--with-qt-pkg-config-modules=modules],[gather include/link flags for additional Qt 5 modules from pkg-config]))
|
|
|
|
AC_ARG_WITH([qt_pkg_config],
|
|
|
|
AC_HELP_STRING([--without-qt-pkg-config], [do not use pkg-config for detecting Qt 5; instead rely on QT_CFLAGS/QT_LIBS being set correctly already]),
|
|
|
|
[ with_qt_pkg_config=${withval} ], [ with_qt_pkg_config=yes ])
|
|
|
|
|
|
|
|
have_qt5=no
|
|
|
|
|
|
|
|
if test x"$have_qt6" = "xyes"; then
|
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
|
|
|
AC_MSG_RESULT(no: already using Qt 6)
|
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
elif test x"$enable_qt5" != xyes; then
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 5)
|
|
|
|
AC_MSG_RESULT(no: disabled by user request)
|
2015-06-03 18:06:34 +00:00
|
|
|
|
2015-05-09 15:01:25 +00:00
|
|
|
else
|
2021-05-24 18:39:56 +00:00
|
|
|
check_qt5
|
2008-08-27 20:38:55 +00:00
|
|
|
fi
|