mirror of
https://gitlab.com/mbunkus/mkvtoolnix.git
synced 2024-10-22 07:21:21 +00:00
configure: detect & use Qt 6 if present, prefer over Qt 5
Qt 6 `configure` will look for Qt 6 first and only continue looking for Qt 5 if Qt 6 isn't found or disabled via `--disable-qt6`. Qt 6 detection works by first looking for the `qmake6` binary. Its location can be specified with the `--with-qmake6=…` option. All other Qt 6 related facts (such as compiler & linker flags or the position of the other required tools such as `lconvert`, `moc`, `rcc` and `uic`) will be derived from the output generated by `qmake6`. Note that at this point Qt 6 is not yet supported for the cross-compilation build to Windows, nor is a static Qt 6 build supported yet. Note that the command line options `--enable-static-qt`, `--with-qt-pkg-config-modules` and `--without-qt-pkg-config` only apply to the Qt 5 and have no effect on Qt 6. Qt 5 The options for specifying the position of the tools (`--with-moc=…`, `--with-rcc=…` and `--with-uic=…`) have been removed. Their position will now be derived from the output generated by `qmake`. General Completely disabling the GUI now requires passing both `--disable-qt6` and `--disable-qt` options. Part of the implementation of #3115.
This commit is contained in:
parent
11046de86a
commit
2848178815
24
NEWS.md
24
NEWS.md
@ -38,6 +38,30 @@
|
||||
* mkvmerge, mkvextract: fixed key frame handling for `BlockGroup` elements
|
||||
with a forward reference but no backward references. Patches by Tom Yan.
|
||||
|
||||
## Build system changes
|
||||
|
||||
* Qt 6: added support for building with Qt 6. `configure` will look for Qt 6
|
||||
first and only continue looking for Qt 5 if Qt 6 isn't found or disabled via
|
||||
`--disable-qt6`.
|
||||
|
||||
Qt 6 detection works by first looking for the `qmake6` binary. Its location
|
||||
can be specified with the `--with-qmake6=…` option.
|
||||
|
||||
All other Qt 6 related facts (such as compiler & linker flags or the
|
||||
position of the other required tools such as `lconvert`, `moc`, `rcc` and
|
||||
`uic`) will be derived from the output generated by `qmake6`.
|
||||
|
||||
Note that at this point Qt 6 is not yet supported for the cross-compilation
|
||||
build to Windows, nor is a static Qt 6 build supported yet.
|
||||
|
||||
Note that the command line options `--enable-static-qt`,
|
||||
`--with-qt-pkg-config-modules` and `--without-qt-pkg-config` only apply to
|
||||
the Qt 5 and have no effect on Qt 6.
|
||||
* Qt 5: the options for specifying the position of the tools (`--with-moc=…`,
|
||||
`--with-rcc=…` and `--with-uic=…`) have been removed. Their position will
|
||||
now be derived from the output generated by `qmake`.
|
||||
* `configure`: completely disabling the GUI now requires passing both
|
||||
`--disable-qt6` and `--disable-qt` options.
|
||||
|
||||
# Version 57.0.0 "Till The End" 2021-05-22
|
||||
|
||||
|
@ -2,7 +2,7 @@ dnl
|
||||
dnl Check for cmark
|
||||
dnl
|
||||
|
||||
if test x"$have_qt" = "xyes" ; then
|
||||
if test x"$USE_QT" = xyes; then
|
||||
PKG_CHECK_EXISTS([libcmark],[cmark_found=yes],[cmark_found=no])
|
||||
if test x"$cmark_found" = xyes; then
|
||||
PKG_CHECK_MODULES([libcmark],[libcmark],[cmark_found=yes])
|
||||
|
390
ac/qt5.m4
390
ac/qt5.m4
@ -4,111 +4,9 @@ dnl
|
||||
|
||||
qt_min_ver=5.9.0
|
||||
|
||||
AC_ARG_ENABLE([qt],
|
||||
AC_HELP_STRING([--enable-qt],[compile the Qt-based MKVToolNix GUI (yes)]),
|
||||
[],[enable_qt=yes])
|
||||
AC_ARG_ENABLE([static_qt],
|
||||
AC_HELP_STRING([--enable-static-qt],[link to static versions of the Qt library (no)]))
|
||||
AC_ARG_WITH([qt_pkg_config_modules],
|
||||
AC_HELP_STRING([--with-qt-pkg-config-modules=modules],[gather include/link flags for additional Qt 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; instead rely on QT_CFLAGS/QT_LIBS being set correctly already]),
|
||||
[ with_qt_pkg_config=${withval} ], [ with_qt_pkg_config=yes ])
|
||||
|
||||
if test x"$enable_qt" = "xyes"; then
|
||||
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
|
||||
else
|
||||
QT_PKG_CONFIG_STATIC=
|
||||
fi
|
||||
|
||||
dnl Find moc.
|
||||
AC_ARG_WITH(moc,
|
||||
AC_HELP_STRING([--with-moc=prog],[use prog instead of looking for moc]),
|
||||
[ MOC="$with_moc" ],)
|
||||
if ! test -z "$MOC"; then
|
||||
AC_MSG_CHECKING(for moc)
|
||||
AC_MSG_RESULT(using supplied $MOC)
|
||||
else
|
||||
AC_PATH_PROG(MOC, moc-qt5,, $PATH)
|
||||
if test -z "$MOC"; then
|
||||
AC_PATH_PROG(MOC, moc,, $PATH)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$MOC" -a -x "$MOC"; then
|
||||
dnl Check its version.
|
||||
AC_MSG_CHECKING(for the Qt version $MOC uses)
|
||||
moc_ver=`"$MOC" -v 2>&1 | sed -e 's:.*Qt ::' -e 's:.* ::' -e 's:[[^0-9\.]]::g'`
|
||||
if test -z "moc_ver"; then
|
||||
AC_MSG_RESULT(unknown; please contact the author)
|
||||
elif ! check_version $qt_min_ver $moc_ver; then
|
||||
AC_MSG_RESULT(too old: $moc_ver)
|
||||
else
|
||||
AC_MSG_RESULT($moc_ver)
|
||||
moc_found=1
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(uic,
|
||||
AC_HELP_STRING([--with-uic=prog],[use prog instead of looking for uic]),
|
||||
[ UIC="$with_uic" ],)
|
||||
|
||||
if ! test -z "$UIC"; then
|
||||
AC_MSG_CHECKING(for uic)
|
||||
AC_MSG_RESULT(using supplied $UIC)
|
||||
else
|
||||
AC_PATH_PROG(UIC, uic-qt5,, $PATH)
|
||||
if test -z "$UIC"; then
|
||||
AC_PATH_PROG(UIC, uic,, $PATH)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$UIC" -a -x "$UIC"; then
|
||||
dnl Check its version.
|
||||
AC_MSG_CHECKING(for the Qt version $UIC uses)
|
||||
uic_ver=`"$UIC" -v 2>&1 | sed -e 's:.*Qt ::' -e 's:.* ::' -e 's:[[^0-9\.]]::g'`
|
||||
if test -z "uic_ver"; then
|
||||
AC_MSG_RESULT(unknown; please contact the author)
|
||||
elif ! check_version $qt_min_ver $uic_ver; then
|
||||
AC_MSG_RESULT(too old: $uic_ver)
|
||||
else
|
||||
AC_MSG_RESULT($uic_ver)
|
||||
uic_found=1
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH(rcc,
|
||||
AC_HELP_STRING([--with-rcc=prog],[use prog instead of looking for rcc]),
|
||||
[ RCC="$with_rcc" ],)
|
||||
|
||||
if ! test -z "$RCC"; then
|
||||
AC_MSG_CHECKING(for rcc)
|
||||
AC_MSG_RESULT(using supplied $RCC)
|
||||
else
|
||||
AC_PATH_PROG(RCC, rcc-qt5,, $PATH)
|
||||
if test -z "$RCC"; then
|
||||
AC_PATH_PROG(RCC, rcc,, $PATH)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$RCC" -a -x "$RCC"; then
|
||||
dnl Check its version.
|
||||
AC_MSG_CHECKING(for the Qt version $RCC uses)
|
||||
rcc_ver=`"$RCC" -v 2>&1 | sed -e 's:.*Qt ::' -e 's:.* ::' -e 's:[[^0-9\.]]::g'`
|
||||
if test -z "rcc_ver"; then
|
||||
AC_MSG_RESULT(unknown; please contact the author)
|
||||
elif ! check_version $qt_min_ver $rcc_ver; then
|
||||
AC_MSG_RESULT(too old: $rcc_ver)
|
||||
else
|
||||
AC_MSG_RESULT($rcc_ver)
|
||||
rcc_found=1
|
||||
fi
|
||||
fi
|
||||
|
||||
check_qt5() {
|
||||
AC_ARG_WITH(qmake,
|
||||
AC_HELP_STRING([--with-qmake=prog],[use prog instead of looking for qmake]),
|
||||
AC_HELP_STRING([--with-qmake=prog],[use prog instead of looking for qmake for Qt 5]),
|
||||
[ QMAKE="$with_qmake" ],)
|
||||
|
||||
if ! test -z "$QMAKE"; then
|
||||
@ -121,35 +19,65 @@ if test x"$enable_qt" = "xyes"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$QMAKE" -a -x "$QMAKE"; then
|
||||
dnl Check its version.
|
||||
AC_MSG_CHECKING(for the Qt version $QMAKE uses)
|
||||
qmake_ver=`LC_ALL=C "$QMAKE" -v 2>&1 | grep 'Using Qt' | sed -e 's:.*version ::' -e 's: .*::'`
|
||||
if test -z "qmake_ver"; then
|
||||
AC_MSG_RESULT(unknown; please contact the author)
|
||||
elif ! check_version $qt_min_ver $qmake_ver; then
|
||||
AC_MSG_RESULT(too old: $qmake_ver)
|
||||
else
|
||||
AC_MSG_RESULT($qmake_ver)
|
||||
qmake_found=1
|
||||
fi
|
||||
if test x"$QMAKE" = x; then
|
||||
AC_MSG_CHECKING(for Qt 5)
|
||||
AC_MSG_RESULT(no: qmake not found)
|
||||
return
|
||||
fi
|
||||
|
||||
ok=0
|
||||
AC_MSG_CHECKING(for Qt $qt_min_ver or newer)
|
||||
if test x"$moc_found" != "x1"; then
|
||||
AC_MSG_RESULT(no: moc not found or too old)
|
||||
elif test x"$uic_found" != "x1"; then
|
||||
AC_MSG_RESULT(no: uic not found or too old)
|
||||
elif test x"$rcc_found" != "x1"; then
|
||||
AC_MSG_RESULT(no: rcc not found or too old)
|
||||
elif test x"$qmake_found" != "x1"; then
|
||||
AC_MSG_RESULT(no: qmake not found or too old)
|
||||
qmake_properties="`mktemp`"
|
||||
|
||||
"$QMAKE" -query > "$qmake_properties"
|
||||
|
||||
qmake_ver="`$ac_cv_path_EGREP '^QT_VERSION:' "$qmake_properties" | sed 's/^QT_VERSION://'`"
|
||||
|
||||
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
|
||||
else
|
||||
ok=1
|
||||
AC_MSG_RESULT($qmake_ver)
|
||||
fi
|
||||
|
||||
if test $ok = 1 -a "x$with_qt_pkg_config" = xyes; then
|
||||
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"
|
||||
|
||||
rm -f "$qmake_properties"
|
||||
|
||||
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])
|
||||
|
||||
if test x"$MOC" = x; then
|
||||
AC_MSG_CHECKING(for Qt 5)
|
||||
AC_MSG_RESULT(no: could not find the moc executable)
|
||||
return
|
||||
|
||||
elif test x"$RCC" = x; then
|
||||
AC_MSG_CHECKING(for Qt 5)
|
||||
AC_MSG_RESULT(no: could not find the rcc executable)
|
||||
return
|
||||
|
||||
elif test x"$UIC" = x; then
|
||||
AC_MSG_CHECKING(for Qt 5)
|
||||
AC_MSG_RESULT(no: could not find the uic executable)
|
||||
return
|
||||
fi
|
||||
|
||||
|
||||
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
|
||||
else
|
||||
QT_PKG_CONFIG_STATIC=
|
||||
fi
|
||||
|
||||
if test "x$with_qt_pkg_config" = xyes; then
|
||||
with_qt_pkg_config_modules="`echo "$with_qt_pkg_config_modules" | sed -e 's/ /,/g'`"
|
||||
if test x"$with_qt_pkg_config_modules" != x ; then
|
||||
with_qt_pkg_config_modules="$with_qt_pkg_config_modules,"
|
||||
@ -161,11 +89,13 @@ if test x"$enable_qt" = "xyes"; then
|
||||
with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5WinExtras"
|
||||
fi
|
||||
|
||||
PKG_CHECK_EXISTS([$with_qt_pkg_config_modules],,[ok=0])
|
||||
PKG_CHECK_EXISTS([$with_qt_pkg_config_modules],[ok=1],[ok=0])
|
||||
PKG_CHECK_EXISTS([Qt5PlatformSupport],[with_qt_pkg_config_modules="$with_qt_pkg_config_modules,Qt5PlatformSupport"])
|
||||
|
||||
if test $ok = 0; then
|
||||
AC_MSG_CHECKING(for Qt 5)
|
||||
AC_MSG_RESULT(no: not found by pkg-config)
|
||||
return
|
||||
fi
|
||||
|
||||
if test x"$MINGW" != x1 && ! echo "$host" | grep -q -i apple ; then
|
||||
@ -181,20 +111,18 @@ if test x"$enable_qt" = "xyes"; then
|
||||
QT_LIBS="`$PKG_CONFIG --libs $with_qt_pkg_config_modules $QT_PKG_CONFIG_STATIC`"
|
||||
fi
|
||||
|
||||
if test $ok = 1; then
|
||||
dnl Try compiling and linking an application.
|
||||
dnl compile test program
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_CACHE_VAL(am_cv_qt_compilation, [
|
||||
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_LANG_PUSH(C++)
|
||||
AC_CACHE_VAL(am_cv_qt_compilation, [
|
||||
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([
|
||||
AC_TRY_LINK([
|
||||
#include <QtCore>
|
||||
#include <QCoreApplication>
|
||||
class Config : public QCoreApplication {
|
||||
@ -203,49 +131,50 @@ Config(int &argc, char **argv);
|
||||
};
|
||||
Config::Config(int &argc, char **argv)
|
||||
: QCoreApplication(argc,argv) {setApplicationName("config");}
|
||||
], [
|
||||
], [
|
||||
int ai = 0;
|
||||
char **ac = 0;
|
||||
Config app(ai,ac);
|
||||
return 0;
|
||||
], [ am_cv_qt_compilation=1 ], [ am_cv_qt_compilation=0 ])
|
||||
], [ am_cv_qt_compilation=1 ], [ am_cv_qt_compilation=0 ])
|
||||
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
CXXFLAGS="$ac_save_CXXFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
|
||||
if test x"$am_cv_qt_compilation" = x1; then
|
||||
break
|
||||
if test x"$am_cv_qt_compilation" = x1; then
|
||||
break
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
else
|
||||
break
|
||||
else
|
||||
break
|
||||
|
||||
fi
|
||||
done
|
||||
])
|
||||
AC_LANG_POP()
|
||||
fi
|
||||
done
|
||||
])
|
||||
AC_LANG_POP()
|
||||
|
||||
problem=""
|
||||
if ! test x"$am_cv_qt_compilation" = x1; then
|
||||
problem="test program could not be compiled"
|
||||
rm -f src/mkvtoolnix-gui/static_plugins.cpp
|
||||
|
||||
if ! test x"$am_cv_qt_compilation" = x1; then
|
||||
AC_MSG_CHECKING(for Qt 5)
|
||||
AC_MSG_RESULT(no: test program could not be compiled)
|
||||
return
|
||||
fi
|
||||
|
||||
if test x"$QT_PKG_CONFIG_STATIC" != x; then
|
||||
qmake_dir="`mktemp -d`"
|
||||
|
||||
if test x"$MINGW" = x1 && check_version 5.10.0 $moc_ver; then
|
||||
QTPLUGIN="qwindowsvistastyle"
|
||||
else
|
||||
QTPLUGIN=""
|
||||
fi
|
||||
|
||||
rm -f src/mkvtoolnix-gui/static_plugins.cpp
|
||||
|
||||
if test x"$problem" = x && test x"$QT_PKG_CONFIG_STATIC" != x; then
|
||||
qmake_dir="`mktemp -d`"
|
||||
|
||||
if test x"$MINGW" = x1 && check_version 5.10.0 $moc_ver; then
|
||||
QTPLUGIN="qwindowsvistastyle"
|
||||
else
|
||||
QTPLUGIN=""
|
||||
fi
|
||||
|
||||
touch "$qmake_dir/empty.cpp"
|
||||
cat > "$qmake_dir/dummy.pro" <<EOF
|
||||
touch "$qmake_dir/empty.cpp"
|
||||
cat > "$qmake_dir/dummy.pro" <<EOF
|
||||
QT += core multimedia
|
||||
QTPLUGIN += $QTPLUGIN
|
||||
CONFIG += release static
|
||||
@ -254,72 +183,97 @@ TEMPLATE = app
|
||||
SOURCES += empty.cpp
|
||||
EOF
|
||||
|
||||
old_wd="$PWD"
|
||||
cd "$qmake_dir"
|
||||
old_wd="$PWD"
|
||||
cd "$qmake_dir"
|
||||
|
||||
"$QMAKE" -makefile -nocache dummy.pro > /dev/null 2>&1
|
||||
result=$?
|
||||
"$QMAKE" -makefile -nocache dummy.pro > /dev/null 2>&1
|
||||
result=$?
|
||||
|
||||
cd "$old_wd"
|
||||
cd "$old_wd"
|
||||
|
||||
makefile=""
|
||||
if test x$result != x0; then
|
||||
problem="qmake failed to create Makefile"
|
||||
makefile=""
|
||||
if test x$result != x0; then
|
||||
problem="qmake failed to create Makefile"
|
||||
|
||||
elif ! test -f "$qmake_dir/console_plugin_import.cpp"; then
|
||||
problem="static plugin list could not be generated via $QMAKE"
|
||||
elif ! test -f "$qmake_dir/console_plugin_import.cpp"; then
|
||||
problem="static plugin list could not be generated via $QMAKE"
|
||||
|
||||
elif test -f "$qmake_dir/Makefile.Release"; then
|
||||
makefile="$qmake_dir/Makefile.Release"
|
||||
elif test -f "$qmake_dir/Makefile.Release"; then
|
||||
makefile="$qmake_dir/Makefile.Release"
|
||||
|
||||
elif test -f "$qmake_dir/Makefile"; then
|
||||
makefile="$qmake_dir/Makefile"
|
||||
elif test -f "$qmake_dir/Makefile"; then
|
||||
makefile="$qmake_dir/Makefile"
|
||||
|
||||
else
|
||||
problem="the Makefile created by $QMAKE could not be found"
|
||||
fi
|
||||
|
||||
if test x"$problem" = x; then
|
||||
qmake_libs="`grep '^LIBS' "$makefile" | sed -Ee 's/^LIBS[[ \t]]*=[[ \t]]*//'`"
|
||||
QT_LIBS="$qmake_libs $QT_LIBS"
|
||||
|
||||
cp "$qmake_dir/console_plugin_import.cpp" src/mkvtoolnix-gui/static_plugins.cpp
|
||||
fi
|
||||
|
||||
rm -rf "$qmake_dir"
|
||||
|
||||
unset makefile qmake_libs qmake_dir
|
||||
else
|
||||
problem="the Makefile created by $QMAKE could not be found"
|
||||
fi
|
||||
|
||||
if test x"$problem" = x; then
|
||||
AC_DEFINE(HAVE_QT, 1, [Define if Qt is present])
|
||||
have_qt=yes
|
||||
USE_QT=yes
|
||||
opt_features_yes="$opt_features_yes\n * MKVToolNix GUI"
|
||||
AC_MSG_RESULT(yes)
|
||||
else
|
||||
AC_MSG_RESULT(no: $problem)
|
||||
qmake_libs="`grep '^LIBS' "$makefile" | sed -Ee 's/^LIBS[[ \t]]*=[[ \t]]*//'`"
|
||||
QT_LIBS="$qmake_libs $QT_LIBS"
|
||||
|
||||
cp "$qmake_dir/console_plugin_import.cpp" src/mkvtoolnix-gui/static_plugins.cpp
|
||||
fi
|
||||
|
||||
unset problem
|
||||
rm -rf "$qmake_dir"
|
||||
|
||||
unset makefile qmake_libs qmake_dir
|
||||
fi
|
||||
|
||||
AC_PATH_PROG(LCONVERT, lconvert)
|
||||
AC_MSG_CHECKING(for Qt 5)
|
||||
|
||||
if test x"$problem" = x; then
|
||||
AC_DEFINE(HAVE_QT, 1, [Define if Qt is present])
|
||||
AC_MSG_RESULT(yes)
|
||||
have_qt5=yes
|
||||
USE_QT=yes
|
||||
else
|
||||
AC_MSG_RESULT(no: $problem)
|
||||
fi
|
||||
|
||||
unset problem
|
||||
}
|
||||
|
||||
AC_ARG_ENABLE([qt],
|
||||
AC_HELP_STRING([--enable-qt],[compile the Qt-based MKVToolNix GUI qith Qt 5 (yes)]),
|
||||
[],[enable_qt=yes])
|
||||
AC_ARG_ENABLE([static_qt],
|
||||
AC_HELP_STRING([--enable-static-qt],[link to static versions of the Qt library (no)]))
|
||||
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)
|
||||
|
||||
elif test x"$enable_qt" != xyes; then
|
||||
AC_MSG_CHECKING(for Qt 5)
|
||||
AC_MSG_RESULT(no: disabled by user request)
|
||||
|
||||
else
|
||||
echo '*** Not checking for Qt: disabled by user request'
|
||||
check_qt5
|
||||
|
||||
if test $have_qt5 != yes; then
|
||||
unset QT_CFLAGS QT_LIBS
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$have_qt" != "xyes" ; then
|
||||
if test x"$have_qt6" = "xyes"; then
|
||||
opt_features_yes="$opt_features_yes\n * MKVToolNix GUI (with Qt 6)"
|
||||
|
||||
elif test x"$have_qt5" = "xyes" ; then
|
||||
opt_features_yes="$opt_features_yes\n * MKVToolNix GUI (with Qt 5)"
|
||||
|
||||
else
|
||||
opt_features_no="$opt_features_no\n * MKVToolNix GUI"
|
||||
QT_CFLAGS=
|
||||
QT_LIBS=
|
||||
MOC=
|
||||
UIC=
|
||||
unset MOC QT_CXXFLAGS QT_INCPATH QT_LDFLAGS QT_LIBS RCC UIC
|
||||
fi
|
||||
|
||||
AC_SUBST(MOC)
|
||||
AC_SUBST(UIC)
|
||||
AC_SUBST(QT_CFLAGS)
|
||||
AC_SUBST(QT_LIBS)
|
||||
AC_SUBST(USE_QT)
|
||||
|
154
ac/qt6.m4
Normal file
154
ac/qt6.m4
Normal file
@ -0,0 +1,154 @@
|
||||
dnl
|
||||
dnl Check for Qt 6
|
||||
dnl
|
||||
|
||||
qt_min_ver=6.1.0
|
||||
|
||||
check_qt6() {
|
||||
AC_ARG_WITH(qmake6,
|
||||
AC_HELP_STRING([--with-qmake6=prog],[use prog instead of looking for qmake6]),
|
||||
[ QMAKE6="$with_qmake6" ],)
|
||||
|
||||
if ! test -z "$QMAKE6"; then
|
||||
AC_MSG_CHECKING(for qmake6)
|
||||
AC_MSG_RESULT(using supplied $QMAKE6)
|
||||
else
|
||||
AC_PATH_TOOL(QMAKE6, qmake6,, $PATH)
|
||||
fi
|
||||
|
||||
if test x"$QMAKE6" = x; then
|
||||
AC_MSG_CHECKING(for Qt 6)
|
||||
AC_MSG_RESULT(no: qmake6 not found)
|
||||
return
|
||||
fi
|
||||
|
||||
qmake_dir="`mktemp -d`"
|
||||
|
||||
touch "$qmake_dir/configure.cpp" "$qmake_dir/configure.h"
|
||||
|
||||
cat > "$qmake_dir/configure.ui" <<EOT
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
</ui>
|
||||
EOT
|
||||
|
||||
cat > "$qmake_dir/configure.qrc" <<EOT
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!DOCTYPE RCC>
|
||||
<RCC version='1.0'>
|
||||
<qresource>
|
||||
<file>configure.pro</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
EOT
|
||||
|
||||
cat > "$qmake_dir/configure.pro" <<EOT
|
||||
QT = core dbus gui widgets network concurrent
|
||||
|
||||
FORMS = configure.ui
|
||||
RESOURCES = configure.qrc
|
||||
HEADERS = configure.h
|
||||
SOURCES = configure.cpp
|
||||
EOT
|
||||
|
||||
old_wd="$PWD"
|
||||
cd "$qmake_dir"
|
||||
|
||||
"$QMAKE6" -makefile -nocache configure.pro > /dev/null
|
||||
result=$?
|
||||
|
||||
"$QMAKE6" -query > "$qmake_dir/configure.properties"
|
||||
result2=$?
|
||||
|
||||
cd "$old_wd"
|
||||
|
||||
if test $result != 0 -o $result2 != 0; then
|
||||
AC_MSG_CHECKING(for Qt 6)
|
||||
AC_MSG_RESULT(no: qmake6 couldn't be run for a dummy project)
|
||||
|
||||
rm -f "$qmake_dir"/configure.* "$qmake_dir"/Makefile "$qmake_dir"/.qmake.stash
|
||||
rmdir "$qmake_dir"
|
||||
|
||||
return
|
||||
fi
|
||||
|
||||
dnl Check its version.
|
||||
qmake6_ver="`$ac_cv_path_EGREP '^QT_VERSION:' "$qmake_dir/configure.properties" | sed 's/^QT_VERSION://'`"
|
||||
|
||||
AC_MSG_CHECKING(for qmake6's version)
|
||||
if test -z "qmake6_ver"; then
|
||||
AC_MSG_RESULT(unknown; please contact the author)
|
||||
return
|
||||
elif ! check_version $qt_min_ver $qmake6_ver; then
|
||||
AC_MSG_RESULT(too old: $qmake6_ver, neet at least $qt_mIN-ver)
|
||||
return
|
||||
else
|
||||
AC_MSG_RESULT($qmake6_ver)
|
||||
fi
|
||||
|
||||
qt_bindir="`$ac_cv_path_EGREP '^QT_INSTALL_BINS:' "$qmake_dir/configure.properties" | sed 's/^QT_INSTALL_BINS://'`"
|
||||
qt_libexecdir="`$ac_cv_path_EGREP '^QT_INSTALL_LIBEXECS:' "$qmake_dir/configure.properties" | sed 's/^QT_INSTALL_LIBEXECS://'`"
|
||||
qt_searchpath="$qt_libexecdir:$qt_bindir:$PATH"
|
||||
|
||||
QT_CFLAGS="`$ac_cv_path_EGREP '^DEFINES *=' "$qmake_dir/Makefile" | sed 's/^DEFINES *= *//'`"
|
||||
QT_CFLAGS="$QT_CFLAGS `$ac_cv_path_EGREP '^CXXFLAGS *=' "$qmake_dir/Makefile" | sed -e 's/^CXXFLAGS *= *//' -e 's/-pipe//g' -e 's/-O.//g' -e 's/ -W[[^ ]]*//g' -e 's/-std=[[^ ]]*//g' -e 's/\$(DEFINES)//g'`"
|
||||
QT_CFLAGS="$QT_CFLAGS `$ac_cv_path_EGREP '^INCPATH *=' "$qmake_dir/Makefile" | sed -e 's/^INCPATH *= *//' -e 's:-I[[^/]][[^ ]]*::g'`"
|
||||
QT_LIBS="`$ac_cv_path_EGREP '^LFLAGS *=' "$qmake_dir/Makefile" | sed -e 's/^LFLAGS *= *//' -e 's/-Wl,-O[[^ ]]*//g'`"
|
||||
QT_LIBS="$QT_LIBS `$ac_cv_path_EGREP '^LIBS *=' "$qmake_dir/Makefile" | sed -e 's/^LIBS *= *//' -e 's/\$(SUBLIBS)//g' -e 's:-L[[^/]][[^ ]]*::g'`"
|
||||
|
||||
rm -f "$qmake_dir"/configure.* "$qmake_dir"/Makefile "$qmake_dir"/.qmake.stash
|
||||
rmdir "$qmake_dir"
|
||||
|
||||
if test x"$QT_CFLAGS" = x -o x"$QT_LIBS" = x; then
|
||||
AC_MSG_CHECKING(for Qt 6)
|
||||
AC_MSG_RESULT(no: could not extract one or more compiler flags from Makefile generated by qmake6)
|
||||
return
|
||||
fi
|
||||
|
||||
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])
|
||||
|
||||
AC_MSG_CHECKING(for Qt 6)
|
||||
|
||||
if test x"$MOC" = x; then
|
||||
AC_MSG_RESULT(no: could not find the moc executable)
|
||||
|
||||
elif test x"$RCC" = x; then
|
||||
AC_MSG_RESULT(no: could not find the rcc executable)
|
||||
|
||||
elif test x"$UIC" = x; then
|
||||
AC_MSG_RESULT(no: could not find the uic executable)
|
||||
|
||||
else
|
||||
AC_DEFINE(HAVE_QT, 1, [Define if Qt is present])
|
||||
AC_MSG_RESULT(yes)
|
||||
have_qt6=yes
|
||||
USE_QT=yes
|
||||
fi
|
||||
}
|
||||
|
||||
AC_ARG_ENABLE([qt6],
|
||||
AC_HELP_STRING([--enable-qt6],[compile the Qt-based MKVToolNix GUI with Qt 6 (yes)]),
|
||||
[],[enable_qt6=yes])
|
||||
|
||||
have_qt6=no
|
||||
|
||||
if test x"$enable_qt6" != "xyes"; then
|
||||
AC_MSG_CHECKING(for Qt 6)
|
||||
AC_MSG_RESULT(no: disabled by user request)
|
||||
|
||||
else
|
||||
check_qt6
|
||||
|
||||
unset qmake_dir qt_bindir qt_libdir qt_searchpath
|
||||
|
||||
if test $have_qt6 != yes; then
|
||||
unset QT_CFLAGS QT_LIBS
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(QT_CFLAGS)
|
||||
AC_SUBST(QT_LIBS)
|
||||
AC_SUBST(USE_QT)
|
@ -34,6 +34,7 @@ m4_include(ac/utf8cpp.m4)
|
||||
m4_include(ac/fmt.m4)
|
||||
m4_include(ac/pcre2.m4)
|
||||
m4_include(ac/zlib.m4)
|
||||
m4_include(ac/qt6.m4)
|
||||
m4_include(ac/qt5.m4)
|
||||
m4_include(ac/cmark.m4)
|
||||
m4_include(ac/gnurx.m4)
|
||||
|
Loading…
Reference in New Issue
Block a user