mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Support qmake with Qt5 too
This extends the support of qmake to Qt5. Currently, the other configuration methods are tried if qmake fails, but a message is printed. A nice goal would be to get rid of those legacy methods (pkg-config, plain autoconf-style), if this proves possible.
This commit is contained in:
parent
4534a20f1a
commit
5d76b4bb8f
110
config/qt.m4
110
config/qt.m4
@ -166,40 +166,43 @@ AC_DEFUN([QT_DO_IT_ALL],
|
|||||||
esac
|
esac
|
||||||
AC_SUBST(QT_CPPFLAGS)
|
AC_SUBST(QT_CPPFLAGS)
|
||||||
|
|
||||||
dnl Check if it possible to do a pkg-config
|
dnl Check if it possible to do a pkg-config (for later)
|
||||||
PKG_PROG_PKG_CONFIG
|
PKG_PROG_PKG_CONFIG
|
||||||
dnl Not possible with Qt6 (QTBUG-86080)
|
|
||||||
if test x$USE_QT6 = xno ; then
|
dnl Try qmake first
|
||||||
if test -n "$PKG_CONFIG" ; then
|
QT_QMAKE_CONFIG([$USE_QT6])
|
||||||
QT_DO_PKG_CONFIG
|
if test -z "$QT_LIB"; then
|
||||||
|
dnl pkg-config does not work with Qt6 (QTBUG-86080)
|
||||||
|
if test x$USE_QT6 = xno ; then
|
||||||
|
if test -n "$PKG_CONFIG" ; then
|
||||||
|
QT_DO_PKG_CONFIG
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if test "$pkg_failed" != "no" ; then
|
fi
|
||||||
QT_DO_MANUAL_CONFIG
|
dnl last chance: old-style configuration
|
||||||
fi
|
if test -z "$QT_LIB"; then
|
||||||
else
|
QT_DO_MANUAL_CONFIG
|
||||||
QT6_QMAKE_CONFIG
|
fi
|
||||||
if test -z "$QT_LIB"; then
|
|
||||||
QT_DO_MANUAL_CONFIG
|
if test -z "$QT_LIB"; then
|
||||||
|
dnl Try again with Qt5 if configuring for Qt6 failed
|
||||||
|
dnl this is mostly the same logic as above
|
||||||
|
if test x$USE_QT6 = xyes ; then
|
||||||
|
USE_QT6=no
|
||||||
|
QT_QMAKE_CONFIG([$USE_QT6])
|
||||||
|
if test -z "$QT_LIB"; then
|
||||||
|
if test -n "$PKG_CONFIG" ; then
|
||||||
|
QT_DO_PKG_CONFIG
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if test -z "$QT_LIB"; then
|
||||||
|
QT_DO_MANUAL_CONFIG
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -z "$QT_LIB"; then
|
if test -z "$QT_LIB"; then
|
||||||
dnl Try again with Qt5 and if configuring for Qt6/5 fails
|
AC_MSG_ERROR([Cannot find Qt libraries.])
|
||||||
if test x$USE_QT6 = xyes ; then
|
|
||||||
USE_QT6=no
|
|
||||||
AC_SUBST([USE_QT6])
|
|
||||||
if test -n "$PKG_CONFIG" ; then
|
|
||||||
QT_DO_PKG_CONFIG
|
|
||||||
fi
|
|
||||||
if test "$pkg_failed" != "no" ; then
|
|
||||||
QT_DO_MANUAL_CONFIG
|
|
||||||
fi
|
|
||||||
if test -z "$QT_LIB"; then
|
|
||||||
AC_MSG_ERROR([cannot find qt libraries.])
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([cannot find qt libraries.])
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Check qt version
|
dnl Check qt version
|
||||||
@ -375,13 +378,20 @@ AC_DEFUN([QT_DO_MANUAL_CONFIG],
|
|||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([QT6_QMAKE_CONFIG],
|
dnl QT_QMAKE_CONFIG(USE_QT6)
|
||||||
|
dnl
|
||||||
|
AC_DEFUN([QT_QMAKE_CONFIG],
|
||||||
[
|
[
|
||||||
dnl Use first suitable qmake in PATH
|
dnl Use first suitable qmake in PATH
|
||||||
AC_CHECK_PROGS([QT_QMAKE], [qmake-qt6 qmake6], [qmake], $PATH)
|
if test $1 = "yes"; then
|
||||||
AC_MSG_CHECKING([for Qt6])
|
qt_major=6
|
||||||
|
else
|
||||||
|
qt_major=5
|
||||||
|
fi
|
||||||
|
AC_CHECK_PROGS([QT_QMAKE], [qmake-qt$qt_major qmake$qt_major qmake], [], $PATH)
|
||||||
|
AC_MSG_CHECKING([for Qt$qt_major])
|
||||||
qtver=`$QT_QMAKE -v | grep -o "Qt version ."`
|
qtver=`$QT_QMAKE -v | grep -o "Qt version ."`
|
||||||
if test "$qtver" = "Qt version 6"; then
|
if test "$qtver" = "Qt version $qt_major"; then
|
||||||
qt_cv_libexec=`$QT_QMAKE -query QT_INSTALL_LIBEXECS`
|
qt_cv_libexec=`$QT_QMAKE -query QT_INSTALL_LIBEXECS`
|
||||||
dnl Use a .pro file for getting qmake's variables
|
dnl Use a .pro file for getting qmake's variables
|
||||||
lyx_test_qt_dir=`mktemp -d`
|
lyx_test_qt_dir=`mktemp -d`
|
||||||
@ -412,18 +422,28 @@ EOF1
|
|||||||
AC_SUBST(QT_CORE_LIB)
|
AC_SUBST(QT_CORE_LIB)
|
||||||
cat > $lyx_test_qt_pro << EOF2
|
cat > $lyx_test_qt_pro << EOF2
|
||||||
QMAKE_EXTRA_VARIABLES = MISSING
|
QMAKE_EXTRA_VARIABLES = MISSING
|
||||||
|
percent.target = %
|
||||||
|
percent.commands = @echo -n "\$(\$(@))\ "
|
||||||
|
QMAKE_EXTRA_TARGETS += percent
|
||||||
|
QMAKE_PROJECT_DEPTH = 0
|
||||||
qtHaveModule(core) {QT += core} else {MISSING += core}
|
qtHaveModule(core) {QT += core} else {MISSING += core}
|
||||||
qtHaveModule(concurrent) {QT += concurrent} else {MISSING += concurrent}
|
qtHaveModule(concurrent) {QT += concurrent} else {MISSING += concurrent}
|
||||||
qtHaveModule(gui) {QT += gui} else {MISSING += gui}
|
qtHaveModule(gui) {QT += gui} else {MISSING += gui}
|
||||||
qtHaveModule(gui-private) {QT += gui-private} else {MISSING += gui-private}
|
qtHaveModule(gui-private) {QT += gui-private} else {MISSING += gui-private}
|
||||||
qtHaveModule(svg) {QT += svg} else {MISSING += svg}
|
qtHaveModule(svg) {QT += svg} else {MISSING += svg}
|
||||||
qtHaveModule(svgwidgets) {QT += svgwidgets} else {MISSING += svgwidgets}
|
|
||||||
qtHaveModule(widgets) {QT += widgets} else {MISSING += widgets}
|
qtHaveModule(widgets) {QT += widgets} else {MISSING += widgets}
|
||||||
percent.target = %
|
|
||||||
percent.commands = @echo -n "\$(\$(@))\ "
|
|
||||||
QMAKE_EXTRA_TARGETS += percent
|
|
||||||
QMAKE_PROJECT_DEPTH = 0
|
|
||||||
EOF2
|
EOF2
|
||||||
|
if test "$qt_major" = 6; then
|
||||||
|
cat >> $lyx_test_qt_pro << EOF3
|
||||||
|
qtHaveModule(svgwidgets) {QT += svgwidgets} else {MISSING += svgwidgets}
|
||||||
|
EOF3
|
||||||
|
else
|
||||||
|
cat >> $lyx_test_qt_pro << EOF4
|
||||||
|
qtHaveModule(x11extras) {QT += x11extras}
|
||||||
|
qtHaveModule(macextras) {QT += macextras}
|
||||||
|
qtHaveModule(winextras) {QT += winextras}
|
||||||
|
EOF4
|
||||||
|
fi
|
||||||
$QT_QMAKE $lyx_test_qt_pro -o $lyx_test_qt_mak 1>/dev/null 2>&1
|
$QT_QMAKE $lyx_test_qt_pro -o $lyx_test_qt_mak 1>/dev/null 2>&1
|
||||||
QT_INCLUDES=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak INCPATH | sed 's/-I\. //g'`
|
QT_INCLUDES=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak INCPATH | sed 's/-I\. //g'`
|
||||||
qt_guilibs=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak LIBS`
|
qt_guilibs=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak LIBS`
|
||||||
@ -434,15 +454,20 @@ EOF2
|
|||||||
else
|
else
|
||||||
QT_LIB=`echo $qt_guilibs | tr ' ' '\n' | grep -v "^-L" | tr '\n' ' '`
|
QT_LIB=`echo $qt_guilibs | tr ' ' '\n' | grep -v "^-L" | tr '\n' ' '`
|
||||||
fi
|
fi
|
||||||
QTLIB_VERSION=`$QT_QMAKE -v | grep "Qt version" | sed -e 's/.*\([[0-9]]\.[[0-9]]*\.[[0-9]]\).*/\1/'`
|
QTLIB_VERSION=`$QT_QMAKE -v | grep "Qt version" | sed -e 's/.*\([[0-9]]\.[[0-9]]*\.[[0-9]]*\).*/\1/'`
|
||||||
if test -z "$QT_LIB"; then
|
if test -z "$QT_LIB"; then
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
else
|
else
|
||||||
QT_MISSING=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak EXPORT_MISSING | sed 's/^ *//'`
|
QT_MISSING=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak EXPORT_MISSING | sed 's/^ *//'`
|
||||||
if test -n "$QT_MISSING"; then
|
if test -n "$QT_MISSING"; then
|
||||||
AC_MSG_ERROR([Qt6 module(s) $QT_MISSING not found.])
|
AC_MSG_ERROR([Qt$qt_major module(s) $QT_MISSING not found.])
|
||||||
fi
|
fi
|
||||||
AC_MSG_RESULT(yes)
|
QT5_X11_EXTRAS=`cd $lyx_test_qt_dir; make -s -f $lyx_test_qt_mak DEFINES | grep QT_X11EXTRAS_LIB`
|
||||||
|
if test -n "$QT5_X11_EXTRAS"; then
|
||||||
|
AC_DEFINE(HAVE_QT5_X11_EXTRAS, 1,
|
||||||
|
[Define if you have the Qt5X11Extras module])
|
||||||
|
fi
|
||||||
|
AC_MSG_RESULT($QTLIB_VERSION)
|
||||||
AC_SUBST(QT_INCLUDES)
|
AC_SUBST(QT_INCLUDES)
|
||||||
AC_SUBST(QT_LDFLAGS)
|
AC_SUBST(QT_LDFLAGS)
|
||||||
AC_SUBST(QT_LIB)
|
AC_SUBST(QT_LIB)
|
||||||
@ -454,4 +479,7 @@ EOF2
|
|||||||
else
|
else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
|
if test -z "$QT_LIB"; then
|
||||||
|
LYX_WARNING([Unable to configure Qt$qt_major with qmake. Please report.])
|
||||||
|
fi
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user