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