Chris@198: Chris@198: AC_DEFUN([SV_MODULE_REQUIRED], Chris@198: [ Chris@198: SV_MODULE_MODULE=$1 Chris@198: SV_MODULE_VERSION_TEST="$2" Chris@198: SV_MODULE_HEADER=$3 Chris@198: SV_MODULE_LIB=$4 Chris@198: SV_MODULE_FUNC=$5 Chris@198: SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') Chris@198: SV_MODULE_FAILED=1 Chris@198: if test -z "$SV_MODULE_VERSION_TEST" ; then Chris@198: SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE Chris@198: fi Chris@198: if test -n "$PKG_CONFIG"; then Chris@198: PKG_CHECK_MODULES($1,[$SV_MODULE_VERSION_TEST],[HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $$1_CFLAGS";LIBS="$LIBS $$1_LIBS";SV_MODULE_FAILED=""],[AC_MSG_NOTICE([Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means])]) Chris@198: fi Chris@198: if test -n "$SV_MODULE_FAILED"; then Chris@198: AC_CHECK_HEADER([$SV_MODULE_HEADER],[HAVES="$HAVES $SV_MODULE_HAVE"],[AC_MSG_ERROR([Failed to find header $SV_MODULE_HEADER for required module $SV_MODULE_MODULE])]) Chris@198: if test -n "$SV_MODULE_LIB"; then Chris@198: AC_CHECK_LIB([$SV_MODULE_LIB],[$SV_MODULE_FUNC],[LIBS="$LIBS -l$SV_MODULE_LIB"],[AC_MSG_ERROR([Failed to find library $SV_MODULE_LIB for required module $SV_MODULE_MODULE])]) Chris@198: fi Chris@198: fi Chris@198: ]) Chris@198: Chris@198: AC_DEFUN([SV_MODULE_OPTIONAL], Chris@198: [ Chris@198: SV_MODULE_MODULE=$1 Chris@198: SV_MODULE_VERSION_TEST="$2" Chris@198: SV_MODULE_HEADER=$3 Chris@198: SV_MODULE_LIB=$4 Chris@198: SV_MODULE_FUNC=$5 Chris@198: SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') Chris@198: SV_MODULE_FAILED=1 Chris@198: if test -z "$SV_MODULE_VERSION_TEST" ; then Chris@198: SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE Chris@198: fi Chris@198: if test -n "$PKG_CONFIG"; then Chris@200: PKG_CHECK_MODULES($1,[$SV_MODULE_VERSION_TEST],[HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $$1_CFLAGS";LIBS="$LIBS $$1_LIBS";SV_MODULE_FAILED=""],[AC_MSG_NOTICE([Failed to find optional module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means])]) Chris@198: fi Chris@198: if test -n "$SV_MODULE_FAILED"; then Chris@198: AC_CHECK_HEADER([$SV_MODULE_HEADER],[HAVES="$HAVES $SV_MODULE_HAVE";SV_MODULE_FAILED=""],[AC_MSG_NOTICE([Failed to find header $SV_MODULE_HEADER for optional module $SV_MODULE_MODULE])]) Chris@198: if test -z "$SV_MODULE_FAILED"; then Chris@198: if test -n "$SV_MODULE_LIB"; then Chris@198: AC_CHECK_LIB([$SV_MODULE_LIB],[$SV_MODULE_FUNC],[LIBS="$LIBS -l$SV_MODULE_LIB"],[AC_MSG_NOTICE([Failed to find library $SV_MODULE_LIB for optional module $SV_MODULE_MODULE])]) Chris@198: fi Chris@198: fi Chris@198: fi Chris@198: ]) Chris@198: Chris@198: # Check for Qt compiler flags, linker flags, and binary packages Chris@198: AC_DEFUN([SV_CHECK_QT], Chris@198: [ Chris@198: AC_REQUIRE([AC_PROG_CXX]) Chris@198: Chris@198: AC_MSG_CHECKING([QTDIR]) Chris@198: AC_ARG_WITH([qtdir], [ --with-qtdir=DIR Qt installation directory [default=$QTDIR]], QTDIR=$withval) Chris@198: # Check that QTDIR is defined or that --with-qtdir given Chris@198: if test x"$QTDIR" = x ; then Chris@198: # some usual Qt locations Chris@198: QT_SEARCH="/usr /opt /usr/lib/qt" Chris@198: else Chris@198: case "$QTDIR" in *3*) Chris@198: AC_MSG_WARN([ Chris@198: *** The QTDIR environment variable is set to "$QTDIR". Chris@198: This looks like it could be the location of a Qt3 installation Chris@198: instead of the Qt4 installation we require. If configure fails, Chris@198: please ensure QTDIR is either set correctly or not set at all. Chris@198: ]) Chris@198: ;; Chris@198: esac Chris@198: QT_SEARCH=$QTDIR Chris@198: QTDIR="" Chris@198: fi Chris@198: for i in $QT_SEARCH ; do Chris@198: QT_INCLUDE_SEARCH="include/qt4 include" Chris@198: for j in $QT_INCLUDE_SEARCH ; do Chris@198: if test -f $i/$j/Qt/qglobal.h && test x$QTDIR = x ; then Chris@198: QTDIR=$i Chris@198: QT_INCLUDES=$i/$j Chris@198: fi Chris@198: done Chris@198: done Chris@198: if test x"$QTDIR" = x ; then Chris@198: AC_MSG_ERROR([*** Failed to find Qt4 installation. QTDIR must be defined, or --with-qtdir option given]) Chris@198: fi Chris@198: AC_MSG_RESULT([$QTDIR]) Chris@198: Chris@198: # Change backslashes in QTDIR to forward slashes to prevent escaping Chris@198: # problems later on in the build process, mainly for Cygwin build Chris@198: # environment using MSVC as the compiler Chris@198: QTDIR=`echo $QTDIR | sed 's/\\\\/\\//g'` Chris@198: Chris@198: AC_MSG_CHECKING([Qt includes]) Chris@198: # Check where includes are located Chris@198: if test x"$QT_INCLUDES" = x ; then Chris@198: AC_MSG_ERROR([ Chris@198: Failed to find required Qt4 headers. Chris@198: Please ensure you have the Qt4 development files installed, Chris@198: and if necessary set QTDIR to the location of your Qt4 installation. Chris@198: ]) Chris@198: fi Chris@198: AC_MSG_RESULT([$QT_INCLUDES]) Chris@198: Chris@198: # Check that qmake is in path Chris@198: AC_CHECK_PROG(QMAKE, qmake-qt4, $QTDIR/bin/qmake-qt4,,$QTDIR/bin/) Chris@198: if test x$QMAKE = x ; then Chris@198: AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/) Chris@198: if test x$QMAKE = x ; then Chris@198: AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/) Chris@198: if test x$QMAKE = x ; then Chris@198: AC_MSG_ERROR([ Chris@198: Failed to find the required qmake-qt4 or qmake program. Please Chris@198: ensure you have the necessary Qt4 development files installed. Chris@198: ]) Chris@198: fi Chris@198: fi Chris@198: fi Chris@198: Chris@198: # Suitable versions of qmake should print out something like: Chris@198: # Chris@198: # QMake version 2.01a Chris@198: # Using Qt version 4.6.3 in /usr/lib Chris@198: # Chris@198: # This may be translated, so we check only for the numbers (2.x and 4.x Chris@198: # in that order). Chris@198: # Chris@198: QMAKE_VERSION_OUTPUT=`$QMAKE -v` Chris@198: case "$QMAKE_VERSION_OUTPUT" in Chris@198: *2.*4.*) ;; Chris@198: *) AC_MSG_WARN([ Chris@198: *** The version of qmake found in "$QMAKE" looks like it might be Chris@198: from the wrong version of Qt (Qt4 is required). Please check Chris@198: that this is the correct version of qmake for Qt4 builds. Chris@198: ]) Chris@198: esac Chris@198: Chris@198: # Check that moc is in path Chris@198: AC_CHECK_PROG(MOC, moc-qt4, $QTDIR/bin/moc-qt4,,$QTDIR/bin/) Chris@198: if test x$MOC = x ; then Chris@198: AC_CHECK_PROG(MOC, moc, $QTDIR/bin/moc,,$QTDIR/bin/) Chris@198: if test x$MOC = x ; then Chris@198: AC_CHECK_PROG(MOC, moc.exe, $QTDIR/bin/moc.exe,,$QTDIR/bin/) Chris@198: if test x$MOC = x ; then Chris@198: AC_MSG_ERROR([ Chris@198: Failed to find required moc-qt4 or moc program. Chris@198: Please ensure you have the Qt4 development files installed, Chris@198: and if necessary set QTDIR to the location of your Qt4 installation. Chris@198: ]) Chris@198: fi Chris@198: fi Chris@198: fi Chris@198: Chris@198: # Check that uic is in path Chris@198: AC_CHECK_PROG(UIC, uic-qt4, $QTDIR/bin/uic-qt4,,$QTDIR/bin/) Chris@198: if test x$UIC = x ; then Chris@198: AC_CHECK_PROG(UIC, uic, $QTDIR/bin/uic,,$QTDIR/bin/) Chris@198: if test x$UIC = x ; then Chris@198: AC_CHECK_PROG(UIC, uic.exe, $QTDIR/bin/uic.exe,,$QTDIR/bin/) Chris@198: if test x$UIC = x ; then Chris@198: AC_MSG_ERROR([ Chris@198: Failed to find required uic-qt4 or uic program. Chris@198: Please ensure you have the Qt4 development files installed, Chris@198: and if necessary set QTDIR to the location of your Qt4 installation. Chris@198: ]) Chris@198: fi Chris@198: fi Chris@198: fi Chris@198: Chris@198: # Check that rcc is in path Chris@198: AC_CHECK_PROG(RCC, rcc-qt4, $QTDIR/bin/rcc-qt4,,$QTDIR/bin/) Chris@198: if test x$RCC = x ; then Chris@198: AC_CHECK_PROG(RCC, rcc, $QTDIR/bin/rcc,,$QTDIR/bin/) Chris@198: if test x$RCC = x ; then Chris@198: AC_CHECK_PROG(RCC, rcc.exe, $QTDIR/bin/rcc.exe,,$QTDIR/bin/) Chris@198: if test x$RCC = x ; then Chris@198: AC_MSG_ERROR([ Chris@198: Failed to find required rcc-qt4 or rcc program. Chris@198: Please ensure you have the Qt4 development files installed, Chris@198: and if necessary set QTDIR to the location of your Qt4 installation. Chris@198: ]) Chris@198: fi Chris@198: fi Chris@198: fi Chris@198: Chris@198: # lupdate is the Qt translation-update utility. Chris@198: AC_CHECK_PROG(LUPDATE, lupdate-qt4, $QTDIR/bin/lupdate-qt4,,$QTDIR/bin/) Chris@198: if test x$LUPDATE = x ; then Chris@198: AC_CHECK_PROG(LUPDATE, lupdate, $QTDIR/bin/lupdate,,$QTDIR/bin/) Chris@198: if test x$LUPDATE = x ; then Chris@198: AC_CHECK_PROG(LUPDATE, lupdate.exe, $QTDIR/bin/lupdate.exe,,$QTDIR/bin/) Chris@198: if test x$LUPDATE = x ; then Chris@198: AC_MSG_WARN([ Chris@198: Failed to find lupdate-qt4 or lupdate program. Chris@198: This program is not needed for a simple build, Chris@198: but it should be part of a Qt4 development installation Chris@198: and its absence is troubling. Chris@198: ]) Chris@198: fi Chris@198: fi Chris@198: fi Chris@198: Chris@198: # lrelease is the Qt translation-release utility. Chris@198: AC_CHECK_PROG(LRELEASE, lrelease-qt4, $QTDIR/bin/lrelease-qt4,,$QTDIR/bin/) Chris@198: if test x$LRELEASE = x ; then Chris@198: AC_CHECK_PROG(LRELEASE, lrelease, $QTDIR/bin/lrelease,,$QTDIR/bin/) Chris@198: if test x$LRELEASE = x ; then Chris@198: AC_CHECK_PROG(LRELEASE, lrelease.exe, $QTDIR/bin/lrelease.exe,,$QTDIR/bin/) Chris@198: if test x$LRELEASE = x ; then Chris@198: AC_MSG_WARN([ Chris@198: Failed to find lrelease-qt4 or lrelease program. Chris@198: This program is not needed for a simple build, Chris@198: but it should be part of a Qt4 development installation Chris@198: and its absence is troubling. Chris@198: ]) Chris@198: fi Chris@198: fi Chris@198: fi Chris@198: Chris@198: QT_CXXFLAGS="-I$QT_INCLUDES/QtGui -I$QT_INCLUDES/QtXml -I$QT_INCLUDES/QtNetwork -I$QT_INCLUDES/QtCore -I$QT_INCLUDES" Chris@198: Chris@198: AC_MSG_CHECKING([QTLIBDIR]) Chris@198: AC_ARG_WITH([qtlibdir], [ --with-qtlibdir=DIR Qt library directory [default=$QTLIBDIR]], QTLIBDIR=$withval) Chris@198: if test x"$QTLIBDIR" = x ; then Chris@198: # bin is included because that's where Qt DLLs hide on Windows Chris@198: # On Mandriva Qt libraries are in /usr/lib or /usr/lib64 although Chris@198: # QTDIR is /usr/lib/qt4 Chris@198: QTLIB_SEARCH="$QTDIR/lib $QTDIR/lib64 $QTDIR/lib32 $QTDIR/bin /usr/lib /usr/lib64" Chris@198: else Chris@198: case "$QTLIBDIR" in *3*) Chris@198: AC_MSG_WARN([ Chris@198: The QTLIBDIR environment variable is set to "$QTLIBDIR". Chris@198: This looks suspiciously like the location for Qt3 libraries Chris@198: instead of the Qt4 libraries we require. If configure fails, Chris@198: please ensure QTLIBDIR is either set correctly or not set at all. Chris@198: ]) Chris@198: ;; Chris@198: esac Chris@198: QTLIB_SEARCH="$QTLIBDIR" Chris@198: QTDIR="" Chris@198: fi Chris@198: QTLIB_EXTS=".so .a .dylib 4.dll" Chris@198: QTLIB_NEED_4="" Chris@198: for i in $QTLIB_SEARCH ; do Chris@198: for j in $QTLIB_EXTS ; do Chris@198: if test -f $i/libQtGui$j && test x$QTLIBDIR = x ; then Chris@198: QTLIBDIR=$i Chris@198: elif test -f $i/QtGui$j && test x$QTLIBDIR = x ; then Chris@198: QTLIBDIR=$i Chris@198: if test x$j = x4.dll ; then Chris@198: QTLIB_NEED_4=1 Chris@198: fi Chris@198: fi Chris@198: done Chris@198: done Chris@198: if test x"$QTLIBDIR" = x ; then Chris@198: AC_MSG_ERROR([ Chris@198: Failed to find required Qt4 GUI link entry point (libQtGui.so or equivalent). Chris@198: Define QTLIBDIR or use --with-qtlibdir to specify the library location. Chris@198: ]) Chris@198: fi Chris@198: AC_MSG_RESULT([$QTLIBDIR]) Chris@198: Chris@198: if test x$QTLIB_NEED_4 = x ; then Chris@198: QT_LIBS="-L$QTLIBDIR -lQtGui -lQtXml -lQtNetwork -lQtCore" Chris@198: else Chris@198: QT_LIBS="-L$QTLIBDIR -lQtGui4 -lQtXml4 -lQtNetwork4 -lQtCore4" Chris@198: fi Chris@198: Chris@198: AC_MSG_CHECKING([QT_CXXFLAGS]) Chris@198: AC_MSG_RESULT([$QT_CXXFLAGS]) Chris@198: AC_MSG_CHECKING([QT_LIBS]) Chris@198: AC_MSG_RESULT([$QT_LIBS]) Chris@198: Chris@198: AC_SUBST(QT_CXXFLAGS) Chris@198: AC_SUBST(QT_LIBS) Chris@198: Chris@198: ]) Chris@198: