*** ./configure.in.orig	Sat Oct  7 16:53:14 2006
--- ./configure.in	Sat Oct  7 16:53:33 2006
***************
*** 800,806 ****
  fi
  
  if test "$with_bonjour" = yes ; then
!   AC_CHECK_HEADER(DNSServiceDiscovery/DNSServiceDiscovery.h, [], [AC_MSG_ERROR([header file <DNSServiceDiscovery/DNSServiceDiscovery.h> is required for Bonjour])])
  fi
  
  
--- 800,806 ----
  fi
  
  if test "$with_bonjour" = yes ; then
!   AC_CHECK_HEADER(dns_sd.h, [], [AC_MSG_ERROR([header file <dns_sd.h> is required for Bonjour])])
  fi
  
  
*** ./src/backend/postmaster/postmaster.c.orig	Sat Oct  7 16:51:10 2006
--- ./src/backend/postmaster/postmaster.c	Sat Oct  7 16:25:12 2006
***************
*** 89,95 ****
  #endif
  
  #ifdef USE_BONJOUR
! #include <DNSServiceDiscovery/DNSServiceDiscovery.h>
  #endif
  
  #include "access/transam.h"
--- 89,95 ----
  #endif
  
  #ifdef USE_BONJOUR
! #include <dns_sd.h>
  #endif
  
  #include "access/transam.h"
***************
*** 232,246 ****
  extern int	optreset;
  #endif
  
  /*
   * postmaster.c - function prototypes
   */
  static void checkDataDir(void);
  
- #ifdef USE_BONJOUR
- static void reg_reply(DNSServiceRegistrationReplyErrorType errorCode,
- 		  void *context);
- #endif
  static void pmdaemonize(void);
  static Port *ConnCreate(int serverFd);
  static void ConnFree(Port *port);
--- 232,246 ----
  extern int	optreset;
  #endif
  
+ #ifdef USE_BONJOUR
+ DNSServiceRef sdRef;
+ #endif
+ 
  /*
   * postmaster.c - function prototypes
   */
  static void checkDataDir(void);
  
  static void pmdaemonize(void);
  static Port *ConnCreate(int serverFd);
  static void ConnFree(Port *port);
***************
*** 777,789 ****
  	/* Register for Bonjour only if we opened TCP socket(s) */
  	if (ListenSocket[0] != -1 && bonjour_name != NULL)
  	{
! 		DNSServiceRegistrationCreate(bonjour_name,
! 									 "_postgresql._tcp.",
! 									 "",
! 									 htons(PostPortNumber),
! 									 "",
! 									 (DNSServiceRegistrationReply) reg_reply,
! 									 NULL);
  	}
  #endif
  
--- 777,803 ----
  	/* Register for Bonjour only if we opened TCP socket(s) */
  	if (ListenSocket[0] != -1 && bonjour_name != NULL)
  	{
! 		/*
! 		 * An empty string as the Bonjour service name means
! 		 * to use the default, the computer name, which is
! 		 * specified by passing NULL to DNSServiceRegister().
! 		 */
! 	    char *name = bonjour_name;
! 	    if (strlen(bonjour_name) == 0)
! 	    	name = NULL;
! 		if (DNSServiceRegister(&sdRef,
! 							   0,
! 							   0,
! 							   name,
! 							   "_postgresql._tcp.",
! 							   NULL,
! 							   NULL,
! 							   htons(PostPortNumber),
! 							   0,
! 							   NULL,
! 							   NULL,
! 							   NULL) == kDNSServiceErr_NoError)
! 			DNSServiceProcessResult(sdRef);
  	}
  #endif
  
***************
*** 1043,1061 ****
  }
  
  
- #ifdef USE_BONJOUR
- 
- /*
-  * empty callback function for DNSServiceRegistrationCreate()
-  */
- static void
- reg_reply(DNSServiceRegistrationReplyErrorType errorCode, void *context)
- {
- 
- }
- #endif   /* USE_BONJOUR */
- 
- 
  /*
   * Fork away from the controlling terminal (-S option)
   */
--- 1057,1062 ----
