annotate acinclude.m4 @ 975:d5404b8421b4

Fix some potential null derefs (from coverity scan)
author Chris Cannam
date Wed, 03 Sep 2014 11:26:21 +0100
parents a98af74f8e2f
children dbb7f0ab011e
rev   line source
Chris@638 1
Chris@638 2 AC_DEFUN([SV_MODULE_REQUIRED],
Chris@638 3 [
Chris@638 4 SV_MODULE_MODULE=$1
Chris@638 5 SV_MODULE_VERSION_TEST="$2"
Chris@638 6 SV_MODULE_HEADER=$3
Chris@638 7 SV_MODULE_LIB=$4
Chris@638 8 SV_MODULE_FUNC=$5
Chris@638 9 SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]')
Chris@638 10 SV_MODULE_FAILED=1
Chris@671 11 if test -n "$$1_LIBS" ; then
Chris@671 12 AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE])
Chris@672 13 CXXFLAGS="$CXXFLAGS $$1_CFLAGS"
Chris@672 14 LIBS="$LIBS $$1_LIBS"
Chris@671 15 SV_MODULE_FAILED=""
Chris@671 16 fi
Chris@638 17 if test -z "$SV_MODULE_VERSION_TEST" ; then
Chris@638 18 SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
Chris@638 19 fi
Chris@671 20 if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then
Chris@638 21 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@638 22 fi
Chris@638 23 if test -n "$SV_MODULE_FAILED"; then
Chris@638 24 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@638 25 if test -n "$SV_MODULE_LIB"; then
Chris@638 26 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@638 27 fi
Chris@638 28 fi
Chris@638 29 ])
Chris@638 30
Chris@638 31 AC_DEFUN([SV_MODULE_OPTIONAL],
Chris@638 32 [
Chris@638 33 SV_MODULE_MODULE=$1
Chris@638 34 SV_MODULE_VERSION_TEST="$2"
Chris@638 35 SV_MODULE_HEADER=$3
Chris@638 36 SV_MODULE_LIB=$4
Chris@638 37 SV_MODULE_FUNC=$5
Chris@638 38 SV_MODULE_HAVE=HAVE_$(echo $1 | tr '[a-z]' '[A-Z]')
Chris@638 39 SV_MODULE_FAILED=1
Chris@671 40 if test -n "$$1_LIBS" ; then
Chris@671 41 AC_MSG_NOTICE([User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE])
Chris@672 42 CXXFLAGS="$CXXFLAGS $$1_CFLAGS"
Chris@672 43 LIBS="$LIBS $$1_LIBS"
Chris@671 44 SV_MODULE_FAILED=""
Chris@671 45 fi
Chris@638 46 if test -z "$SV_MODULE_VERSION_TEST" ; then
Chris@638 47 SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
Chris@638 48 fi
Chris@671 49 if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then
Chris@649 50 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@638 51 fi
Chris@638 52 if test -n "$SV_MODULE_FAILED"; then
Chris@638 53 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@638 54 if test -z "$SV_MODULE_FAILED"; then
Chris@638 55 if test -n "$SV_MODULE_LIB"; then
Chris@638 56 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@638 57 fi
Chris@638 58 fi
Chris@638 59 fi
Chris@638 60 ])
Chris@638 61
Chris@651 62 # Check for Qt. The only part of Qt we use directly is qmake.
Chris@651 63
Chris@638 64 AC_DEFUN([SV_CHECK_QT],
Chris@638 65 [
Chris@638 66 AC_REQUIRE([AC_PROG_CXX])
Chris@638 67
Chris@651 68 if test x$QMAKE = x ; then
Chris@792 69 AC_CHECK_PROG(QMAKE, qmake-qt5, $QTDIR/bin/qmake-qt5,,$QTDIR/bin/)
Chris@651 70 fi
Chris@651 71 if test x$QMAKE = x ; then
Chris@651 72 AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/)
Chris@651 73 fi
Chris@651 74 if test x$QMAKE = x ; then
Chris@651 75 AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/)
Chris@651 76 fi
Chris@651 77 if test x$QMAKE = x ; then
Chris@792 78 AC_CHECK_PROG(QMAKE, qmake-qt5, qmake-qt5,,$PATH)
Chris@651 79 fi
Chris@651 80 if test x$QMAKE = x ; then
Chris@651 81 AC_CHECK_PROG(QMAKE, qmake, qmake,,$PATH)
Chris@651 82 fi
Chris@651 83 if test x$QMAKE = x ; then
Chris@651 84 AC_MSG_ERROR([
Chris@792 85 Failed to find the required qmake-qt5 or qmake program. Please
Chris@792 86 ensure you have the necessary Qt5 development files installed, and
Chris@792 87 if necessary set QTDIR to the location of your Qt5 installation.
Chris@638 88 ])
Chris@638 89 fi
Chris@638 90
Chris@638 91 # Suitable versions of qmake should print out something like:
Chris@638 92 #
Chris@638 93 # QMake version 2.01a
Chris@638 94 # Using Qt version 4.6.3 in /usr/lib
Chris@638 95 #
Chris@638 96 # This may be translated, so we check only for the numbers (2.x and 4.x
Chris@638 97 # in that order).
Chris@638 98 #
Chris@638 99 QMAKE_VERSION_OUTPUT=`$QMAKE -v`
Chris@638 100 case "$QMAKE_VERSION_OUTPUT" in
Chris@792 101 *5.*) ;;
Chris@638 102 *) AC_MSG_WARN([
Chris@638 103 *** The version of qmake found in "$QMAKE" looks like it might be
Chris@792 104 from the wrong version of Qt (Qt5 is required). Please check
Chris@792 105 that this is the correct version of qmake for Qt5 builds.
Chris@638 106 ])
Chris@638 107 esac
Chris@638 108
Chris@655 109 case "`uname`" in
Chris@655 110 *Darwin*) QMAKE="$QMAKE -spec macx-g++";;
Chris@655 111 esac
Chris@655 112
Chris@638 113 ])
Chris@638 114