From f6df0c8106da1c757a6d4877ce5cc5d79758cc71 Mon Sep 17 00:00:00 2001
From: yanmorin <yanmorin>
Date: Tue, 6 Sep 2005 18:00:53 +0000
Subject: [PATCH] Zeroconf integration (first part)

---
 AUTHORS      |  6 +++++-
 CHANGES      |  2 ++
 COPYING      |  2 +-
 ChangeLog    |  1 +
 DEPS         |  3 ++-
 config.h.in  |  3 +++
 configure.ac | 39 ++++++++++++++++++++++++++++++++++++++-
 7 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 9c394b8203..5712f244b7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -12,6 +12,10 @@ Sherry Yang (syangs04 at yahoo dot com)
 Imran Akbar (imr at stanford dot edu)
 	- Working on Win32 port
 
+Yan Morin
+(yan dot morin at savoifairelinux dot com)
+	- zeroconf integration
+
 
 Contributors:
-Mikael Magnusson
\ No newline at end of file
+Mikael Magnusson
diff --git a/CHANGES b/CHANGES
index fce0b265e8..d88f10f9fc 100644
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,8 @@ SFLphone (0.4.1-pre2) / now
           (thanks to Mikael Magnusson)
 	* We actualy check if portaudio and eXosip2 libs
           are installed
+	* zeroconf integration start
+
 
 SFLphone (0.4.1-pre1) / 2005-08-11
 	* Use libeXosip2
diff --git a/COPYING b/COPYING
index 3852420519..8648c8a0ea 100644
--- a/COPYING
+++ b/COPYING
@@ -1,5 +1,5 @@
 All of the code (except when other copyright is specified) is 
-(c) 2004 Savoir-faire Linux inc.
+(c) 2004-2005 Savoir-faire Linux inc.
 and released under the terms of the venerable
 
 		    GNU GENERAL PUBLIC LICENSE
diff --git a/ChangeLog b/ChangeLog
index 4c3114ee33..c77713e882 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@ Jean-Philippe Barette-LaPierre (30 April 2005) version 0.4.1-pre1
   (thanks to Mikael Magnusson)
 - We actualy check if portaudio and eXosip2 libs
   are installed. (thanks to Mikael Magnusson)
+- zeroconf integration start
 
 Jean-Philippe Barette-LaPierre (30 April 2005) version 0.4.1-pre1
 - Now, we send a final response to reINVITEs
diff --git a/DEPS b/DEPS
index 32fe7cbef7..9a47469a39 100644
--- a/DEPS
+++ b/DEPS
@@ -2,4 +2,5 @@ PortAudio: http://portaudio.com/archives/pa_snapshot_v19.tar.gz
 Common C++ 2 1.3.6: http://sourceforge.net/projects/cplusplus/
 ccRTP 1.3.0: http://sourceforge.net/projects/cplusplus/
 libosip 2.2.1: http://savannah.gnu.org/projects/osip/
-libeXosip2-1.9.1-pre15: http://www.antisip.com/download/
\ No newline at end of file
+libeXosip2-1.9.1-pre15: http://www.antisip.com/download/
+mDNSResponder87: http://developer.apple.com/darwin/projects/bonjour/
diff --git a/config.h.in b/config.h.in
index af06bd0e0a..f02cc79fbe 100644
--- a/config.h.in
+++ b/config.h.in
@@ -15,6 +15,9 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define if dns-sd is available */
+#undef HAVE_DNSSD
+
 /* Define to 1 if you have the <eXosip2/eXosip.h> header file. */
 #undef HAVE_EXOSIP2_EXOSIP_H
 
diff --git a/configure.ac b/configure.ac
index 8df70437c9..a902031be5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,7 +127,43 @@ AC_SUBST(portaudio_LIB)
 
 AC_SUBST(SFLPHONE_CXXFLAGS)
 AC_SUBST(SFLPHONE_LIBS)
-	
+
+AC_ARG_ENABLE(zeroconf, [  --disable-zeroconf	don't require libdns_sd (browsing and publishing DNS-SD services will not be possible) ],  with_zeroconf=$enableval, with_zeroconf=yes)
+if test "$with_zeroconf" = "yes"; then
+AC_MSG_CHECKING(for DNS-SD support)
+save_dnssdtest_LIBS="$LIBS"
+save_dnssdtest_LDFLAGS="$LDFLAGS"
+save_dnssdtest_CPPFLAGS="$CPPFLAGS"
+LDFLAGS="$all_libraries $LDFLAGS"
+CPPFLAGS="$CPPFLAGS $all_includes"
+case $host_os in
+  darwin*) LIBS="" ;;
+  *) LIBS="-ldns_sd" ;;
+esac
+have_libdns_sd="no"
+AC_TRY_LINK(	[
+			#include <dns_sd.h>
+		],[
+			DNSServiceRefDeallocate( (DNSServiceRef) 0);
+			TXTRecordDeallocate( (TXTRecordRef*) 0);
+		],[
+			AC_DEFINE(HAVE_DNSSD,1,[Define if dns-sd is available])
+			case $host_os in
+				darwin*) LIB_DNSSD="" ;;
+				*) LIB_DNSSD="-ldns_sd" ;;
+			esac
+			have_libdns_sd="yes"
+			AC_MSG_RESULT(yes)
+		],[
+			AC_MSG_RESULT(no)
+                        LIB_DNSSD=""
+])
+CPPFLAGS=$save_dnssdtest_CPPFLAGS
+LDFLAGS=$save_dnssdtest_LDFLAGS
+LIBS=$save_dnssdtest_LIBS
+fi
+AC_SUBST(LIB_DNSSD)
+AM_CONDITIONAL(USE_ZEROCONF, test "$have_libdns_sd" = "yes")	
 
 dnl AC_CONFIG_FILES(
 AC_OUTPUT(
@@ -143,6 +179,7 @@ src/audio/pacpp/source/Makefile \
 src/audio/pacpp/source/portaudiocpp/Makefile \
 src/gui/Makefile \
 src/gui/qt/Makefile \
+src/zeroconf/Makefile
 utilspp/Makefile \
 utilspp/functor/Makefile \
 utilspp/singleton/Makefile \
-- 
GitLab