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