diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2004-04-03 08:01:04 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2004-04-03 08:01:04 +0000 |
commit | cfd9a803fbfff5d6332000fd515bc92a10001acf (patch) | |
tree | 701f328e917b4af6964a0af8c3e57a766a3b98c1 | |
parent | 138996fe1350b28f551edc24ecc6c498d20c64f5 (diff) |
Use own check for D-BUS support
-rw-r--r-- | acinclude.m4 | 62 | ||||
-rw-r--r-- | configure.in | 14 | ||||
-rw-r--r-- | hcid/Makefile.am | 8 |
3 files changed, 68 insertions, 16 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 67506577..f088ecc3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -55,3 +55,65 @@ AC_DEFUN(AC_PATH_BLUEZ, [ AC_SUBST(BLUEZ_LDFLAGS) AC_SUBST(BLUEZ_LIBS) ]) + +AC_DEFUN(AC_PATH_DBUS, [ + AC_ARG_ENABLE(dbus, [ --enable-dbus enable D-BUS support], + dbus_enable=$enableval, + dbus_enable=no + ) + + AC_ARG_WITH(dbus, [ --with-dbus=DIR D-BUS library is installed in DIR], [ + dbus_includes=$withval/include + dbus_libraries=$withval/lib + dbus_enable=yes + ]) + + DBUS_INCLUDES="" + DBUS_LDFLAGS="" + DBUS_LIBS="" + + ac_save_CFLAGS=$CFLAGS + if test -n "$dbus_includes"; then + CFLAGS="$CFLAGS -I$dbus_includes -I$dbus_includes/dbus-1.0" + else + CFLAGS="$CFLAGS -I/usr/include/dbus-1.0" + fi + CFLAGS="$CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE" + + ac_save_LDFLAGS=$LDFLAGS + if test -n "$dbus_libraries"; then + CFLAGS="$CFLAGS -I$dbus_libraries/dbus-1.0/include" + LDFLAGS="$LDFLAGS -L$dbus_libraries" + else + CFLAGS="$CFLAGS -I/usr/lib/dbus-1.0/include" + fi + + AC_CHECK_HEADER(dbus/dbus.h,, + dbus_enable=no) + + AC_CHECK_LIB(dbus-1, dbus_error_init, + DBUS_LIBS="$DBUS_LIBS -ldbus-1", + dbus_enable=no) + + CFLAGS=$ac_save_CFLAGS + if test -n "$dbus_includes"; then + DBUS_INCLUDES="-I$dbus_includes -I$dbus_includes/dbus-1.0" + else + DBUS_INCLUDES="-I/usr/include/dbus-1.0" + fi + + LDFLAGS=$ac_save_LDFLAGS + if test -n "$dbus_libraries"; then + DBUS_INCLUDES="$DBUS_INCLUDES -I$dbus_libraries/dbus-1.0/include" + DBUS_LDFLAGS="-L$dbus_libraries" + DBUS_LIBS="-L$dbus_libraries $DBUS_LIBS" + else + DBUS_INCLUDES="$DBUS_INCLUDES -I/usr/lib/dbus-1.0/include" + fi + + AC_SUBST(DBUS_INCLUDES) + AC_SUBST(DBUS_LDFLAGS) + AC_SUBST(DBUS_LIBS) + + AM_CONDITIONAL(DBUS, test "$dbus_enable" = "yes") +]) diff --git a/configure.in b/configure.in index e0211d39..c9c11be5 100644 --- a/configure.in +++ b/configure.in @@ -23,18 +23,6 @@ AM_PROG_LEX AC_PATH_BLUEZ -AC_ARG_ENABLE(dbus, [ --enable-dbus use D-BUS], - BLUEZ_DBUS="$enableval", - BLUEZ_DBUS="no" -) - -if test x"$BLUEZ_DBUS" == "xyes"; then - PKG_CHECK_MODULES(DBUS, dbus-1, have_dbus=yes, have_dbus=no) - - CFLAGS="$CFLAGS $DBUS_CFLAGS -DENABLE_DBUS" - LIBS="$LIBS $DBUS_LIBS" -fi - -AM_CONDITIONAL(ENABLE_DBUS, test x$BLUEZ_DBUS = xyes) +AC_PATH_DBUS AC_OUTPUT(Makefile hcid/Makefile tools/Makefile rfcomm/Makefile sdpd/Makefile test/Makefile scripts/Makefile pcmcia/Makefile) diff --git a/hcid/Makefile.am b/hcid/Makefile.am index f356b9b6..b720e5cc 100644 --- a/hcid/Makefile.am +++ b/hcid/Makefile.am @@ -4,18 +4,20 @@ sbin_PROGRAMS = hcid -if ENABLE_DBUS +if DBUS dbus_hcid_sources = dbus.c +dbus_hcid_ldflags = @DBUS_LIBS@ else dbus_hcid_sources = +dbus_hcid_ldflags = endif hcid_SOURCES = main.c security.c hcid.h lib.c lib.h parser.h parser.y lexer.l kword.h kword.c glib-ectomy.h glib-ectomy.c $(dbus_hcid_sources) hcid_CONFIG = hcid.conf -LDFLAGS = @BLUEZ_LIBS@ +LDFLAGS = @BLUEZ_LIBS@ $(dbus_hcid_ldflags) -INCLUDES = @BLUEZ_INCLUDES@ +INCLUDES = @BLUEZ_INCLUDES@ @DBUS_INCLUDES@ man_MANS = hcid.8 hcid.conf.5 |