1 dnl Check for optional Zeroconf support
3 AC_DEFUN([NETATALK_ZEROCONF], [
10 AC_ARG_ENABLE(zeroconf,
11 [ --enable-zeroconf[[=DIR]] enable Zeroconf support [[auto]]],
12 [zeroconf=$enableval],
16 dnl make sure atalk_libname is defined beforehand
17 [[ -n "$atalk_libname" ]] || AC_MSG_ERROR([internal error, atalk_libname undefined])
19 if test "x$zeroconf" != "xno"; then
21 savedcppflags="$CPPFLAGS"
22 savedldflags="$LDFLAGS"
24 if test "x$zeroconf" = "xyes" -o "x$zeroconf" = "xtry"; then
27 zeroconf_dir="$zeroconf"
30 # mDNS support using Avahi
31 AC_CHECK_HEADER(avahi-client/client.h,
32 [AC_CHECK_LIB(avahi-client,
34 [AC_DEFINE(USE_ZEROCONF, 1,
35 [Use DNS-SD registration])])])
36 case "$ac_cv_lib_avahi_client_avahi_client_new" in
38 PKG_CHECK_MODULES(AVAHI, [ avahi-client >= 0.6 ])
39 PKG_CHECK_MODULES(AVAHI_TPOLL, [ avahi-client >= 0.6.4 ],
40 [AC_DEFINE(HAVE_AVAHI_THREADED_POLL, 1, [Uses Avahis threaded poll implementation])],
41 [AC_MSG_WARN(This Avahi implementation is not supporting threaded poll objects. Maybe this is not what you want.)])
42 ZEROCONF_LIBS="$AVAHI_LIBS"
43 ZEROCONF_CFLAGS="$AVAHI_CFLAGS"
44 AC_DEFINE(HAVE_AVAHI, 1, [Use Avahi/DNS-SD registration])
49 CPPFLAGS="$savedcppflags"
50 LDFLAGS="$savedldflags"
53 netatalk_cv_zeroconf=no
54 AC_MSG_CHECKING([whether to enable Zerconf support])
55 if test "x$found_zeroconf" = "xyes"; then
57 AC_DEFINE(USE_ZEROCONF, 1, [Define to enable Zeroconf support])
58 netatalk_cv_zeroconf=yes
61 if test "x$zeroconf" != "xno" -a "x$zeroconf" != "xtry"; then
62 AC_MSG_ERROR([Zeroconf installation not found])
66 LIB_REMOVE_USR_LIB(ZEROCONF_LIBS)
67 CFLAGS_REMOVE_USR_INCLUDE(ZEROCONF_CFLAGS)
68 AC_SUBST(ZEROCONF_LIBS)
69 AC_SUBST(ZEROCONF_CFLAGS)