1 dnl Check for optional Zeroconf support
3 AC_DEFUN([NETATALK_ZEROCONF], [
9 AC_ARG_ENABLE(zeroconf,
10 [ --enable-zeroconf[[=DIR]] enable Zeroconf support [[auto]]],
11 [zeroconf=$enableval],
15 dnl make sure atalk_libname is defined beforehand
16 [[ -n "$atalk_libname" ]] || AC_MSG_ERROR([internal error, atalk_libname undefined])
18 if test "x$zeroconf" != "xno"; then
19 savedcppflags="$CPPFLAGS"
20 savedldflags="$LDFLAGS"
22 if test "x$zeroconf" = "xyes" -o "x$zeroconf" = "xtry"; then
25 zeroconf_dir="$zeroconf"
28 # mDNS support using mDNSResponder
34 AC_DEFINE(USE_ZEROCONF, 1, [Use DNS-SD registration]))
37 if test "$ac_cv_lib_dns_sd_DNSServiceRegister" = yes; then
38 ZEROCONF_LIBS="-ldns_sd"
39 AC_DEFINE(HAVE_MDNS, 1, [Use mDNSRespnder/DNS-SD registration])
43 # mDNS support using Avahi
44 if test x"$found_zeroconf" != x"yes" ; then
46 avahi-client/client.h,
50 AC_DEFINE(USE_ZEROCONF, 1, [Use DNS-SD registration]))
53 case "$ac_cv_lib_avahi_client_avahi_client_new" in
55 PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6 ])
56 PKG_CHECK_MODULES(AVAHI_TPOLL, [ avahi-client >= 0.6.4 ],
57 [AC_DEFINE(HAVE_AVAHI_THREADED_POLL, 1, [Uses Avahis threaded poll implementation])],
58 [AC_MSG_WARN(This Avahi implementation is not supporting threaded poll objects. Maybe this is not what you want.)])
59 ZEROCONF_LIBS="$AVAHI_LIBS"
60 ZEROCONF_CFLAGS="$AVAHI_CFLAGS"
61 AC_DEFINE(HAVE_AVAHI, 1, [Use Avahi/DNS-SD registration])
65 CPPFLAGS="$savedcppflags"
66 LDFLAGS="$savedldflags"
70 netatalk_cv_zeroconf=no
71 AC_MSG_CHECKING([whether to enable Zerconf support])
72 if test "x$found_zeroconf" = "xyes"; then
74 AC_DEFINE(USE_ZEROCONF, 1, [Define to enable Zeroconf support])
75 netatalk_cv_zeroconf=yes
78 if test "x$zeroconf" != "xno" -a "x$zeroconf" != "xtry"; then
79 AC_MSG_ERROR([Zeroconf installation not found])
83 LIB_REMOVE_USR_LIB(ZEROCONF_LIBS)
84 CFLAGS_REMOVE_USR_INCLUDE(ZEROCONF_CFLAGS)
85 AC_SUBST(ZEROCONF_LIBS)
86 AC_SUBST(ZEROCONF_CFLAGS)