2 dnl Copyright (C) 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
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.
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],
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)`"
38 AC_MSG_ERROR([${with_qt3_incl} directory doesn't contain any QT 3.x headers])
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"${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.
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!])
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`"
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`"
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
80 ac_cv_path_qt3_incl="-I$j/include"
84 if test "x$gnash_qt3_topdir" != x; then
89 gnash_qt3_topdir="`echo ${ac_cv_path_qt3_incl} | sed -e 's:-I::' -e 's:/lib/qt.*::'`"
92 if test x"${ac_cv_path_qt3_incl}" = x; then
96 QT3_CFLAGS="${ac_cv_path_qt3_incl}"
97 AC_MSG_RESULT(${ac_cv_path_qt3_incl})
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"
108 AC_MSG_ERROR([${with_qt3_lib} directory doesn't contain QT 3.x libraries.])
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`"
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"
126 ac_cv_path_qt3_lib="-L${gnash_qt3_topdir}/lib ${qt3support} -lqt-mt"
129 if test x"${ac_cv_path_qt3_lib}" != x; then
130 AC_MSG_RESULT(${ac_cv_path_qt3_lib})
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])
145 AC_PATH_PROG(MOC3, moc, ,[ /usr/lib/qt-3.3/bin ${QTDIR}/bin${pathlist}])
147 fi dnl end of ${ac_cv_path_qt3_incl} empty
158 # indent-tabs-mode: nil