2 dnl Copyright (C) 2005, 2006, 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
18 AC_DEFUN([GNASH_PATH_DBUS],
21 dnl Look for the header
22 AC_ARG_WITH(dbus_incl, AC_HELP_STRING([--with-dbus-incl], [directory where libdbus header is]), with_dbus_incl=${withval})
23 AC_CACHE_VAL(ac_cv_path_dbus_incl,[
24 if test x"${with_dbus_incl}" != x ; then
25 if test -f ${with_dbus_incl}/dbus/dbus.h ; then
26 ac_cv_path_dbus_incl="-I`(cd ${with_dbus_incl}; pwd)`"
28 AC_MSG_ERROR([${with_dbus_incl} directory doesn't contain dbus/dbus.h])
33 if test x$cross_compiling = xno; then
34 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_dbus_incl}" = x; then
35 $PKG_CONFIG --exists dbus-1 && ac_cv_path_dbus_incl=`$PKG_CONFIG --cflags dbus-1`
39 dnl Attempt to find the top level directory, which unfortunately has a
40 dnl version number attached. At least on Debain based systems, this
41 dnl doesn't seem to get a directory that is unversioned.
43 AC_MSG_CHECKING([for the Dbus Version])
45 if test x$cross_compiling = xno; then
46 if test x"$PKG_CONFIG" != x; then
47 $PKG_CONFIG --exists dbus-1 && gnash_dbus_version=`$PKG_CONFIG --modversion dbus-1 | cut -d "." -f 1 | awk '{print $'0'".0"}'`
51 if test x"${gnash_dbus_version}" = x; then
54 for i in $incllist; do
55 for j in `ls -dr $i/dbus-[[0-9]].[[0-9]] 2>/dev/null`; do
56 if test -f $j/dbus.h; then
57 gnash_dbus_topdir=`basename $j`
58 gnash_dbus_version=`echo ${gnash_dbus_topdir} | sed -e 's:dbus-::' -e 's:.0::'`
59 ac_cv_path_dbus_incl="-I$i/${gnash_dbus_topdir}"
63 if test x$gnash_dbus_version != x; then
69 if test x"${gnash_dbus_version}" = x; then
72 AC_MSG_RESULT([${gnash_dbus_version}])
75 AC_MSG_CHECKING([for Dbus headers])
76 AC_MSG_RESULT(${ac_cv_path_dbus_incl})
78 dnl Look for the library
79 AC_ARG_WITH(dbus_lib, AC_HELP_STRING([--with-dbus-lib], [directory where dbus library is]), with_dbus_lib=${withval})
80 AC_CACHE_VAL(ac_cv_path_dbus_lib,[
81 if test x"${with_dbus_lib}" != x ; then
82 if test -f ${with_dbus_lib}/libdbus-1.a -o -f ${with_dbus_lib}/libdbus-1.${shlibext}; then
83 ac_cv_path_dbus_lib="-L`(cd ${with_dbus_lib}; pwd)`"
85 AC_MSG_ERROR([${with_dbus_lib} directory doesn't contain libdbus.])
90 if test x$cross_compiling = xno; then
91 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_dbus_lib}" = x; then
92 $PKG_CONFIG --exists dbus-1 && ac_cv_path_dbus_lib=`$PKG_CONFIG --libs-only-l dbus-1`
96 if test x"${ac_cv_path_dbus_lib}" = x; then
97 newlist="/lib /lib64 $libslist"
99 if test -f $i/libdbus-${gnash_dbus_version}.a -o -f $i/libdbus-${gnash_dbus_version}.${shlibext}; then
100 if test x"$i" != x"/lib"; then
101 ac_cv_path_dbus_lib="-L$i -ldbus-${gnash_dbus_version}"
104 ac_cv_path_dbus_lib="-ldbus-${gnash_dbus_version}"
111 AC_MSG_CHECKING([for Dbus library])
112 AC_MSG_RESULT(${ac_cv_path_dbus_lib})
114 if test x"${ac_cv_path_dbus_lib}" = x; then
115 AC_CHECK_LIB(dbus-${gnash_dbus_version}, dbus_engine_shape_class_init, [ac_cv_path_dbus_lib="-ldbus-${gnash_dbus_version}"])
118 if test x"${ac_cv_path_dbus_incl}" != x; then
119 DBUS_CFLAGS="${ac_cv_path_dbus_incl}"
124 if test x"${ac_cv_path_dbus_lib}" != x; then
125 DBUS_LIBS="${ac_cv_path_dbus_lib}"
130 AC_SUBST(DBUS_CFLAGS)
137 # indent-tabs-mode: nil