]> git.meshlink.io Git - catta/commitdiff
Allow compilation against bsdxml instead of Expat. Patch from zml. (Closes #159)
authorLennart Poettering <lennart@poettering.net>
Sun, 16 Dec 2007 20:23:22 +0000 (20:23 +0000)
committerLennart Poettering <lennart@poettering.net>
Sun, 16 Dec 2007 20:23:22 +0000 (20:23 +0000)
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1585 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe

avahi-daemon/Makefile.am
avahi-daemon/static-services.c
avahi-dnsconfd/Makefile.am
configure.ac

index 2bb2325f65d7da41ab3a252d8df767723d6e6664..622b4de6f8f9739b42b164be69ac7b0d023f826f 100644 (file)
@@ -23,7 +23,7 @@ AM_CFLAGS=-I$(top_srcdir)
 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_daemon_SOURCES = \
        ../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 b9a852cc362b0e685ba8d075c4d46d52c95b8296..e123a217e22779e33df6430a1d0d996eaa02e620 100644 (file)
 #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 18b3adf70fa03cff3ce87b464ebeebd6c2209924..d35873480362fa9dd60edb83b71d3b079b0d3b6f 100644 (file)
@@ -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
index 43b1f657af2ff8a51bcc3161538ce4e5b1e6da1d..7dc41700385761214e67eaf201b2ae0fb1bab455 100644 (file)
@@ -612,23 +612,55 @@ AM_CONDITIONAL(HAVE_DBUS, test "x$HAVE_DBUS" = "xyes")
 #
 # 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
+
+# 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 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
 
-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)
+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 ! $have_expat ; then
-        AC_MSG_ERROR([*** libexpat not found ***])
-    fi
+if $use_expat || $use_bsdxml; then
+       HAVE_XML=yes
 fi
-AM_CONDITIONAL(HAVE_EXPAT, test "x$HAVE_EXPAT" = "xyes")
+
+AM_CONDITIONAL(HAVE_XML, test "x$HAVE_XML" = "xyes")
 
 #
 # GDBM
@@ -1053,7 +1085,7 @@ echo "
     Enable GLIB GObject:                       ${HAVE_GOBJECT}
     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}
@@ -1075,9 +1107,9 @@ echo "
     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