annotate acinclude.m4 @ 350:c053d985ec8c

* Add basic build files
author Chris Cannam
date Wed, 22 Sep 2010 11:12:26 +0100
parents
children d59bb887e4d2
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@350 38 PKG_CHECK_MODULES($1,[$SV_MODULE_VERSION_TEST],[HAVES="$HAVES $SV_MODULE_HAVE";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@350 50 # Check for Qt compiler flags, linker flags, and binary packages
Chris@350 51 AC_DEFUN([SV_CHECK_QT],
Chris@350 52 [
Chris@350 53 AC_REQUIRE([AC_PROG_CXX])
Chris@350 54
Chris@350 55 AC_MSG_CHECKING([QTDIR])
Chris@350 56 AC_ARG_WITH([qtdir], [ --with-qtdir=DIR Qt installation directory [default=$QTDIR]], QTDIR=$withval)
Chris@350 57 # Check that QTDIR is defined or that --with-qtdir given
Chris@350 58 if test x"$QTDIR" = x ; then
Chris@350 59 # some usual Qt locations
Chris@350 60 QT_SEARCH="/usr /opt /usr/lib/qt"
Chris@350 61 else
Chris@350 62 case "$QTDIR" in *3*)
Chris@350 63 AC_MSG_WARN([
Chris@350 64 *** The QTDIR environment variable is set to "$QTDIR".
Chris@350 65 This looks like it could be the location of a Qt3 installation
Chris@350 66 instead of the Qt4 installation we require. If configure fails,
Chris@350 67 please ensure QTDIR is either set correctly or not set at all.
Chris@350 68 ])
Chris@350 69 ;;
Chris@350 70 esac
Chris@350 71 QT_SEARCH=$QTDIR
Chris@350 72 QTDIR=""
Chris@350 73 fi
Chris@350 74 for i in $QT_SEARCH ; do
Chris@350 75 QT_INCLUDE_SEARCH="include/qt4 include"
Chris@350 76 for j in $QT_INCLUDE_SEARCH ; do
Chris@350 77 if test -f $i/$j/Qt/qglobal.h && test x$QTDIR = x ; then
Chris@350 78 QTDIR=$i
Chris@350 79 QT_INCLUDES=$i/$j
Chris@350 80 fi
Chris@350 81 done
Chris@350 82 done
Chris@350 83 if test x"$QTDIR" = x ; then
Chris@350 84 AC_MSG_ERROR([*** Failed to find Qt4 installation. QTDIR must be defined, or --with-qtdir option given])
Chris@350 85 fi
Chris@350 86 AC_MSG_RESULT([$QTDIR])
Chris@350 87
Chris@350 88 # Change backslashes in QTDIR to forward slashes to prevent escaping
Chris@350 89 # problems later on in the build process, mainly for Cygwin build
Chris@350 90 # environment using MSVC as the compiler
Chris@350 91 QTDIR=`echo $QTDIR | sed 's/\\\\/\\//g'`
Chris@350 92
Chris@350 93 AC_MSG_CHECKING([Qt includes])
Chris@350 94 # Check where includes are located
Chris@350 95 if test x"$QT_INCLUDES" = x ; then
Chris@350 96 AC_MSG_ERROR([
Chris@350 97 Failed to find required Qt4 headers.
Chris@350 98 Please ensure you have the Qt4 development files installed,
Chris@350 99 and if necessary set QTDIR to the location of your Qt4 installation.
Chris@350 100 ])
Chris@350 101 fi
Chris@350 102 AC_MSG_RESULT([$QT_INCLUDES])
Chris@350 103
Chris@350 104 # Check that qmake is in path
Chris@350 105 AC_CHECK_PROG(QMAKE, qmake-qt4, $QTDIR/bin/qmake-qt4,,$QTDIR/bin/)
Chris@350 106 if test x$QMAKE = x ; then
Chris@350 107 AC_CHECK_PROG(QMAKE, qmake, $QTDIR/bin/qmake,,$QTDIR/bin/)
Chris@350 108 if test x$QMAKE = x ; then
Chris@350 109 AC_CHECK_PROG(QMAKE, qmake.exe, $QTDIR/bin/qmake.exe,,$QTDIR/bin/)
Chris@350 110 if test x$QMAKE = x ; then
Chris@350 111 AC_MSG_ERROR([
Chris@350 112 Failed to find the required qmake-qt4 or qmake program. Please
Chris@350 113 ensure you have the necessary Qt4 development files installed.
Chris@350 114 ])
Chris@350 115 fi
Chris@350 116 fi
Chris@350 117 fi
Chris@350 118
Chris@350 119 # Suitable versions of qmake should print out something like:
Chris@350 120 #
Chris@350 121 # QMake version 2.01a
Chris@350 122 # Using Qt version 4.6.3 in /usr/lib
Chris@350 123 #
Chris@350 124 # This may be translated, so we check only for the numbers (2.x and 4.x
Chris@350 125 # in that order).
Chris@350 126 #
Chris@350 127 QMAKE_VERSION_OUTPUT=`$QMAKE -v`
Chris@350 128 case "$QMAKE_VERSION_OUTPUT" in
Chris@350 129 *2.*4.*) ;;
Chris@350 130 *) AC_MSG_WARN([
Chris@350 131 *** The version of qmake found in "$QMAKE" looks like it might be
Chris@350 132 from the wrong version of Qt (Qt4 is required). Please check
Chris@350 133 that this is the correct version of qmake for Qt4 builds.
Chris@350 134 ])
Chris@350 135 esac
Chris@350 136
Chris@350 137 # Check that moc is in path
Chris@350 138 AC_CHECK_PROG(MOC, moc-qt4, $QTDIR/bin/moc-qt4,,$QTDIR/bin/)
Chris@350 139 if test x$MOC = x ; then
Chris@350 140 AC_CHECK_PROG(MOC, moc, $QTDIR/bin/moc,,$QTDIR/bin/)
Chris@350 141 if test x$MOC = x ; then
Chris@350 142 AC_CHECK_PROG(MOC, moc.exe, $QTDIR/bin/moc.exe,,$QTDIR/bin/)
Chris@350 143 if test x$MOC = x ; then
Chris@350 144 AC_MSG_ERROR([
Chris@350 145 Failed to find required moc-qt4 or moc program.
Chris@350 146 Please ensure you have the Qt4 development files installed,
Chris@350 147 and if necessary set QTDIR to the location of your Qt4 installation.
Chris@350 148 ])
Chris@350 149 fi
Chris@350 150 fi
Chris@350 151 fi
Chris@350 152
Chris@350 153 # Check that uic is in path
Chris@350 154 AC_CHECK_PROG(UIC, uic-qt4, $QTDIR/bin/uic-qt4,,$QTDIR/bin/)
Chris@350 155 if test x$UIC = x ; then
Chris@350 156 AC_CHECK_PROG(UIC, uic, $QTDIR/bin/uic,,$QTDIR/bin/)
Chris@350 157 if test x$UIC = x ; then
Chris@350 158 AC_CHECK_PROG(UIC, uic.exe, $QTDIR/bin/uic.exe,,$QTDIR/bin/)
Chris@350 159 if test x$UIC = x ; then
Chris@350 160 AC_MSG_ERROR([
Chris@350 161 Failed to find required uic-qt4 or uic program.
Chris@350 162 Please ensure you have the Qt4 development files installed,
Chris@350 163 and if necessary set QTDIR to the location of your Qt4 installation.
Chris@350 164 ])
Chris@350 165 fi
Chris@350 166 fi
Chris@350 167 fi
Chris@350 168
Chris@350 169 # Check that rcc is in path
Chris@350 170 AC_CHECK_PROG(RCC, rcc-qt4, $QTDIR/bin/rcc-qt4,,$QTDIR/bin/)
Chris@350 171 if test x$RCC = x ; then
Chris@350 172 AC_CHECK_PROG(RCC, rcc, $QTDIR/bin/rcc,,$QTDIR/bin/)
Chris@350 173 if test x$RCC = x ; then
Chris@350 174 AC_CHECK_PROG(RCC, rcc.exe, $QTDIR/bin/rcc.exe,,$QTDIR/bin/)
Chris@350 175 if test x$RCC = x ; then
Chris@350 176 AC_MSG_ERROR([
Chris@350 177 Failed to find required rcc-qt4 or rcc program.
Chris@350 178 Please ensure you have the Qt4 development files installed,
Chris@350 179 and if necessary set QTDIR to the location of your Qt4 installation.
Chris@350 180 ])
Chris@350 181 fi
Chris@350 182 fi
Chris@350 183 fi
Chris@350 184
Chris@350 185 # lupdate is the Qt translation-update utility.
Chris@350 186 AC_CHECK_PROG(LUPDATE, lupdate-qt4, $QTDIR/bin/lupdate-qt4,,$QTDIR/bin/)
Chris@350 187 if test x$LUPDATE = x ; then
Chris@350 188 AC_CHECK_PROG(LUPDATE, lupdate, $QTDIR/bin/lupdate,,$QTDIR/bin/)
Chris@350 189 if test x$LUPDATE = x ; then
Chris@350 190 AC_CHECK_PROG(LUPDATE, lupdate.exe, $QTDIR/bin/lupdate.exe,,$QTDIR/bin/)
Chris@350 191 if test x$LUPDATE = x ; then
Chris@350 192 AC_MSG_WARN([
Chris@350 193 Failed to find lupdate-qt4 or lupdate program.
Chris@350 194 This program is not needed for a simple build,
Chris@350 195 but it should be part of a Qt4 development installation
Chris@350 196 and its absence is troubling.
Chris@350 197 ])
Chris@350 198 fi
Chris@350 199 fi
Chris@350 200 fi
Chris@350 201
Chris@350 202 # lrelease is the Qt translation-release utility.
Chris@350 203 AC_CHECK_PROG(LRELEASE, lrelease-qt4, $QTDIR/bin/lrelease-qt4,,$QTDIR/bin/)
Chris@350 204 if test x$LRELEASE = x ; then
Chris@350 205 AC_CHECK_PROG(LRELEASE, lrelease, $QTDIR/bin/lrelease,,$QTDIR/bin/)
Chris@350 206 if test x$LRELEASE = x ; then
Chris@350 207 AC_CHECK_PROG(LRELEASE, lrelease.exe, $QTDIR/bin/lrelease.exe,,$QTDIR/bin/)
Chris@350 208 if test x$LRELEASE = x ; then
Chris@350 209 AC_MSG_WARN([
Chris@350 210 Failed to find lrelease-qt4 or lrelease program.
Chris@350 211 This program is not needed for a simple build,
Chris@350 212 but it should be part of a Qt4 development installation
Chris@350 213 and its absence is troubling.
Chris@350 214 ])
Chris@350 215 fi
Chris@350 216 fi
Chris@350 217 fi
Chris@350 218
Chris@350 219 QT_CXXFLAGS="-I$QT_INCLUDES/QtGui -I$QT_INCLUDES/QtXml -I$QT_INCLUDES/QtNetwork -I$QT_INCLUDES/QtCore -I$QT_INCLUDES"
Chris@350 220
Chris@350 221 AC_MSG_CHECKING([QTLIBDIR])
Chris@350 222 AC_ARG_WITH([qtlibdir], [ --with-qtlibdir=DIR Qt library directory [default=$QTLIBDIR]], QTLIBDIR=$withval)
Chris@350 223 if test x"$QTLIBDIR" = x ; then
Chris@350 224 # bin is included because that's where Qt DLLs hide on Windows
Chris@350 225 # On Mandriva Qt libraries are in /usr/lib or /usr/lib64 although
Chris@350 226 # QTDIR is /usr/lib/qt4
Chris@350 227 QTLIB_SEARCH="$QTDIR/lib $QTDIR/lib64 $QTDIR/lib32 $QTDIR/bin /usr/lib /usr/lib64"
Chris@350 228 else
Chris@350 229 case "$QTLIBDIR" in *3*)
Chris@350 230 AC_MSG_WARN([
Chris@350 231 The QTLIBDIR environment variable is set to "$QTLIBDIR".
Chris@350 232 This looks suspiciously like the location for Qt3 libraries
Chris@350 233 instead of the Qt4 libraries we require. If configure fails,
Chris@350 234 please ensure QTLIBDIR is either set correctly or not set at all.
Chris@350 235 ])
Chris@350 236 ;;
Chris@350 237 esac
Chris@350 238 QTLIB_SEARCH="$QTLIBDIR"
Chris@350 239 QTDIR=""
Chris@350 240 fi
Chris@350 241 QTLIB_EXTS=".so .a .dylib 4.dll"
Chris@350 242 QTLIB_NEED_4=""
Chris@350 243 for i in $QTLIB_SEARCH ; do
Chris@350 244 for j in $QTLIB_EXTS ; do
Chris@350 245 if test -f $i/libQtGui$j && test x$QTLIBDIR = x ; then
Chris@350 246 QTLIBDIR=$i
Chris@350 247 elif test -f $i/QtGui$j && test x$QTLIBDIR = x ; then
Chris@350 248 QTLIBDIR=$i
Chris@350 249 if test x$j = x4.dll ; then
Chris@350 250 QTLIB_NEED_4=1
Chris@350 251 fi
Chris@350 252 fi
Chris@350 253 done
Chris@350 254 done
Chris@350 255 if test x"$QTLIBDIR" = x ; then
Chris@350 256 AC_MSG_ERROR([
Chris@350 257 Failed to find required Qt4 GUI link entry point (libQtGui.so or equivalent).
Chris@350 258 Define QTLIBDIR or use --with-qtlibdir to specify the library location.
Chris@350 259 ])
Chris@350 260 fi
Chris@350 261 AC_MSG_RESULT([$QTLIBDIR])
Chris@350 262
Chris@350 263 if test x$QTLIB_NEED_4 = x ; then
Chris@350 264 QT_LIBS="-L$QTLIBDIR -lQtGui -lQtXml -lQtNetwork -lQtCore"
Chris@350 265 else
Chris@350 266 QT_LIBS="-L$QTLIBDIR -lQtGui4 -lQtXml4 -lQtNetwork4 -lQtCore4"
Chris@350 267 fi
Chris@350 268
Chris@350 269 AC_MSG_CHECKING([QT_CXXFLAGS])
Chris@350 270 AC_MSG_RESULT([$QT_CXXFLAGS])
Chris@350 271 AC_MSG_CHECKING([QT_LIBS])
Chris@350 272 AC_MSG_RESULT([$QT_LIBS])
Chris@350 273
Chris@350 274 AC_SUBST(QT_CXXFLAGS)
Chris@350 275 AC_SUBST(QT_LIBS)
Chris@350 276
Chris@350 277 ])
Chris@350 278