comparison acinclude.m4 @ 42:94d988cef54e

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