Index: m4/ax_check_openssl.m4
===================================================================
--- m4/ax_check_openssl.m4	(revision 461541aae6382bb58dfb3c4a1679d2d48e8f9e64)
+++ m4/ax_check_openssl.m4	(revision 461541aae6382bb58dfb3c4a1679d2d48e8f9e64)
@@ -0,0 +1,125 @@
+# ===========================================================================
+#     http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
+#
+# DESCRIPTION
+#
+#   Look for OpenSSL in a number of default spots, or in a user-selected
+#   spot (via --with-openssl).  Sets
+#
+#     OPENSSL_INCLUDES to the include directives required
+#     OPENSSL_LIBS to the -l directives required
+#     OPENSSL_LDFLAGS to the -L or -R flags required
+#
+#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
+#
+#   This macro sets OPENSSL_INCLUDES such that source files should use the
+#   openssl/ directory in include directives:
+#
+#     #include <openssl/hmac.h>
+#
+# LICENSE
+#
+#   Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
+#   Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 8
+
+AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
+AC_DEFUN([AX_CHECK_OPENSSL], [
+    found=false
+    AC_ARG_WITH([openssl],
+        [AS_HELP_STRING([--with-openssl=DIR],
+            [root of the OpenSSL directory])],
+        [
+            case "$withval" in
+            "" | y | ye | yes | n | no)
+            AC_MSG_ERROR([Invalid --with-openssl value])
+              ;;
+            *) ssldirs="$withval"
+              ;;
+            esac
+        ], [
+            # if pkg-config is installed and openssl has installed a .pc file,
+            # then use that information and don't search ssldirs
+            AC_PATH_PROG([PKG_CONFIG], [pkg-config])
+            if test x"$PKG_CONFIG" != x""; then
+                OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
+                if test $? = 0; then
+                    OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
+                    OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
+#                    found=true
+                fi
+            fi
+
+            # no such luck; use some default ssldirs
+            if ! $found; then
+                ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
+            fi
+        ]
+        )
+
+
+    # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
+    # an 'openssl' subdirectory
+
+    if ! $found; then
+        OPENSSL_INCLUDES=
+        for ssldir in $ssldirs; do
+            AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
+            if test -f "$ssldir/include/openssl/ssl.h"; then
+                OPENSSL_INCLUDES="-I$ssldir/include"
+                OPENSSL_LDFLAGS="-L$ssldir/lib"
+                OPENSSL_LIBS="-lssl -lcrypto"
+                found=true
+                AC_MSG_RESULT([yes])
+                break
+            else
+                AC_MSG_RESULT([no])
+            fi
+        done
+
+        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
+        # it will just work!
+    fi
+
+    # try the preprocessor and linker with our new flags,
+    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
+
+    AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
+    echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
+        "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
+
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    save_CPPFLAGS="$CPPFLAGS"
+    LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
+    LIBS="$OPENSSL_LIBS $LIBS"
+    CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
+    AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
+        [
+            AC_MSG_RESULT([yes])
+            $1
+        ], [
+            AC_MSG_RESULT([no])
+            $2
+        ])
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+
+    AC_SUBST([OPENSSL_INCLUDES])
+    AC_SUBST([OPENSSL_LIBS])
+    AC_SUBST([OPENSSL_LDFLAGS])
+])
+
Index: m4/ax_check_xml2.m4
===================================================================
--- m4/ax_check_xml2.m4	(revision 461541aae6382bb58dfb3c4a1679d2d48e8f9e64)
+++ m4/ax_check_xml2.m4	(revision 461541aae6382bb58dfb3c4a1679d2d48e8f9e64)
@@ -0,0 +1,117 @@
+# ===========================================================================
+#     ax_check_xml2.m4
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_XML2([action-if-found[, action-if-not-found]])
+#
+# DESCRIPTION
+#
+#   Look for xml2in a number of default spots, or in a user-selected
+#   spot (via --with-xml2).  Sets
+#
+#     XML2_INCLUDES to the include directives required
+#     XML2_LIBS to the -l directives required
+#     XML2_LDFLAGS to the -L or -R flags required
+#
+#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
+#
+#   This macro sets XML2_INCLUDES such that source files should use the
+#   libxml2/ directory in include directives:
+#    ... <libxml/tree.h>
+#
+AU_ALIAS([CHECK_XML2], [AX_CHECK_XML2])
+AC_DEFUN([AX_CHECK_XML2], [
+    found=false
+    AC_ARG_WITH([xml2],
+        [AS_HELP_STRING([--with-xml2=DIR],
+            [root of the XML2 directory])],
+        [
+            case "$withval" in
+            "" | y | ye | yes | n | no)
+            AC_MSG_ERROR([Invalid --with-xml2 value])
+              ;;
+            *) xml2dirs="$withval"
+              ;;
+            esac
+        ], [
+            # if pkg-config is installed and xml2 has installed a .pc file,
+            # then use that information and don't search xml2dirs
+            AC_PATH_PROG([PKG_CONFIG], [pkg-config])
+            if test x"$PKG_CONFIG" != x""; then
+                XML2_LDFLAGS=`$PKG_CONFIG xml2 --libs-only-L 2>/dev/null`
+                if test $? = 0; then
+                    XML2_LIBS=`$PKG_CONFIG xml2 --libs-only-l 2>/dev/null`
+                    XML2_INCLUDES=`$PKG_CONFIG xml2 --cflags-only-I 2>/dev/null`
+#                    found=true
+                fi
+            fi
+
+            # no such luck; use some default xml2dirs
+            if ! $found; then
+                xml2dirs="/usr/local /usr"
+            fi
+        ]
+        )
+
+
+    # XML2 headers have to be in libxml and xml2dir subdirectories
+    # CFLAGS =-g -Wall `xmlsec1-config --cflags --crypto=default` `xml2-config --cflags`
+    # LDFLAGS += `xml2-config --libs` `xmlsec1-config --libs --crypto=default` 
+
+    if ! $found; then
+        AC_PATH_PROG([XML2_CONFIG], [xml2-config])
+        if test x"$XML2_CONFIG" != x""; then
+            for xml2dir in $xml2dirs; do
+                AC_MSG_CHECKING([for libxml/tree.h in $xml2dir])
+                if test -f "$xml2dir/include/libxml2/libxml/tree.h"; then
+                    XML2_INCLUDES=`$XML2_CONFIG --cflags 2>/dev/null` 
+                    XML2_LDFLAGS=`$XML2_CONFIG --libs 2>/dev/null` 
+                    found=true
+                    AC_MSG_RESULT([yes])
+                    break
+                else
+                    AC_MSG_RESULT([no])
+                fi
+            done
+        else
+            # cannot even find the xml2-config
+            AC_MSG_ERROR([Cannot find xml2-config in your system path])
+        fi
+
+        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
+        # it will just work!
+    fi
+
+    # try the preprocessor and linker with our new flags,
+    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
+
+    AC_MSG_CHECKING([whether compiling and linking against XML2 works])
+    echo "Trying link with XML2_LDFLAGS=$XML2_LDFLAGS;" \
+        "XML2_LIBS=$XML2_LIBS; XML2_INCLUDES=$XML2_INCLUDES" >&AS_MESSAGE_LOG_FD
+
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    save_CPPFLAGS="$CPPFLAGS"
+    LDFLAGS="$LDFLAGS $XML2_LDFLAGS"
+    LIBS="$XML2_LIBS $LIBS"
+    CPPFLAGS="$XML2_INCLUDES $CPPFLAGS"
+    AC_LINK_IFELSE( 
+        [AC_LANG_PROGRAM([#include <libxml/tree.h>], [xmlMalloc(1)])],
+        [
+            AC_MSG_RESULT([yes])
+            $1
+        ], [
+            AC_MSG_RESULT([no])
+            $2
+        ])
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+
+    AC_SUBST([XML2_INCLUDES])
+    AC_SUBST([XML2_LIBS])
+    AC_SUBST([XML2_LDFLAGS])
+])
+
Index: m4/ax_check_xmlsec1.m4
===================================================================
--- m4/ax_check_xmlsec1.m4	(revision 461541aae6382bb58dfb3c4a1679d2d48e8f9e64)
+++ m4/ax_check_xmlsec1.m4	(revision 461541aae6382bb58dfb3c4a1679d2d48e8f9e64)
@@ -0,0 +1,120 @@
+# ===========================================================================
+#     ax_check_xmlsec1.m4
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_XMLSEC1([action-if-found[, action-if-not-found]])
+#
+# DESCRIPTION
+#
+#   Look for xmlsec1 in a number of default spots, or in a user-selected
+#   spot (via --with-xmlsec1).  Sets
+#
+#     XMLSEC1_INCLUDES to the include directives required
+#     XMLSEC1_LIBS to the -l directives required
+#     XMLSEC1_LDFLAGS to the -L or -R flags required
+#
+#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
+#
+#   This macro sets XMLSEC1_INCLUDES such that source files should use the
+#   xml/ directory in include directives:
+#    ... <xmlsec/xmlsec.h>
+#
+#
+AU_ALIAS([CHECK_XMLSEC1], [AX_CHECK_XMLSEC1])
+AC_DEFUN([AX_CHECK_XMLSEC1], [
+    found=false
+    AC_ARG_WITH([xmlsec1],
+        [AS_HELP_STRING([--with-xmlsec1=DIR],
+            [root of the XMLSEC1 directory])],
+        [
+            case "$withval" in
+            "" | y | ye | yes | n | no)
+            AC_MSG_ERROR([Invalid --with-xmlsec1 value])
+              ;;
+            *) xmlsec1dirs="$withval"
+              ;;
+            esac
+        ], [
+            # if pkg-config is installed and xmlsec1 has installed a .pc file,
+            # then use that information and don't search xmlsec1dirs
+            AC_PATH_PROG([PKG_CONFIG], [pkg-config])
+            if test x"$PKG_CONFIG" != x""; then
+                XMLSEC1_LDFLAGS=`$PKG_CONFIG xmlsec1 --libs-only-L 2>/dev/null`
+                if test $? = 0; then
+                    XMLSEC1_LIBS=`$PKG_CONFIG xmlsec1 --libs-only-l 2>/dev/null`
+                    XMLSEC1_INCLUDES=`$PKG_CONFIG xmlsec1 --cflags-only-I 2>/dev/null`
+                    AC_MSG_NOTICE([found xmlsec with pkg-config])
+#                    found=true
+                fi
+            fi
+
+            # no such luck; use some default xmlsec1dirs
+            if ! $found; then
+                xmlsec1dirs="/usr/local /usr"
+            fi
+        ]
+        )
+
+
+    # XMLSEC1 headers have to be in libxml and xmlsec subdirectories
+    # CFLAGS =-g -Wall `xmlsec1-config --cflags --crypto=default` `xml2-config --cflags`
+    # LDFLAGS += `xml2-config --libs` `xmlsec1-config --libs --crypto=default` 
+
+    if ! $found; then
+        AC_PATH_PROG([XMLSEC1_CONFIG], [xmlsec1-config])
+        if test x"$XMLSEC1_CONFIG" != x""; then
+            for xmlsec1dir in $xmlsec1dirs; do
+                AC_MSG_CHECKING([for xmlsec/xmlsec.h in $xmlsec1dir])
+                if test -f "$xmlsec1dir/include/xmlsec1/xmlsec/xmlsec.h"; then
+                    XMLSEC1_INCLUDES="-g -Wall "
+                    XMLSEC1_INCLUDES+=`$XMLSEC1_CONFIG --cflags --crypto=default 2>/dev/null` 
+                    XMLSEC1_LDFLAGS=`$XMLSEC1_CONFIG --libs --crypto=default 2>/dev/null` 
+                    found=true
+                    AC_MSG_RESULT([yes])
+                    break;
+                else
+                    AC_MSG_RESULT([no])
+                fi
+            done
+        else
+            # cannot even find the xmlsec-config
+            AC_MSG_ERROR([Cannot find xmlsec-config in your system path])
+        fi
+
+        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
+        # it will just work!
+    fi
+
+    # try the preprocessor and linker with our new flags,
+    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
+
+    AC_MSG_CHECKING([whether compiling and linking against XMLSEC1 works])
+    echo "Trying link with XMLSEC1_LDFLAGS=$XMLSEC1_LDFLAGS;" \
+        "XMLSEC1_LIBS=$XMLSEC1_LIBS; XMLSEC1_INCLUDES=$XMLSEC1_INCLUDES" >&AS_MESSAGE_LOG_FD
+
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    save_CPPFLAGS="$CPPFLAGS"
+    LDFLAGS="$LDFLAGS $XMLSEC1_LDFLAGS"
+    LIBS="$XMLSEC1_LIBS $LIBS"
+    CPPFLAGS="$XMLSEC1_INCLUDES $CPPFLAGS"
+    AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM([#include <xmlsec/xmlsec.h>], [xmlSecInit()])],
+        [
+            AC_MSG_RESULT([yes])
+            $1
+        ], [
+            AC_MSG_RESULT([no])
+            $2
+        ])
+    CPPFLAGS="$save_CPPFLAGS"
+    LDFLAGS="$save_LDFLAGS"
+    LIBS="$save_LIBS"
+
+    AC_SUBST([XMLSEC1_INCLUDES])
+    AC_SUBST([XMLSEC1_LIBS])
+    AC_SUBST([XMLSEC1_LDFLAGS])
+])
+
