2 dnl Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010,
3 dnl 2011 Free Software Foundation, Inc.
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.
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],
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)`"
39 AC_MSG_ERROR([${with_qt3_incl} directory doesn't contain any QT 3.x headers])
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.
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!])
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`"
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`"
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
81 ac_cv_path_qt3_incl="-I$j/include"
85 if test "x$gnash_qt3_topdir" != x; then
90 gnash_qt3_topdir="`echo ${ac_cv_path_qt3_incl} | sed -e 's:-I::' -e 's:/lib/qt.*::'`"
93 if test x"${ac_cv_path_qt3_incl}" = x; then
97 QT3_CFLAGS="${ac_cv_path_qt3_incl}"
98 AC_MSG_RESULT(${ac_cv_path_qt3_incl})
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"
109 AC_MSG_ERROR([${with_qt3_lib} directory doesn't contain QT 3.x libraries.])
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`"
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"
127 ac_cv_path_qt3_lib="-L${gnash_qt3_topdir}/lib ${qt3support} -lqt-mt"
130 if test x"${ac_cv_path_qt3_lib}" != x; then
131 AC_MSG_RESULT(${ac_cv_path_qt3_lib})
137 if test x"${ac_cv_path_qt3_lib}" != x; then
138 AC_MSG_RESULT(${ac_cv_path_qt3_lib})
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}"
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
166 # indent-tabs-mode: nil