using dbus-devel on fedora?

Todd Zullinger tmz at pobox.com
Mon Jul 14 01:25:19 UTC 2008


Tom Horsley wrote:
> Through combinations of compiler error messages and the "locate"
> command, I've determined that I need the following -I options in
> order to successfully compile C programs that use the dbus
> interfaces (on a 64 bit system):
> 
>  -I /usr/include/dbus-1.0 -I /usr/lib64/dbus-1.0/include
> 
> Is there some more elegant way to provide the proper compile
> options? I haven't been able to find it in any of the docs (in fact
> I can't find any docs that talk about actually compiling dbus code
> at all :-).
> 
> I know some libraries come with a tool you can use to echo the
> proper options to stdout for whatever the current version happens to
> be. This looks like it could use such a tool, but I didn't see
> anything in the list of files from the dbus-devel rpm that looked
> promising.

The pkg-config command is what helps here.  The dbus-devel package
ships a pkg-config file (dbus-1.pc):

$ rpm -ql dbus-devel | grep pkgconfig
/usr/lib/pkgconfig/dbus-1.pc

This allows you to get the CLFAGS or LIBS like so:

$ pkg-config --cflags dbus-1
-I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include

$ pkg-config --libs dbus-1
-L/lib -ldbus-1  

There are macros available for autoconf/automake to detect and set
these things for you as well.  For example, libgpod has this in its
configure.ac file (used to generate the configure script):

PKG_CHECK_MODULES(LIBGPOD, glib-2.0>= 2.8.0 gobject-2.0)

This tests for glib-2.0 greater than or equal to 2.8.0 and
gobject-2.0.  If they are not found, there is an error and configure
stops.  If they are found, the variables LIBGPOD_CFLAGS and
LIBGPOD_LIBS are set.

Hope that helps,

-- 
Todd        OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Remember, there's a big difference between kneeling down and bending
over.
    -- Frank Zappa

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 542 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20080713/e15da332/attachment-0001.sig>


More information about the fedora-list mailing list