Skip to content

Commit 3e46f18

Browse files
author
wonder
committed
Qt4 detection in configure script using pkgconfig.
git-svn-id: http://svn.osgeo.org/qgis/trunk@5008 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a4067da commit 3e46f18

File tree

2 files changed

+93
-20
lines changed

2 files changed

+93
-20
lines changed

acinclude.m4

+92
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,98 @@ AC_SUBST(QTDIR)
508508
])
509509

510510

511+
dnl ------------------------------------------------------------------------
512+
dnl
513+
dnl improved Qt4 check
514+
dnl - uses pkgconfig by default
515+
dnl - can be overridden by -with-qtdir=....
516+
dnl
517+
dnl ------------------------------------------------------------------------
518+
519+
AC_DEFUN([AQ_CHECK_QT4],[
520+
521+
AC_ARG_WITH([qtdir], AC_HELP_STRING([--with-qtdir=DIR],[Qt4 installation directory]),
522+
QTDIR="$withval", QTDIR="")
523+
524+
QT_MIN_VER=4.1.0
525+
526+
if test "x$QTDIR" == "x" ; then
527+
528+
dnl ---------------------------------------------------------------------------
529+
dnl we will use PKGCONFIG, check that all needed Qt4 components are there
530+
dnl ---------------------------------------------------------------------------
531+
532+
PKG_CHECK_MODULES(QTCORE, QtCore >= $QT_MIN_VER)
533+
PKG_CHECK_MODULES(QTGUI, QtGui >= $QT_MIN_VER)
534+
PKG_CHECK_MODULES(QT3SUP, Qt3Support >= $QT_MIN_VER)
535+
PKG_CHECK_MODULES(QTNET, QtNetwork >= $QT_MIN_VER)
536+
PKG_CHECK_MODULES(QTXML, QtXml >= $QT_MIN_VER)
537+
PKG_CHECK_MODULES(QTSVG, QtSvg >= $QT_MIN_VER)
538+
539+
dnl check for Qt binaries needed for compilation: moc,uic,rcc
540+
dnl (we could also check for moc and uic versions)
541+
542+
AC_CHECK_PROG(MOC, moc, moc)
543+
if test x$MOC = x ; then
544+
AC_MSG_ERROR([*** moc must be in path])
545+
fi
546+
AC_CHECK_PROG(UIC, uic, uic)
547+
if test x$UIC = x ; then
548+
AC_MSG_ERROR([*** uic must be in path])
549+
fi
550+
AC_CHECK_PROG(RCC, rcc, rcc)
551+
if test x$RCC = x ; then
552+
AC_MSG_ERROR([*** rcc must be in path])
553+
fi
554+
555+
dnl set and display variables
556+
557+
QT_CXXFLAGS="-DQT3_SUPPORT $QTCORE_CFLAGS $QTGUI_CFLAGS $QT3SUP_CFLAGS $QTNET_CFLAGS $QTXML_CFLAGS $QTSVG_CFLAGS"
558+
AC_MSG_CHECKING([QT_CXXFLAGS])
559+
AC_MSG_RESULT([$QT_CXXFLAGS])
560+
AC_SUBST([$QT_CXXFLAGS])
561+
562+
QT_LDADD="$QTCORE_LIBS $QTGUI_LIBS $QT3SUP_LIBS $QTNET_LIBS $QTXML_LIBS $QTSVG_LIBS"
563+
AC_MSG_CHECKING([QT_LDADD])
564+
AC_MSG_RESULT([$QT_LDADD])
565+
AC_SUBST([$QT_LDADD])
566+
567+
QTDIR="no_qtdir"
568+
AC_SUBST([$QTDIR])
569+
570+
QT_MAJOR=4
571+
572+
else
573+
574+
dnl ---------------------------------------------------------------------------
575+
dnl let's use old code for detection
576+
dnl it needs cleanups since there is still Qt3 detection stuff
577+
dnl ---------------------------------------------------------------------------
578+
AQ_CHECK_QT
579+
580+
dnl ---------------------------------------------------------------------------
581+
dnl Qt/Mac check (install everything into application bundle)
582+
dnl ---------------------------------------------------------------------------
583+
if test x$QTDIR != x -a -f "$QTDIR/mkspecs/default/Info.plist.app"; then
584+
have_qtmac=yes
585+
bundle_suffix=$PACKAGE.app/Contents/MacOS
586+
if test `expr "$prefix" : ".*$bundle_suffix$"` -eq 0; then
587+
prefix="$prefix/$bundle_suffix"
588+
fi
589+
fi
590+
591+
fi
592+
593+
dnl do we still need this? [MD]
594+
dnl Assume for the moment that Qt4 installations will still compile against uic3
595+
dnl AM_CONDITIONAL([NO_UIC_IMPLEMENTATIONS], [test "$QT_MAJOR" = "4"])
596+
AM_CONDITIONAL([NO_UIC_IMPLEMENTATIONS], [test "$QT_MAJOR" = "0"])
597+
AM_CONDITIONAL([HAVE_QT3], [test "$QT_MAJOR" = "3"])
598+
AM_CONDITIONAL([HAVE_QT4], [test "$QT_MAJOR" = "4"])
599+
600+
AM_CONDITIONAL([HAVE_QTMAC], [test "$have_qtmac" = "yes"])
601+
])
602+
511603

512604
# Configure path for the GNU Scientific Library
513605
# Christopher R. Gabriel <cgabriel@linux.it>, April 2000

configure.in

+1-20
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,7 @@ AQ_CHECK_LIB64
8484
dnl ---------------------------------------------------------------------------
8585
dnl Qt check
8686
dnl ---------------------------------------------------------------------------
87-
AQ_CHECK_QT
88-
89-
dnl Assume for the moment that Qt4 installations will still compile against uic3
90-
dnl AM_CONDITIONAL([NO_UIC_IMPLEMENTATIONS], [test "$QT_MAJOR" = "4"])
91-
AM_CONDITIONAL([NO_UIC_IMPLEMENTATIONS], [test "$QT_MAJOR" = "0"])
92-
93-
AM_CONDITIONAL([HAVE_QT3], [test "$QT_MAJOR" = "3"])
94-
AM_CONDITIONAL([HAVE_QT4], [test "$QT_MAJOR" = "4"])
95-
96-
dnl ---------------------------------------------------------------------------
97-
dnl Qt/Mac check (install everything into application bundle)
98-
dnl ---------------------------------------------------------------------------
99-
if test x$QTDIR != x -a -f "$QTDIR/mkspecs/default/Info.plist.app"; then
100-
have_qtmac=yes
101-
bundle_suffix=$PACKAGE.app/Contents/MacOS
102-
if test `expr "$prefix" : ".*$bundle_suffix$"` -eq 0; then
103-
prefix="$prefix/$bundle_suffix"
104-
fi
105-
fi
106-
AM_CONDITIONAL([HAVE_QTMAC], [test "$have_qtmac" = "yes"])
87+
AQ_CHECK_QT4
10788

10889
dnl ---------------------------------------------------------------------------
10990
dnl Python

0 commit comments

Comments
 (0)