diff options
author | kraxel <kraxel> | 2006-01-24 16:41:25 +0000 |
---|---|---|
committer | kraxel <kraxel> | 2006-01-24 16:41:25 +0000 |
commit | 2bc71f882724947307fadcf5f3c7cee81191acb2 (patch) | |
tree | f238dede0e181e49387a07a6eb9e00a42e45a931 | |
parent | 5874585e61bbeec0f63d741d8051da62dd6a8009 (diff) | |
download | xenwatch-2bc71f882724947307fadcf5f3c7cee81191acb2.tar.gz |
- build without avahi.
-rw-r--r-- | GNUmakefile | 1 | ||||
-rw-r--r-- | mdns.c | 61 |
2 files changed, 42 insertions, 20 deletions
diff --git a/GNUmakefile b/GNUmakefile index 76ff4e2..5289274 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -28,6 +28,7 @@ endef ifeq ($(HAVE_GTK),yes) pkgs := gtk+-x11-2.0 ifeq ($(HAVE_AVAHI),yes) + CFLAGS += -DHAVE_AVAHI=1 pkgs += avahi-glib avahi-client endif $(GTK_TARGETS) : CFLAGS += $(shell pkg-config --cflags $(pkgs)) -Wno-strict-prototypes @@ -3,18 +3,21 @@ #include <unistd.h> #include <string.h> -#include <glib.h> - -#include <avahi-client/client.h> -#include <avahi-client/lookup.h> -#include <avahi-common/error.h> -#include <avahi-common/timeval.h> -#include <avahi-glib/glib-watch.h> -#include <avahi-glib/glib-malloc.h> +#ifdef HAVE_AVAHI +# include <glib.h> +# include <avahi-client/client.h> +# include <avahi-client/lookup.h> +# include <avahi-common/error.h> +# include <avahi-common/timeval.h> +# include <avahi-glib/glib-watch.h> +# include <avahi-glib/glib-malloc.h> +#endif #include "list.h" #include "mdns.h" +#ifdef HAVE_AVAHI + /* ---------------------------------------------------------------------- */ static const char *revents[] = { @@ -138,18 +141,6 @@ client_callback(AvahiClient *client, AvahiClientState state, void *userdata) /* ---------------------------------------------------------------------- */ -void mdns_fini(void) -{ - if (client) { - avahi_client_free(client); - client = NULL; - } - if (glib_poll) { - avahi_glib_poll_free(glib_poll); - glib_poll = NULL; - } -} - int mdns_init(void) { int error; @@ -185,3 +176,33 @@ int mdns_browse(const char *service, const char *domain) } return 0; } + +void mdns_fini(void) +{ + if (client) { + avahi_client_free(client); + client = NULL; + } + if (glib_poll) { + avahi_glib_poll_free(glib_poll); + glib_poll = NULL; + } +} + +#else + +int mdns_init(void) +{ + return -1; +} + +int mdns_browse(const char *service, const char *domain) +{ + return -1; +} + +void mdns_fini(void) +{ +} + +#endif |