Chris@350: Chris@350: AC_DEFUN([SV_MODULE_REQUIRED], Chris@350: [ Chris@350: SV_MODULE_MODULE=$1 Chris@350: SV_MODULE_VERSION_TEST="$2" Chris@350: SV_MODULE_HEADER=$3 Chris@350: SV_MODULE_LIB=$4 Chris@350: SV_MODULE_FUNC=$5 Chris@350: SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') Chris@350: SV_MODULE_FAILED=1 Chris@405: if test -n "$$1_LIBS" ; then Chris@405: AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE]) Chris@405: CXXFLAGS="$CXXFLAGS $$1_CFLAGS" Chris@405: LIBS="$LIBS $$1_LIBS" Chris@405: SV_MODULE_FAILED="" Chris@405: fi Chris@350: if test -z "$SV_MODULE_VERSION_TEST" ; then Chris@350: SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE Chris@350: fi Chris@405: if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then Chris@350: 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: fi Chris@350: if test -n "$SV_MODULE_FAILED"; then Chris@350: 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: if test -n "$SV_MODULE_LIB"; then Chris@350: 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: fi Chris@350: fi Chris@350: ]) Chris@350: Chris@350: AC_DEFUN([SV_MODULE_OPTIONAL], Chris@350: [ Chris@350: SV_MODULE_MODULE=$1 Chris@350: SV_MODULE_VERSION_TEST="$2" Chris@350: SV_MODULE_HEADER=$3 Chris@350: SV_MODULE_LIB=$4 Chris@350: SV_MODULE_FUNC=$5 Chris@350: SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]') Chris@350: SV_MODULE_FAILED=1 Chris@405: if test -n "$$1_LIBS" ; then Chris@405: AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE]) Chris@405: CXXFLAGS="$CXXFLAGS $$1_CFLAGS" Chris@405: LIBS="$LIBS $$1_LIBS" Chris@405: SV_MODULE_FAILED="" Chris@405: fi Chris@350: if test -z "$SV_MODULE_VERSION_TEST" ; then Chris@350: SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE Chris@350: fi Chris@405: if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then Chris@352: 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: fi Chris@350: if test -n "$SV_MODULE_FAILED"; then Chris@350: 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: if test -z "$SV_MODULE_FAILED"; then Chris@350: if test -n "$SV_MODULE_LIB"; then Chris@350: 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: fi Chris@350: fi Chris@350: fi Chris@350: ]) Chris@350: Chris@354: # Check for Qt. The only part of Qt we use directly is qmake. Chris@354: Chris@350: AC_DEFUN([SV_CHECK_QT], Chris@350: [ Chris@350: AC_REQUIRE([AC_PROG_CXX]) Chris@350: Chris@354: if test x$QMAKE = x ; then Chris@354: AC_CHECK_PROG(QMAKE, qmake-qt4, $QTDIR/bin/qmake-qt4,,$QTDIR/bin/) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@354: AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@354: AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@354: AC_CHECK_PROG(QMAKE, qmake-qt4, qmake-qt4,,$PATH) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@354: AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH) Chris@354: fi Chris@354: if test x$QMAKE = x ; then Chris@354: AC_MSG_ERROR([ Chris@354: Failed to find the required qmake-qt4 or qmake program. Please Chris@354: ensure you have the necessary Qt4 development files installed, and Chris@354: if necessary set QTDIR to the location of your Qt4 installation. Chris@350: ]) Chris@350: fi Chris@350: Chris@350: # Suitable versions of qmake should print out something like: Chris@350: # Chris@350: # QMake version 2.01a Chris@350: # Using Qt version 4.6.3 in /usr/lib Chris@350: # Chris@350: # This may be translated, so we check only for the numbers (2.x and 4.x Chris@350: # in that order). Chris@350: # Chris@350: QMAKE_VERSION_OUTPUT=`$QMAKE -v` Chris@350: case "$QMAKE_VERSION_OUTPUT" in Chris@350: *2.*4.*) ;; Chris@350: *) AC_MSG_WARN([ Chris@350: *** The version of qmake found in "$QMAKE" looks like it might be Chris@350: from the wrong version of Qt (Qt4 is required). Please check Chris@350: that this is the correct version of qmake for Qt4 builds. Chris@350: ]) Chris@350: esac Chris@350: Chris@359: case "`uname`" in Chris@359: *Darwin*) QMAKE="$QMAKE -spec macx-g++";; Chris@359: esac Chris@359: Chris@350: ]) Chris@350: