annotate acinclude.m4 @ 354:518224ea73ca

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