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"
53 # Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
54 case "${host_cpu}-${host_os}" in
56 if test "$CXX" = "CC" ; then
57 CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
63 # Checks for typedefs, structures, and compiler characteristics.
66 AC_CHECK_SIZEOF([long])
68 # Checks for library functions.
69 AC_CHECK_FUNCS([strchr strdup strstr timegm strcasecmp])
70 AC_CHECK_HEADERS([dlfcn.h])
71 AC_CHECK_FUNC(dlclose, , [ AC_CHECK_LIB(dl, dlopen) ])
74 ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
75 if test $enable_threads != "pthread"; then
76 AC_MSG_ERROR([unable to find pthreads, currently this is required])
78 AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])
79 AM_CONDITIONAL(BUILD_PTHREAD,test "$enable_threads" = "pthread")
80 LIBS="$PTHREAD_LIBS $LIBS"
81 CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
82 CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
85 AC_CHECK_FUNCS([pthread_rwlock_init])
98 # are covariant methods allowed?
100 [AC_LANG_PROGRAM([[]],
102 class base { public: virtual base *GetPtr( void ) { return this; } };
103 class derived: virtual public base { public: virtual derived *GetPtr( void ) { return this; } };
105 [AC_DEFINE([HAVE_COVARIANT_RETURNS],[1],[Define to 1 if C++ compiler supports covariant virtual methods.])])
107 # is nullptr supported?
109 [AC_LANG_PROGRAM([[]],[[const char* ptr = nullptr;]])],
110 [AC_DEFINE([HAVE_NULLPTR],[1],[Define to 1 if C++ compiler supports nullptr keyword.])])
112 # log4shib settings (favor this version over the log4cpp code)
113 AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
114 AC_ARG_WITH(log4shib,
115 AS_HELP_STRING([--with-log4shib=PATH],[where log4shib-config is installed]),
117 LOG4SHIB_CONFIG="${with_log4shib}"
118 if ! test -f "${LOG4SHIB_CONFIG}" ; then
119 LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
122 if test -f "${LOG4SHIB_CONFIG}" ; then
123 LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
124 CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
125 AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
127 [AC_LANG_PROGRAM([[#include <log4shib/Category.hh>
128 #include <log4shib/CategoryStream.hh>]],
129 [[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])],
130 [AC_DEFINE([XMLTOOLING_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
131 [AC_MSG_ERROR([unable to link with log4shib])])
133 AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
134 AC_MSG_WARN([will look for original log4cpp library])
137 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
139 AS_HELP_STRING([--with-log4cpp=PATH],[where log4cpp-config is installed]),
141 LOG4CPP_CONFIG="${with_log4cpp}"
142 if ! test -f "${LOG4CPP_CONFIG}" ; then
143 LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
146 if test -f "${LOG4CPP_CONFIG}"; then
147 AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
148 LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
149 CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
150 AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
152 [AC_LANG_PROGRAM([[#include <log4cpp/Category.hh>
153 #include <log4cpp/CategoryStream.hh>]],
154 [[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])],
155 [AC_DEFINE([XMLTOOLING_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])],
156 [AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
158 AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
164 AS_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
165 [if test x_$with_xerces != x_/usr; then
166 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
167 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
169 LIBS="-lxerces-c $LIBS"
170 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
171 AC_MSG_CHECKING([Xerces version])
173 [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
174 [#if _XERCES_VERSION != 20600
177 #error cannot use version 2.6.0
180 [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
182 [AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],
183 [[xercesc::XMLPlatformUtils::Initialize()]])],
184 ,[AC_MSG_ERROR([unable to link with Xerces])])
186 AC_MSG_CHECKING([whether Xerces is 64-bit clean])
188 [AC_LANG_PROGRAM([[#include <xercesc/framework/MemBufInputSource.hpp>]],
189 [[using namespace XERCES_CPP_NAMESPACE; XMLFilePos testvar;]])],
190 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_64BITSAFE],[1],[Define to 1 if Xerces has a 64-bit-safe API.])],
191 [AC_MSG_RESULT([no])])
193 AC_MSG_CHECKING([whether Xerces BinInputStream requires getContentType])
195 [AC_LANG_PROGRAM([[#include <xercesc/util/BinMemInputStream.hpp>]],
196 [[using namespace XERCES_CPP_NAMESPACE; XMLByte buf[1024]; BinMemInputStream in(buf,1024); in.getContentType();]])],
197 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_INPUTSTREAM_HAS_CONTENTTYPE],[1],[Define to 1 if Xerces InputStream class requires getContentType.])],
198 [AC_MSG_RESULT([no])])
200 AC_MSG_CHECKING([whether Xerces DOMLS API is compliant])
202 [AC_LANG_PROGRAM([[#include <xercesc/dom/DOM.hpp>]],
203 [[using namespace XERCES_CPP_NAMESPACE;
204 DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(NULL);
205 DOMLSSerializer *ls = ((DOMImplementationLS*)impl)->createLSSerializer();]])],
206 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_COMPLIANT_DOMLS],[1],[Define to 1 if Xerces supports a compliant DOMLS API.])],
207 [AC_MSG_RESULT([no])])
209 AC_MSG_CHECKING([whether Xerces has setIdAttribute(XMLCh*, bool)])
211 [AC_LANG_PROGRAM([[#include <xercesc/dom/DOM.hpp>]],
212 [[using namespace XERCES_CPP_NAMESPACE; DOMElement * elt; elt->setIdAttribute(NULL, false);]])],
213 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_BOOLSETIDATTRIBUTE],[1],[Define to 1 if Xerces DOM ID methods take extra parameter.])],
214 [AC_MSG_RESULT([no])])
216 AC_MSG_CHECKING([whether Xerces XMLString::release(XMLByte**) exists])
218 [AC_LANG_PROGRAM([[#include <xercesc/util/XMLString.hpp>]],
219 [[using namespace XERCES_CPP_NAMESPACE; XMLByte* buf=NULL; XMLString::release(&buf);]])],
220 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XERCESC_HAS_XMLBYTE_RELEASE],[1],[Define to 1 if Xerces XMLString includes XMLByte release.])],
221 [AC_MSG_RESULT([no])])
223 # XML-Security settings
225 AS_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
228 if test x_$with_xmlsec != x_no; then
230 # OpenSSL settings (need to do this first in case it's in a different spot from xmlsec)
232 AS_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
233 [if test x_$with_openssl != x_/usr; then
234 SSLFLAGS="-I${with_openssl}/include"
235 SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl"
237 SSLLIBS="-lcrypto -lssl"
240 if test "x$SSLLIBS" = "x" ; then
241 AC_PATH_PROG(PKG_CONFIG, pkg-config)
242 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
243 if pkg-config openssl ; then
244 SSLLIBS="`$PKG_CONFIG --libs openssl`"
245 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
247 AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
252 if test "x$SSLLIBS" = "x" ; then
253 SSLLIBS="-lcrypto -lssl"
256 AC_MSG_CHECKING(for OpenSSL cflags)
257 AC_MSG_RESULT($SSLFLAGS)
258 CPPFLAGS="$CPPFLAGS $SSLFLAGS"
259 AC_MSG_CHECKING(for OpenSSL libraries)
260 AC_MSG_RESULT($SSLLIBS)
261 XMLSEC_LIBS="$XMLSEC_LIBS $SSLLIBS"
263 # save and append master libs
265 LIBS="$XMLSEC_LIBS $LIBS"
267 AC_CHECK_HEADER([openssl/pem.h],,AC_MSG_ERROR([unable to find openssl header files]))
268 AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
269 AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,AC_MSG_ERROR([unable to link with openssl libraries]))
272 AC_CHECK_DECL(EVP_sha512,
273 [AC_DEFINE([XMLTOOLING_OPENSSL_HAVE_SHA2],[1],[Define to 1 if OpenSSL supports the SHA-2 hash family.])],
274 ,[#include <openssl/evp.h>])
275 AC_CHECK_DECL(EVP_PKEY_set1_EC_KEY,
276 [AC_DEFINE([XMLTOOLING_OPENSSL_HAVE_EC],[1],[Define to 1 if OpenSSL has EC support.])],
277 ,[#include <openssl/evp.h>])
279 # restore master libs
282 if test x_$with_xmlsec != x_/usr; then
283 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
284 XMLSEC_LIBS="$XMLSEC_LIBS -L${with_xmlsec}/lib"
286 XMLSEC_LIBS="$XMLSEC_LIBS -lxml-security-c"
288 # save and append master libs
290 LIBS="$XMLSEC_LIBS $LIBS"
292 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
293 AC_MSG_CHECKING([XML-Security version])
295 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
296 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
299 #error need version 1.4.0 or later
302 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
305 [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
306 [[XSECPlatformUtils::Initialise()]])],,
307 [AC_MSG_ERROR([unable to link with XML-Security])])
308 AC_CHECK_TYPE([xsecsize_t],[AC_DEFINE([HAVE_XSECSIZE_T],[1],[Define to 1 if you have the 'xsecsize_t' type.])])
310 AC_MSG_CHECKING([whether XML-Security-C has multiple CRL support])
312 [AC_LANG_PROGRAM([[#include <xsec/dsig/DSIGKeyInfoX509.hpp>]],
313 [[DSIGKeyInfoX509* klist; klist->getX509CRLListSize();]])],
314 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_MULTIPLECRL],[1],[Define to 1 if XML-Security-C handles multiple CRLs.])],
315 [AC_MSG_RESULT([no])])
317 AC_MSG_CHECKING([whether XML-Security-C exposes the signature algorithm URI])
319 [AC_LANG_PROGRAM([[#include <xsec/dsig/DSIGSignature.hpp>]],
320 [[DSIGSignature* sig; sig->getAlgorithmURI();]])],
321 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_SIGALGORITHM],[1],[Define to 1 if XML-Security-C exposes the signature algorithm URI.])],
322 [AC_MSG_RESULT([no])])
324 AC_MSG_CHECKING([whether XML-Security-C includes ECC support])
326 [AC_LANG_PROGRAM([[#include <xsec/dsig/DSIGKeyInfoValue.hpp>]],
327 [[DSIGKeyInfoValue* info; info->getECNamedCurve();]])],
328 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_ECC],[1],[Define to 1 if XML-Security-C includes ECC support.])],
329 [AC_MSG_RESULT([no])])
331 AC_MSG_CHECKING([whether XML-Security-C includes C14N 1.1 support])
333 [AC_LANG_PROGRAM([[#include <xsec/dsig/DSIGConstants.hpp>]],
334 [[transformType t = TRANSFORM_C14N11;]])],
335 [AC_MSG_RESULT([yes])AC_DEFINE([XMLTOOLING_XMLSEC_C14N11],[1],[Define to 1 if XML-Security-C includes C14N 1.1 support.])],
336 [AC_MSG_RESULT([no])])
338 AC_MSG_CHECKING([whether XML-Security-C includes debug logging support])
340 [AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
341 [[XSECPlatformUtils::SetReferenceLoggingSink(NULL)]])],
342 [AC_MSG_RESULT([yes])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 AS_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?
389 [AC_LANG_PROGRAM([[#include <string>]],[[std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65]])],
390 [AC_DEFINE([HAVE_GOOD_STL],[1],[Define to 1 if you have an STL implementation that supports useful string specialization.])],[])
392 [AC_LANG_PROGRAM([[#include <vector>]],[[std::iterator_traits<std::vector<int>::iterator>::value_type foo=0]])],
393 [AC_DEFINE([HAVE_ITERATOR_TRAITS],[1],[Define to 1 if you have an STL implementation that supports std::iterator_traits.])],[])
395 # Check for unit test support
396 CXXTEST="/usr/bin/cxxtestgen.pl"
399 AS_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
400 [if test x_$with_cxxtest != x_/usr; then
401 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
402 CXXTESTFLAGS="-I${with_cxxtest}"
404 if ! test -f "${CXXTEST}"; then
405 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
409 AC_SUBST(CXXTESTFLAGS)
410 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
412 AX_CREATE_PKGCONFIG_INFO(,,[$XMLSEC_LIBS -lxmltooling],[OpenSAML XMLTooling-C library])
414 LIBTOOL="$LIBTOOL --silent"
416 # output packaging and makefiles