From 0cbfefdb155c5b79f63ebb19196e783c4cb48afc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 16 Dec 2007 20:23:22 +0000 Subject: Allow compilation against bsdxml instead of Expat. Patch from zml. (Closes #159) git-svn-id: file:///home/lennart/svn/public/avahi/trunk@1585 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe --- avahi-daemon/Makefile.am | 6 ++-- avahi-daemon/static-services.c | 6 ++++ avahi-dnsconfd/Makefile.am | 2 +- configure.ac | 66 +++++++++++++++++++++++++++++++----------- 4 files changed, 59 insertions(+), 21 deletions(-) diff --git a/avahi-daemon/Makefile.am b/avahi-daemon/Makefile.am index 2bb2325..622b4de 100644 --- a/avahi-daemon/Makefile.am +++ b/avahi-daemon/Makefile.am @@ -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 \ diff --git a/avahi-daemon/static-services.c b/avahi-daemon/static-services.c index b9a852c..e123a21 100644 --- a/avahi-daemon/static-services.c +++ b/avahi-daemon/static-services.c @@ -31,7 +31,13 @@ #include #include +#ifdef USE_EXPAT_H #include +#endif /* USE_EXPAT_H */ + +#ifdef USE_BSDXML_H +#include +#endif /* USE_BSDXML_H */ #include #include diff --git a/avahi-dnsconfd/Makefile.am b/avahi-dnsconfd/Makefile.am index 18b3adf..d358734 100644 --- a/avahi-dnsconfd/Makefile.am +++ b/avahi-dnsconfd/Makefile.am @@ -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 diff --git a/configure.ac b/configure.ac index 43b1f65..7dc4170 100644 --- a/configure.ac +++ b/configure.ac @@ -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 -- cgit