Add automated test on delayed return value handling in ExternalInterface.call().
[gnash.git] / macros / qt3.m4
blob569dd7e324b52e75550fb5f3e363ee118bab2bfe
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 dnl Configuing QT is a pain in the neck if you want to support all
19 dnl versions, as the layout of the API has changed significantly
20 dnl between Qt3 and Qt4. In Qt4, all the top level includes are in a
21 dnl 'Qt' subdirectory now. Since it's best for now to handle the path
22 dnl changes in the source files so we're concious of the changes, we
23 dnl set version flags in config.h and use Automake conditionals to
24 dnl force one behaviour or the other.
26 AC_DEFUN([GNASH_PATH_QT3],
28   gnash_qt3_topdir=""
29   has_qt3=no
31   dnl Look for the header
32   AC_ARG_WITH(qt3_incl, AC_HELP_STRING([--with-qt3-incl], [directory where QT 3.x headers are]), with_qt3_incl=${withval})
34   AC_CACHE_VAL(ac_cv_path_qt3_incl,[
35     if test x"${with_qt3_incl}" != x; then
36       if test -f ${with_qt3_incl}/qobject.h; then
37         ac_cv_path_qt3_incl="-I`(cd ${with_qt3_incl}; pwd)`"
38       else
39         AC_MSG_ERROR([${with_qt3_incl} directory doesn't contain any QT 3.x headers])
40       fi
41     fi
42   ])                            dnl end of cache ac_cv_path_qt4_incl
44   dnl Only run these tests if this version was specified by the user, and they
45   dnl haven't spcified a custom path.
46   if test x"${ac_cv_path_qt3_incl}" = x; then
47     dnl if QTDIR is set in the users environment, use that, as that's what
48     dnl most QT programmers do, as it's required by the QT build system.
49     qt_pkg="qt-mt"
50     if test x$QTDIR != x; then
51       if test -f $QTDIR/include/qobject.h; then
52         qt_base=`basename $QTDIR`
53         if test x"${qt_base}" = "qt4"; then
54           AC_MSG_ERROR([Mismatched QT versions! Reset QTDIR in your environment!])
55         else
56           gnash_qt_version=3
57         fi
58       fi
59     fi
61     if test x$cross_compiling = xno; then
62       if test x"$PKG_CONFIG" != x; then
63         gnash_qt_version="`$PKG_CONFIG --modversion $qt_pkg | cut -d '.' -f 1`"
64       fi
65     fi
67     AC_MSG_CHECKING([for QT 3.x header])
68     if test x$cross_compiling = xno; then
69       if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_qt3_incl}" = x; then
70         $PKG_CONFIG --exists $qt_pkg && ac_cv_path_qt3_incl="`$PKG_CONFIG --cflags-only-I $qt_pkg | cut -d ' ' -f 1`"
71       fi
72     fi
74     dnl QT 3,x stores it's headers in ../lib/qt-3.3/include for example, so
75     dnl use libslist instead of incllist
76     if test x"${ac_cv_path_qt3_incl}" = x; then
77       for i in $QTDIR $libslist $incllist; do
78         for j in `ls -dr $i/qt[[0-9]] 2>/dev/null`; do
79           if test -f $j/include/qobject.h; then
80             gnash_qt3_topdir="$j"
81             ac_cv_path_qt3_incl="-I$j/include"
82             break
83           fi
84         done
85         if test "x$gnash_qt3_topdir" != x; then
86           break;
87         fi
88       done
89     else
90       gnash_qt3_topdir="`echo ${ac_cv_path_qt3_incl} | sed -e 's:-I::' -e 's:/lib/qt.*::'`"
91     fi
93     if test x"${ac_cv_path_qt3_incl}" = x; then
94       QT3_CFLAGS=""
95       AC_MSG_RESULT(no)
96     else
97       QT3_CFLAGS="${ac_cv_path_qt3_incl}"
98       AC_MSG_RESULT(${ac_cv_path_qt3_incl})
99     fi
101 dnl   # QT_LIBS =  -lqtui -lqtcore -lqtprint -L/usr/lib/qt-3.3/lib -lqt-mt
102   dnl Look for the libraries
103     AC_ARG_WITH(qt3_lib, AC_HELP_STRING([--with-qt3-lib], [directory where QT 3.x libraries are]), with_qt3_lib=${withval})
104     AC_CACHE_VAL(ac_cv_path_qt3_lib, [
105       if test x"${with_qt3_lib}" != x ; then
106         if test `ls -C1 ${with_qt3_lib}/lib/libqt*-mt.* | wc -l` -gt 0 ; then
107          ac_cv_path_qt3_lib="-L`(cd ${with_qt3_lib}; pwd)` ${qt3support} -lqt-mt"
108         else
109                 AC_MSG_ERROR([${with_qt3_lib} directory doesn't contain QT 3.x libraries.])
110         fi
111       fi
112     ])
114     if test x$cross_compiling = xno; then
115       if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_qt3_lib}" = x; then
116         $PKG_CONFIG --exists $qt_pkg && ac_cv_path_qt3_lib="`$PKG_CONFIG --libs-only-l $qt_pkg | cut -d ' ' -f 1`"
117       fi
118     fi
120     if test x"${ac_cv_path_qt3_lib}" = x; then
121       AC_MSG_CHECKING([for QT 3.x libraries])
122       if test `ls -C1 ${gnash_qt3_topdir}/lib/libqt*-mt.*| wc -l` -gt 0 ; then
123         dnl Qtopia (embedded QT) uses libqte-mt instead of libqt-mt
124         if test -f ${gnash_qt3_topdir}/lib/libqte-mt.${shlibext}; then
125           ac_cv_path_qt3_lib="-L${gnash_qt3_topdir}/lib ${qt3support} -lqte-mt"
126          else
127           ac_cv_path_qt3_lib="-L${gnash_qt3_topdir}/lib ${qt3support} -lqt-mt"
128         fi
129       fi
130       if test x"${ac_cv_path_qt3_lib}" != x; then
131         AC_MSG_RESULT(${ac_cv_path_qt3_lib})
132       else
133         AC_MSG_RESULT(none)
134       fi
135     fi
137     if test x"${ac_cv_path_qt3_lib}" != x; then
138       AC_MSG_RESULT(${ac_cv_path_qt3_lib})
139     else
140       AC_MSG_RESULT(no)
141     fi
143     dnl Both the headers and the library must be installed
144     if test x"${ac_cv_path_qt3_incl}" != x -a x"${ac_cv_path_qt3_lib}" != x; then
145       AC_DEFINE(HAVE_QT3, 1, [Have QT 3.x installed])
146       QT3_LIBS="${ac_cv_path_qt3_lib}"
147       has_qt3="yes"
148     else
149       has_qt3="no"
150       QT3_LIBS=""
151     fi
153     AC_PATH_PROG(MOC3, moc, ,[ /usr/lib/qt-3.3/bin ${QTDIR}/bin${pathlist}])
155   fi                              dnl end of ${ac_cv_path_qt3_incl} empty
157   AC_SUBST(MOC3)
158   AC_SUBST(QT3_CFLAGS)  
159   AC_SUBST(QT3_LIBS)
163 # Local Variables:
164 # c-basic-offset: 2
165 # tab-width: 2
166 # indent-tabs-mode: nil
167 # End: