Add automated test on delayed return value handling in ExternalInterface.call().
[gnash.git] / macros / dbus.m4
bloba8cb0d3958c47b8bd568efd25c87d375999d4169
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
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)`"
28       else
29         AC_MSG_ERROR([${with_dbus_incl} directory doesn't contain dbus/dbus.h])
30       fi
31     fi
32   ])
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`
37     fi
38   fi
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"}'`
49     fi
50   fi
52   if test x"${gnash_dbus_version}" = x; then
53     gnash_dbus_topdir=""
54     gnash_dbus_version=""
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}"
61               break
62             fi
63       done
64           if test x$gnash_dbus_version != x; then
65             break;
66           fi
67     done
68   fi      
70   if test x"${gnash_dbus_version}" = x; then
71     AC_MSG_RESULT(none)
72   else
73     AC_MSG_RESULT([${gnash_dbus_version}])
74   fi
75   
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)`"
85       else
86               AC_MSG_ERROR([${with_dbus_lib} directory doesn't contain libdbus.])
87       fi
88     fi
89   ])
90   
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`
94     fi
95   fi
97   if test x"${ac_cv_path_dbus_lib}" = x; then
98     newlist="/lib /lib64 $libslist"
99     for i in $newlist; do
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}"
103                 break
104         else
105                 ac_cv_path_dbus_lib="-ldbus-${gnash_dbus_version}"
106           break
107         fi
108       fi
109     done
110   fi
111         
112   AC_MSG_CHECKING([for Dbus library])
113   AC_MSG_RESULT(${ac_cv_path_dbus_lib})
114   
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}"])
117   fi
119   if test x"${ac_cv_path_dbus_incl}" != x; then
120     DBUS_CFLAGS="${ac_cv_path_dbus_incl}"
121   else
122     DBUS_CFLAGS=""
123   fi
125   if test x"${ac_cv_path_dbus_lib}" != x; then
126     DBUS_LIBS="${ac_cv_path_dbus_lib}"
127   else
128     DBUS_LIBS=""
129   fi
131   AC_SUBST(DBUS_CFLAGS)
132   AC_SUBST(DBUS_LIBS)
135 # Local Variables:
136 # c-basic-offset: 2
137 # tab-width: 2
138 # indent-tabs-mode: nil
139 # End: