# This cool debug trap works on i386/gcc only
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-if ENABLE_DBUS
+if HAVE_DBUS
avahi_clientincludedir=$(includedir)/avahi-client
+avahi_clientinclude_HEADERS = client.h
-avahi_clientinclude_HEADERS = \
- client.h
+noinst_HEADERS = internal.h
-noinst_HEADERS = \
- internal.h
+noinst_PROGRAMS = client-test
-noinst_PROGRAMS = \
- client-test
-
-lib_LTLIBRARIES = \
- libavahi-client.la
+lib_LTLIBRARIES = libavahi-client.la
libavahi_client_la_SOURCES = \
client.c client.h \
entrygroup.c \
browser.c
-
libavahi_client_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
-libavahi_client_la_LIBADD = $(AM_LDADD) $(DBUS_LIBS) ../avahi-common/libavahi-common.la ../avahi-common/libdbus-watch-glue.la
+libavahi_client_la_LIBADD = $(AM_LDADD) $(DBUS_LIBS) ../avahi-common/libavahi-common.la ../avahi-common/libdbus-watch-glue-pic.la
libavahi_client_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info 0:0:0
-client_test_SOURCES = \
- client-test.c
-
-client_test_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-client_test_LDADD = $(AM_LDADD) $(GLIB20_LIBS) libavahi-client.la ../avahi-common/libavahi-common.la ../avahi-glib/libavahi-glib.la
+client_test_SOURCES = client-test.c
+client_test_CFLAGS = $(AM_CFLAGS)
+client_test_LDADD = $(AM_LDADD) libavahi-client.la ../avahi-common/libavahi-common.la
endif
#include <avahi-client/client.h>
#include <avahi-common/error.h>
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
+#include <avahi-common/simple-watch.h>
+#include <avahi-common/malloc.h>
#include <stdio.h>
-#include <glib.h>
+#include <assert.h>
+
+static const AvahiPoll *poll_api = NULL;
+
static void
avahi_client_callback (AvahiClient *c, AvahiClientState state, void *user_data)
printf ("XXX: Callback on %s, interface (%d), protocol (%d), event (%d), type (%s), domain (%s), data (%s)\n", avahi_service_type_browser_path (b), interface, protocol, event, type, domain, (char*)user_data);
}
-static gboolean
-test_free_domain_browser (gpointer data)
+static void test_free_domain_browser(AvahiTimeout *timeout, void* userdata)
{
- AvahiServiceBrowser *b = data;
+ AvahiServiceBrowser *b = userdata;
printf ("XXX: freeing domain browser\n");
avahi_service_browser_free (b);
- return FALSE;
}
-static gboolean
-test_free_entry_group (gpointer data)
+static void test_free_entry_group (AvahiTimeout *timeout, void* userdata)
{
- AvahiEntryGroup *g = data;
+ AvahiEntryGroup *g = userdata;
printf ("XXX: freeing entry group\n");
avahi_entry_group_free (g);
- return FALSE;
}
int
main (int argc, char *argv[])
{
- GMainLoop *loop;
AvahiClient *avahi;
AvahiEntryGroup *group;
AvahiStringList *txt;
AvahiDomainBrowser *domain;
AvahiServiceBrowser *sb;
AvahiServiceTypeBrowser *st;
- AvahiGLibPoll *glib_poll;
+ AvahiSimplePoll *simple_poll;
char *ret;
+ struct timeval tv;
- avahi_set_allocator(avahi_glib_allocator());
-
- glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
- loop = g_main_loop_new (NULL, FALSE);
+ simple_poll = avahi_simple_poll_new();
+ poll_api = avahi_simple_poll_get(simple_poll);
- avahi = avahi_client_new (avahi_glib_poll_get(glib_poll), avahi_client_callback, "omghai2u");
+ avahi = avahi_client_new(poll_api, avahi_client_callback, "omghai2u");
- g_assert (avahi != NULL);
+ assert (avahi != NULL);
ret = avahi_client_get_version_string (avahi);
printf ("Avahi Server Version: %s (Error Return: %s)\n", ret, avahi_strerror (avahi_client_errno (avahi)));
- g_free (ret);
+ avahi_free (ret);
ret = avahi_client_get_host_name (avahi);
printf ("Host Name: %s (Error Return: %s)\n", ret, avahi_strerror (avahi_client_errno (avahi)));
- g_free (ret);
+ avahi_free (ret);
ret = avahi_client_get_domain_name (avahi);
printf ("Domain Name: %s (Error Return: %s)\n", ret, avahi_strerror (avahi_client_errno (avahi)));
- g_free (ret);
+ avahi_free (ret);
ret = avahi_client_get_host_name_fqdn (avahi);
printf ("FQDN: %s (Error Return: %s)\n", ret, avahi_strerror (avahi_client_errno (avahi)));
- g_free (ret);
+ avahi_free (ret);
group = avahi_entry_group_new (avahi, avahi_entry_group_callback, "omghai");
else
printf ("Sucessfully created service browser, path %s\n", avahi_service_browser_path (sb));
- g_timeout_add (2000, test_free_entry_group, group);
- g_timeout_add (5000, test_free_domain_browser, sb);
- g_main_loop_run (loop);
+ avahi_elapse_time(&tv, 5000, 0);
+ poll_api->timeout_new(poll_api, &tv, test_free_entry_group, group);
+ avahi_elapse_time(&tv, 8000, 0);
+ poll_api->timeout_new(poll_api, &tv, test_free_domain_browser, sb);
+
+ for (;;)
+ if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
+ break;
+
+
+ avahi_simple_poll_free(simple_poll);
- g_free (avahi);
+ avahi_free (avahi);
return 0;
}
timeval-test.c
timeval_test_CFLAGS = $(AM_CFLAGS)
-if ENABLE_DBUS
+if HAVE_DBUS
noinst_HEADERS += \
dbus.h \
dbus-watch-glue.h
noinst_LTLIBRARIES = \
- libdbus-watch-glue.la
+ libdbus-watch-glue.la \
+ libdbus-watch-glue-pic.la
libdbus_watch_glue_la_SOURCES = \
dbus-watch-glue.h dbus-watch-glue.c
libdbus_watch_glue_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
-libdbus_watch_glue_la_LDFLAGS = $(AM_LDFLAGS) -static -export-dynamic
+libdbus_watch_glue_la_LDFLAGS = $(AM_LDFLAGS) -all-static
+
+libdbus_watch_glue_pic_la_SOURCES = $(libdbus_watch_glue_la_SOURCES)
+libdbus_watch_glue_pic_la_CFLAGS = $(libdbus_watch_glue_la_CFLAGS) -fPIC
+libdbus_watch_glue_pic_la_LDFLAGS = $(libdbus_watch_glue_la_LDFLAGS)
endif
AM_CFLAGS=-I$(top_srcdir)
-# Import stuff from avahi-common
-COMMON_LDADD=../avahi-common/libavahi-common.la
-
-# Import stuff from avahi-glib
-GLIB_LDADD=../avahi-glib/libavahi-glib.la
-
# This cool debug trap works on i386/gcc only
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
hashmap.c hashmap.h
libavahi_core_la_CFLAGS = $(AM_CFLAGS)
-libavahi_core_la_LIBADD = $(AM_LDADD) $(COMMON_LDADD)
+libavahi_core_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
libavahi_core_la_LDFLAGS = $(AM_LDFLAGS) -export-dynamic -version-info 0:0:0
prioq_test_SOURCES = \
prioq-test.c \
prioq.c prioq.h
prioq_test_CFLAGS = $(AM_CFLAGS)
-prioq_test_LDADD = $(AM_LDADD) $(COMMON_LDADD)
+prioq_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
avahi_test_SOURCES = \
avahi-test.c
-avahi_test_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-avahi_test_LDADD = $(AM_LDADD) $(COMMON_LDADD) libavahi-core.la $(GLIB_LDADD) $(GLIB20_LIBS)
+avahi_test_CFLAGS = $(AM_CFLAGS)
+avahi_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
conformance_test_SOURCES = \
conformance-test.c
-conformance_test_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
-conformance_test_LDADD = $(AM_LDADD) $(COMMON_LDADD) libavahi-core.la $(GLIB_LDADD) $(GLIB20_LIBS)
+conformance_test_CFLAGS = $(AM_CFLAGS)
+conformance_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
avahi_reflector_SOURCES = \
avahi-reflector.c
avahi_reflector_CFLAGS = $(AM_CFLAGS)
-avahi_reflector_LDADD = $(AM_LDADD) $(COMMON_LDADD) libavahi-core.la
+avahi_reflector_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la libavahi-core.la
dns_test_SOURCES = \
dns.c dns.h \
rr.c rr.h \
hashmap.c hashmap.h
dns_test_CFLAGS = $(AM_CFLAGS)
-dns_test_LDADD = $(AM_LDADD) $(COMMON_LDADD)
+dns_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
timeeventq_test_SOURCES = \
timeeventq-test.c \
prioq.h prioq.c \
log.c log.h
timeeventq_test_CFLAGS = $(AM_CFLAGS)
-timeeventq_test_LDADD = $(AM_LDADD) $(COMMON_LDADD)
+timeeventq_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
hashmap_test_SOURCES = \
hashmap-test.c \
hashmap.h hashmap.c \
util.h util.c
hashmap_test_CFLAGS = $(AM_CFLAGS)
-hashmap_test_LDADD = $(AM_LDADD) $(COMMON_LDADD)
+hashmap_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
valgrind: avahi-test
libtool --mode=execute valgrind ./avahi-test
#include <assert.h>
#include <avahi-common/malloc.h>
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
+#include <avahi-common/simple-watch.h>
#include <avahi-core/core.h>
#include <avahi-core/log.h>
static AvahiServer *server = NULL;
static char *service_name = NULL;
-static int quit_timeout(void* data) {
- g_main_loop_quit(data);
- return 0;
+static const AvahiPoll *poll_api;
+
+static void quit_timeout_callback(AvahiTimeout *timeout, void* userdata) {
+ AvahiSimplePoll *simple_poll = userdata;
+
+ avahi_simple_poll_quit(simple_poll);
}
static void dump_line(const char *text, void* userdata) {
printf("%s\n", text);
}
-static int dump_timeout(void* data) {
- AvahiServer *Avahi = data;
- avahi_server_dump(Avahi, dump_line, NULL);
- return 1;
+static void dump_timeout_callback(AvahiTimeout *timeout, void* userdata) {
+ struct timeval tv;
+
+ AvahiServer *avahi = userdata;
+ avahi_server_dump(avahi, dump_line, NULL);
+
+ avahi_elapse_time(&tv, 5000, 0);
+ poll_api->timeout_update(timeout, &tv);
}
static void record_browser_callback(AvahiSRecordBrowser *r, AvahiIfIndex interface, AvahiProtocol protocol, AvahiBrowserEvent event, AvahiRecord *record, void* userdata) {
assert(avahi_s_entry_group_is_empty(group));
if (!service_name)
- service_name = g_strdup("Test Service");
+ service_name = avahi_strdup("Test Service");
else if (new_name) {
char *n = avahi_alternative_service_name(service_name);
avahi_free(service_name);
}
int main(int argc, char *argv[]) {
- GMainLoop *loop = NULL;
AvahiSRecordBrowser *r;
AvahiSHostNameResolver *hnr;
AvahiSAddressResolver *ar;
AvahiSServiceBrowser *sb;
AvahiSServiceResolver *sr;
AvahiSDNSServerBrowser *dsb;
- AvahiGLibPoll *glib_poll;
+ AvahiSimplePoll *simple_poll;
int error;
+ struct timeval tv;
- avahi_set_allocator(avahi_glib_allocator());
- glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
+ simple_poll = avahi_simple_poll_new();
+ poll_api = avahi_simple_poll_get(simple_poll);
avahi_server_config_init(&config);
/* config.host_name = g_strdup("test"); */
- server = avahi_server_new(avahi_glib_poll_get(glib_poll), &config, server_callback, NULL, &error);
+ server = avahi_server_new(poll_api, &config, server_callback, NULL, &error);
avahi_server_config_free(&config);
k = avahi_key_new("_http._tcp.local", AVAHI_DNS_CLASS_IN, AVAHI_DNS_TYPE_PTR);
dsb = avahi_s_dns_server_browser_new(server, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "local", AVAHI_DNS_SERVER_RESOLVE, AVAHI_PROTO_UNSPEC, dsb_callback, NULL);
-
- g_timeout_add(1000*5, dump_timeout, server);
- g_timeout_add(1000*60, quit_timeout, loop);
-
- loop = g_main_loop_new(NULL, 0);
- g_main_loop_run(loop);
- g_main_loop_unref(loop);
+ avahi_elapse_time(&tv, 1000*5, 0);
+ poll_api->timeout_new(poll_api, &tv, dump_timeout_callback, server);
+
+ avahi_elapse_time(&tv, 1000*60, 0);
+ poll_api->timeout_new(poll_api, &tv, quit_timeout_callback, server);
+
+ for (;;)
+ if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
+ break;
avahi_s_record_browser_free(r);
avahi_s_host_name_resolver_free(hnr);
if (server)
avahi_server_free(server);
- if (glib_poll)
- avahi_glib_poll_free(glib_poll);
+ if (simple_poll)
+ avahi_simple_poll_free(simple_poll);
avahi_free(service_name);
#include <assert.h>
#include <avahi-common/alternative.h>
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
+#include <avahi-common/malloc.h>
+#include <avahi-common/simple-watch.h>
#include "core.h"
#include "log.h"
static AvahiSEntryGroup *group = NULL;
static int try = 0;
static AvahiServer *avahi = NULL;
+static const AvahiPoll *poll_api;
static void dump_line(const char *text, void* userdata) {
printf("%s\n", text);
}
-static int dump_timeout(void* data) {
+static void dump_timeout_callback(AvahiTimeout *timeout, void* data) {
+ struct timeval tv;
+
avahi_server_dump(avahi, dump_line, NULL);
- return 1;
+
+ avahi_elapse_time(&tv, 5000, 0);
+ poll_api->timeout_update(timeout, &tv);
}
static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata);
assert(t || name);
- n = t ? g_strdup(t) : avahi_alternative_service_name(name);
+ n = t ? avahi_strdup(t) : avahi_alternative_service_name(name);
avahi_free(name);
name = n;
try++;
}
-static int rename_timeout(void* data) {
+static void rename_timeout_callback(AvahiTimeout *timeout, void *userdata) {
+ struct timeval tv;
if (access("flag", F_OK) == 0) {
create_service("New - Bonjour Service Name");
- return 0;
+ return;
}
- return 1;
+ avahi_elapse_time(&tv, 5000, 0);
+ poll_api->timeout_update(timeout, &tv);
}
static void entry_group_callback(AvahiServer *s, AvahiSEntryGroup *g, AvahiEntryGroupState state, void* userdata) {
}
int main(int argc, char *argv[]) {
- GMainLoop *loop = NULL;
- gint error;
- AvahiGLibPoll *glib_poll;
+ int error;
+ AvahiSimplePoll *simple_poll;
+ struct timeval tv;
- avahi_set_allocator(avahi_glib_allocator());
-
- glib_poll = avahi_glib_poll_new(NULL, G_PRIORITY_DEFAULT);
-
- avahi = avahi_server_new(avahi_glib_poll_get(glib_poll), NULL, server_callback, NULL, &error);
+ simple_poll = avahi_simple_poll_new();
+ poll_api = avahi_simple_poll_get(simple_poll);
- loop = g_main_loop_new(NULL, 0);
- g_timeout_add(1000*5, dump_timeout, avahi);
- g_timeout_add(1000*5, rename_timeout, avahi);
- g_main_loop_run(loop);
- g_main_loop_unref(loop);
+ avahi = avahi_server_new(poll_api, NULL, server_callback, NULL, &error);
+ avahi_elapse_time(&tv, 5000, 0);
+ poll_api->timeout_new(poll_api, &tv, dump_timeout_callback, avahi);
+
+ avahi_elapse_time(&tv, 5000, 0);
+ poll_api->timeout_new(poll_api, &tv, rename_timeout_callback, avahi);
+
+ for (;;)
+ if (avahi_simple_poll_iterate(simple_poll, -1) != 0)
+ break;
+
if (group)
avahi_s_entry_group_free(group);
avahi_server_free(avahi);
- avahi_glib_poll_free(glib_poll);
+ avahi_simple_poll_free(simple_poll);
return 0;
}
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
+AM_CFLAGS=-I$(top_srcdir)
+
+# This cool debug trap works on i386/gcc only
+AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
+
+if HAVE_LIBDAEMON
+if HAVE_EXPAT
+
pkgsysconfdir=$(sysconfdir)/avahi
servicedir=$(pkgsysconfdir)/services
introspectiondir=$(pkgdatadir)/introspection
dbusservicedir=$(DBUS_SYS_DIR)
-AM_CFLAGS= \
- -I$(top_srcdir) \
+AM_CFLAGS+= \
-DAVAHI_DAEMON_RUNTIME_DIR=\"$(avahi_runtime_dir)/avahi-daemon/\" \
-DAVAHI_SOCKET=\"$(avahi_socket)\" \
-DAVAHI_SERVICE_DIR=\"$(servicedir)\" \
-DAVAHI_CONFIG_FILE=\"$(pkgsysconfdir)/avahi-daemon.conf\" \
-DAVAHI_DBUS_INTROSPECTION_DIR=\"$(introspectiondir)\"
-AM_LDADD=-lexpat
-
-# libdaemon
-AM_CFLAGS+=$(LIBDAEMON_CFLAGS)
-AM_LDADD+=$(LIBDAEMON_LIBS)
-
-if ENABLE_DBUS
-AM_CFLAGS+=$(DBUS_CFLAGS)
-AM_LDADD+=$(DBUS_LIBS)
-endif
-
-# This cool debug trap works on i386/gcc only
-AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-
sbin_PROGRAMS = \
avahi-daemon
static-services.c static-services.h \
ini-file-parser.c ini-file-parser.h
-avahi_daemon_CFLAGS = $(AM_CFLAGS)
-avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la
+avahi_daemon_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
+avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la $(LIBDAEMON_LIBS) -lexpat
ini_file_parser_test_SOURCES = \
ini-file-parser.c ini-file-parser.h \
pkgdata_DATA = \
avahi-service.dtd
-EXTRA_DIST = \
- avahi-service.dtd \
- avahi-daemon.conf \
- example.service \
- dbus-test.py \
- avahi-dbus.conf \
- Server.introspect \
- EntryGroup.introspect \
- DomainBrowser.introspect \
- ServiceTypeBrowser.introspect \
- ServiceBrowser.introspect \
- ssh.service \
- example.service \
- introspect.dtd \
- introspect.xsl
-if ENABLE_DBUS
+if HAVE_DBUS
avahi_daemon_SOURCES += \
dbus-protocol.c \
dbus-protocol.h
avahi_daemon_LDADD += \
- ../avahi-common/libdbus-watch-glue.la
+ ../avahi-common/libdbus-watch-glue.la \
+ $(DBUS_LIBS)
+
+avahi_daemon_CFLAGS += $(DBUS_CFLAGS)
dbusservice_DATA = avahi-dbus.conf
ServiceBrowser.introspect
endif
+endif
+endif
-
+EXTRA_DIST = \
+ avahi-service.dtd \
+ avahi-daemon.conf \
+ example.service \
+ dbus-test.py \
+ avahi-dbus.conf \
+ Server.introspect \
+ EntryGroup.introspect \
+ DomainBrowser.introspect \
+ ServiceTypeBrowser.introspect \
+ ServiceBrowser.introspect \
+ ssh.service \
+ example.service \
+ introspect.dtd \
+ introspect.xsl
xmllint:
xmllint --noout --valid example.service
#include "main.h"
#include "simple-protocol.h"
-#include "dbus-protocol.h"
#include "static-services.h"
#include "ini-file-parser.h"
+#ifdef HAVE_DBUS
+#include "dbus-protocol.h"
+#endif
+
AvahiServer *avahi_server = NULL;
typedef enum {
avahi_server = s;
-#ifdef ENABLE_DBUS
+#ifdef HAVE_DBUS
if (c->enable_dbus)
dbus_protocol_server_state_changed(state);
#endif
if (simple_protocol_setup(poll_api) < 0)
goto finish;
-#ifdef ENABLE_DBUS
+#ifdef HAVE_DBUS
if (c->enable_dbus)
if (dbus_protocol_setup(poll_api) < 0)
goto finish;
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-AM_CFLAGS=-I$(top_srcdir) \
+AM_CFLAGS=\
+ -I$(top_srcdir) \
-DAVAHI_INTERFACES_DIR=\"$(interfacesdir)\"
-AM_CFLAGS+=$(GLIB20_CFLAGS) $(GTK20_CFLAGS) $(GLADE20_CFLAGS)
-AM_LDADD=$(GLIB20_LIBS) $(GTK20_LIBS) $(GLADE20_LIBS)
-
# This cool debug trap works on i386/gcc only
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-if ENABLE_GTK
+if HAVE_GTK
bin_PROGRAMS = \
avahi-discover-standalone
avahi_discover_standalone_SOURCES = \
main.c
-avahi_discover_standalone_CFLAGS = $(AM_CFLAGS)
-avahi_discover_standalone_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-glib/libavahi-glib.la ../avahi-core/libavahi-core.la
+avahi_discover_standalone_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(GLIB20_CFLAGS) $(GTK20_CFLAGS) $(GLADE20_CFLAGS)
+
+avahi_discover_standalone_LDADD = \
+ $(AM_LDADD) \
+ ../avahi-common/libavahi-common.la \
+ ../avahi-glib/libavahi-glib.la \
+ ../avahi-core/libavahi-core.la \
+ $(GLIB20_LIBS) $(GTK20_LIBS) $(GLADE20_LIBS)
interfaces = \
avahi-discover.glade
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
+if HAVE_EXPAT
+if HAVE_LIBDAEMON
+
pkgsysconfdir=$(sysconfdir)/avahi
AM_CFLAGS= \
-DAVAHI_SOCKET=\"$(avahi_socket)\" \
-DAVAHI_DNSCONF_SCRIPT=\"$(pkgsysconfdir)/avahi-dnsconfd.action\"
-# libdaemon
-AM_CFLAGS+=$(LIBDAEMON_CFLAGS)
-AM_LDADD=$(LIBDAEMON_LIBS)
-
# This cool debug trap works on i386/gcc only
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
-sbin_PROGRAMS = \
- avahi-dnsconfd
+sbin_PROGRAMS = avahi-dnsconfd
-avahi_dnsconfd_SOURCES = \
- main.c
-
-avahi_dnsconfd_CFLAGS = $(AM_CFLAGS)
-avahi_dnsconfd_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la
+avahi_dnsconfd_SOURCES = main.c
+avahi_dnsconfd_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
+avahi_dnsconfd_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(LIBDAEMON_LIBS)
pkgsysconf_SCRIPTS=avahi-dnsconfd.action
+endif
+endif
+
EXTRA_DIST=avahi-dnsconfd.action
AM_CFLAGS=-I$(top_srcdir)
-# GLIB 2.0
-AM_CFLAGS+=$(GLIB20_CFLAGS)
-AM_LDADD=$(GLIB20_LIBS)
-
-# Import stuff from avahi-common
-COMMON_LDADD=../avahi-common/libavahi-common.la
-
# This cool debug trap works on i386/gcc only
AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
avahiincludedir=$(includedir)/avahi-glib
+if HAVE_GLIB
+
avahiinclude_HEADERS = \
glib-watch.h
glib-malloc.h
libavahi_glib_la_SOURCES = \
glib-watch.c glib-watch.h \
glib-malloc.h glib-malloc.c
-libavahi_glib_la_CFLAGS = $(AM_CFLAGS)
-libavahi_glib_la_LIBADD = $(AM_LDADD) $(COMMON_LDADD)
+libavahi_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
+libavahi_glib_la_LIBADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(GLIB20_LIBS)
glib_watch_test_SOURCES = \
glib-watch.c glib-watch.h \
glib-watch-test.c
-glib_watch_test_CFLAGS = $(AM_CFLAGS)
-glib_watch_test_LDADD = $(AM_LDADD) $(COMMON_LDADD)
-
-
-
+glib_watch_test_CFLAGS = $(AM_CFLAGS) $(GLIB20_CFLAGS)
+glib_watch_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la $(GLIB20_LIBS)
+endif
avahi-resolve-address.in \
avahi-discover.desktop.in
-if HAVE_PYTHON
SUBDIRS=avahi
+if HAVE_PYTHON
+
desktopdir = $(datadir)/applications
desktop_DATA = avahi-discover.desktop
bin_SCRIPTS = $(pythonscripts)
-endif
avahi-discover.desktop: avahi-discover.desktop.in
sed -e 's,@bindir\@,$(bindir),g' $< > $@
chmod +x $@
CLEANFILES = $(pythonscripts) $(desktop_DATA)
+
+endif
AC_TYPE_MODE_T
AC_TYPE_PID_T
+# If using GCC specify some additional parameters
+if test "x$GCC" = "xyes" ; then
+ CFLAGS="$CFLAGS -pipe -W -Wall -pedantic"
+
+ AC_LANG_CONFTEST([int main() {}])
+ $CC -c conftest.c -std=c99 -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=c99 -Wno-unused-parameter"
+ rm -f conftest.o
+fi
+
+#
# Check for GLIB 2.0
-PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
-AC_SUBST(GLIB20_CFLAGS)
-AC_SUBST(GLIB20_LIBS)
+#
+AC_ARG_ENABLE(glib,
+ AS_HELP_STRING([--disable-glib],[Disable use of GLib]),
+ [case "${enableval}" in
+ yes) HAVE_GLIB=yes ;;
+ no) HAVE_GLIB=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-glib) ;;
+ esac],
+ [HAVE_GLIB=yes])
+
+if test "x$HAVE_GLIB" = "xyes"; then
+ PKG_CHECK_MODULES(GLIB20, [ glib-2.0 >= 2.4.0 ])
+ AC_SUBST(GLIB20_CFLAGS)
+ AC_SUBST(GLIB20_LIBS)
+fi
+AM_CONDITIONAL(HAVE_GLIB, test "x$HAVE_GLIB" = "xyes")
+
+#
+# Check for GTK+
+#
AC_ARG_ENABLE(gtk,
- AS_HELP_STRING([--disable-gtk],[Use GTK+ (default=yes)]),
+ AS_HELP_STRING([--disable-gtk],[Disable use of GTK+]),
[case "${enableval}" in
- yes) ENABLE_GTK=yes ;;
- no) ENABLE_GTK=no ;;
+ yes) HAVE_GTK=yes ;;
+ no) HAVE_GTK=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-gtk) ;;
esac],
- [ENABLE_GTK=yes]) dnl Default value
+ [HAVE_GTK=yes])
-if test "x$ENABLE_GTK" = "xyes"; then
+if test "x$HAVE_GTK" = "xyes"; then
# Check for GTK 2.0
PKG_CHECK_MODULES(GTK20, [ gtk+-2.0 >= 2.4.0 ])
AC_SUBST(GTK20_CFLAGS)
AC_SUBST(GLADE20_CFLAGS)
AC_SUBST(GLADE20_LIBS)
- interfacesdir="${datadir}/${PACKAGE}/interfaces/"
- AC_SUBST(interfacesdir)
-
+ interfacesdir="${datadir}/${PACKAGE}/interfaces/"
+ AC_SUBST(interfacesdir)
fi
-AM_CONDITIONAL(ENABLE_GTK, test "x$ENABLE_GTK" = "xyes")
-
-#
-# Doxygen
-#
-DX_HTML_FEATURE(ON)
-DX_CHM_FEATURE(OFF)
-DX_CHI_FEATURE(OFF)
-DX_MAN_FEATURE(OFF)
-DX_RTF_FEATURE(OFF)
-DX_XML_FEATURE(OFF)
-DX_PDF_FEATURE(OFF)
-DX_PS_FEATURE(OFF)
-DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
-
-#
-# XMLTOMAN manpage generation
-#
-AC_ARG_ENABLE(xmltoman,
- AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
-[case "${enableval}" in
- yes) xmltoman=yes ;;
- no) xmltoman=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
-esac],[xmltoman=yes])
-
-if test x$xmltoman = xyes ; then
- AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
-
- if test x$have_xmltoman = xno ; then
- AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
- xmltoman=no
- fi
-fi
-
-AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
+AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
#
# D-BUS
#
AC_ARG_ENABLE(dbus,
- AS_HELP_STRING([--disable-dbus],[Enable DBUS support (default=no)]),
+ AS_HELP_STRING([--disable-dbus],[Disable use of D-BUS]),
[case "${enableval}" in
- yes) ENABLE_DBUS=yes ;;
- no) ENABLE_DBUS=no ;;
+ yes) HAVE_DBUS=yes ;;
+ no) HAVE_DBUS=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-dbus) ;;
esac],
- [ENABLE_DBUS=yes]) dnl Default value
+ [HAVE_DBUS=yes])
+AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
-if test "x$ENABLE_DBUS" = "xyes"; then
- AC_DEFINE(ENABLE_DBUS, 1, [Whether to use DBUS or not])
- PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.30])
+if test "x$HAVE_DBUS" = "xyes"; then
+ AC_DEFINE(HAVE_DBUS, 1, [Whether we have D-BUS or not])
- AC_ARG_WITH(dbus-sys, AS_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is]))
+ PKG_CHECK_MODULES(DBUS, [ dbus-1 >= 0.30 ])
+ DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
+ AC_SUBST(DBUS_CFLAGS)
+ AC_SUBST(DBUS_LIBS)
if ! test -z "$with_dbus_sys" ; then
DBUS_SYS_DIR="$with_dbus_sys"
else
- DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
+ DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
fi
AC_SUBST(DBUS_SYS_DIR)
- DBUS_CFLAGS="$DBUS_CFLAGS -DDBUS_API_SUBJECT_TO_CHANGE"
- AC_SUBST(DBUS_CFLAGS)
- AC_SUBST(DBUS_LIBS)
fi
-
-AM_CONDITIONAL(ENABLE_DBUS, test "x$ENABLE_DBUS" = "xyes")
+AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
#
# Expat
#
-AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
+AC_ARG_ENABLE(expat,
+ AS_HELP_STRING([--disable-expat],[Disable use of Expat]),
+ [case "${enableval}" in
+ yes) HAVE_EXPAT=yes ;;
+ no) HAVE_EXPAT=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-expat) ;;
+ esac],
+ [HAVE_EXPAT=yes])
-if ! $have_expat ; then
- AC_MSG_ERROR([*** libexpat not found ***])
+if test "x$HAVE_DBUS" = "xyes"; then
+ AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
+
+ if ! $have_expat ; then
+ AC_MSG_ERROR([*** libexpat not found ***])
+ fi
fi
+AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
#
-# LibDaemon
+# libdaemon
#
-PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
-AC_SUBST(LIBDAEMON_CFLAGS)
-AC_SUBST(LIBDAEMON_LIBS)
+AC_ARG_ENABLE(libdaemon,
+ AS_HELP_STRING([--disable-libdaemon],[Disable use of libdaemon]),
+ [case "${enableval}" in
+ yes) HAVE_LIBDAEMON=yes ;;
+ no) HAVE_LIBDAEMON=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-libdaemon) ;;
+ esac],
+ [HAVE_LIBDAEMON=yes])
-# If using GCC specify some additional parameters
-if test "x$GCC" = "xyes" ; then
- CFLAGS="$CFLAGS -pipe -W -Wall -pedantic"
+if test "x$HAVE_LIBDAEMON" = "xyes"; then
+ PKG_CHECK_MODULES(LIBDAEMON, [ libdaemon >= 0.5 ])
+ AC_SUBST(LIBDAEMON_CFLAGS)
+ AC_SUBST(LIBDAEMON_LIBS)
+fi
+AM_CONDITIONAL(HAVE_LIBDAEMON, test "x$HAVE_LIBDAEMON" = "xyes")
- AC_LANG_CONFTEST([int main() {}])
- $CC -c conftest.c -std=c99 -Wno-unused-parameter $CFLAGS > /dev/null 2> /dev/null && CFLAGS="$CFLAGS -std=c99 -Wno-unused-parameter"
- rm -f conftest.o
+#
+# Python stuff
+#
+AC_ARG_ENABLE(python,
+ AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
+ [case "${enableval}" in
+ yes) HAVE_PYTHON=yes ;;
+ no) HAVE_PYTHON=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;;
+ esac],[HAVE_PYTHON=yes])
+
+if test "y$HAVE_PYTHON" = xyes ; then
+ AM_PATH_PYTHON(2.4)
+
+ if test "x$HAVE_PYTHON" = xyes ; then
+ AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(Could not find Python module pygtk)])
+ AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find Python module dbus)])
+ fi
fi
+AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = "xyes" ])
#
# Detecting the linux distro for specific things like initscripts.
AC_SUBST(avahi_runtime_dir)
AC_SUBST(avahi_socket)
+
#
-# Python stuff
+# Doxygen
#
-AC_ARG_ENABLE(python,
- AS_HELP_STRING([--disable-python], [Disable scripts that depends on python]),
- [case "${enableval}" in
- yes) use_python=yes ;;
- no) use_python=no ;;
- *) AC_MSG_ERROR([bad value ${enableval} for --disable-python]) ;;
- esac],[use_python=yes])
+DX_HTML_FEATURE(ON)
+DX_CHM_FEATURE(OFF)
+DX_CHI_FEATURE(OFF)
+DX_MAN_FEATURE(OFF)
+DX_RTF_FEATURE(OFF)
+DX_XML_FEATURE(OFF)
+DX_PDF_FEATURE(OFF)
+DX_PS_FEATURE(OFF)
+DX_INIT_DOXYGEN(avahi, doxygen.cfg, doxygen)
-HAVE_PYTHON=no
-if test "x$use_python" = xyes ; then
- AM_PATH_PYTHON(2.4, [HAVE_PYTHON=yes], [HAVE_PYTHON=no])
+#
+# XMLTOMAN manpage generation
+#
+AC_ARG_ENABLE(xmltoman,
+ AS_HELP_STRING([--disable-xmltoman],[Disable rebuilding of man pages with xmltoman]),
+[case "${enableval}" in
+ yes) xmltoman=yes ;;
+ no) xmltoman=no ;;
+ *) AC_MSG_ERROR([bad value ${enableval} for --disable-xmltoman]) ;;
+esac],[xmltoman=yes])
- if test "x$HAVE_PYTHON" = xyes ; then
- AM_CHECK_PYMOD(gtk,,,[AC_MSG_ERROR(could not find pygtk module)])
- AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(could not find python dbus module)])
+if test x$xmltoman = xyes ; then
+ AC_CHECK_PROG(have_xmltoman, xmltoman, yes, no)
+
+ if test x$have_xmltoman = xno ; then
+ AC_MSG_WARN([*** Not rebuilding man pages as xmltoman is not found ***])
+ xmltoman=no
fi
fi
-AM_CONDITIONAL(HAVE_PYTHON, [test "x$HAVE_PYTHON" = xyes ])
+AM_CONDITIONAL([USE_XMLTOMAN], [test "x$xmltoman" = xyes])
# ==========================================================================
AC_CONFIG_FILES([
dbus-1 version: `pkg-config dbus-1 --modversion`
compiler: ${CC}
cflags: ${CFLAGS}
- Enable Gtk: ${ENABLE_GTK}
- Enable DBUS: ${ENABLE_DBUS}
+ Enable GLIB: ${HAVE_GLIB}
+ Enable GTK: ${HAVE_GTK}
+ Enable D-BUS: ${HAVE_DBUS}
+ Enable Expat: ${HAVE_EXPAT}
+ Enable libdaemon: ${HAVE_LIBDAEMON}
Have Python: ${HAVE_PYTHON}
Linux Distro: ${with_distro}
User for Avahi: ${AVAHI_USER}
Group for Avahi: ${AVAHI_GROUP}
+"
- NOTE: Remember to create user ${AVAHI_USER} and group ${AVAHI_GROUP} before make install
+BUILD_DAEMON=no
+
+if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
+ BUILD_DAEMON=yes
+fi
+
+BUILD_UTILS=no
+
+if test "x$BUILD_DAEMON" = "xyes" -a "x$HAVE_DBUS" = "xyes" -a "x$HAVE_PYTHON" = "xyes" ; then
+ BUILD_UTILS=yes
+fi
+
+echo "
+ Building avahi-core yes
+ Building avahi-daemon: ${BUILD_DAEMON}
+ Building avahi-dnsconfd: ${BUILD_DAEMON}
+ Building avahi-utils: ${BUILD_UTILS}
+ Building avahi-glib: ${HAVE_GLIB}
+ Building avahi-discover-standalone ${HAVE_GTK}
"
AM_CFLAGS= \
-I$(top_srcdir)
-# GLIB 2.0
-AM_CFLAGS+=$(GLIB20_CFLAGS)
-AM_LDADD=$(GLIB20_LIBS)
+if HAVE_GLIB
+if HAVE_DBUS
-# DBUS
-AM_CFLAGS+=$(DBUS_CFLAGS)
-AM_LDADD+=$(DBUS_LIBS)
+noinst_PROGRAMS = c-plus-plus-test
-noinst_PROGRAMS = \
- c-plus-plus-test
+c_plus_plus_test_SOURCES = c-plus-plus-test.cc
-c_plus_plus_test_SOURCES = \
- c-plus-plus-test.cc
+c_plus_plus_test_CXXFLAGS = \
+ $(AM_CFLAGS) \
+ $(GLIB20_CFLAGS) \
+ $(DBUS_CFLAGS)
-c_plus_plus_test_CXXFLAGS = $(AM_CFLAGS)
-c_plus_plus_test_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la
+c_plus_plus_test_LDADD = \
+ $(AM_LDADD) \
+ ../avahi-common/libavahi-common.la \
+ ../avahi-core/libavahi-core.la \
+ ../avahi-client/libavahi-client.la \
+ ../avahi-glib/libavahi-glib.la \
+ $(GLIB20_LIBS) \
+ $(DBUS_LIBS)
+
+
+endif
+endif
EXTRA_DIST=c-plus-plus-test-gen.py
gen:
- python ./c-plus-plus-test-gen.py > c-plus-plus-test.cc
+ python ./c-plus-plus-test-gen.py avahi-common avahi-core avahi-client avahi-glib > c-plus-plus-test.cc
+
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.
-import os
+import os, sys
def print_includes(dir):
files = os.listdir("../%s" % dir)
files = filter(lambda fn: fn.endswith(".h") and not fn.startswith("."), files)
+ files.sort()
for f in files:
print "#include <%s/%s>" % (dir, f)
***/
"""
-print_includes("avahi-common")
-print_includes("avahi-core")
-print_includes("avahi-client")
+for f in sys.argv[1:]:
+ print_includes(f)
print """
int main(int argc, char*argv[]) {
USA.
***/
-#include <avahi-common/error.h>
-#include <avahi-common/strlst.h>
-#include <avahi-common/simple-watch.h>
+#include <avahi-common/address.h>
+#include <avahi-common/alternative.h>
+#include <avahi-common/cdecl.h>
+#include <avahi-common/dbus-watch-glue.h>
#include <avahi-common/dbus.h>
-#include <avahi-common/timeval.h>
-#include <avahi-common/watch.h>
-#include <avahi-common/malloc.h>
+#include <avahi-common/defs.h>
#include <avahi-common/domain.h>
-#include <avahi-common/cdecl.h>
-#include <avahi-common/alternative.h>
+#include <avahi-common/error.h>
#include <avahi-common/gccmacro.h>
-#include <avahi-common/defs.h>
-#include <avahi-common/address.h>
#include <avahi-common/llist.h>
-#include <avahi-core/query-sched.h>
-#include <avahi-core/probe-sched.h>
+#include <avahi-common/malloc.h>
+#include <avahi-common/simple-watch.h>
+#include <avahi-common/strlst.h>
+#include <avahi-common/timeval.h>
+#include <avahi-common/watch.h>
#include <avahi-core/announce.h>
-#include <avahi-core/util.h>
-#include <avahi-core/rrlist.h>
+#include <avahi-core/browse.h>
+#include <avahi-core/cache.h>
+#include <avahi-core/core.h>
#include <avahi-core/dns.h>
#include <avahi-core/fdutil.h>
-#include <avahi-core/core.h>
-#include <avahi-core/prioq.h>
-#include <avahi-core/browse.h>
+#include <avahi-core/hashmap.h>
+#include <avahi-core/iface.h>
+#include <avahi-core/log.h>
#include <avahi-core/netlink.h>
-#include <avahi-core/cache.h>
+#include <avahi-core/prioq.h>
+#include <avahi-core/probe-sched.h>
+#include <avahi-core/query-sched.h>
+#include <avahi-core/response-sched.h>
+#include <avahi-core/rr.h>
+#include <avahi-core/rrlist.h>
#include <avahi-core/server.h>
#include <avahi-core/socket.h>
-#include <avahi-core/rr.h>
-#include <avahi-core/iface.h>
-#include <avahi-core/hashmap.h>
-#include <avahi-core/log.h>
#include <avahi-core/timeeventq.h>
-#include <avahi-core/response-sched.h>
-#include <avahi-client/internal.h>
+#include <avahi-core/util.h>
#include <avahi-client/client.h>
+#include <avahi-client/internal.h>
+#include <avahi-glib/glib-malloc.h>
+#include <avahi-glib/glib-watch.h>
int main(int argc, char*argv[]) {
return 0;