diff -ur xrootd.orig/configure.ac xrootd/configure.ac
--- xrootd.orig/configure.ac 2010-12-09 16:24:21.000000000 +0100
+++ xrootd/configure.ac 2010-12-16 06:08:16.078935003 +0100
@@ -1085,6 +1085,70 @@
AM_CONDITIONAL(ENABLE_SECSSL,test x"$activate_secssl" = xyes -o x"$activate_secssl" = xdefault_yes)
+###########################################
+# bonjour checks
+ACX_LIBOPTION(bonjour, [bonjour support], yes)
+
+if test x"$activate_bonjour" = xyes -o x"$activate_bonjour" = xdefault_yes; then
+ if test x"$acx_bonjour_incdir" != x; then
+ searchpath=$acx_bonjour_incdir
+ else
+ searchpath="$std_inc_path"
+ fi
+
+ ACX_LOCATEFILE([dns_sd.h],[$searchpath],
+ [BONJOUR_INCDIR="-I$acx_founddir"
+ AC_MSG_NOTICE([bonjour header dir set to: $dir ]) ],
+ [activate_bonjour=no]
+ )
+
+ CPPFLAGS_BUP="$CPPFLAGS"
+ LDFLAGS_BUP=$LDFLAGS
+
+ CPPFLAGS="$BONJOUR_INCDIR $CPPFLAGS"
+
+ AC_CHECK_HEADER([dns_sd.h],
+ [],[activate_bonjour=no]
+ )
+
+ LDFLAGS="$BONJOUR_LIBDIR $LDFLAGS"
+ AC_CHECK_LIB([dns_sd],[TXTRecordCreate],
+ [:],[activate_bonjour=no],[]
+ )
+
+ CPPFLAGS="$CPPFLAGS_BUP"
+ LDFLAGS=$LDFLAGS_BUP
+
+ AC_SUBST(BONJOUR_INCDIR)
+ AC_SUBST(BONJOUR_LIBDIR)
+ AC_SUBST(BONJOUR_LIBS)
+fi
+
+rm -f src/XrdOuc/XrdOucFactoryBonjour.hh
+rm -f src/XrdOuc/XrdOucFactoryBonjour.cc
+if test x"$activate_bonjour" = xyes -o x"$activate_bonjour" = xdefault_yes; then
+case "$target_os" in
+ linux*)
+ ln -s XrdOucAvahiBonjour.hh src/XrdOuc/XrdOucFactoryBonjour.hh
+ ln -s XrdOucAvahiBonjour.cc src/XrdOuc/XrdOucFactoryBonjour.cc
+ BONJOUR_LIBS="-ldns_sd -lavahi-client -lavahi-common"
+ ;;
+ darwin*)
+ ln -s XrdOucFactoryBonjour.hh src/XrdOuc/XrdOucFactoryBonjour.hh
+ ln -s XrdOucFactoryBonjour.cc src/XrdOuc/XrdOucFactoryBonjour.cc
+ BONJOUR_LIBS="-ldns_sd"
+ ;;
+ *)
+ if test "x$activate_bonjour" = "xyes" ; then
+ echo "Sorry, the Bonjour/Avahi interface currently supported only for Linux/MacOsX - disabling ... (target: $target_os)"
+ fi
+ activate_bonjour=no
+ ;;
+esac
+fi
+
+AM_CONDITIONAL(ENABLE_BONJOUR,test x"$activate_bonjour" = xyes -o x"$activate_bonjour" = xdefault_yes)
+
# Record the extension of dynamic libraries on this platform
LT_SYS_MODULE_EXT
diff -ur xrootd.orig/src/Xrd/Makefile.am xrootd/src/Xrd/Makefile.am
--- xrootd.orig/src/Xrd/Makefile.am 2010-12-16 06:00:10.348934620 +0100
+++ xrootd/src/Xrd/Makefile.am 2010-12-16 06:00:49.273934990 +0100
@@ -47,7 +47,8 @@
XrdScheduler.cc XrdScheduler.hh XrdJob.hh \
XrdStats.cc XrdStats.hh \
XrdTrace.hh
-libXrd_la_LIBADD = ../XrdNet/libXrdNet.la \
+libXrd_la_LIBADD = ../XrdOuc/libXrdOucBonjour.la \
+ ../XrdNet/libXrdNet.la \
../XrdOuc/libXrdOuc.la \
../XrdNetUtil/libXrdNetUtil.la \
../XrdSys/libXrdSys.la \
diff -ur xrootd.orig/src/XrdOuc/Makefile.am xrootd/src/XrdOuc/Makefile.am
--- xrootd.orig/src/XrdOuc/Makefile.am 2010-12-16 06:00:10.470935000 +0100
+++ xrootd/src/XrdOuc/Makefile.am 2010-12-16 06:00:49.322935001 +0100
@@ -8,7 +8,7 @@
## Checked in by $Author$
#######################################################################
-AM_CPPFLAGS = -I$(top_srcdir)/src
+AM_CPPFLAGS = -I$(top_srcdir)/src $(BONJOUR_INCDIR)
#############################################################################
## extra installation directory definitions
@@ -18,7 +18,7 @@
#############################################################################
## deliverables (to be built / installed)
-xrootdoucinc_HEADERS = \
+OUCHEADERS = \
XrdOuca2x.hh XrdOucChain.hh XrdOucDLlist.hh \
XrdOucEnv.hh XrdOucErrInfo.hh XrdOucExport.hh \
XrdOucHash.hh XrdOucHash.icc XrdOucLock.hh \
@@ -30,8 +30,18 @@
XrdOucPup.hh XrdOucCRC.hh XrdOucArgs.hh \
XrdOucNSWalk.hh XrdOucSxeq.hh
+if ENABLE_BONJOUR
+xrootdoucinc_HEADERS = $(OUCHEADERS) XrdOucBonjour.hh
+nodist_xrootdoucinc_HEADERS = XrdOucFactoryBonjour.hh
+else
+xrootdoucinc_HEADERS = $(OUCHEADERS)
+nodist_xrootdoucinc_HEADERS =
+endif
+
lib_LTLIBRARIES = libXrdOuc.la
+noinst_LTLIBRARIES = libXrdOucBonjour.la
+
#############################################################################
# Build rules
@@ -61,6 +71,19 @@
../XrdSys/libXrdSys.la \
$(LIBPTHREAD) $(SEM_LIBRT) $(LIBNSL)
+if ENABLE_BONJOUR
+libXrdOucBonjour_la_SOURCES = XrdOucBonjour.cc
+nodist_libXrdOucBonjour_la_SOURCES = XrdOucFactoryBonjour.cc
+else
+libXrdOucBonjour_la_SOURCES =
+nodist_libXrdOucBonjour_la_SOURCES =
+endif
+libXrdOucBonjour_la_LIBADD = $(BONJOUR_LIBDIR) $(BONJOUR_LIBS)
+
+# sources not named in rules that still need to get rolled into the
+# distribution tarball
+EXTRA_DIST = XrdOucAppleBonjour.cc XrdOucAppleBonjour.hh \
+ XrdOucAvahiBonjour.cc XrdOucAvahiBonjour.hh
# TODO: again as in classic? REFAC libXrdOuc_la_CXXFLAGS = -prefer-pic
# TODO: again as in classic? REFAC libXrdOuc_la_LDFLAGS = -static