process Invoke messages from the standalone player. GetURL and FSCommand now also...
[gnash.git] / macros / qt3.m4
blob2883aab6d8342c99e9ffab961f78210149871320
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 dnl Configuing QT is a pain in the neck if you want to support all
18 dnl versions, as the layout of the API has changed significantly
19 dnl between Qt3 and Qt4. In Qt4, all the top level includes are in a
20 dnl 'Qt' subdirectory now. Since it's best for now to handle the path
21 dnl changes in the source files so we're concious of the changes, we
22 dnl set version flags in config.h and use Automake conditionals to
23 dnl force one behaviour or the other.
25 AC_DEFUN([GNASH_PATH_QT3],
27   gnash_qt3_topdir=""
28   has_qt3=no
30   dnl Look for the header
31   AC_ARG_WITH(qt3_incl, AC_HELP_STRING([--with-qt3-incl], [directory where QT 3.x headers are]), with_qt3_incl=${withval})
33   AC_CACHE_VAL(ac_cv_path_qt3_incl,[
34     if test x"${with_qt3_incl}" != x; then
35       if test -f ${with_qt3_incl}/qobject.h; then
36         ac_cv_path_qt3_incl="-I`(cd ${with_qt3_incl}; pwd)`"
37       else
38         AC_MSG_ERROR([${with_qt3_incl} directory doesn't contain any QT 3.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, and they
44   dnl haven't spcified a custom path.
45   if test x"${build_qt3}" = xyes -a x"${ac_cv_path_qt3_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     qt_pkg="qt-mt"
49     if test x$QTDIR != x; then
50       if test -f $QTDIR/include/qobject.h; then
51         qt_base=`basename $QTDIR`
52         if test x"${qt_base}" = "qt4"; then
53           AC_MSG_ERROR([Mismatched QT versions! Reset QTDIR in your environment!])
54         else
55           gnash_qt_version=3
56         fi
57       fi
58     fi
60     if test x$cross_compiling = xno; then
61       if test x"$PKG_CONFIG" != x; then
62         gnash_qt_version="`$PKG_CONFIG --modversion $qt_pkg | cut -d '.' -f 1`"
63       fi
64     fi
66     AC_MSG_CHECKING([for QT 3.x header])
67     if test x$cross_compiling = xno; then
68       if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_qt3_incl}" = x; then
69         $PKG_CONFIG --exists $qt_pkg && ac_cv_path_qt3_incl="`$PKG_CONFIG --cflags-only-I $qt_pkg | cut -d ' ' -f 1`"
70       fi
71     fi
73     dnl QT 3,x stores it's headers in ../lib/qt-3.3/include for example, so
74     dnl use libslist instead of incllist
75     if test x"${ac_cv_path_qt3_incl}" = x; then
76       for i in $QTDIR $libslist $incllist; do
77         for j in `ls -dr $i/qt[[0-9]] 2>/dev/null`; do
78           if test -f $j/include/qobject.h; then
79             gnash_qt3_topdir="$j"
80             ac_cv_path_qt3_incl="-I$j/include"
81             break
82           fi
83         done
84         if test "x$gnash_qt3_topdir" != x; then
85           break;
86         fi
87       done
88     else
89       gnash_qt3_topdir="`echo ${ac_cv_path_qt3_incl} | sed -e 's:-I::' -e 's:/lib/qt.*::'`"
90     fi
92     if test x"${ac_cv_path_qt3_incl}" = x; then
93       QT3_CFLAGS=""
94       AC_MSG_RESULT(no)
95     else
96       QT3_CFLAGS="${ac_cv_path_qt3_incl}"
97       AC_MSG_RESULT(${ac_cv_path_qt3_incl})
98     fi
100 dnl   # QT_LIBS =  -lqtui -lqtcore -lqtprint -L/usr/lib/qt-3.3/lib -lqt-mt
101   dnl Look for the libraries
102     AC_ARG_WITH(qt3_lib, AC_HELP_STRING([--with-qt3-lib], [directory where QT 3.x libraries are]), with_qt3_lib=${withval})
103     AC_CACHE_VAL(ac_cv_path_qt3_lib, [
104       if test x"${with_qt3_lib}" != x ; then
105         if test `ls -C1 ${with_qt3_lib}/lib/libqt*-mt.* | wc -l` -gt 0 ; then
106          ac_cv_path_qt3_lib="-L`(cd ${with_qt3_lib}; pwd)` ${qt3support} -lqt-mt"
107         else
108                 AC_MSG_ERROR([${with_qt3_lib} directory doesn't contain QT 3.x libraries.])
109         fi
110       fi
111     ])
113     if test x$cross_compiling = xno; then
114       if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_qt3_lib}" = x; then
115         $PKG_CONFIG --exists $qt_pkg && ac_cv_path_qt3_lib="`$PKG_CONFIG --libs-only-l $qt_pkg | cut -d ' ' -f 1`"
116       fi
117     fi
119     if test x"${ac_cv_path_qt3_lib}" = x; then
120       AC_MSG_CHECKING([for QT 3.x libraries])
121       if test `ls -C1 ${gnash_qt3_topdir}/lib/libqt*-mt.*| wc -l` -gt 0 ; then
122         dnl Qtopia (embedded QT) uses libqte-mt instead of libqt-mt
123         if test -f ${gnash_qt3_topdir}/lib/libqte-mt.${shlibext}; then
124           ac_cv_path_qt3_lib="-L${gnash_qt3_topdir}/lib ${qt3support} -lqte-mt"
125          else
126           ac_cv_path_qt3_lib="-L${gnash_qt3_topdir}/lib ${qt3support} -lqt-mt"
127         fi
128       fi
129       if test x"${ac_cv_path_qt3_lib}" != x; then
130         AC_MSG_RESULT(${ac_cv_path_qt3_lib})
131       else
132         AC_MSG_RESULT(none)
133       fi
134     fi
136     if test x"${ac_cv_path_qt3_lib}" != x; then
137       QT3_LIBS="${ac_cv_path_qt3_lib}"
138       AC_DEFINE(HAVE_QT3, 1, [Have QT 3.x installed])
139       has_qt3="yes"
140     else
141       QT3_LIBS=""
142       has_qt3="no"
143     fi
145     AC_PATH_PROG(MOC3, moc, ,[ /usr/lib/qt-3.3/bin ${QTDIR}/bin${pathlist}])
147   fi                              dnl end of build_qt3
149   AC_SUBST(MOC3)
150   AC_SUBST(QT3_CFLAGS)  
151   AC_SUBST(QT3_LIBS)
155 # Local Variables:
156 # c-basic-offset: 2
157 # tab-width: 2
158 # indent-tabs-mode: nil
159 # End: