Index: avahi-daemon/static-services.c
===================================================================
--- avahi-daemon/static-services.c	(revision 79770)
+++ avahi-daemon/static-services.c	(revision 79771)
@@ -31,7 +31,13 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+#ifdef USE_EXPAT_H
 #include <expat.h>
+#endif /* USE_EXPAT_H */
+
+#ifdef USE_BSDXML_H
+#include <bsdxml.h>
+#endif /* USE_BSDXML_H */
 
 #include <avahi-common/llist.h>
 #include <avahi-common/malloc.h>
Index: avahi-daemon/Makefile.am
===================================================================
--- avahi-daemon/Makefile.am	(revision 79770)
+++ avahi-daemon/Makefile.am	(revision 79771)
@@ -23,7 +23,7 @@
 AM_CFLAGS+='-DDEBUG_TRAP=__asm__("int $$3")'
 
 if HAVE_LIBDAEMON
-if HAVE_EXPAT
+if HAVE_XML
 
 pkgsysconfdir=$(sysconfdir)/avahi
 servicedir=$(pkgsysconfdir)/services
@@ -56,8 +56,8 @@
 	../avahi-client/check-nss.c \
 	inotify-nosys.h
 
-avahi_daemon_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS)
-avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la $(LIBDAEMON_LIBS) -lexpat
+avahi_daemon_CFLAGS = $(AM_CFLAGS) $(LIBDAEMON_CFLAGS) $(XML_CFLAGS)
+avahi_daemon_LDADD = $(AM_LDADD) ../avahi-common/libavahi-common.la ../avahi-core/libavahi-core.la $(LIBDAEMON_LIBS) $(XML_LIBS)
 
 ini_file_parser_test_SOURCES = \
 	ini-file-parser.c ini-file-parser.h \
Index: configure.ac
===================================================================
--- configure.ac	(revision 79770)
+++ configure.ac	(revision 79771)
@@ -590,24 +590,56 @@
 #
 # Expat
 #
-AC_ARG_ENABLE(expat,
-        AS_HELP_STRING([--disable-expat],[Disable use of Expat]),
-        [case "${enableval}" in
-                yes) HAVE_EXPAT=yes ;;
-                no)  HAVE_EXPAT=no ;;
-                *) AC_MSG_ERROR(bad value ${enableval} for --enable-expat) ;;
-        esac],
-        [HAVE_EXPAT=yes]) 
+AC_ARG_WITH(xml, AS_HELP_STRING([--with-xml=[expat/bsdxml/none]],[XML library to use]))
+use_expat=false
+use_bsdxml=false
 
-if test "x$HAVE_EXPAT" = "xyes" ; then
-    AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
+# See what we have
+AC_CHECK_LIB(expat, XML_ParserCreate, [ AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false) ], have_expat=false)
+AC_CHECK_LIB(bsdxml, XML_ParserCreate, [ AC_CHECK_HEADERS(bsdxml.h, have_bsdxml=true, have_bsdxml=false) ], have_bsdxml=false)
 
-    if ! $have_expat ; then
-        AC_MSG_ERROR([*** libexpat not found ***])
-    fi
+if test "x$with_xml" = "xnone"; then
+elif test "x$with_xml" = "xexpat"; then
+	use_expat=true
+	if ! $have_expat ; then
+		AC_MSG_ERROR([*** libexpat requested, but not found ***])
+	fi
+elif test "x$with_xml" = "xbsdxml"; then
+	use_bsdxml=true
+	if ! $have_bsdxml ; then
+		AC_MSG_ERROR([*** libbsdxml requested, but not found ***])
+	fi
+elif test "x$with_xml" != "x"; then
+	AC_MSG_ERROR([*** unknown with-xml option ***])
+else
+	if $have_expat ; then
+		use_expat=true
+	elif $have_bsdxml ; then
+		use_bsdxml=true
+	else
+		AC_MSG_ERROR([*** neither libexpat not libbsdxml could be found ***])
+	fi
 fi
-AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
 
+if $use_expat; then
+	with_xml=expat
+	XML_CLAGS=-DUSE_EXPAT_H
+	XML_LIBS=-lexpat
+fi
+if $use_bsdxml; then
+	with_xml=bsdxml
+	XML_CFLAGS=-DUSE_BSDXML_H
+	XML_LIBS=-lbsdxml
+fi
+AC_SUBST(XML_LIBS)
+AC_SUBST(XML_CFLAGS)
+
+if $use_expat || $use_bsdxml; then
+	HAVE_XML=yes
+fi
+
+AM_CONDITIONAL(HAVE_XML, test "x$HAVE_XML" = "xyes")
+
 #
 # GDBM
 #
@@ -1028,7 +1060,7 @@
     Enable GLIB:                               ${HAVE_GLIB}
     Enable GTK:                                ${HAVE_GTK}
     Enable D-Bus:                              ${HAVE_DBUS}
-    Enable Expat:                              ${HAVE_EXPAT}
+    With XML:                                  ${with_xml}
     Enable GDBM:                               ${HAVE_GDBM}
     Enable DBM:                                ${HAVE_DBM}
     Enable libdaemon:                          ${HAVE_LIBDAEMON}
@@ -1050,9 +1082,9 @@
     Enable stack-smashing protection:          ${enable_ssp}
 "
 
-BUILD_DAEMON="no   (You need libdaemon and expat!)"
+BUILD_DAEMON="no   (You need libdaemon and expat/bsdxml!)"
 
-if test "x$HAVE_EXPAT" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
+if test "x$HAVE_XML" = "xyes" -a "x$HAVE_LIBDAEMON" = "xyes" ; then
     BUILD_DAEMON=yes
 fi
 
Index: avahi-dnsconfd/Makefile.am
===================================================================
--- avahi-dnsconfd/Makefile.am	(revision 79770)
+++ avahi-dnsconfd/Makefile.am	(revision 79771)
@@ -17,7 +17,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 # USA.
 
-if HAVE_EXPAT
+if HAVE_XML
 if HAVE_LIBDAEMON
 
 pkgsysconfdir=$(sysconfdir)/avahi
