AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_HEADER_STDC
-AC_CHECK_HEADERS(bstring.h errno.h fcntl.h ieeefp.h math.h)
+AC_CHECK_HEADERS(bstring.h)
+AC_CHECK_HEADER(dns_sd.h,
+ [AC_CHECK_LIB(dns_sd,
+ DNSServiceRegister,
+ [AC_DEFINE(HAVE_DNSREGISTRATION, 1,
+ [Use Rendezvous/DNS-SD registration])])])
+case "$ac_cv_lib_dns_sd_DNSServiceRegister" in
+ yes) LIBS="-ldns_sd $LIBS" ;;
+esac
+AC_CHECK_HEADERS(errno.h fcntl.h ieeefp.h math.h)
+
# HMS: Lame, but fast.
if test -f /etc/redhat-release
then
# define SIGDIE4 SIGTERM
#endif /* SYS_WINNT */
+#ifdef HAVE_DNSREGISTRATION
+#include <dns_sd.h>
+DNSServiceRef mdns;
+#endif
+
/*
* Scheduling priority we run at
*/
get_systime(&now);
SRANDOM((int)(now.l_i * now.l_uf));
+#ifdef HAVE_DNSREGISTRATION
+ msyslog(LOG_INFO, "Attemping to register mDNS\n");
+ if ( DNSServiceRegister (&mdns, 0, 0, NULL, "_ntp._udp", NULL, NULL, htons(NTP_PORT), 0, NULL, NULL, NULL) != kDNSServiceErr_NoError ) {
+ msyslog(LOG_ERR, "Unable to register mDNS\n");
+ }
+#endif
+
#if !defined(VMS)
# ifndef NODETACH
/*
{
msyslog(LOG_NOTICE, "ntpd exiting on signal %d", sig);
+#ifdef HAVE_DNSREGISTRATION
+ if (mdns != NULL)
+ DNSServiceRefDeallocate(mdns);
+#endif
switch (sig)
{