From c4660f404c9a0dbf1c00a20baacfc738d93eaff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Wed, 22 Jul 2009 20:17:04 +0200 Subject: Add Avahi detection in configure script. 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(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 ################################################################################ -- cgit v0.10.2-6-g49f6