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 # XML-Security settings
228 AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
231 if test x_$with_xmlsec != x_no; then
233 # OpenSSL settings (need to do this first in case it's in a different spot from xmlsec)
235 AC_HELP_STRING([--with-openssl=PATH], [where openssl is installed]),
236 [if test x_$with_openssl != x_/usr; then
237 SSLFLAGS="-I${with_openssl}/include"
238 SSLLIBS="-L${with_openssl}/lib -lcrypto -lssl"
240 SSLLIBS="-lcrypto -lssl"
243 if test "x$SSLLIBS" = "x" ; then
244 AC_PATH_PROG(PKG_CONFIG, pkg-config)
245 if test "x$PKG_CONFIG" != x && test "x$PKG_CONFIG" != "xno" ; then
246 if pkg-config openssl ; then
247 SSLLIBS="`$PKG_CONFIG --libs openssl`"
248 SSLFLAGS="`$PKG_CONFIG --cflags openssl`"
250 AC_MSG_WARN([OpenSSL not supported by pkg-config, try --with-openssl instead])
255 if test "x$SSLLIBS" = "x" ; then
256 SSLLIBS="-lcrypto -lssl"
259 AC_MSG_CHECKING(for OpenSSL cflags)
260 AC_MSG_RESULT($SSLFLAGS)
261 CPPFLAGS="$CPPFLAGS $SSLFLAGS"
262 AC_MSG_CHECKING(for OpenSSL libraries)
263 AC_MSG_RESULT($SSLLIBS)
264 XMLSEC_LIBS="$XMLSEC_LIBS $SSLLIBS"
266 # save and append master libs
268 LIBS="$XMLSEC_LIBS $LIBS"
270 AC_CHECK_HEADER([openssl/pem.h],,
271 AC_MSG_ERROR([unable to find openssl header files]))
272 AC_MSG_CHECKING(for ERR_load_CRYPTO_string)
273 AC_TRY_LINK_FUNC([ERR_load_CRYPTO_strings],,
274 AC_MSG_ERROR([unable to link with openssl libraries]))
277 # restore master libs
280 if test x_$with_xmlsec != x_/usr; then
281 CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
282 LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
284 XMLSEC_LIBS="$XMLSEC_LIBS -lxml-security-c"
286 # save and append master libs
288 LIBS="$XMLSEC_LIBS $LIBS"
290 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
291 AC_MSG_CHECKING([XML-Security version])
293 [AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
294 [#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
297 #error need version 1.4.0 or later
300 [AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
302 [#include <xsec/utils/XSECPlatformUtils.hpp>],
303 [XSECPlatformUtils::Initialise()],,
304 [AC_MSG_ERROR([unable to link with XML-Security])])
305 AC_CHECK_TYPE([xsecsize_t],[AC_DEFINE([HAVE_XSECSIZE_T], [1], [Define to 1 if you have the 'xsecsize_t' type.])])
307 AC_MSG_CHECKING([whether XML-Security-C has multiple CRL support])
308 AC_TRY_COMPILE([#include <xsec/dsig/DSIGKeyInfoList.hpp>],
309 [DSIGKeyInfoList* klist; klist->getX509CRLListSize();],
310 [AC_MSG_RESULT([yes])]
311 [AC_DEFINE([XMLTOOLING_XMLSEC_MULTIPLECRL], [1], [Define to 1 if XML-Security-C handles multiple CRLs.])],
312 [AC_MSG_RESULT([no])])
314 AC_MSG_CHECKING([whether XML-Security-C exposes the signature algorithm URI])
315 AC_TRY_COMPILE([#include <xsec/dsig/DSIGSignature.hpp>],
316 [DSIGSignature* sig; sig->getAlgorithmURI();],
317 [AC_MSG_RESULT([yes])]
318 [AC_DEFINE([XMLTOOLING_XMLSEC_SIGALGORITHM], [1], [Define to 1 if XML-Security-C exposes the signature algorithm URI.])],
319 [AC_MSG_RESULT([no])])
321 # restore master libs
325 AC_PATH_PROG(CURL_CONFIG,curl-config)
327 AC_HELP_STRING([--with-curl=PATH], [where curl-config is installed]),
329 CURL_CONFIG="${with_curl}"
330 if ! test -f "${CURL_CONFIG}" ; then
331 CURL_CONFIG="${with_curl}/bin/curl-config"
334 if test -f "${CURL_CONFIG}" ; then
335 CPPFLAGS="`${CURL_CONFIG} --cflags` $CPPFLAGS"
336 XMLSEC_LIBS="`${CURL_CONFIG} --libs` $XMLSEC_LIBS"
338 AC_MSG_ERROR([curl-config not found, may need to use --with-curl option])
341 # save and append master libs
343 LIBS="$XMLSEC_LIBS $LIBS"
345 AC_CHECK_HEADER([curl/curl.h],,AC_MSG_ERROR([unable to find libcurl header files]))
346 AC_CHECK_LIB([curl],[curl_global_init],,AC_MSG_ERROR([unable to link with libcurl]))
347 AC_MSG_CHECKING([for CURLOPT_SSL_CTX_FUNCTION in curl.h])
348 AC_EGREP_HEADER([CURLOPT_SSL_CTX_FUNCTION], [curl/curl.h],
349 [AC_MSG_RESULT(yes)],
350 [AC_MSG_ERROR([need libcurl that supports CURLOPT_SSL_CTX_FUNCTION])])
351 AC_CHECK_TYPE([curl_off_t],[AC_DEFINE([HAVE_CURL_OFF_T], [1], [Define to 1 if you have the 'curl_off_t' type.])])
353 # restore master libs
356 AC_SUBST(XMLSEC_LIBS)
358 AC_MSG_WARN([xmlsec disabled, building without signature/encryption support])
359 AC_DEFINE([XMLTOOLING_NO_XMLSEC], [1], [Define to 1 if you wish to disable XML-Security-dependent features.])
361 AM_CONDITIONAL(BUILD_XMLSEC,test x_$with_xmlsec != x_no)
363 # Does the STL in use help or screw us?
366 [std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65],
367 [AC_DEFINE([HAVE_GOOD_STL], [1],
368 [Define to 1 if you have an STL implementation that supports useful string specialization.])],
372 [std::iterator_traits<std::vector<int>::iterator>::value_type foo=0],
373 [AC_DEFINE([HAVE_ITERATOR_TRAITS], [1],
374 [Define to 1 if you have an STL implementation that supports std::iterator_traits.])],
377 # Check for unit test support
378 CXXTEST="/usr/bin/cxxtestgen.pl"
381 AC_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
382 [if test x_$with_cxxtest != x_/usr; then
383 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
384 CXXTESTFLAGS="-I${with_cxxtest}"
386 if ! test -f "${CXXTEST}"; then
387 AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
391 AC_SUBST(CXXTESTFLAGS)
392 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
394 AX_CREATE_PKGCONFIG_INFO(,,[$XMLSEC_LIBS -lxmltooling],[OpenSAML XMLTooling-C library])
396 LIBTOOL="$LIBTOOL --silent"
398 # output packaging and makefiles
399 AC_CONFIG_FILES([xmltooling.spec pkginfo Portfile])
400 AC_CONFIG_FILES([Makefile xmltooling/Makefile xmltoolingtest/Makefile schemas/Makefile doc/Makefile])