Add automated test on delayed return value handling in ExternalInterface.call().
[gnash.git] / macros / qt4.m4
bloba05108c884cf7575e78fe3702cef45613fccbe3c
1 dnl  
2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
4 dnl  
5 dnl  This program is free software; you can redistribute it and/or modify
6 dnl  it under the terms of the GNU General Public License as published by
7 dnl  the Free Software Foundation; either version 3 of the License, or
8 dnl  (at your option) any later version.
9 dnl  
10 dnl  This program is distributed in the hope that it will be useful,
11 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 dnl  GNU General Public License for more details.
14 dnl  You should have received a copy of the GNU General Public License
15 dnl  along with this program; if not, write to the Free Software
16 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 AC_DEFUN([GNASH_PATH_QT4], [
19   gnash_qt4_topdir=
21   dnl Look for the header
22   AC_ARG_WITH(qt4_incl, AC_HELP_STRING([--with-qt4-incl],
23              [directory where QT 4.x headers are]),
24              with_qt4_incl=${withval})
26   AC_CACHE_VAL(ac_cv_path_qt4_incl,[
27     if test x"${with_qt4_incl}" != x; then
28       if test -f ${with_qt4_incl}/QtCore/qobject.h; then
29         qt4_include_subdirs="QtCore QtGui QtOpenGL"
31         ac_cv_path_qt4_incl="${ac_cv_path_qt4_incl} -I`(cd ${with_qt4_incl}; pwd)`"
32         for i in ${qt4_include_subdirs}; do
33           if test -d "${with_qt4_incl}/$i"; then
34             ac_cv_path_qt4_incl="${ac_cv_path_qt4_incl} -I`(cd ${with_qt4_incl}/$i; pwd)`"
35           fi
36         done
37       else
38         AC_MSG_ERROR([${with_qt4_incl}/QtCore directory doesn't contain QT 4.x headers])
39       fi
40     fi
41   ])                            dnl end of cache ac_cv_path_qt4_incl
43   dnl Only run these tests if this version was specified by the user.
45     if test x"${ac_cv_path_qt4_incl}" = x; then
46       dnl if QTDIR is set in the users environment, use that, as that's what
47       dnl most QT programmers do, as it's required by the QT build system.
48       if test x$QTDIR != x; then
49         if test -f $QTDIR/include/QtCore/qobject.h; then
50           qt_base=`basename $QTDIR`
51           dnl Only support version 4 in this file.
52           if test x"${qt_base}" != x"qt4"; then
53             AC_MSG_ERROR([Mismatched QT versions! Reset QTDIR in your environment!])
54           fi
55         fi
56       fi
57     fi
59 dnl FIXME: do we even need the version anymore ?
60 dnl     if test x"${cross_compiling} = xno; then
61 dnl       if test x"${PKG_CONFIG}" != x; x1then
62 dnl         gnash_qt_version="`${PKG_CONFIG} --modversion QtCore | cut -d '.' -f 1`"
63 dnl       fi
64 dnl     fi
66      AC_MSG_CHECKING([for QT 4.x headers])
67     if test x$cross_compiling = xno; then
68       if test x"${PKG_CONFIG}" != x -a x"${ac_cv_path_qt4_incl}" = x; then
69         if ${PKG_CONFIG} --exists QtOpenGL; then
70           ac_cv_path_qt4_incl="`$PKG_CONFIG --cflags-only-I QtCore QtGui QtOpenGL`"
71         else
72           if ${PKG_CONFIG} --exists QtCore QtGui; then
73             ac_cv_path_qt4_incl="`$PKG_CONFIG --cflags-only-I QtCore QtGui`"
74           fi
75         fi
76         gnash_qt4_topdir=`echo "${ac_cv_path_qt4_incl}"`
77       fi
78     fi
80     dnl QT 4.x stores it's headers in ../lib/qt4/include for example, so
81     dnl use libslist instead of incllist
82     if test x"${ac_cv_path_qt4_incl}" = x; then
83       for i in ${incllist} ${libslist}; do
84         dnl Some distributions put the QT headers directly in the directory
85         if test -f $i/Qt/qobject.h; then
86           gnash_qt4_topdir="$i"
87           if test x"$i" != x"/usr/include"; then
88             ac_cv_path_qt4_incl="-I$i"
89           fi
90           break
91         fi
92         dnl Some distributions put the QT headers in a sub directory
93         if test -f $i/qt4/Qt/qobject.h; then
94           gnash_qt4_topdir="$i/qt4"
95           ac_cv_path_qt4_incl="-I$i/qt4"
96           break
97         fi
98       done
99     fi
101     dnl this is a list of al the libraries supported by QT 4.x, but we don't need all of
102     dnl then, but we might as well get all the paths, as header files ofteninclude other
103     dnl header files.
104     all_qt4_libs="QtCore QtGui QtOpenGL QtXml QtDBus QtNetwork QtScript QtSql QtTest QtSvg QtWebKit"
105     if test x"${ac_cv_path_qt4_incl}" = x; then
106       for i in ${all_qt4_libs}; do
107         dnl Darwin is easy, everything is in the same location on all machines.
108         if test x"${darwin}" = xyes; then
109           if test -d /Library/Frameworks; then
110             ac_cv_path_qt4_incl="${ac_cv_path_qt4_incl} /Library/Frameworks/$i.framework/Headers"
111           fi
112         else
113           if test -d ${gnash_qt4_topdir}/$i; then
114             ac_cv_path_qt4_incl="${ac_cv_path_qt4_incl} -I${gnash_qt4_topdir}/$i"
115           fi
116         fi
117       done
118     fi
119     if test x"${ac_cv_path_qt4_incl}" = x; then
120       QT4_CFLAGS=""
121       AC_MSG_RESULT(no)
122     else
123       QT4_CFLAGS="${ac_cv_path_qt4_incl}"
124       AC_MSG_RESULT(${gnash_qt4_topdir})
125     fi
127 dnl   if test "$gnash_cv_lib_qt_dir" = "no"; then
128 dnl     dnl We might be on OSX...
129 dnl     if test -d /Library/Frameworks/QtCore.framework; then
130 dnl       gnash_cv_lib_qt_dir=/Library/Frameworks
131 dnl       KDE_LIBS="-L/Library/Frameworks -F/Library/Frameworks"
132 dnl     fi
133 dnl   fi
135   dnl Look for the libraries
136     AC_ARG_WITH(qt4_lib, AC_HELP_STRING([--with-qt4-lib], [directory where QT 4.x libraries are]), with_qt4_lib=${withval})
137     AC_CACHE_VAL(ac_cv_path_qt4_lib, [
138       if test x"${with_qt4_lib}" != x ; then
139         if test `ls -C1 ${with_qt4_lib}/libQtCore.${shlibext}* | wc -l` -gt 0 ; then
140          ac_cv_path_qt4_lib="-L`(cd ${with_qt4_lib}; pwd)` ${qt4support} -lQtCore -lQtGui"
141         else
142           AC_MSG_ERROR([${with_qt4_lib} directory doesn't contain QT 4.x libraries.])
143         fi
144       fi
145     ])
147     if test x$cross_compiling = xno; then
148       if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_qt4_lib}" = x; then
149         $PKG_CONFIG --exists QtCore QtGui && ac_cv_path_qt4_lib="`$PKG_CONFIG --libs QtCore QtGui`"
150       fi
151     fi
153     AC_MSG_CHECKING([for QT 4.x libraries])
154     if test x"${ac_cv_path_qt4_lib}" = x; then
155       for i in $libslist; do
156         if test -f $i/libQtCore.${shlibext}; then
157           gnash_qt4_topdir=$i
158           if test x"$i" != x"/usr/lib"; then
159             ac_cv_path_qt4_lib="-L$i"
160           fi
161           break
162         fi
163       done
164       dnl redefine the list of libraries, as we don't need all of them, so why bother.
165       all_qt4_libs="QtCore QtGui"
166       for i in ${all_qt4_libs}; do
167         if test -f ${gnash_qt4_topdir}/lib$i.${shlibext}; then
168             ac_cv_path_qt4_lib="${ac_cv_path_qt4_lib} -l$i"
169         fi
170       done
171     fi
173     if test x"${ac_cv_path_qt4_lib}" != x; then
174       AC_MSG_RESULT(${ac_cv_path_qt4_lib})
175     else
176       AC_MSG_RESULT(no)
177     fi
179     dnl Both the headers and the library must be installed
180     if test x"${ac_cv_path_qt4_incl}" != x -a x"${ac_cv_path_qt4_lib}" != x; then
181       AC_DEFINE(HAVE_QT4, 1, [Have QT 4.x installed])
182       QT4_LIBS="${ac_cv_path_qt4_lib}"
183       has_qt4="yes"
184     else
185       has_qt4="no"
186       QT4_LIBS=""
187     fi
189     AC_PATH_PROGS(MOC4, [moc-qt4 moc moc4], ,[/usr/bin ${QTDIR}/bin /usr/lib/qt4/bin /usr/share/qt4/bin/ ${pathlist}])
190     AC_PATH_PROGS(UIC4, [uic-qt4 uic uic4], ,[/usr/bin ${QTDIR}/bin /usr/lib/qt4/bin /usr/share/qt4/bin/ ${pathlist}])
193     AC_SUBST([QT4_CFLAGS])
194     AC_SUBST([QT4_LIBS])
195     AC_SUBST([MOC4])
196     AC_SUBST([UIC4])
197 ])                              dnl end of defun GNASH_PATH_QT4
199 dnl dnl Find the QT 4.x libQtCore library
200 dnl AC_DEFUN([GNASH_QT4_CORE], [
201 dnl   AC_REQUIRE([GNASH_PATH_QT4])
202 dnl   if test x"$gnash_qt4_topdir" = x"/Library/Frameworks"; then
203 dnl     QT_CFLAGS="${QT_CFLAGS} -D_REENTRANT -DQT_SHARED ${gnash_qt4_topdir}/QtCore.framework/Headers"
204 dnl     QTCORE="-framework QtCore"
205 dnl   else
206 dnl     QT_CFLAGS="${QT_CFLAGS} -D_REENTRANT -DQT_SHARED -I${gnash_qt4_topdir}/QtCore"
207 dnl     QT_LIBS="$QT_LIBS -lQtCore"
208 dnl   fi
209 dnl   if test "$enable_qt_debug" = "no"; then
210 dnl     KDE_CFLAGS="$CPPFLAGS -DQT_NO_DEBUG"
211 dnl   fi
212 dnl   AC_SUBST(QTCORE)
213 dnl ])
215 dnl FIXME: I don't think we need this.
216 dnl AC_DEFUN([GNASH_QT_PLATFORM], [
217 dnl     AC_REQUIRE([GNASH_QT4_CORE])
218 dnl     AC_MSG_CHECKING([Qt platform])
219 dnl     platform=unknown
220 dnl     AC_COMPILE_IFELSE([
221 dnl             #include <qglobal.h>
222 dnl             #ifndef Q_WS_X11
223 dnl             #error Not X11
224 dnl             #endif
225 dnl     ], [platform=X11], [])
226 dnl     if test "$platform" = "unknown"; then
227 dnl             AC_COMPILE_IFELSE([
228 dnl                     #include <qglobal.h>
229 dnl                     #ifndef Q_WS_QWS
230 dnl                     #error Not Qtopia
231 dnl                     #endif
232 dnl             ], [platform=Qtopia], [])
233 dnl     fi
234 dnl     if test "$platform" = "unknown"; then
235 dnl             AC_COMPILE_IFELSE([
236 dnl                     #include <qglobal.h>
237 dnl                     #ifndef Q_WS_MACX
238 dnl                     #error Not OSX
239 dnl                     #endif
240 dnl             ], [platform=OSX], [])
241 dnl     fi
242 dnl     if test "$platform" = "unknown"; then
243 dnl             AC_COMPILE_IFELSE([
244 dnl                     #include <qglobal.h>
245 dnl                     #ifndef Q_WS_MAC9
246 dnl                     #error Not OS9
247 dnl                     #endif
248 dnl             ], [platform=OS9], [])
249 dnl     fi
250 dnl     if test "$platform" = "unknown"; then
251 dnl             AC_COMPILE_IFELSE([
252 dnl                     #include <qglobal.h>
253 dnl                     #ifndef Q_WS_WIN32
254 dnl                     #error No dirty Nazi junk
255 dnl                     #endif
256 dnl             ], [platform=Win32], [])
257 dnl     fi
258 dnl     AC_MSG_RESULT([$platform])
259 dnl ])