+#error cannot use version 2.6.0
+#endif])],
+ [AC_MSG_RESULT(OK)],
+ [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],[[xercesc::XMLPlatformUtils::Initialize()]])],
+ ,[AC_MSG_ERROR([unable to link with Xerces])])
+
+AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([[#include <xercesc/util/XMLString.hpp>]],
+ [[using namespace XERCES_CPP_NAMESPACE; XMLByte* buf=NULL; XMLString::release(&buf);]])],
+ [AC_MSG_RESULT([yes])AC_DEFINE([SHIBSP_XERCESC_HAS_XMLBYTE_RELEASE],[1],[Define to 1 if Xerces XMLString includes XMLByte release.])],
+ [AC_MSG_RESULT([no])])
+
+AC_MSG_CHECKING([whether Xerces DOMNodeFilter API returns a short])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <xercesc/dom/DOM.hpp>]], [[using namespace XERCES_CPP_NAMESPACE;
+ class Blocker : public DOMNodeFilter {
+ public:
+ short acceptNode(const DOMNode* node) const {
+ return FILTER_REJECT;
+ }
+ };
+ static Blocker g_Blocker;
+ ]])],[AC_MSG_RESULT([yes])
+ AC_DEFINE([SHIBSP_XERCESC_SHORT_ACCEPTNODE],[1],[Define to 1 if Xerces DOMNodeFilter API returns a short.])],[AC_MSG_RESULT([no])])
+
+#XML-Tooling settings
+AC_ARG_WITH(xmltooling,
+ AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling is installed]),
+ [if test x_$with_xmltooling != x_/usr; then
+ LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
+ CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
+ DX_INCLUDE="${with_xmltooling}/include"
+ fi])
+LITE_LIBS="-lxmltooling-lite"
+XMLSEC_LIBS="-lxmltooling"
+AC_CHECK_HEADER([xmltooling/base.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
+
+
+# save and append master libs
+save_LIBS="$LIBS"
+LIBS="$XMLSEC_LIBS $LIBS"
+
+AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([[#include <xmltooling/XMLToolingConfig.h>
+#include <xmltooling/version.h>]],
+ [[#if _XMLTOOLING_VERSION >= 10400
+xmltooling::XMLToolingConfig::getConfig();
+#else
+#error Need XMLTooling version 1.4 or higher
+#endif]])],
+ ,[AC_MSG_ERROR([unable to link with XMLTooling, or version was too old])])
+
+# restore master libs
+LIBS="$save_LIBS"
+
+# Establish location of xmltooling catalog.
+XMLTOOLINGXMLDIR=""
+if test "x$with_xmltooling" = "x" ; then
+ with_xmltooling="/usr"
+fi
+if test -f $with_xmltooling/share/xml/xmltooling/catalog.xml ; then
+ XMLTOOLINGXMLDIR="$with_xmltooling"
+elif test -f $with_xerces/share/xml/xmltooling/catalog.xml ; then
+ XMLTOOLINGXMLDIR="$with_xerces"
+elif test -f $with_log4shib/share/xml/xmltooling/catalog.xml ; then
+ XMLTOOLINGXMLDIR="$with_log4shib"
+fi
+if test "x$XMLTOOLINGXMLDIR" = "x" ; then
+ AC_MSG_ERROR([xmltooling XML catalog not found, may need to use --with-xmltooling option])
+fi
+XMLTOOLINGXMLDIR="$XMLTOOLINGXMLDIR/share/xml/xmltooling"
+AC_SUBST(XMLTOOLINGXMLDIR)