Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash
[gnash.git] / macros / qtopia.m4
blob3c0df4fc3a56a628e63d83021a4263c4367bc138
1 dnl  
2 dnl    Copyright (C) 2005, 2006, 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
18 dnl ~{rob@ute} pts/8> QtCore  QtSvg Qtnetwork QtXml 
19 dnl QtCore: Command not found.
20 dnl ~{rob@ute} pts/8> -L/home/rob/projects/gnu/i686-pc-linux-gnulibc1/qtopia/lib -lQtSvg -L/home/rob/projects/gnu/i686-pc-linux-gnulibc1/qtopia/qtopiacore/target/lib -lQtSql -lQtXml -lQtGui -lpng -lQtNetwork -lQtCore -lz -lm -lrt -ldl -lpthread -lqtopiabase -lqtopia -lmd5 -lqtopia-sqlite -lqtopiasecurity -Wl,-rpath,/usr/local/qtopia-prefix/lib
21 dnl -L/home/rob/projects/gnu/i686-pc-linux-gnulibc1/qtopia/lib: Command not found.
23 AC_DEFUN([GNASH_PATH_QTOPIA],
26   has_qtopia=no
27   gnash_qtopia_version=0
29   dnl the list of Qtopia headers we need
30   dnl Look for the header
31   AC_ARG_WITH(qtopia, AC_HELP_STRING([--with-qtopia], [directory where Qtopia is installed]), with_qtopia=${withval})
32   AC_CACHE_VAL(ac_cv_path_qtopia_incl,[
33     if test x"${with_qtopia}" != x ; then
34       if test -f ${with_qtopia}/include/qtopiamail/qtopiamail.h ; then
35         gnash_qtopia_topdir="${with_qtopia}"
36         ac_cv_path_qtopia_incl="-I`(cd ${with_qtopia}/include; pwd)`"
37         gnash_qtopia_version=4
38       else
39         gnash_qtopia_topdir="${with_qtopia}"
40         if test -f ${with_qtopia}/include/qtopia/mail/qtopiamail.h ; then
41           ac_cv_path_qtopia_incl="-I`(cd ${with_qtopia}/include; pwd)`"
42           gnash_qtopia_version=2
43         else
44           AC_MSG_ERROR([${with_qtopia} directory doesn't contain Qtopia headers])
45         fi
46       fi
47       if test -f ${with_qtopia}/lib/libqtopiamail.a -o -f ${with_qtopia}/lib/libqtopiamail.${shlibext}; then
48               ac_cv_path_qtopia_lib="-L`(cd ${with_qtopia}/lib; pwd)`"
49       else
50               AC_MSG_ERROR([${with_qtopia}/lib directory doesn't contain Qtopia libraries])
51       fi
52     fi
53   ])
55   
56   if test x"${QPEDIR}" != x; then
57     gnash_qtopia_topdir=$QPEDIR
58   else
59     if test x"${gnash_qtopia_topdir}" = x; then
60       AC_MSG_ERROR([QPEDIR must be set in your shell environment or use --with-qtopia=])
61     fi
62   fi
64   if test x"${ac_cv_path_qtopia_incl}" = x; then
65     dnl Attempt to find the top level directory, which unfortunately
66     dnl has a x version number attached. At least on Debain based
67     dnl systems, this doesn't seem to get a directory that is
68     dnl unversioned. 
69     if test x"${gnash_qtopia_version}" = x; then
70       AC_MSG_CHECKING([for libqtopia header])
71       if test -f ${gnash_qtopia_topdir}/include/qtopiamail/qtopiamail.h ; then
72         ac_cv_path_qtopia_incl="-I`(cd ${gnash_qtopia_topdir}/include; pwd)`"
73         gnash_qtopia_version=4
74       else
75         if test -f ${gnash_qtopia_topdir}/include/qtopia/mail/qtopiamail.h ; then
76           ac_cv_path_qtopia_incl="-I`(cd ${gnash_qtopia_topdir}/include; pwd)`"
77           gnash_qtopia_version=2
78         else
79           AC_MSG_ERROR([${gnash_qtopia_topdir} directory doesn't contain qtopia])
80         fi
81       fi
82       AC_MSG_RESULT(${ac_cv_path_qtopia_incl}) 
83     fi                          dnl end of gnash_qtopia_version
84   fi                            dnl end of ac_cv_path_qtopia_incl
86   AC_MSG_CHECKING([for the Qtopia Version])
87   AC_MSG_RESULT(${gnash_qtopia_version}) 
89   dnl this a sanity check for Qtopia 2
90   AC_MSG_CHECKING([Sanity checking the Qtopia header installation])
91   qt_headers="qmainwindow.h qmenubar.h qpopupmenu.h qapplication.h"
92   if test ${gnash_qtopia_version} -eq 2; then
93     if test x"${ac_cv_path_qtopia_incl}" != x; then
94       for i in $qt_headers; do
95         if ! test -f  ${gnash_qtopia_topdir}/include/$i; then
96           AC_MSG_WARN([${gnash_qtopia_topdir}/include/$i not found!])
97           qtopia_nogo=yes
98         fi
99       done
100     fi
101   fi
102   
103   dnl this a sanity check for Qtopia 4
104   qt_headers="QtXml QtGui QtCore QtNetwork QtSql"
105   if test ${gnash_qtopia_version} -eq 4; then
106     if test x"${ac_cv_path_qtopia_incl}" != x; then
107       for i in $qt_headers; do
108         if ! test -d ${gnash_qtopia_topdir}/qtopiacore/target/include/$i; then
109           AC_MSG_WARN([${gnash_qtopia_topdir}/qtopiacore/target/include/$i not found!])
110           qtopia_nogo=yes
111         fi
112       done
113     fi
114   fi
116   if test x"${qtopia_nogo}" = xyes; then
117     AC_MSG_ERROR([Broken Qtopia header installation!])
118   else
119     AC_MSG_RESULT([fine])
120   fi
122   if test ${gnash_qtopia_version} -eq 0; then
123     AC_MSG_RESULT(none)
124   else
125     AC_MSG_RESULT([${gnash_qtopia_version}])
126   fi
127   
128   dnl the list of Qtopia libs we need
129   qt_libs="qtopiabase qtopia qpe qt"
131   if test x"${ac_cv_path_qtopia_lib}" = x; then
132     if test x"${ac_cv_path_qtopia_lib}" = x; then
133       AC_MSG_CHECKING([for libqtopia library])
134       if test -f $gnash_qtopia_topdir/lib/libqpe.a -o -f $gnash_qtopia_topdir/lib/libqpe.${shlibext}; then
135         if test ! x"$i" = x"/usr/lib" -a ! x"$i" = x"/usr/lib64"; then
136          ac_cv_path_qtopia_lib="-L$gnash_qtopia_topdir/lib -lqpe"
137          break
138         else
139          ac_cv_path_qtopia_lib="-lqpe"
140          break
141        fi
142       fi
143     fi
144     AC_MSG_RESULT(${ac_cv_path_qtopia_lib})
145         fi
146   
147   AC_MSG_CHECKING([Sanity checking the Qtopia installation])
148   dnl this a sanity check for Qtopia 2
149   qt_libs="libqtopia libqpe"
150   if test ${gnash_qtopia_version} -eq 2; then
151     AC_DEFINE([GNASH_QTOPIA_VERSION], 2, [The Qtopia version])
152     if test x"${ac_cv_path_qtopia_lib}" != x; then
153       for i in $qt_libs; do
154         if ! test -f  ${gnash_qtopia_topdir}/lib/$i.${shlibext}; then
155           AC_MSG_WARN([${gnash_qtopia_topdir}/lib/$i.${shlibext} not found!])
156           qtopia_nogo=yes
157         fi
158       done
159     fi
160   fi
161   
162   dnl this a sanity check for Qtopia 4
163   qt_libs="libqtopia libqtopiabase"
164   if test ${gnash_qtopia_version} -eq 4; then
165     AC_DEFINE([GNASH_QTOPIA_VERSION], 4, [The Qtopia version])
166     gnash_qtopia_version=`dirname ${gnash_qtopia_topdir}`
167     if test x"${ac_cv_path_qtopia_lib}" != x; then
168       for i in $qt_libs; do
169         if ! test -f  ${gnash_qtopia_topdir}/lib/$i.${shlibext}; then
170           AC_MSG_WARN([${gnash_qtopia_topdir}/lib/$i${shlibext} not found!])
171           qtopia_nogo=yes
172         fi
173       done
174     fi
175   fi
176   if test x"${qtopia_nogo}" = xyes; then
177     AC_MSG_ERROR([Broken Qtopia library installation!])
178   else
179     AC_MSG_RESULT([fine])
180   fi
182   if test x"${ac_cv_path_qtopia_lib}" = x; then
183     AC_CHECK_LIB(qtopia-${gnash_qtopia_version}, qtopia_engine_shape_class_init, [ac_cv_path_qtopia_lib="-lqtopia"])
184   fi
186   if test x"${ac_cv_path_qtopia_incl}" != x; then
187     QTOPIA_CFLAGS="${ac_cv_path_qtopia_incl}"
188   else
189     QTOPIA_CFLAGS=""
190   fi
192   if test x"${ac_cv_path_qtopia_lib}" != x; then
193     QTOPIA_LIBS="${ac_cv_path_qtopia_lib}"
194     AC_DEFINE(HAVE_QTOPIA, 1, [has the Qtopia framework])
195     has_qtopia="yes"
196   else
197     QTOPIA_LIBS=""
198   fi
200   AC_SUBST(QTOPIA_CFLAGS)
201   AC_SUBST(QTOPIA_LIBS)
204 # Local Variables:
205 # c-basic-offset: 2
206 # tab-width: 2
207 # indent-tabs-mode: nil
208 # End: