annotate acinclude.m4 @ 202:7f6fad69f7fd

* Hugely simplify Qt search -- all we need is qmake...
author Chris Cannam
date Thu, 07 Oct 2010 17:57:12 +0100
parents 2c33d6bbea15
children fcac1e59d4c1
rev   line source
Chris@198 1
Chris@198 2 AC_DEFUN([SV_MODULE_REQUIRED],
Chris@198 3 [
Chris@198 4 SV_MODULE_MODULE=$1
Chris@198 5 SV_MODULE_VERSION_TEST="$2"
Chris@198 6 SV_MODULE_HEADER=$3
Chris@198 7 SV_MODULE_LIB=$4
Chris@198 8 SV_MODULE_FUNC=$5
Chris@198 9 SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]')
Chris@198 10 SV_MODULE_FAILED=1
Chris@198 11 if test -z "$SV_MODULE_VERSION_TEST" ; then
Chris@198 12 SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
Chris@198 13 fi
Chris@198 14 if test -n "$PKG_CONFIG"; then
Chris@198 15 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 16 fi
Chris@198 17 if test -n "$SV_MODULE_FAILED"; then
Chris@198 18 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 19 if test -n "$SV_MODULE_LIB"; then
Chris@198 20 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 21 fi
Chris@198 22 fi
Chris@198 23 ])
Chris@198 24
Chris@198 25 AC_DEFUN([SV_MODULE_OPTIONAL],
Chris@198 26 [
Chris@198 27 SV_MODULE_MODULE=$1
Chris@198 28 SV_MODULE_VERSION_TEST="$2"
Chris@198 29 SV_MODULE_HEADER=$3
Chris@198 30 SV_MODULE_LIB=$4
Chris@198 31 SV_MODULE_FUNC=$5
Chris@198 32 SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]')
Chris@198 33 SV_MODULE_FAILED=1
Chris@198 34 if test -z "$SV_MODULE_VERSION_TEST" ; then
Chris@198 35 SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
Chris@198 36 fi
Chris@198 37 if test -n "$PKG_CONFIG"; then
Chris@200 38 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 39 fi
Chris@198 40 if test -n "$SV_MODULE_FAILED"; then
Chris@198 41 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 42 if test -z "$SV_MODULE_FAILED"; then
Chris@198 43 if test -n "$SV_MODULE_LIB"; then
Chris@198 44 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 45 fi
Chris@198 46 fi
Chris@198 47 fi
Chris@198 48 ])
Chris@198 49
Chris@202 50 # Check for Qt. The only part of Qt we use directly is qmake.
Chris@202 51
Chris@198 52 AC_DEFUN([SV_CHECK_QT],
Chris@198 53 [
Chris@198 54 AC_REQUIRE([AC_PROG_CXX])
Chris@198 55
Chris@202 56 if test x$QMAKE = x ; then
Chris@202 57 AC_CHECK_PROG(QMAKE, qmake-qt4, $QTDIR/bin/qmake-qt4,,$QTDIR/bin/)
Chris@202 58 fi
Chris@202 59 if test x$QMAKE = x ; then
Chris@202 60 AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/)
Chris@202 61 fi
Chris@202 62 if test x$QMAKE = x ; then
Chris@202 63 AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/)
Chris@202 64 fi
Chris@202 65 if test x$QMAKE = x ; then
Chris@202 66 AC_CHECK_PROG(QMAKE, qmake-qt4, qmake-qt4,,$PATH)
Chris@202 67 fi
Chris@202 68 if test x$QMAKE = x ; then
Chris@202 69 AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH)
Chris@202 70 fi
Chris@202 71 if test x$QMAKE = x ; then
Chris@202 72 AC_MSG_ERROR([
Chris@202 73 Failed to find the required qmake-qt4 or qmake program. Please
Chris@202 74 ensure you have the necessary Qt4 development files installed, and
Chris@202 75 if necessary set QTDIR to the location of your Qt4 installation.
Chris@198 76 ])
Chris@198 77 fi
Chris@198 78
Chris@198 79 # Suitable versions of qmake should print out something like:
Chris@198 80 #
Chris@198 81 # QMake version 2.01a
Chris@198 82 # Using Qt version 4.6.3 in /usr/lib
Chris@198 83 #
Chris@198 84 # This may be translated, so we check only for the numbers (2.x and 4.x
Chris@198 85 # in that order).
Chris@198 86 #
Chris@198 87 QMAKE_VERSION_OUTPUT=`$QMAKE -v`
Chris@198 88 case "$QMAKE_VERSION_OUTPUT" in
Chris@198 89 *2.*4.*) ;;
Chris@198 90 *) AC_MSG_WARN([
Chris@198 91 *** The version of qmake found in "$QMAKE" looks like it might be
Chris@198 92 from the wrong version of Qt (Qt4 is required). Please check
Chris@198 93 that this is the correct version of qmake for Qt4 builds.
Chris@198 94 ])
Chris@198 95 esac
Chris@198 96
Chris@198 97 ])
Chris@198 98