2021-05-24 18:39:56 +00:00
|
|
|
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
|
2022-02-19 15:10:25 +00:00
|
|
|
AC_CHECK_TOOLS(QMAKE6, [ qmake6 qmake-qt6 qt6-qmake ])
|
2021-05-24 18:39:56 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test x"$QMAKE6" = x; then
|
|
|
|
AC_MSG_CHECKING(for Qt 6)
|
|
|
|
AC_MSG_RESULT(no: qmake6 not found)
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2022-02-21 21:04:36 +00:00
|
|
|
rm -f src/mkvtoolnix-gui/static_plugins.cpp
|
2021-05-24 18:39:56 +00:00
|
|
|
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>
|
2021-06-15 20:39:33 +00:00
|
|
|
EOT
|
|
|
|
|
2022-02-21 21:04:36 +00:00
|
|
|
qmake_qtplugin_ui=""
|
|
|
|
qmake_qt_ui=""
|
2022-04-09 07:29:40 +00:00
|
|
|
qmake_qt_ui_try="multimedia"
|
2022-02-21 21:04:36 +00:00
|
|
|
|
|
|
|
if ! test x"$MINGW" = x1; then
|
2022-03-02 18:26:12 +00:00
|
|
|
qmake_qt_ui="dbus"
|
2022-02-21 21:04:36 +00:00
|
|
|
fi
|
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
cat > "$qmake_dir/configure_non_gui.pro" <<EOT
|
|
|
|
QT = core
|
2022-02-21 21:04:36 +00:00
|
|
|
TARGET = console
|
2021-06-15 20:39:33 +00:00
|
|
|
|
|
|
|
HEADERS = configure.h
|
|
|
|
SOURCES = configure.cpp
|
2021-05-24 18:39:56 +00:00
|
|
|
EOT
|
|
|
|
|
2022-02-19 15:10:25 +00:00
|
|
|
old_wd="$PWD"
|
|
|
|
cd "$qmake_dir"
|
|
|
|
|
|
|
|
"$QMAKE6" -makefile -nocache configure_non_gui.pro > /dev/null
|
|
|
|
result=$?
|
|
|
|
|
|
|
|
if test $result = 0; then
|
|
|
|
if test -f Makefile.Release; then
|
|
|
|
mv Makefile.Release Makefile.non_gui
|
|
|
|
else
|
|
|
|
mv Makefile Makefile.non_gui
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2022-03-02 18:26:12 +00:00
|
|
|
while true; do
|
|
|
|
rm -f Makefile Makefile.Release
|
|
|
|
|
|
|
|
cat > "$qmake_dir/configure.pro" <<EOT
|
2022-04-23 09:53:53 +00:00
|
|
|
QT = core $qmake_qt_ui $qmake_qt_ui_try gui widgets network concurrent svg
|
2022-02-21 21:04:36 +00:00
|
|
|
QTPLUGIN += $qmake_qtplugin_ui
|
2021-05-24 18:39:56 +00:00
|
|
|
|
|
|
|
FORMS = configure.ui
|
|
|
|
RESOURCES = configure.qrc
|
|
|
|
HEADERS = configure.h
|
|
|
|
SOURCES = configure.cpp
|
|
|
|
EOT
|
|
|
|
|
2022-03-02 18:26:12 +00:00
|
|
|
"$QMAKE6" -makefile -nocache configure.pro > /dev/null
|
|
|
|
result2=$?
|
|
|
|
|
2022-04-08 19:34:23 +00:00
|
|
|
if test $result2 = 0 -o -z $qmake_qt_ui_try; then
|
2022-03-02 18:26:12 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
|
|
|
qmake_qt_ui_try=""
|
|
|
|
done
|
2021-05-24 18:39:56 +00:00
|
|
|
|
2022-02-21 21:04:36 +00:00
|
|
|
if test $result2 = 0; then
|
|
|
|
if test -f Makefile.Release; then
|
|
|
|
mv Makefile.Release Makefile
|
2022-02-19 15:10:25 +00:00
|
|
|
fi
|
2022-02-21 21:04:36 +00:00
|
|
|
if test -f configure_plugin_import.cpp; then
|
|
|
|
cp configure_plugin_import.cpp "$old_wd/src/mkvtoolnix-gui/static_plugins.cpp"
|
|
|
|
fi
|
|
|
|
fi
|
2021-05-24 18:39:56 +00:00
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
"$QMAKE6" -query > "$qmake_dir/configure.properties"
|
|
|
|
result3=$?
|
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
cd "$old_wd"
|
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
if test $result != 0 -o $result2 != 0 -o $result3 != 0; then
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 6)
|
|
|
|
AC_MSG_RESULT(no: qmake6 couldn't be run for a dummy project)
|
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
rm -rf "$qmake_dir"
|
2021-05-24 18:39:56 +00:00
|
|
|
|
|
|
|
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
|
2022-07-26 05:58:55 +00:00
|
|
|
AC_MSG_RESULT(too old: $qmake6_ver, need at least $qt_min_ver)
|
2021-05-24 18:39:56 +00:00
|
|
|
return
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT($qmake6_ver)
|
|
|
|
fi
|
|
|
|
|
2022-02-19 15:10:25 +00:00
|
|
|
qt_bindir="`$ac_cv_path_EGREP '^QT_HOST_BINS:' "$qmake_dir/configure.properties" | sed 's/^QT_HOST_BINS://'`"
|
|
|
|
qt_libexecdir="`$ac_cv_path_EGREP '^QT_HOST_LIBEXECS:' "$qmake_dir/configure.properties" | sed 's/^QT_HOST_LIBEXECS://'`"
|
2022-07-30 12:40:22 +00:00
|
|
|
|
|
|
|
# If under MinGW/MSYS2, convert these two paths to Unix style
|
|
|
|
if ! test -z "${MINGW_PREFIX}"; then
|
|
|
|
qt_bindir="`cygpath -u ${qt_bindir}`"
|
|
|
|
qt_libexecdir="`cygpath -u ${qt_libexecdir}`"
|
|
|
|
fi
|
|
|
|
|
2021-05-24 18:39:56 +00:00
|
|
|
qt_searchpath="$qt_libexecdir:$qt_bindir:$PATH"
|
|
|
|
|
|
|
|
QT_CFLAGS="`$ac_cv_path_EGREP '^DEFINES *=' "$qmake_dir/Makefile" | sed 's/^DEFINES *= *//'`"
|
2022-02-19 15:10:25 +00:00
|
|
|
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/ -f[[a-z]][[^ ]]*//g' -e 's/ -W[[^ ]]*//g' -e 's/-std=[[^ ]]*//g' -e 's/\$([[^)]]*)//g'`"
|
2022-07-30 12:40:22 +00:00
|
|
|
QT_INCFLAGS="`$ac_cv_path_EGREP '^INCPATH *=' "$qmake_dir/Makefile" | sed -e 's/^INCPATH *= *//'`"
|
|
|
|
|
|
|
|
# If under MinGW/MSYS2, fix relative include paths
|
|
|
|
if ! test -z "${MINGW_PREFIX}"; then
|
|
|
|
QT_INCFLAGS="`echo $QT_INCFLAGS | sed -e "s:../..${MINGW_PREFIX}:${MINGW_PREFIX}:g"`"
|
|
|
|
fi
|
|
|
|
|
|
|
|
QT_INCFLAGS="`echo $QT_INCFLAGS | sed -e 's:-I[[^/]][[^ ]]*::g'`"
|
|
|
|
QT_CFLAGS="$QT_CFLAGS $QT_INCFLAGS"
|
2021-07-11 02:49:23 +00:00
|
|
|
QT_CFLAGS="`echo $QT_CFLAGS | sed -e 's/\$(EXPORT_ARCH_ARGS)//'`"
|
2022-02-19 15:10:25 +00:00
|
|
|
QT_LIBS="`$ac_cv_path_EGREP '^LFLAGS *=' "$qmake_dir/Makefile" | sed -e 's/^LFLAGS *= *//' -e 's/-Wl,-O[[^ ]]*//g' -e 's/ -f[[a-z]][[^ ]]*//g'`"
|
|
|
|
QT_LIBS="$QT_LIBS `$ac_cv_path_EGREP '^LIBS *=' "$qmake_dir/Makefile" | sed -e 's/^LIBS *= *//' -e 's/\$([[^)]]*)//g' -e 's:-L[[^/]][[^ ]]*::g'`"
|
2021-07-11 02:49:23 +00:00
|
|
|
QT_LIBS="`echo $QT_LIBS | sed -e 's/\$(EXPORT_ARCH_ARGS)//'`"
|
2022-02-19 15:10:25 +00:00
|
|
|
QT_LIBS_NON_GUI="`$ac_cv_path_EGREP '^LFLAGS *=' "$qmake_dir/Makefile.non_gui" | sed -e 's/^LFLAGS *= *//' -e 's/-Wl,-O[[^ ]]*//g' -e 's/ -f[[a-z]][[^ ]]*//g'`"
|
|
|
|
QT_LIBS_NON_GUI="$QT_LIBS_NON_GUI `$ac_cv_path_EGREP '^LIBS *=' "$qmake_dir/Makefile.non_gui" | sed -e 's/^LIBS *= *//' -e 's/\$([[^)]]*)//g' -e 's:-L[[^/]][[^ ]]*::g'`"
|
2022-02-21 21:04:36 +00:00
|
|
|
QT_LIBS_NON_GUI="`echo $QT_LIBS_NON_GUI | sed -e 's/\$(EXPORT_ARCH_ARGS)//' -e 's/-Wl,-subsystem,windows *//g'`"
|
2021-05-24 18:39:56 +00:00
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
rm -rf "$qmake_dir"
|
2021-05-24 18:39:56 +00:00
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
if test x"$QT_CFLAGS" = x -o x"$QT_LIBS" = x -o x"$QT_LIBS_NON_GUI" = x; then
|
2021-05-24 18:39:56 +00:00
|
|
|
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])
|
|
|
|
|
|
|
|
if test x"$MOC" = x; then
|
2021-05-24 19:08:22 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 6)
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_RESULT(no: could not find the moc executable)
|
2021-05-24 19:08:22 +00:00
|
|
|
return
|
2021-05-24 18:39:56 +00:00
|
|
|
|
|
|
|
elif test x"$RCC" = x; then
|
2021-05-24 19:08:22 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 6)
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_RESULT(no: could not find the rcc executable)
|
2021-05-24 19:08:22 +00:00
|
|
|
return
|
2021-05-24 18:39:56 +00:00
|
|
|
|
|
|
|
elif test x"$UIC" = x; then
|
2021-05-24 19:08:22 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 6)
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_MSG_RESULT(no: could not find the uic executable)
|
2021-05-24 19:08:22 +00:00
|
|
|
return
|
|
|
|
fi
|
2021-05-24 18:39:56 +00:00
|
|
|
|
2021-05-24 19:08:22 +00:00
|
|
|
dnl compile test program
|
|
|
|
AC_LANG_PUSH(C++)
|
|
|
|
AC_CACHE_VAL(am_cv_qt6_compilation, [
|
|
|
|
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([
|
|
|
|
#include <QtCore>
|
|
|
|
#include <QCoreApplication>
|
|
|
|
class Config : public QCoreApplication {
|
|
|
|
public:
|
|
|
|
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_qt6_compilation=1 ], [ am_cv_qt6_compilation=0 ])
|
|
|
|
|
|
|
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
|
|
|
LIBS="$ac_save_LIBS"
|
|
|
|
])
|
|
|
|
AC_LANG_POP()
|
|
|
|
|
|
|
|
if test x"$am_cv_qt6_compilation" != x1; then
|
|
|
|
AC_MSG_CHECKING(for Qt 6)
|
|
|
|
AC_MSG_RESULT(no: could not compile a test program)
|
|
|
|
return
|
2021-05-24 18:39:56 +00:00
|
|
|
fi
|
2021-05-24 19:08:22 +00:00
|
|
|
|
2022-02-21 21:35:56 +00:00
|
|
|
AC_LANG_PUSH(C++)
|
|
|
|
ac_save_CXXFLAGS="$CXXFLAGS"
|
|
|
|
CXXFLAGS="$STD_CXX $CXXFLAGS $QT_CFLAGS -fPIC"
|
|
|
|
AC_CHECK_HEADERS([QMediaPlayer])
|
|
|
|
CXXFLAGS="$ac_save_CXXFLAGS"
|
|
|
|
AC_LANG_POP()
|
|
|
|
|
2021-05-24 19:08:22 +00:00
|
|
|
AC_DEFINE(HAVE_QT, 1, [Define if Qt is present])
|
2021-05-30 12:33:05 +00:00
|
|
|
AC_MSG_CHECKING(for Qt 6)
|
2021-05-24 19:08:22 +00:00
|
|
|
AC_MSG_RESULT(yes)
|
|
|
|
have_qt6=yes
|
2021-05-24 18:39:56 +00:00
|
|
|
}
|
|
|
|
|
2021-06-15 20:39:33 +00:00
|
|
|
AC_ARG_ENABLE([gui],
|
|
|
|
AC_HELP_STRING([--enable-gui],[compile the Qt-based GUI (yes)]),
|
|
|
|
[],[enable_gui=yes])
|
2021-05-24 18:39:56 +00:00
|
|
|
AC_ARG_ENABLE([qt6],
|
2021-06-15 20:39:33 +00:00
|
|
|
AC_HELP_STRING([--enable-qt6],[compile with Qt 6 (yes)]),
|
2021-05-24 18:39:56 +00:00
|
|
|
[],[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
|
2021-06-15 20:39:33 +00:00
|
|
|
unset QT_CFLAGS QT_LIBS QT_LIBS_NON_GUI LCONVERT MOC RCC UIC ac_cv_path_LCONVERT ac_cv_path_MOC ac_cv_path_RCC ac_cv_path_UIC
|
2021-05-24 18:39:56 +00:00
|
|
|
fi
|
|
|
|
fi
|