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