2 AC_INIT([xmltooling], [1.4], [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.4])
8 sinclude(acx_pthread.m4)
9 sinclude(ax_create_pkgconfig_info.m4)
20 DX_INIT_DOXYGEN(xmltooling, doxygen.cfg, doc/api)
23 AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)]),
24 enable_debug=$enableval, enable_debug=no)
26 if test "$enable_debug" = "yes" ; then
27 GCC_CFLAGS="$CFLAGS -g -D_DEBUG"
28 GCC_CXXFLAGS="$CXXFLAGS -g -D_DEBUG"
30 GCC_CFLAGS="$CFLAGS -O2 -DNDEBUG"
31 GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
34 AC_PROG_CC([gcc gcc3 cc])
35 AC_PROG_CXX([g++ g++3 c++ CC])
38 if test "$GCC" = "yes" ; then
39 # AC_HAVE_GCC_VERSION(4,0,0,0,
41 # AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
42 # [Define to enable class visibility control in gcc.])
43 # GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
44 # GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
46 CFLAGS="-Wall $GCC_CFLAGS"
47 CXXFLAGS="-Wall $GCC_CXXFLAGS"
49 # Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
50 case "${host_cpu}-${host_os}" in
52 if test "$CXX" = "CC" ; then
53 CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
62 # Checks for typedefs, structures, and compiler characteristics.
65 AC_CHECK_SIZEOF([long])
67 # Checks for library functions.
68 AC_CHECK_FUNCS([strchr strdup strstr timegm strcasecmp])
69 AC_CHECK_HEADERS([dlfcn.h])
70 AC_CHECK_FUNC(dlclose, , [ AC_CHECK_LIB(dl, dlopen) ])
73 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
74 if test $enable_threads != "pthread"; then
75 AC_MSG_ERROR([unable to find pthreads, currently this is required])
77 AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
78 AM_CONDITIONAL(BUILD_PTHREAD,test "$enable_threads" = "pthread")
79 LIBS="$PTHREAD_LIBS $LIBS"
80 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
81 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
84 AC_CHECK_FUNCS([pthread_rwlock_init])
92 # are covariant methods allowed?
94 [AC_LANG_PROGRAM([[]],
96 class base { public: virtual base *GetPtr( void ) { return this; } };
97 class derived: virtual public base { public: virtual derived *GetPtr( void ) { return this; } };
99 [AC_DEFINE([HAVE_COVARIANT_RETURNS], [1], [Define to 1 if C++ compiler supports covariant virtual methods.])]
102 # is nullptr supported?
104 [AC_LANG_PROGRAM([[]],
106 const char* ptr = nullptr;
108 [AC_DEFINE([HAVE_NULLPTR], [1], [Define to 1 if C++ compiler supports nullptr keyword.])]
111 # log4shib settings (favor this version over the log4cpp code)
112 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
113 AC_ARG_WITH(log4shib,
114 AC_HELP_STRING([--with-log4shib=PATH], [where log4shib-config is installed]),
116 LOG4SHIB_CONFIG="${with_log4shib}"
117 if ! test -f "${LOG4SHIB_CONFIG}" ; then
118 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
121 if test -f "${LOG4SHIB_CONFIG}"; then
122 LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
123 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
124 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
126 [#include <log4shib/Category.hh>
127 #include <log4shib/CategoryStream.hh>],
128 [log4shib::Category::getInstance("foo").errorStream() << log4shib::eol],
129 [AC_DEFINE([XMLTOOLING_LOG4SHIB], [1], [Define to 1 if log4shib library is used.])],
130 [AC_MSG_ERROR([unable to link with log4shib])])
132 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
133 AC_MSG_WARN([will look for original log4cpp library])
136 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
138 AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp-config is installed]),
140 LOG4CPP_CONFIG="${with_log4cpp}"
141 if ! test -f "${LOG4CPP_CONFIG}" ; then
142 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
145 if test -f "${LOG4CPP_CONFIG}"; then
146 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
147 LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
148 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
149 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
151 [#include <log4cpp/Category.hh>
152 #include <log4cpp/CategoryStream.hh>],
153 [log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol],
154 [AC_DEFINE([XMLTOOLING_LOG4CPP], [1], [Define to 1 if log4cpp library is used.])],
155 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
157 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
163 AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
164 [if test x_$with_xerces != x_/usr; then
165 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
166 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
168 LIBS="-lxerces-c $LIBS"
169 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
170 AC_MSG_CHECKING([Xerces version])
172 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
173 [#if _XERCES_VERSION != 20600
176 #error cannot use version 2.6.0
179 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
181 [#include <xercesc/util/PlatformUtils.hpp>],
182 [xercesc::XMLPlatformUtils::Initialize()],
183 [AC_DEFINE([HAVE_LIBXERCESC], [1], [Define to 1 if Xerces-C library was found])],
184 [AC_MSG_ERROR([unable to link with Xerces])])
186 AC_MSG_CHECKING([whether Xerces is 64-bit clean])
187 AC_TRY_COMPILE([#include <xercesc/framework/MemBufInputSource.hpp>],
188 [using namespace XERCES_CPP_NAMESPACE;
191 [AC_MSG_RESULT([yes])]
192 [AC_DEFINE([XMLTOOLING_XERCESC_64BITSAFE], [1], [Define to 1 if Xerces has a 64-bit-safe API.])],
193 [AC_MSG_RESULT([no])])
195 AC_MSG_CHECKING([whether Xerces BinInputStream requires getContentType])
196 AC_TRY_COMPILE([#include <xercesc/util/BinMemInputStream.hpp>],
197 [using namespace XERCES_CPP_NAMESPACE;
199 BinMemInputStream in(buf,1024);
202 [AC_MSG_RESULT([yes])]
203 [AC_DEFINE([XMLTOOLING_XERCESC_INPUTSTREAM_HAS_CONTENTTYPE], [1], [Define to 1 if Xerces InputStream class requires getContentType.])],
204 [AC_MSG_RESULT([no])])
206 AC_MSG_CHECKING([whether Xerces DOMLS API is compliant])
207 AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
208 [using namespace XERCES_CPP_NAMESPACE;
209 DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(NULL);
210 DOMLSSerializer *ls = ((DOMImplementationLS*)impl)->createLSSerializer();
212 [AC_MSG_RESULT([yes])]
213 [AC_DEFINE([XMLTOOLING_XERCESC_COMPLIANT_DOMLS], [1], [Define to 1 if Xerces supports a compliant DOMLS API.])],
214 [AC_MSG_RESULT([no])])
216 AC_MSG_CHECKING([whether Xerces has setIdAttribute(XMLCh*, bool)])
217 AC_TRY_COMPILE([#include <xercesc/dom/DOM.hpp>],
218 [using namespace XERCES_CPP_NAMESPACE;
220 elt->setIdAttribute(NULL, false);
222 [AC_MSG_RESULT([yes])]
223 [AC_DEFINE([XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE], [1], [Define to 1 if Xerces DOM ID methods take extra parameter.])],
224 [AC_MSG_RESULT([no])])
226 AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
227 AC_TRY_COMPILE([#include <xercesc/util/XMLString.hpp>],
228 [using namespace XERCES_CPP_NAMESPACE;
230 XMLString::release(&buf);
232 [AC_MSG_RESULT([yes])]
233 [AC_DEFINE([XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE], [1], [Define to 1 if Xerces XMLString includes XMLByte release.])],
234 [AC_MSG_RESULT([no])])
236 # XML-Security settings
238 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
241 if test x_$with_xmlsec != x_no; then
243 # OpenSSL settings (need to do this first in case it's in a different spot from xmlsec)
245 AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
246 [if test x_$with_openssl != x_/usr; then
247 SSLFLAGS="-I${with_openssl}/include"
248 SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl"
250 SSLLIBS="-lcrypto -lssl"
253 if test "x$SSLLIBS" = "x" ; then
254 AC_PATH_PROG(PKG_CONFIG, pkg-config)
255 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
256 if pkg-config openssl ; then
257 SSLLIBS="`$PKG_CONFIG --libs openssl`"
258 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
260 AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
265 if test "x$SSLLIBS" = "x" ; then
266 SSLLIBS="-lcrypto -lssl"
269 AC_MSG_CHECKING(for OpenSSL cflags)
270 AC_MSG_RESULT($SSLFLAGS)
271 CPPFLAGS="$CPPFLAGS $SSLFLAGS"
272 AC_MSG_CHECKING(for OpenSSL libraries)
273 AC_MSG_RESULT($SSLLIBS)
274 XMLSEC_LIBS="$XMLSEC_LIBS $SSLLIBS"
276 # save and append master libs
278 LIBS="$XMLSEC_LIBS $LIBS"
280 AC_CHECK_HEADER([openssl/pem.h],,
281 AC_MSG_ERROR([unable to find openssl header files]))
282 AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
283 AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,
284 AC_MSG_ERROR([unable to link with openssl libraries]))
287 # restore master libs
290 if test x_$with_xmlsec != x_/usr; then
291 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
292 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
294 XMLSEC_LIBS="$XMLSEC_LIBS -lxml-security-c"
296 # save and append master libs
298 LIBS="$XMLSEC_LIBS $LIBS"
300 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
301 AC_MSG_CHECKING([XML-Security version])
303 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
304 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
307 #error need version 1.4.0 or later
310 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
312 [#include <xsec/utils/XSECPlatformUtils.hpp>],
313 [XSECPlatformUtils::Initialise()],,
314 [AC_MSG_ERROR([unable to link with XML-Security])])
315 AC_CHECK_TYPE([xsecsize_t],[AC_DEFINE([HAVE_XSECSIZE_T], [1], [Define to 1 if you have the 'xsecsize_t' type.])])
317 AC_MSG_CHECKING([whether XML-Security-C has multiple CRL support])
318 AC_TRY_COMPILE([#include <xsec/dsig/DSIGKeyInfoList.hpp>],
319 [DSIGKeyInfoList* klist; klist->getX509CRLListSize();],
320 [AC_MSG_RESULT([yes])]
321 [AC_DEFINE([XMLTOOLING_XMLSEC_MULTIPLECRL], [1], [Define to 1 if XML-Security-C handles multiple CRLs.])],
322 [AC_MSG_RESULT([no])])
324 AC_MSG_CHECKING([whether XML-Security-C exposes the signature algorithm URI])
325 AC_TRY_COMPILE([#include <xsec/dsig/DSIGSignature.hpp>],
326 [DSIGSignature* sig; sig->getAlgorithmURI();],
327 [AC_MSG_RESULT([yes])]
328 [AC_DEFINE([XMLTOOLING_XMLSEC_SIGALGORITHM], [1], [Define to 1 if XML-Security-C exposes the signature algorithm URI.])],
329 [AC_MSG_RESULT([no])])
331 AC_MSG_CHECKING([whether XML-Security-C includes ECC support])
332 AC_TRY_COMPILE([#include <xsec/dsig/DSIGKeyInfoValue.hpp>],
333 [DSIGKeyInfoValue* info; info->getECNamedCurve();],
334 [AC_MSG_RESULT([yes])]
335 [AC_DEFINE([XMLTOOLING_XMLSEC_ECC], [1], [Define to 1 if XML-Security-C includes ECC support.])],
336 [AC_MSG_RESULT([no])])
338 AC_MSG_CHECKING([whether XML-Security-C includes debug logging support])
339 AC_TRY_COMPILE([#include <xsec/utils/XSECPlatformUtils.hpp>],
340 [XSECPlatformUtils::SetReferenceLoggingSink(NULL)],
341 [AC_MSG_RESULT([yes])]
342 [AC_DEFINE([XMLTOOLING_XMLSEC_DEBUGLOGGING], [1], [Define to 1 if XML-Security-C includes debug logging support.])],
343 [AC_MSG_RESULT([no])])
345 # restore master libs
349 AC_PATH_PROG(CURL_CONFIG,curl-config)
351 AC_HELP_STRING([--with-curl=PATH], [where curl-config is installed]),
353 CURL_CONFIG="${with_curl}"
354 if ! test -f "${CURL_CONFIG}" ; then
355 CURL_CONFIG="${with_curl}/bin/curl-config"
358 if test -f "${CURL_CONFIG}" ; then
359 CPPFLAGS="`${CURL_CONFIG} --cflags` $CPPFLAGS"
360 XMLSEC_LIBS="`${CURL_CONFIG} --libs` $XMLSEC_LIBS"
362 AC_MSG_ERROR([curl-config not found, may need to use --with-curl option])
365 # save and append master libs
367 LIBS="$XMLSEC_LIBS $LIBS"
369 AC_CHECK_HEADER([curl/curl.h],,AC_MSG_ERROR([unable to find libcurl header files]))
370 AC_CHECK_LIB([curl],[curl_global_init],,AC_MSG_ERROR([unable to link with libcurl]))
371 AC_MSG_CHECKING([for CURLOPT_SSL_CTX_FUNCTION in curl.h])
372 AC_EGREP_HEADER([CURLOPT_SSL_CTX_FUNCTION], [curl/curl.h],
373 [AC_MSG_RESULT(yes)],
374 [AC_MSG_ERROR([need libcurl that supports CURLOPT_SSL_CTX_FUNCTION])])
375 AC_CHECK_TYPE([curl_off_t],[AC_DEFINE([HAVE_CURL_OFF_T], [1], [Define to 1 if you have the 'curl_off_t' type.])])
377 # restore master libs
380 AC_SUBST(XMLSEC_LIBS)
382 AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
383 AC_DEFINE([XMLTOOLING_NO_XMLSEC], [1], [Define to 1 if you wish to disable XML-Security-dependent features.])
385 AM_CONDITIONAL(BUILD_XMLSEC,test x_$with_xmlsec != x_no)
387 # Does the STL in use help or screw us?
390 [std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65],
391 [AC_DEFINE([HAVE_GOOD_STL], [1],
392 [Define to 1 if you have an STL implementation that supports useful string specialization.])],
396 [std::iterator_traits<std::vector<int>::iterator>::value_type foo=0],
397 [AC_DEFINE([HAVE_ITERATOR_TRAITS], [1],
398 [Define to 1 if you have an STL implementation that supports std::iterator_traits.])],
401 # Check for unit test support
402 CXXTEST="/usr/bin/cxxtestgen.pl"
405 AC_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
406 [if test x_$with_cxxtest != x_/usr; then
407 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
408 CXXTESTFLAGS="-I${with_cxxtest}"
410 if ! test -f "${CXXTEST}"; then
411 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
415 AC_SUBST(CXXTESTFLAGS)
416 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
418 AX_CREATE_PKGCONFIG_INFO(,,[$XMLSEC_LIBS -lxmltooling],[OpenSAML XMLTooling-C library])
420 LIBTOOL="$LIBTOOL --silent"
422 # output packaging and makefiles
423 AC_CONFIG_FILES([xmltooling.spec pkginfo Portfile])
424 AC_CONFIG_FILES([Makefile xmltooling/Makefile xmltoolingtest/Makefile schemas/Makefile doc/Makefile])