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
19 AC_DEFUN([GNASH_PATH_DBUS],
22 dnl Look for the header
23 AC_ARG_WITH(dbus_incl, AC_HELP_STRING([--with-dbus-incl], [directory where libdbus header is]), with_dbus_incl=${withval})
24 AC_CACHE_VAL(ac_cv_path_dbus_incl,[
25 if test x"${with_dbus_incl}" != x ; then
26 if test -f ${with_dbus_incl}/dbus/dbus.h ; then
27 ac_cv_path_dbus_incl="-I`(cd ${with_dbus_incl}; pwd)`"
29 AC_MSG_ERROR([${with_dbus_incl} directory doesn't contain dbus/dbus.h])
34 if test x$cross_compiling = xno; then
35 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_dbus_incl}" = x; then
36 $PKG_CONFIG --exists dbus-1 && ac_cv_path_dbus_incl=`$PKG_CONFIG --cflags dbus-1`
40 dnl Attempt to find the top level directory, which unfortunately has a
41 dnl version number attached. At least on Debain based systems, this
42 dnl doesn't seem to get a directory that is unversioned.
44 AC_MSG_CHECKING([for the Dbus Version])
46 if test x$cross_compiling = xno; then
47 if test x"$PKG_CONFIG" != x; then
48 $PKG_CONFIG --exists dbus-1 && gnash_dbus_version=`$PKG_CONFIG --modversion dbus-1 | cut -d "." -f 1 | awk '{print $'0'".0"}'`
52 if test x"${gnash_dbus_version}" = x; then
55 for i in $incllist; do
56 for j in `ls -dr $i/dbus-[[0-9]].[[0-9]] 2>/dev/null`; do
57 if test -f $j/dbus.h; then
58 gnash_dbus_topdir=`basename $j`
59 gnash_dbus_version=`echo ${gnash_dbus_topdir} | sed -e 's:dbus-::' -e 's:.0::'`
60 ac_cv_path_dbus_incl="-I$i/${gnash_dbus_topdir}"
64 if test x$gnash_dbus_version != x; then
70 if test x"${gnash_dbus_version}" = x; then
73 AC_MSG_RESULT([${gnash_dbus_version}])
76 AC_MSG_CHECKING([for Dbus headers])
77 AC_MSG_RESULT(${ac_cv_path_dbus_incl})
79 dnl Look for the library
80 AC_ARG_WITH(dbus_lib, AC_HELP_STRING([--with-dbus-lib], [directory where dbus library is]), with_dbus_lib=${withval})
81 AC_CACHE_VAL(ac_cv_path_dbus_lib,[
82 if test x"${with_dbus_lib}" != x ; then
83 if test -f ${with_dbus_lib}/libdbus-1.a -o -f ${with_dbus_lib}/libdbus-1.${shlibext}; then
84 ac_cv_path_dbus_lib="-L`(cd ${with_dbus_lib}; pwd)`"
86 AC_MSG_ERROR([${with_dbus_lib} directory doesn't contain libdbus.])
91 if test x$cross_compiling = xno; then
92 if test x"$PKG_CONFIG" != x -a x"${ac_cv_path_dbus_lib}" = x; then
93 $PKG_CONFIG --exists dbus-1 && ac_cv_path_dbus_lib=`$PKG_CONFIG --libs-only-l dbus-1`
97 if test x"${ac_cv_path_dbus_lib}" = x; then
98 newlist="/lib /lib64 $libslist"
100 if test -f $i/libdbus-${gnash_dbus_version}.a -o -f $i/libdbus-${gnash_dbus_version}.${shlibext}; then
101 if test x"$i" != x"/lib"; then
102 ac_cv_path_dbus_lib="-L$i -ldbus-${gnash_dbus_version}"
105 ac_cv_path_dbus_lib="-ldbus-${gnash_dbus_version}"
112 AC_MSG_CHECKING([for Dbus library])
113 AC_MSG_RESULT(${ac_cv_path_dbus_lib})
115 if test x"${ac_cv_path_dbus_lib}" = x; then
116 AC_CHECK_LIB(dbus-${gnash_dbus_version}, dbus_engine_shape_class_init, [ac_cv_path_dbus_lib="-ldbus-${gnash_dbus_version}"])
119 if test x"${ac_cv_path_dbus_incl}" != x; then
120 DBUS_CFLAGS="${ac_cv_path_dbus_incl}"
125 if test x"${ac_cv_path_dbus_lib}" != x; then
126 DBUS_LIBS="${ac_cv_path_dbus_lib}"
131 AC_SUBST(DBUS_CFLAGS)
138 # indent-tabs-mode: nil