-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