summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-22 18:17:04 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-22 18:17:04 (GMT)
commitc4660f404c9a0dbf1c00a20baacfc738d93eaff5 (patch)
tree33d8532adaa535786f7e7910e334118f927f204f
parent3b7107fb14663c4e83d4829c6ddec7af84c796bb (diff)
downloadswift-c4660f404c9a0dbf1c00a20baacfc738d93eaff5.zip
swift-c4660f404c9a0dbf1c00a20baacfc738d93eaff5.tar.bz2
Add Avahi detection in configure script.
-rw-r--r--Makefile.config.in2
-rw-r--r--Swiften/LinkLocal/AvahiDNSSDService.cpp4
-rw-r--r--autoconf/ax_avahi.m428
-rw-r--r--configure.in19
4 files changed, 50 insertions, 3 deletions
diff --git a/Makefile.config.in b/Makefile.config.in
index f9f3252..848f223 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -22,7 +22,7 @@ HAVE_EXPAT=@HAVE_EXPAT@
USE_BUNDLED_EXPAT=@USE_BUNDLED_EXPAT@
HAVE_LIBXML=@CONFIG_HAVE_LIBXML@
HAVE_OPENSSL=@CONFIG_HAVE_OPENSSL@
-HAVE_AVAHI=@CONFIG_HAVE_AVAHI@
+HAVE_AVAHI=@HAVE_AVAHI@
WIN32=@CONFIG_WIN32@
MACOSX=@CONFIG_MACOSX@
BUILD_SWIFT=@BUILD_SWIFT@
diff --git a/Swiften/LinkLocal/AvahiDNSSDService.cpp b/Swiften/LinkLocal/AvahiDNSSDService.cpp
index 62ea172..1dd5c28 100644
--- a/Swiften/LinkLocal/AvahiDNSSDService.cpp
+++ b/Swiften/LinkLocal/AvahiDNSSDService.cpp
@@ -23,7 +23,7 @@ void AvahiDNSSDService::start() {
static_cast<AvahiClientFlags>(0), NULL, this, &error); // TODO
if (!client) {
// TODO
- std::cerr << "Error 1" << std::endl;
+ std::cerr << "Avahi Error: " << avahi_strerror(error) << std::endl;
return;
}
@@ -33,7 +33,7 @@ void AvahiDNSSDService::start() {
handleServiceDiscoveredGlobal, this);
if (!serviceBrowser) {
// TODO
- std::cerr << "Error 2" << std::endl;
+ std::cerr << "Avahi Error: " << avahi_strerror(error) << std::endl;
return;
}
diff --git a/autoconf/ax_avahi.m4 b/autoconf/ax_avahi.m4
new file mode 100644
index 0000000..1ea3233
--- /dev/null
+++ b/autoconf/ax_avahi.m4
@@ -0,0 +1,28 @@
+# Author: Remko Tronçon
+
+AC_DEFUN([AX_AVAHI],
+[
+ AC_ARG_WITH(
+ [avahi],
+ AC_HELP_STRING([--with-avahi=@<:@ARG@:>@],[Path to Avahi installation]),
+ [
+ WITH_AVAHI="$withval"
+ if test "$withval" != "no" -a "$withval" != "yes"; then
+ AVAHI_CPPFLAGS="-I$withval/include"
+ AVAHI_LDFLAGS="-L$withval/lib"
+ CPPFLAGS="$CPPFLAGS $AVAHI_CPPFLAGS"
+ LDFLAGS="$LDFLAGS $AVAHI_LDFLAGS"
+ fi
+ ],
+ [WITH_AVAHI="yes"])
+
+ if test "$WITH_AVAHI" != "no"; then
+ AC_CHECK_HEADER(avahi-client/client.h,
+ [
+ HAVE_AVAHI=yes
+ # TODO: Check if this lib exists
+ AVAHI_LIBS="-lavahi-client"
+ ],
+ [])
+ fi
+])
diff --git a/configure.in b/configure.in
index 095c51a..9025855 100644
--- a/configure.in
+++ b/configure.in
@@ -194,6 +194,25 @@ fi
# Resolv
AC_CHECK_LIB(resolv, inet_aton)
+# Avahi
+case $host in
+ *-*-cygwin*)
+ ;;
+ *-mingw32*)
+ ;;
+ *-*-darwin*)
+ ;;
+ *)
+ AX_AVAHI()
+ if test "$HAVE_AVAHI" = yes; then
+ CONFIG_CXXFLAGS="$CONFIG_CXXFLAGS $AVAHI_CPPFLAGS"
+ CONFIG_LDFLAGS="$CONFIG_LDFLAGS $AVAHI_LDFLAGS"
+ CONFIG_LIBS="$AVAHI_LIBS $CONFIG_LIBS"
+ AC_DEFINE(HAVE_AVAHI)
+ fi
+esac
+
+
################################################################################
# Build configuration summary
################################################################################