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