2 AC_INIT([xmltooling], [1.0], [mace-opensaml-users@internet2.edu], [xmltooling])
3 AM_CONFIG_HEADER(config.h)
4 AM_CONFIG_HEADER(xmltooling/config_pub.h)
5 AM_INIT_AUTOMAKE([xmltooling], [1.0])
7 sinclude(acx_pthread.m4)
10 AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)]),
11 enable_debug=$enableval, enable_debug=no)
13 if test "$enable_debug" = "yes" ; then
14 GCC_CFLAGS="$CFLAGS -g -D_DEBUG"
15 GCC_CXXFLAGS="$CXXFLAGS -g -D_DEBUG"
17 GCC_CFLAGS="$CFLAGS -O2 -DNDEBUG"
18 GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
21 AC_PROG_CC([gcc gcc3 cc])
22 AC_PROG_CXX([g++ g++3 c++ CC])
24 if test "$GCC" = "yes" ; then
26 CXXFLAGS="$GCC_CXXFLAGS"
41 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
42 if test $enable_threads != "pthread"; then
43 AC_MSG_ERROR([unable to find pthreads, currently this is required])
45 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
46 LIBS="$PTHREAD_LIBS $LIBS"
47 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
48 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
51 # Checks for typedefs, structures, and compiler characteristics.
57 # Checks for library functions.
59 AC_CHECK_FUNCS([strchr strdup strstr gmtime_r timegm])
60 AC_CHECK_HEADERS([dlfcn.h])
63 AC_PATH_PROG(PKG_CONFIG, pkg-config)
64 if test "x$PKG_CONFIG" = x || test "x$PKG_CONFIG" = "xno" ; then
66 AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
67 [if test x_$with_openssl != x_/usr; then
68 SSLLIBS="-L${with_openssl}/lib"
69 SSLFLAGS="-I${with_openssl}/include"
71 SSLLIBS="$SSLLIBS -lssl -lcrypto"
73 SSLLIBS="`$PKG_CONFIG --libs openssl`"
74 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
76 AC_MSG_CHECKING(for OpenSSL libraries)
77 AC_MSG_RESULT($SSLLIBS)
79 AC_MSG_CHECKING(for OpenSSL cflags)
80 AC_MSG_RESULT($SSLFLAGS)
81 CPPFLAGS="$SSLFLAGS $CPPFLAGS"
83 AC_CHECK_HEADER([openssl/ssl.h],,
84 AC_MSG_ERROR([unable to find openssl header files]))
85 AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
86 AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,
87 AC_MSG_ERROR([unable to link with openssl libraries]))
89 AC_MSG_CHECKING(for SSL_library_init)
90 AC_TRY_LINK_FUNC([SSL_library_init],,
91 AC_MSG_ERROR([unable to link with openssl libraries]))
95 AC_PATH_PROG(CURL_CONFIG,curl-config)
97 AC_HELP_STRING([--with-curl=PATH], [where libcurl is installed]),
98 [CURL_CONFIG="${with_curl}/bin/curl-config"])
99 if test -f "${CURL_CONFIG}"; then
100 LDFLAGS="`${CURL_CONFIG} --libs` $LDFLAGS"
101 CPPFLAGS="`${CURL_CONFIG} --cflags` $CPPFLAGS"
103 AC_MSG_WARN([curl-config not found, guessing at libcurl build settings])
105 AC_CHECK_HEADER([curl/curl.h],,AC_MSG_ERROR([unable to find libcurl header files]))
106 AC_CHECK_LIB([curl],[curl_global_init],,AC_MSG_ERROR([unable to link with libcurl]))
107 AC_MSG_CHECKING([for CURLOPT_SSL_CTX_FUNCTION in curl.h])
108 AC_EGREP_HEADER([CURLOPT_SSL_CTX_FUNCTION], [curl/curl.h],
109 [AC_MSG_RESULT(yes)],
110 [AC_MSG_ERROR([need libcurl that supports CURLOPT_SSL_CTX_FUNCTION])])
115 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
117 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp is installed]),
118 [LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"])
119 if test -f "${LOG4CPP_CONFIG}"; then
120 LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
121 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
123 AC_MSG_WARN([log4cpp-config not found, guessing at log4cpp build settings])
124 LIBS="-llog4cpp $LIBS"
126 AC_CHECK_HEADER([log4cpp/Category.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
127 AC_CHECK_HEADER([log4cpp/PropertyConfigurator.hh],,AC_MSG_ERROR([you need at least log4cpp 0.3.x]))
129 [#include <log4cpp/Category.hh>],
130 [log4cpp::Category::getInstance("foo")],
131 [AC_DEFINE(HAVE_LIBLOG4CPP,1,[Define if log4cpp library was found])],
132 [AC_MSG_ERROR([unable to link with log4cpp])])
136 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
137 [if test x_$with_xerces != x_/usr; then
138 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
139 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
141 LIBS="-lxerces-c $LIBS"
142 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
143 AC_MSG_CHECKING([Xerces version])
145 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
146 [#if _XERCES_VERSION != 20600
149 #error cannot use version 2.6.0
152 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use special 2.6.1 tarball provided by Shibboleth Project])])
154 [#include <xercesc/util/PlatformUtils.hpp>],
155 [xercesc::XMLPlatformUtils::Initialize()],
156 [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
157 [AC_MSG_ERROR([unable to link with Xerces])])
160 # XML-Security settings
162 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),
163 [if test x_$with_xmlsec != x_/usr; then
164 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
165 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
168 if test x_$with_xmlsec != x_no; then
169 if test x_$with_xmlsec != x_/usr; then
170 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
171 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
173 LIBS="-lxml-security-c $LIBS"
174 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
175 AC_MSG_CHECKING([XML-Security version])
177 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
178 [#if XSEC_VERSION_MAJOR > 1 || XSEC_VERSION_MEDIUM >2
181 #error need version 1.3 or later
184 [AC_MSG_FAILURE([XML-Security version 1.3 or greater is required.])])
186 [#include <xsec/utils/XSECPlatformUtils.hpp>],
187 [XSECPlatformUtils::Initialise()],,
188 [AC_MSG_ERROR([unable to link with XML-Sec])])
190 AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
191 [AC_DEFINE(XMLTOOLING_NO_XMLSEC,1,
192 [Define if you wish to disable XML-Security-dependent features.])]
194 AM_CONDITIONAL(BUILD_XMLSEC,test x_$with_xmlsec != x_no)
196 # Does the STL in use help or screw us?
199 [std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65],
200 [AC_DEFINE(HAVE_GOOD_STL,1,
201 [Define if you have an STL implementation that supports useful string specialization.])],
204 # Check for unit test support
205 CXXTEST="/usr/bin/cxxtestgen.pl"
208 AC_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
209 [if test x_$with_cxxtest != x_/usr; then
210 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
211 CXXTESTFLAGS="-I${with_cxxtest}"
213 if ! test -f "${CXXTEST}"; then
214 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
218 AC_SUBST(CXXTESTFLAGS)
219 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
222 AC_OUTPUT(Makefile xmltooling/Makefile xmltoolingtest/Makefile schemas/Makefile)