1 # Process this file with autoreconf
3 AC_INIT([xmltooling],[1.5],[https://issues.shibboleth.net/],[xmltooling])
4 AC_CONFIG_SRCDIR(xmltooling)
5 AC_CONFIG_AUX_DIR(build-aux)
6 AC_CONFIG_MACRO_DIR(m4)
20 DX_INIT_DOXYGEN(xmltooling, doxygen.cfg, doc/api)
23 AS_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_CONFIG_HEADERS([config.h xmltooling/config_pub.h])
35 AC_CONFIG_FILES([xmltooling.spec])
36 AC_CONFIG_FILES([Makefile xmltooling/Makefile xmltoolingtest/Makefile schemas/Makefile doc/Makefile])
38 AC_PROG_CC([gcc gcc3 cc])
39 AC_PROG_CXX([g++ g++3 c++ CC])
42 if test "$GCC" = "yes" ; then
43 # AC_HAVE_GCC_VERSION(4,0,0,0,
45 # AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
46 # [Define to enable class visibility control in gcc.])
47 # GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
48 # GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
50 CFLAGS="-Wall $GCC_CFLAGS"
51 CXXFLAGS="-Wall $GCC_CXXFLAGS"
54 # Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
55 # Also enables POSIX semantics for some functions.
56 case "${host_cpu}-${host_os}" in
58 CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
59 CXXFLAGS="$CXXFLAGS -D_POSIX_PTHREAD_SEMANTICS"
60 if test "$CXX" = "CC" ; then
61 CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
66 # Checks for typedefs, structures, and compiler characteristics.
69 AC_CHECK_SIZEOF([long])
71 # Checks for library functions.
72 AC_CHECK_FUNCS([strchr strdup strstr timegm strcasecmp])
73 AC_CHECK_HEADERS([dlfcn.h])
74 AC_CHECK_FUNC(dlclose, , [ AC_CHECK_LIB(dl, dlopen) ])
77 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
78 if test $enable_threads != "pthread"; then
79 AC_MSG_ERROR([unable to find pthreads, currently this is required])
81 AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])
82 AM_CONDITIONAL(BUILD_PTHREAD,test "$enable_threads" = "pthread")
83 LIBS="$PTHREAD_LIBS $LIBS"
84 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
85 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
88 AC_CHECK_FUNCS([pthread_rwlock_init])
105 CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
107 # are covariant methods allowed?
109 [AC_LANG_PROGRAM([[]],
111 class base { public: virtual base *GetPtr( void ) { return this; } };
112 class derived: virtual public base { public: virtual derived *GetPtr( void ) { return this; } };
114 [AC_DEFINE([HAVE_COVARIANT_RETURNS],[1],[Define to 1 if C++ compiler supports covariant virtual methods.])])
116 # is nullptr supported?
118 [AC_LANG_PROGRAM([[]],[[const char* ptr = nullptr;]])],
119 [AC_DEFINE([HAVE_NULLPTR],[1],[Define to 1 if C++ compiler supports nullptr keyword.])])
121 # log4shib settings (favor this version over the log4cpp code)
122 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
123 AC_ARG_WITH(log4shib,
124 AS_HELP_STRING([--with-log4shib=PATH],[where log4shib-config is installed]),
126 LOG4SHIB_CONFIG="${with_log4shib}"
127 if ! test -f "${LOG4SHIB_CONFIG}" ; then
128 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
131 if test -f "${LOG4SHIB_CONFIG}" ; then
132 LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
133 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
134 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
136 [AC_LANG_PROGRAM([[#include <log4shib/Category.hh>
137 #include <log4shib/CategoryStream.hh>]],
138 [[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])],
139 [AC_DEFINE([XMLTOOLING_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
140 [AC_MSG_ERROR([unable to link with log4shib])])
142 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
143 AC_MSG_WARN([will look for original log4cpp library])
146 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
148 AS_HELP_STRING([--with-log4cpp=PATH],[where log4cpp-config is installed]),
150 LOG4CPP_CONFIG="${with_log4cpp}"
151 if ! test -f "${LOG4CPP_CONFIG}" ; then
152 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
155 if test -f "${LOG4CPP_CONFIG}"; then
156 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
157 LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
158 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
159 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
161 [AC_LANG_PROGRAM([[#include <log4cpp/Category.hh>
162 #include <log4cpp/CategoryStream.hh>]],
163 [[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])],
164 [AC_DEFINE([XMLTOOLING_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])],
165 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
167 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
173 AS_HELP_STRING([--with-xerces=PATH],[where xerces-c is installed]),,
175 if test x_$with_xerces != x_/usr; then
176 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
177 LIBS="-L${with_xerces}/lib -lxerces-c $LIBS"
179 LIBS="-lxerces-c $LIBS"
182 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
183 AC_MSG_CHECKING([Xerces version])
185 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
186 [#if _XERCES_VERSION != 20600
189 #error cannot use version 2.6.0
192 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
194 [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],
195 [[xercesc::XMLPlatformUtils::Initialize()]])],
196 ,[AC_MSG_ERROR([unable to link with Xerces])])
198 AC_MSG_CHECKING([whether Xerces is 64-bit clean])
200 [AC_LANG_PROGRAM([[#include <xercesc/framework/MemBufInputSource.hpp>]],
201 [[using namespace XERCES_CPP_NAMESPACE; XMLFilePos testvar;]])],
202 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_64BITSAFE],[1],[Define to 1 if Xerces has a 64-bit-safe API.])],
203 [AC_MSG_RESULT([no])])
205 AC_MSG_CHECKING([whether Xerces BinInputStream requires getContentType])
207 [AC_LANG_PROGRAM([[#include <xercesc/util/BinMemInputStream.hpp>]],
208 [[using namespace XERCES_CPP_NAMESPACE; XMLByte buf[1024]; BinMemInputStream in(buf,1024); in.getContentType();]])],
209 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_INPUTSTREAM_HAS_CONTENTTYPE],[1],[Define to 1 if Xerces InputStream class requires getContentType.])],
210 [AC_MSG_RESULT([no])])
212 AC_MSG_CHECKING([whether Xerces DOMLS API is compliant])
214 [AC_LANG_PROGRAM([[#include <xercesc/dom/DOM.hpp>]],
215 [[using namespace XERCES_CPP_NAMESPACE;
216 DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(NULL);
217 DOMLSSerializer *ls = ((DOMImplementationLS*)impl)->createLSSerializer();]])],
218 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_COMPLIANT_DOMLS],[1],[Define to 1 if Xerces supports a compliant DOMLS API.])],
219 [AC_MSG_RESULT([no])])
221 AC_MSG_CHECKING([whether Xerces has setIdAttribute(XMLCh*, bool)])
223 [AC_LANG_PROGRAM([[#include <xercesc/dom/DOM.hpp>]],
224 [[using namespace XERCES_CPP_NAMESPACE; DOMElement * elt; elt->setIdAttribute(NULL, false);]])],
225 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE],[1],[Define to 1 if Xerces DOM ID methods take extra parameter.])],
226 [AC_MSG_RESULT([no])])
228 AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
230 [AC_LANG_PROGRAM([[#include <xercesc/util/XMLString.hpp>]],
231 [[using namespace XERCES_CPP_NAMESPACE; XMLByte* buf=NULL; XMLString::release(&buf);]])],
232 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE],[1],[Define to 1 if Xerces XMLString includes XMLByte release.])],
233 [AC_MSG_RESULT([no])])
235 # XML-Security settings
237 AS_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
240 if test x_$with_xmlsec != x_no; then
242 # OpenSSL settings (need to do this first in case it's in a different spot from xmlsec)
244 AS_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
245 [if test x_$with_openssl != x_/usr; then
246 SSLFLAGS="-I${with_openssl}/include"
247 SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl"
249 SSLLIBS="-lcrypto -lssl"
252 if test "x$SSLLIBS" = "x" ; then
253 AC_PATH_PROG(PKG_CONFIG, pkg-config)
254 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
255 if pkg-config openssl ; then
256 SSLLIBS="`$PKG_CONFIG --libs openssl`"
257 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
259 AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
264 if test "x$SSLLIBS" = "x" ; then
265 SSLLIBS="-lcrypto -lssl"
268 AC_MSG_CHECKING(for OpenSSL cflags)
269 AC_MSG_RESULT($SSLFLAGS)
270 CPPFLAGS="$CPPFLAGS $SSLFLAGS"
271 AC_MSG_CHECKING(for OpenSSL libraries)
272 AC_MSG_RESULT($SSLLIBS)
273 XMLSEC_LIBS="$XMLSEC_LIBS $SSLLIBS"
275 # save and append master libs
277 LIBS="$XMLSEC_LIBS $LIBS"
279 AC_CHECK_HEADER([openssl/pem.h],,AC_MSG_ERROR([unable to find openssl header files]))
280 AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
281 AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,AC_MSG_ERROR([unable to link with openssl libraries]))
284 AC_CHECK_DECL(EVP_sha512,
285 [AC_DEFINE([XMLTOOLING_OPENSSL_HAVE_SHA2],[1],[Define to 1 if OpenSSL supports the SHA-2 hash family.])],
286 ,[#include <openssl/evp.h>])
287 AC_CHECK_DECL(EVP_PKEY_set1_EC_KEY,
288 [AC_DEFINE([XMLTOOLING_OPENSSL_HAVE_EC],[1],[Define to 1 if OpenSSL has EC support.])],
289 ,[#include <openssl/evp.h>])
291 # restore master libs
294 if test x_$with_xmlsec != x_/usr; then
295 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
296 XMLSEC_LIBS="-L${with_xmlsec}/lib -lxml-security-c $XMLSEC_LIBS"
298 XMLSEC_LIBS="-lxml-security-c $XMLSEC_LIBS"
301 # save and append master libs
303 LIBS="$XMLSEC_LIBS $LIBS"
305 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
306 AC_MSG_CHECKING([XML-Security version])
308 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
309 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
312 #error need version 1.4.0 or later
315 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
318 [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
319 [[XSECPlatformUtils::Initialise()]])],,
320 [AC_MSG_ERROR([unable to link with XML-Security])])
321 AC_CHECK_TYPE([xsecsize_t],[AC_DEFINE([HAVE_XSECSIZE_T],[1],[Define to 1 if you have the 'xsecsize_t' type.])])
323 AC_MSG_CHECKING([whether XML-Security-C has multiple CRL support])
325 [AC_LANG_PROGRAM([[#include <xsec/dsig/DSIGKeyInfoX509.hpp>]],
326 [[DSIGKeyInfoX509* klist; klist->getX509CRLListSize();]])],
327 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_MULTIPLECRL],[1],[Define to 1 if XML-Security-C handles multiple CRLs.])],
328 [AC_MSG_RESULT([no])])
330 AC_MSG_CHECKING([whether XML-Security-C exposes the signature algorithm URI])
332 [AC_LANG_PROGRAM([[#include <xsec/dsig/DSIGSignature.hpp>]],
333 [[DSIGSignature* sig; sig->getAlgorithmURI();]])],
334 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_SIGALGORITHM],[1],[Define to 1 if XML-Security-C exposes the signature algorithm URI.])],
335 [AC_MSG_RESULT([no])])
337 AC_MSG_CHECKING([whether XML-Security-C includes ECC support])
339 [AC_LANG_PROGRAM([[#include <xsec/dsig/DSIGKeyInfoValue.hpp>]],
340 [[DSIGKeyInfoValue* info; info->getECNamedCurve();]])],
341 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_ECC],[1],[Define to 1 if XML-Security-C includes ECC support.])],
342 [AC_MSG_RESULT([no])])
344 AC_MSG_CHECKING([whether XML-Security-C includes C14N 1.1 support])
346 [AC_LANG_PROGRAM([[#include <xsec/dsig/DSIGConstants.hpp>]],
347 [[transformType t = TRANSFORM_C14N11;]])],
348 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_C14N11],[1],[Define to 1 if XML-Security-C includes C14N 1.1 support.])],
349 [AC_MSG_RESULT([no])])
351 AC_MSG_CHECKING([whether XML-Security-C includes debug logging support])
353 [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
354 [[XSECPlatformUtils::SetReferenceLoggingSink(NULL)]])],
355 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_DEBUGLOGGING],[1],[Define to 1 if XML-Security-C includes debug logging support.])],
356 [AC_MSG_RESULT([no])])
358 # restore master libs
362 AC_PATH_PROG(CURL_CONFIG,curl-config)
364 AS_HELP_STRING([--with-curl=PATH], [where curl-config is installed]),
366 CURL_CONFIG="${with_curl}"
367 if ! test -f "${CURL_CONFIG}" ; then
368 CURL_CONFIG="${with_curl}/bin/curl-config"
371 if test -f "${CURL_CONFIG}" ; then
372 CPPFLAGS="`${CURL_CONFIG} --cflags` $CPPFLAGS"
373 XMLSEC_LIBS="`${CURL_CONFIG} --libs` $XMLSEC_LIBS"
375 AC_MSG_ERROR([curl-config not found, may need to use --with-curl option])
378 # save and append master libs
380 LIBS="$XMLSEC_LIBS $LIBS"
382 AC_CHECK_HEADER([curl/curl.h],,AC_MSG_ERROR([unable to find libcurl header files]))
384 [AC_LANG_PROGRAM([[#include <curl/curl.h>]],
385 [[curl_global_init(CURL_GLOBAL_ALL)]])],,
386 [AC_MSG_ERROR([unable to link with libcurl])])
387 AC_MSG_CHECKING([for CURLOPT_SSL_CTX_FUNCTION in curl.h])
388 AC_EGREP_HEADER([CURLOPT_SSL_CTX_FUNCTION], [curl/curl.h],
389 [AC_MSG_RESULT(yes)],
390 [AC_MSG_ERROR([need libcurl that supports CURLOPT_SSL_CTX_FUNCTION])])
391 AC_CHECK_TYPE([curl_off_t],[AC_DEFINE([HAVE_CURL_OFF_T],[1],[Define to 1 if you have the 'curl_off_t' type.])],,[[#include <curl/curl.h>]])
393 # restore master libs
396 AC_SUBST(XMLSEC_LIBS)
398 AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
399 AC_DEFINE([XMLTOOLING_NO_XMLSEC],[1],[Define to 1 if you wish to disable XML-Security-dependent features.])
401 AM_CONDITIONAL(BUILD_XMLSEC,test x_$with_xmlsec != x_no)
403 # Does the STL in use help or screw us?
405 [AC_LANG_PROGRAM([[#include <string>]],[[std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65]])],
406 [AC_DEFINE([HAVE_GOOD_STL],[1],[Define to 1 if you have an STL implementation that supports useful string specialization.])],[])
408 [AC_LANG_PROGRAM([[#include <vector>]],[[std::iterator_traits<std::vector<int>::iterator>::value_type foo=0]])],
409 [AC_DEFINE([HAVE_ITERATOR_TRAITS],[1],[Define to 1 if you have an STL implementation that supports std::iterator_traits.])],[])
411 # Check for unit test support
412 CXXTEST="/usr/bin/cxxtestgen.pl"
415 AS_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
416 [if test x_$with_cxxtest != x_/usr; then
417 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
418 CXXTESTFLAGS="-I${with_cxxtest}"
420 if ! test -f "${CXXTEST}"; then
421 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
425 AC_SUBST(CXXTESTFLAGS)
426 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
428 AX_CREATE_PKGCONFIG_INFO(,,[$XMLSEC_LIBS -lxmltooling],[OpenSAML XMLTooling-C library])
430 LIBTOOL="$LIBTOOL --silent"
432 # output packaging and makefiles