Skip to content

Commit e665603

Browse files
author
wonder
committed
Qt4 detection by using pkg-config is not default anymore, to enable it, use --with-qt-pkg-config
Added support for QtTest in pkg-config detection. git-svn-id: http://svn.osgeo.org/qgis/trunk@5257 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 471d17b commit e665603

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

acinclude.m4

+16-4
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,19 @@ AC_DEFUN([AQ_CHECK_QT4],[
515515
516516
AC_ARG_WITH([qtdir], AC_HELP_STRING([--with-qtdir=DIR],[Qt4 installation directory]),
517517
QTDIR="$withval", QTDIR="")
518+
AC_ARG_WITH([qt-pkg-config], AC_HELP_STRING([--with-qt-pkg-config],
519+
[Detect Qt4 directory using pkg-config instead of using --with-qtdir. Works only with Qt4 version for X11.]),
520+
QT_PKG_CONFIG="y", QT_PKG_CONFIG="n")
518521
519-
QT_MIN_VER=4.1.0
520-
521-
if test "x$QTDIR" = "x" ; then
522+
if test "$QT_PKG_CONFIG" = "y" ; then
522523
523524
dnl ---------------------------------------------------------------------------
524525
dnl we will use PKGCONFIG, check that all needed Qt4 components are there
525526
dnl ---------------------------------------------------------------------------
526527
527-
PKG_CHECK_MODULES(QT, QtCore QtGui Qt3Support QtNetwork QtXml QtSvg >= $QT_MIN_VER)
528+
QT_MIN_VER=4.1.0
529+
530+
PKG_CHECK_MODULES(QT, QtCore QtGui Qt3Support QtNetwork QtXml QtSvg QtTest >= $QT_MIN_VER)
528531
529532
dnl check for Qt binaries needed for compilation: moc,uic,rcc
530533
dnl (we could also check for moc and uic versions)
@@ -542,6 +545,15 @@ AC_DEFUN([AQ_CHECK_QT4],[
542545
AC_MSG_ERROR([*** rcc must be in path])
543546
fi
544547
548+
dnl workaround for case when QtTest doesn't report QtTest subdirectory
549+
dnl in include path (this is not a very nice check)
550+
PKG_CHECK_MODULES(QT_TEST, QtTest >= $QT_MIN_VER)
551+
QT_TEST_CFLAGS=`echo $QT_TEST_CFLAGS | sed 's/[ \t]*$//'` # remove trailing spaces
552+
QTTEST_HAS_SUBDIR=`echo $QT_TEST_CFLAGS | grep '/QtTest' | wc -l`
553+
if test "$QTTEST_HAS_SUBDIR" -eq "0" ; then
554+
QT_CFLAGS="$QT_CFLAGS $QT_TEST_CFLAGS/QtTest"
555+
fi
556+
545557
dnl set and display variables
546558
547559
QT_CXXFLAGS="-DQT3_SUPPORT $QT_CFLAGS"

0 commit comments

Comments
 (0)